vrsode::TriangleData Class Reference

Creates and destroys a Triangle Data object which is used to store Trimesh data. More...

#include <TriangleData.h>

Inheritance diagram for vrsode::TriangleData:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 TriangleData (unsigned int vertexCount, unsigned int indexCount)
 ctor allocating memory for a given amount of vertices and indices.
virtual ~TriangleData ()
void addVertex (VRS::Vector3Base< VO_TRIMESH_COORD_TYPE >)
 adds a vertex to this triangle data.
void addVertex (VO_TRIMESH_COORD_TYPE, VO_TRIMESH_COORD_TYPE, VO_TRIMESH_COORD_TYPE)
 adds a vertex to this triangle data.
void addIndex (VRS::Vector3Base< VO_TRIMESH_INDEX_TYPE >)
 adds an index to this triangle data.
void addIndex (VO_TRIMESH_INDEX_TYPE, VO_TRIMESH_INDEX_TYPE, VO_TRIMESH_INDEX_TYPE)
 adds an index to this triangle data.
void addTriangle (VRS::Vector3Base< VO_TRIMESH_COORD_TYPE >, VRS::Vector3Base< VO_TRIMESH_COORD_TYPE >, VRS::Vector3Base< VO_TRIMESH_COORD_TYPE >)
 adds a triangle with no shared vertices.
void addTriangle (VO_TRIMESH_COORD_TYPE, VO_TRIMESH_COORD_TYPE, VO_TRIMESH_COORD_TYPE, VO_TRIMESH_COORD_TYPE, VO_TRIMESH_COORD_TYPE, VO_TRIMESH_COORD_TYPE, VO_TRIMESH_COORD_TYPE, VO_TRIMESH_COORD_TYPE, VO_TRIMESH_COORD_TYPE)
 adds a triangle with no shared vertices.
void addQuad (VRS::Vector3Base< VO_TRIMESH_COORD_TYPE >, VRS::Vector3Base< VO_TRIMESH_COORD_TYPE >, VRS::Vector3Base< VO_TRIMESH_COORD_TYPE >, VRS::Vector3Base< VO_TRIMESH_COORD_TYPE >)
 adds a quad with no shared vertices.
void addQuad (VO_TRIMESH_COORD_TYPE, VO_TRIMESH_COORD_TYPE, VO_TRIMESH_COORD_TYPE, VO_TRIMESH_COORD_TYPE, VO_TRIMESH_COORD_TYPE, VO_TRIMESH_COORD_TYPE, VO_TRIMESH_COORD_TYPE, VO_TRIMESH_COORD_TYPE, VO_TRIMESH_COORD_TYPE, VO_TRIMESH_COORD_TYPE, VO_TRIMESH_COORD_TYPE, VO_TRIMESH_COORD_TYPE)
 adds a quad with no shared vertices.
const std::vector< VRS::Vector3Base<
double > > 
explicitVertexList () const
 returns a pure vertex array, no index needed, vertices shared over triangles are copied for each triangle.
const std::vector< VRS::Vector3Base<
double > > 
explicitVertexListForLines () const
 Retuns a list of vertives which can be directly passed to a VRS::PolygonSet of type Lines, so you can see the realy triangles as debug body.
VO_TRIMESH_COORD_TYPE * vertexArray ()
 returns a pointer to the internal vertex array
VO_TRIMESH_INDEX_TYPE * indexArray ()
 returns a pointer to the internal index array
unsigned int vertexCount () const
 returns the number of registered vertices.
unsigned int indexCount () const
 returns the number if registered indices.
unsigned int triangleCount () const
 returns the number of registered triangles (triangles * 3 = indices)
void createDebugCube ()
 fills this triangle data with cube data for debugging purposes.
void createDebugThing ()
 fills this triangle data with some strange object for debuggind purpose.
unsigned int sizeOfVertexStride ()
 return the data size of one vertex (3 vertices)
unsigned int sizeOfTriangleStride ()
 return the data size of one triangle (3 indices)
void setGeometryChangeCallback (VRS::SO< TrimeshShape >, void(TrimeshShape::*)())
 registers a callback function which will be invoked on geometry change
void reportGeometryChange ()
 reports a geometry change to the containing trimesh shape in order to regenerate the trimesh structure.
void initDataUpdate (unsigned int vertexCount, unsigned int indexCount)
 start to fill new triangle data.
void initDataUpdateKeepCurrent ()
 start to change triangle data.
void rollbackDataUpdate ()
 revert a data update.
void commitDataUpdate ()
 commit a data update.
VO_TRIMESH_COORD_TYPE * uncommittedVertexArray ()
 returns a pointer to the uncommitted vertex array.
VO_TRIMESH_INDEX_TYPE * uncommittedIndexArray ()
 returns a pointer to the uncommitted index array.
void dump ()
 dumps the triangle data to stdout.
void setVertexArrayFill (unsigned int fill)
 sets the vertex array fill manually.
void setIndexArrayFill (unsigned int fill)
 sets the index array fill manually.

Private Member Functions

void cleanInactivePool ()
 cleans the inactive datapool, freeing resources, resetting values.

Private Attributes

bool m_activeDataPool
unsigned int m_vertexArraySize [2]
unsigned int m_indexArraySize [2]
unsigned int m_vertexArrayFill [2]
unsigned int m_indexArrayFill [2]
VO_TRIMESH_COORD_TYPE * m_vertexArray [2]
VO_TRIMESH_INDEX_TYPE * m_indexArray [2]
VRS::SO< TrimeshShapem_callbackShape
void(TrimeshShape::* m_callbackFunction )()

Detailed Description

Creates and destroys a Triangle Data object which is used to store Trimesh data.

Definition at line 22 of file TriangleData.h.


Constructor & Destructor Documentation

vrsode::TriangleData::TriangleData ( unsigned int  vertexCount,
unsigned int  indexCount 
)

ctor allocating memory for a given amount of vertices and indices.

Note:
one vertex means 3 floating point values. one index means one integer pointing to one vertex.

Definition at line 8 of file TriangleData.cpp.

References m_activeDataPool, m_callbackFunction, m_callbackShape, m_indexArray, m_indexArrayFill, m_indexArraySize, m_vertexArray, m_vertexArrayFill, m_vertexArraySize, VO_TRIMESH_COORD_TYPE, and VO_TRIMESH_INDEX_TYPE.

vrsode::TriangleData::~TriangleData (  )  [virtual]

Definition at line 39 of file TriangleData.cpp.

References m_activeDataPool, m_indexArray, and m_vertexArray.


Member Function Documentation

void vrsode::TriangleData::cleanInactivePool (  )  [private]

cleans the inactive datapool, freeing resources, resetting values.

Definition at line 321 of file TriangleData.cpp.

References m_activeDataPool, m_indexArray, m_indexArrayFill, m_indexArraySize, m_vertexArray, m_vertexArrayFill, and m_vertexArraySize.

Referenced by commitDataUpdate(), initDataUpdate(), and rollbackDataUpdate().

Here is the caller graph for this function:

void vrsode::TriangleData::addVertex ( VRS::Vector3Base< VO_TRIMESH_COORD_TYPE >   ) 

adds a vertex to this triangle data.

Definition at line 46 of file TriangleData.cpp.

Referenced by addTriangle(), createDebugCube(), and createDebugThing().

Here is the caller graph for this function:

void vrsode::TriangleData::addVertex ( VO_TRIMESH_COORD_TYPE  ,
VO_TRIMESH_COORD_TYPE  ,
VO_TRIMESH_COORD_TYPE   
)

adds a vertex to this triangle data.

Definition at line 52 of file TriangleData.cpp.

References m_activeDataPool, m_vertexArray, m_vertexArrayFill, and m_vertexArraySize.

void vrsode::TriangleData::addIndex ( VRS::Vector3Base< VO_TRIMESH_INDEX_TYPE >   ) 

adds an index to this triangle data.

Definition at line 68 of file TriangleData.cpp.

Referenced by addTriangle(), createDebugCube(), and createDebugThing().

Here is the caller graph for this function:

void vrsode::TriangleData::addIndex ( VO_TRIMESH_INDEX_TYPE  ,
VO_TRIMESH_INDEX_TYPE  ,
VO_TRIMESH_INDEX_TYPE   
)

adds an index to this triangle data.

Definition at line 74 of file TriangleData.cpp.

References m_activeDataPool, m_indexArray, m_indexArrayFill, and m_indexArraySize.

void vrsode::TriangleData::addTriangle ( VRS::Vector3Base< VO_TRIMESH_COORD_TYPE >  ,
VRS::Vector3Base< VO_TRIMESH_COORD_TYPE >  ,
VRS::Vector3Base< VO_TRIMESH_COORD_TYPE >   
)

adds a triangle with no shared vertices.

provided for convenience.

Definition at line 90 of file TriangleData.cpp.

References addIndex(), addVertex(), m_activeDataPool, and m_vertexArrayFill.

Referenced by addQuad(), and addTriangle().

Here is the call graph for this function:

Here is the caller graph for this function:

void vrsode::TriangleData::addTriangle ( VO_TRIMESH_COORD_TYPE  ,
VO_TRIMESH_COORD_TYPE  ,
VO_TRIMESH_COORD_TYPE  ,
VO_TRIMESH_COORD_TYPE  ,
VO_TRIMESH_COORD_TYPE  ,
VO_TRIMESH_COORD_TYPE  ,
VO_TRIMESH_COORD_TYPE  ,
VO_TRIMESH_COORD_TYPE  ,
VO_TRIMESH_COORD_TYPE   
)

adds a triangle with no shared vertices.

provided for convenience.

Definition at line 104 of file TriangleData.cpp.

References addTriangle().

Here is the call graph for this function:

void vrsode::TriangleData::addQuad ( VRS::Vector3Base< VO_TRIMESH_COORD_TYPE >  ,
VRS::Vector3Base< VO_TRIMESH_COORD_TYPE >  ,
VRS::Vector3Base< VO_TRIMESH_COORD_TYPE >  ,
VRS::Vector3Base< VO_TRIMESH_COORD_TYPE >   
)

adds a quad with no shared vertices.

Definition at line 118 of file TriangleData.cpp.

References addTriangle().

Here is the call graph for this function:

void vrsode::TriangleData::addQuad ( VO_TRIMESH_COORD_TYPE  ,
VO_TRIMESH_COORD_TYPE  ,
VO_TRIMESH_COORD_TYPE  ,
VO_TRIMESH_COORD_TYPE  ,
VO_TRIMESH_COORD_TYPE  ,
VO_TRIMESH_COORD_TYPE  ,
VO_TRIMESH_COORD_TYPE  ,
VO_TRIMESH_COORD_TYPE  ,
VO_TRIMESH_COORD_TYPE  ,
VO_TRIMESH_COORD_TYPE  ,
VO_TRIMESH_COORD_TYPE  ,
VO_TRIMESH_COORD_TYPE   
)

adds a quad with no shared vertices.

Definition at line 129 of file TriangleData.cpp.

References addTriangle().

Here is the call graph for this function:

const std::vector< VRS::Vector3Base< double > > vrsode::TriangleData::explicitVertexList (  )  const

returns a pure vertex array, no index needed, vertices shared over triangles are copied for each triangle.

Definition at line 175 of file TriangleData.cpp.

References indexCount(), m_activeDataPool, m_indexArray, and m_vertexArray.

Here is the call graph for this function:

const std::vector< VRS::Vector3Base< double > > vrsode::TriangleData::explicitVertexListForLines (  )  const

Retuns a list of vertives which can be directly passed to a VRS::PolygonSet of type Lines, so you can see the realy triangles as debug body.

Definition at line 193 of file TriangleData.cpp.

References indexCount(), m_activeDataPool, m_indexArray, and m_vertexArray.

Here is the call graph for this function:

VO_TRIMESH_COORD_TYPE * vrsode::TriangleData::vertexArray (  ) 

returns a pointer to the internal vertex array

Definition at line 144 of file TriangleData.cpp.

References m_activeDataPool, and m_vertexArray.

VO_TRIMESH_INDEX_TYPE * vrsode::TriangleData::indexArray (  ) 

returns a pointer to the internal index array

Definition at line 150 of file TriangleData.cpp.

References m_activeDataPool, and m_indexArray.

unsigned int vrsode::TriangleData::vertexCount (  )  const

returns the number of registered vertices.

Definition at line 156 of file TriangleData.cpp.

References m_activeDataPool, and m_vertexArrayFill.

Referenced by dump().

Here is the caller graph for this function:

unsigned int vrsode::TriangleData::indexCount (  )  const

returns the number if registered indices.

Definition at line 162 of file TriangleData.cpp.

References m_activeDataPool, and m_indexArrayFill.

Referenced by explicitVertexList(), and explicitVertexListForLines().

Here is the caller graph for this function:

unsigned int vrsode::TriangleData::triangleCount (  )  const

returns the number of registered triangles (triangles * 3 = indices)

Definition at line 168 of file TriangleData.cpp.

References m_activeDataPool, and m_indexArrayFill.

void vrsode::TriangleData::createDebugCube (  ) 

fills this triangle data with cube data for debugging purposes.

Definition at line 378 of file TriangleData.cpp.

References addIndex(), and addVertex().

Here is the call graph for this function:

void vrsode::TriangleData::createDebugThing (  ) 

fills this triangle data with some strange object for debuggind purpose.

Definition at line 406 of file TriangleData.cpp.

References addIndex(), and addVertex().

Here is the call graph for this function:

unsigned int vrsode::TriangleData::sizeOfVertexStride (  ) 

return the data size of one vertex (3 vertices)

Definition at line 253 of file TriangleData.cpp.

References VO_TRIMESH_COORD_TYPE.

unsigned int vrsode::TriangleData::sizeOfTriangleStride (  ) 

return the data size of one triangle (3 indices)

Definition at line 259 of file TriangleData.cpp.

References VO_TRIMESH_INDEX_TYPE.

void vrsode::TriangleData::setGeometryChangeCallback ( VRS::SO< TrimeshShape ,
void(TrimeshShape::*)()   
)

registers a callback function which will be invoked on geometry change

Definition at line 265 of file TriangleData.cpp.

References m_callbackFunction, and m_callbackShape.

void vrsode::TriangleData::reportGeometryChange (  ) 

reports a geometry change to the containing trimesh shape in order to regenerate the trimesh structure.

Definition at line 273 of file TriangleData.cpp.

References m_callbackFunction, and m_callbackShape.

Referenced by commitDataUpdate().

Here is the caller graph for this function:

void vrsode::TriangleData::initDataUpdate ( unsigned int  vertexCount,
unsigned int  indexCount 
)

start to fill new triangle data.

Definition at line 280 of file TriangleData.cpp.

References cleanInactivePool(), m_activeDataPool, m_indexArray, m_indexArrayFill, m_indexArraySize, m_vertexArray, m_vertexArrayFill, m_vertexArraySize, VO_TRIMESH_COORD_TYPE, and VO_TRIMESH_INDEX_TYPE.

Referenced by initDataUpdateKeepCurrent().

Here is the call graph for this function:

Here is the caller graph for this function:

void vrsode::TriangleData::initDataUpdateKeepCurrent (  ) 

start to change triangle data.

Definition at line 301 of file TriangleData.cpp.

References initDataUpdate(), m_activeDataPool, m_indexArray, m_indexArrayFill, m_indexArraySize, m_vertexArray, m_vertexArrayFill, m_vertexArraySize, VO_TRIMESH_COORD_TYPE, and VO_TRIMESH_INDEX_TYPE.

Here is the call graph for this function:

void vrsode::TriangleData::rollbackDataUpdate (  ) 

revert a data update.

Definition at line 338 of file TriangleData.cpp.

References cleanInactivePool().

Here is the call graph for this function:

void vrsode::TriangleData::commitDataUpdate (  ) 

commit a data update.

Definition at line 344 of file TriangleData.cpp.

References cleanInactivePool(), m_activeDataPool, and reportGeometryChange().

Here is the call graph for this function:

VO_TRIMESH_COORD_TYPE * vrsode::TriangleData::uncommittedVertexArray (  ) 

returns a pointer to the uncommitted vertex array.

Definition at line 352 of file TriangleData.cpp.

References m_activeDataPool, and m_vertexArray.

VO_TRIMESH_INDEX_TYPE * vrsode::TriangleData::uncommittedIndexArray (  ) 

returns a pointer to the uncommitted index array.

Definition at line 358 of file TriangleData.cpp.

References m_activeDataPool, and m_indexArray.

void vrsode::TriangleData::dump (  ) 

dumps the triangle data to stdout.

Definition at line 364 of file TriangleData.cpp.

References m_activeDataPool, m_vertexArray, and vertexCount().

Here is the call graph for this function:

void vrsode::TriangleData::setVertexArrayFill ( unsigned int  fill  ) 

sets the vertex array fill manually.

fill the amount of vertices, means float values / 3

Definition at line 433 of file TriangleData.cpp.

References m_activeDataPool, and m_vertexArrayFill.

void vrsode::TriangleData::setIndexArrayFill ( unsigned int  fill  ) 

sets the index array fill manually.

fill the amount of indices, means triangles * 3

Definition at line 427 of file TriangleData.cpp.

References m_activeDataPool, and m_indexArrayFill.


Member Data Documentation

bool vrsode::TriangleData::m_activeDataPool [private]

Definition at line 24 of file TriangleData.h.

Referenced by addIndex(), addTriangle(), addVertex(), cleanInactivePool(), commitDataUpdate(), dump(), explicitVertexList(), explicitVertexListForLines(), indexArray(), indexCount(), initDataUpdate(), initDataUpdateKeepCurrent(), setIndexArrayFill(), setVertexArrayFill(), triangleCount(), TriangleData(), uncommittedIndexArray(), uncommittedVertexArray(), vertexArray(), vertexCount(), and ~TriangleData().

unsigned int vrsode::TriangleData::m_vertexArraySize[2] [private]

Definition at line 26 of file TriangleData.h.

Referenced by addVertex(), cleanInactivePool(), initDataUpdate(), initDataUpdateKeepCurrent(), and TriangleData().

unsigned int vrsode::TriangleData::m_indexArraySize[2] [private]

Definition at line 27 of file TriangleData.h.

Referenced by addIndex(), cleanInactivePool(), initDataUpdate(), initDataUpdateKeepCurrent(), and TriangleData().

unsigned int vrsode::TriangleData::m_vertexArrayFill[2] [private]

Definition at line 29 of file TriangleData.h.

Referenced by addTriangle(), addVertex(), cleanInactivePool(), initDataUpdate(), initDataUpdateKeepCurrent(), setVertexArrayFill(), TriangleData(), and vertexCount().

unsigned int vrsode::TriangleData::m_indexArrayFill[2] [private]

Definition at line 30 of file TriangleData.h.

Referenced by addIndex(), cleanInactivePool(), indexCount(), initDataUpdate(), initDataUpdateKeepCurrent(), setIndexArrayFill(), triangleCount(), and TriangleData().

VO_TRIMESH_COORD_TYPE* vrsode::TriangleData::m_vertexArray[2] [private]

Definition at line 32 of file TriangleData.h.

Referenced by addVertex(), cleanInactivePool(), dump(), explicitVertexList(), explicitVertexListForLines(), initDataUpdate(), initDataUpdateKeepCurrent(), TriangleData(), uncommittedVertexArray(), vertexArray(), and ~TriangleData().

VO_TRIMESH_INDEX_TYPE* vrsode::TriangleData::m_indexArray[2] [private]

Definition at line 33 of file TriangleData.h.

Referenced by addIndex(), cleanInactivePool(), explicitVertexList(), explicitVertexListForLines(), indexArray(), initDataUpdate(), initDataUpdateKeepCurrent(), TriangleData(), uncommittedIndexArray(), and ~TriangleData().

VRS::SO<TrimeshShape> vrsode::TriangleData::m_callbackShape [private]

Definition at line 35 of file TriangleData.h.

Referenced by reportGeometryChange(), setGeometryChangeCallback(), and TriangleData().

void(TrimeshShape::* vrsode::TriangleData::m_callbackFunction)() [private]

Referenced by reportGeometryChange(), setGeometryChangeCallback(), and TriangleData().


The documentation for this class was generated from the following files:
Generated on Fri May 11 21:02:19 2007 for Random Racer by  doxygen 1.5.1