Browse Source

Fix the fix

David Catuhe 7 years ago
parent
commit
78504c2c14

File diff suppressed because it is too large
+ 7522 - 7513
Playground/babylon.d.txt


File diff suppressed because it is too large
+ 6 - 6
Viewer/dist/viewer.js


File diff suppressed because it is too large
+ 6 - 6
Viewer/dist/viewer.min.js


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


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


+ 27 - 16
dist/preview release/babylon.max.js

@@ -15195,19 +15195,23 @@ var BABYLON;
             configurable: true
         });
         /**
-         * Sets a new pivot matrix to the mesh.
-         * Returns the AbstractMesh.
+         * Sets a new pivot matrix to the current node
+         * @param matrix defines the new pivot matrix to use
+         * @param postMultiplyPivotMatrix defines if the pivot matrix must be cancelled in the world matrix. By default the pivot matrix is just applied at the beginning of the world matrix. When this parameter is set to true, the inverse of the pivot matrix is also applied at the end to cancel the transformation effect
+         * @returns the current TransformNode
         */
         TransformNode.prototype.setPivotMatrix = function (matrix, postMultiplyPivotMatrix) {
             if (postMultiplyPivotMatrix === void 0) { postMultiplyPivotMatrix = false; }
             this._pivotMatrix = matrix.clone();
             this._cache.pivotMatrixUpdated = true;
             this._postMultiplyPivotMatrix = postMultiplyPivotMatrix;
-            if (!this._pivotMatrixInverse) {
-                this._pivotMatrixInverse = BABYLON.Matrix.Invert(this._pivotMatrix);
-            }
-            else {
-                this._pivotMatrix.invertToRef(this._pivotMatrixInverse);
+            if (this._postMultiplyPivotMatrix) {
+                if (!this._pivotMatrixInverse) {
+                    this._pivotMatrixInverse = BABYLON.Matrix.Invert(this._pivotMatrix);
+                }
+                else {
+                    this._pivotMatrix.invertToRef(this._pivotMatrixInverse);
+                }
             }
             return this;
         };
@@ -15371,8 +15375,16 @@ var BABYLON;
             BABYLON.Vector3.TransformNormalToRef(localAxis, this.getWorldMatrix(), result);
             return this;
         };
-        TransformNode.prototype.setPivotPoint = function (point, space) {
+        /**
+         * Sets a new pivot point to the current node
+         * @param point defines the new pivot point to use
+         * @param space defines if the point is in world or local space (local by default)
+         * @param postMultiplyPivotMatrix defines if the pivot transformation must be cancelled in the world matrix. By default the pivot matrix is just applied at the beginning of the world matrix. When this parameter is set to true, the inverse of the pivot matrix is also applied at the end to cancel the transformation effect
+         * @returns the current TransformNode
+        */
+        TransformNode.prototype.setPivotPoint = function (point, space, postMultiplyPivotMatrix) {
             if (space === void 0) { space = BABYLON.Space.LOCAL; }
+            if (postMultiplyPivotMatrix === void 0) { postMultiplyPivotMatrix = false; }
             if (this.getScene().getRenderId() == 0) {
                 this.computeWorldMatrix(true);
             }
@@ -15386,11 +15398,13 @@ var BABYLON;
             this._pivotMatrix.m[12] = -point.x;
             this._pivotMatrix.m[13] = -point.y;
             this._pivotMatrix.m[14] = -point.z;
-            if (!this._pivotMatrixInverse) {
-                this._pivotMatrixInverse = BABYLON.Matrix.Invert(this._pivotMatrix);
-            }
-            else {
-                this._pivotMatrix.invertToRef(this._pivotMatrixInverse);
+            if (this._postMultiplyPivotMatrix) {
+                if (!this._pivotMatrixInverse) {
+                    this._pivotMatrixInverse = BABYLON.Matrix.Invert(this._pivotMatrix);
+                }
+                else {
+                    this._pivotMatrix.invertToRef(this._pivotMatrixInverse);
+                }
             }
             this._cache.pivotMatrixUpdated = true;
             return this;
@@ -15764,9 +15778,6 @@ var BABYLON;
             this._afterComputeWorldMatrix();
             // Absolute position
             this._absolutePosition.copyFromFloats(this._worldMatrix.m[12], this._worldMatrix.m[13], this._worldMatrix.m[14]);
-            if (this._pivotMatrixInverse) {
-                BABYLON.Vector3.TransformCoordinatesToRef(this._absolutePosition, this._pivotMatrixInverse, this._absolutePosition);
-            }
             // Callbacks
             this.onAfterWorldMatrixUpdateObservable.notifyObservers(this);
             if (!this._poseMatrix) {

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


File diff suppressed because it is too large
+ 8702 - 8693
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts


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


+ 27 - 16
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js

@@ -15195,19 +15195,23 @@ var BABYLON;
             configurable: true
         });
         /**
-         * Sets a new pivot matrix to the mesh.
-         * Returns the AbstractMesh.
+         * Sets a new pivot matrix to the current node
+         * @param matrix defines the new pivot matrix to use
+         * @param postMultiplyPivotMatrix defines if the pivot matrix must be cancelled in the world matrix. By default the pivot matrix is just applied at the beginning of the world matrix. When this parameter is set to true, the inverse of the pivot matrix is also applied at the end to cancel the transformation effect
+         * @returns the current TransformNode
         */
         TransformNode.prototype.setPivotMatrix = function (matrix, postMultiplyPivotMatrix) {
             if (postMultiplyPivotMatrix === void 0) { postMultiplyPivotMatrix = false; }
             this._pivotMatrix = matrix.clone();
             this._cache.pivotMatrixUpdated = true;
             this._postMultiplyPivotMatrix = postMultiplyPivotMatrix;
-            if (!this._pivotMatrixInverse) {
-                this._pivotMatrixInverse = BABYLON.Matrix.Invert(this._pivotMatrix);
-            }
-            else {
-                this._pivotMatrix.invertToRef(this._pivotMatrixInverse);
+            if (this._postMultiplyPivotMatrix) {
+                if (!this._pivotMatrixInverse) {
+                    this._pivotMatrixInverse = BABYLON.Matrix.Invert(this._pivotMatrix);
+                }
+                else {
+                    this._pivotMatrix.invertToRef(this._pivotMatrixInverse);
+                }
             }
             return this;
         };
@@ -15371,8 +15375,16 @@ var BABYLON;
             BABYLON.Vector3.TransformNormalToRef(localAxis, this.getWorldMatrix(), result);
             return this;
         };
-        TransformNode.prototype.setPivotPoint = function (point, space) {
+        /**
+         * Sets a new pivot point to the current node
+         * @param point defines the new pivot point to use
+         * @param space defines if the point is in world or local space (local by default)
+         * @param postMultiplyPivotMatrix defines if the pivot transformation must be cancelled in the world matrix. By default the pivot matrix is just applied at the beginning of the world matrix. When this parameter is set to true, the inverse of the pivot matrix is also applied at the end to cancel the transformation effect
+         * @returns the current TransformNode
+        */
+        TransformNode.prototype.setPivotPoint = function (point, space, postMultiplyPivotMatrix) {
             if (space === void 0) { space = BABYLON.Space.LOCAL; }
+            if (postMultiplyPivotMatrix === void 0) { postMultiplyPivotMatrix = false; }
             if (this.getScene().getRenderId() == 0) {
                 this.computeWorldMatrix(true);
             }
@@ -15386,11 +15398,13 @@ var BABYLON;
             this._pivotMatrix.m[12] = -point.x;
             this._pivotMatrix.m[13] = -point.y;
             this._pivotMatrix.m[14] = -point.z;
-            if (!this._pivotMatrixInverse) {
-                this._pivotMatrixInverse = BABYLON.Matrix.Invert(this._pivotMatrix);
-            }
-            else {
-                this._pivotMatrix.invertToRef(this._pivotMatrixInverse);
+            if (this._postMultiplyPivotMatrix) {
+                if (!this._pivotMatrixInverse) {
+                    this._pivotMatrixInverse = BABYLON.Matrix.Invert(this._pivotMatrix);
+                }
+                else {
+                    this._pivotMatrix.invertToRef(this._pivotMatrixInverse);
+                }
             }
             this._cache.pivotMatrixUpdated = true;
             return this;
@@ -15764,9 +15778,6 @@ var BABYLON;
             this._afterComputeWorldMatrix();
             // Absolute position
             this._absolutePosition.copyFromFloats(this._worldMatrix.m[12], this._worldMatrix.m[13], this._worldMatrix.m[14]);
-            if (this._pivotMatrixInverse) {
-                BABYLON.Vector3.TransformCoordinatesToRef(this._absolutePosition, this._pivotMatrixInverse, this._absolutePosition);
-            }
             // Callbacks
             this.onAfterWorldMatrixUpdateObservable.notifyObservers(this);
             if (!this._poseMatrix) {

+ 27 - 16
dist/preview release/customConfigurations/minimalGLTFViewer/es6.js

@@ -15181,19 +15181,23 @@ var BABYLON;
             configurable: true
         });
         /**
-         * Sets a new pivot matrix to the mesh.
-         * Returns the AbstractMesh.
+         * Sets a new pivot matrix to the current node
+         * @param matrix defines the new pivot matrix to use
+         * @param postMultiplyPivotMatrix defines if the pivot matrix must be cancelled in the world matrix. By default the pivot matrix is just applied at the beginning of the world matrix. When this parameter is set to true, the inverse of the pivot matrix is also applied at the end to cancel the transformation effect
+         * @returns the current TransformNode
         */
         TransformNode.prototype.setPivotMatrix = function (matrix, postMultiplyPivotMatrix) {
             if (postMultiplyPivotMatrix === void 0) { postMultiplyPivotMatrix = false; }
             this._pivotMatrix = matrix.clone();
             this._cache.pivotMatrixUpdated = true;
             this._postMultiplyPivotMatrix = postMultiplyPivotMatrix;
-            if (!this._pivotMatrixInverse) {
-                this._pivotMatrixInverse = BABYLON.Matrix.Invert(this._pivotMatrix);
-            }
-            else {
-                this._pivotMatrix.invertToRef(this._pivotMatrixInverse);
+            if (this._postMultiplyPivotMatrix) {
+                if (!this._pivotMatrixInverse) {
+                    this._pivotMatrixInverse = BABYLON.Matrix.Invert(this._pivotMatrix);
+                }
+                else {
+                    this._pivotMatrix.invertToRef(this._pivotMatrixInverse);
+                }
             }
             return this;
         };
@@ -15357,8 +15361,16 @@ var BABYLON;
             BABYLON.Vector3.TransformNormalToRef(localAxis, this.getWorldMatrix(), result);
             return this;
         };
-        TransformNode.prototype.setPivotPoint = function (point, space) {
+        /**
+         * Sets a new pivot point to the current node
+         * @param point defines the new pivot point to use
+         * @param space defines if the point is in world or local space (local by default)
+         * @param postMultiplyPivotMatrix defines if the pivot transformation must be cancelled in the world matrix. By default the pivot matrix is just applied at the beginning of the world matrix. When this parameter is set to true, the inverse of the pivot matrix is also applied at the end to cancel the transformation effect
+         * @returns the current TransformNode
+        */
+        TransformNode.prototype.setPivotPoint = function (point, space, postMultiplyPivotMatrix) {
             if (space === void 0) { space = BABYLON.Space.LOCAL; }
+            if (postMultiplyPivotMatrix === void 0) { postMultiplyPivotMatrix = false; }
             if (this.getScene().getRenderId() == 0) {
                 this.computeWorldMatrix(true);
             }
@@ -15372,11 +15384,13 @@ var BABYLON;
             this._pivotMatrix.m[12] = -point.x;
             this._pivotMatrix.m[13] = -point.y;
             this._pivotMatrix.m[14] = -point.z;
-            if (!this._pivotMatrixInverse) {
-                this._pivotMatrixInverse = BABYLON.Matrix.Invert(this._pivotMatrix);
-            }
-            else {
-                this._pivotMatrix.invertToRef(this._pivotMatrixInverse);
+            if (this._postMultiplyPivotMatrix) {
+                if (!this._pivotMatrixInverse) {
+                    this._pivotMatrixInverse = BABYLON.Matrix.Invert(this._pivotMatrix);
+                }
+                else {
+                    this._pivotMatrix.invertToRef(this._pivotMatrixInverse);
+                }
             }
             this._cache.pivotMatrixUpdated = true;
             return this;
@@ -15750,9 +15764,6 @@ var BABYLON;
             this._afterComputeWorldMatrix();
             // Absolute position
             this._absolutePosition.copyFromFloats(this._worldMatrix.m[12], this._worldMatrix.m[13], this._worldMatrix.m[14]);
-            if (this._pivotMatrixInverse) {
-                BABYLON.Vector3.TransformCoordinatesToRef(this._absolutePosition, this._pivotMatrixInverse, this._absolutePosition);
-            }
             // Callbacks
             this.onAfterWorldMatrixUpdateObservable.notifyObservers(this);
             if (!this._poseMatrix) {

+ 27 - 16
dist/preview release/es6.js

@@ -15181,19 +15181,23 @@ var BABYLON;
             configurable: true
         });
         /**
-         * Sets a new pivot matrix to the mesh.
-         * Returns the AbstractMesh.
+         * Sets a new pivot matrix to the current node
+         * @param matrix defines the new pivot matrix to use
+         * @param postMultiplyPivotMatrix defines if the pivot matrix must be cancelled in the world matrix. By default the pivot matrix is just applied at the beginning of the world matrix. When this parameter is set to true, the inverse of the pivot matrix is also applied at the end to cancel the transformation effect
+         * @returns the current TransformNode
         */
         TransformNode.prototype.setPivotMatrix = function (matrix, postMultiplyPivotMatrix) {
             if (postMultiplyPivotMatrix === void 0) { postMultiplyPivotMatrix = false; }
             this._pivotMatrix = matrix.clone();
             this._cache.pivotMatrixUpdated = true;
             this._postMultiplyPivotMatrix = postMultiplyPivotMatrix;
-            if (!this._pivotMatrixInverse) {
-                this._pivotMatrixInverse = BABYLON.Matrix.Invert(this._pivotMatrix);
-            }
-            else {
-                this._pivotMatrix.invertToRef(this._pivotMatrixInverse);
+            if (this._postMultiplyPivotMatrix) {
+                if (!this._pivotMatrixInverse) {
+                    this._pivotMatrixInverse = BABYLON.Matrix.Invert(this._pivotMatrix);
+                }
+                else {
+                    this._pivotMatrix.invertToRef(this._pivotMatrixInverse);
+                }
             }
             return this;
         };
@@ -15357,8 +15361,16 @@ var BABYLON;
             BABYLON.Vector3.TransformNormalToRef(localAxis, this.getWorldMatrix(), result);
             return this;
         };
-        TransformNode.prototype.setPivotPoint = function (point, space) {
+        /**
+         * Sets a new pivot point to the current node
+         * @param point defines the new pivot point to use
+         * @param space defines if the point is in world or local space (local by default)
+         * @param postMultiplyPivotMatrix defines if the pivot transformation must be cancelled in the world matrix. By default the pivot matrix is just applied at the beginning of the world matrix. When this parameter is set to true, the inverse of the pivot matrix is also applied at the end to cancel the transformation effect
+         * @returns the current TransformNode
+        */
+        TransformNode.prototype.setPivotPoint = function (point, space, postMultiplyPivotMatrix) {
             if (space === void 0) { space = BABYLON.Space.LOCAL; }
+            if (postMultiplyPivotMatrix === void 0) { postMultiplyPivotMatrix = false; }
             if (this.getScene().getRenderId() == 0) {
                 this.computeWorldMatrix(true);
             }
@@ -15372,11 +15384,13 @@ var BABYLON;
             this._pivotMatrix.m[12] = -point.x;
             this._pivotMatrix.m[13] = -point.y;
             this._pivotMatrix.m[14] = -point.z;
-            if (!this._pivotMatrixInverse) {
-                this._pivotMatrixInverse = BABYLON.Matrix.Invert(this._pivotMatrix);
-            }
-            else {
-                this._pivotMatrix.invertToRef(this._pivotMatrixInverse);
+            if (this._postMultiplyPivotMatrix) {
+                if (!this._pivotMatrixInverse) {
+                    this._pivotMatrixInverse = BABYLON.Matrix.Invert(this._pivotMatrix);
+                }
+                else {
+                    this._pivotMatrix.invertToRef(this._pivotMatrixInverse);
+                }
             }
             this._cache.pivotMatrixUpdated = true;
             return this;
@@ -15750,9 +15764,6 @@ var BABYLON;
             this._afterComputeWorldMatrix();
             // Absolute position
             this._absolutePosition.copyFromFloats(this._worldMatrix.m[12], this._worldMatrix.m[13], this._worldMatrix.m[14]);
-            if (this._pivotMatrixInverse) {
-                BABYLON.Vector3.TransformCoordinatesToRef(this._absolutePosition, this._pivotMatrixInverse, this._absolutePosition);
-            }
             // Callbacks
             this.onAfterWorldMatrixUpdateObservable.notifyObservers(this);
             if (!this._poseMatrix) {

+ 2 - 36
dist/preview release/typedocValidationBaseline.json

@@ -1,7 +1,7 @@
 {
-  "errors": 8172,
+  "errors": 8166,
   "babylon.typedoc.json": {
-    "errors": 8172,
+    "errors": 8166,
     "AnimationKeyInterpolation": {
       "Enumeration": {
         "Comments": {
@@ -37989,40 +37989,6 @@
             }
           }
         },
-        "setPivotMatrix": {
-          "Comments": {
-            "MissingReturn": true
-          },
-          "Parameter": {
-            "matrix": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "postMultiplyPivotMatrix": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        },
-        "setPivotPoint": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "point": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "space": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        },
         "setPositionWithLocalVector": {
           "Comments": {
             "MissingReturn": true

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


+ 25 - 16
src/Mesh/babylon.transformNode.ts

@@ -208,18 +208,22 @@ module BABYLON {
         }
 
         /**
-         * Sets a new pivot matrix to the mesh.  
-         * Returns the AbstractMesh.
+         * Sets a new pivot matrix to the current node
+         * @param matrix defines the new pivot matrix to use
+         * @param postMultiplyPivotMatrix defines if the pivot matrix must be cancelled in the world matrix. By default the pivot matrix is just applied at the beginning of the world matrix. When this parameter is set to true, the inverse of the pivot matrix is also applied at the end to cancel the transformation effect
+         * @returns the current TransformNode
         */
         public setPivotMatrix(matrix: Matrix, postMultiplyPivotMatrix = false): TransformNode {
             this._pivotMatrix = matrix.clone();
             this._cache.pivotMatrixUpdated = true;
             this._postMultiplyPivotMatrix = postMultiplyPivotMatrix;
 
-            if(!this._pivotMatrixInverse){
-                this._pivotMatrixInverse = Matrix.Invert(this._pivotMatrix);
-            } else {
-                this._pivotMatrix.invertToRef(this._pivotMatrixInverse);
+            if (this._postMultiplyPivotMatrix) {
+                if (!this._pivotMatrixInverse) {
+                    this._pivotMatrixInverse = Matrix.Invert(this._pivotMatrix);
+                } else {
+                    this._pivotMatrix.invertToRef(this._pivotMatrixInverse);
+                }
             }
 
             return this;
@@ -393,7 +397,14 @@ module BABYLON {
             return this;
         }
 
-        public setPivotPoint(point: Vector3, space: Space = Space.LOCAL): TransformNode {
+        /**
+         * Sets a new pivot point to the current node
+         * @param point defines the new pivot point to use
+         * @param space defines if the point is in world or local space (local by default)
+         * @param postMultiplyPivotMatrix defines if the pivot transformation must be cancelled in the world matrix. By default the pivot matrix is just applied at the beginning of the world matrix. When this parameter is set to true, the inverse of the pivot matrix is also applied at the end to cancel the transformation effect
+         * @returns the current TransformNode
+        */        
+        public setPivotPoint(point: Vector3, space: Space = Space.LOCAL, postMultiplyPivotMatrix = false): TransformNode {
             if (this.getScene().getRenderId() == 0) {
                 this.computeWorldMatrix(true);
             }
@@ -411,12 +422,14 @@ module BABYLON {
             this._pivotMatrix.m[13] = -point.y;
             this._pivotMatrix.m[14] = -point.z;
 
-            if(!this._pivotMatrixInverse){
-                this._pivotMatrixInverse = Matrix.Invert(this._pivotMatrix);
-            } else {
-                this._pivotMatrix.invertToRef(this._pivotMatrixInverse);
+            if (this._postMultiplyPivotMatrix) {
+                if (!this._pivotMatrixInverse) {
+                    this._pivotMatrixInverse = Matrix.Invert(this._pivotMatrix);
+                } else {
+                    this._pivotMatrix.invertToRef(this._pivotMatrixInverse);
+                }
             }
-            
+
             this._cache.pivotMatrixUpdated = true;
             return this;
         }
@@ -835,10 +848,6 @@ module BABYLON {
             // Absolute position
             this._absolutePosition.copyFromFloats(this._worldMatrix.m[12], this._worldMatrix.m[13], this._worldMatrix.m[14]);
 
-            if(this._pivotMatrixInverse){
-                Vector3.TransformCoordinatesToRef(this._absolutePosition, this._pivotMatrixInverse, this._absolutePosition);
-            }
-
             // Callbacks
             this.onAfterWorldMatrixUpdateObservable.notifyObservers(this);