Forráskód Böngészése

Path3D edge case fix

Poolminer 5 éve
szülő
commit
917df6179a
1 módosított fájl, 6 hozzáadás és 5 törlés
  1. 6 5
      src/Maths/math.path.ts

+ 6 - 5
src/Maths/math.path.ts

@@ -632,14 +632,15 @@ export class Path3D {
             // normals and binormals
             // http://www.cs.cmu.edu/afs/andrew/scs/cs/15-462/web/old/asst2camera.html
             curTang = this._tangents[i];
-            prevNor = this._normals[i - 1];
             prevBinor = this._binormals[i - 1];
             this._normals[i] = Vector3.Cross(prevBinor, curTang);
-            if (this._normals[i].length() === 0) {
-                this._normals[i] = prevNor;
-            }
             if (!this._raw) {
-                this._normals[i].normalize();
+                if (this._normals[i].length() === 0) {
+                    prevNor = this._normals[i - 1];
+                    this._normals[i] = prevNor.clone();
+                } else {
+                    this._normals[i].normalize();
+                }
             }
             this._binormals[i] = Vector3.Cross(curTang, this._normals[i]);
             if (!this._raw) {