chai3d::cGenericArray Class Reference

This class implements an abstract class for describing geometrical elements composed of vertices. More...

#include <CGenericArray.h>

Inheritance diagram for chai3d::cGenericArray:

Public Member Functions

 cGenericArray (cVertexArrayPtr a_vertexArray)
 
 ~cGenericArray ()
 
virtual void clear ()
 This method clear all elements of array. More...
 
virtual unsigned int getNumElements ()
 This method returns the number of allocated elements. More...
 
virtual unsigned int getNumVerticesPerElement ()
 This method returns the number of vertices per element. More...
 
void compress ()
 This method removes non used elements. This compresses the array. More...
 
bool getAllocated (const unsigned int a_index) const
 
virtual unsigned int getVertexIndex (const unsigned int a_elementIndex, const unsigned int a_vertexNumber) const
 
cVector3d getTexCoordAtPosition (const unsigned int a_elementIndex, const cVector3d &a_localPos)
 
virtual void render ()
 This method render the OpenGL vertex buffer object. More...
 
virtual bool computeCollision (const unsigned int a_elementIndex, cGenericObject *a_object, cVector3d &a_segmentPointA, cVector3d &a_segmentPointB, cCollisionRecorder &a_recorder, cCollisionSettings &a_settings) const
 This method checks if the given line segment intersects a selected element from this array. More...
 

Static Public Member Functions

static cGenericArrayPtr create (cVertexArrayPtr a_vertexArray)
 Shared cGenericArray allocator. More...
 

Public Attributes

cVertexArrayPtr m_vertices
 Vertex array that contains all vertices used to describe the elements of this array. More...
 
std::vector< unsigned int > m_indices
 Element indices to vertices. More...
 
std::vector< bool > m_allocated
 Element allocation flags. More...
 
bool m_flagMarkForUpdate
 If true then element data has been modified. More...
 
bool m_flagMarkForResize
 If true then element array size has changed. More...
 
GLuint m_elementBuffer
 OpenGL Buffer for storing elements. More...
 

Protected Attributes

std::list< unsigned int > m_freeElements
 List of free elements. More...
 

Detailed Description

cGenericArray implements an abstract class for describing geometrical elements composed of vertices.
Example of elements include points, segments, or triangles. Each element shall be composed on one or more vertices (point=1, segment=2, triangle=3).

Constructor & Destructor Documentation

chai3d::cGenericArray::cGenericArray ( cVertexArrayPtr  a_vertexArray)
inline

Constructor of cGenericArray.

Parameters
a_vertexArrayArray of vertices used to describe the elements.
chai3d::cGenericArray::~cGenericArray ( )
inline

Destructor of cGenericArray.

Member Function Documentation

virtual void chai3d::cGenericArray::clear ( )
inlinevirtual
static cGenericArrayPtr chai3d::cGenericArray::create ( cVertexArrayPtr  a_vertexArray)
inlinestatic
virtual unsigned int chai3d::cGenericArray::getNumElements ( )
inlinevirtual
virtual unsigned int chai3d::cGenericArray::getNumVerticesPerElement ( )
inlinevirtual
void chai3d::cGenericArray::compress ( )
bool chai3d::cGenericArray::getAllocated ( const unsigned int  a_index) const
inline

Is the element passed by argument currently allocated.

Returns
true if the element is allocated, false otherwise.
virtual unsigned int chai3d::cGenericArray::getVertexIndex ( const unsigned int  a_elementIndex,
const unsigned int  a_vertexNumber 
) const
inlinevirtual

This method returns the index number of a vertex for a selected element. The element is identified by passing its index number as argument. The vertex is selected by passing its vertex number. For a triangle. this number shall be 0,1, or 2.

Parameters
a_elementIndexIndex number of the element.
a_vertexNumberVertex number.
Returns
Index number to the requested vertex.

Reimplemented in chai3d::cTriangleArray, chai3d::cSegmentArray, and chai3d::cPointArray.

cVector3d chai3d::cGenericArray::getTexCoordAtPosition ( const unsigned int  a_elementIndex,
const cVector3d a_localPos 
)
inline

This method returns the texture coordinate at the nearest point on the element from an input location.

Parameters
a_elementIndexIndex number of selected element.
a_localPosLocation of point on element.
Returns
Interpolated texture coordinate at desired location.
virtual void chai3d::cGenericArray::render ( )
inlinevirtual
virtual bool chai3d::cGenericArray::computeCollision ( const unsigned int  a_elementIndex,
cGenericObject a_object,
cVector3d a_segmentPointA,
cVector3d a_segmentPointB,
cCollisionRecorder a_recorder,
cCollisionSettings a_settings 
) const
inlinevirtual

Member Data Documentation

cVertexArrayPtr chai3d::cGenericArray::m_vertices
std::vector<unsigned int> chai3d::cGenericArray::m_indices
std::vector<bool> chai3d::cGenericArray::m_allocated
bool chai3d::cGenericArray::m_flagMarkForUpdate
bool chai3d::cGenericArray::m_flagMarkForResize
GLuint chai3d::cGenericArray::m_elementBuffer
std::list<unsigned int> chai3d::cGenericArray::m_freeElements
protected

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