瀏覽代碼

Merge remote-tracking branch 'upstream/master' into FixGulpMac

sebastien 6 年之前
父節點
當前提交
a28445a465

文件差異過大導致無法顯示
+ 14759 - 14760
Playground/babylon.d.txt


文件差異過大導致無法顯示
+ 14200 - 14201
dist/preview release/babylon.d.ts


文件差異過大導致無法顯示
+ 1 - 1
dist/preview release/babylon.js


+ 28 - 35
dist/preview release/babylon.max.js

@@ -8396,8 +8396,8 @@ var BABYLON;
          * @param result defines the target matrix
          * @param result defines the target matrix
          */
          */
         Matrix.RotationYawPitchRollToRef = function (yaw, pitch, roll, result) {
         Matrix.RotationYawPitchRollToRef = function (yaw, pitch, roll, result) {
-            Quaternion.RotationYawPitchRollToRef(yaw, pitch, roll, this._tempQuaternion);
-            this._tempQuaternion.toRotationMatrix(result);
+            Quaternion.RotationYawPitchRollToRef(yaw, pitch, roll, MathTmp.Quaternion[0]);
+            MathTmp.Quaternion[0].toRotationMatrix(result);
         };
         };
         /**
         /**
          * Creates a scaling matrix
          * Creates a scaling matrix
@@ -8997,7 +8997,6 @@ var BABYLON;
             result.m[15] = 1.0;
             result.m[15] = 1.0;
             result._markAsUpdated();
             result._markAsUpdated();
         };
         };
-        Matrix._tempQuaternion = new Quaternion();
         Matrix._xAxis = Vector3.Zero();
         Matrix._xAxis = Vector3.Zero();
         Matrix._yAxis = Vector3.Zero();
         Matrix._yAxis = Vector3.Zero();
         Matrix._zAxis = Vector3.Zero();
         Matrix._zAxis = Vector3.Zero();
@@ -19274,7 +19273,7 @@ var BABYLON;
             this.reConstruct(min, max, worldMatrix);
             this.reConstruct(min, max, worldMatrix);
         }
         }
         /**
         /**
-         * Recreates the entire bounding sphere from scratch
+         * Recreates the entire bounding sphere from scratch as if we call the constructor in place
          * @param min defines the new minimum vector (in local space)
          * @param min defines the new minimum vector (in local space)
          * @param max defines the new maximum vector (in local space)
          * @param max defines the new maximum vector (in local space)
          * @param worldMatrix defines the new world matrix
          * @param worldMatrix defines the new world matrix
@@ -19298,9 +19297,16 @@ var BABYLON;
             var tempRadiusVector = tmpVectors[0].setAll(newRadius);
             var tempRadiusVector = tmpVectors[0].setAll(newRadius);
             var min = this.center.subtractToRef(tempRadiusVector, tmpVectors[1]);
             var min = this.center.subtractToRef(tempRadiusVector, tmpVectors[1]);
             var max = this.center.addToRef(tempRadiusVector, tmpVectors[2]);
             var max = this.center.addToRef(tempRadiusVector, tmpVectors[2]);
-            this.reConstruct(min, max);
+            this.reConstruct(min, max, this._worldMatrix);
             return this;
             return this;
         };
         };
+        /**
+         * Gets the world matrix of the bounding box
+         * @returns a matrix
+         */
+        BoundingSphere.prototype.getWorldMatrix = function () {
+            return this._worldMatrix;
+        };
         // Methods
         // Methods
         /** @hidden */
         /** @hidden */
         BoundingSphere.prototype._update = function (worldMatrix) {
         BoundingSphere.prototype._update = function (worldMatrix) {
@@ -19424,7 +19430,7 @@ var BABYLON;
         }
         }
         // Methods
         // Methods
         /**
         /**
-         * Recreates the entire bounding box from scratch
+         * Recreates the entire bounding box from scratch as if we call the constructor in place
          * @param min defines the new minimum vector (in local space)
          * @param min defines the new minimum vector (in local space)
          * @param max defines the new maximum vector (in local space)
          * @param max defines the new maximum vector (in local space)
          * @param worldMatrix defines the new world matrix
          * @param worldMatrix defines the new world matrix
@@ -19445,7 +19451,7 @@ var BABYLON;
             // OBB
             // OBB
             max.addToRef(min, this.center).scaleInPlace(0.5);
             max.addToRef(min, this.center).scaleInPlace(0.5);
             max.subtractToRef(min, this.extendSize).scaleInPlace(0.5);
             max.subtractToRef(min, this.extendSize).scaleInPlace(0.5);
-            this._update(worldMatrix || this._worldMatrix || BABYLON.Matrix.Identity());
+            this._update(worldMatrix || BABYLON.Matrix.IdentityReadOnly);
         };
         };
         /**
         /**
          * Scale the current bounding box by applying a scale factor
          * Scale the current bounding box by applying a scale factor
@@ -19461,7 +19467,7 @@ var BABYLON;
             var newRadius = diff.scaleInPlace(distance * 0.5);
             var newRadius = diff.scaleInPlace(distance * 0.5);
             var min = this.center.subtractToRef(newRadius, tmpVectors[1]);
             var min = this.center.subtractToRef(newRadius, tmpVectors[1]);
             var max = this.center.addToRef(newRadius, tmpVectors[2]);
             var max = this.center.addToRef(newRadius, tmpVectors[2]);
-            this.reConstruct(min, max);
+            this.reConstruct(min, max, this._worldMatrix);
             return this;
             return this;
         };
         };
         /**
         /**
@@ -19471,15 +19477,6 @@ var BABYLON;
         BoundingBox.prototype.getWorldMatrix = function () {
         BoundingBox.prototype.getWorldMatrix = function () {
             return this._worldMatrix;
             return this._worldMatrix;
         };
         };
-        /**
-         * Sets the world matrix stored in the bounding box
-         * @param matrix defines the matrix to store
-         * @returns current bounding box
-         */
-        BoundingBox.prototype.setWorldMatrix = function (matrix) {
-            this._worldMatrix.copyFrom(matrix);
-            return this;
-        };
         /** @hidden */
         /** @hidden */
         BoundingBox.prototype._update = function (world) {
         BoundingBox.prototype._update = function (world) {
             var minWorld = this.minimumWorld;
             var minWorld = this.minimumWorld;
@@ -19655,22 +19652,21 @@ var BABYLON;
 
 
 var BABYLON;
 var BABYLON;
 (function (BABYLON) {
 (function (BABYLON) {
-    var computeBoxExtents = function (axis, box) {
+    var _result0 = { min: 0, max: 0 };
+    var _result1 = { min: 0, max: 0 };
+    var computeBoxExtents = function (axis, box, result) {
         var p = BABYLON.Vector3.Dot(box.centerWorld, axis);
         var p = BABYLON.Vector3.Dot(box.centerWorld, axis);
         var r0 = Math.abs(BABYLON.Vector3.Dot(box.directions[0], axis)) * box.extendSize.x;
         var r0 = Math.abs(BABYLON.Vector3.Dot(box.directions[0], axis)) * box.extendSize.x;
         var r1 = Math.abs(BABYLON.Vector3.Dot(box.directions[1], axis)) * box.extendSize.y;
         var r1 = Math.abs(BABYLON.Vector3.Dot(box.directions[1], axis)) * box.extendSize.y;
         var r2 = Math.abs(BABYLON.Vector3.Dot(box.directions[2], axis)) * box.extendSize.z;
         var r2 = Math.abs(BABYLON.Vector3.Dot(box.directions[2], axis)) * box.extendSize.z;
         var r = r0 + r1 + r2;
         var r = r0 + r1 + r2;
-        return {
-            min: p - r,
-            max: p + r
-        };
+        result.min = p - r;
+        result.max = p + r;
     };
     };
-    var extentsOverlap = function (min0, max0, min1, max1) { return !(min0 > max1 || min1 > max0); };
     var axisOverlap = function (axis, box0, box1) {
     var axisOverlap = function (axis, box0, box1) {
-        var result0 = computeBoxExtents(axis, box0);
-        var result1 = computeBoxExtents(axis, box1);
-        return extentsOverlap(result0.min, result0.max, result1.min, result1.max);
+        computeBoxExtents(axis, box0, _result0);
+        computeBoxExtents(axis, box1, _result1);
+        return !(_result0.min > _result1.max || _result1.min > _result0.max);
     };
     };
     /**
     /**
      * Info for a bounding data of a mesh
      * Info for a bounding data of a mesh
@@ -19688,7 +19684,7 @@ var BABYLON;
             this.boundingSphere = new BABYLON.BoundingSphere(minimum, maximum, worldMatrix);
             this.boundingSphere = new BABYLON.BoundingSphere(minimum, maximum, worldMatrix);
         }
         }
         /**
         /**
-         * Recreates the entire bounding info from scratch
+         * Recreates the entire bounding info from scratch as if we call the constructor in place
          * @param min defines the new minimum vector (in local space)
          * @param min defines the new minimum vector (in local space)
          * @param max defines the new maximum vector (in local space)
          * @param max defines the new maximum vector (in local space)
          * @param worldMatrix defines the new world matrix
          * @param worldMatrix defines the new world matrix
@@ -19751,8 +19747,8 @@ var BABYLON;
         BoundingInfo.prototype.centerOn = function (center, extend) {
         BoundingInfo.prototype.centerOn = function (center, extend) {
             var minimum = BoundingInfo.TmpVector3[0].copyFrom(center).subtractInPlace(extend);
             var minimum = BoundingInfo.TmpVector3[0].copyFrom(center).subtractInPlace(extend);
             var maximum = BoundingInfo.TmpVector3[1].copyFrom(center).addInPlace(extend);
             var maximum = BoundingInfo.TmpVector3[1].copyFrom(center).addInPlace(extend);
-            this.boundingBox.reConstruct(minimum, maximum);
-            this.boundingSphere.reConstruct(minimum, maximum);
+            this.boundingBox.reConstruct(minimum, maximum, this.boundingBox.getWorldMatrix());
+            this.boundingSphere.reConstruct(minimum, maximum, this.boundingBox.getWorldMatrix());
             return this;
             return this;
         };
         };
         /**
         /**
@@ -19832,9 +19828,6 @@ var BABYLON;
          * @returns if the bounding info intersects
          * @returns if the bounding info intersects
          */
          */
         BoundingInfo.prototype.intersects = function (boundingInfo, precise) {
         BoundingInfo.prototype.intersects = function (boundingInfo, precise) {
-            if (!this.boundingSphere.centerWorld || !boundingInfo.boundingSphere.centerWorld) {
-                return false;
-            }
             if (!BABYLON.BoundingSphere.Intersects(this.boundingSphere, boundingInfo.boundingSphere)) {
             if (!BABYLON.BoundingSphere.Intersects(this.boundingSphere, boundingInfo.boundingSphere)) {
                 return false;
                 return false;
             }
             }
@@ -27134,6 +27127,9 @@ var BABYLON;
                     evt.preventDefault();
                     evt.preventDefault();
                     canvas.focus();
                     canvas.focus();
                 }
                 }
+                _this._startingPointerPosition.x = _this._pointerX;
+                _this._startingPointerPosition.y = _this._pointerY;
+                _this._startingPointerTime = Date.now();
                 // PreObservable support
                 // PreObservable support
                 if (_this._checkPrePointerObservable(null, evt, BABYLON.PointerEventTypes.POINTERDOWN)) {
                 if (_this._checkPrePointerObservable(null, evt, BABYLON.PointerEventTypes.POINTERDOWN)) {
                     return;
                     return;
@@ -27142,9 +27138,6 @@ var BABYLON;
                     return;
                     return;
                 }
                 }
                 _this._pointerCaptures[evt.pointerId] = true;
                 _this._pointerCaptures[evt.pointerId] = true;
-                _this._startingPointerPosition.x = _this._pointerX;
-                _this._startingPointerPosition.y = _this._pointerY;
-                _this._startingPointerTime = Date.now();
                 if (!_this.pointerDownPredicate) {
                 if (!_this.pointerDownPredicate) {
                     _this.pointerDownPredicate = function (mesh) {
                     _this.pointerDownPredicate = function (mesh) {
                         return mesh.isPickable && mesh.isVisible && mesh.isReady() && mesh.isEnabled();
                         return mesh.isPickable && mesh.isVisible && mesh.isReady() && mesh.isEnabled();

+ 28 - 35
dist/preview release/babylon.no-module.max.js

@@ -8363,8 +8363,8 @@ var BABYLON;
          * @param result defines the target matrix
          * @param result defines the target matrix
          */
          */
         Matrix.RotationYawPitchRollToRef = function (yaw, pitch, roll, result) {
         Matrix.RotationYawPitchRollToRef = function (yaw, pitch, roll, result) {
-            Quaternion.RotationYawPitchRollToRef(yaw, pitch, roll, this._tempQuaternion);
-            this._tempQuaternion.toRotationMatrix(result);
+            Quaternion.RotationYawPitchRollToRef(yaw, pitch, roll, MathTmp.Quaternion[0]);
+            MathTmp.Quaternion[0].toRotationMatrix(result);
         };
         };
         /**
         /**
          * Creates a scaling matrix
          * Creates a scaling matrix
@@ -8964,7 +8964,6 @@ var BABYLON;
             result.m[15] = 1.0;
             result.m[15] = 1.0;
             result._markAsUpdated();
             result._markAsUpdated();
         };
         };
-        Matrix._tempQuaternion = new Quaternion();
         Matrix._xAxis = Vector3.Zero();
         Matrix._xAxis = Vector3.Zero();
         Matrix._yAxis = Vector3.Zero();
         Matrix._yAxis = Vector3.Zero();
         Matrix._zAxis = Vector3.Zero();
         Matrix._zAxis = Vector3.Zero();
@@ -19241,7 +19240,7 @@ var BABYLON;
             this.reConstruct(min, max, worldMatrix);
             this.reConstruct(min, max, worldMatrix);
         }
         }
         /**
         /**
-         * Recreates the entire bounding sphere from scratch
+         * Recreates the entire bounding sphere from scratch as if we call the constructor in place
          * @param min defines the new minimum vector (in local space)
          * @param min defines the new minimum vector (in local space)
          * @param max defines the new maximum vector (in local space)
          * @param max defines the new maximum vector (in local space)
          * @param worldMatrix defines the new world matrix
          * @param worldMatrix defines the new world matrix
@@ -19265,9 +19264,16 @@ var BABYLON;
             var tempRadiusVector = tmpVectors[0].setAll(newRadius);
             var tempRadiusVector = tmpVectors[0].setAll(newRadius);
             var min = this.center.subtractToRef(tempRadiusVector, tmpVectors[1]);
             var min = this.center.subtractToRef(tempRadiusVector, tmpVectors[1]);
             var max = this.center.addToRef(tempRadiusVector, tmpVectors[2]);
             var max = this.center.addToRef(tempRadiusVector, tmpVectors[2]);
-            this.reConstruct(min, max);
+            this.reConstruct(min, max, this._worldMatrix);
             return this;
             return this;
         };
         };
+        /**
+         * Gets the world matrix of the bounding box
+         * @returns a matrix
+         */
+        BoundingSphere.prototype.getWorldMatrix = function () {
+            return this._worldMatrix;
+        };
         // Methods
         // Methods
         /** @hidden */
         /** @hidden */
         BoundingSphere.prototype._update = function (worldMatrix) {
         BoundingSphere.prototype._update = function (worldMatrix) {
@@ -19391,7 +19397,7 @@ var BABYLON;
         }
         }
         // Methods
         // Methods
         /**
         /**
-         * Recreates the entire bounding box from scratch
+         * Recreates the entire bounding box from scratch as if we call the constructor in place
          * @param min defines the new minimum vector (in local space)
          * @param min defines the new minimum vector (in local space)
          * @param max defines the new maximum vector (in local space)
          * @param max defines the new maximum vector (in local space)
          * @param worldMatrix defines the new world matrix
          * @param worldMatrix defines the new world matrix
@@ -19412,7 +19418,7 @@ var BABYLON;
             // OBB
             // OBB
             max.addToRef(min, this.center).scaleInPlace(0.5);
             max.addToRef(min, this.center).scaleInPlace(0.5);
             max.subtractToRef(min, this.extendSize).scaleInPlace(0.5);
             max.subtractToRef(min, this.extendSize).scaleInPlace(0.5);
-            this._update(worldMatrix || this._worldMatrix || BABYLON.Matrix.Identity());
+            this._update(worldMatrix || BABYLON.Matrix.IdentityReadOnly);
         };
         };
         /**
         /**
          * Scale the current bounding box by applying a scale factor
          * Scale the current bounding box by applying a scale factor
@@ -19428,7 +19434,7 @@ var BABYLON;
             var newRadius = diff.scaleInPlace(distance * 0.5);
             var newRadius = diff.scaleInPlace(distance * 0.5);
             var min = this.center.subtractToRef(newRadius, tmpVectors[1]);
             var min = this.center.subtractToRef(newRadius, tmpVectors[1]);
             var max = this.center.addToRef(newRadius, tmpVectors[2]);
             var max = this.center.addToRef(newRadius, tmpVectors[2]);
-            this.reConstruct(min, max);
+            this.reConstruct(min, max, this._worldMatrix);
             return this;
             return this;
         };
         };
         /**
         /**
@@ -19438,15 +19444,6 @@ var BABYLON;
         BoundingBox.prototype.getWorldMatrix = function () {
         BoundingBox.prototype.getWorldMatrix = function () {
             return this._worldMatrix;
             return this._worldMatrix;
         };
         };
-        /**
-         * Sets the world matrix stored in the bounding box
-         * @param matrix defines the matrix to store
-         * @returns current bounding box
-         */
-        BoundingBox.prototype.setWorldMatrix = function (matrix) {
-            this._worldMatrix.copyFrom(matrix);
-            return this;
-        };
         /** @hidden */
         /** @hidden */
         BoundingBox.prototype._update = function (world) {
         BoundingBox.prototype._update = function (world) {
             var minWorld = this.minimumWorld;
             var minWorld = this.minimumWorld;
@@ -19622,22 +19619,21 @@ var BABYLON;
 
 
 var BABYLON;
 var BABYLON;
 (function (BABYLON) {
 (function (BABYLON) {
-    var computeBoxExtents = function (axis, box) {
+    var _result0 = { min: 0, max: 0 };
+    var _result1 = { min: 0, max: 0 };
+    var computeBoxExtents = function (axis, box, result) {
         var p = BABYLON.Vector3.Dot(box.centerWorld, axis);
         var p = BABYLON.Vector3.Dot(box.centerWorld, axis);
         var r0 = Math.abs(BABYLON.Vector3.Dot(box.directions[0], axis)) * box.extendSize.x;
         var r0 = Math.abs(BABYLON.Vector3.Dot(box.directions[0], axis)) * box.extendSize.x;
         var r1 = Math.abs(BABYLON.Vector3.Dot(box.directions[1], axis)) * box.extendSize.y;
         var r1 = Math.abs(BABYLON.Vector3.Dot(box.directions[1], axis)) * box.extendSize.y;
         var r2 = Math.abs(BABYLON.Vector3.Dot(box.directions[2], axis)) * box.extendSize.z;
         var r2 = Math.abs(BABYLON.Vector3.Dot(box.directions[2], axis)) * box.extendSize.z;
         var r = r0 + r1 + r2;
         var r = r0 + r1 + r2;
-        return {
-            min: p - r,
-            max: p + r
-        };
+        result.min = p - r;
+        result.max = p + r;
     };
     };
-    var extentsOverlap = function (min0, max0, min1, max1) { return !(min0 > max1 || min1 > max0); };
     var axisOverlap = function (axis, box0, box1) {
     var axisOverlap = function (axis, box0, box1) {
-        var result0 = computeBoxExtents(axis, box0);
-        var result1 = computeBoxExtents(axis, box1);
-        return extentsOverlap(result0.min, result0.max, result1.min, result1.max);
+        computeBoxExtents(axis, box0, _result0);
+        computeBoxExtents(axis, box1, _result1);
+        return !(_result0.min > _result1.max || _result1.min > _result0.max);
     };
     };
     /**
     /**
      * Info for a bounding data of a mesh
      * Info for a bounding data of a mesh
@@ -19655,7 +19651,7 @@ var BABYLON;
             this.boundingSphere = new BABYLON.BoundingSphere(minimum, maximum, worldMatrix);
             this.boundingSphere = new BABYLON.BoundingSphere(minimum, maximum, worldMatrix);
         }
         }
         /**
         /**
-         * Recreates the entire bounding info from scratch
+         * Recreates the entire bounding info from scratch as if we call the constructor in place
          * @param min defines the new minimum vector (in local space)
          * @param min defines the new minimum vector (in local space)
          * @param max defines the new maximum vector (in local space)
          * @param max defines the new maximum vector (in local space)
          * @param worldMatrix defines the new world matrix
          * @param worldMatrix defines the new world matrix
@@ -19718,8 +19714,8 @@ var BABYLON;
         BoundingInfo.prototype.centerOn = function (center, extend) {
         BoundingInfo.prototype.centerOn = function (center, extend) {
             var minimum = BoundingInfo.TmpVector3[0].copyFrom(center).subtractInPlace(extend);
             var minimum = BoundingInfo.TmpVector3[0].copyFrom(center).subtractInPlace(extend);
             var maximum = BoundingInfo.TmpVector3[1].copyFrom(center).addInPlace(extend);
             var maximum = BoundingInfo.TmpVector3[1].copyFrom(center).addInPlace(extend);
-            this.boundingBox.reConstruct(minimum, maximum);
-            this.boundingSphere.reConstruct(minimum, maximum);
+            this.boundingBox.reConstruct(minimum, maximum, this.boundingBox.getWorldMatrix());
+            this.boundingSphere.reConstruct(minimum, maximum, this.boundingBox.getWorldMatrix());
             return this;
             return this;
         };
         };
         /**
         /**
@@ -19799,9 +19795,6 @@ var BABYLON;
          * @returns if the bounding info intersects
          * @returns if the bounding info intersects
          */
          */
         BoundingInfo.prototype.intersects = function (boundingInfo, precise) {
         BoundingInfo.prototype.intersects = function (boundingInfo, precise) {
-            if (!this.boundingSphere.centerWorld || !boundingInfo.boundingSphere.centerWorld) {
-                return false;
-            }
             if (!BABYLON.BoundingSphere.Intersects(this.boundingSphere, boundingInfo.boundingSphere)) {
             if (!BABYLON.BoundingSphere.Intersects(this.boundingSphere, boundingInfo.boundingSphere)) {
                 return false;
                 return false;
             }
             }
@@ -27101,6 +27094,9 @@ var BABYLON;
                     evt.preventDefault();
                     evt.preventDefault();
                     canvas.focus();
                     canvas.focus();
                 }
                 }
+                _this._startingPointerPosition.x = _this._pointerX;
+                _this._startingPointerPosition.y = _this._pointerY;
+                _this._startingPointerTime = Date.now();
                 // PreObservable support
                 // PreObservable support
                 if (_this._checkPrePointerObservable(null, evt, BABYLON.PointerEventTypes.POINTERDOWN)) {
                 if (_this._checkPrePointerObservable(null, evt, BABYLON.PointerEventTypes.POINTERDOWN)) {
                     return;
                     return;
@@ -27109,9 +27105,6 @@ var BABYLON;
                     return;
                     return;
                 }
                 }
                 _this._pointerCaptures[evt.pointerId] = true;
                 _this._pointerCaptures[evt.pointerId] = true;
-                _this._startingPointerPosition.x = _this._pointerX;
-                _this._startingPointerPosition.y = _this._pointerY;
-                _this._startingPointerTime = Date.now();
                 if (!_this.pointerDownPredicate) {
                 if (!_this.pointerDownPredicate) {
                     _this.pointerDownPredicate = function (mesh) {
                     _this.pointerDownPredicate = function (mesh) {
                         return mesh.isPickable && mesh.isVisible && mesh.isReady() && mesh.isEnabled();
                         return mesh.isPickable && mesh.isVisible && mesh.isReady() && mesh.isEnabled();

文件差異過大導致無法顯示
+ 1 - 1
dist/preview release/babylon.worker.js


+ 28 - 35
dist/preview release/es6.js

@@ -8363,8 +8363,8 @@ var BABYLON;
          * @param result defines the target matrix
          * @param result defines the target matrix
          */
          */
         Matrix.RotationYawPitchRollToRef = function (yaw, pitch, roll, result) {
         Matrix.RotationYawPitchRollToRef = function (yaw, pitch, roll, result) {
-            Quaternion.RotationYawPitchRollToRef(yaw, pitch, roll, this._tempQuaternion);
-            this._tempQuaternion.toRotationMatrix(result);
+            Quaternion.RotationYawPitchRollToRef(yaw, pitch, roll, MathTmp.Quaternion[0]);
+            MathTmp.Quaternion[0].toRotationMatrix(result);
         };
         };
         /**
         /**
          * Creates a scaling matrix
          * Creates a scaling matrix
@@ -8964,7 +8964,6 @@ var BABYLON;
             result.m[15] = 1.0;
             result.m[15] = 1.0;
             result._markAsUpdated();
             result._markAsUpdated();
         };
         };
-        Matrix._tempQuaternion = new Quaternion();
         Matrix._xAxis = Vector3.Zero();
         Matrix._xAxis = Vector3.Zero();
         Matrix._yAxis = Vector3.Zero();
         Matrix._yAxis = Vector3.Zero();
         Matrix._zAxis = Vector3.Zero();
         Matrix._zAxis = Vector3.Zero();
@@ -19241,7 +19240,7 @@ var BABYLON;
             this.reConstruct(min, max, worldMatrix);
             this.reConstruct(min, max, worldMatrix);
         }
         }
         /**
         /**
-         * Recreates the entire bounding sphere from scratch
+         * Recreates the entire bounding sphere from scratch as if we call the constructor in place
          * @param min defines the new minimum vector (in local space)
          * @param min defines the new minimum vector (in local space)
          * @param max defines the new maximum vector (in local space)
          * @param max defines the new maximum vector (in local space)
          * @param worldMatrix defines the new world matrix
          * @param worldMatrix defines the new world matrix
@@ -19265,9 +19264,16 @@ var BABYLON;
             var tempRadiusVector = tmpVectors[0].setAll(newRadius);
             var tempRadiusVector = tmpVectors[0].setAll(newRadius);
             var min = this.center.subtractToRef(tempRadiusVector, tmpVectors[1]);
             var min = this.center.subtractToRef(tempRadiusVector, tmpVectors[1]);
             var max = this.center.addToRef(tempRadiusVector, tmpVectors[2]);
             var max = this.center.addToRef(tempRadiusVector, tmpVectors[2]);
-            this.reConstruct(min, max);
+            this.reConstruct(min, max, this._worldMatrix);
             return this;
             return this;
         };
         };
+        /**
+         * Gets the world matrix of the bounding box
+         * @returns a matrix
+         */
+        BoundingSphere.prototype.getWorldMatrix = function () {
+            return this._worldMatrix;
+        };
         // Methods
         // Methods
         /** @hidden */
         /** @hidden */
         BoundingSphere.prototype._update = function (worldMatrix) {
         BoundingSphere.prototype._update = function (worldMatrix) {
@@ -19391,7 +19397,7 @@ var BABYLON;
         }
         }
         // Methods
         // Methods
         /**
         /**
-         * Recreates the entire bounding box from scratch
+         * Recreates the entire bounding box from scratch as if we call the constructor in place
          * @param min defines the new minimum vector (in local space)
          * @param min defines the new minimum vector (in local space)
          * @param max defines the new maximum vector (in local space)
          * @param max defines the new maximum vector (in local space)
          * @param worldMatrix defines the new world matrix
          * @param worldMatrix defines the new world matrix
@@ -19412,7 +19418,7 @@ var BABYLON;
             // OBB
             // OBB
             max.addToRef(min, this.center).scaleInPlace(0.5);
             max.addToRef(min, this.center).scaleInPlace(0.5);
             max.subtractToRef(min, this.extendSize).scaleInPlace(0.5);
             max.subtractToRef(min, this.extendSize).scaleInPlace(0.5);
-            this._update(worldMatrix || this._worldMatrix || BABYLON.Matrix.Identity());
+            this._update(worldMatrix || BABYLON.Matrix.IdentityReadOnly);
         };
         };
         /**
         /**
          * Scale the current bounding box by applying a scale factor
          * Scale the current bounding box by applying a scale factor
@@ -19428,7 +19434,7 @@ var BABYLON;
             var newRadius = diff.scaleInPlace(distance * 0.5);
             var newRadius = diff.scaleInPlace(distance * 0.5);
             var min = this.center.subtractToRef(newRadius, tmpVectors[1]);
             var min = this.center.subtractToRef(newRadius, tmpVectors[1]);
             var max = this.center.addToRef(newRadius, tmpVectors[2]);
             var max = this.center.addToRef(newRadius, tmpVectors[2]);
-            this.reConstruct(min, max);
+            this.reConstruct(min, max, this._worldMatrix);
             return this;
             return this;
         };
         };
         /**
         /**
@@ -19438,15 +19444,6 @@ var BABYLON;
         BoundingBox.prototype.getWorldMatrix = function () {
         BoundingBox.prototype.getWorldMatrix = function () {
             return this._worldMatrix;
             return this._worldMatrix;
         };
         };
-        /**
-         * Sets the world matrix stored in the bounding box
-         * @param matrix defines the matrix to store
-         * @returns current bounding box
-         */
-        BoundingBox.prototype.setWorldMatrix = function (matrix) {
-            this._worldMatrix.copyFrom(matrix);
-            return this;
-        };
         /** @hidden */
         /** @hidden */
         BoundingBox.prototype._update = function (world) {
         BoundingBox.prototype._update = function (world) {
             var minWorld = this.minimumWorld;
             var minWorld = this.minimumWorld;
@@ -19622,22 +19619,21 @@ var BABYLON;
 
 
 var BABYLON;
 var BABYLON;
 (function (BABYLON) {
 (function (BABYLON) {
-    var computeBoxExtents = function (axis, box) {
+    var _result0 = { min: 0, max: 0 };
+    var _result1 = { min: 0, max: 0 };
+    var computeBoxExtents = function (axis, box, result) {
         var p = BABYLON.Vector3.Dot(box.centerWorld, axis);
         var p = BABYLON.Vector3.Dot(box.centerWorld, axis);
         var r0 = Math.abs(BABYLON.Vector3.Dot(box.directions[0], axis)) * box.extendSize.x;
         var r0 = Math.abs(BABYLON.Vector3.Dot(box.directions[0], axis)) * box.extendSize.x;
         var r1 = Math.abs(BABYLON.Vector3.Dot(box.directions[1], axis)) * box.extendSize.y;
         var r1 = Math.abs(BABYLON.Vector3.Dot(box.directions[1], axis)) * box.extendSize.y;
         var r2 = Math.abs(BABYLON.Vector3.Dot(box.directions[2], axis)) * box.extendSize.z;
         var r2 = Math.abs(BABYLON.Vector3.Dot(box.directions[2], axis)) * box.extendSize.z;
         var r = r0 + r1 + r2;
         var r = r0 + r1 + r2;
-        return {
-            min: p - r,
-            max: p + r
-        };
+        result.min = p - r;
+        result.max = p + r;
     };
     };
-    var extentsOverlap = function (min0, max0, min1, max1) { return !(min0 > max1 || min1 > max0); };
     var axisOverlap = function (axis, box0, box1) {
     var axisOverlap = function (axis, box0, box1) {
-        var result0 = computeBoxExtents(axis, box0);
-        var result1 = computeBoxExtents(axis, box1);
-        return extentsOverlap(result0.min, result0.max, result1.min, result1.max);
+        computeBoxExtents(axis, box0, _result0);
+        computeBoxExtents(axis, box1, _result1);
+        return !(_result0.min > _result1.max || _result1.min > _result0.max);
     };
     };
     /**
     /**
      * Info for a bounding data of a mesh
      * Info for a bounding data of a mesh
@@ -19655,7 +19651,7 @@ var BABYLON;
             this.boundingSphere = new BABYLON.BoundingSphere(minimum, maximum, worldMatrix);
             this.boundingSphere = new BABYLON.BoundingSphere(minimum, maximum, worldMatrix);
         }
         }
         /**
         /**
-         * Recreates the entire bounding info from scratch
+         * Recreates the entire bounding info from scratch as if we call the constructor in place
          * @param min defines the new minimum vector (in local space)
          * @param min defines the new minimum vector (in local space)
          * @param max defines the new maximum vector (in local space)
          * @param max defines the new maximum vector (in local space)
          * @param worldMatrix defines the new world matrix
          * @param worldMatrix defines the new world matrix
@@ -19718,8 +19714,8 @@ var BABYLON;
         BoundingInfo.prototype.centerOn = function (center, extend) {
         BoundingInfo.prototype.centerOn = function (center, extend) {
             var minimum = BoundingInfo.TmpVector3[0].copyFrom(center).subtractInPlace(extend);
             var minimum = BoundingInfo.TmpVector3[0].copyFrom(center).subtractInPlace(extend);
             var maximum = BoundingInfo.TmpVector3[1].copyFrom(center).addInPlace(extend);
             var maximum = BoundingInfo.TmpVector3[1].copyFrom(center).addInPlace(extend);
-            this.boundingBox.reConstruct(minimum, maximum);
-            this.boundingSphere.reConstruct(minimum, maximum);
+            this.boundingBox.reConstruct(minimum, maximum, this.boundingBox.getWorldMatrix());
+            this.boundingSphere.reConstruct(minimum, maximum, this.boundingBox.getWorldMatrix());
             return this;
             return this;
         };
         };
         /**
         /**
@@ -19799,9 +19795,6 @@ var BABYLON;
          * @returns if the bounding info intersects
          * @returns if the bounding info intersects
          */
          */
         BoundingInfo.prototype.intersects = function (boundingInfo, precise) {
         BoundingInfo.prototype.intersects = function (boundingInfo, precise) {
-            if (!this.boundingSphere.centerWorld || !boundingInfo.boundingSphere.centerWorld) {
-                return false;
-            }
             if (!BABYLON.BoundingSphere.Intersects(this.boundingSphere, boundingInfo.boundingSphere)) {
             if (!BABYLON.BoundingSphere.Intersects(this.boundingSphere, boundingInfo.boundingSphere)) {
                 return false;
                 return false;
             }
             }
@@ -27101,6 +27094,9 @@ var BABYLON;
                     evt.preventDefault();
                     evt.preventDefault();
                     canvas.focus();
                     canvas.focus();
                 }
                 }
+                _this._startingPointerPosition.x = _this._pointerX;
+                _this._startingPointerPosition.y = _this._pointerY;
+                _this._startingPointerTime = Date.now();
                 // PreObservable support
                 // PreObservable support
                 if (_this._checkPrePointerObservable(null, evt, BABYLON.PointerEventTypes.POINTERDOWN)) {
                 if (_this._checkPrePointerObservable(null, evt, BABYLON.PointerEventTypes.POINTERDOWN)) {
                     return;
                     return;
@@ -27109,9 +27105,6 @@ var BABYLON;
                     return;
                     return;
                 }
                 }
                 _this._pointerCaptures[evt.pointerId] = true;
                 _this._pointerCaptures[evt.pointerId] = true;
-                _this._startingPointerPosition.x = _this._pointerX;
-                _this._startingPointerPosition.y = _this._pointerY;
-                _this._startingPointerTime = Date.now();
                 if (!_this.pointerDownPredicate) {
                 if (!_this.pointerDownPredicate) {
                     _this.pointerDownPredicate = function (mesh) {
                     _this.pointerDownPredicate = function (mesh) {
                         return mesh.isPickable && mesh.isVisible && mesh.isReady() && mesh.isEnabled();
                         return mesh.isPickable && mesh.isVisible && mesh.isReady() && mesh.isEnabled();

+ 1 - 15
dist/preview release/viewer/babylon.viewer.d.ts

@@ -924,7 +924,7 @@ declare module BabylonViewer {
       * @param name the name of the custom optimizer configuration
       * @param name the name of the custom optimizer configuration
       * @param upgrade set to true if you want to upgrade optimizer and false if you want to degrade
       * @param upgrade set to true if you want to upgrade optimizer and false if you want to degrade
       */
       */
-    export function getCustomOptimizerByName(name: string, upgrade?: boolean): typeof extendedUpgrade;
+    export function getCustomOptimizerByName(name: string, upgrade?: boolean): (sceneManager: SceneManager) => boolean;
     export function registerCustomOptimizer(name: string, optimizer: (sceneManager: SceneManager) => boolean): void;
     export function registerCustomOptimizer(name: string, optimizer: (sceneManager: SceneManager) => boolean): void;
 }
 }
 declare module BabylonViewer {
 declare module BabylonViewer {
@@ -1558,20 +1558,6 @@ declare module BabylonViewer {
     export function addLoaderPlugin(name: string, plugin: ILoaderPlugin): void;
     export function addLoaderPlugin(name: string, plugin: ILoaderPlugin): void;
 }
 }
 declare module BabylonViewer {
 declare module BabylonViewer {
-    /**
-        * A custom upgrade-oriented function configuration for the scene optimizer.
-        *
-        * @param viewer the viewer to optimize
-        */
-    export function extendedUpgrade(sceneManager: SceneManager): boolean;
-    /**
-        * A custom degrade-oriented function configuration for the scene optimizer.
-        *
-        * @param viewer the viewer to optimize
-        */
-    export function extendedDegrade(sceneManager: SceneManager): boolean;
-}
-declare module BabylonViewer {
 }
 }
 declare module BabylonViewer {
 declare module BabylonViewer {
     export interface IEnvironmentMapConfiguration {
     export interface IEnvironmentMapConfiguration {

文件差異過大導致無法顯示
+ 1 - 1
dist/preview release/viewer/babylon.viewer.js


文件差異過大導致無法顯示
+ 1 - 1
dist/preview release/viewer/babylon.viewer.max.js


+ 1 - 18
dist/preview release/viewer/babylon.viewer.module.d.ts

@@ -985,14 +985,13 @@ declare module 'babylonjs-viewer/templating/viewerTemplatePlugin' {
 }
 }
 
 
 declare module 'babylonjs-viewer/optimizer/custom' {
 declare module 'babylonjs-viewer/optimizer/custom' {
-    import { extendedUpgrade } from "babylonjs-viewer/optimizer/custom/extended";
     import { SceneManager } from "babylonjs-viewer/managers/sceneManager";
     import { SceneManager } from "babylonjs-viewer/managers/sceneManager";
     /**
     /**
       *
       *
       * @param name the name of the custom optimizer configuration
       * @param name the name of the custom optimizer configuration
       * @param upgrade set to true if you want to upgrade optimizer and false if you want to degrade
       * @param upgrade set to true if you want to upgrade optimizer and false if you want to degrade
       */
       */
-    export function getCustomOptimizerByName(name: string, upgrade?: boolean): typeof extendedUpgrade;
+    export function getCustomOptimizerByName(name: string, upgrade?: boolean): (sceneManager: SceneManager) => boolean;
     export function registerCustomOptimizer(name: string, optimizer: (sceneManager: SceneManager) => boolean): void;
     export function registerCustomOptimizer(name: string, optimizer: (sceneManager: SceneManager) => boolean): void;
 }
 }
 
 
@@ -1663,22 +1662,6 @@ declare module 'babylonjs-viewer/loader/plugins' {
     export function addLoaderPlugin(name: string, plugin: ILoaderPlugin): void;
     export function addLoaderPlugin(name: string, plugin: ILoaderPlugin): void;
 }
 }
 
 
-declare module 'babylonjs-viewer/optimizer/custom/extended' {
-    import { SceneManager } from 'babylonjs-viewer/managers/sceneManager';
-    /**
-        * A custom upgrade-oriented function configuration for the scene optimizer.
-        *
-        * @param viewer the viewer to optimize
-        */
-    export function extendedUpgrade(sceneManager: SceneManager): boolean;
-    /**
-        * A custom degrade-oriented function configuration for the scene optimizer.
-        *
-        * @param viewer the viewer to optimize
-        */
-    export function extendedDegrade(sceneManager: SceneManager): boolean;
-}
-
 declare module 'babylonjs-viewer/configuration/interfaces' {
 declare module 'babylonjs-viewer/configuration/interfaces' {
     export * from 'babylonjs-viewer/configuration/interfaces/cameraConfiguration';
     export * from 'babylonjs-viewer/configuration/interfaces/cameraConfiguration';
     export * from 'babylonjs-viewer/configuration/interfaces/colorGradingConfiguration';
     export * from 'babylonjs-viewer/configuration/interfaces/colorGradingConfiguration';

+ 3 - 3
src/Culling/babylon.ray.ts

@@ -441,7 +441,7 @@ module BABYLON {
         * @param world a matrix to transform the ray to. Default is the identity matrix.
         * @param world a matrix to transform the ray to. Default is the identity matrix.
         * @returns the new ray
         * @returns the new ray
         */
         */
-        public static CreateNewFromTo(origin: Vector3, end: Vector3, world: Matrix = Matrix.IdentityReadOnly): Ray {
+        public static CreateNewFromTo(origin: Vector3, end: Vector3, world: Readonly<Matrix> = Matrix.IdentityReadOnly): Ray {
             var direction = end.subtract(origin);
             var direction = end.subtract(origin);
             var length = Math.sqrt((direction.x * direction.x) + (direction.y * direction.y) + (direction.z * direction.z));
             var length = Math.sqrt((direction.x * direction.x) + (direction.y * direction.y) + (direction.z * direction.z));
             direction.normalize();
             direction.normalize();
@@ -455,7 +455,7 @@ module BABYLON {
          * @param matrix matrix to apply
          * @param matrix matrix to apply
          * @returns the resulting new ray
          * @returns the resulting new ray
          */
          */
-        public static Transform(ray: Ray, matrix: Matrix): Ray {
+        public static Transform(ray: Ray, matrix: Readonly<Matrix>): Ray {
             var result = new Ray(new Vector3(0, 0, 0), new Vector3(0, 0, 0));
             var result = new Ray(new Vector3(0, 0, 0), new Vector3(0, 0, 0));
             Ray.TransformToRef(ray, matrix, result);
             Ray.TransformToRef(ray, matrix, result);
 
 
@@ -468,7 +468,7 @@ module BABYLON {
          * @param matrix matrix to apply
          * @param matrix matrix to apply
          * @param result ray to store result in
          * @param result ray to store result in
          */
          */
-        public static TransformToRef(ray: Ray, matrix: Matrix, result: Ray): void {
+        public static TransformToRef(ray: Ray, matrix: Readonly<Matrix>, result: Ray): void {
             Vector3.TransformCoordinatesToRef(ray.origin, matrix, result.origin);
             Vector3.TransformCoordinatesToRef(ray.origin, matrix, result.origin);
             Vector3.TransformNormalToRef(ray.direction, matrix, result.direction);
             Vector3.TransformNormalToRef(ray.direction, matrix, result.direction);
             result.length = ray.length;
             result.length = ray.length;

+ 3 - 3
src/Materials/Textures/babylon.baseTexture.ts

@@ -293,7 +293,7 @@ module BABYLON {
          * @returns the transformation matrix
          * @returns the transformation matrix
          */
          */
         public getTextureMatrix(): Matrix {
         public getTextureMatrix(): Matrix {
-            return Matrix.IdentityReadOnly;
+            return <Matrix>Matrix.IdentityReadOnly;
         }
         }
 
 
         /**
         /**
@@ -301,7 +301,7 @@ module BABYLON {
          * @returns the reflection matrix
          * @returns the reflection matrix
          */
          */
         public getReflectionTextureMatrix(): Matrix {
         public getReflectionTextureMatrix(): Matrix {
-            return Matrix.IdentityReadOnly;
+            return <Matrix>Matrix.IdentityReadOnly;
         }
         }
 
 
         /**
         /**
@@ -367,7 +367,7 @@ module BABYLON {
          */
          */
         public getBaseSize(): ISize {
         public getBaseSize(): ISize {
             if (!this.isReady() || !this._texture) {
             if (!this.isReady() || !this._texture) {
-                return Size.Zero();
+                return Size.Zero();
             }
             }
 
 
             if (this._texture._size) {
             if (this._texture._size) {

+ 5 - 5
src/Math/babylon.math.ts

@@ -2280,7 +2280,7 @@ module BABYLON {
          * @param transformation defines the transformation matrix
          * @param transformation defines the transformation matrix
          * @param result defines the Vector3 where to store the result
          * @param result defines the Vector3 where to store the result
          */
          */
-        public static TransformNormalToRef(vector: Vector3, transformation: Matrix, result: Vector3): void {
+        public static TransformNormalToRef(vector: Vector3, transformation: Readonly<Matrix>, result: Vector3): void {
             this.TransformNormalFromFloatsToRef(vector.x, vector.y, vector.z, transformation, result);
             this.TransformNormalFromFloatsToRef(vector.x, vector.y, vector.z, transformation, result);
         }
         }
 
 
@@ -4536,7 +4536,7 @@ module BABYLON {
          * @param other defines the second operand
          * @param other defines the second operand
          * @returns a new matrix set with the multiplication result of the current Matrix and the given one
          * @returns a new matrix set with the multiplication result of the current Matrix and the given one
          */
          */
-        public multiply(other: Matrix): Matrix {
+        public multiply(other: Readonly<Matrix>): Matrix {
             var result = new Matrix();
             var result = new Matrix();
             this.multiplyToRef(other, result);
             this.multiplyToRef(other, result);
             return result;
             return result;
@@ -4547,7 +4547,7 @@ module BABYLON {
          * @param other defines the source matrix
          * @param other defines the source matrix
          * @returns the current updated matrix
          * @returns the current updated matrix
          */
          */
-        public copyFrom(other: Matrix): Matrix {
+        public copyFrom(other: Readonly<Matrix>): Matrix {
             for (var index = 0; index < 16; index++) {
             for (var index = 0; index < 16; index++) {
                 this.m[index] = other.m[index];
                 this.m[index] = other.m[index];
             }
             }
@@ -4575,7 +4575,7 @@ module BABYLON {
          * @param result defines the matrix where to store the multiplication
          * @param result defines the matrix where to store the multiplication
          * @returns the current matrix
          * @returns the current matrix
          */
          */
-        public multiplyToRef(other: Matrix, result: Matrix): Matrix {
+        public multiplyToRef(other: Readonly<Matrix>, result: Matrix): Matrix {
             this.multiplyToArray(other, result.m, 0);
             this.multiplyToArray(other, result.m, 0);
 
 
             result._markAsUpdated();
             result._markAsUpdated();
@@ -4589,7 +4589,7 @@ module BABYLON {
          * @param offset defines the offset in the target array where to start storing values
          * @param offset defines the offset in the target array where to start storing values
          * @returns the current matrix
          * @returns the current matrix
          */
          */
-        public multiplyToArray(other: Matrix, result: Float32Array, offset: number): Matrix {
+        public multiplyToArray(other: Readonly<Matrix>, result: Float32Array, offset: number): Matrix {
             var tm0 = this.m[0];
             var tm0 = this.m[0];
             var tm1 = this.m[1];
             var tm1 = this.m[1];
             var tm2 = this.m[2];
             var tm2 = this.m[2];

+ 1 - 1
src/Mesh/babylon.transformNode.ts

@@ -306,7 +306,7 @@ module BABYLON {
          * @param postMultiplyPivotMatrix defines if the pivot matrix must be cancelled in the world matrix. When this parameter is set to true (default), the inverse of the pivot matrix is also applied at the end to cancel the transformation effect
          * @param postMultiplyPivotMatrix defines if the pivot matrix must be cancelled in the world matrix. When this parameter is set to true (default), the inverse of the pivot matrix is also applied at the end to cancel the transformation effect
          * @returns the current TransformNode
          * @returns the current TransformNode
         */
         */
-        public setPivotMatrix(matrix: Matrix, postMultiplyPivotMatrix = true): TransformNode {
+        public setPivotMatrix(matrix: Readonly<Matrix>, postMultiplyPivotMatrix = true): TransformNode {
             this._pivotMatrix.copyFrom(matrix);
             this._pivotMatrix.copyFrom(matrix);
             this._cache.pivotMatrixUpdated = true;
             this._cache.pivotMatrixUpdated = true;
             this._postMultiplyPivotMatrix = postMultiplyPivotMatrix;
             this._postMultiplyPivotMatrix = postMultiplyPivotMatrix;

+ 4 - 3
src/babylon.scene.ts

@@ -2020,6 +2020,10 @@ module BABYLON {
                     canvas.focus();
                     canvas.focus();
                 }
                 }
 
 
+                this._startingPointerPosition.x = this._pointerX;
+                this._startingPointerPosition.y = this._pointerY;
+                this._startingPointerTime = Date.now();
+
                 // PreObservable support
                 // PreObservable support
                 if (this._checkPrePointerObservable(null, evt, PointerEventTypes.POINTERDOWN)) {
                 if (this._checkPrePointerObservable(null, evt, PointerEventTypes.POINTERDOWN)) {
                     return;
                     return;
@@ -2030,9 +2034,6 @@ module BABYLON {
                 }
                 }
 
 
                 this._pointerCaptures[evt.pointerId] = true;
                 this._pointerCaptures[evt.pointerId] = true;
-                this._startingPointerPosition.x = this._pointerX;
-                this._startingPointerPosition.y = this._pointerY;
-                this._startingPointerTime = Date.now();
 
 
                 if (!this.pointerDownPredicate) {
                 if (!this.pointerDownPredicate) {
                     this.pointerDownPredicate = (mesh: AbstractMesh): boolean => {
                     this.pointerDownPredicate = (mesh: AbstractMesh): boolean => {