Fix issue in TriangleVertexArray

This commit is contained in:
Daniel Chappuis 2017-09-04 07:26:01 +02:00
parent 946e62dd4b
commit 501bca5e3d

View File

@ -173,12 +173,12 @@ void TriangleVertexArray::computeVerticesNormals() {
for (uint v=0; v<mNbVertices * 3; v += 3) { for (uint v=0; v<mNbVertices * 3; v += 3) {
// Normalize the normal // Normalize the normal
Vector3 normal(verticesNormals[v * 3], verticesNormals[v * 3 + 1], verticesNormals[v * 3 + 2]); Vector3 normal(verticesNormals[v], verticesNormals[v + 1], verticesNormals[v + 2]);
normal.normalize(); normal.normalize();
verticesNormals[v * 3] = normal.x; verticesNormals[v] = normal.x;
verticesNormals[v * 3 + 1] = normal.y; verticesNormals[v + 1] = normal.y;
verticesNormals[v * 3 + 2] = normal.z; verticesNormals[v + 2] = normal.z;
} }
mVerticesNormalsStart = reinterpret_cast<unsigned char*>(verticesNormals); mVerticesNormalsStart = reinterpret_cast<unsigned char*>(verticesNormals);