This class implements array of 3D vertices.
More...
#include <CVertexArray.h>
|
| | 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 |
| |
| cVector3d | getTangent (const unsigned int a_vertexIndex) const |
| |
| 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 | getNumVertices () 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 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) |
| |
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.
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.
- Parameters
-
| a_options | Data allocation options. |
| chai3d::cVertexArray::~cVertexArray |
( |
| ) |
|
|
inline |
| static cVertexArrayPtr chai3d::cVertexArray::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 |
|
) |
| |
|
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.
- Parameters
-
| 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. |
| void chai3d::cVertexArray::clear |
( |
| ) |
|
|
inline |
This method clears all vertex data.
This method create copy of this vertex array.
| int chai3d::cVertexArray::newVertex |
( |
| ) |
|
|
inline |
This method creates a new vertex.
- Returns
- Index number of the new allocated vertex.
| int chai3d::cVertexArray::newVertices |
( |
unsigned int |
a_numberOfVertices | ) |
|
|
inline |
This method creates a number of new vertices.
- Parameters
-
| a_numberOfVertices | Number of vertices to create. |
- Returns
- Index number of the first new allocated vertex.
| void chai3d::cVertexArray::setLocalPos |
( |
const unsigned int |
a_vertexIndex, |
|
|
const double & |
a_x, |
|
|
const double & |
a_y, |
|
|
const double & |
a_z |
|
) |
| |
|
inline |
This method sets the local position data for selected vertex.
- Parameters
-
| a_vertexIndex | Vertex index number. |
| a_x | X position value. |
| a_y | Y position value. |
| a_z | Z position value. |
| void chai3d::cVertexArray::setLocalPos |
( |
const unsigned int |
a_vertexIndex, |
|
|
const cVector3d & |
a_pos |
|
) |
| |
|
inline |
This method sets the local position value for selected vertex.
- Parameters
-
| a_vertexIndex | Vertex index number. |
| a_pos | Local position of vertex. |
| void chai3d::cVertexArray::translate |
( |
const unsigned int |
a_vertexIndex, |
|
|
const cVector3d & |
a_translation |
|
) |
| |
|
inline |
This method translates a selected vertex by defining a translation offset passed as argument.
- Parameters
-
| a_vertexIndex | Vertex index number. |
| a_translation | Translation offset. |
| cVector3d chai3d::cVertexArray::getLocalPos |
( |
const unsigned int |
a_vertexIndex | ) |
const |
|
inline |
This method returns the local position for a selected vertex.
- Parameters
-
| a_vertexIndex | Vertex index number. |
- Returns
- Position of vertex.
| cVector3d chai3d::cVertexArray::getGlobalPos |
( |
const unsigned int |
a_vertexIndex | ) |
const |
|
inline |
This method returns the global position of a selected vertex. This value is only correct if the computeGlobalPositions() method has been called previously.
- Parameters
-
| a_vertexIndex | Vertex index number. |
- Returns
- Global position of vertex in world coordinates.
| void chai3d::cVertexArray::setNormal |
( |
const unsigned int |
a_vertexIndex, |
|
|
const cVector3d & |
a_normal |
|
) |
| |
|
inline |
This method sets the surface normal vector for selected vertex.
- Parameters
-
| a_vertexIndex | Vertex index. |
| a_normal | Normal vector. |
| void chai3d::cVertexArray::setNormal |
( |
const unsigned int |
a_vertexIndex, |
|
|
const double & |
a_x, |
|
|
const double & |
a_y, |
|
|
const double & |
a_z |
|
) |
| |
|
inline |
This method sets the surface normal vector for selected vertex.
- Parameters
-
| a_vertexIndex | Vertex index. |
| a_x | X component of normal. |
| a_y | Y component of normal. |
| a_z | Z component of normal. |
| cVector3d chai3d::cVertexArray::getNormal |
( |
const unsigned int |
a_vertexIndex | ) |
const |
|
inline |
This method returns the surface normal vector for selected vertex.
- Parameters
-
| a_vertexIndex | Vertex index. |
- Returns
- Normal vector.
| void chai3d::cVertexArray::setTexCoord |
( |
const unsigned int |
a_vertexIndex, |
|
|
const cVector3d & |
a_texCoord |
|
) |
| |
|
inline |
This method sets the texture coordinate for selected vertex.
- Parameters
-
| a_vertexIndex | Vertex index. |
| a_texCoord | Texture coordinate. |
| void chai3d::cVertexArray::setTexCoord |
( |
const unsigned int |
a_vertexIndex, |
|
|
const double & |
a_tx, |
|
|
const double & |
a_ty = 0.0, |
|
|
const double & |
a_tz = 0.0 |
|
) |
| |
|
inline |
This method sets the texture coordinate for selected vertex by passing its coordinates as parameters.
- 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. |
| cVector3d chai3d::cVertexArray::getTexCoord |
( |
const unsigned int |
a_vertexIndex | ) |
const |
|
inline |
This method returns the texture coordinate for a selected vertex.
- Parameters
-
| a_vertexIndex | Vertex index. |
- Returns
- Texture coordinate.
| void chai3d::cVertexArray::setColor |
( |
const unsigned int |
a_vertexIndex, |
|
|
const cColorf & |
a_color |
|
) |
| |
|
inline |
This method set the color for a selected vertex.
- Parameters
-
| a_vertexIndex | Vertex index. |
| a_color | Color. |
| void chai3d::cVertexArray::setColor |
( |
const unsigned int |
a_vertexIndex, |
|
|
const float & |
a_red, |
|
|
const float & |
a_green, |
|
|
const float & |
a_blue, |
|
|
const float & |
a_alpha = 1.0 |
|
) |
| |
|
inline |
This method set the color of a selected vertex by passing as argument the individual color components.
- Parameters
-
| a_vertexIndex | Vertex index. |
| a_red | Red component. |
| a_green | Green component. |
| a_blue | Blue component. |
| a_alpha | Alpha component. |
| void chai3d::cVertexArray::setColor |
( |
const unsigned int |
a_vertexIndex, |
|
|
const cColorb & |
a_color |
|
) |
| |
|
inline |
This method set color for selected vertex.
- Parameters
-
| a_vertexIndex | Vertex index. |
| a_color | Color. |
| cColorf chai3d::cVertexArray::getColor |
( |
const unsigned int |
a_vertexIndex | ) |
const |
|
inline |
This method returns the color for a selected vertex.
- Parameters
-
| a_vertexIndex | Vertex index. |
- Returns
- Color of vertex.
| cVector3d chai3d::cVertexArray::getTangent |
( |
const unsigned int |
a_vertexIndex | ) |
const |
|
inline |
This method returns the surface tangent for a selected vertex.
- Parameters
-
| a_vertexIndex | Vertex index. |
- Returns
- Tangent vector.
| cVector3d chai3d::cVertexArray::getBitangent |
( |
const unsigned int |
a_vertexIndex | ) |
const |
|
inline |
This method returns the surface bitangent for selected vertex.
- Parameters
-
| a_vertexIndex | Vertex index. |
- Returns
- Bitangent vector.
| void chai3d::cVertexArray::setUserData |
( |
const unsigned int |
a_vertexIndex, |
|
|
const int |
a_userData |
|
) |
| |
|
inline |
This method sets the user data field for selected vertex.
- Parameters
-
| a_vertexIndex | Vertex index. |
| a_userData | User data. |
| int chai3d::cVertexArray::getUserData |
( |
const unsigned int |
a_vertexIndex | ) |
const |
|
inline |
This method returns the user data value for a selected vertex.
- Parameters
-
| a_vertexIndex | Vertex index. |
- Returns
- User data.
| void chai3d::cVertexArray::computeGlobalPosition |
( |
const unsigned int |
a_vertexIndex, |
|
|
const cVector3d & |
a_globalPos, |
|
|
const cMatrix3d & |
a_globalRot |
|
) |
| |
|
inline |
This method computes the global position of vertex given the global position and global rotation matrix of the parent object.
- Parameters
-
| a_vertexIndex | Index number of vertex. |
| a_globalPos | Global position vector of parent. |
| a_globalRot | Global rotation matrix of parent. |
| unsigned int chai3d::cVertexArray::getNumVertices |
( |
| ) |
const |
|
inline |
This method returns the number of vertices allocated in this array.
- Returns
- Number of vertices.
| bool chai3d::cVertexArray::getUseNormalData |
( |
| ) |
const |
|
inline |
This method checks if normal data is allocated for each vertex in this array.
- Returns
- true if data is allocated, false otherwise.
| bool chai3d::cVertexArray::getUseTexCoordData |
( |
| ) |
const |
|
inline |
This method check if texture coordinate data is allocated for each vertex in this array.
- Returns
- true if data is allocated, false otherwise.
| bool chai3d::cVertexArray::getUseColorData |
( |
| ) |
const |
|
inline |
This method checks if color data is allocated for each vertex in this array.
- Returns
- true if data is allocated, false otherwise.
| bool chai3d::cVertexArray::getUseTangentData |
( |
| ) |
const |
|
inline |
This method checks if tangent data is allocated for each vertex in this array.
- Returns
- true if data is allocated, false otherwise.
| bool chai3d::cVertexArray::getUseBitangentData |
( |
| ) |
const |
|
inline |
This method checks if bitangent data is allocated for each vertex in this array.
- Returns
- true if data is allocated, false otherwise.
| bool chai3d::cVertexArray::getUseUserData |
( |
| ) |
const |
|
inline |
This method checks if user data is allocated for each vertex in this array.
- Returns
- true if data is allocated, false otherwise.
| void chai3d::cVertexArray::renderInitialize |
( |
| ) |
|
|
inline |
This method allocates or updates all OpenGL buffers.
| void chai3d::cVertexArray::renderFinalize |
( |
| ) |
|
|
inline |
This method finalizes rendering by disabling all OpenGL buffers.
| void chai3d::cVertexArray::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 |
|
) |
| |
|
inline |
This method allocate data for vertex array.
- Parameters
-
| 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 |
| unsigned int chai3d::cVertexArray::m_numVertices |
|
protected |
| bool chai3d::cVertexArray::m_useNormalData |
|
protected |
| bool chai3d::cVertexArray::m_useTexCoordData |
|
protected |
| bool chai3d::cVertexArray::m_useColorData |
|
protected |
| bool chai3d::cVertexArray::m_useTangentData |
|
protected |
| bool chai3d::cVertexArray::m_useBitangentData |
|
protected |
| bool chai3d::cVertexArray::m_useUserData |
|
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 |
The documentation for this class was generated from the following file: