84 const bool a_useTexCoordData,
85 const bool a_useColorData,
86 const bool a_useTangentData,
87 const bool a_useBitangentData,
88 const bool a_useUserData)
198 static cVertexArrayPtr
create(
const bool a_useNormalData,
199 const bool a_useTexCoordData,
200 const bool a_useColorData,
201 const bool a_useTangentData,
202 const bool a_useBitangentData,
203 const bool a_useUserData)
212 return (std::make_shared<cVertexArray>(options));
259 vertexArray->m_color =
m_color;
273 return (vertexArray);
302 if (a_numberOfVertices == 0) {
return (-1); }
434 m_normal[a_vertexIndex].set(a_x, a_y, a_z);
486 const double& a_ty = 0.0,
487 const double& a_tz = 0.0)
491 m_texCoord[a_vertexIndex].set(a_tx, a_ty,a_tz);
519 inline void setColor(
const unsigned int a_vertexIndex,
524 m_color[a_vertexIndex] = a_color;
542 inline void setColor(
const unsigned int a_vertexIndex,
544 const float& a_green,
546 const float& a_alpha = 1.0 )
550 m_color[a_vertexIndex].set(a_red, a_green, a_blue, a_alpha);
564 inline void setColor(
const unsigned int a_vertexIndex,
585 return (
m_color[a_vertexIndex]);
626 const int a_userData)
889 glVertexAttribPointer(
C_VB_POSITION, 3, GL_DOUBLE, GL_FALSE, 0, 0);
890 glVertexPointer(3, GL_DOUBLE, 0, 0);
897 glVertexAttribPointer(
C_VB_NORMAL, 3, GL_DOUBLE, GL_FALSE, 0, 0);
908 glVertexAttribPointer(
C_VB_TEXCOORD, 3, GL_DOUBLE, GL_FALSE, 0, 0);
930 glVertexAttribPointer(
C_VB_TANGENT, 3, GL_DOUBLE, GL_FALSE, 0, 0);
941 glVertexAttribPointer(
C_VB_BITANGENT, 3, GL_DOUBLE, GL_FALSE, 0, 0);
948 glBindBuffer(GL_ARRAY_BUFFER, 0);
985 const bool a_useNormalData,
986 const bool a_useTexCoordData,
987 const bool a_useColorData,
988 const bool a_useTangentData,
989 const bool a_useBitangentData,
990 const bool a_useUserData)
1005 if ((a_numberOfVertices > 1) || (a_numberOfVertices == 0))
1025 if ((a_numberOfVertices > 1) || (a_numberOfVertices == 0))
1044 cColorf color(0.0, 0.0, 0.0, 1.0);
1045 if ((a_numberOfVertices > 1) || (a_numberOfVertices == 0))
1065 if ((a_numberOfVertices > 1) || (a_numberOfVertices == 0))
1085 if ((a_numberOfVertices > 1) || (a_numberOfVertices == 0))
1105 if ((a_numberOfVertices > 1) || (a_numberOfVertices == 0))
This class implements a 3D vector.
Definition: CVector3d.h:88
int newVertex()
Definition: CVertexArray.h:284
Implements an OpenGL shader primitive.
bool m_useBitangentData
If true then surface bitangent data will be allocated for each new vertex.
Definition: CVertexArray.h:1178
std::vector< int > m_userData
User data of vertices.
Definition: CVertexArray.h:1153
void mulr(const cMatrix3d &a_matrix, cMatrix3d &a_result) const
This function computes the multiplication of this matrix with another.
Definition: CMatrix3d.h:922
#define C_VB_BITANGENT
Definition: CShader.h:77
std::vector< cVector3d > m_bitangent
Surface bitangent of vertices.
Definition: CVertexArray.h:1150
cColorf getColor(const unsigned int a_vertexIndex) const
Definition: CVertexArray.h:583
bool m_useTexCoordData
Definition: CVertexArray.h:99
bool m_useTexCoordData
If true then texture coordinate data will be allocated for each new vertex.
Definition: CVertexArray.h:1169
bool m_useUserData
Definition: CVertexArray.h:103
cVector3d getTexCoord(const unsigned int a_vertexIndex) const
Definition: CVertexArray.h:505
std::vector< cColorf > m_color
Color of vertices.
Definition: CVertexArray.h:1144
This class implements array of 3D vertices.
Definition: CVertexArray.h:133
std::vector< cVector3d > m_tangent
Surface tangent of vertices.
Definition: CVertexArray.h:1147
bool m_flagBufferResize
If true, then data buffer need to be updated in size.
Definition: CVertexArray.h:1212
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)
Definition: CVertexArray.h:984
void setNormal(const unsigned int a_vertexIndex, const double &a_x, const double &a_y, const double &a_z)
Definition: CVertexArray.h:427
unsigned int getNumVertices() const
Definition: CVertexArray.h:676
int getUserData(const unsigned int a_vertexIndex) const
Definition: CVertexArray.h:644
GLuint m_bitangentBuffer
OpenGL Buffer for storing triangle indices.
Definition: CVertexArray.h:1237
bool m_useBitangentData
Definition: CVertexArray.h:102
void renderFinalize()
Definition: CVertexArray.h:958
bool m_flagColorData
If true then vertex color data has been modified.
Definition: CVertexArray.h:1200
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)
Definition: CVertexArray.h:198
bool m_flagTangentData
If true then surface tangent data has been modified.
Definition: CVertexArray.h:1203
void setTexCoord(const unsigned int a_vertexIndex, const cVector3d &a_texCoord)
Definition: CVertexArray.h:462
std::vector< cVector3d > m_normal
Surface normal of vertices.
Definition: CVertexArray.h:1138
This structure manages user options when creating vertex arrays.
Definition: CVertexArray.h:78
bool m_flagNormalData
If true then normal data has been modified.
Definition: CVertexArray.h:1194
bool m_useColorData
If true then vertex color data will be allocated for each new vertex.
Definition: CVertexArray.h:1172
void setColor(const unsigned int a_vertexIndex, const cColorf &a_color)
Definition: CVertexArray.h:519
bool m_flagUserData
If true then user data has been modified.
Definition: CVertexArray.h:1209
This class implements a 3D matrix.
Definition: CMatrix3d.h:97
#define C_VB_COLOR
Definition: CShader.h:75
GLuint m_tangentBuffer
OpenGL Buffer for storing triangle indices.
Definition: CVertexArray.h:1234
cVertexArrayPtr copy()
Definition: CVertexArray.h:245
cVector3d getBitangent(const unsigned int a_vertexIndex) const
Definition: CVertexArray.h:611
This class defines a color using a GLubyte representation for each component.
Definition: CColor.h:1184
~cVertexArray()
Definition: CVertexArray.h:181
bool getUseTangentData() const
Definition: CVertexArray.h:732
GLuint m_texCoordBuffer
OpenGL Buffer for storing triangle indices.
Definition: CVertexArray.h:1228
bool m_useColorData
Definition: CVertexArray.h:100
void setLocalPos(const unsigned int a_vertexIndex, const double &a_x, const double &a_y, const double &a_z)
Definition: CVertexArray.h:325
cVertexArrayOptions(const bool a_useNormalData, const bool a_useTexCoordData, const bool a_useColorData, const bool a_useTangentData, const bool a_useBitangentData, const bool a_useUserData)
Definition: CVertexArray.h:83
#define C_VB_POSITION
Definition: CShader.h:72
std::vector< cVector3d > m_globalPos
Global position of vertices in world coordinates.
Definition: CVertexArray.h:1135
std::vector< cVector3d > m_localPos
Local position of vertices.
Definition: CVertexArray.h:1132
#define C_VB_TANGENT
Definition: CShader.h:76
GLuint m_positionBuffer
OpenGL Buffer for storing triangle indices.
Definition: CVertexArray.h:1222
cVector3d getLocalPos(const unsigned int a_vertexIndex) const
Definition: CVertexArray.h:376
void setColor(const unsigned int a_vertexIndex, const cColorb &a_color)
Definition: CVertexArray.h:564
bool getUseBitangentData() const
Definition: CVertexArray.h:746
std::shared_ptr< cVertexArray > cVertexArrayPtr
Definition: CVertexArray.h:107
bool m_useTangentData
If true then surface tangent data will be allocated for each new vertex.
Definition: CVertexArray.h:1175
This class defines a color using a GLfloat representation for each component.
Definition: CColor.h:138
Implements color properties.
bool getUseColorData() const
Definition: CVertexArray.h:718
void setUserData(const unsigned int a_vertexIndex, const int a_userData)
Definition: CVertexArray.h:625
cVertexArray(const cVertexArrayOptions &a_options)
Definition: CVertexArray.h:150
void setTexCoord(const unsigned int a_vertexIndex, const double &a_tx, const double &a_ty=0.0, const double &a_tz=0.0)
Definition: CVertexArray.h:484
#define C_VB_INDEX_BUFFER
Definition: CShader.h:71
bool getUseUserData() const
Definition: CVertexArray.h:760
bool getUseTexCoordData() const
Definition: CVertexArray.h:704
bool m_flagPositionData
If true then position data has been modified.
Definition: CVertexArray.h:1191
bool m_flagTexCoordData
If true then texture coordinate data has been modified.
Definition: CVertexArray.h:1197
bool m_useNormalData
If true then normal data will be allocated for each new vertex.
Definition: CVertexArray.h:1166
#define C_VB_TEXCOORD
Definition: CShader.h:74
void setNormal(const unsigned int a_vertexIndex, const cVector3d &a_normal)
Definition: CVertexArray.h:406
bool m_flagBitangentData
If true then surface bitangent data has been modified.
Definition: CVertexArray.h:1206
bool m_useNormalData
Definition: CVertexArray.h:98
void clear()
Definition: CVertexArray.h:225
std::vector< cVector3d > m_texCoord
Texture coordinate (U,V,W) of vertices.
Definition: CVertexArray.h:1141
Definition: CAudioBuffer.cpp:56
GLuint m_colorBuffer
OpenGL Buffer for storing triangle indices.
Definition: CVertexArray.h:1231
GLuint m_normalBuffer
OpenGL Buffer for storing triangle indices.
Definition: CVertexArray.h:1225
#define C_VB_NORMAL
Definition: CShader.h:73
bool m_useTangentData
Definition: CVertexArray.h:101
cVector3d getGlobalPos(const unsigned int a_vertexIndex) const
Definition: CVertexArray.h:392
void renderInitialize()
Definition: CVertexArray.h:771
unsigned int m_numVertices
Number of vertices.
Definition: CVertexArray.h:1163
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)
Definition: CVertexArray.h:542
int newVertices(unsigned int a_numberOfVertices)
Definition: CVertexArray.h:299
void computeGlobalPosition(const unsigned int a_vertexIndex, const cVector3d &a_globalPos, const cMatrix3d &a_globalRot)
Definition: CVertexArray.h:660
void translate(const unsigned int a_vertexIndex, const cVector3d &a_translation)
Definition: CVertexArray.h:360
void setLocalPos(const unsigned int a_vertexIndex, const cVector3d &a_pos)
Definition: CVertexArray.h:343
cColorf getColorf() const
This method returns this color converted into cColorf format.
Definition: CColor.cpp:76
bool getUseNormalData() const
Definition: CVertexArray.h:690
bool m_useUserData
If true then surface bitangent data will be allocated for each new vertex.
Definition: CVertexArray.h:1181
cVector3d getNormal(const unsigned int a_vertexIndex) const
Definition: CVertexArray.h:448
cVector3d getTangent(const unsigned int a_vertexIndex) const
Definition: CVertexArray.h:597