Abstract base class for renderables based on dynamically growing vertex and index buffers.
More...
#include <visualization/3d/DynamicRenderable.h>
Abstract base class for renderables based on dynamically growing vertex and index buffers.
The usage is as follows:
- call initialize() once, to create all necessary components and to provide the type of render operations, the layout of the vertex buffer and specify whether to use an index buffer or not.
- call prepareBuffers() to specify the size of the vertex and index buffer
- fill in the vertex and index buffers, which can be obtained using the getVertexBuffer() and getIndexBuffer() methods.
- set the bounding box of the Renderable using the setBoundingBox() method.
- continue at 2 or 3, whenever the content needs to be updated.
◆ Flags
Flags that can be specified in prepareHardwareBuffers().
Enumerator |
---|
NONE | |
INDEX_BUFFER_32BIT | create a 32bit index buffer instead of 16bit
|
◆ DynamicRenderable()
◆ ~DynamicRenderable()
◆ initialize()
void initialize |
( |
Ogre::RenderOperation::OperationType |
operationType, |
|
|
const Ogre::VertexDeclaration & |
vertexDecl, |
|
|
bool |
useIndices |
|
) |
| |
Initializes the dynamic renderable.
This function should only be only called once! It initializes all necessary structures and specifies the operation type (triangle list, fan, etc), the vertex declaration (vertex,normals,texturecoords) and specifies, whether to use an index buffer or not.
- Parameters
-
operationType | The type of render operation to perform. |
vertexDecl | The vertex declaration describing the content of the vertex buffer |
useIndices | Specifies whether to use an index buffer or not |
◆ setOperationType()
void setOperationType |
( |
Ogre::RenderOperation::OperationType |
operationType | ) |
|
Allows to change the operation type after calling initialize.
◆ enableIndexBuffer()
void enableIndexBuffer |
( |
bool |
enable = true | ) |
|
Allows to enable/disable the index buffer, after initialize() was already called.
Note, that you can enable the index buffer only, is the parameter useIndices in the call to initialize() was set true. Otherwise, this method will throw an exception here.
◆ MIRA_ENUM_TO_FLAGS_INCLASS()
MIRA_ENUM_TO_FLAGS_INCLASS |
( |
Flags |
| ) |
|
◆ prepareBuffers()
void prepareBuffers |
( |
size_t |
vertexCount, |
|
|
size_t |
indexCount = 0 , |
|
|
Flags |
flags = NONE , |
|
|
Ogre::HardwareBuffer::Usage |
usage = Ogre::HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY |
|
) |
| |
Prepares the hardware buffers for the requested vertex and index counts.
This function must be called at least once before locking the buffers to fill in data. It guarantees that the hardware buffers are large enough to hold at least the requested number of vertices and indices (if using indices). The buffers are possibly reallocated to achieve this. This method can be called more than once to increase the size of the buffers, if necessary.
- Parameters
-
vertexCount | The number of vertices the buffer must hold. |
indexCount | The number of indices the buffer must hold. This parameter is ignored if not using indices. |
◆ updateVertexCount()
void updateVertexCount |
( |
size_t |
vertexCount | ) |
|
Update the count of vertices actually filled into the buffer.
You should use this if the number of vertices that were eventually filled into the buffer is smaller than the initial count used with prepareBuffers, in order to avoid rendering uninitialized data. Make sure it is not greater than the vertexCount used in the call to prepareBuffers!
◆ getVertexBuffer()
Ogre::HardwareVertexBufferSharedPtr getVertexBuffer |
( |
unsigned short |
index = 0 | ) |
|
Gets the vertex buffer bound to the given source index.
◆ getIndexBuffer()
Ogre::HardwareIndexBufferSharedPtr getIndexBuffer |
( |
| ) |
|
Gets the index buffer of this renderable (or NULL, if no index buffer was created)
◆ getBoundingRadius()
virtual Ogre::Real getBoundingRadius |
( |
void |
| ) |
const |
|
virtual |
Implementation of Ogre::SimpleRenderable.
◆ getSquaredViewDepth()
virtual Ogre::Real getSquaredViewDepth |
( |
const Ogre::Camera * |
cam | ) |
const |
|
virtual |
Implementation of Ogre::SimpleRenderable.
◆ _updateRenderQueue()
virtual void _updateRenderQueue |
( |
Ogre::RenderQueue * |
queue | ) |
|
|
inlinevirtual |
◆ mVertexBufferCapacity
size_t mVertexBufferCapacity |
|
protected |
Maximum capacity of the currently allocated vertex buffer.
◆ mIndexBufferCapacity
size_t mIndexBufferCapacity |
|
protected |
Maximum capacity of the currently allocated index buffer.
The documentation for this class was generated from the following file: