Pārlūkot izejas kodu

Merge pull request #1537 from abow/master

removed getDirection from Node and added it to Camera, AbstractMesh, …
David Catuhe 8 gadi atpakaļ
vecāks
revīzija
48142663e4

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

@@ -609,13 +609,13 @@
 
             var result = Vector3.Zero();
 
-            this.getDirectionToRef(localAxis, result,  mesh);
+            this.getDirectionToRef(localAxis, mesh, result);
             
             return result;
 
         }
 
-        public getDirectionToRef (localAxis: Vector3, result: Vector3, mesh?: AbstractMesh): void {
+        public getDirectionToRef (localAxis: Vector3, mesh: AbstractMesh, result: Vector3): void {
 
             this._skeleton.computeAbsoluteTransforms();
             

+ 12 - 0
src/Cameras/babylon.camera.ts

@@ -705,6 +705,18 @@
             return SerializationHelper.Clone(Camera.GetConstructorFromName(this.getTypeName(), name, this.getScene(), this.interaxialDistance, this.isStereoscopicSideBySide), this);
         }
 
+        public getDirection(localAxis:BABYLON.Vector3): BABYLON.Vector3 {
+            var result = BABYLON.Vector3.Zero();
+
+            this.getDirectionToRef(localAxis, result);
+            
+            return result;
+        }
+
+        public getDirectionToRef(localAxis:BABYLON.Vector3, result:BABYLON.Vector3): void {
+            BABYLON.Vector3.TransformNormalToRef(localAxis, this.getWorldMatrix(), result);
+        }
+
         static GetConstructorFromName(type: string, name: string, scene: Scene, interaxial_distance: number = 0, isStereoscopicSideBySide: boolean = true): () => Camera {
             switch (type) {
                 case "ArcRotateCamera":

+ 13 - 0
src/Mesh/babylon.abstractMesh.ts

@@ -1206,5 +1206,18 @@
 
             super.dispose();
         }
+
+        public getDirection(localAxis:BABYLON.Vector3): BABYLON.Vector3 {
+            var result = BABYLON.Vector3.Zero();
+
+            this.getDirectionToRef(localAxis, result);
+            
+            return result;
+        }
+
+        public getDirectionToRef(localAxis:BABYLON.Vector3, result:BABYLON.Vector3): void {
+            BABYLON.Vector3.TransformNormalToRef(localAxis, this.getWorldMatrix(), result);
+        }
+
     }
 }

+ 1 - 13
src/babylon.node.ts

@@ -362,19 +362,7 @@
             this.onDisposeObservable.notifyObservers(this);
             this.onDisposeObservable.clear();
         }
-
-        public getDirection(localAxis:BABYLON.Vector3): BABYLON.Vector3 {
-            var result = BABYLON.Vector3.Zero();
-
-            this.getDirectionToRef(localAxis, result);
-            
-            return result;
-        }
-
-        public getDirectionToRef(localAxis:BABYLON.Vector3, result:BABYLON.Vector3): void {
-            BABYLON.Vector3.TransformNormalToRef(localAxis, this.getWorldMatrix(), result);
-        }
-
+        
         public static ParseAnimationRanges(node: Node, parsedNode: any, scene: Scene): void {
             if (parsedNode.ranges) {
                 for (var index = 0; index < parsedNode.ranges.length; index++) {