David Catuhe 7 سال پیش
والد
کامیت
6b1b7cf48d

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 1346 - 1233
Playground/babylon.d.txt


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 4540 - 4539
dist/preview release/babylon.d.ts


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 47 - 47
dist/preview release/babylon.js


+ 44 - 13
dist/preview release/babylon.max.js

@@ -5178,7 +5178,8 @@ var BABYLON;
                     case 3: // FresnelParameters
                     case 4: // Vector2
                     case 5: // Vector3
-                    case 7:// Color Curves
+                    case 7: // Color Curves
+                    case 10:// Quaternion
                         destination[property] = instanciate ? sourceProperty : sourceProperty.clone();
                         break;
                 }
@@ -5305,6 +5306,10 @@ var BABYLON;
         return generateSerializableMember(9, sourceName); // image processing
     }
     BABYLON.serializeAsImageProcessingConfiguration = serializeAsImageProcessingConfiguration;
+    function serializeAsQuaternion(sourceName) {
+        return generateSerializableMember(10, sourceName); // quaternion member
+    }
+    BABYLON.serializeAsQuaternion = serializeAsQuaternion;
     var SerializationHelper = /** @class */ (function () {
         function SerializationHelper() {
         }
@@ -13047,6 +13052,7 @@ var BABYLON;
 //# sourceMappingURL=babylon.boundingInfo.js.map
 
 
+
 var BABYLON;
 (function (BABYLON) {
     var TransformNode = /** @class */ (function (_super) {
@@ -13917,6 +13923,27 @@ var BABYLON;
         TransformNode.BILLBOARDMODE_ALL = 7;
         TransformNode._lookAtVectorCache = new BABYLON.Vector3(0, 0, 0);
         TransformNode._rotationAxisCache = new BABYLON.Quaternion();
+        __decorate([
+            BABYLON.serializeAsVector3()
+        ], TransformNode.prototype, "_rotation", void 0);
+        __decorate([
+            BABYLON.serializeAsQuaternion()
+        ], TransformNode.prototype, "_rotationQuaternion", void 0);
+        __decorate([
+            BABYLON.serializeAsVector3()
+        ], TransformNode.prototype, "_scaling", void 0);
+        __decorate([
+            BABYLON.serialize()
+        ], TransformNode.prototype, "billboardMode", void 0);
+        __decorate([
+            BABYLON.serialize()
+        ], TransformNode.prototype, "scalingDeterminant", void 0);
+        __decorate([
+            BABYLON.serialize()
+        ], TransformNode.prototype, "infiniteDistance", void 0);
+        __decorate([
+            BABYLON.serializeAsVector3()
+        ], TransformNode.prototype, "position", void 0);
         return TransformNode;
     }(BABYLON.Node));
     BABYLON.TransformNode = TransformNode;
@@ -15635,6 +15662,10 @@ var BABYLON;
 
 
 
+
+
+
+
 var BABYLON;
 (function (BABYLON) {
     var Light = /** @class */ (function (_super) {
@@ -67363,14 +67394,13 @@ var BABYLON;
                 return null;
             }
             var event = new PhysicsRadialExplosionEvent(this._scene);
-            for (var i = 0; i < impostors.length; ++i) {
-                var impostor = impostors[i];
+            impostors.forEach(function (impostor) {
                 var impostorForceAndContactPoint = event.getImpostorForceAndContactPoint(impostor, origin, radius, strength, falloff);
-                if (impostorForceAndContactPoint === null) {
-                    continue;
+                if (!impostorForceAndContactPoint) {
+                    return;
                 }
                 impostor.applyImpulse(impostorForceAndContactPoint.force, impostorForceAndContactPoint.contactPoint);
-            }
+            });
             event.cleanup(false);
             return event;
         };
@@ -67391,14 +67421,13 @@ var BABYLON;
                 return null;
             }
             var event = new PhysicsRadialExplosionEvent(this._scene);
-            for (var i = 0; i < impostors.length; ++i) {
-                var impostor = impostors[i];
+            impostors.forEach(function (impostor) {
                 var impostorForceAndContactPoint = event.getImpostorForceAndContactPoint(impostor, origin, radius, strength, falloff);
-                if (impostorForceAndContactPoint === null) {
-                    continue;
+                if (!impostorForceAndContactPoint) {
+                    return;
                 }
                 impostor.applyForce(impostorForceAndContactPoint.force, impostorForceAndContactPoint.contactPoint);
-            }
+            });
             event.cleanup(false);
             return event;
         };
@@ -67500,7 +67529,7 @@ var BABYLON;
         /*** Helpers ***/
         PhysicsRadialExplosionEvent.prototype._prepareRadialSphere = function () {
             if (!this._radialSphere) {
-                this._radialSphere = BABYLON.Mesh.CreateSphere("radialSphere", 32, 1, this._scene);
+                this._radialSphere = BABYLON.MeshBuilder.CreateSphere("radialSphere", { segments: 32, diameter: 1 }, this._scene);
                 this._radialSphere.isVisible = false;
             }
         };
@@ -67577,7 +67606,9 @@ var BABYLON;
             }
             else {
                 var radialExplosionEvent = this._physicsHelper.applyRadialExplosionForce(this._origin, this._radius, this._strength * -1, this._falloff);
-                this._radialSphere = radialExplosionEvent.getData().radialSphere.clone('radialSphereClone');
+                if (radialExplosionEvent) {
+                    this._radialSphere = radialExplosionEvent.getData().radialSphere.clone('radialSphereClone');
+                }
             }
         };
         return PhysicsGravitationalFieldEvent;

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 40 - 40
dist/preview release/babylon.worker.js


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 5646 - 5533
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 36 - 36
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js


+ 317 - 24
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js

@@ -7863,7 +7863,7 @@ var BABYLON;
             }
         };
         var onerror = function (request, exception) {
-            if (onErrorCallBack) {
+            if (onErrorCallBack && request) {
                 onErrorCallBack(request.status + " " + request.statusText, exception);
             }
         };
@@ -11042,7 +11042,7 @@ var BABYLON;
                 isDDS = (extension === ".dds");
             }
             var onerror = function (request, exception) {
-                if (onError) {
+                if (onError && request) {
                     onError(request.status + " " + request.statusText, exception);
                 }
             };
@@ -11268,7 +11268,7 @@ var BABYLON;
             this._internalTexturesCache.push(texture);
             var onerror = function (request, exception) {
                 scene._removePendingData(texture);
-                if (onError) {
+                if (onError && request) {
                     onError(request.status + " " + request.statusText, exception);
                 }
             };
@@ -13442,15 +13442,18 @@ var BABYLON;
             return this;
         };
         /**
-         * Defines the passed mesh as the parent of the current mesh.
-         * Returns the AbstractMesh.
+         * Defines the passed node as the parent of the current node.
+         * Returns the TransformNode.
          */
-        TransformNode.prototype.setParent = function (mesh) {
-            var parent = mesh;
-            if (mesh == null) {
+        TransformNode.prototype.setParent = function (node) {
+            if (node == null) {
                 var rotation = BABYLON.Tmp.Quaternion[0];
                 var position = BABYLON.Tmp.Vector3[0];
                 var scale = BABYLON.Tmp.Vector3[1];
+                if (this.parent && this.parent.computeWorldMatrix) {
+                    this.parent.computeWorldMatrix(true);
+                }
+                this.computeWorldMatrix(true);
                 this.getWorldMatrix().decompose(scale, rotation, position);
                 if (this.rotationQuaternion) {
                     this.rotationQuaternion.copyFrom(rotation);
@@ -13463,13 +13466,34 @@ var BABYLON;
                 this.position.z = position.z;
             }
             else {
+                var rotation = BABYLON.Tmp.Quaternion[0];
                 var position = BABYLON.Tmp.Vector3[0];
-                var m1 = BABYLON.Tmp.Matrix[0];
-                parent.getWorldMatrix().invertToRef(m1);
-                BABYLON.Vector3.TransformCoordinatesToRef(this.position, m1, position);
-                this.position.copyFrom(position);
+                var scale = BABYLON.Tmp.Vector3[1];
+                var m0 = BABYLON.Tmp.Matrix[0];
+                var m1 = BABYLON.Tmp.Matrix[1];
+                var invParentMatrix = BABYLON.Tmp.Matrix[2];
+                node.computeWorldMatrix(true);
+                node.getWorldMatrix().decompose(scale, rotation, position);
+                rotation.toRotationMatrix(m0);
+                m1.setTranslation(position);
+                m1.multiplyToRef(m0, m0);
+                m0.invertToRef(invParentMatrix);
+                this.getWorldMatrix().multiplyToRef(invParentMatrix, m0);
+                m0.decompose(scale, rotation, position);
+                if (this.rotationQuaternion) {
+                    this.rotationQuaternion.copyFrom(rotation);
+                }
+                else {
+                    rotation.toEulerAnglesToRef(this.rotation);
+                }
+                node.getWorldMatrix().invertToRef(invParentMatrix);
+                this.getWorldMatrix().multiplyToRef(invParentMatrix, m0);
+                m0.decompose(scale, rotation, position);
+                this.position.x = position.x;
+                this.position.y = position.y;
+                this.position.z = position.z;
             }
-            this.parent = parent;
+            this.parent = node;
             return this;
         };
         Object.defineProperty(TransformNode.prototype, "nonUniformScaling", {
@@ -24169,10 +24193,9 @@ var BABYLON;
             return this;
         };
         Mesh.prototype._onBeforeDraw = function (isInstance, world, effectiveMaterial) {
-            if (isInstance) {
+            if (isInstance && effectiveMaterial) {
                 effectiveMaterial.bindOnlyWorldMatrix(world);
             }
-            return this;
         };
         /**
          * Returns an array populated with ParticleSystem objects whose the mesh is the emitter.
@@ -24393,7 +24416,8 @@ var BABYLON;
             }
             // Sources
             var meshes = this.getScene().meshes;
-            meshes.forEach(function (mesh) {
+            meshes.forEach(function (abstractMesh) {
+                var mesh = abstractMesh;
                 if (mesh._source && mesh._source === _this) {
                     mesh._source = null;
                 }
@@ -33261,6 +33285,9 @@ var BABYLON;
             }
             this._texture = texture;
             var callback = function (text) {
+                if (typeof text !== "string") {
+                    return;
+                }
                 var data = null;
                 var tempData = null;
                 var line;
@@ -44526,8 +44553,8 @@ var BABYLON;
             var _this = this;
             this._scaledPosition = BABYLON.Vector3.Zero();
             this._scaledVelocity = BABYLON.Vector3.Zero();
-            this.onMeshUpdated = function (mesh) {
-                _this._addUpdateMeshesList[mesh.uniqueId] = CollisionCoordinatorWorker.SerializeMesh(mesh);
+            this.onMeshUpdated = function (transformNode) {
+                _this._addUpdateMeshesList[transformNode.uniqueId] = CollisionCoordinatorWorker.SerializeMesh(transformNode);
             };
             this.onGeometryUpdated = function (geometry) {
                 _this._addUpdateGeometriesList[geometry.id] = CollisionCoordinatorWorker.SerializeGeometry(geometry);
@@ -49696,8 +49723,12 @@ var BABYLON;
                 this._connectedMesh = null;
             }
         };
-        Sound.prototype._onRegisterAfterWorldMatrixUpdate = function (connectedMesh) {
-            var boundingInfo = connectedMesh.getBoundingInfo();
+        Sound.prototype._onRegisterAfterWorldMatrixUpdate = function (node) {
+            if (!node.getBoundingInfo) {
+                return;
+            }
+            var mesh = node;
+            var boundingInfo = mesh.getBoundingInfo();
             this.setPosition(boundingInfo.boundingSphere.centerWorld);
             if (BABYLON.Engine.audioEngine.canUseWebAudio && this._isDirectional && this.isPlaying) {
                 this._updateDirection();
@@ -67115,6 +67146,9 @@ var BABYLON;
         PhysicsEngine.prototype.getPhysicsPlugin = function () {
             return this._physicsPlugin;
         };
+        PhysicsEngine.prototype.getImpostors = function () {
+            return this._impostors;
+        };
         PhysicsEngine.prototype.getImpostorForPhysicsObject = function (object) {
             for (var i = 0; i < this._impostors.length; ++i) {
                 if (this._impostors[i].object === object) {
@@ -67142,6 +67176,265 @@ var BABYLON;
 
 var BABYLON;
 (function (BABYLON) {
+    /**
+     * The strenght of the force in correspondence to the distance of the affected object
+     */
+    var PhysicsRadialImpulseFallof;
+    (function (PhysicsRadialImpulseFallof) {
+        PhysicsRadialImpulseFallof[PhysicsRadialImpulseFallof["Constant"] = 0] = "Constant";
+        PhysicsRadialImpulseFallof[PhysicsRadialImpulseFallof["Linear"] = 1] = "Linear"; // impulse gets weaker if it's further from the origin
+    })(PhysicsRadialImpulseFallof = BABYLON.PhysicsRadialImpulseFallof || (BABYLON.PhysicsRadialImpulseFallof = {}));
+    var PhysicsHelper = /** @class */ (function () {
+        function PhysicsHelper(scene) {
+            this._scene = scene;
+            this._physicsEngine = this._scene.getPhysicsEngine();
+            if (!this._physicsEngine) {
+                BABYLON.Tools.Warn('Physics engine not enabled. Please enable the physics before you can use the methods.');
+            }
+        }
+        /**
+         * @param {Vector3} origin the origin of the explosion
+         * @param {number} radius the explosion radius
+         * @param {number} strength the explosion strength
+         * @param {PhysicsRadialImpulseFallof} falloff possible options: Constant & Linear. Defaults to Constant
+         */
+        PhysicsHelper.prototype.applyRadialExplosionImpulse = function (origin, radius, strength, falloff) {
+            if (falloff === void 0) { falloff = PhysicsRadialImpulseFallof.Constant; }
+            if (!this._physicsEngine) {
+                BABYLON.Tools.Warn('Physics engine not enabled. Please enable the physics before you call this method.');
+                return null;
+            }
+            var impostors = this._physicsEngine.getImpostors();
+            if (impostors.length === 0) {
+                return null;
+            }
+            var event = new PhysicsRadialExplosionEvent(this._scene);
+            impostors.forEach(function (impostor) {
+                var impostorForceAndContactPoint = event.getImpostorForceAndContactPoint(impostor, origin, radius, strength, falloff);
+                if (!impostorForceAndContactPoint) {
+                    return;
+                }
+                impostor.applyImpulse(impostorForceAndContactPoint.force, impostorForceAndContactPoint.contactPoint);
+            });
+            event.cleanup(false);
+            return event;
+        };
+        /**
+         * @param {Vector3} origin the origin of the explosion
+         * @param {number} radius the explosion radius
+         * @param {number} strength the explosion strength
+         * @param {PhysicsRadialImpulseFallof} falloff possible options: Constant & Linear. Defaults to Constant
+         */
+        PhysicsHelper.prototype.applyRadialExplosionForce = function (origin, radius, strength, falloff) {
+            if (falloff === void 0) { falloff = PhysicsRadialImpulseFallof.Constant; }
+            if (!this._physicsEngine) {
+                BABYLON.Tools.Warn('Physics engine not enabled. Please enable the physics before you call the PhysicsHelper.');
+                return null;
+            }
+            var impostors = this._physicsEngine.getImpostors();
+            if (impostors.length === 0) {
+                return null;
+            }
+            var event = new PhysicsRadialExplosionEvent(this._scene);
+            impostors.forEach(function (impostor) {
+                var impostorForceAndContactPoint = event.getImpostorForceAndContactPoint(impostor, origin, radius, strength, falloff);
+                if (!impostorForceAndContactPoint) {
+                    return;
+                }
+                impostor.applyForce(impostorForceAndContactPoint.force, impostorForceAndContactPoint.contactPoint);
+            });
+            event.cleanup(false);
+            return event;
+        };
+        /**
+         * @param {Vector3} origin the origin of the explosion
+         * @param {number} radius the explosion radius
+         * @param {number} strength the explosion strength
+         * @param {PhysicsRadialImpulseFallof} falloff possible options: Constant & Linear. Defaults to Constant
+         */
+        PhysicsHelper.prototype.gravitationalField = function (origin, radius, strength, falloff) {
+            if (falloff === void 0) { falloff = PhysicsRadialImpulseFallof.Constant; }
+            if (!this._physicsEngine) {
+                BABYLON.Tools.Warn('Physics engine not enabled. Please enable the physics before you call the PhysicsHelper.');
+                return null;
+            }
+            var impostors = this._physicsEngine.getImpostors();
+            if (impostors.length === 0) {
+                return null;
+            }
+            var event = new PhysicsGravitationalFieldEvent(this, this._scene, origin, radius, strength, falloff);
+            event.cleanup(false);
+            return event;
+        };
+        return PhysicsHelper;
+    }());
+    BABYLON.PhysicsHelper = PhysicsHelper;
+    /***** Radial explosion *****/
+    var PhysicsRadialExplosionEvent = /** @class */ (function () {
+        function PhysicsRadialExplosionEvent(scene) {
+            this._rays = [];
+            this._dataFetched = false; // check if the data has been fetched. If not, do cleanup
+            this._scene = scene;
+        }
+        /**
+         * Returns the data related to the radial explosion event (radialSphere & rays).
+         * @returns {PhysicsRadialExplosionEventData}
+         */
+        PhysicsRadialExplosionEvent.prototype.getData = function () {
+            this._dataFetched = true;
+            return {
+                radialSphere: this._radialSphere,
+                rays: this._rays,
+            };
+        };
+        /**
+         * Returns the force and contact point of the impostor or false, if the impostor is not affected by the force/impulse.
+         * @param impostor
+         * @param {Vector3} origin the origin of the explosion
+         * @param {number} radius the explosion radius
+         * @param {number} strength the explosion strength
+         * @param {PhysicsRadialImpulseFallof} falloff possible options: Constant & Linear
+         * @returns {Nullable<PhysicsForceAndContactPoint>}
+         */
+        PhysicsRadialExplosionEvent.prototype.getImpostorForceAndContactPoint = function (impostor, origin, radius, strength, falloff) {
+            if (impostor.mass === 0) {
+                return null;
+            }
+            if (!this._intersectsWithRadialSphere(impostor, origin, radius)) {
+                return null;
+            }
+            var impostorObject = impostor.object;
+            var impostorObjectCenter = impostor.getObjectCenter();
+            var direction = impostorObjectCenter.subtract(origin);
+            var ray = new BABYLON.Ray(origin, direction, radius);
+            this._rays.push(ray);
+            var hit = ray.intersectsMesh(impostorObject);
+            var contactPoint = hit.pickedPoint;
+            if (!contactPoint) {
+                return null;
+            }
+            var distanceFromOrigin = BABYLON.Vector3.Distance(origin, contactPoint);
+            if (distanceFromOrigin > radius) {
+                return null;
+            }
+            var multiplier = falloff === PhysicsRadialImpulseFallof.Constant
+                ? strength
+                : strength * (1 - (distanceFromOrigin / radius));
+            var force = direction.multiplyByFloats(multiplier, multiplier, multiplier);
+            return { force: force, contactPoint: contactPoint };
+        };
+        /**
+         * Disposes the radialSphere.
+         * @param {bolean} force
+         */
+        PhysicsRadialExplosionEvent.prototype.cleanup = function (force) {
+            var _this = this;
+            if (force === void 0) { force = true; }
+            if (force) {
+                this._radialSphere.dispose();
+            }
+            else {
+                setTimeout(function () {
+                    if (!_this._dataFetched) {
+                        _this._radialSphere.dispose();
+                    }
+                }, 0);
+            }
+        };
+        /*** Helpers ***/
+        PhysicsRadialExplosionEvent.prototype._prepareRadialSphere = function () {
+            if (!this._radialSphere) {
+                this._radialSphere = BABYLON.MeshBuilder.CreateSphere("radialSphere", { segments: 32, diameter: 1 }, this._scene);
+                this._radialSphere.isVisible = false;
+            }
+        };
+        PhysicsRadialExplosionEvent.prototype._intersectsWithRadialSphere = function (impostor, origin, radius) {
+            var impostorObject = impostor.object;
+            this._prepareRadialSphere();
+            this._radialSphere.position = origin;
+            this._radialSphere.scaling = new BABYLON.Vector3(radius * 2, radius * 2, radius * 2);
+            this._radialSphere._updateBoundingInfo();
+            this._radialSphere.computeWorldMatrix(true);
+            return this._radialSphere.intersectsMesh(impostorObject, true);
+        };
+        return PhysicsRadialExplosionEvent;
+    }());
+    BABYLON.PhysicsRadialExplosionEvent = PhysicsRadialExplosionEvent;
+    /***** Gravitational Field *****/
+    var PhysicsGravitationalFieldEvent = /** @class */ (function () {
+        function PhysicsGravitationalFieldEvent(physicsHelper, scene, origin, radius, strength, falloff) {
+            if (falloff === void 0) { falloff = PhysicsRadialImpulseFallof.Constant; }
+            this._dataFetched = false; // check if the has been fetched the data. If not, do cleanup
+            this._physicsHelper = physicsHelper;
+            this._scene = scene;
+            this._origin = origin;
+            this._radius = radius;
+            this._strength = strength;
+            this._falloff = falloff;
+            this._tickCallback = this._tick.bind(this);
+        }
+        /**
+         * Returns the data related to the gravitational field event (radialSphere).
+         * @returns {PhysicsGravitationalFieldEventData}
+         */
+        PhysicsGravitationalFieldEvent.prototype.getData = function () {
+            this._dataFetched = true;
+            return {
+                radialSphere: this._radialSphere,
+            };
+        };
+        /**
+         * Enables the gravitational field.
+         */
+        PhysicsGravitationalFieldEvent.prototype.enable = function () {
+            this._tickCallback.call(this);
+            this._scene.registerBeforeRender(this._tickCallback);
+        };
+        /**
+         * Disables the gravitational field.
+         */
+        PhysicsGravitationalFieldEvent.prototype.disable = function () {
+            this._scene.unregisterBeforeRender(this._tickCallback);
+        };
+        /**
+         * Disposes the radialSphere.
+         * @param {bolean} force
+         */
+        PhysicsGravitationalFieldEvent.prototype.cleanup = function (force) {
+            var _this = this;
+            if (force === void 0) { force = true; }
+            if (force) {
+                this._radialSphere.dispose();
+            }
+            else {
+                setTimeout(function () {
+                    if (!_this._dataFetched) {
+                        _this._radialSphere.dispose();
+                    }
+                }, 0);
+            }
+        };
+        PhysicsGravitationalFieldEvent.prototype._tick = function () {
+            // Since the params won't change, we fetch the event only once
+            if (this._radialSphere) {
+                this._physicsHelper.applyRadialExplosionForce(this._origin, this._radius, this._strength * -1, this._falloff);
+            }
+            else {
+                var radialExplosionEvent = this._physicsHelper.applyRadialExplosionForce(this._origin, this._radius, this._strength * -1, this._falloff);
+                if (radialExplosionEvent) {
+                    this._radialSphere = radialExplosionEvent.getData().radialSphere.clone('radialSphereClone');
+                }
+            }
+        };
+        return PhysicsGravitationalFieldEvent;
+    }());
+    BABYLON.PhysicsGravitationalFieldEvent = PhysicsGravitationalFieldEvent;
+})(BABYLON || (BABYLON = {}));
+
+//# sourceMappingURL=babylon.physicsHelper.js.map
+
+var BABYLON;
+(function (BABYLON) {
     var CannonJSPlugin = /** @class */ (function () {
         function CannonJSPlugin(_useDeltaForWorldStep, iterations) {
             if (_useDeltaForWorldStep === void 0) { _useDeltaForWorldStep = true; }
@@ -74526,8 +74819,8 @@ var BABYLON;
             var onload = function () {
                 onSuccess();
             };
-            var onerror = function (msg, exception) {
-                onError(msg, exception);
+            var onerror = function (message, exception) {
+                onError(message, exception);
             };
             this.texture = new BABYLON.Texture(this.url, scene, this.noMipmap, this.invertY, this.samplingMode, onload, onerror);
         };
@@ -74549,8 +74842,8 @@ var BABYLON;
             var onload = function () {
                 onSuccess();
             };
-            var onerror = function (msg, exception) {
-                onError(msg, exception);
+            var onerror = function (message, exception) {
+                onError(message, exception);
             };
             this.texture = new BABYLON.CubeTexture(this.url, scene, this.extensions, this.noMipmap, this.files, onload, onerror);
         };

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 1 - 1
dist/preview release/loaders/babylon.objFileLoader.min.js


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 1 - 1
dist/preview release/loaders/babylonjs.loaders.min.js


+ 74 - 62
src/Mesh/babylon.transformNode.ts

@@ -6,19 +6,31 @@ module BABYLON {
         public static BILLBOARDMODE_Y = 2;
         public static BILLBOARDMODE_Z = 4;
         public static BILLBOARDMODE_ALL = 7;
-        
+
         // Properties
+        @serializeAsVector3()
         private _rotation = Vector3.Zero();
+
+        @serializeAsQuaternion()
         private _rotationQuaternion: Nullable<Quaternion>;
+
+        @serializeAsVector3()
         protected _scaling = Vector3.One();
         protected _isDirty = false;
         private _transformToBoneReferal: Nullable<TransformNode>;
-        
+
+        @serialize()
         public billboardMode = AbstractMesh.BILLBOARDMODE_NONE;
+
+        @serialize()
         public scalingDeterminant = 1;
+
+        @serialize()
         public infiniteDistance = false;
+
+        @serializeAsVector3()
         public position = Vector3.Zero();
-                        
+
         // Cache        
         public _poseMatrix: Matrix;
         private _localWorld = Matrix.Zero();
@@ -26,15 +38,15 @@ module BABYLON {
         private _absolutePosition = Vector3.Zero();
         private _pivotMatrix = Matrix.Identity();
         private _pivotMatrixInverse: Matrix;
-        private _postMultiplyPivotMatrix = false;        
-        
+        private _postMultiplyPivotMatrix = false;
+
         protected _isWorldMatrixFrozen = false;
 
         /**
         * An event triggered after the world matrix is updated
         * @type {BABYLON.Observable}
         */
-        public onAfterWorldMatrixUpdateObservable = new Observable<TransformNode>();        
+        public onAfterWorldMatrixUpdateObservable = new Observable<TransformNode>();
 
         constructor(name: string, scene: Nullable<Scene> = null, isPure = true) {
             super(name, scene);
@@ -42,13 +54,13 @@ module BABYLON {
             if (isPure) {
                 this.getScene().addTransformNode(this);
             }
-        }        
-                
-       /**
-         * Rotation property : a Vector3 depicting the rotation value in radians around each local axis X, Y, Z. 
-         * If rotation quaternion is set, this Vector3 will (almost always) be the Zero vector!
-         * Default : (0.0, 0.0, 0.0)
-         */
+        }
+
+        /**
+          * Rotation property : a Vector3 depicting the rotation value in radians around each local axis X, Y, Z. 
+          * If rotation quaternion is set, this Vector3 will (almost always) be the Zero vector!
+          * Default : (0.0, 0.0, 0.0)
+          */
         public get rotation(): Vector3 {
             return this._rotation;
         }
@@ -125,7 +137,7 @@ module BABYLON {
         public getPoseMatrix(): Matrix {
             return this._poseMatrix;
         }
-        
+
         public _isSynchronized(): boolean {
             if (this._isDirty) {
                 return false;
@@ -177,7 +189,7 @@ module BABYLON {
             this._currentRenderId = Number.MAX_VALUE;
             this._isDirty = true;
             return this;
-        }        
+        }
 
         /**
          * Returns the current mesh absolute position.
@@ -240,10 +252,10 @@ module BABYLON {
             return this._isWorldMatrixFrozen;
         }
 
-     /**
-         * Retuns the mesh absolute position in the World.  
-         * Returns a Vector3.
-         */
+        /**
+            * Retuns the mesh absolute position in the World.  
+            * Returns a Vector3.
+            */
         public getAbsolutePosition(): Vector3 {
             this.computeWorldMatrix();
             return this._absolutePosition;
@@ -284,12 +296,12 @@ module BABYLON {
                 this.position.z = absolutePositionZ;
             }
             return this;
-        }   
+        }
 
-      /**
-         * Sets the mesh position in its local space.  
-         * Returns the AbstractMesh.  
-         */
+        /**
+           * Sets the mesh position in its local space.  
+           * Returns the AbstractMesh.  
+           */
         public setPositionWithLocalVector(vector3: Vector3): TransformNode {
             this.computeWorldMatrix();
             this.position = Vector3.TransformNormal(vector3, this._localWorld);
@@ -336,12 +348,12 @@ module BABYLON {
             this.rotationQuaternion = this.rotationQuaternion || new Quaternion();
             Quaternion.RotationYawPitchRollToRef(yaw + yawCor, pitch + pitchCor, rollCor, this.rotationQuaternion);
             return this;
-        }        
+        }
 
-       /**
-         * Returns a new Vector3 what is the localAxis, expressed in the mesh local space, rotated like the mesh.  
-         * This Vector3 is expressed in the World space.  
-         */
+        /**
+          * Returns a new Vector3 what is the localAxis, expressed in the mesh local space, rotated like the mesh.  
+          * This Vector3 is expressed in the World space.  
+          */
         public getDirection(localAxis: Vector3): Vector3 {
             var result = Vector3.Zero();
 
@@ -422,23 +434,23 @@ module BABYLON {
             this.getPivotPointToRef(result);
             Vector3.TransformCoordinatesToRef(result, this.getWorldMatrix(), result);
             return this;
-        }        
+        }
 
         /**
          * Defines the passed node as the parent of the current node.  
          * Returns the TransformNode.
          */
         public setParent(node: Nullable<TransformNode>): TransformNode {
-            
+
             if (node == null) {
                 var rotation = Tmp.Quaternion[0];
                 var position = Tmp.Vector3[0];
                 var scale = Tmp.Vector3[1];
-                
-                if(this.parent && (<TransformNode>this.parent).computeWorldMatrix){
+
+                if (this.parent && (<TransformNode>this.parent).computeWorldMatrix) {
                     (<TransformNode>this.parent).computeWorldMatrix(true);
                 }
-                this.computeWorldMatrix(true);              
+                this.computeWorldMatrix(true);
                 this.getWorldMatrix().decompose(scale, rotation, position);
 
                 if (this.rotationQuaternion) {
@@ -457,37 +469,37 @@ module BABYLON {
                 var m0 = Tmp.Matrix[0];
                 var m1 = Tmp.Matrix[1];
                 var invParentMatrix = Tmp.Matrix[2];
-                
+
                 node.computeWorldMatrix(true);
                 node.getWorldMatrix().decompose(scale, rotation, position);
-                
+
                 rotation.toRotationMatrix(m0);
-                m1.setTranslation(position);   
-                m1.multiplyToRef(m0, m0);     
+                m1.setTranslation(position);
+                m1.multiplyToRef(m0, m0);
                 m0.invertToRef(invParentMatrix);
-                
-                this.getWorldMatrix().multiplyToRef(invParentMatrix, m0);        
+
+                this.getWorldMatrix().multiplyToRef(invParentMatrix, m0);
                 m0.decompose(scale, rotation, position);
-                
+
                 if (this.rotationQuaternion) {
                     this.rotationQuaternion.copyFrom(rotation);
                 } else {
                     rotation.toEulerAnglesToRef(this.rotation);
                 }
-                
+
                 node.getWorldMatrix().invertToRef(invParentMatrix);
                 this.getWorldMatrix().multiplyToRef(invParentMatrix, m0);
                 m0.decompose(scale, rotation, position);
-                
+
                 this.position.x = position.x;
                 this.position.y = position.y;
                 this.position.z = position.z;
             }
-            
+
             this.parent = node;
             return this;
-        }       
-        
+        }
+
         private _nonUniformScaling = false;
         public get nonUniformScaling(): boolean {
             return this._nonUniformScaling;
@@ -500,7 +512,7 @@ module BABYLON {
 
             this._nonUniformScaling = true;
             return true;
-        }        
+        }
 
         /**
          * Attach the current TransformNode to another TransformNode associated with a bone
@@ -528,7 +540,7 @@ module BABYLON {
             this._transformToBoneReferal = null;
             this.parent = null;
             return this;
-        }        
+        }
 
         private static _rotationAxisCache = new Quaternion();
         /**
@@ -636,8 +648,8 @@ module BABYLON {
                 rotationQuaternion.toEulerAnglesToRef(this.rotation);
             }
             return this;
-        }        
-        
+        }
+
         /**
          * Computes the mesh World matrix and returns it.  
          * If the mesh world matrix is frozen, this computation does nothing more than returning the last frozen values.  
@@ -685,7 +697,7 @@ module BABYLON {
 
             // Translation
             let camera = (<Camera>this.getScene().activeCamera);
-            
+
             if (this.infiniteDistance && !this.parent && camera) {
 
                 var cameraWorldMatrix = camera.getWorldMatrix();
@@ -804,7 +816,7 @@ module BABYLON {
             }
 
             return this._worldMatrix;
-        }   
+        }
 
         protected _afterComputeWorldMatrix(): void {
         }
@@ -827,7 +839,7 @@ module BABYLON {
         public unregisterAfterWorldMatrixUpdate(func: (mesh: TransformNode) => void): TransformNode {
             this.onAfterWorldMatrixUpdateObservable.removeCallback(func);
             return this;
-        }        
+        }
 
         public clone(name: string, newParent: Node): Nullable<TransformNode> {
             var result = SerializationHelper.Clone(() => new TransformNode(name, this.getScene()), this);
@@ -840,7 +852,7 @@ module BABYLON {
             }
 
             return result;
-        }        
+        }
 
         public serialize(serializationObject: any = null): any {
             if (!serializationObject) {
@@ -928,15 +940,15 @@ module BABYLON {
             if (parsedTransformNode.parentId) {
                 transformNode._waitingParentId = parsedTransformNode.parentId;
             }
-         
+
             return transformNode;
-        }        
+        }
 
-    /**
-         * Disposes the TransformNode.  
-         * By default, all the children are also disposed unless the parameter `doNotRecurse` is set to `true`.  
-         * Returns nothing.  
-         */
+        /**
+             * Disposes the TransformNode.  
+             * By default, all the children are also disposed unless the parameter `doNotRecurse` is set to `true`.  
+             * Returns nothing.  
+             */
         public dispose(doNotRecurse?: boolean): void {
             // Animations
             this.getScene().stopAnimation(this);
@@ -965,6 +977,6 @@ module BABYLON {
 
             super.dispose();
         }
-        
+
     }
 }

+ 14 - 9
src/Tools/babylon.decorators.ts

@@ -2,7 +2,7 @@
     var __decoratorInitialStore = {};
     var __mergedStore = {};
 
-    var _copySource = function<T>(creationFunction: () => T, source: T, instanciate: boolean): T {
+    var _copySource = function <T>(creationFunction: () => T, source: T, instanciate: boolean): T {
         var destination = creationFunction();
 
         // Tags
@@ -25,14 +25,15 @@
                         (<any>destination)[property] = sourceProperty;
                         break;
                     case 1:     // Texture
-                        (<any>destination)[property] = (instanciate||sourceProperty.isRenderTarget)?sourceProperty:sourceProperty.clone();
+                        (<any>destination)[property] = (instanciate || sourceProperty.isRenderTarget) ? sourceProperty : sourceProperty.clone();
                         break;
                     case 2:     // Color3
                     case 3:     // FresnelParameters
                     case 4:     // Vector2
                     case 5:     // Vector3
                     case 7:     // Color Curves
-                        (<any>destination)[property] = instanciate?sourceProperty:sourceProperty.clone();
+                    case 10:    // Quaternion
+                        (<any>destination)[property] = instanciate ? sourceProperty : sourceProperty.clone();
                         break;
                 }
             }
@@ -70,7 +71,7 @@
         while (currentKey) {
             let initialStore = (<any>__decoratorInitialStore)[currentKey];
             for (var property in initialStore) {
-                store[property] = initialStore[property];                
+                store[property] = initialStore[property];
             }
 
             let parent: any;
@@ -94,7 +95,7 @@
             if (done) {
                 break;
             }
-            
+
             currentKey = parent.getClassName();
             currentTarget = parent;
         }
@@ -116,15 +117,15 @@
         return (target: any, propertyKey: string) => {
             var key = targetKey || ("_" + propertyKey);
             Object.defineProperty(target, propertyKey, {
-                get: function () {
+                get: function (this: any) {
                     return this[key];
                 },
-                set: function (value) {
+                set: function (this: any, value) {
                     if (this[key] === value) {
                         return;
                     }
                     this[key] = value;
-                    
+
                     target[setCallback].apply(this);
                 },
                 enumerable: true,
@@ -164,7 +165,7 @@
     export function serializeAsMeshReference(sourceName?: string) {
         return generateSerializableMember(6, sourceName); // mesh reference member
     }
-    
+
     export function serializeAsColorCurves(sourceName?: string) {
         return generateSerializableMember(7, sourceName); // color curves
     }
@@ -177,6 +178,10 @@
         return generateSerializableMember(9, sourceName); // image processing
     }
 
+    export function serializeAsQuaternion(sourceName?: string) {
+        return generateSerializableMember(10, sourceName); // quaternion member
+    }
+
 
     export class SerializationHelper {