Skip to content
Jesusemora edited this page Mar 30, 2023 · 2 revisions

Mesh

Variables

                                              
vector<float> vertices vector containing vertex position, they are stored in the format: x, y, z, x, y, z, x, y, z
vector<float> normals vector containing vertex normal information, they are stored in the format: x, y, z, x, y, z, x, y, z
vector<float> uvs vector containing vertex uv information, they are stored in the format: u, v, u, v, u, v
vector<float> tangents vector containing vertex tangent information, this is generated by the function GetTangents or GetTangentsTriangles. It is stored in the format: x, y, z, x, y, z, x, y, z
vector<GLuint> indices vector containing triangle indices, they are stored in the format: v0, v1, v2, v0, v1, v2, v0, v1, v2
int numverts used during loading of mesh, it contains a number equal to the sum of the size of vertices, normals and uvs, which divided by 8 can be multiplied by 2 or 3 to get the size of vertices or uvs.
int numindices number of indices, used in glDrawElements. Equivalent to indices.size()
string name name of the mesh

public methods

void GetTangents() generates tangents and fills the vector tangents. used with glDrawElements
void GetTangentsTriangles() generates tangents when vertices is divisible by 3. used with glDrawArrays. Gives bad results, should be removed eventually.
void RecalculateNormals() clears normals and fills it with newly generated normals from vertices and faces
void CalculateNormals() calculates and fills normals with unit normal vectors generated from vertices and faces
string debug() returns a string with the sizes of the vectors of Mesh, used for testing of model loading and general debuging.

Clone this wiki locally