This class implements array of 3D vertices. More...
#include <CVertexArray.h>
Public Member Functions | |
cVertexArray (const cVertexArrayOptions &a_options) | |
~cVertexArray () | |
void | clear () |
cVertexArrayPtr | copy () |
int | newVertex () |
int | newVertices (unsigned int a_numberOfVertices) |
void | setLocalPos (const unsigned int a_vertexIndex, const double &a_x, const double &a_y, const double &a_z) |
void | setLocalPos (const unsigned int a_vertexIndex, const cVector3d &a_pos) |
void | translate (const unsigned int a_vertexIndex, const cVector3d &a_translation) |
cVector3d | getLocalPos (const unsigned int a_vertexIndex) const |
cVector3d | getGlobalPos (const unsigned int a_vertexIndex) const |
void | setNormal (const unsigned int a_vertexIndex, const cVector3d &a_normal) |
void | setNormal (const unsigned int a_vertexIndex, const double &a_x, const double &a_y, const double &a_z) |
cVector3d | getNormal (const unsigned int a_vertexIndex) const |
void | setTexCoord (const unsigned int a_vertexIndex, const cVector3d &a_texCoord) |
void | setTexCoord (const unsigned int a_vertexIndex, const double &a_tx, const double &a_ty=0.0, const double &a_tz=0.0) |
cVector3d | getTexCoord (const unsigned int a_vertexIndex) const |
void | setColor (const unsigned int a_vertexIndex, const cColorf &a_color) |
void | setColor (const unsigned int a_vertexIndex, const float &a_red, const float &a_green, const float &a_blue, const float &a_alpha=1.0) |
void | setColor (const unsigned int a_vertexIndex, const cColorb &a_color) |
cColorf | getColor (const unsigned int a_vertexIndex) const |
void | setTangent (const unsigned int a_vertexIndex, const cVector3d &a_tangent) |
void | setTangent (const unsigned int a_vertexIndex, const double &a_x, const double &a_y, const double &a_z) |
cVector3d | getTangent (const unsigned int a_vertexIndex) const |
void | setBitangent (const unsigned int a_vertexIndex, const cVector3d &a_bitangent) |
void | setBitangent (const unsigned int a_vertexIndex, const double &a_x, const double &a_y, const double &a_z) |
cVector3d | getBitangent (const unsigned int a_vertexIndex) const |
void | setUserData (const unsigned int a_vertexIndex, const int a_userData) |
int | getUserData (const unsigned int a_vertexIndex) const |
void | computeGlobalPosition (const unsigned int a_vertexIndex, const cVector3d &a_globalPos, const cMatrix3d &a_globalRot) |
unsigned int | getNumElements () const |
bool | getUseNormalData () const |
bool | getUseTexCoordData () const |
bool | getUseColorData () const |
bool | getUseTangentData () const |
bool | getUseBitangentData () const |
bool | getUseUserData () const |
void | renderInitialize () |
void | renderFinalize () |
void | allocateData (const int a_numberOfVertices, const bool a_useNormalData, const bool a_useTexCoordData, const bool a_useColorData, const bool a_useTangentData, const bool a_useBitangentData, const bool a_useUserData) |
Static Public Member Functions | |
static cVertexArrayPtr | create (const bool a_useNormalData, const bool a_useTexCoordData, const bool a_useColorData, const bool a_useTangentData, const bool a_useBitangentData, const bool a_useUserData) |
Public Attributes | |
std::vector< cVector3d > | m_localPos |
Local position of vertices. More... | |
std::vector< cVector3d > | m_globalPos |
Global position of vertices in world coordinates. More... | |
std::vector< cVector3d > | m_normal |
Surface normal of vertices. More... | |
std::vector< cVector3d > | m_texCoord |
Texture coordinate (U,V,W) of vertices. More... | |
std::vector< cColorf > | m_color |
Color of vertices. More... | |
std::vector< cVector3d > | m_tangent |
Surface tangent of vertices. More... | |
std::vector< cVector3d > | m_bitangent |
Surface bitangent of vertices. More... | |
std::vector< int > | m_userData |
User data of vertices. More... | |
bool | m_flagPositionData |
If true then position data has been modified. More... | |
bool | m_flagNormalData |
If true then normal data has been modified. More... | |
bool | m_flagTexCoordData |
If true then texture coordinate data has been modified. More... | |
bool | m_flagColorData |
If true then vertex color data has been modified. More... | |
bool | m_flagTangentData |
If true then surface tangent data has been modified. More... | |
bool | m_flagBitangentData |
If true then surface bitangent data has been modified. More... | |
bool | m_flagUserData |
If true then user data has been modified. More... | |
bool | m_flagBufferResize |
If true, then data buffer need to be updated in size. More... | |
GLuint | m_positionBuffer |
OpenGL Buffer for storing triangle indices. More... | |
GLuint | m_normalBuffer |
OpenGL Buffer for storing triangle indices. More... | |
GLuint | m_texCoordBuffer |
OpenGL Buffer for storing triangle indices. More... | |
GLuint | m_colorBuffer |
OpenGL Buffer for storing triangle indices. More... | |
GLuint | m_tangentBuffer |
OpenGL Buffer for storing triangle indices. More... | |
GLuint | m_bitangentBuffer |
OpenGL Buffer for storing triangle indices. More... | |
Protected Attributes | |
unsigned int | m_numVertices |
Number of vertices. More... | |
bool | m_useNormalData |
If true then normal data will be allocated for each new vertex. More... | |
bool | m_useTexCoordData |
If true then texture coordinate data will be allocated for each new vertex. More... | |
bool | m_useColorData |
If true then vertex color data will be allocated for each new vertex. More... | |
bool | m_useTangentData |
If true then surface tangent data will be allocated for each new vertex. More... | |
bool | m_useBitangentData |
If true then surface bitangent data will be allocated for each new vertex. More... | |
bool | m_useUserData |
If true then surface bitangent data will be allocated for each new vertex. More... | |
cVertexArray defines a an array of 3D vertices (points) that can include properties such as position, color, texture coordinate, and surface normals.
New vertices can be added to the array by calling newVertex() or newVertices(). Once points have been allocated, they cannot be removed, unless the entire array is cleared by calling clear().
The properties of each vertex can be modified by calling the appropriate methods and by passing the vertex index as argument with the associated data.
|
inline |
Constructor of cVertexArray. You may define which type of data this vertex array will store. By setting the flag, every time a new vertex is created, the associated data will be allocated and initialized.
a_options | Data allocation options. |
|
inline |
Destructor of cVertexArray.
|
inlinestatic |
This method create an instance of cVertexArrayPtr. You may define which type of data this vertex array will store. By setting the flag, every time a new vertex is created, the associated data will be allocated and initialized.
a_useNormalData | If true then normal data is allocated. |
a_useTexCoordData | If true then texture coordinate data is allocated. |
a_useColorData | If true then vertex color data is allocated. |
a_useTangentData | If true then surface tangent data is allocated. |
a_useBitangentData | If true then surface bitangent data is allocated. |
a_useUserData | If true then user data is allocated. |
|
inline |
This method clears all vertex data.
|
inline |
This method creates copy of this vertex array.
|
inline |
This method creates a new vertex.
|
inline |
This method creates a number of new vertices.
a_numberOfVertices | Number of vertices to create. |
|
inline |
This method sets the local position data for selected vertex.
a_vertexIndex | Vertex index number. |
a_x | X position value. |
a_y | Y position value. |
a_z | Z position value. |
|
inline |
This method sets the local position value for selected vertex.
a_vertexIndex | Vertex index number. |
a_pos | Local position of vertex. |
|
inline |
This method translates a selected vertex by defining a translation offset passed as argument.
a_vertexIndex | Vertex index number. |
a_translation | Translation offset. |
|
inline |
This method returns the local position for a selected vertex.
a_vertexIndex | Vertex index number. |
|
inline |
This method returns the global position of a selected vertex. This value is only correct if the computeGlobalPositions() method has been called previously.
a_vertexIndex | Vertex index number. |
|
inline |
This method sets the surface normal vector for selected vertex.
a_vertexIndex | Vertex index. |
a_normal | Normal vector. |
|
inline |
This method sets the surface normal vector for selected vertex.
a_vertexIndex | Vertex index. |
a_x | X component of normal. |
a_y | Y component of normal. |
a_z | Z component of normal. |
|
inline |
This method returns the surface normal vector for selected vertex.
a_vertexIndex | Vertex index. |
|
inline |
This method sets the texture coordinate for selected vertex.
a_vertexIndex | Vertex index. |
a_texCoord | Texture coordinate. |
|
inline |
This method sets the texture coordinate for selected vertex by passing its coordinates as parameters.
a_vertexIndex | Vertex index. |
a_tx | X component of texture coordinate. |
a_ty | Y component of texture coordinate. |
a_tz | Z component of texture coordinate. |
|
inline |
This method returns the texture coordinate for a selected vertex.
a_vertexIndex | Vertex index. |
|
inline |
This method set the color for a selected vertex.
a_vertexIndex | Vertex index. |
a_color | Color. |
|
inline |
This method set the color of a selected vertex by passing as argument the individual color components.
a_vertexIndex | Vertex index. |
a_red | Red component. |
a_green | Green component. |
a_blue | Blue component. |
a_alpha | Alpha component. |
|
inline |
This method set color for selected vertex.
a_vertexIndex | Vertex index. |
a_color | Color. |
|
inline |
This method returns the color for a selected vertex.
a_vertexIndex | Vertex index. |
|
inline |
This method sets the tangent vector for selected vertex.
a_vertexIndex | Vertex index. |
a_tangent | Tangent vector. |
|
inline |
This method sets the tangent vector for selected vertex.
a_vertexIndex | Vertex index. |
a_x | X component of tangent. |
a_y | Y component of tangent. |
a_z | Z component of tangent. |
|
inline |
This method returns the surface tangent for a selected vertex.
a_vertexIndex | Vertex index. |
|
inline |
This method sets the bi-tangent vector for selected vertex.
a_vertexIndex | Vertex index. |
a_bitangent | Bi-tangent vector. |
|
inline |
This method sets the bi-tangent vector for selected vertex.
a_vertexIndex | Vertex index. |
a_x | X component of bi-tangent. |
a_y | Y component of bi-tangent. |
a_z | Z component of bi-tangent. |
|
inline |
This method returns the surface bitangent for selected vertex.
a_vertexIndex | Vertex index. |
|
inline |
This method sets the user data field for selected vertex.
a_vertexIndex | Vertex index. |
a_userData | User data. |
|
inline |
This method returns the user data value for a selected vertex.
a_vertexIndex | Vertex index. |
|
inline |
This method computes the global position of vertex given the global position and global rotation matrix of the parent object.
a_vertexIndex | Index number of vertex. |
a_globalPos | Global position vector of parent. |
a_globalRot | Global rotation matrix of parent. |
|
inline |
This method returns the number of vertices allocated in this array.
|
inline |
This method checks if normal data is allocated for each vertex in this array.
|
inline |
This method check if texture coordinate data is allocated for each vertex in this array.
|
inline |
This method checks if color data is allocated for each vertex in this array.
|
inline |
This method checks if tangent data is allocated for each vertex in this array.
|
inline |
This method checks if bitangent data is allocated for each vertex in this array.
|
inline |
This method checks if user data is allocated for each vertex in this array.
|
inline |
This method allocates or updates all OpenGL buffers.
|
inline |
This method finalizes rendering by disabling all OpenGL buffers.
|
inline |
This method allocate data for vertex array.
a_numberOfVertices | Number of new vertices to be allocated |
a_useNormalData | If true then normal data is allocated. |
a_useTexCoordData | If__true__ then texture coordinate data is allocated. |
a_useColorData | If true then vertex color data is allocated. |
a_useTangentData | If true then surface tangent data is allocated. |
a_useBitangentData | If true then surface bitangent data is allocated. |
a_useUserData | If true then user data data is allocated. |
std::vector<cVector3d> chai3d::cVertexArray::m_localPos |
std::vector<cVector3d> chai3d::cVertexArray::m_globalPos |
std::vector<cVector3d> chai3d::cVertexArray::m_normal |
std::vector<cVector3d> chai3d::cVertexArray::m_texCoord |
std::vector<cColorf> chai3d::cVertexArray::m_color |
std::vector<cVector3d> chai3d::cVertexArray::m_tangent |
std::vector<cVector3d> chai3d::cVertexArray::m_bitangent |
std::vector<int> chai3d::cVertexArray::m_userData |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
bool chai3d::cVertexArray::m_flagPositionData |
bool chai3d::cVertexArray::m_flagNormalData |
bool chai3d::cVertexArray::m_flagTexCoordData |
bool chai3d::cVertexArray::m_flagColorData |
bool chai3d::cVertexArray::m_flagTangentData |
bool chai3d::cVertexArray::m_flagBitangentData |
bool chai3d::cVertexArray::m_flagUserData |
bool chai3d::cVertexArray::m_flagBufferResize |
GLuint chai3d::cVertexArray::m_positionBuffer |
GLuint chai3d::cVertexArray::m_normalBuffer |
GLuint chai3d::cVertexArray::m_texCoordBuffer |
GLuint chai3d::cVertexArray::m_colorBuffer |
GLuint chai3d::cVertexArray::m_tangentBuffer |
GLuint chai3d::cVertexArray::m_bitangentBuffer |