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)
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;
274 return (vertexArray);
303 if (a_numberOfVertices == 0) {
return (-1); }
435 m_normal[a_vertexIndex].set(a_x, a_y, a_z);
487 const double& a_ty = 0.0,
488 const double& a_tz = 0.0)
492 m_texCoord[a_vertexIndex].set(a_tx, a_ty,a_tz);
520 inline void setColor(
const unsigned int a_vertexIndex,
525 m_color[a_vertexIndex] = a_color;
543 inline void setColor(
const unsigned int a_vertexIndex,
545 const float& a_green,
547 const float& a_alpha = 1.0 )
551 m_color[a_vertexIndex].set(a_red, a_green, a_blue, a_alpha);
565 inline void setColor(
const unsigned int a_vertexIndex,
586 return (
m_color[a_vertexIndex]);
626 m_tangent[a_vertexIndex].set(a_x, a_y, a_z);
711 const int a_userData)
974 glVertexAttribPointer(
C_VB_POSITION, 3, GL_DOUBLE, GL_FALSE, 0, 0);
975 glVertexPointer(3, GL_DOUBLE, 0, 0);
982 glVertexAttribPointer(
C_VB_NORMAL, 3, GL_DOUBLE, GL_FALSE, 0, 0);
993 glVertexAttribPointer(
C_VB_TEXCOORD, 3, GL_DOUBLE, GL_FALSE, 0, 0);
1015 glVertexAttribPointer(
C_VB_TANGENT, 3, GL_DOUBLE, GL_FALSE, 0, 0);
1026 glVertexAttribPointer(
C_VB_BITANGENT, 3, GL_DOUBLE, GL_FALSE, 0, 0);
1033 glBindBuffer(GL_ARRAY_BUFFER, 0);
1070 const bool a_useNormalData,
1071 const bool a_useTexCoordData,
1072 const bool a_useColorData,
1073 const bool a_useTangentData,
1074 const bool a_useBitangentData,
1075 const bool a_useUserData)
1090 if ((a_numberOfVertices > 1) || (a_numberOfVertices == 0))
1110 if ((a_numberOfVertices > 1) || (a_numberOfVertices == 0))
1129 cColorf color(0.0, 0.0, 0.0, 1.0);
1130 if ((a_numberOfVertices > 1) || (a_numberOfVertices == 0))
1150 if ((a_numberOfVertices > 1) || (a_numberOfVertices == 0))
1170 if ((a_numberOfVertices > 1) || (a_numberOfVertices == 0))
1190 if ((a_numberOfVertices > 1) || (a_numberOfVertices == 0))
Implements color properties.
Implements an OpenGL shader primitive.
#define C_VB_TANGENT
Definition CShader.h:77
#define C_VB_BITANGENT
Definition CShader.h:78
#define C_VB_POSITION
Definition CShader.h:73
#define C_VB_COLOR
Definition CShader.h:76
#define C_VB_NORMAL
Definition CShader.h:74
#define C_VB_INDEX_BUFFER
Definition CShader.h:72
#define C_VB_TEXCOORD
Definition CShader.h:75
This class implements array of 3D vertices.
Definition CVertexArray.h:134
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:485
cVector3d getTexCoord(const unsigned int a_vertexIndex) const
Definition CVertexArray.h:506
void setLocalPos(const unsigned int a_vertexIndex, const cVector3d &a_pos)
Definition CVertexArray.h:344
int newVertices(unsigned int a_numberOfVertices)
Definition CVertexArray.h:300
bool m_useTangentData
If true then surface tangent data will be allocated for each new vertex.
Definition CVertexArray.h:1260
bool m_useUserData
If true then surface bitangent data will be allocated for each new vertex.
Definition CVertexArray.h:1266
bool m_useColorData
If true then vertex color data will be allocated for each new vertex.
Definition CVertexArray.h:1257
bool m_flagColorData
If true then vertex color data has been modified.
Definition CVertexArray.h:1285
void setUserData(const unsigned int a_vertexIndex, const int a_userData)
Definition CVertexArray.h:710
cVertexArray(const cVertexArrayOptions &a_options)
Definition CVertexArray.h:150
void setTexCoord(const unsigned int a_vertexIndex, const cVector3d &a_texCoord)
Definition CVertexArray.h:463
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:1069
std::vector< cVector3d > m_tangent
Surface tangent of vertices.
Definition CVertexArray.h:1232
bool m_flagPositionData
If true then position data has been modified.
Definition CVertexArray.h:1276
void setTangent(const unsigned int a_vertexIndex, const double &a_x, const double &a_y, const double &a_z)
Definition CVertexArray.h:619
bool getUseNormalData() const
Definition CVertexArray.h:775
void setBitangent(const unsigned int a_vertexIndex, const cVector3d &a_bitangent)
Definition CVertexArray.h:654
bool m_flagUserData
If true then user data has been modified.
Definition CVertexArray.h:1294
bool m_flagBufferResize
If true, then data buffer need to be updated in size.
Definition CVertexArray.h:1297
GLuint m_positionBuffer
OpenGL Buffer for storing triangle indices.
Definition CVertexArray.h:1307
void setColor(const unsigned int a_vertexIndex, const cColorb &a_color)
Definition CVertexArray.h:565
bool m_flagBitangentData
If true then surface bitangent data has been modified.
Definition CVertexArray.h:1291
bool m_useBitangentData
If true then surface bitangent data will be allocated for each new vertex.
Definition CVertexArray.h:1263
bool getUseTexCoordData() const
Definition CVertexArray.h:789
void clear()
Definition CVertexArray.h:225
std::vector< cVector3d > m_normal
Surface normal of vertices.
Definition CVertexArray.h:1223
GLuint m_bitangentBuffer
OpenGL Buffer for storing triangle indices.
Definition CVertexArray.h:1322
cVector3d getGlobalPos(const unsigned int a_vertexIndex) const
Definition CVertexArray.h:393
cVertexArrayPtr copy()
Definition CVertexArray.h:245
void setNormal(const unsigned int a_vertexIndex, const cVector3d &a_normal)
Definition CVertexArray.h:407
bool getUseColorData() const
Definition CVertexArray.h:803
GLuint m_texCoordBuffer
OpenGL Buffer for storing triangle indices.
Definition CVertexArray.h:1313
std::vector< cVector3d > m_globalPos
Global position of vertices in world coordinates.
Definition CVertexArray.h:1220
std::vector< cVector3d > m_texCoord
Texture coordinate (U,V,W) of vertices.
Definition CVertexArray.h:1226
bool m_flagNormalData
If true then normal data has been modified.
Definition CVertexArray.h:1279
GLuint m_colorBuffer
OpenGL Buffer for storing triangle indices.
Definition CVertexArray.h:1316
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:543
std::vector< cVector3d > m_bitangent
Surface bitangent of vertices.
Definition CVertexArray.h:1235
bool m_flagTangentData
If true then surface tangent data has been modified.
Definition CVertexArray.h:1288
void setColor(const unsigned int a_vertexIndex, const cColorf &a_color)
Definition CVertexArray.h:520
int newVertex()
Definition CVertexArray.h:285
bool getUseBitangentData() const
Definition CVertexArray.h:831
std::vector< cVector3d > m_localPos
Local position of vertices.
Definition CVertexArray.h:1217
cVector3d getNormal(const unsigned int a_vertexIndex) const
Definition CVertexArray.h:449
cVector3d getBitangent(const unsigned int a_vertexIndex) const
Definition CVertexArray.h:696
int getUserData(const unsigned int a_vertexIndex) const
Definition CVertexArray.h:729
std::vector< int > m_userData
User data of vertices.
Definition CVertexArray.h:1238
cVector3d getTangent(const unsigned int a_vertexIndex) const
Definition CVertexArray.h:640
void computeGlobalPosition(const unsigned int a_vertexIndex, const cVector3d &a_globalPos, const cMatrix3d &a_globalRot)
Definition CVertexArray.h:745
bool m_useTexCoordData
If true then texture coordinate data will be allocated for each new vertex.
Definition CVertexArray.h:1254
void setLocalPos(const unsigned int a_vertexIndex, const double &a_x, const double &a_y, const double &a_z)
Definition CVertexArray.h:326
cVector3d getLocalPos(const unsigned int a_vertexIndex) const
Definition CVertexArray.h:377
bool m_useNormalData
If true then normal data will be allocated for each new vertex.
Definition CVertexArray.h:1251
unsigned int m_numVertices
Number of vertices.
Definition CVertexArray.h:1248
cColorf getColor(const unsigned int a_vertexIndex) const
Definition CVertexArray.h:584
void renderFinalize()
Definition CVertexArray.h:1043
bool getUseUserData() const
Definition CVertexArray.h:845
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
unsigned int getNumElements() const
Definition CVertexArray.h:761
bool m_flagTexCoordData
If true then texture coordinate data has been modified.
Definition CVertexArray.h:1282
void translate(const unsigned int a_vertexIndex, const cVector3d &a_translation)
Definition CVertexArray.h:361
GLuint m_normalBuffer
OpenGL Buffer for storing triangle indices.
Definition CVertexArray.h:1310
std::vector< cColorf > m_color
Color of vertices.
Definition CVertexArray.h:1229
void setBitangent(const unsigned int a_vertexIndex, const double &a_x, const double &a_y, const double &a_z)
Definition CVertexArray.h:675
GLuint m_tangentBuffer
OpenGL Buffer for storing triangle indices.
Definition CVertexArray.h:1319
void setTangent(const unsigned int a_vertexIndex, const cVector3d &a_tangent)
Definition CVertexArray.h:598
void setNormal(const unsigned int a_vertexIndex, const double &a_x, const double &a_y, const double &a_z)
Definition CVertexArray.h:428
bool getUseTangentData() const
Definition CVertexArray.h:817
virtual ~cVertexArray()
Definition CVertexArray.h:181
void renderInitialize()
Definition CVertexArray.h:856
Definition CAudioBuffer.cpp:57
std::shared_ptr< cVertexArray > cVertexArrayPtr
Definition CVertexArray.h:108
This class defines a color using a GLubyte representation for each component.
Definition CColor.h:1185
cColorf getColorf() const
This method returns this color converted into cColorf format.
Definition CColor.cpp:76
This class defines a color using a GLfloat representation for each component.
Definition CColor.h:139
This class implements a 3D matrix.
Definition CMatrix3d.h:98
void mulr(const double &a_scalar, cMatrix3d &a_result) const
This function computes the multiplication of this matrix by a scalar.
Definition CMatrix3d.h:916
This class implements a 3D vector.
Definition CVector3d.h:89
This structure manages user options when creating vertex arrays.
Definition CVertexArray.h:79
bool m_useTexCoordData
Definition CVertexArray.h:99
bool m_useUserData
Definition CVertexArray.h:103
bool m_useTangentData
Definition CVertexArray.h:101
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
bool m_useNormalData
Definition CVertexArray.h:98
bool m_useBitangentData
Definition CVertexArray.h:102
bool m_useColorData
Definition CVertexArray.h:100