David Catuhe 7 năm trước cách đây
mục cha
commit
157c34f135

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 10710 - 10625
Playground/babylon.d.txt


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 6488 - 6448
dist/preview release/babylon.d.ts


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 27 - 27
dist/preview release/babylon.js


+ 187 - 125
dist/preview release/babylon.max.js

@@ -17776,16 +17776,29 @@ var BABYLON;
 var BABYLON;
 (function (BABYLON) {
     var BoundingSphere = /** @class */ (function () {
-        function BoundingSphere(minimum, maximum) {
-            this.minimum = minimum;
-            this.maximum = maximum;
+        /**
+         * Creates a new bounding sphere
+         * @param min defines the minimum vector (in local space)
+         * @param max defines the maximum vector (in local space)
+         */
+        function BoundingSphere(min, max) {
             this._tempRadiusVector = BABYLON.Vector3.Zero();
-            var distance = BABYLON.Vector3.Distance(minimum, maximum);
-            this.center = BABYLON.Vector3.Lerp(minimum, maximum, 0.5);
+            this.reConstruct(min, max);
+        }
+        /**
+         * Recreates the entire bounding sphere from scratch
+         * @param min defines the new minimum vector (in local space)
+         * @param max defines the new maximum vector (in local space)
+         */
+        BoundingSphere.prototype.reConstruct = function (min, max) {
+            this.minimum = min.clone();
+            this.maximum = max.clone();
+            var distance = BABYLON.Vector3.Distance(min, max);
+            this.center = BABYLON.Vector3.Lerp(min, max, 0.5);
             this.radius = distance * 0.5;
             this.centerWorld = BABYLON.Vector3.Zero();
             this._update(BABYLON.Matrix.Identity());
-        }
+        };
         // Methods
         BoundingSphere.prototype._update = function (world) {
             BABYLON.Vector3.TransformCoordinatesToRef(this.center, world, this.centerWorld);
@@ -17828,12 +17841,26 @@ var BABYLON;
 var BABYLON;
 (function (BABYLON) {
     var BoundingBox = /** @class */ (function () {
-        function BoundingBox(minimum, maximum) {
-            this.minimum = minimum;
-            this.maximum = maximum;
-            this.vectors = new Array();
+        /**
+         * Creates a new bounding box
+         * @param min defines the minimum vector (in local space)
+         * @param max defines the maximum vector (in local space)
+         */
+        function BoundingBox(min, max) {
             this.vectorsWorld = new Array();
+            this.reConstruct(min, max);
+        }
+        // Methods
+        /**
+         * Recreates the entire bounding box from scratch
+         * @param min defines the new minimum vector (in local space)
+         * @param max defines the new maximum vector (in local space)
+         */
+        BoundingBox.prototype.reConstruct = function (min, max) {
+            this.minimum = min.clone();
+            this.maximum = max.clone();
             // Bounding vectors
+            this.vectors = new Array();
             this.vectors.push(this.minimum.clone());
             this.vectors.push(this.maximum.clone());
             this.vectors.push(this.minimum.clone());
@@ -17860,9 +17887,8 @@ var BABYLON;
             this.maximumWorld = BABYLON.Vector3.Zero();
             this.centerWorld = BABYLON.Vector3.Zero();
             this.extendSizeWorld = BABYLON.Vector3.Zero();
-            this._update(BABYLON.Matrix.Identity());
-        }
-        // Methods
+            this._update(this._worldMatrix || BABYLON.Matrix.Identity());
+        };
         BoundingBox.prototype.getWorldMatrix = function () {
             return this._worldMatrix;
         };
@@ -19409,10 +19435,7 @@ var BABYLON;
                 if (!this.subMeshes) {
                     return;
                 }
-                for (var _i = 0, _a = this.subMeshes; _i < _a.length; _i++) {
-                    var subMesh = _a[_i];
-                    subMesh.setEffect(null);
-                }
+                this._unBindEffect();
             },
             enumerable: true,
             configurable: true
@@ -19629,6 +19652,13 @@ var BABYLON;
             }
             this._markSubMeshesAsLightDirty();
         };
+        /** @ignore */
+        AbstractMesh.prototype._unBindEffect = function () {
+            for (var _i = 0, _a = this.subMeshes; _i < _a.length; _i++) {
+                var subMesh = _a[_i];
+                subMesh.setEffect(null);
+            }
+        };
         AbstractMesh.prototype._removeLightSource = function (light) {
             var index = this._lightSources.indexOf(light);
             if (index === -1) {
@@ -30777,6 +30807,13 @@ var BABYLON;
             }
             return ret;
         };
+        Mesh.prototype._unBindEffect = function () {
+            _super.prototype._unBindEffect.call(this);
+            for (var _i = 0, _a = this.instances; _i < _a.length; _i++) {
+                var instance = _a[_i];
+                instance._unBindEffect();
+            }
+        };
         Object.defineProperty(Mesh.prototype, "hasLODLevels", {
             /**
              * True if the mesh has some Levels Of Details (LOD).
@@ -43132,11 +43169,17 @@ var BABYLON;
         };
         StandardMaterial.prototype.unbind = function () {
             if (this._activeEffect) {
+                var needFlag = false;
                 if (this._reflectionTexture && this._reflectionTexture.isRenderTarget) {
                     this._activeEffect.setTexture("reflection2DSampler", null);
+                    needFlag = true;
                 }
                 if (this._refractionTexture && this._refractionTexture.isRenderTarget) {
                     this._activeEffect.setTexture("refraction2DSampler", null);
+                    needFlag = true;
+                }
+                if (needFlag) {
+                    this._markAllSubMeshesAsTexturesDirty();
                 }
             }
             _super.prototype.unbind.call(this);
@@ -50715,21 +50758,15 @@ var BABYLON;
             if (this._isStarted || this._targetedAnimations.length === 0) {
                 return this;
             }
-            var _loop_1 = function () {
-                var targetedAnimation = this_1._targetedAnimations[index];
-                if (!targetedAnimation.target.animations) {
-                    targetedAnimation.target.animations = [];
-                }
-                if (targetedAnimation.target.animations.indexOf(targetedAnimation.animation) === -1) {
-                    targetedAnimation.target.animations.push(targetedAnimation.animation);
-                }
+            var _loop_1 = function (targetedAnimation) {
                 this_1._animatables.push(this_1._scene.beginDirectAnimation(targetedAnimation.target, [targetedAnimation.animation], from !== undefined ? from : this_1._from, to !== undefined ? to : this_1._to, loop, speedRatio, function () {
                     _this.onAnimationEndObservable.notifyObservers(targetedAnimation);
                 }));
             };
             var this_1 = this;
-            for (var index = 0; index < this._targetedAnimations.length; index++) {
-                _loop_1();
+            for (var _i = 0, _a = this._targetedAnimations; _i < _a.length; _i++) {
+                var targetedAnimation = _a[_i];
+                _loop_1(targetedAnimation);
             }
             this._speedRatio = speedRatio;
             this._isStarted = true;
@@ -51183,7 +51220,7 @@ var BABYLON;
                         }
                     }
                 }
-                else if (this._originalBlendValue.constructor) { // Complex value
+                else {
                     var constructor = this._originalBlendValue.constructor;
                     if (constructor.Lerp) { // Lerp supported
                         this._currentValue = constructor.Lerp(this._originalBlendValue, currentValue, this._blendingFactor);
@@ -51191,13 +51228,13 @@ var BABYLON;
                     else if (constructor.Slerp) { // Slerp supported
                         this._currentValue = constructor.Slerp(this._originalBlendValue, currentValue, this._blendingFactor);
                     }
+                    else if (this._originalBlendValue.toFixed) { // Number
+                        this._currentValue = this._originalBlendValue * (1.0 - this._blendingFactor) + this._blendingFactor * currentValue;
+                    }
                     else { // Blending not supported
                         this._currentValue = currentValue;
                     }
                 }
-                else { // Direct value
-                    this._currentValue = this._originalBlendValue * (1.0 - this._blendingFactor) + this._blendingFactor * currentValue;
-                }
                 this._blendingFactor += blendingSpeed;
             }
             else {
@@ -51989,10 +52026,16 @@ var BABYLON;
          * @param actionManager manager for the action the condition applies to
          * @param target for the action
          * @param propertyPath path to specify the property of the target the conditional operator uses
-         * @param value the vale compared by the conditional operator against the current value of the property
-         * @param operator the conditional operator, default {BABYLON.ValueCondition.IsEqual}
-         */
-        function ValueCondition(actionManager, target, propertyPath, value, operator) {
+         * @param value the value compared by the conditional operator against the current value of the property
+         * @param operator the conditional operator, default ValueCondition.IsEqual
+         */
+        function ValueCondition(actionManager, target, 
+        /** path to specify the property of the target the conditional operator uses  */
+        propertyPath, 
+        /** the value compared by the conditional operator against the current value of the property */
+        value, 
+        /** the conditional operator, default ValueCondition.IsEqual */
+        operator) {
             if (operator === void 0) { operator = ValueCondition.IsEqual; }
             var _this = _super.call(this, actionManager) || this;
             _this.propertyPath = propertyPath;
@@ -52124,11 +52167,13 @@ var BABYLON;
     var PredicateCondition = /** @class */ (function (_super) {
         __extends(PredicateCondition, _super);
         /**
-         * Creates a new {BABYLON.PredicateCondition}
+         * Creates a new PredicateCondition
          * @param actionManager manager for the action the condition applies to
-         * @param predicate
+         * @param predicate defines the predicate function used to validate the condition
          */
-        function PredicateCondition(actionManager, predicate) {
+        function PredicateCondition(actionManager, 
+        /** defines the predicate function used to validate the condition */
+        predicate) {
             var _this = _super.call(this, actionManager) || this;
             _this.predicate = predicate;
             return _this;
@@ -52143,12 +52188,12 @@ var BABYLON;
     }(Condition));
     BABYLON.PredicateCondition = PredicateCondition;
     /**
-     * Defines a state condition as an extension of {BABYLON.Condition}
+     * Defines a state condition as an extension of Condition
      */
     var StateCondition = /** @class */ (function (_super) {
         __extends(StateCondition, _super);
         /**
-         * Creates a new {BABYLON.StateCondition}
+         * Creates a new StateCondition
          * @param actionManager manager for the action the condition applies to
          * @param target of the condition
          * @param value to compare with target state
@@ -52166,7 +52211,7 @@ var BABYLON;
             return this._target.state === this.value;
         };
         /**
-         * Serialize the {BABYLON.StateCondition} into a JSON compatible object
+         * Serialize the StateCondition into a JSON compatible object
          * @returns serialization object
          */
         StateCondition.prototype.serialize = function () {
@@ -52443,7 +52488,7 @@ var BABYLON;
             // Members
             this.actions = new Array();
             this.hoverCursor = '';
-            this._scene = scene;
+            this._scene = scene || BABYLON.Engine.LastCreatedScene;
             scene._actionManagers.push(this);
         }
         Object.defineProperty(ActionManager, "NothingTrigger", {
@@ -61016,9 +61061,19 @@ var BABYLON;
              * Returns true if the decoder is available.
              */
             get: function () {
-                return (typeof DracoDecoderModule !== "undefined" ||
-                    (typeof WebAssembly === "object" && !!DracoCompression.Configuration.decoderWasm) ||
-                    !!DracoCompression.Configuration.decoder);
+                if (typeof DracoDecoderModule !== "undefined") {
+                    return true;
+                }
+                var decoder = DracoCompression.Configuration.decoder;
+                if (decoder) {
+                    if (decoder.wasmUrl && decoder.wasmBinaryUrl && typeof WebAssembly === "object") {
+                        return true;
+                    }
+                    if (decoder.fallbackUrl) {
+                        return true;
+                    }
+                }
+                return false;
             },
             enumerable: true,
             configurable: true
@@ -61108,24 +61163,29 @@ var BABYLON;
         };
         DracoCompression._GetDecoderModule = function () {
             if (!DracoCompression._DecoderModulePromise) {
-                var promise = void 0;
+                var promise = null;
                 var config_1 = {};
                 if (typeof DracoDecoderModule !== "undefined") {
                     promise = Promise.resolve();
                 }
-                else if (typeof WebAssembly === "object" && DracoCompression.Configuration.decoderWasm) {
-                    promise = Promise.all([
-                        DracoCompression._LoadScriptAsync(DracoCompression.Configuration.decoderWasm.wrapperUrl),
-                        DracoCompression._LoadFileAsync(DracoCompression.Configuration.decoderWasm.binaryUrl).then(function (data) {
-                            config_1.wasmBinary = data;
-                        })
-                    ]);
-                }
-                else if (DracoCompression.Configuration.decoder) {
-                    promise = DracoCompression._LoadScriptAsync(DracoCompression.Configuration.decoder.url);
-                }
                 else {
-                    throw new Error("Invalid decoder configuration");
+                    var decoder = DracoCompression.Configuration.decoder;
+                    if (decoder) {
+                        if (decoder.wasmUrl && decoder.wasmBinaryUrl && typeof WebAssembly === "object") {
+                            promise = Promise.all([
+                                DracoCompression._LoadScriptAsync(decoder.wasmUrl),
+                                DracoCompression._LoadFileAsync(decoder.wasmBinaryUrl).then(function (data) {
+                                    config_1.wasmBinary = data;
+                                })
+                            ]);
+                        }
+                        else if (decoder.fallbackUrl) {
+                            promise = DracoCompression._LoadScriptAsync(decoder.fallbackUrl);
+                        }
+                    }
+                }
+                if (!promise) {
+                    throw new Error("Draco decoder module is not available");
                 }
                 DracoCompression._DecoderModulePromise = promise.then(function () {
                     return new Promise(function (resolve) {
@@ -61157,51 +61217,16 @@ var BABYLON;
                 });
             });
         };
-        DracoCompression._GetDefaultConfig = function () {
-            var configuration = {
-                decoder: null,
-                decoderWasm: null
-            };
-            if (BABYLON.Tools.IsWindowObjectExist()) {
-                var decoderUrl = null;
-                var decoderWasmBinaryUrl = null;
-                var decoderWasmWrapperUrl = null;
-                for (var i = 0; i < document.scripts.length; i++) {
-                    var type = document.scripts[i].type;
-                    var src = document.scripts[i].src;
-                    switch (type) {
-                        case "text/x-draco-decoder": {
-                            decoderUrl = src;
-                            break;
-                        }
-                        case "text/x-draco-decoder-wasm-binary": {
-                            decoderWasmBinaryUrl = src;
-                            break;
-                        }
-                        case "text/x-draco-decoder-wasm-wrapper": {
-                            decoderWasmWrapperUrl = src;
-                            break;
-                        }
-                    }
-                }
-                if (decoderUrl) {
-                    configuration.decoder = {
-                        url: decoderUrl
-                    };
-                }
-                if (decoderWasmWrapperUrl && decoderWasmBinaryUrl) {
-                    configuration.decoderWasm = {
-                        binaryUrl: decoderWasmBinaryUrl,
-                        wrapperUrl: decoderWasmWrapperUrl
-                    };
-                }
-            }
-            return configuration;
-        };
         /**
-         * Gets the configuration.
+         * The configuration.
          */
-        DracoCompression.Configuration = DracoCompression._GetDefaultConfig();
+        DracoCompression.Configuration = {
+            decoder: {
+                wasmUrl: "https://preview.babylonjs.com/draco_wasm_wrapper_gltf.js",
+                wasmBinaryUrl: "https://preview.babylonjs.com/draco_decoder_gltf.wasm",
+                fallbackUrl: "https://preview.babylonjs.com/draco_decoder_gltf.js"
+            }
+        };
         return DracoCompression;
     }());
     BABYLON.DracoCompression = DracoCompression;
@@ -77079,6 +77104,9 @@ var BABYLON;
                 var child = _a[_i];
                 var cm = child.getLocalMatrix();
                 cm.multiplyToRef(scaleMat, cm);
+                cm.m[12] *= x;
+                cm.m[13] *= y;
+                cm.m[14] *= z;
                 child._markAsDirtyAndDecompose();
             }
             this._markAsDirtyAndDecompose();
@@ -77602,13 +77630,37 @@ var BABYLON;
 
 var BABYLON;
 (function (BABYLON) {
-    /** Class used to apply inverse kinematics to bones */
+    /**
+     * Class used to apply inverse kinematics to bones
+     * @see http://doc.babylonjs.com/how_to/how_to_use_bones_and_skeletons#boneikcontroller
+     */
     var BoneIKController = /** @class */ (function () {
+        /**
+         * Creates a new BoneIKController
+         * @param mesh defines the mesh to control
+         * @param bone defines the bone to control
+         * @param options defines options to set up the controller
+         */
         function BoneIKController(mesh, bone, options) {
+            /**
+             * Gets or sets the target position
+             */
             this.targetPosition = BABYLON.Vector3.Zero();
+            /**
+             * Gets or sets the pole target position
+             */
             this.poleTargetPosition = BABYLON.Vector3.Zero();
+            /**
+             * Gets or sets the pole target local offset
+             */
             this.poleTargetLocalOffset = BABYLON.Vector3.Zero();
+            /**
+             * Gets or sets the pole angle
+             */
             this.poleAngle = 0;
+            /**
+             * The amount to slerp (spherical linear interpolation) to the target.  Set this to a value between 0 and 1 (a value of 1 disables slerp)
+             */
             this.slerpAmount = 1;
             this._bone1Quat = BABYLON.Quaternion.Identity();
             this._bone1Mat = BABYLON.Matrix.Identity();
@@ -77684,6 +77736,9 @@ var BABYLON;
             }
         }
         Object.defineProperty(BoneIKController.prototype, "maxAngle", {
+            /**
+             * Gets or sets maximum allowed angle
+             */
             get: function () {
                 return this._maxAngle;
             },
@@ -77705,6 +77760,9 @@ var BABYLON;
             var b = this._bone2Length;
             this._maxReach = Math.sqrt(a * a + b * b - 2 * a * b * Math.cos(ang));
         };
+        /**
+         * Force the controller to update the bones
+         */
         BoneIKController.prototype.update = function () {
             var bone1 = this._bone1;
             if (!bone1) {
@@ -77816,6 +77874,10 @@ var BABYLON;
 
 var BABYLON;
 (function (BABYLON) {
+    /**
+     * Class used to make a bone look toward a point in space
+     * @see http://doc.babylonjs.com/how_to/how_to_use_bones_and_skeletons#bonelookcontroller
+     */
     var BoneLookController = /** @class */ (function () {
         /**
          * Create a BoneLookController
@@ -77823,42 +77885,42 @@ var BABYLON;
          * @param bone the bone that will be looking to the target
          * @param target the target Vector3 to look at
          * @param settings optional settings:
-         * - maxYaw: the maximum angle the bone will yaw to
-         * - minYaw: the minimum angle the bone will yaw to
-         * - maxPitch: the maximum angle the bone will pitch to
-         * - minPitch: the minimum angle the bone will yaw to
-         * - slerpAmount: set the between 0 and 1 to make the bone slerp to the target.
-         * - upAxis: the up axis of the coordinate system
-         * - upAxisSpace: the space that the up axis is in - BABYLON.Space.BONE, BABYLON.Space.LOCAL (default), or BABYLON.Space.WORLD.
-         * - yawAxis: set yawAxis if the bone does not yaw on the y axis
-         * - pitchAxis: set pitchAxis if the bone does not pitch on the x axis
-         * - adjustYaw: used to make an adjustment to the yaw of the bone
-         * - adjustPitch: used to make an adjustment to the pitch of the bone
-         * - adjustRoll: used to make an adjustment to the roll of the bone
+         * * maxYaw: the maximum angle the bone will yaw to
+         * * minYaw: the minimum angle the bone will yaw to
+         * * maxPitch: the maximum angle the bone will pitch to
+         * * minPitch: the minimum angle the bone will yaw to
+         * * slerpAmount: set the between 0 and 1 to make the bone slerp to the target.
+         * * upAxis: the up axis of the coordinate system
+         * * upAxisSpace: the space that the up axis is in - BABYLON.Space.BONE, BABYLON.Space.LOCAL (default), or BABYLON.Space.WORLD.
+         * * yawAxis: set yawAxis if the bone does not yaw on the y axis
+         * * pitchAxis: set pitchAxis if the bone does not pitch on the x axis
+         * * adjustYaw: used to make an adjustment to the yaw of the bone
+         * * adjustPitch: used to make an adjustment to the pitch of the bone
+         * * adjustRoll: used to make an adjustment to the roll of the bone
          **/
         function BoneLookController(mesh, bone, target, options) {
             /**
-             * The up axis of the coordinate system that is used when the bone is rotated.
+             * The up axis of the coordinate system that is used when the bone is rotated
              */
             this.upAxis = BABYLON.Vector3.Up();
             /**
-             * The space that the up axis is in - BABYLON.Space.BONE, BABYLON.Space.LOCAL (default), or BABYLON.Space.WORLD.
+             * The space that the up axis is in - BABYLON.Space.BONE, BABYLON.Space.LOCAL (default), or BABYLON.Space.WORLD
              */
             this.upAxisSpace = BABYLON.Space.LOCAL;
             /**
-             * Used to make an adjustment to the yaw of the bone.
+             * Used to make an adjustment to the yaw of the bone
              */
             this.adjustYaw = 0;
             /**
-             * Used to make an adjustment to the pitch of the bone.
+             * Used to make an adjustment to the pitch of the bone
              */
             this.adjustPitch = 0;
             /**
-             * Used to make an adjustment to the roll of the bone.
+             * Used to make an adjustment to the roll of the bone
              */
             this.adjustRoll = 0;
             /**
-             * The amount to slerp (spherical linear interpolation) to the target.  Set this to a value between 0 and 1 (a value of 1 disables slerp).
+             * The amount to slerp (spherical linear interpolation) to the target.  Set this to a value between 0 and 1 (a value of 1 disables slerp)
              */
             this.slerpAmount = 1;
             this._boneQuat = BABYLON.Quaternion.Identity();
@@ -77935,7 +77997,7 @@ var BABYLON;
         }
         Object.defineProperty(BoneLookController.prototype, "minYaw", {
             /**
-             * Get/set the minimum yaw angle that the bone can look to.
+             * Gets or sets the minimum yaw angle that the bone can look to
              */
             get: function () {
                 return this._minYaw;
@@ -77954,7 +78016,7 @@ var BABYLON;
         });
         Object.defineProperty(BoneLookController.prototype, "maxYaw", {
             /**
-             * Get/set the maximum yaw angle that the bone can look to.
+             * Gets or sets the maximum yaw angle that the bone can look to
              */
             get: function () {
                 return this._maxYaw;
@@ -77973,7 +78035,7 @@ var BABYLON;
         });
         Object.defineProperty(BoneLookController.prototype, "minPitch", {
             /**
-             * Get/set the minimum pitch angle that the bone can look to.
+             * Gets or sets the minimum pitch angle that the bone can look to
              */
             get: function () {
                 return this._minPitch;
@@ -77987,7 +78049,7 @@ var BABYLON;
         });
         Object.defineProperty(BoneLookController.prototype, "maxPitch", {
             /**
-             * Get/set the maximum pitch angle that the bone can look to.
+             * Gets or sets the maximum pitch angle that the bone can look to
              */
             get: function () {
                 return this._maxPitch;
@@ -78000,7 +78062,7 @@ var BABYLON;
             configurable: true
         });
         /**
-         * Update the bone to look at the target.  This should be called before the scene is rendered (use scene.registerBeforeRender()).
+         * Update the bone to look at the target.  This should be called before the scene is rendered (use scene.registerBeforeRender())
          */
         BoneLookController.prototype.update = function () {
             //skip the first frame when slerping so that the mesh rotation is correct

+ 187 - 125
dist/preview release/babylon.no-module.max.js

@@ -17743,16 +17743,29 @@ var BABYLON;
 var BABYLON;
 (function (BABYLON) {
     var BoundingSphere = /** @class */ (function () {
-        function BoundingSphere(minimum, maximum) {
-            this.minimum = minimum;
-            this.maximum = maximum;
+        /**
+         * Creates a new bounding sphere
+         * @param min defines the minimum vector (in local space)
+         * @param max defines the maximum vector (in local space)
+         */
+        function BoundingSphere(min, max) {
             this._tempRadiusVector = BABYLON.Vector3.Zero();
-            var distance = BABYLON.Vector3.Distance(minimum, maximum);
-            this.center = BABYLON.Vector3.Lerp(minimum, maximum, 0.5);
+            this.reConstruct(min, max);
+        }
+        /**
+         * Recreates the entire bounding sphere from scratch
+         * @param min defines the new minimum vector (in local space)
+         * @param max defines the new maximum vector (in local space)
+         */
+        BoundingSphere.prototype.reConstruct = function (min, max) {
+            this.minimum = min.clone();
+            this.maximum = max.clone();
+            var distance = BABYLON.Vector3.Distance(min, max);
+            this.center = BABYLON.Vector3.Lerp(min, max, 0.5);
             this.radius = distance * 0.5;
             this.centerWorld = BABYLON.Vector3.Zero();
             this._update(BABYLON.Matrix.Identity());
-        }
+        };
         // Methods
         BoundingSphere.prototype._update = function (world) {
             BABYLON.Vector3.TransformCoordinatesToRef(this.center, world, this.centerWorld);
@@ -17795,12 +17808,26 @@ var BABYLON;
 var BABYLON;
 (function (BABYLON) {
     var BoundingBox = /** @class */ (function () {
-        function BoundingBox(minimum, maximum) {
-            this.minimum = minimum;
-            this.maximum = maximum;
-            this.vectors = new Array();
+        /**
+         * Creates a new bounding box
+         * @param min defines the minimum vector (in local space)
+         * @param max defines the maximum vector (in local space)
+         */
+        function BoundingBox(min, max) {
             this.vectorsWorld = new Array();
+            this.reConstruct(min, max);
+        }
+        // Methods
+        /**
+         * Recreates the entire bounding box from scratch
+         * @param min defines the new minimum vector (in local space)
+         * @param max defines the new maximum vector (in local space)
+         */
+        BoundingBox.prototype.reConstruct = function (min, max) {
+            this.minimum = min.clone();
+            this.maximum = max.clone();
             // Bounding vectors
+            this.vectors = new Array();
             this.vectors.push(this.minimum.clone());
             this.vectors.push(this.maximum.clone());
             this.vectors.push(this.minimum.clone());
@@ -17827,9 +17854,8 @@ var BABYLON;
             this.maximumWorld = BABYLON.Vector3.Zero();
             this.centerWorld = BABYLON.Vector3.Zero();
             this.extendSizeWorld = BABYLON.Vector3.Zero();
-            this._update(BABYLON.Matrix.Identity());
-        }
-        // Methods
+            this._update(this._worldMatrix || BABYLON.Matrix.Identity());
+        };
         BoundingBox.prototype.getWorldMatrix = function () {
             return this._worldMatrix;
         };
@@ -19376,10 +19402,7 @@ var BABYLON;
                 if (!this.subMeshes) {
                     return;
                 }
-                for (var _i = 0, _a = this.subMeshes; _i < _a.length; _i++) {
-                    var subMesh = _a[_i];
-                    subMesh.setEffect(null);
-                }
+                this._unBindEffect();
             },
             enumerable: true,
             configurable: true
@@ -19596,6 +19619,13 @@ var BABYLON;
             }
             this._markSubMeshesAsLightDirty();
         };
+        /** @ignore */
+        AbstractMesh.prototype._unBindEffect = function () {
+            for (var _i = 0, _a = this.subMeshes; _i < _a.length; _i++) {
+                var subMesh = _a[_i];
+                subMesh.setEffect(null);
+            }
+        };
         AbstractMesh.prototype._removeLightSource = function (light) {
             var index = this._lightSources.indexOf(light);
             if (index === -1) {
@@ -30744,6 +30774,13 @@ var BABYLON;
             }
             return ret;
         };
+        Mesh.prototype._unBindEffect = function () {
+            _super.prototype._unBindEffect.call(this);
+            for (var _i = 0, _a = this.instances; _i < _a.length; _i++) {
+                var instance = _a[_i];
+                instance._unBindEffect();
+            }
+        };
         Object.defineProperty(Mesh.prototype, "hasLODLevels", {
             /**
              * True if the mesh has some Levels Of Details (LOD).
@@ -43099,11 +43136,17 @@ var BABYLON;
         };
         StandardMaterial.prototype.unbind = function () {
             if (this._activeEffect) {
+                var needFlag = false;
                 if (this._reflectionTexture && this._reflectionTexture.isRenderTarget) {
                     this._activeEffect.setTexture("reflection2DSampler", null);
+                    needFlag = true;
                 }
                 if (this._refractionTexture && this._refractionTexture.isRenderTarget) {
                     this._activeEffect.setTexture("refraction2DSampler", null);
+                    needFlag = true;
+                }
+                if (needFlag) {
+                    this._markAllSubMeshesAsTexturesDirty();
                 }
             }
             _super.prototype.unbind.call(this);
@@ -50682,21 +50725,15 @@ var BABYLON;
             if (this._isStarted || this._targetedAnimations.length === 0) {
                 return this;
             }
-            var _loop_1 = function () {
-                var targetedAnimation = this_1._targetedAnimations[index];
-                if (!targetedAnimation.target.animations) {
-                    targetedAnimation.target.animations = [];
-                }
-                if (targetedAnimation.target.animations.indexOf(targetedAnimation.animation) === -1) {
-                    targetedAnimation.target.animations.push(targetedAnimation.animation);
-                }
+            var _loop_1 = function (targetedAnimation) {
                 this_1._animatables.push(this_1._scene.beginDirectAnimation(targetedAnimation.target, [targetedAnimation.animation], from !== undefined ? from : this_1._from, to !== undefined ? to : this_1._to, loop, speedRatio, function () {
                     _this.onAnimationEndObservable.notifyObservers(targetedAnimation);
                 }));
             };
             var this_1 = this;
-            for (var index = 0; index < this._targetedAnimations.length; index++) {
-                _loop_1();
+            for (var _i = 0, _a = this._targetedAnimations; _i < _a.length; _i++) {
+                var targetedAnimation = _a[_i];
+                _loop_1(targetedAnimation);
             }
             this._speedRatio = speedRatio;
             this._isStarted = true;
@@ -51150,7 +51187,7 @@ var BABYLON;
                         }
                     }
                 }
-                else if (this._originalBlendValue.constructor) { // Complex value
+                else {
                     var constructor = this._originalBlendValue.constructor;
                     if (constructor.Lerp) { // Lerp supported
                         this._currentValue = constructor.Lerp(this._originalBlendValue, currentValue, this._blendingFactor);
@@ -51158,13 +51195,13 @@ var BABYLON;
                     else if (constructor.Slerp) { // Slerp supported
                         this._currentValue = constructor.Slerp(this._originalBlendValue, currentValue, this._blendingFactor);
                     }
+                    else if (this._originalBlendValue.toFixed) { // Number
+                        this._currentValue = this._originalBlendValue * (1.0 - this._blendingFactor) + this._blendingFactor * currentValue;
+                    }
                     else { // Blending not supported
                         this._currentValue = currentValue;
                     }
                 }
-                else { // Direct value
-                    this._currentValue = this._originalBlendValue * (1.0 - this._blendingFactor) + this._blendingFactor * currentValue;
-                }
                 this._blendingFactor += blendingSpeed;
             }
             else {
@@ -51956,10 +51993,16 @@ var BABYLON;
          * @param actionManager manager for the action the condition applies to
          * @param target for the action
          * @param propertyPath path to specify the property of the target the conditional operator uses
-         * @param value the vale compared by the conditional operator against the current value of the property
-         * @param operator the conditional operator, default {BABYLON.ValueCondition.IsEqual}
-         */
-        function ValueCondition(actionManager, target, propertyPath, value, operator) {
+         * @param value the value compared by the conditional operator against the current value of the property
+         * @param operator the conditional operator, default ValueCondition.IsEqual
+         */
+        function ValueCondition(actionManager, target, 
+        /** path to specify the property of the target the conditional operator uses  */
+        propertyPath, 
+        /** the value compared by the conditional operator against the current value of the property */
+        value, 
+        /** the conditional operator, default ValueCondition.IsEqual */
+        operator) {
             if (operator === void 0) { operator = ValueCondition.IsEqual; }
             var _this = _super.call(this, actionManager) || this;
             _this.propertyPath = propertyPath;
@@ -52091,11 +52134,13 @@ var BABYLON;
     var PredicateCondition = /** @class */ (function (_super) {
         __extends(PredicateCondition, _super);
         /**
-         * Creates a new {BABYLON.PredicateCondition}
+         * Creates a new PredicateCondition
          * @param actionManager manager for the action the condition applies to
-         * @param predicate
+         * @param predicate defines the predicate function used to validate the condition
          */
-        function PredicateCondition(actionManager, predicate) {
+        function PredicateCondition(actionManager, 
+        /** defines the predicate function used to validate the condition */
+        predicate) {
             var _this = _super.call(this, actionManager) || this;
             _this.predicate = predicate;
             return _this;
@@ -52110,12 +52155,12 @@ var BABYLON;
     }(Condition));
     BABYLON.PredicateCondition = PredicateCondition;
     /**
-     * Defines a state condition as an extension of {BABYLON.Condition}
+     * Defines a state condition as an extension of Condition
      */
     var StateCondition = /** @class */ (function (_super) {
         __extends(StateCondition, _super);
         /**
-         * Creates a new {BABYLON.StateCondition}
+         * Creates a new StateCondition
          * @param actionManager manager for the action the condition applies to
          * @param target of the condition
          * @param value to compare with target state
@@ -52133,7 +52178,7 @@ var BABYLON;
             return this._target.state === this.value;
         };
         /**
-         * Serialize the {BABYLON.StateCondition} into a JSON compatible object
+         * Serialize the StateCondition into a JSON compatible object
          * @returns serialization object
          */
         StateCondition.prototype.serialize = function () {
@@ -52410,7 +52455,7 @@ var BABYLON;
             // Members
             this.actions = new Array();
             this.hoverCursor = '';
-            this._scene = scene;
+            this._scene = scene || BABYLON.Engine.LastCreatedScene;
             scene._actionManagers.push(this);
         }
         Object.defineProperty(ActionManager, "NothingTrigger", {
@@ -60983,9 +61028,19 @@ var BABYLON;
              * Returns true if the decoder is available.
              */
             get: function () {
-                return (typeof DracoDecoderModule !== "undefined" ||
-                    (typeof WebAssembly === "object" && !!DracoCompression.Configuration.decoderWasm) ||
-                    !!DracoCompression.Configuration.decoder);
+                if (typeof DracoDecoderModule !== "undefined") {
+                    return true;
+                }
+                var decoder = DracoCompression.Configuration.decoder;
+                if (decoder) {
+                    if (decoder.wasmUrl && decoder.wasmBinaryUrl && typeof WebAssembly === "object") {
+                        return true;
+                    }
+                    if (decoder.fallbackUrl) {
+                        return true;
+                    }
+                }
+                return false;
             },
             enumerable: true,
             configurable: true
@@ -61075,24 +61130,29 @@ var BABYLON;
         };
         DracoCompression._GetDecoderModule = function () {
             if (!DracoCompression._DecoderModulePromise) {
-                var promise = void 0;
+                var promise = null;
                 var config_1 = {};
                 if (typeof DracoDecoderModule !== "undefined") {
                     promise = Promise.resolve();
                 }
-                else if (typeof WebAssembly === "object" && DracoCompression.Configuration.decoderWasm) {
-                    promise = Promise.all([
-                        DracoCompression._LoadScriptAsync(DracoCompression.Configuration.decoderWasm.wrapperUrl),
-                        DracoCompression._LoadFileAsync(DracoCompression.Configuration.decoderWasm.binaryUrl).then(function (data) {
-                            config_1.wasmBinary = data;
-                        })
-                    ]);
-                }
-                else if (DracoCompression.Configuration.decoder) {
-                    promise = DracoCompression._LoadScriptAsync(DracoCompression.Configuration.decoder.url);
-                }
                 else {
-                    throw new Error("Invalid decoder configuration");
+                    var decoder = DracoCompression.Configuration.decoder;
+                    if (decoder) {
+                        if (decoder.wasmUrl && decoder.wasmBinaryUrl && typeof WebAssembly === "object") {
+                            promise = Promise.all([
+                                DracoCompression._LoadScriptAsync(decoder.wasmUrl),
+                                DracoCompression._LoadFileAsync(decoder.wasmBinaryUrl).then(function (data) {
+                                    config_1.wasmBinary = data;
+                                })
+                            ]);
+                        }
+                        else if (decoder.fallbackUrl) {
+                            promise = DracoCompression._LoadScriptAsync(decoder.fallbackUrl);
+                        }
+                    }
+                }
+                if (!promise) {
+                    throw new Error("Draco decoder module is not available");
                 }
                 DracoCompression._DecoderModulePromise = promise.then(function () {
                     return new Promise(function (resolve) {
@@ -61124,51 +61184,16 @@ var BABYLON;
                 });
             });
         };
-        DracoCompression._GetDefaultConfig = function () {
-            var configuration = {
-                decoder: null,
-                decoderWasm: null
-            };
-            if (BABYLON.Tools.IsWindowObjectExist()) {
-                var decoderUrl = null;
-                var decoderWasmBinaryUrl = null;
-                var decoderWasmWrapperUrl = null;
-                for (var i = 0; i < document.scripts.length; i++) {
-                    var type = document.scripts[i].type;
-                    var src = document.scripts[i].src;
-                    switch (type) {
-                        case "text/x-draco-decoder": {
-                            decoderUrl = src;
-                            break;
-                        }
-                        case "text/x-draco-decoder-wasm-binary": {
-                            decoderWasmBinaryUrl = src;
-                            break;
-                        }
-                        case "text/x-draco-decoder-wasm-wrapper": {
-                            decoderWasmWrapperUrl = src;
-                            break;
-                        }
-                    }
-                }
-                if (decoderUrl) {
-                    configuration.decoder = {
-                        url: decoderUrl
-                    };
-                }
-                if (decoderWasmWrapperUrl && decoderWasmBinaryUrl) {
-                    configuration.decoderWasm = {
-                        binaryUrl: decoderWasmBinaryUrl,
-                        wrapperUrl: decoderWasmWrapperUrl
-                    };
-                }
-            }
-            return configuration;
-        };
         /**
-         * Gets the configuration.
+         * The configuration.
          */
-        DracoCompression.Configuration = DracoCompression._GetDefaultConfig();
+        DracoCompression.Configuration = {
+            decoder: {
+                wasmUrl: "https://preview.babylonjs.com/draco_wasm_wrapper_gltf.js",
+                wasmBinaryUrl: "https://preview.babylonjs.com/draco_decoder_gltf.wasm",
+                fallbackUrl: "https://preview.babylonjs.com/draco_decoder_gltf.js"
+            }
+        };
         return DracoCompression;
     }());
     BABYLON.DracoCompression = DracoCompression;
@@ -77046,6 +77071,9 @@ var BABYLON;
                 var child = _a[_i];
                 var cm = child.getLocalMatrix();
                 cm.multiplyToRef(scaleMat, cm);
+                cm.m[12] *= x;
+                cm.m[13] *= y;
+                cm.m[14] *= z;
                 child._markAsDirtyAndDecompose();
             }
             this._markAsDirtyAndDecompose();
@@ -77569,13 +77597,37 @@ var BABYLON;
 
 var BABYLON;
 (function (BABYLON) {
-    /** Class used to apply inverse kinematics to bones */
+    /**
+     * Class used to apply inverse kinematics to bones
+     * @see http://doc.babylonjs.com/how_to/how_to_use_bones_and_skeletons#boneikcontroller
+     */
     var BoneIKController = /** @class */ (function () {
+        /**
+         * Creates a new BoneIKController
+         * @param mesh defines the mesh to control
+         * @param bone defines the bone to control
+         * @param options defines options to set up the controller
+         */
         function BoneIKController(mesh, bone, options) {
+            /**
+             * Gets or sets the target position
+             */
             this.targetPosition = BABYLON.Vector3.Zero();
+            /**
+             * Gets or sets the pole target position
+             */
             this.poleTargetPosition = BABYLON.Vector3.Zero();
+            /**
+             * Gets or sets the pole target local offset
+             */
             this.poleTargetLocalOffset = BABYLON.Vector3.Zero();
+            /**
+             * Gets or sets the pole angle
+             */
             this.poleAngle = 0;
+            /**
+             * The amount to slerp (spherical linear interpolation) to the target.  Set this to a value between 0 and 1 (a value of 1 disables slerp)
+             */
             this.slerpAmount = 1;
             this._bone1Quat = BABYLON.Quaternion.Identity();
             this._bone1Mat = BABYLON.Matrix.Identity();
@@ -77651,6 +77703,9 @@ var BABYLON;
             }
         }
         Object.defineProperty(BoneIKController.prototype, "maxAngle", {
+            /**
+             * Gets or sets maximum allowed angle
+             */
             get: function () {
                 return this._maxAngle;
             },
@@ -77672,6 +77727,9 @@ var BABYLON;
             var b = this._bone2Length;
             this._maxReach = Math.sqrt(a * a + b * b - 2 * a * b * Math.cos(ang));
         };
+        /**
+         * Force the controller to update the bones
+         */
         BoneIKController.prototype.update = function () {
             var bone1 = this._bone1;
             if (!bone1) {
@@ -77783,6 +77841,10 @@ var BABYLON;
 
 var BABYLON;
 (function (BABYLON) {
+    /**
+     * Class used to make a bone look toward a point in space
+     * @see http://doc.babylonjs.com/how_to/how_to_use_bones_and_skeletons#bonelookcontroller
+     */
     var BoneLookController = /** @class */ (function () {
         /**
          * Create a BoneLookController
@@ -77790,42 +77852,42 @@ var BABYLON;
          * @param bone the bone that will be looking to the target
          * @param target the target Vector3 to look at
          * @param settings optional settings:
-         * - maxYaw: the maximum angle the bone will yaw to
-         * - minYaw: the minimum angle the bone will yaw to
-         * - maxPitch: the maximum angle the bone will pitch to
-         * - minPitch: the minimum angle the bone will yaw to
-         * - slerpAmount: set the between 0 and 1 to make the bone slerp to the target.
-         * - upAxis: the up axis of the coordinate system
-         * - upAxisSpace: the space that the up axis is in - BABYLON.Space.BONE, BABYLON.Space.LOCAL (default), or BABYLON.Space.WORLD.
-         * - yawAxis: set yawAxis if the bone does not yaw on the y axis
-         * - pitchAxis: set pitchAxis if the bone does not pitch on the x axis
-         * - adjustYaw: used to make an adjustment to the yaw of the bone
-         * - adjustPitch: used to make an adjustment to the pitch of the bone
-         * - adjustRoll: used to make an adjustment to the roll of the bone
+         * * maxYaw: the maximum angle the bone will yaw to
+         * * minYaw: the minimum angle the bone will yaw to
+         * * maxPitch: the maximum angle the bone will pitch to
+         * * minPitch: the minimum angle the bone will yaw to
+         * * slerpAmount: set the between 0 and 1 to make the bone slerp to the target.
+         * * upAxis: the up axis of the coordinate system
+         * * upAxisSpace: the space that the up axis is in - BABYLON.Space.BONE, BABYLON.Space.LOCAL (default), or BABYLON.Space.WORLD.
+         * * yawAxis: set yawAxis if the bone does not yaw on the y axis
+         * * pitchAxis: set pitchAxis if the bone does not pitch on the x axis
+         * * adjustYaw: used to make an adjustment to the yaw of the bone
+         * * adjustPitch: used to make an adjustment to the pitch of the bone
+         * * adjustRoll: used to make an adjustment to the roll of the bone
          **/
         function BoneLookController(mesh, bone, target, options) {
             /**
-             * The up axis of the coordinate system that is used when the bone is rotated.
+             * The up axis of the coordinate system that is used when the bone is rotated
              */
             this.upAxis = BABYLON.Vector3.Up();
             /**
-             * The space that the up axis is in - BABYLON.Space.BONE, BABYLON.Space.LOCAL (default), or BABYLON.Space.WORLD.
+             * The space that the up axis is in - BABYLON.Space.BONE, BABYLON.Space.LOCAL (default), or BABYLON.Space.WORLD
              */
             this.upAxisSpace = BABYLON.Space.LOCAL;
             /**
-             * Used to make an adjustment to the yaw of the bone.
+             * Used to make an adjustment to the yaw of the bone
              */
             this.adjustYaw = 0;
             /**
-             * Used to make an adjustment to the pitch of the bone.
+             * Used to make an adjustment to the pitch of the bone
              */
             this.adjustPitch = 0;
             /**
-             * Used to make an adjustment to the roll of the bone.
+             * Used to make an adjustment to the roll of the bone
              */
             this.adjustRoll = 0;
             /**
-             * The amount to slerp (spherical linear interpolation) to the target.  Set this to a value between 0 and 1 (a value of 1 disables slerp).
+             * The amount to slerp (spherical linear interpolation) to the target.  Set this to a value between 0 and 1 (a value of 1 disables slerp)
              */
             this.slerpAmount = 1;
             this._boneQuat = BABYLON.Quaternion.Identity();
@@ -77902,7 +77964,7 @@ var BABYLON;
         }
         Object.defineProperty(BoneLookController.prototype, "minYaw", {
             /**
-             * Get/set the minimum yaw angle that the bone can look to.
+             * Gets or sets the minimum yaw angle that the bone can look to
              */
             get: function () {
                 return this._minYaw;
@@ -77921,7 +77983,7 @@ var BABYLON;
         });
         Object.defineProperty(BoneLookController.prototype, "maxYaw", {
             /**
-             * Get/set the maximum yaw angle that the bone can look to.
+             * Gets or sets the maximum yaw angle that the bone can look to
              */
             get: function () {
                 return this._maxYaw;
@@ -77940,7 +78002,7 @@ var BABYLON;
         });
         Object.defineProperty(BoneLookController.prototype, "minPitch", {
             /**
-             * Get/set the minimum pitch angle that the bone can look to.
+             * Gets or sets the minimum pitch angle that the bone can look to
              */
             get: function () {
                 return this._minPitch;
@@ -77954,7 +78016,7 @@ var BABYLON;
         });
         Object.defineProperty(BoneLookController.prototype, "maxPitch", {
             /**
-             * Get/set the maximum pitch angle that the bone can look to.
+             * Gets or sets the maximum pitch angle that the bone can look to
              */
             get: function () {
                 return this._maxPitch;
@@ -77967,7 +78029,7 @@ var BABYLON;
             configurable: true
         });
         /**
-         * Update the bone to look at the target.  This should be called before the scene is rendered (use scene.registerBeforeRender()).
+         * Update the bone to look at the target.  This should be called before the scene is rendered (use scene.registerBeforeRender())
          */
         BoneLookController.prototype.update = function () {
             //skip the first frame when slerping so that the mesh rotation is correct

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 27 - 27
dist/preview release/babylon.worker.js


+ 187 - 125
dist/preview release/es6.js

@@ -17743,16 +17743,29 @@ var BABYLON;
 var BABYLON;
 (function (BABYLON) {
     var BoundingSphere = /** @class */ (function () {
-        function BoundingSphere(minimum, maximum) {
-            this.minimum = minimum;
-            this.maximum = maximum;
+        /**
+         * Creates a new bounding sphere
+         * @param min defines the minimum vector (in local space)
+         * @param max defines the maximum vector (in local space)
+         */
+        function BoundingSphere(min, max) {
             this._tempRadiusVector = BABYLON.Vector3.Zero();
-            var distance = BABYLON.Vector3.Distance(minimum, maximum);
-            this.center = BABYLON.Vector3.Lerp(minimum, maximum, 0.5);
+            this.reConstruct(min, max);
+        }
+        /**
+         * Recreates the entire bounding sphere from scratch
+         * @param min defines the new minimum vector (in local space)
+         * @param max defines the new maximum vector (in local space)
+         */
+        BoundingSphere.prototype.reConstruct = function (min, max) {
+            this.minimum = min.clone();
+            this.maximum = max.clone();
+            var distance = BABYLON.Vector3.Distance(min, max);
+            this.center = BABYLON.Vector3.Lerp(min, max, 0.5);
             this.radius = distance * 0.5;
             this.centerWorld = BABYLON.Vector3.Zero();
             this._update(BABYLON.Matrix.Identity());
-        }
+        };
         // Methods
         BoundingSphere.prototype._update = function (world) {
             BABYLON.Vector3.TransformCoordinatesToRef(this.center, world, this.centerWorld);
@@ -17795,12 +17808,26 @@ var BABYLON;
 var BABYLON;
 (function (BABYLON) {
     var BoundingBox = /** @class */ (function () {
-        function BoundingBox(minimum, maximum) {
-            this.minimum = minimum;
-            this.maximum = maximum;
-            this.vectors = new Array();
+        /**
+         * Creates a new bounding box
+         * @param min defines the minimum vector (in local space)
+         * @param max defines the maximum vector (in local space)
+         */
+        function BoundingBox(min, max) {
             this.vectorsWorld = new Array();
+            this.reConstruct(min, max);
+        }
+        // Methods
+        /**
+         * Recreates the entire bounding box from scratch
+         * @param min defines the new minimum vector (in local space)
+         * @param max defines the new maximum vector (in local space)
+         */
+        BoundingBox.prototype.reConstruct = function (min, max) {
+            this.minimum = min.clone();
+            this.maximum = max.clone();
             // Bounding vectors
+            this.vectors = new Array();
             this.vectors.push(this.minimum.clone());
             this.vectors.push(this.maximum.clone());
             this.vectors.push(this.minimum.clone());
@@ -17827,9 +17854,8 @@ var BABYLON;
             this.maximumWorld = BABYLON.Vector3.Zero();
             this.centerWorld = BABYLON.Vector3.Zero();
             this.extendSizeWorld = BABYLON.Vector3.Zero();
-            this._update(BABYLON.Matrix.Identity());
-        }
-        // Methods
+            this._update(this._worldMatrix || BABYLON.Matrix.Identity());
+        };
         BoundingBox.prototype.getWorldMatrix = function () {
             return this._worldMatrix;
         };
@@ -19376,10 +19402,7 @@ var BABYLON;
                 if (!this.subMeshes) {
                     return;
                 }
-                for (var _i = 0, _a = this.subMeshes; _i < _a.length; _i++) {
-                    var subMesh = _a[_i];
-                    subMesh.setEffect(null);
-                }
+                this._unBindEffect();
             },
             enumerable: true,
             configurable: true
@@ -19596,6 +19619,13 @@ var BABYLON;
             }
             this._markSubMeshesAsLightDirty();
         };
+        /** @ignore */
+        AbstractMesh.prototype._unBindEffect = function () {
+            for (var _i = 0, _a = this.subMeshes; _i < _a.length; _i++) {
+                var subMesh = _a[_i];
+                subMesh.setEffect(null);
+            }
+        };
         AbstractMesh.prototype._removeLightSource = function (light) {
             var index = this._lightSources.indexOf(light);
             if (index === -1) {
@@ -30744,6 +30774,13 @@ var BABYLON;
             }
             return ret;
         };
+        Mesh.prototype._unBindEffect = function () {
+            _super.prototype._unBindEffect.call(this);
+            for (var _i = 0, _a = this.instances; _i < _a.length; _i++) {
+                var instance = _a[_i];
+                instance._unBindEffect();
+            }
+        };
         Object.defineProperty(Mesh.prototype, "hasLODLevels", {
             /**
              * True if the mesh has some Levels Of Details (LOD).
@@ -43099,11 +43136,17 @@ var BABYLON;
         };
         StandardMaterial.prototype.unbind = function () {
             if (this._activeEffect) {
+                var needFlag = false;
                 if (this._reflectionTexture && this._reflectionTexture.isRenderTarget) {
                     this._activeEffect.setTexture("reflection2DSampler", null);
+                    needFlag = true;
                 }
                 if (this._refractionTexture && this._refractionTexture.isRenderTarget) {
                     this._activeEffect.setTexture("refraction2DSampler", null);
+                    needFlag = true;
+                }
+                if (needFlag) {
+                    this._markAllSubMeshesAsTexturesDirty();
                 }
             }
             _super.prototype.unbind.call(this);
@@ -50682,21 +50725,15 @@ var BABYLON;
             if (this._isStarted || this._targetedAnimations.length === 0) {
                 return this;
             }
-            var _loop_1 = function () {
-                var targetedAnimation = this_1._targetedAnimations[index];
-                if (!targetedAnimation.target.animations) {
-                    targetedAnimation.target.animations = [];
-                }
-                if (targetedAnimation.target.animations.indexOf(targetedAnimation.animation) === -1) {
-                    targetedAnimation.target.animations.push(targetedAnimation.animation);
-                }
+            var _loop_1 = function (targetedAnimation) {
                 this_1._animatables.push(this_1._scene.beginDirectAnimation(targetedAnimation.target, [targetedAnimation.animation], from !== undefined ? from : this_1._from, to !== undefined ? to : this_1._to, loop, speedRatio, function () {
                     _this.onAnimationEndObservable.notifyObservers(targetedAnimation);
                 }));
             };
             var this_1 = this;
-            for (var index = 0; index < this._targetedAnimations.length; index++) {
-                _loop_1();
+            for (var _i = 0, _a = this._targetedAnimations; _i < _a.length; _i++) {
+                var targetedAnimation = _a[_i];
+                _loop_1(targetedAnimation);
             }
             this._speedRatio = speedRatio;
             this._isStarted = true;
@@ -51150,7 +51187,7 @@ var BABYLON;
                         }
                     }
                 }
-                else if (this._originalBlendValue.constructor) { // Complex value
+                else {
                     var constructor = this._originalBlendValue.constructor;
                     if (constructor.Lerp) { // Lerp supported
                         this._currentValue = constructor.Lerp(this._originalBlendValue, currentValue, this._blendingFactor);
@@ -51158,13 +51195,13 @@ var BABYLON;
                     else if (constructor.Slerp) { // Slerp supported
                         this._currentValue = constructor.Slerp(this._originalBlendValue, currentValue, this._blendingFactor);
                     }
+                    else if (this._originalBlendValue.toFixed) { // Number
+                        this._currentValue = this._originalBlendValue * (1.0 - this._blendingFactor) + this._blendingFactor * currentValue;
+                    }
                     else { // Blending not supported
                         this._currentValue = currentValue;
                     }
                 }
-                else { // Direct value
-                    this._currentValue = this._originalBlendValue * (1.0 - this._blendingFactor) + this._blendingFactor * currentValue;
-                }
                 this._blendingFactor += blendingSpeed;
             }
             else {
@@ -51956,10 +51993,16 @@ var BABYLON;
          * @param actionManager manager for the action the condition applies to
          * @param target for the action
          * @param propertyPath path to specify the property of the target the conditional operator uses
-         * @param value the vale compared by the conditional operator against the current value of the property
-         * @param operator the conditional operator, default {BABYLON.ValueCondition.IsEqual}
-         */
-        function ValueCondition(actionManager, target, propertyPath, value, operator) {
+         * @param value the value compared by the conditional operator against the current value of the property
+         * @param operator the conditional operator, default ValueCondition.IsEqual
+         */
+        function ValueCondition(actionManager, target, 
+        /** path to specify the property of the target the conditional operator uses  */
+        propertyPath, 
+        /** the value compared by the conditional operator against the current value of the property */
+        value, 
+        /** the conditional operator, default ValueCondition.IsEqual */
+        operator) {
             if (operator === void 0) { operator = ValueCondition.IsEqual; }
             var _this = _super.call(this, actionManager) || this;
             _this.propertyPath = propertyPath;
@@ -52091,11 +52134,13 @@ var BABYLON;
     var PredicateCondition = /** @class */ (function (_super) {
         __extends(PredicateCondition, _super);
         /**
-         * Creates a new {BABYLON.PredicateCondition}
+         * Creates a new PredicateCondition
          * @param actionManager manager for the action the condition applies to
-         * @param predicate
+         * @param predicate defines the predicate function used to validate the condition
          */
-        function PredicateCondition(actionManager, predicate) {
+        function PredicateCondition(actionManager, 
+        /** defines the predicate function used to validate the condition */
+        predicate) {
             var _this = _super.call(this, actionManager) || this;
             _this.predicate = predicate;
             return _this;
@@ -52110,12 +52155,12 @@ var BABYLON;
     }(Condition));
     BABYLON.PredicateCondition = PredicateCondition;
     /**
-     * Defines a state condition as an extension of {BABYLON.Condition}
+     * Defines a state condition as an extension of Condition
      */
     var StateCondition = /** @class */ (function (_super) {
         __extends(StateCondition, _super);
         /**
-         * Creates a new {BABYLON.StateCondition}
+         * Creates a new StateCondition
          * @param actionManager manager for the action the condition applies to
          * @param target of the condition
          * @param value to compare with target state
@@ -52133,7 +52178,7 @@ var BABYLON;
             return this._target.state === this.value;
         };
         /**
-         * Serialize the {BABYLON.StateCondition} into a JSON compatible object
+         * Serialize the StateCondition into a JSON compatible object
          * @returns serialization object
          */
         StateCondition.prototype.serialize = function () {
@@ -52410,7 +52455,7 @@ var BABYLON;
             // Members
             this.actions = new Array();
             this.hoverCursor = '';
-            this._scene = scene;
+            this._scene = scene || BABYLON.Engine.LastCreatedScene;
             scene._actionManagers.push(this);
         }
         Object.defineProperty(ActionManager, "NothingTrigger", {
@@ -60983,9 +61028,19 @@ var BABYLON;
              * Returns true if the decoder is available.
              */
             get: function () {
-                return (typeof DracoDecoderModule !== "undefined" ||
-                    (typeof WebAssembly === "object" && !!DracoCompression.Configuration.decoderWasm) ||
-                    !!DracoCompression.Configuration.decoder);
+                if (typeof DracoDecoderModule !== "undefined") {
+                    return true;
+                }
+                var decoder = DracoCompression.Configuration.decoder;
+                if (decoder) {
+                    if (decoder.wasmUrl && decoder.wasmBinaryUrl && typeof WebAssembly === "object") {
+                        return true;
+                    }
+                    if (decoder.fallbackUrl) {
+                        return true;
+                    }
+                }
+                return false;
             },
             enumerable: true,
             configurable: true
@@ -61075,24 +61130,29 @@ var BABYLON;
         };
         DracoCompression._GetDecoderModule = function () {
             if (!DracoCompression._DecoderModulePromise) {
-                var promise = void 0;
+                var promise = null;
                 var config_1 = {};
                 if (typeof DracoDecoderModule !== "undefined") {
                     promise = Promise.resolve();
                 }
-                else if (typeof WebAssembly === "object" && DracoCompression.Configuration.decoderWasm) {
-                    promise = Promise.all([
-                        DracoCompression._LoadScriptAsync(DracoCompression.Configuration.decoderWasm.wrapperUrl),
-                        DracoCompression._LoadFileAsync(DracoCompression.Configuration.decoderWasm.binaryUrl).then(function (data) {
-                            config_1.wasmBinary = data;
-                        })
-                    ]);
-                }
-                else if (DracoCompression.Configuration.decoder) {
-                    promise = DracoCompression._LoadScriptAsync(DracoCompression.Configuration.decoder.url);
-                }
                 else {
-                    throw new Error("Invalid decoder configuration");
+                    var decoder = DracoCompression.Configuration.decoder;
+                    if (decoder) {
+                        if (decoder.wasmUrl && decoder.wasmBinaryUrl && typeof WebAssembly === "object") {
+                            promise = Promise.all([
+                                DracoCompression._LoadScriptAsync(decoder.wasmUrl),
+                                DracoCompression._LoadFileAsync(decoder.wasmBinaryUrl).then(function (data) {
+                                    config_1.wasmBinary = data;
+                                })
+                            ]);
+                        }
+                        else if (decoder.fallbackUrl) {
+                            promise = DracoCompression._LoadScriptAsync(decoder.fallbackUrl);
+                        }
+                    }
+                }
+                if (!promise) {
+                    throw new Error("Draco decoder module is not available");
                 }
                 DracoCompression._DecoderModulePromise = promise.then(function () {
                     return new Promise(function (resolve) {
@@ -61124,51 +61184,16 @@ var BABYLON;
                 });
             });
         };
-        DracoCompression._GetDefaultConfig = function () {
-            var configuration = {
-                decoder: null,
-                decoderWasm: null
-            };
-            if (BABYLON.Tools.IsWindowObjectExist()) {
-                var decoderUrl = null;
-                var decoderWasmBinaryUrl = null;
-                var decoderWasmWrapperUrl = null;
-                for (var i = 0; i < document.scripts.length; i++) {
-                    var type = document.scripts[i].type;
-                    var src = document.scripts[i].src;
-                    switch (type) {
-                        case "text/x-draco-decoder": {
-                            decoderUrl = src;
-                            break;
-                        }
-                        case "text/x-draco-decoder-wasm-binary": {
-                            decoderWasmBinaryUrl = src;
-                            break;
-                        }
-                        case "text/x-draco-decoder-wasm-wrapper": {
-                            decoderWasmWrapperUrl = src;
-                            break;
-                        }
-                    }
-                }
-                if (decoderUrl) {
-                    configuration.decoder = {
-                        url: decoderUrl
-                    };
-                }
-                if (decoderWasmWrapperUrl && decoderWasmBinaryUrl) {
-                    configuration.decoderWasm = {
-                        binaryUrl: decoderWasmBinaryUrl,
-                        wrapperUrl: decoderWasmWrapperUrl
-                    };
-                }
-            }
-            return configuration;
-        };
         /**
-         * Gets the configuration.
+         * The configuration.
          */
-        DracoCompression.Configuration = DracoCompression._GetDefaultConfig();
+        DracoCompression.Configuration = {
+            decoder: {
+                wasmUrl: "https://preview.babylonjs.com/draco_wasm_wrapper_gltf.js",
+                wasmBinaryUrl: "https://preview.babylonjs.com/draco_decoder_gltf.wasm",
+                fallbackUrl: "https://preview.babylonjs.com/draco_decoder_gltf.js"
+            }
+        };
         return DracoCompression;
     }());
     BABYLON.DracoCompression = DracoCompression;
@@ -77046,6 +77071,9 @@ var BABYLON;
                 var child = _a[_i];
                 var cm = child.getLocalMatrix();
                 cm.multiplyToRef(scaleMat, cm);
+                cm.m[12] *= x;
+                cm.m[13] *= y;
+                cm.m[14] *= z;
                 child._markAsDirtyAndDecompose();
             }
             this._markAsDirtyAndDecompose();
@@ -77569,13 +77597,37 @@ var BABYLON;
 
 var BABYLON;
 (function (BABYLON) {
-    /** Class used to apply inverse kinematics to bones */
+    /**
+     * Class used to apply inverse kinematics to bones
+     * @see http://doc.babylonjs.com/how_to/how_to_use_bones_and_skeletons#boneikcontroller
+     */
     var BoneIKController = /** @class */ (function () {
+        /**
+         * Creates a new BoneIKController
+         * @param mesh defines the mesh to control
+         * @param bone defines the bone to control
+         * @param options defines options to set up the controller
+         */
         function BoneIKController(mesh, bone, options) {
+            /**
+             * Gets or sets the target position
+             */
             this.targetPosition = BABYLON.Vector3.Zero();
+            /**
+             * Gets or sets the pole target position
+             */
             this.poleTargetPosition = BABYLON.Vector3.Zero();
+            /**
+             * Gets or sets the pole target local offset
+             */
             this.poleTargetLocalOffset = BABYLON.Vector3.Zero();
+            /**
+             * Gets or sets the pole angle
+             */
             this.poleAngle = 0;
+            /**
+             * The amount to slerp (spherical linear interpolation) to the target.  Set this to a value between 0 and 1 (a value of 1 disables slerp)
+             */
             this.slerpAmount = 1;
             this._bone1Quat = BABYLON.Quaternion.Identity();
             this._bone1Mat = BABYLON.Matrix.Identity();
@@ -77651,6 +77703,9 @@ var BABYLON;
             }
         }
         Object.defineProperty(BoneIKController.prototype, "maxAngle", {
+            /**
+             * Gets or sets maximum allowed angle
+             */
             get: function () {
                 return this._maxAngle;
             },
@@ -77672,6 +77727,9 @@ var BABYLON;
             var b = this._bone2Length;
             this._maxReach = Math.sqrt(a * a + b * b - 2 * a * b * Math.cos(ang));
         };
+        /**
+         * Force the controller to update the bones
+         */
         BoneIKController.prototype.update = function () {
             var bone1 = this._bone1;
             if (!bone1) {
@@ -77783,6 +77841,10 @@ var BABYLON;
 
 var BABYLON;
 (function (BABYLON) {
+    /**
+     * Class used to make a bone look toward a point in space
+     * @see http://doc.babylonjs.com/how_to/how_to_use_bones_and_skeletons#bonelookcontroller
+     */
     var BoneLookController = /** @class */ (function () {
         /**
          * Create a BoneLookController
@@ -77790,42 +77852,42 @@ var BABYLON;
          * @param bone the bone that will be looking to the target
          * @param target the target Vector3 to look at
          * @param settings optional settings:
-         * - maxYaw: the maximum angle the bone will yaw to
-         * - minYaw: the minimum angle the bone will yaw to
-         * - maxPitch: the maximum angle the bone will pitch to
-         * - minPitch: the minimum angle the bone will yaw to
-         * - slerpAmount: set the between 0 and 1 to make the bone slerp to the target.
-         * - upAxis: the up axis of the coordinate system
-         * - upAxisSpace: the space that the up axis is in - BABYLON.Space.BONE, BABYLON.Space.LOCAL (default), or BABYLON.Space.WORLD.
-         * - yawAxis: set yawAxis if the bone does not yaw on the y axis
-         * - pitchAxis: set pitchAxis if the bone does not pitch on the x axis
-         * - adjustYaw: used to make an adjustment to the yaw of the bone
-         * - adjustPitch: used to make an adjustment to the pitch of the bone
-         * - adjustRoll: used to make an adjustment to the roll of the bone
+         * * maxYaw: the maximum angle the bone will yaw to
+         * * minYaw: the minimum angle the bone will yaw to
+         * * maxPitch: the maximum angle the bone will pitch to
+         * * minPitch: the minimum angle the bone will yaw to
+         * * slerpAmount: set the between 0 and 1 to make the bone slerp to the target.
+         * * upAxis: the up axis of the coordinate system
+         * * upAxisSpace: the space that the up axis is in - BABYLON.Space.BONE, BABYLON.Space.LOCAL (default), or BABYLON.Space.WORLD.
+         * * yawAxis: set yawAxis if the bone does not yaw on the y axis
+         * * pitchAxis: set pitchAxis if the bone does not pitch on the x axis
+         * * adjustYaw: used to make an adjustment to the yaw of the bone
+         * * adjustPitch: used to make an adjustment to the pitch of the bone
+         * * adjustRoll: used to make an adjustment to the roll of the bone
          **/
         function BoneLookController(mesh, bone, target, options) {
             /**
-             * The up axis of the coordinate system that is used when the bone is rotated.
+             * The up axis of the coordinate system that is used when the bone is rotated
              */
             this.upAxis = BABYLON.Vector3.Up();
             /**
-             * The space that the up axis is in - BABYLON.Space.BONE, BABYLON.Space.LOCAL (default), or BABYLON.Space.WORLD.
+             * The space that the up axis is in - BABYLON.Space.BONE, BABYLON.Space.LOCAL (default), or BABYLON.Space.WORLD
              */
             this.upAxisSpace = BABYLON.Space.LOCAL;
             /**
-             * Used to make an adjustment to the yaw of the bone.
+             * Used to make an adjustment to the yaw of the bone
              */
             this.adjustYaw = 0;
             /**
-             * Used to make an adjustment to the pitch of the bone.
+             * Used to make an adjustment to the pitch of the bone
              */
             this.adjustPitch = 0;
             /**
-             * Used to make an adjustment to the roll of the bone.
+             * Used to make an adjustment to the roll of the bone
              */
             this.adjustRoll = 0;
             /**
-             * The amount to slerp (spherical linear interpolation) to the target.  Set this to a value between 0 and 1 (a value of 1 disables slerp).
+             * The amount to slerp (spherical linear interpolation) to the target.  Set this to a value between 0 and 1 (a value of 1 disables slerp)
              */
             this.slerpAmount = 1;
             this._boneQuat = BABYLON.Quaternion.Identity();
@@ -77902,7 +77964,7 @@ var BABYLON;
         }
         Object.defineProperty(BoneLookController.prototype, "minYaw", {
             /**
-             * Get/set the minimum yaw angle that the bone can look to.
+             * Gets or sets the minimum yaw angle that the bone can look to
              */
             get: function () {
                 return this._minYaw;
@@ -77921,7 +77983,7 @@ var BABYLON;
         });
         Object.defineProperty(BoneLookController.prototype, "maxYaw", {
             /**
-             * Get/set the maximum yaw angle that the bone can look to.
+             * Gets or sets the maximum yaw angle that the bone can look to
              */
             get: function () {
                 return this._maxYaw;
@@ -77940,7 +78002,7 @@ var BABYLON;
         });
         Object.defineProperty(BoneLookController.prototype, "minPitch", {
             /**
-             * Get/set the minimum pitch angle that the bone can look to.
+             * Gets or sets the minimum pitch angle that the bone can look to
              */
             get: function () {
                 return this._minPitch;
@@ -77954,7 +78016,7 @@ var BABYLON;
         });
         Object.defineProperty(BoneLookController.prototype, "maxPitch", {
             /**
-             * Get/set the maximum pitch angle that the bone can look to.
+             * Gets or sets the maximum pitch angle that the bone can look to
              */
             get: function () {
                 return this._maxPitch;
@@ -77967,7 +78029,7 @@ var BABYLON;
             configurable: true
         });
         /**
-         * Update the bone to look at the target.  This should be called before the scene is rendered (use scene.registerBeforeRender()).
+         * Update the bone to look at the target.  This should be called before the scene is rendered (use scene.registerBeforeRender())
          */
         BoneLookController.prototype.update = function () {
             //skip the first frame when slerping so that the mesh rotation is correct

+ 1 - 0
dist/preview release/gui/babylon.gui.d.ts

@@ -55,6 +55,7 @@ declare module BABYLON.GUI {
         dispose(): void;
         private _onResize();
         _getGlobalViewport(scene: Scene): Viewport;
+        getProjectedPosition(position: Vector3, worldMatrix: Matrix): Vector2;
         private _checkUpdate(camera);
         private _render();
         private _doPicking(x, y, type, pointerId, buttonIndex);

+ 10 - 0
dist/preview release/gui/babylon.gui.js

@@ -303,6 +303,16 @@ var BABYLON;
                 var engine = scene.getEngine();
                 return this._fullscreenViewport.toGlobal(engine.getRenderWidth(), engine.getRenderHeight());
             };
+            AdvancedDynamicTexture.prototype.getProjectedPosition = function (position, worldMatrix) {
+                var scene = this.getScene();
+                if (!scene) {
+                    return BABYLON.Vector2.Zero();
+                }
+                var globalViewport = this._getGlobalViewport(scene);
+                var projectedPosition = BABYLON.Vector3.Project(position, worldMatrix, scene.getTransformMatrix(), globalViewport);
+                projectedPosition.scaleInPlace(this.renderScale);
+                return new BABYLON.Vector2(projectedPosition.x, projectedPosition.y);
+            };
             AdvancedDynamicTexture.prototype._checkUpdate = function (camera) {
                 if (this._layerToDispose) {
                     if ((camera.layerMask & this._layerToDispose.layerMask) === 0) {

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 4 - 4
dist/preview release/gui/babylon.gui.min.js


+ 1 - 0
dist/preview release/gui/babylon.gui.module.d.ts

@@ -60,6 +60,7 @@ declare module BABYLON.GUI {
         dispose(): void;
         private _onResize();
         _getGlobalViewport(scene: Scene): Viewport;
+        getProjectedPosition(position: Vector3, worldMatrix: Matrix): Vector2;
         private _checkUpdate(camera);
         private _render();
         private _doPicking(x, y, type, pointerId, buttonIndex);

+ 7 - 1
dist/preview release/loaders/babylon.glTF2FileLoader.js

@@ -1290,7 +1290,9 @@ var BABYLON;
                             }); }));
                             var morphTargets = new Array();
                             _this._forEachPrimitive(targetNode, function (babylonMesh) {
-                                morphTargets.push(babylonMesh.morphTargetManager.getTarget(targetIndex));
+                                var morphTarget = babylonMesh.morphTargetManager.getTarget(targetIndex);
+                                morphTarget.animations.push(babylonAnimation);
+                                morphTargets.push(morphTarget);
                             });
                             babylonAnimationGroup.addTargetedAnimation(babylonAnimation, morphTargets);
                         };
@@ -1303,6 +1305,10 @@ var BABYLON;
                         var babylonAnimation = new BABYLON.Animation(animationName, targetPath, 1, animationType);
                         babylonAnimation.setKeys(keys);
                         if (targetNode._babylonAnimationTargets) {
+                            for (var _i = 0, _a = targetNode._babylonAnimationTargets; _i < _a.length; _i++) {
+                                var babylonAnimationTarget = _a[_i];
+                                babylonAnimationTarget.animations.push(babylonAnimation);
+                            }
                             babylonAnimationGroup.addTargetedAnimation(babylonAnimation, targetNode._babylonAnimationTargets);
                         }
                     }

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 2 - 2
dist/preview release/loaders/babylon.glTF2FileLoader.min.js


+ 7 - 1
dist/preview release/loaders/babylon.glTFFileLoader.js

@@ -3485,7 +3485,9 @@ var BABYLON;
                             }); }));
                             var morphTargets = new Array();
                             _this._forEachPrimitive(targetNode, function (babylonMesh) {
-                                morphTargets.push(babylonMesh.morphTargetManager.getTarget(targetIndex));
+                                var morphTarget = babylonMesh.morphTargetManager.getTarget(targetIndex);
+                                morphTarget.animations.push(babylonAnimation);
+                                morphTargets.push(morphTarget);
                             });
                             babylonAnimationGroup.addTargetedAnimation(babylonAnimation, morphTargets);
                         };
@@ -3498,6 +3500,10 @@ var BABYLON;
                         var babylonAnimation = new BABYLON.Animation(animationName, targetPath, 1, animationType);
                         babylonAnimation.setKeys(keys);
                         if (targetNode._babylonAnimationTargets) {
+                            for (var _i = 0, _a = targetNode._babylonAnimationTargets; _i < _a.length; _i++) {
+                                var babylonAnimationTarget = _a[_i];
+                                babylonAnimationTarget.animations.push(babylonAnimation);
+                            }
                             babylonAnimationGroup.addTargetedAnimation(babylonAnimation, targetNode._babylonAnimationTargets);
                         }
                     }

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 2 - 2
dist/preview release/loaders/babylon.glTFFileLoader.min.js


+ 7 - 1
dist/preview release/loaders/babylonjs.loaders.js

@@ -4467,7 +4467,9 @@ var BABYLON;
                             }); }));
                             var morphTargets = new Array();
                             _this._forEachPrimitive(targetNode, function (babylonMesh) {
-                                morphTargets.push(babylonMesh.morphTargetManager.getTarget(targetIndex));
+                                var morphTarget = babylonMesh.morphTargetManager.getTarget(targetIndex);
+                                morphTarget.animations.push(babylonAnimation);
+                                morphTargets.push(morphTarget);
                             });
                             babylonAnimationGroup.addTargetedAnimation(babylonAnimation, morphTargets);
                         };
@@ -4480,6 +4482,10 @@ var BABYLON;
                         var babylonAnimation = new BABYLON.Animation(animationName, targetPath, 1, animationType);
                         babylonAnimation.setKeys(keys);
                         if (targetNode._babylonAnimationTargets) {
+                            for (var _i = 0, _a = targetNode._babylonAnimationTargets; _i < _a.length; _i++) {
+                                var babylonAnimationTarget = _a[_i];
+                                babylonAnimationTarget.animations.push(babylonAnimation);
+                            }
                             babylonAnimationGroup.addTargetedAnimation(babylonAnimation, targetNode._babylonAnimationTargets);
                         }
                     }

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1 - 1
dist/preview release/loaders/babylonjs.loaders.min.js


+ 2 - 40
dist/preview release/typedocValidationBaseline.json

@@ -1,7 +1,7 @@
 {
-  "errors": 5142,
+  "errors": 5116,
   "babylon.typedoc.json": {
-    "errors": 5142,
+    "errors": 5116,
     "AnimationKeyInterpolation": {
       "Enumeration": {
         "Comments": {
@@ -4613,25 +4613,6 @@
           "MissingText": true
         }
       },
-      "Constructor": {
-        "new BoundingBox": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "minimum": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "maximum": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        }
-      },
       "Property": {
         "center": {
           "Comments": {
@@ -5084,25 +5065,6 @@
           "MissingText": true
         }
       },
-      "Constructor": {
-        "new BoundingSphere": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "minimum": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "maximum": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        }
-      },
       "Property": {
         "center": {
           "Comments": {

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 33 - 33
dist/preview release/viewer/babylon.viewer.js


+ 198 - 126
dist/preview release/viewer/babylon.viewer.max.js

@@ -17864,16 +17864,29 @@ var BABYLON;
 var BABYLON;
 (function (BABYLON) {
     var BoundingSphere = /** @class */ (function () {
-        function BoundingSphere(minimum, maximum) {
-            this.minimum = minimum;
-            this.maximum = maximum;
+        /**
+         * Creates a new bounding sphere
+         * @param min defines the minimum vector (in local space)
+         * @param max defines the maximum vector (in local space)
+         */
+        function BoundingSphere(min, max) {
             this._tempRadiusVector = BABYLON.Vector3.Zero();
-            var distance = BABYLON.Vector3.Distance(minimum, maximum);
-            this.center = BABYLON.Vector3.Lerp(minimum, maximum, 0.5);
+            this.reConstruct(min, max);
+        }
+        /**
+         * Recreates the entire bounding sphere from scratch
+         * @param min defines the new minimum vector (in local space)
+         * @param max defines the new maximum vector (in local space)
+         */
+        BoundingSphere.prototype.reConstruct = function (min, max) {
+            this.minimum = min.clone();
+            this.maximum = max.clone();
+            var distance = BABYLON.Vector3.Distance(min, max);
+            this.center = BABYLON.Vector3.Lerp(min, max, 0.5);
             this.radius = distance * 0.5;
             this.centerWorld = BABYLON.Vector3.Zero();
             this._update(BABYLON.Matrix.Identity());
-        }
+        };
         // Methods
         BoundingSphere.prototype._update = function (world) {
             BABYLON.Vector3.TransformCoordinatesToRef(this.center, world, this.centerWorld);
@@ -17916,12 +17929,26 @@ var BABYLON;
 var BABYLON;
 (function (BABYLON) {
     var BoundingBox = /** @class */ (function () {
-        function BoundingBox(minimum, maximum) {
-            this.minimum = minimum;
-            this.maximum = maximum;
-            this.vectors = new Array();
+        /**
+         * Creates a new bounding box
+         * @param min defines the minimum vector (in local space)
+         * @param max defines the maximum vector (in local space)
+         */
+        function BoundingBox(min, max) {
             this.vectorsWorld = new Array();
+            this.reConstruct(min, max);
+        }
+        // Methods
+        /**
+         * Recreates the entire bounding box from scratch
+         * @param min defines the new minimum vector (in local space)
+         * @param max defines the new maximum vector (in local space)
+         */
+        BoundingBox.prototype.reConstruct = function (min, max) {
+            this.minimum = min.clone();
+            this.maximum = max.clone();
             // Bounding vectors
+            this.vectors = new Array();
             this.vectors.push(this.minimum.clone());
             this.vectors.push(this.maximum.clone());
             this.vectors.push(this.minimum.clone());
@@ -17948,9 +17975,8 @@ var BABYLON;
             this.maximumWorld = BABYLON.Vector3.Zero();
             this.centerWorld = BABYLON.Vector3.Zero();
             this.extendSizeWorld = BABYLON.Vector3.Zero();
-            this._update(BABYLON.Matrix.Identity());
-        }
-        // Methods
+            this._update(this._worldMatrix || BABYLON.Matrix.Identity());
+        };
         BoundingBox.prototype.getWorldMatrix = function () {
             return this._worldMatrix;
         };
@@ -19497,10 +19523,7 @@ var BABYLON;
                 if (!this.subMeshes) {
                     return;
                 }
-                for (var _i = 0, _a = this.subMeshes; _i < _a.length; _i++) {
-                    var subMesh = _a[_i];
-                    subMesh.setEffect(null);
-                }
+                this._unBindEffect();
             },
             enumerable: true,
             configurable: true
@@ -19717,6 +19740,13 @@ var BABYLON;
             }
             this._markSubMeshesAsLightDirty();
         };
+        /** @ignore */
+        AbstractMesh.prototype._unBindEffect = function () {
+            for (var _i = 0, _a = this.subMeshes; _i < _a.length; _i++) {
+                var subMesh = _a[_i];
+                subMesh.setEffect(null);
+            }
+        };
         AbstractMesh.prototype._removeLightSource = function (light) {
             var index = this._lightSources.indexOf(light);
             if (index === -1) {
@@ -30865,6 +30895,13 @@ var BABYLON;
             }
             return ret;
         };
+        Mesh.prototype._unBindEffect = function () {
+            _super.prototype._unBindEffect.call(this);
+            for (var _i = 0, _a = this.instances; _i < _a.length; _i++) {
+                var instance = _a[_i];
+                instance._unBindEffect();
+            }
+        };
         Object.defineProperty(Mesh.prototype, "hasLODLevels", {
             /**
              * True if the mesh has some Levels Of Details (LOD).
@@ -43220,11 +43257,17 @@ var BABYLON;
         };
         StandardMaterial.prototype.unbind = function () {
             if (this._activeEffect) {
+                var needFlag = false;
                 if (this._reflectionTexture && this._reflectionTexture.isRenderTarget) {
                     this._activeEffect.setTexture("reflection2DSampler", null);
+                    needFlag = true;
                 }
                 if (this._refractionTexture && this._refractionTexture.isRenderTarget) {
                     this._activeEffect.setTexture("refraction2DSampler", null);
+                    needFlag = true;
+                }
+                if (needFlag) {
+                    this._markAllSubMeshesAsTexturesDirty();
                 }
             }
             _super.prototype.unbind.call(this);
@@ -50803,21 +50846,15 @@ var BABYLON;
             if (this._isStarted || this._targetedAnimations.length === 0) {
                 return this;
             }
-            var _loop_1 = function () {
-                var targetedAnimation = this_1._targetedAnimations[index];
-                if (!targetedAnimation.target.animations) {
-                    targetedAnimation.target.animations = [];
-                }
-                if (targetedAnimation.target.animations.indexOf(targetedAnimation.animation) === -1) {
-                    targetedAnimation.target.animations.push(targetedAnimation.animation);
-                }
+            var _loop_1 = function (targetedAnimation) {
                 this_1._animatables.push(this_1._scene.beginDirectAnimation(targetedAnimation.target, [targetedAnimation.animation], from !== undefined ? from : this_1._from, to !== undefined ? to : this_1._to, loop, speedRatio, function () {
                     _this.onAnimationEndObservable.notifyObservers(targetedAnimation);
                 }));
             };
             var this_1 = this;
-            for (var index = 0; index < this._targetedAnimations.length; index++) {
-                _loop_1();
+            for (var _i = 0, _a = this._targetedAnimations; _i < _a.length; _i++) {
+                var targetedAnimation = _a[_i];
+                _loop_1(targetedAnimation);
             }
             this._speedRatio = speedRatio;
             this._isStarted = true;
@@ -51271,7 +51308,7 @@ var BABYLON;
                         }
                     }
                 }
-                else if (this._originalBlendValue.constructor) { // Complex value
+                else {
                     var constructor = this._originalBlendValue.constructor;
                     if (constructor.Lerp) { // Lerp supported
                         this._currentValue = constructor.Lerp(this._originalBlendValue, currentValue, this._blendingFactor);
@@ -51279,13 +51316,13 @@ var BABYLON;
                     else if (constructor.Slerp) { // Slerp supported
                         this._currentValue = constructor.Slerp(this._originalBlendValue, currentValue, this._blendingFactor);
                     }
+                    else if (this._originalBlendValue.toFixed) { // Number
+                        this._currentValue = this._originalBlendValue * (1.0 - this._blendingFactor) + this._blendingFactor * currentValue;
+                    }
                     else { // Blending not supported
                         this._currentValue = currentValue;
                     }
                 }
-                else { // Direct value
-                    this._currentValue = this._originalBlendValue * (1.0 - this._blendingFactor) + this._blendingFactor * currentValue;
-                }
                 this._blendingFactor += blendingSpeed;
             }
             else {
@@ -52077,10 +52114,16 @@ var BABYLON;
          * @param actionManager manager for the action the condition applies to
          * @param target for the action
          * @param propertyPath path to specify the property of the target the conditional operator uses
-         * @param value the vale compared by the conditional operator against the current value of the property
-         * @param operator the conditional operator, default {BABYLON.ValueCondition.IsEqual}
-         */
-        function ValueCondition(actionManager, target, propertyPath, value, operator) {
+         * @param value the value compared by the conditional operator against the current value of the property
+         * @param operator the conditional operator, default ValueCondition.IsEqual
+         */
+        function ValueCondition(actionManager, target, 
+        /** path to specify the property of the target the conditional operator uses  */
+        propertyPath, 
+        /** the value compared by the conditional operator against the current value of the property */
+        value, 
+        /** the conditional operator, default ValueCondition.IsEqual */
+        operator) {
             if (operator === void 0) { operator = ValueCondition.IsEqual; }
             var _this = _super.call(this, actionManager) || this;
             _this.propertyPath = propertyPath;
@@ -52212,11 +52255,13 @@ var BABYLON;
     var PredicateCondition = /** @class */ (function (_super) {
         __extends(PredicateCondition, _super);
         /**
-         * Creates a new {BABYLON.PredicateCondition}
+         * Creates a new PredicateCondition
          * @param actionManager manager for the action the condition applies to
-         * @param predicate
+         * @param predicate defines the predicate function used to validate the condition
          */
-        function PredicateCondition(actionManager, predicate) {
+        function PredicateCondition(actionManager, 
+        /** defines the predicate function used to validate the condition */
+        predicate) {
             var _this = _super.call(this, actionManager) || this;
             _this.predicate = predicate;
             return _this;
@@ -52231,12 +52276,12 @@ var BABYLON;
     }(Condition));
     BABYLON.PredicateCondition = PredicateCondition;
     /**
-     * Defines a state condition as an extension of {BABYLON.Condition}
+     * Defines a state condition as an extension of Condition
      */
     var StateCondition = /** @class */ (function (_super) {
         __extends(StateCondition, _super);
         /**
-         * Creates a new {BABYLON.StateCondition}
+         * Creates a new StateCondition
          * @param actionManager manager for the action the condition applies to
          * @param target of the condition
          * @param value to compare with target state
@@ -52254,7 +52299,7 @@ var BABYLON;
             return this._target.state === this.value;
         };
         /**
-         * Serialize the {BABYLON.StateCondition} into a JSON compatible object
+         * Serialize the StateCondition into a JSON compatible object
          * @returns serialization object
          */
         StateCondition.prototype.serialize = function () {
@@ -52531,7 +52576,7 @@ var BABYLON;
             // Members
             this.actions = new Array();
             this.hoverCursor = '';
-            this._scene = scene;
+            this._scene = scene || BABYLON.Engine.LastCreatedScene;
             scene._actionManagers.push(this);
         }
         Object.defineProperty(ActionManager, "NothingTrigger", {
@@ -61104,9 +61149,19 @@ var BABYLON;
              * Returns true if the decoder is available.
              */
             get: function () {
-                return (typeof DracoDecoderModule !== "undefined" ||
-                    (typeof WebAssembly === "object" && !!DracoCompression.Configuration.decoderWasm) ||
-                    !!DracoCompression.Configuration.decoder);
+                if (typeof DracoDecoderModule !== "undefined") {
+                    return true;
+                }
+                var decoder = DracoCompression.Configuration.decoder;
+                if (decoder) {
+                    if (decoder.wasmUrl && decoder.wasmBinaryUrl && typeof WebAssembly === "object") {
+                        return true;
+                    }
+                    if (decoder.fallbackUrl) {
+                        return true;
+                    }
+                }
+                return false;
             },
             enumerable: true,
             configurable: true
@@ -61196,24 +61251,29 @@ var BABYLON;
         };
         DracoCompression._GetDecoderModule = function () {
             if (!DracoCompression._DecoderModulePromise) {
-                var promise = void 0;
+                var promise = null;
                 var config_1 = {};
                 if (typeof DracoDecoderModule !== "undefined") {
                     promise = Promise.resolve();
                 }
-                else if (typeof WebAssembly === "object" && DracoCompression.Configuration.decoderWasm) {
-                    promise = Promise.all([
-                        DracoCompression._LoadScriptAsync(DracoCompression.Configuration.decoderWasm.wrapperUrl),
-                        DracoCompression._LoadFileAsync(DracoCompression.Configuration.decoderWasm.binaryUrl).then(function (data) {
-                            config_1.wasmBinary = data;
-                        })
-                    ]);
-                }
-                else if (DracoCompression.Configuration.decoder) {
-                    promise = DracoCompression._LoadScriptAsync(DracoCompression.Configuration.decoder.url);
-                }
                 else {
-                    throw new Error("Invalid decoder configuration");
+                    var decoder = DracoCompression.Configuration.decoder;
+                    if (decoder) {
+                        if (decoder.wasmUrl && decoder.wasmBinaryUrl && typeof WebAssembly === "object") {
+                            promise = Promise.all([
+                                DracoCompression._LoadScriptAsync(decoder.wasmUrl),
+                                DracoCompression._LoadFileAsync(decoder.wasmBinaryUrl).then(function (data) {
+                                    config_1.wasmBinary = data;
+                                })
+                            ]);
+                        }
+                        else if (decoder.fallbackUrl) {
+                            promise = DracoCompression._LoadScriptAsync(decoder.fallbackUrl);
+                        }
+                    }
+                }
+                if (!promise) {
+                    throw new Error("Draco decoder module is not available");
                 }
                 DracoCompression._DecoderModulePromise = promise.then(function () {
                     return new Promise(function (resolve) {
@@ -61245,51 +61305,16 @@ var BABYLON;
                 });
             });
         };
-        DracoCompression._GetDefaultConfig = function () {
-            var configuration = {
-                decoder: null,
-                decoderWasm: null
-            };
-            if (BABYLON.Tools.IsWindowObjectExist()) {
-                var decoderUrl = null;
-                var decoderWasmBinaryUrl = null;
-                var decoderWasmWrapperUrl = null;
-                for (var i = 0; i < document.scripts.length; i++) {
-                    var type = document.scripts[i].type;
-                    var src = document.scripts[i].src;
-                    switch (type) {
-                        case "text/x-draco-decoder": {
-                            decoderUrl = src;
-                            break;
-                        }
-                        case "text/x-draco-decoder-wasm-binary": {
-                            decoderWasmBinaryUrl = src;
-                            break;
-                        }
-                        case "text/x-draco-decoder-wasm-wrapper": {
-                            decoderWasmWrapperUrl = src;
-                            break;
-                        }
-                    }
-                }
-                if (decoderUrl) {
-                    configuration.decoder = {
-                        url: decoderUrl
-                    };
-                }
-                if (decoderWasmWrapperUrl && decoderWasmBinaryUrl) {
-                    configuration.decoderWasm = {
-                        binaryUrl: decoderWasmBinaryUrl,
-                        wrapperUrl: decoderWasmWrapperUrl
-                    };
-                }
-            }
-            return configuration;
-        };
         /**
-         * Gets the configuration.
+         * The configuration.
          */
-        DracoCompression.Configuration = DracoCompression._GetDefaultConfig();
+        DracoCompression.Configuration = {
+            decoder: {
+                wasmUrl: "https://preview.babylonjs.com/draco_wasm_wrapper_gltf.js",
+                wasmBinaryUrl: "https://preview.babylonjs.com/draco_decoder_gltf.wasm",
+                fallbackUrl: "https://preview.babylonjs.com/draco_decoder_gltf.js"
+            }
+        };
         return DracoCompression;
     }());
     BABYLON.DracoCompression = DracoCompression;
@@ -77167,6 +77192,9 @@ var BABYLON;
                 var child = _a[_i];
                 var cm = child.getLocalMatrix();
                 cm.multiplyToRef(scaleMat, cm);
+                cm.m[12] *= x;
+                cm.m[13] *= y;
+                cm.m[14] *= z;
                 child._markAsDirtyAndDecompose();
             }
             this._markAsDirtyAndDecompose();
@@ -77690,13 +77718,37 @@ var BABYLON;
 
 var BABYLON;
 (function (BABYLON) {
-    /** Class used to apply inverse kinematics to bones */
+    /**
+     * Class used to apply inverse kinematics to bones
+     * @see http://doc.babylonjs.com/how_to/how_to_use_bones_and_skeletons#boneikcontroller
+     */
     var BoneIKController = /** @class */ (function () {
+        /**
+         * Creates a new BoneIKController
+         * @param mesh defines the mesh to control
+         * @param bone defines the bone to control
+         * @param options defines options to set up the controller
+         */
         function BoneIKController(mesh, bone, options) {
+            /**
+             * Gets or sets the target position
+             */
             this.targetPosition = BABYLON.Vector3.Zero();
+            /**
+             * Gets or sets the pole target position
+             */
             this.poleTargetPosition = BABYLON.Vector3.Zero();
+            /**
+             * Gets or sets the pole target local offset
+             */
             this.poleTargetLocalOffset = BABYLON.Vector3.Zero();
+            /**
+             * Gets or sets the pole angle
+             */
             this.poleAngle = 0;
+            /**
+             * The amount to slerp (spherical linear interpolation) to the target.  Set this to a value between 0 and 1 (a value of 1 disables slerp)
+             */
             this.slerpAmount = 1;
             this._bone1Quat = BABYLON.Quaternion.Identity();
             this._bone1Mat = BABYLON.Matrix.Identity();
@@ -77772,6 +77824,9 @@ var BABYLON;
             }
         }
         Object.defineProperty(BoneIKController.prototype, "maxAngle", {
+            /**
+             * Gets or sets maximum allowed angle
+             */
             get: function () {
                 return this._maxAngle;
             },
@@ -77793,6 +77848,9 @@ var BABYLON;
             var b = this._bone2Length;
             this._maxReach = Math.sqrt(a * a + b * b - 2 * a * b * Math.cos(ang));
         };
+        /**
+         * Force the controller to update the bones
+         */
         BoneIKController.prototype.update = function () {
             var bone1 = this._bone1;
             if (!bone1) {
@@ -77904,6 +77962,10 @@ var BABYLON;
 
 var BABYLON;
 (function (BABYLON) {
+    /**
+     * Class used to make a bone look toward a point in space
+     * @see http://doc.babylonjs.com/how_to/how_to_use_bones_and_skeletons#bonelookcontroller
+     */
     var BoneLookController = /** @class */ (function () {
         /**
          * Create a BoneLookController
@@ -77911,42 +77973,42 @@ var BABYLON;
          * @param bone the bone that will be looking to the target
          * @param target the target Vector3 to look at
          * @param settings optional settings:
-         * - maxYaw: the maximum angle the bone will yaw to
-         * - minYaw: the minimum angle the bone will yaw to
-         * - maxPitch: the maximum angle the bone will pitch to
-         * - minPitch: the minimum angle the bone will yaw to
-         * - slerpAmount: set the between 0 and 1 to make the bone slerp to the target.
-         * - upAxis: the up axis of the coordinate system
-         * - upAxisSpace: the space that the up axis is in - BABYLON.Space.BONE, BABYLON.Space.LOCAL (default), or BABYLON.Space.WORLD.
-         * - yawAxis: set yawAxis if the bone does not yaw on the y axis
-         * - pitchAxis: set pitchAxis if the bone does not pitch on the x axis
-         * - adjustYaw: used to make an adjustment to the yaw of the bone
-         * - adjustPitch: used to make an adjustment to the pitch of the bone
-         * - adjustRoll: used to make an adjustment to the roll of the bone
+         * * maxYaw: the maximum angle the bone will yaw to
+         * * minYaw: the minimum angle the bone will yaw to
+         * * maxPitch: the maximum angle the bone will pitch to
+         * * minPitch: the minimum angle the bone will yaw to
+         * * slerpAmount: set the between 0 and 1 to make the bone slerp to the target.
+         * * upAxis: the up axis of the coordinate system
+         * * upAxisSpace: the space that the up axis is in - BABYLON.Space.BONE, BABYLON.Space.LOCAL (default), or BABYLON.Space.WORLD.
+         * * yawAxis: set yawAxis if the bone does not yaw on the y axis
+         * * pitchAxis: set pitchAxis if the bone does not pitch on the x axis
+         * * adjustYaw: used to make an adjustment to the yaw of the bone
+         * * adjustPitch: used to make an adjustment to the pitch of the bone
+         * * adjustRoll: used to make an adjustment to the roll of the bone
          **/
         function BoneLookController(mesh, bone, target, options) {
             /**
-             * The up axis of the coordinate system that is used when the bone is rotated.
+             * The up axis of the coordinate system that is used when the bone is rotated
              */
             this.upAxis = BABYLON.Vector3.Up();
             /**
-             * The space that the up axis is in - BABYLON.Space.BONE, BABYLON.Space.LOCAL (default), or BABYLON.Space.WORLD.
+             * The space that the up axis is in - BABYLON.Space.BONE, BABYLON.Space.LOCAL (default), or BABYLON.Space.WORLD
              */
             this.upAxisSpace = BABYLON.Space.LOCAL;
             /**
-             * Used to make an adjustment to the yaw of the bone.
+             * Used to make an adjustment to the yaw of the bone
              */
             this.adjustYaw = 0;
             /**
-             * Used to make an adjustment to the pitch of the bone.
+             * Used to make an adjustment to the pitch of the bone
              */
             this.adjustPitch = 0;
             /**
-             * Used to make an adjustment to the roll of the bone.
+             * Used to make an adjustment to the roll of the bone
              */
             this.adjustRoll = 0;
             /**
-             * The amount to slerp (spherical linear interpolation) to the target.  Set this to a value between 0 and 1 (a value of 1 disables slerp).
+             * The amount to slerp (spherical linear interpolation) to the target.  Set this to a value between 0 and 1 (a value of 1 disables slerp)
              */
             this.slerpAmount = 1;
             this._boneQuat = BABYLON.Quaternion.Identity();
@@ -78023,7 +78085,7 @@ var BABYLON;
         }
         Object.defineProperty(BoneLookController.prototype, "minYaw", {
             /**
-             * Get/set the minimum yaw angle that the bone can look to.
+             * Gets or sets the minimum yaw angle that the bone can look to
              */
             get: function () {
                 return this._minYaw;
@@ -78042,7 +78104,7 @@ var BABYLON;
         });
         Object.defineProperty(BoneLookController.prototype, "maxYaw", {
             /**
-             * Get/set the maximum yaw angle that the bone can look to.
+             * Gets or sets the maximum yaw angle that the bone can look to
              */
             get: function () {
                 return this._maxYaw;
@@ -78061,7 +78123,7 @@ var BABYLON;
         });
         Object.defineProperty(BoneLookController.prototype, "minPitch", {
             /**
-             * Get/set the minimum pitch angle that the bone can look to.
+             * Gets or sets the minimum pitch angle that the bone can look to
              */
             get: function () {
                 return this._minPitch;
@@ -78075,7 +78137,7 @@ var BABYLON;
         });
         Object.defineProperty(BoneLookController.prototype, "maxPitch", {
             /**
-             * Get/set the maximum pitch angle that the bone can look to.
+             * Gets or sets the maximum pitch angle that the bone can look to
              */
             get: function () {
                 return this._maxPitch;
@@ -78088,7 +78150,7 @@ var BABYLON;
             configurable: true
         });
         /**
-         * Update the bone to look at the target.  This should be called before the scene is rendered (use scene.registerBeforeRender()).
+         * Update the bone to look at the target.  This should be called before the scene is rendered (use scene.registerBeforeRender())
          */
         BoneLookController.prototype.update = function () {
             //skip the first frame when slerping so that the mesh rotation is correct
@@ -101328,6 +101390,9 @@ var BABYLON;
                 vertexData.indices = handledMesh.indices;
                 //Set the data from the VertexBuffer to the current BABYLON.Mesh
                 vertexData.applyToMesh(babylonMesh);
+                if (OBJFileLoader.INVERT_Y) {
+                    babylonMesh.scaling.y *= -1;
+                }
                 //Push the mesh into an array
                 babylonMeshesArray.push(babylonMesh);
             }
@@ -101369,6 +101434,7 @@ var BABYLON;
             return babylonMeshesArray;
         };
         OBJFileLoader.OPTIMIZE_WITH_UV = false;
+        OBJFileLoader.INVERT_Y = false;
         return OBJFileLoader;
     }());
     BABYLON.OBJFileLoader = OBJFileLoader;
@@ -104849,7 +104915,9 @@ var BABYLON;
                             }); }));
                             var morphTargets = new Array();
                             _this._forEachPrimitive(targetNode, function (babylonMesh) {
-                                morphTargets.push(babylonMesh.morphTargetManager.getTarget(targetIndex));
+                                var morphTarget = babylonMesh.morphTargetManager.getTarget(targetIndex);
+                                morphTarget.animations.push(babylonAnimation);
+                                morphTargets.push(morphTarget);
                             });
                             babylonAnimationGroup.addTargetedAnimation(babylonAnimation, morphTargets);
                         };
@@ -104862,6 +104930,10 @@ var BABYLON;
                         var babylonAnimation = new BABYLON.Animation(animationName, targetPath, 1, animationType);
                         babylonAnimation.setKeys(keys);
                         if (targetNode._babylonAnimationTargets) {
+                            for (var _i = 0, _a = targetNode._babylonAnimationTargets; _i < _a.length; _i++) {
+                                var babylonAnimationTarget = _a[_i];
+                                babylonAnimationTarget.animations.push(babylonAnimation);
+                            }
                             babylonAnimationGroup.addTargetedAnimation(babylonAnimation, targetNode._babylonAnimationTargets);
                         }
                     }

+ 1 - 1
src/Actions/babylon.actionManager.ts

@@ -152,7 +152,7 @@
         private _scene: Scene;
 
         constructor(scene: Scene) {
-            this._scene = scene;
+            this._scene = scene || Engine.LastCreatedScene;
 
             scene._actionManagers.push(this);
         }

+ 24 - 5
src/Culling/babylon.boundingBox.ts

@@ -1,6 +1,6 @@
 module BABYLON {
     export class BoundingBox implements ICullable {
-        public vectors: Vector3[] = new Array<Vector3>();
+        public vectors: Vector3[];
         public center: Vector3;
         public centerWorld: Vector3;
         public extendSize: Vector3;
@@ -9,12 +9,32 @@
         public vectorsWorld: Vector3[] = new Array<Vector3>();
         public minimumWorld: Vector3;
         public maximumWorld: Vector3;
-
+        public minimum: Vector3;
+        public maximum: Vector3;
 
         private _worldMatrix: Matrix;
 
-        constructor(public minimum: Vector3, public maximum: Vector3) {
+        /**
+         * Creates a new bounding box
+         * @param min defines the minimum vector (in local space)
+         * @param max defines the maximum vector (in local space)
+         */
+        constructor(min: Vector3, max: Vector3) {
+            this.reConstruct(min, max);
+        }
+
+        // Methods
+
+        /**
+         * Recreates the entire bounding box from scratch
+         * @param min defines the new minimum vector (in local space)
+         * @param max defines the new maximum vector (in local space) 
+         */
+        public reConstruct(min: Vector3, max: Vector3) {
+            this.minimum = min.clone();
+            this.maximum = max.clone()
             // Bounding vectors
+            this.vectors= new Array<Vector3>();
             this.vectors.push(this.minimum.clone());
             this.vectors.push(this.maximum.clone());
 
@@ -50,10 +70,9 @@
             this.centerWorld = Vector3.Zero();
             this.extendSizeWorld = Vector3.Zero();
 
-            this._update(Matrix.Identity());
+            this._update(this._worldMatrix || Matrix.Identity());
         }
 
-        // Methods
         public getWorldMatrix(): Matrix {
             return this._worldMatrix;
         }

+ 23 - 4
src/Culling/babylon.boundingSphere.ts

@@ -4,17 +4,36 @@
         public radius: number;
         public centerWorld: Vector3;
         public radiusWorld: number;
+        public minimum: Vector3;
+        public maximum: Vector3;
 
         private _tempRadiusVector = Vector3.Zero();
 
-        constructor(public minimum: Vector3, public maximum: Vector3) {
-            var distance = Vector3.Distance(minimum, maximum);
+        /**
+         * Creates a new bounding sphere
+         * @param min defines the minimum vector (in local space)
+         * @param max defines the maximum vector (in local space)
+         */
+        constructor(min: Vector3, max: Vector3) {
+            this.reConstruct(min, max);
+        }
+
+        /**
+         * Recreates the entire bounding sphere from scratch
+         * @param min defines the new minimum vector (in local space)
+         * @param max defines the new maximum vector (in local space) 
+         */
+        public reConstruct(min: Vector3, max: Vector3) {
+            this.minimum = min.clone();
+            this.maximum = max.clone()
+
+            var distance = Vector3.Distance(min, max);
 
-            this.center = Vector3.Lerp(minimum, maximum, 0.5);
+            this.center = Vector3.Lerp(min, max, 0.5);
             this.radius = distance * 0.5;
 
             this.centerWorld = Vector3.Zero();
-            this._update(Matrix.Identity());
+            this._update(Matrix.Identity());            
         }
 
         // Methods

+ 7 - 0
src/Materials/babylon.standardMaterial.ts

@@ -968,12 +968,19 @@ module BABYLON {
 
         public unbind(): void {
             if (this._activeEffect) {
+                let needFlag = false;
                 if (this._reflectionTexture && this._reflectionTexture.isRenderTarget) {
                     this._activeEffect.setTexture("reflection2DSampler", null);
+                    needFlag = true;
                 }
 
                 if (this._refractionTexture && this._refractionTexture.isRenderTarget) {
                     this._activeEffect.setTexture("refraction2DSampler", null);
+                    needFlag = true;
+                }
+
+                if (needFlag) {
+                    this._markAllSubMeshesAsTexturesDirty();
                 }
             }