MIRA
Classes | Public Types | Public Member Functions | Protected Attributes | List of all members
DynamicPoints Class Reference

#include <visualization/3d/DynamicPoints.h>

Inheritance diagram for DynamicPoints:
Inheritance graph
[legend]

Classes

struct  PointData
 

Public Types

enum  Flags { NONE = 0, INDEX_BUFFER_32BIT = 1 }
 Flags that can be specified in prepareHardwareBuffers(). More...
 

Public Member Functions

 DynamicPoints (OperationType opType=Ogre::RenderOperation::OT_POINT_LIST)
 Constructor - see setOperationType() for description of argument. More...
 
virtual ~DynamicPoints ()
 
void addPoint (const Ogre::Vector3 &p, const Ogre::ColourValue &c)
 Add a point to the point list. More...
 
void addPoint (Real x, Real y, Real z, const Ogre::ColourValue &c)
 Add a point to the point list. More...
 
void setPoint (unsigned short index, const Vector3 &value)
 Change the location of an existing point in the point list. More...
 
const Vector3 & getPoint (unsigned short index) const
 Return the location of an existing point in the point list. More...
 
void setColor (const Ogre::ColourValue &c)
 Change the colour of existing points. More...
 
unsigned short getNumPoints (void) const
 Return the total number of points in the point list. More...
 
void clear ()
 Remove all points from the point list. More...
 
void update ()
 Call this to update the hardware buffer after making changes. More...
 
void setOperationType (OperationType opType)
 Set the type of operation to draw with. More...
 
OperationType getOperationType () const
 
void initialize (Ogre::RenderOperation::OperationType operationType, const Ogre::VertexDeclaration &vertexDecl, bool useIndices)
 Initializes the dynamic renderable. More...
 
void enableIndexBuffer (bool enable=true)
 Allows to enable/disable the index buffer, after initialize() was already called. More...
 
 MIRA_ENUM_TO_FLAGS_INCLASS (Flags)
 
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. More...
 
void updateVertexCount (size_t vertexCount)
 Update the count of vertices actually filled into the buffer. More...
 
Ogre::HardwareVertexBufferSharedPtr getVertexBuffer (unsigned short index=0)
 Gets the vertex buffer bound to the given source index. More...
 
Ogre::HardwareIndexBufferSharedPtr getIndexBuffer ()
 Gets the index buffer of this renderable (or NULL, if no index buffer was created) More...
 
virtual Ogre::Real getBoundingRadius (void) const
 Implementation of Ogre::SimpleRenderable. More...
 
virtual Ogre::Real getSquaredViewDepth (const Ogre::Camera *cam) const
 Implementation of Ogre::SimpleRenderable. More...
 
virtual void _updateRenderQueue (Ogre::RenderQueue *queue)
 

Protected Attributes

size_t mVertexBufferCapacity
 Maximum capacity of the currently allocated vertex buffer. More...
 
size_t mIndexBufferCapacity
 Maximum capacity of the currently allocated index buffer. More...
 

Member Enumeration Documentation

◆ Flags

enum Flags
inherited

Flags that can be specified in prepareHardwareBuffers().

Enumerator
NONE 
INDEX_BUFFER_32BIT 

create a 32bit index buffer instead of 16bit

Constructor & Destructor Documentation

◆ DynamicPoints()

DynamicPoints ( OperationType  opType = Ogre::RenderOperation::OT_POINT_LIST)

Constructor - see setOperationType() for description of argument.

◆ ~DynamicPoints()

virtual ~DynamicPoints ( )
virtual

Member Function Documentation

◆ addPoint() [1/2]

void addPoint ( const Ogre::Vector3 &  p,
const Ogre::ColourValue &  c 
)

Add a point to the point list.

◆ addPoint() [2/2]

void addPoint ( Real  x,
Real  y,
Real  z,
const Ogre::ColourValue &  c 
)

Add a point to the point list.

◆ setPoint()

void setPoint ( unsigned short  index,
const Vector3 &  value 
)

Change the location of an existing point in the point list.

◆ getPoint()

const Vector3& getPoint ( unsigned short  index) const

Return the location of an existing point in the point list.

◆ setColor()

void setColor ( const Ogre::ColourValue &  c)

Change the colour of existing points.

◆ getNumPoints()

unsigned short getNumPoints ( void  ) const

Return the total number of points in the point list.

◆ clear()

void clear ( )

Remove all points from the point list.

◆ update()

void update ( )

Call this to update the hardware buffer after making changes.

◆ setOperationType()

void setOperationType ( OperationType  opType)

Set the type of operation to draw with.

Parameters
opTypeCan be one of
  • RenderOperation::OT_LINE_STRIP
  • RenderOperation::OT_LINE_LIST
  • RenderOperation::OT_POINT_LIST
  • RenderOperation::OT_TRIANGLE_LIST
  • RenderOperation::OT_TRIANGLE_STRIP
  • RenderOperation::OT_TRIANGLE_FAN The default is OT_POINT_LIST.

◆ getOperationType()

OperationType getOperationType ( ) const

◆ initialize()

void initialize ( Ogre::RenderOperation::OperationType  operationType,
const Ogre::VertexDeclaration &  vertexDecl,
bool  useIndices 
)
inherited

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
operationTypeThe type of render operation to perform.
vertexDeclThe vertex declaration describing the content of the vertex buffer
useIndicesSpecifies whether to use an index buffer or not

◆ enableIndexBuffer()

void enableIndexBuffer ( bool  enable = true)
inherited

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  )
inherited

◆ prepareBuffers()

void prepareBuffers ( size_t  vertexCount,
size_t  indexCount = 0,
Flags  flags = NONE,
Ogre::HardwareBuffer::Usage  usage = Ogre::HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY 
)
inherited

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
vertexCountThe number of vertices the buffer must hold.
indexCountThe number of indices the buffer must hold. This parameter is ignored if not using indices.

◆ updateVertexCount()

void updateVertexCount ( size_t  vertexCount)
inherited

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)
inherited

Gets the vertex buffer bound to the given source index.

◆ getIndexBuffer()

Ogre::HardwareIndexBufferSharedPtr getIndexBuffer ( )
inherited

Gets the index buffer of this renderable (or NULL, if no index buffer was created)

◆ getBoundingRadius()

virtual Ogre::Real getBoundingRadius ( void  ) const
virtualinherited

Implementation of Ogre::SimpleRenderable.

◆ getSquaredViewDepth()

virtual Ogre::Real getSquaredViewDepth ( const Ogre::Camera *  cam) const
virtualinherited

Implementation of Ogre::SimpleRenderable.

◆ _updateRenderQueue()

virtual void _updateRenderQueue ( Ogre::RenderQueue *  queue)
inlinevirtualinherited

Member Data Documentation

◆ mVertexBufferCapacity

size_t mVertexBufferCapacity
protectedinherited

Maximum capacity of the currently allocated vertex buffer.

◆ mIndexBufferCapacity

size_t mIndexBufferCapacity
protectedinherited

Maximum capacity of the currently allocated index buffer.


The documentation for this class was generated from the following file: