Explorar el Código

revet change + use little matrix optimization

Julien Barrois hace 6 años
padre
commit
80b7e9e3b9

+ 2 - 2
src/Culling/babylon.boundingBox.ts

@@ -93,7 +93,7 @@ module BABYLON {
             max.addToRef(min, this.center).scaleInPlace(0.5);
             max.subtractToRef(min, this.extendSize).scaleInPlace(0.5);
 
-            this._update(worldMatrix || this._worldMatrix || Matrix.Identity());
+            this._update(worldMatrix || this._worldMatrix || Matrix.Identity(true));
         }
 
         /**
@@ -118,7 +118,7 @@ module BABYLON {
         }
 
         /**
-         * Gets the world matrix of the bounding box.
+         * Gets the world matrix of the bounding box
          * @returns a matrix
          */
         public getWorldMatrix(): Matrix {

+ 1 - 3
src/Culling/babylon.boundingSphere.ts

@@ -29,8 +29,6 @@ module BABYLON {
         public maximum = Vector3.Zero();
 
         private static readonly TmpVector3 = Tools.BuildArray(3, Vector3.Zero);
-        // This matrix is used as a value to reset the bounding box.
-        private static readonly _identityMatrix = Matrix.Identity();
 
         /**
          * Creates a new bounding sphere
@@ -57,7 +55,7 @@ module BABYLON {
             max.addToRef(min, this.center).scaleInPlace(0.5);
             this.radius = distance * 0.5;
 
-            this._update(worldMatrix || BoundingSphere._identityMatrix);
+            this._update(worldMatrix || Matrix.IdentityReadOnly);
         }
 
         /**

+ 1 - 1
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.
         * @returns the new ray
         */
-        public static CreateNewFromTo(origin: Vector3, end: Vector3, world: Matrix = Matrix.Identity()): Ray {
+        public static CreateNewFromTo(origin: Vector3, end: Vector3, world: Matrix = Matrix.IdentityReadOnly): Ray {
             var direction = end.subtract(origin);
             var length = Math.sqrt((direction.x * direction.x) + (direction.y * direction.y) + (direction.z * direction.z));
             direction.normalize();

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

@@ -4225,7 +4225,7 @@ module BABYLON {
         private static _yAxis: Vector3 = Vector3.Zero();
         private static _zAxis: Vector3 = Vector3.Zero();
         private static _updateFlagSeed = 0;
-        private static _identityReadOnly = Matrix.Identity();
+        private static _identityReadOnly = Matrix.Identity(true);
 
         private _isIdentity = false;
         private _isIdentityDirty = true;