Skip to content

Commit c10acd1

Browse files
committed
Fixed normal renormalization being triggered unnecesarily, reported at vpenades#243
1 parent e8d7d5a commit c10acd1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/SharpGLTF.Toolkit/Geometry/VertexTypes/VertexPreprocessorLambdas.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ static class VertexPreprocessorLambdas
161161
if (n == Vector3.Zero) return null;
162162

163163
var l = n.Length();
164-
if (l < 0.99f || l > 0.01f) vertex.SetNormal(Vector3.Normalize(n));
164+
if (Math.Abs(l-1) > 0.01f) vertex.SetNormal(Vector3.Normalize(n));
165165
}
166166

167167
if (vertex.TryGetTangent(out Vector4 tw))
@@ -175,7 +175,7 @@ static class VertexPreprocessorLambdas
175175
if (tw.W < 0) tw.W = -1;
176176

177177
var l = t.Length();
178-
if (l < 0.99f || l > 0.01f) t = Vector3.Normalize(t);
178+
if (Math.Abs(l - 1) > 0.01f) t = Vector3.Normalize(t);
179179

180180
vertex.SetTangent(new Vector4(t, tw.W));
181181
}

0 commit comments

Comments
 (0)