Explorar el Código

moved refs back to last param on ToRef methods

Adam Bowman hace 8 años
padre
commit
481808fcaf

+ 10 - 10
src/Bones/babylon.bone.ts

@@ -200,7 +200,7 @@
 
                 tmat.invert();
                 Vector3.TransformCoordinatesToRef(vec, tmat, tvec);
-                
+
                 lm.m[12] += tvec.x;
                 lm.m[13] += tvec.y;
                 lm.m[14] += tvec.z;
@@ -482,13 +482,13 @@
 
             var pos = Vector3.Zero();
 
-            this.getPositionToRef(pos, space, mesh);
+            this.getPositionToRef(space, mesh, pos);
 
             return pos;
 
         }
 
-        public getPositionToRef (result: Vector3, space = Space.LOCAL, mesh?: AbstractMesh): void {
+        public getPositionToRef (space = Space.LOCAL, mesh: AbstractMesh, result: Vector3): void {
 
             if(space == Space.LOCAL){
 
@@ -523,15 +523,15 @@
 
             var pos = Vector3.Zero();
 
-            this.getPositionToRef(pos, Space.WORLD, mesh);
+            this.getPositionToRef(Space.WORLD, mesh, pos);
 
             return pos;
 
         }
 
-        public getAbsolutePositionToRef (result: Vector3, mesh?: AbstractMesh) {
+        public getAbsolutePositionToRef (mesh: AbstractMesh, result: Vector3) {
 
-            this.getPositionToRef(result, Space.WORLD, mesh);
+            this.getPositionToRef(Space.WORLD, mesh, result);
 
         }
 
@@ -588,13 +588,13 @@
 
             var result = Vector3.Zero();
 
-            this.getDirectionToRef(localAxis, result, mesh);
+            this.getDirectionToRef(localAxis, result,  mesh);
             
             return result;
 
         }
 
-        public getDirectionToRef (result: Vector3, localAxis: Vector3, mesh?: AbstractMesh): void {
+        public getDirectionToRef (localAxis: Vector3, result: Vector3, mesh?: AbstractMesh): void {
 
             this._skeleton.computeAbsoluteTransforms();
             
@@ -616,13 +616,13 @@
 
             var result = Quaternion.Identity();
 
-            this.getRotationToRef(result, space, mesh);
+            this.getRotationToRef(space, mesh, result);
 
             return result;
 
         }
 
-        public getRotationToRef( result: Quaternion, space = Space.LOCAL, mesh?: AbstractMesh): void{
+        public getRotationToRef( space = Space.LOCAL, mesh: AbstractMesh, result: Quaternion): void{
 
             if(space == Space.LOCAL){
 

+ 4 - 4
src/Bones/babylon.boneIKController.ts

@@ -65,9 +65,9 @@ module BABYLON {
             
                 mesh.computeWorldMatrix(true);
 
-                var pos1 = this._bone2.children[0].getPosition(Space.WORLD, mesh);
-                var pos2 = this._bone2.getPosition(Space.WORLD, mesh);
-                var pos3 = this._bone1.getPosition(Space.WORLD, mesh);
+                var pos1 = this._bone2.children[0].getAbsolutePosition(mesh);
+                var pos2 = this._bone2.getAbsolutePosition(mesh);
+                var pos3 = this._bone1.getAbsolutePosition(mesh);
 
                 this._bone1Length = Vector3.Distance(pos1, pos2);
                 this._bone2Length = Vector3.Distance(pos2, pos3);
@@ -111,7 +111,7 @@ module BABYLON {
             var mat1 = this._tmpMat1;
             var mat2 = this._tmpMat2;
 
-            bone1.getPositionToRef(bonePos, Space.WORLD, this.mesh);
+            bone1.getAbsolutePositionToRef(this.mesh, bonePos);
 
             poleTarget.subtractToRef(bonePos, upAxis);
 

+ 1 - 1
src/Bones/babylon.boneLookController.ts

@@ -42,7 +42,7 @@ module BABYLON {
             var mat1 = this._tmpMat1;
             var mat2 = this._tmpMat2;
 
-            bone.getPositionToRef(bonePos, Space.WORLD, this.mesh);
+            bone.getAbsolutePositionToRef(this.mesh, bonePos);
 
             target.subtractToRef(bonePos, zaxis);
             zaxis.normalize();

+ 2 - 2
src/Debug/babylon.skeletonViewer.ts

@@ -90,8 +90,8 @@
                     points = [Vector3.Zero(), Vector3.Zero()];
                     this._debugLines[boneNum] = points;
                 }
-                childBone.getPositionToRef(points[0], Space.WORLD, this.mesh);
-                parentBone.getPositionToRef(points[1], Space.WORLD, this.mesh);
+                childBone.getAbsolutePositionToRef(this.mesh, points[0]);
+				parentBone.getAbsolutePositionToRef(this.mesh, points[1]);
                 boneNum++;
             }
         }

+ 2 - 2
src/babylon.node.ts

@@ -346,12 +346,12 @@
         public getDirection(localAxis:BABYLON.Vector3): BABYLON.Vector3 {
             var result = BABYLON.Vector3.Zero();
 
-            this.getDirectionToRef(result, localAxis);
+            this.getDirectionToRef(localAxis, result);
             
             return result;
         }
 
-        public getDirectionToRef(result:BABYLON.Vector3, localAxis:BABYLON.Vector3): void {
+        public getDirectionToRef(localAxis:BABYLON.Vector3, result:BABYLON.Vector3): void {
             BABYLON.Vector3.TransformNormalToRef(localAxis, this.getWorldMatrix(), result);
         }