Pārlūkot izejas kodu

Fix ome readonly checks

David Catuhe 6 gadi atpakaļ
vecāks
revīzija
a51c2bc352

+ 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;