Browse Source

fix scaling issues with billboards

David Catuhe 8 years ago
parent
commit
a88b8752c4

File diff suppressed because it is too large
+ 19 - 19
dist/preview release/babylon.core.js


File diff suppressed because it is too large
+ 1186 - 1186
dist/preview release/babylon.d.ts


File diff suppressed because it is too large
+ 19 - 19
dist/preview release/babylon.js


+ 5 - 3
dist/preview release/babylon.max.js

@@ -12681,13 +12681,13 @@ var BABYLON;
             if (this.billboardMode !== AbstractMesh.BILLBOARDMODE_NONE && this.getScene().activeCamera) {
                 BABYLON.Tmp.Matrix[1].copyFrom(this.getScene().activeCamera.getViewMatrix());
                 BABYLON.Tmp.Matrix[1].setTranslationFromFloats(0, 0, 0);
-                BABYLON.Tmp.Matrix[1].invertToRef(BABYLON.Tmp.Matrix[5]);
+                BABYLON.Tmp.Matrix[1].invertToRef(BABYLON.Tmp.Matrix[0]);
                 if ((this.billboardMode & AbstractMesh.BILLBOARDMODE_ALL) !== AbstractMesh.BILLBOARDMODE_ALL) {
                     // Need to extract rotation vectors
                     var scale = BABYLON.Tmp.Vector3[2];
                     var rotation = BABYLON.Tmp.Quaternion[0];
                     var translation = BABYLON.Tmp.Vector3[3];
-                    BABYLON.Tmp.Matrix[5].decompose(scale, rotation, translation);
+                    BABYLON.Tmp.Matrix[0].decompose(scale, rotation, translation);
                     var finalQuaternion = BABYLON.Tmp.Quaternion[1];
                     finalQuaternion.w = rotation.w;
                     if ((this.billboardMode & AbstractMesh.BILLBOARDMODE_X) === AbstractMesh.BILLBOARDMODE_X) {
@@ -12699,8 +12699,10 @@ var BABYLON;
                     if ((this.billboardMode & AbstractMesh.BILLBOARDMODE_Z) === AbstractMesh.BILLBOARDMODE_Z) {
                         finalQuaternion.z = rotation.z;
                     }
-                    BABYLON.Matrix.ComposeToRef(scale, finalQuaternion, translation, BABYLON.Tmp.Matrix[5]);
+                    BABYLON.Matrix.ComposeToRef(scale, finalQuaternion, translation, BABYLON.Tmp.Matrix[0]);
                 }
+                BABYLON.Tmp.Matrix[1].copyFrom(BABYLON.Tmp.Matrix[5]);
+                BABYLON.Tmp.Matrix[1].multiplyToRef(BABYLON.Tmp.Matrix[0], BABYLON.Tmp.Matrix[5]);
             }
             // Local world
             BABYLON.Tmp.Matrix[5].multiplyToRef(BABYLON.Tmp.Matrix[2], this._localWorld);

File diff suppressed because it is too large
+ 1186 - 1186
dist/preview release/babylon.module.d.ts


File diff suppressed because it is too large
+ 19 - 19
dist/preview release/babylon.noworker.js


+ 6 - 3
src/Mesh/babylon.abstractMesh.ts

@@ -873,7 +873,7 @@
                 Tmp.Matrix[1].copyFrom(this.getScene().activeCamera.getViewMatrix());
 
                 Tmp.Matrix[1].setTranslationFromFloats(0, 0, 0);
-                Tmp.Matrix[1].invertToRef(Tmp.Matrix[5]);
+                Tmp.Matrix[1].invertToRef(Tmp.Matrix[0]);
 
                 if ((this.billboardMode & AbstractMesh.BILLBOARDMODE_ALL) !== AbstractMesh.BILLBOARDMODE_ALL)
                 {
@@ -881,7 +881,7 @@
                     var scale = Tmp.Vector3[2];
                     var rotation = Tmp.Quaternion[0];
                     var translation = Tmp.Vector3[3];
-                    Tmp.Matrix[5].decompose(scale, rotation, translation);
+                    Tmp.Matrix[0].decompose(scale, rotation, translation);
 
                     var finalQuaternion = Tmp.Quaternion[1];
                     finalQuaternion.w = rotation.w;
@@ -900,8 +900,11 @@
                         finalQuaternion.z = rotation.z;
                     }
  
-                    Matrix.ComposeToRef(scale, finalQuaternion, translation, Tmp.Matrix[5]);
+                    Matrix.ComposeToRef(scale, finalQuaternion, translation, Tmp.Matrix[0]);
                 }
+
+                Tmp.Matrix[1].copyFrom(Tmp.Matrix[5]);
+                Tmp.Matrix[1].multiplyToRef(Tmp.Matrix[0], Tmp.Matrix[5]);
             }
 
             // Local world