Commit 36bf0a8f authored by Janis Born's avatar Janis Born

fix wrong indices in OBJ normal computation

parent 7e526c3b
......@@ -306,9 +306,9 @@ SharedGeometryData loadGeometryDataFromOBJ(const std::string& _filename, bool _c
if(_computeNormals)
{
size_t triangleIndex = i / 3;
glm::vec3 v0 = (glm::vec3)positionData[indices[triangleIndex+0].position];
glm::vec3 v1 = (glm::vec3)positionData[indices[triangleIndex+1].position];
glm::vec3 v2 = (glm::vec3)positionData[indices[triangleIndex+2].position];
glm::vec3 v0 = (glm::vec3)positionData[indices[3 * triangleIndex + 0].position];
glm::vec3 v1 = (glm::vec3)positionData[indices[3 * triangleIndex + 1].position];
glm::vec3 v2 = (glm::vec3)positionData[indices[3 * triangleIndex + 2].position];
glm::vec3 normal = glm::normalize(glm::cross(v1 - v0, v2 - v0));
abData[pos++] = normal.x;
abData[pos++] = normal.y;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment