Skip to content

Commit

Permalink
Keep 0 normals and just don't use them
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Beeson authored and kbrameld committed Jan 24, 2024
1 parent bf32057 commit 108943d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/shapes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -661,10 +661,10 @@ void Mesh::computeVertexNormals(bool debug)
{
if (avg_normals[i].squaredNorm () > 0.0) {
avg_normals[i].normalize();
} else {
//if( debug ) { printf("Had to use Patrick trick!!!! [%d] avg normal: %f %f %f \n", i, avg_normals[i][0], avg_normals[i][1], avg_normals[i][2] ); }
avg_normals[i][0]=avg_normals[i][1]=avg_normals[i][2]=std::sqrt(1.0/3);
}
else
avg_normals[i][0]=avg_normals[i][1]=avg_normals[i][2]=0;

unsigned int i3 = i * 3;
vertex_normals[i3] = avg_normals[i][0];
vertex_normals[i3 + 1] = avg_normals[i][1];
Expand Down Expand Up @@ -708,7 +708,7 @@ void shapes::Mesh::computeVertexNormals_original()
if (avg_normals[i].squaredNorm() > 0.0)
avg_normals[i].normalize();
else
avg_normals[i][0]=avg_normals[i][1]=avg_normals[i][2]=std::sqrt(1.0/3);
avg_normals[i][0]=avg_normals[i][1]=avg_normals[i][2]=0;

unsigned int i3 = i * 3;
vertex_normals[i3] = avg_normals[i][0];
Expand Down

0 comments on commit 108943d

Please sign in to comment.