Skip to content

Commit

Permalink
whoops forgot that normals need transformations as well
Browse files Browse the repository at this point in the history
  • Loading branch information
Fothsid committed Aug 15, 2021
1 parent 8315688 commit 25794f0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/convert_to_nbd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,9 +410,11 @@ static void FillMesh(FbxManager* sdkManager, OBMesh& mesh, FbxNode* node)
mesh.normalList->list.resize(vertices.size());
for (int i = 0; i < vertices.size(); i++)
{
mesh.normalList->list[i].x = vertices[i].nx;
mesh.normalList->list[i].y = vertices[i].ny;
mesh.normalList->list[i].z = vertices[i].nz;
FbxVector4 normal(vertices[i].nx, vertices[i].ny, vertices[i].nz);
normal = matrix.Inverse() * normal;
mesh.normalList->list[i].x = normal[0];
mesh.normalList->list[i].y = normal[1];
mesh.normalList->list[i].z = normal[2];
}
}

Expand Down

0 comments on commit 25794f0

Please sign in to comment.