From e1602f2b272c571e68d234fcf1e340e811071300 Mon Sep 17 00:00:00 2001 From: Daniel Chappuis Date: Sun, 3 Sep 2017 17:35:09 +0200 Subject: [PATCH] Fix issues with normals computation in TriangleVertexArray --- src/collision/TriangleVertexArray.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/collision/TriangleVertexArray.cpp b/src/collision/TriangleVertexArray.cpp index ad59d37a..1e500001 100644 --- a/src/collision/TriangleVertexArray.cpp +++ b/src/collision/TriangleVertexArray.cpp @@ -163,9 +163,9 @@ void TriangleVertexArray::computeVerticesNormals() { Vector3 normalComponent = std::asin(sinA) * crossProduct; // Add the normal component of this vertex into the normals array - verticesNormals[verticesIndices[v]] = normalComponent.x; - verticesNormals[verticesIndices[v] + 1] = normalComponent.y; - verticesNormals[verticesIndices[v] + 2] = normalComponent.z; + verticesNormals[verticesIndices[v] * 3] = normalComponent.x; + verticesNormals[verticesIndices[v] * 3 + 1] = normalComponent.y; + verticesNormals[verticesIndices[v] * 3 + 2] = normalComponent.z; } } @@ -173,12 +173,12 @@ void TriangleVertexArray::computeVerticesNormals() { for (uint v=0; v(verticesNormals);