This class implements an abstract class for describing geometrical elements composed of vertices. More...
#include <CGenericArray.h>
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... | |
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).
|
inline |
Constructor of cGenericArray.
a_vertexArray | Array of vertices used to describe the elements. |
|
inline |
Destructor of cGenericArray.
|
inlinevirtual |
Reimplemented in chai3d::cPointArray, chai3d::cTriangleArray, and chai3d::cSegmentArray.
|
inlinestatic |
|
inlinevirtual |
|
inlinevirtual |
Reimplemented in chai3d::cPointArray, chai3d::cTriangleArray, and chai3d::cSegmentArray.
void chai3d::cGenericArray::compress | ( | ) |
|
inline |
Is the element passed by argument currently allocated.
|
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.
a_elementIndex | Index number of the element. |
a_vertexNumber | Vertex number. |
Reimplemented in chai3d::cTriangleArray, chai3d::cSegmentArray, and chai3d::cPointArray.
|
inline |
This method returns the texture coordinate at the nearest point on the element from an input location.
a_elementIndex | Index number of selected element. |
a_localPos | Location of point on element. |
|
inlinevirtual |
Reimplemented in chai3d::cSegmentArray, and chai3d::cPointArray.
|
inlinevirtual |
Reimplemented in chai3d::cTriangleArray, chai3d::cSegmentArray, and chai3d::cPointArray.
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 |
|
protected |