David Catuhe 8 年之前
父節點
當前提交
941b25202b

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


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


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


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

@@ -16408,6 +16408,8 @@ var BABYLON;
             this.constantlyUpdateMeshUnderPointer = false;
             this.useRightHandedSystem = false;
             this.hoverCursor = "pointer";
+            // Metadata
+            this.metadata = null;
             // Events
             /**
             * An event triggered when the scene is disposed.
@@ -27421,6 +27423,10 @@ var BABYLON;
                         var physicsGravity = parsedData.physicsGravity ? BABYLON.Vector3.FromArray(parsedData.physicsGravity) : null;
                         scene.enablePhysics(physicsGravity, physicsPlugin);
                     }
+                    // Metadata
+                    if (parsedData.metadata !== undefined) {
+                        scene.metadata = parsedData.metadata;
+                    }
                     //collisions, if defined. otherwise, default is true
                     if (parsedData.collisionsEnabled != undefined) {
                         scene.collisionsEnabled = parsedData.collisionsEnabled;
@@ -30161,18 +30167,35 @@ var BABYLON;
                 children[i].computeAbsoluteTransforms();
             }
         };
-        Bone.prototype.getDirection = function (localAxis) {
+        Bone.prototype.getDirection = function (localAxis, mesh) {
             var result = BABYLON.Vector3.Zero();
-            this.getDirectionToRef(localAxis, result);
+            this.getDirectionToRef(localAxis, result, mesh);
             return result;
         };
-        Bone.prototype.getDirectionToRef = function (localAxis, result) {
+        Bone.prototype.getDirectionToRef = function (localAxis, result, mesh) {
             this._skeleton.computeAbsoluteTransforms();
-            BABYLON.Vector3.TransformNormalToRef(localAxis, this.getAbsoluteTransform(), result);
+            var mat = BABYLON.Tmp.Matrix[0];
+            mat.copyFrom(this.getAbsoluteTransform());
+            if (mesh) {
+                mat.multiplyToRef(mesh.getWorldMatrix(), mat);
+            }
+            BABYLON.Vector3.TransformNormalToRef(localAxis, mat, result);
             if (this._scaleVector.x != 1 || this._scaleVector.y != 1 || this._scaleVector.z != 1) {
                 result.normalize();
             }
         };
+        Bone.prototype.getRotation = function (mesh) {
+            var result = BABYLON.Quaternion.Identity();
+            this.getRotationToRef(mesh, result);
+            return result;
+        };
+        Bone.prototype.getRotationToRef = function (mesh, result) {
+            var mat = BABYLON.Tmp.Matrix[0];
+            var amat = this.getAbsoluteTransform();
+            var wmat = mesh.getWorldMatrix();
+            amat.multiplyToRef(wmat, mat);
+            mat.decompose(BABYLON.Tmp.Vector3[0], result, BABYLON.Tmp.Vector3[1]);
+        };
         return Bone;
     }(BABYLON.Node));
     BABYLON.Bone = Bone;
@@ -41852,6 +41875,10 @@ var BABYLON;
             serializationObject.physicsRestitution = mesh.getPhysicsRestitution();
             serializationObject.physicsImpostor = mesh.getPhysicsImpostor().type;
         }
+        // Metadata
+        if (mesh.metadata) {
+            serializationObject.metadata = mesh.metadata;
+        }
         // Instances
         serializationObject.instances = [];
         for (var index = 0; index < mesh.instances.length; index++) {
@@ -41957,6 +41984,10 @@ var BABYLON;
                 serializationObject.physicsGravity = scene.getPhysicsEngine().gravity.asArray();
                 serializationObject.physicsEngine = scene.getPhysicsEngine().getPhysicsPluginName();
             }
+            // Metadata
+            if (scene.metadata) {
+                serializationObject.metadata = scene.metadata;
+            }
             // Lights
             serializationObject.lights = [];
             var index;

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


+ 21 - 4
src/Bones/babylon.bone.js

@@ -411,18 +411,35 @@ var BABYLON;
                 children[i].computeAbsoluteTransforms();
             }
         };
-        Bone.prototype.getDirection = function (localAxis) {
+        Bone.prototype.getDirection = function (localAxis, mesh) {
             var result = BABYLON.Vector3.Zero();
-            this.getDirectionToRef(localAxis, result);
+            this.getDirectionToRef(localAxis, result, mesh);
             return result;
         };
-        Bone.prototype.getDirectionToRef = function (localAxis, result) {
+        Bone.prototype.getDirectionToRef = function (localAxis, result, mesh) {
             this._skeleton.computeAbsoluteTransforms();
-            BABYLON.Vector3.TransformNormalToRef(localAxis, this.getAbsoluteTransform(), result);
+            var mat = BABYLON.Tmp.Matrix[0];
+            mat.copyFrom(this.getAbsoluteTransform());
+            if (mesh) {
+                mat.multiplyToRef(mesh.getWorldMatrix(), mat);
+            }
+            BABYLON.Vector3.TransformNormalToRef(localAxis, mat, result);
             if (this._scaleVector.x != 1 || this._scaleVector.y != 1 || this._scaleVector.z != 1) {
                 result.normalize();
             }
         };
+        Bone.prototype.getRotation = function (mesh) {
+            var result = BABYLON.Quaternion.Identity();
+            this.getRotationToRef(mesh, result);
+            return result;
+        };
+        Bone.prototype.getRotationToRef = function (mesh, result) {
+            var mat = BABYLON.Tmp.Matrix[0];
+            var amat = this.getAbsoluteTransform();
+            var wmat = mesh.getWorldMatrix();
+            amat.multiplyToRef(wmat, mat);
+            mat.decompose(BABYLON.Tmp.Vector3[0], result, BABYLON.Tmp.Vector3[1]);
+        };
         return Bone;
     }(BABYLON.Node));
     BABYLON.Bone = Bone;

+ 4 - 0
src/Loading/Plugins/babylon.babylonFileLoader.js

@@ -248,6 +248,10 @@ var BABYLON;
                         var physicsGravity = parsedData.physicsGravity ? BABYLON.Vector3.FromArray(parsedData.physicsGravity) : null;
                         scene.enablePhysics(physicsGravity, physicsPlugin);
                     }
+                    // Metadata
+                    if (parsedData.metadata !== undefined) {
+                        scene.metadata = parsedData.metadata;
+                    }
                     //collisions, if defined. otherwise, default is true
                     if (parsedData.collisionsEnabled != undefined) {
                         scene.collisionsEnabled = parsedData.collisionsEnabled;

+ 8 - 0
src/Tools/babylon.sceneSerializer.js

@@ -103,6 +103,10 @@ var BABYLON;
             serializationObject.physicsRestitution = mesh.getPhysicsRestitution();
             serializationObject.physicsImpostor = mesh.getPhysicsImpostor().type;
         }
+        // Metadata
+        if (mesh.metadata) {
+            serializationObject.metadata = mesh.metadata;
+        }
         // Instances
         serializationObject.instances = [];
         for (var index = 0; index < mesh.instances.length; index++) {
@@ -208,6 +212,10 @@ var BABYLON;
                 serializationObject.physicsGravity = scene.getPhysicsEngine().gravity.asArray();
                 serializationObject.physicsEngine = scene.getPhysicsEngine().getPhysicsPluginName();
             }
+            // Metadata
+            if (scene.metadata) {
+                serializationObject.metadata = scene.metadata;
+            }
             // Lights
             serializationObject.lights = [];
             var index;

+ 2 - 0
src/babylon.scene.js

@@ -136,6 +136,8 @@ var BABYLON;
             this.constantlyUpdateMeshUnderPointer = false;
             this.useRightHandedSystem = false;
             this.hoverCursor = "pointer";
+            // Metadata
+            this.metadata = null;
             // Events
             /**
             * An event triggered when the scene is disposed.