David Catuhe 7 лет назад
Родитель
Сommit
dc3f6a001e
33 измененных файлов с 39518 добавлено и 38170 удалено
  1. 13681 13529
      Playground/babylon.d.txt
  2. 15954 15919
      dist/preview release/babylon.d.ts
  3. 5 5
      dist/preview release/babylon.js
  4. 65 16
      dist/preview release/babylon.max.js
  5. 5 5
      dist/preview release/babylon.worker.js
  6. 8218 8065
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts
  7. 54 54
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js
  8. 443 105
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js
  9. 443 105
      dist/preview release/customConfigurations/minimalGLTFViewer/es6.js
  10. 65 16
      dist/preview release/es6.js
  11. 3 3
      dist/preview release/gui/babylon.gui.min.js
  12. 4 4
      dist/preview release/inspector/babylon.inspector.bundle.js
  13. 3 3
      dist/preview release/inspector/babylon.inspector.min.js
  14. 2 2
      dist/preview release/loaders/babylon.glTF1FileLoader.min.js
  15. 2 2
      dist/preview release/loaders/babylon.glTF2FileLoader.min.js
  16. 3 3
      dist/preview release/loaders/babylon.glTFFileLoader.min.js
  17. 1 1
      dist/preview release/loaders/babylon.objFileLoader.min.js
  18. 3 3
      dist/preview release/loaders/babylonjs.loaders.min.js
  19. 1 1
      dist/preview release/materialsLibrary/babylon.customMaterial.min.js
  20. 1 1
      dist/preview release/materialsLibrary/babylon.shadowOnlyMaterial.min.js
  21. 1 1
      dist/preview release/materialsLibrary/babylon.waterMaterial.min.js
  22. 3 3
      dist/preview release/materialsLibrary/babylonjs.materials.min.js
  23. 1 1
      dist/preview release/postProcessesLibrary/babylon.asciiArtPostProcess.min.js
  24. 1 1
      dist/preview release/postProcessesLibrary/babylon.digitalRainPostProcess.min.js
  25. 1 1
      dist/preview release/postProcessesLibrary/babylonjs.postProcess.min.js
  26. 1 1
      dist/preview release/serializers/babylon.glTF2Serializer.min.js
  27. 1 1
      dist/preview release/serializers/babylonjs.serializers.min.js
  28. 2 141
      dist/preview release/typedocValidationBaseline.json
  29. 68 67
      dist/preview release/viewer/babylon.viewer.js
  30. 443 105
      dist/preview release/viewer/babylon.viewer.max.js
  31. 1 1
      src/Animations/babylon.animatable.ts
  32. 27 3
      src/Animations/babylon.runtimeAnimation.ts
  33. 12 2
      src/Math/babylon.math.ts

Разница между файлами не показана из-за своего большого размера
+ 13681 - 13529
Playground/babylon.d.txt


Разница между файлами не показана из-за своего большого размера
+ 15954 - 15919
dist/preview release/babylon.d.ts


Разница между файлами не показана из-за своего большого размера
+ 5 - 5
dist/preview release/babylon.js


+ 65 - 16
dist/preview release/babylon.max.js

@@ -1592,6 +1592,7 @@ var BABYLON;
         /**
          * Scale the current Color3 values by a factor and add the result to a given Color3
          * @param scale defines the scale factor
+         * @param result defines color to store the result into
          * @returns the unmodified current Color3
          */
         Color3.prototype.scaleAndAddToRef = function (scale, result) {
@@ -1980,6 +1981,7 @@ var BABYLON;
         /**
          * Scale the current Color4 values by a factor and add the result to a given Color4
          * @param scale defines the scale factor
+         * @param result defines the Color4 object where to store the result
          * @returns the unmodified current Color4
          */
         Color4.prototype.scaleAndAddToRef = function (scale, result) {
@@ -2440,6 +2442,7 @@ var BABYLON;
         /**
          * Scale the current Vector2 values by a factor to a given Vector2
          * @param scale defines the scale factor
+         * @param result defines the Vector2 object where to store the result
          * @returns the unmodified current Vector2
          */
         Vector2.prototype.scaleToRef = function (scale, result) {
@@ -2450,6 +2453,7 @@ var BABYLON;
         /**
          * Scale the current Vector2 values by a factor and add the result to a given Vector2
          * @param scale defines the scale factor
+         * @param result defines the Vector2 object where to store the result
          * @returns the unmodified current Vector2
          */
         Vector2.prototype.scaleAndAddToRef = function (scale, result) {
@@ -2897,6 +2901,7 @@ var BABYLON;
         /**
          * Scale the current Vector3 values by a factor and add the result to a given Vector3
          * @param scale defines the scale factor
+         * @param result defines the Vector3 object where to store the result
          * @returns the unmodified current Vector3
          */
         Vector3.prototype.scaleAndAddToRef = function (scale, result) {
@@ -3852,6 +3857,7 @@ var BABYLON;
         /**
          * Scale the current Vector4 values by a factor and add the result to a given Vector4
          * @param scale defines the scale factor
+         * @param result defines the Vector4 object where to store the result
          * @returns the unmodified current Vector4
          */
         Vector4.prototype.scaleAndAddToRef = function (scale, result) {
@@ -4388,8 +4394,9 @@ var BABYLON;
             return new Quaternion(this.x * value, this.y * value, this.z * value, this.w * value);
         };
         /**
-         * Scale the current VectQuaternionor4 values by a factor to a given Quaternion
+         * Scale the current Quaternion values by a factor to a given Quaternion
          * @param scale defines the scale factor
+         * @param result defines the Quaternion object where to store the result
          * @returns the unmodified current Quaternion
          */
         Quaternion.prototype.scaleToRef = function (scale, result) {
@@ -4400,8 +4407,9 @@ var BABYLON;
             return this;
         };
         /**
-         * Scale the current VectQuaternionor4 values by a factor and add the result to a given Quaternion
+         * Scale the current Quaternion values by a factor and add the result to a given Quaternion
          * @param scale defines the scale factor
+         * @param result defines the Quaternion object where to store the result
          * @returns the unmodified current Quaternion
          */
         Quaternion.prototype.scaleAndAddToRef = function (scale, result) {
@@ -5227,6 +5235,7 @@ var BABYLON;
         /**
          * Scale the current Matrix values by a factor to a given result Matrix
          * @param scale defines the scale factor
+         * @param result defines the Matrix to store the result
          * @returns the current Matrix
          */
         Matrix.prototype.scaleToRef = function (scale, result) {
@@ -5239,6 +5248,7 @@ var BABYLON;
         /**
          * Scale the current Matrix values by a factor and add the result to a given Matrix
          * @param scale defines the scale factor
+         * @param result defines the Matrix to store the result
          * @returns the current Matrix
          */
         Matrix.prototype.scaleAndAddToRef = function (scale, result) {
@@ -12625,7 +12635,7 @@ var BABYLON;
             this.applyStates();
             this._drawCalls.addCount(1, false);
             // Render
-            var drawMode = this.DrawMode(fillMode);
+            var drawMode = this._drawMode(fillMode);
             var indexFormat = this._uintIndicesCurrentlySet ? this._gl.UNSIGNED_INT : this._gl.UNSIGNED_SHORT;
             var mult = this._uintIndicesCurrentlySet ? 4 : 2;
             if (instancesCount) {
@@ -12639,7 +12649,7 @@ var BABYLON;
             // Apply states
             this.applyStates();
             this._drawCalls.addCount(1, false);
-            var drawMode = this.DrawMode(fillMode);
+            var drawMode = this._drawMode(fillMode);
             if (instancesCount) {
                 this._gl.drawArraysInstanced(drawMode, verticesStart, verticesCount, instancesCount);
             }
@@ -12647,7 +12657,7 @@ var BABYLON;
                 this._gl.drawArrays(drawMode, verticesStart, verticesCount);
             }
         };
-        Engine.prototype.DrawMode = function (fillMode) {
+        Engine.prototype._drawMode = function (fillMode) {
             switch (fillMode) {
                 // Triangle views
                 case BABYLON.Material.TriangleFillMode:
@@ -23469,6 +23479,9 @@ var BABYLON;
             target._lateAnimationHolders[runtimeAnimation.targetPath].totalWeight += runtimeAnimation.weight;
         };
         Scene.prototype._processLateAnimationBindings = function () {
+            if (!this._registeredForLateAnimationBindings.length) {
+                return;
+            }
             for (var index = 0; index < this._registeredForLateAnimationBindings.length; index++) {
                 var target = this._registeredForLateAnimationBindings.data[index];
                 for (var path in target._lateAnimationHolders) {
@@ -23488,8 +23501,8 @@ var BABYLON;
                         // We need to normalize the weights
                         normalizer = holder.totalWeight;
                     }
-                    for (var index = 0; index < holder.animations.length; index++) {
-                        var runtimeAnimation = holder.animations[index];
+                    for (var animIndex = 0; animIndex < holder.animations.length; animIndex++) {
+                        var runtimeAnimation = holder.animations[animIndex];
                         if (finalValue) {
                             runtimeAnimation.currentValue.scaleAndAddToRef(runtimeAnimation.weight / normalizer, finalValue);
                         }
@@ -47775,6 +47788,12 @@ var BABYLON;
 var BABYLON;
 (function (BABYLON) {
     var RuntimeAnimation = /** @class */ (function () {
+        /**
+         * Create a new RuntimeAnimation object
+         * @param target defines the target of the animation
+         * @param animation defines the source {BABYLON.Animation} object
+         * @param scene defines the hosting scene
+         */
         function RuntimeAnimation(target, animation, scene) {
             this._offsetsCache = {};
             this._highLimitsCache = {};
@@ -47977,6 +47996,11 @@ var BABYLON;
             }
             return this._getKeyValue(keys[keys.length - 1].value);
         };
+        /**
+         * Affect the interpolated value to the target
+         * @param currentValue defines the value computed by the animation
+         * @param weight defines the weight to apply to this value
+         */
         RuntimeAnimation.prototype.setValue = function (currentValue, weight) {
             if (weight === void 0) { weight = 1.0; }
             // Set value
@@ -48003,11 +48027,18 @@ var BABYLON;
             var blendingSpeed = this._target && this._target.animationPropertiesOverride ? this._target.animationPropertiesOverride.blendingSpeed : this._animation.blendingSpeed;
             if (enableBlending && this._blendingFactor <= 1.0 || weight !== -1.0) {
                 if (!this._originalValue) {
-                    if (destination[path].clone) {
-                        this._originalValue = destination[path].clone();
+                    var originalValue = void 0;
+                    if (destination.getRestPose) {
+                        originalValue = destination.getRestPose();
                     }
                     else {
-                        this._originalValue = destination[path];
+                        originalValue = destination[path];
+                    }
+                    if (originalValue.clone) {
+                        this._originalValue = originalValue.clone();
+                    }
+                    else {
+                        this._originalValue = originalValue;
                     }
                 }
             }
@@ -48048,8 +48079,11 @@ var BABYLON;
             }
             return this._animation.loopMode;
         };
-        RuntimeAnimation.prototype.goToFrame = function (frame, weight) {
-            if (weight === void 0) { weight = 1.0; }
+        /**
+         * Move the current animation to a given frame
+         * @param frame defines the frame to move to
+         */
+        RuntimeAnimation.prototype.goToFrame = function (frame) {
             var keys = this._animation.getKeys();
             if (frame < keys[0].frame) {
                 frame = keys[0].frame;
@@ -48058,14 +48092,24 @@ var BABYLON;
                 frame = keys[keys.length - 1].frame;
             }
             var currentValue = this._interpolate(frame, 0, this._getCorrectLoopMode());
-            this.setValue(currentValue, weight);
+            this.setValue(currentValue, -1);
         };
         RuntimeAnimation.prototype._prepareForSpeedRatioChange = function (newSpeedRatio) {
             var newRatio = this._previousDelay * (this._animation.framePerSecond * newSpeedRatio) / 1000.0;
             this._ratioOffset = this._previousRatio - newRatio;
         };
+        /**
+         * Execute the current animation
+         * @param delay defines the delay to add to the current frame
+         * @param from defines the lower bound of the animation range
+         * @param to defines the upper bound of the animation range
+         * @param loop defines if the current animation must loop
+         * @param speedRatio defines the current speed ratio
+         * @param weight defines the weight of the animation (default is -1 so no weight)
+         * @returns a boolean indicating if the animation has ended
+         */
         RuntimeAnimation.prototype.animate = function (delay, from, to, loop, speedRatio, weight) {
-            if (weight === void 0) { weight = 1.0; }
+            if (weight === void 0) { weight = -1.0; }
             var targetPropertyPath = this._animation.targetPropertyPath;
             if (!targetPropertyPath || targetPropertyPath.length < 1) {
                 this._stopped = true;
@@ -48246,6 +48290,11 @@ var BABYLON;
                 return this._weight;
             },
             set: function (value) {
+                if (value === -1) {
+                    this._weight = -1;
+                    return;
+                }
+                // Else weight must be in [0, 1] range
                 this._weight = Math.min(Math.max(value, 0), 1.0);
             },
             enumerable: true,
@@ -48304,7 +48353,7 @@ var BABYLON;
             // Reset to original value
             for (index = 0; index < runtimeAnimations.length; index++) {
                 var animation = runtimeAnimations[index];
-                animation.animate(0, this.fromFrame, this.toFrame, false, this._speedRatio, 1.0);
+                animation.animate(0, this.fromFrame, this.toFrame, false, this._speedRatio);
             }
             this._localDelayOffset = null;
             this._pausedDelay = null;
@@ -48335,7 +48384,7 @@ var BABYLON;
                 this._localDelayOffset -= delay;
             }
             for (var index = 0; index < runtimeAnimations.length; index++) {
-                runtimeAnimations[index].goToFrame(frame, this._weight);
+                runtimeAnimations[index].goToFrame(frame);
             }
         };
         Animatable.prototype.pause = function () {

Разница между файлами не показана из-за своего большого размера
+ 5 - 5
dist/preview release/babylon.worker.js


Разница между файлами не показана из-за своего большого размера
+ 8218 - 8065
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts


Разница между файлами не показана из-за своего большого размера
+ 54 - 54
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js


+ 443 - 105
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js

@@ -1572,7 +1572,7 @@ var BABYLON;
         /**
          * Multiplies in place each rgb value by scale
          * @param scale defines the scaling factor
-         * @returns the updated Color3.
+         * @returns the updated Color3
          */
         Color3.prototype.scale = function (scale) {
             return new Color3(this.r * scale, this.g * scale, this.b * scale);
@@ -1581,7 +1581,7 @@ var BABYLON;
          * Multiplies the rgb values by scale and stores the result into "result"
          * @param scale defines the scaling factor
          * @param result defines the Color3 object where to store the result
-         * @returns the unmodified current Color3.
+         * @returns the unmodified current Color3
          */
         Color3.prototype.scaleToRef = function (scale, result) {
             result.r = this.r * scale;
@@ -1590,6 +1590,18 @@ var BABYLON;
             return this;
         };
         /**
+         * Scale the current Color3 values by a factor and add the result to a given Color3
+         * @param scale defines the scale factor
+         * @param result defines color to store the result into
+         * @returns the unmodified current Color3
+         */
+        Color3.prototype.scaleAndAddToRef = function (scale, result) {
+            result.r += this.r * scale;
+            result.g += this.g * scale;
+            result.b += this.b * scale;
+            return this;
+        };
+        /**
          * Clamps the rgb values by the min and max values and stores the result into "result"
          * @param min defines minimum clamping value (default is 0)
          * @param max defines maximum clamping value (default is 1)
@@ -1957,7 +1969,7 @@ var BABYLON;
          * Multiplies the current Color4 values by scale and stores the result in "result"
          * @param scale defines the scaling factor to apply
          * @param result defines the Color4 object where to store the result
-         * @returns the current Color4.
+         * @returns the current unmodified Color4
          */
         Color4.prototype.scaleToRef = function (scale, result) {
             result.r = this.r * scale;
@@ -1967,6 +1979,19 @@ var BABYLON;
             return this;
         };
         /**
+         * Scale the current Color4 values by a factor and add the result to a given Color4
+         * @param scale defines the scale factor
+         * @param result defines the Color4 object where to store the result
+         * @returns the unmodified current Color4
+         */
+        Color4.prototype.scaleAndAddToRef = function (scale, result) {
+            result.r += this.r * scale;
+            result.g += this.g * scale;
+            result.b += this.b * scale;
+            result.a += this.a * scale;
+            return this;
+        };
+        /**
          * Clamps the rgb values by the min and max values and stores the result into "result"
          * @param min defines minimum clamping value (default is 0)
          * @param max defines maximum clamping value (default is 1)
@@ -2410,7 +2435,31 @@ var BABYLON;
          * Returns a new Vector2 scaled by "scale" from the current Vector2.
          */
         Vector2.prototype.scale = function (scale) {
-            return new Vector2(this.x * scale, this.y * scale);
+            var result = new Vector2(0, 0);
+            this.scaleToRef(scale, result);
+            return result;
+        };
+        /**
+         * Scale the current Vector2 values by a factor to a given Vector2
+         * @param scale defines the scale factor
+         * @param result defines the Vector2 object where to store the result
+         * @returns the unmodified current Vector2
+         */
+        Vector2.prototype.scaleToRef = function (scale, result) {
+            result.x = this.x * scale;
+            result.y = this.y * scale;
+            return this;
+        };
+        /**
+         * Scale the current Vector2 values by a factor and add the result to a given Vector2
+         * @param scale defines the scale factor
+         * @param result defines the Vector2 object where to store the result
+         * @returns the unmodified current Vector2
+         */
+        Vector2.prototype.scaleAndAddToRef = function (scale, result) {
+            result.x += this.x * scale;
+            result.y += this.y * scale;
+            return this;
         };
         /**
          * Boolean : True if the passed vector coordinates strictly equal the current Vector2 ones.
@@ -2850,6 +2899,18 @@ var BABYLON;
             return this;
         };
         /**
+         * Scale the current Vector3 values by a factor and add the result to a given Vector3
+         * @param scale defines the scale factor
+         * @param result defines the Vector3 object where to store the result
+         * @returns the unmodified current Vector3
+         */
+        Vector3.prototype.scaleAndAddToRef = function (scale, result) {
+            result.x += this.x * scale;
+            result.y += this.y * scale;
+            result.z += this.z * scale;
+            return this;
+        };
+        /**
          * Returns true if the current Vector3 and the passed vector coordinates are strictly equal
          * @param otherVector defines the second operand
          * @returns true if both vectors are equals
@@ -3794,6 +3855,19 @@ var BABYLON;
             return this;
         };
         /**
+         * Scale the current Vector4 values by a factor and add the result to a given Vector4
+         * @param scale defines the scale factor
+         * @param result defines the Vector4 object where to store the result
+         * @returns the unmodified current Vector4
+         */
+        Vector4.prototype.scaleAndAddToRef = function (scale, result) {
+            result.x += this.x * scale;
+            result.y += this.y * scale;
+            result.z += this.z * scale;
+            result.w += this.w * scale;
+            return this;
+        };
+        /**
          * Boolean : True if the current Vector4 coordinates are stricly equal to the passed ones.
          */
         Vector4.prototype.equals = function (otherVector) {
@@ -4320,6 +4394,32 @@ var BABYLON;
             return new Quaternion(this.x * value, this.y * value, this.z * value, this.w * value);
         };
         /**
+         * Scale the current Quaternion values by a factor to a given Quaternion
+         * @param scale defines the scale factor
+         * @param result defines the Quaternion object where to store the result
+         * @returns the unmodified current Quaternion
+         */
+        Quaternion.prototype.scaleToRef = function (scale, result) {
+            result.x = this.x * scale;
+            result.y = this.y * scale;
+            result.z = this.z * scale;
+            result.w = this.w * scale;
+            return this;
+        };
+        /**
+         * Scale the current Quaternion values by a factor and add the result to a given Quaternion
+         * @param scale defines the scale factor
+         * @param result defines the Quaternion object where to store the result
+         * @returns the unmodified current Quaternion
+         */
+        Quaternion.prototype.scaleAndAddToRef = function (scale, result) {
+            result.x += this.x * scale;
+            result.y += this.y * scale;
+            result.z += this.z * scale;
+            result.w += this.w * scale;
+            return this;
+        };
+        /**
          * Returns a new Quaternion set as the quaternion mulplication result of the current one with the passed one "q1".
          */
         Quaternion.prototype.multiply = function (q1) {
@@ -5066,6 +5166,99 @@ var BABYLON;
             return true;
         };
         /**
+         * Returns the index-th row of the current matrix as a new Vector4.
+         */
+        Matrix.prototype.getRow = function (index) {
+            if (index < 0 || index > 3) {
+                return null;
+            }
+            var i = index * 4;
+            return new Vector4(this.m[i + 0], this.m[i + 1], this.m[i + 2], this.m[i + 3]);
+        };
+        /**
+         * Sets the index-th row of the current matrix with the passed Vector4 values.
+         * Returns the updated Matrix.
+         */
+        Matrix.prototype.setRow = function (index, row) {
+            if (index < 0 || index > 3) {
+                return this;
+            }
+            var i = index * 4;
+            this.m[i + 0] = row.x;
+            this.m[i + 1] = row.y;
+            this.m[i + 2] = row.z;
+            this.m[i + 3] = row.w;
+            this._markAsUpdated();
+            return this;
+        };
+        /**
+         * Compute the transpose of the matrix.
+         * Returns a new Matrix.
+         */
+        Matrix.prototype.transpose = function () {
+            return Matrix.Transpose(this);
+        };
+        /**
+         * Compute the transpose of the matrix.
+         * Returns the current matrix.
+         */
+        Matrix.prototype.transposeToRef = function (result) {
+            Matrix.TransposeToRef(this, result);
+            return this;
+        };
+        /**
+         * Sets the index-th row of the current matrix with the passed 4 x float values.
+         * Returns the updated Matrix.
+         */
+        Matrix.prototype.setRowFromFloats = function (index, x, y, z, w) {
+            if (index < 0 || index > 3) {
+                return this;
+            }
+            var i = index * 4;
+            this.m[i + 0] = x;
+            this.m[i + 1] = y;
+            this.m[i + 2] = z;
+            this.m[i + 3] = w;
+            this._markAsUpdated();
+            return this;
+        };
+        /**
+         * Compute a new Matrix set with the current Matrix values multiplied by scale (float)
+         * @param scale defines the scale factor
+         * @returns a new Matrix
+         */
+        Matrix.prototype.scale = function (scale) {
+            var result = new Matrix();
+            this.scaleToRef(scale, result);
+            return result;
+        };
+        /**
+         * Scale the current Matrix values by a factor to a given result Matrix
+         * @param scale defines the scale factor
+         * @param result defines the Matrix to store the result
+         * @returns the current Matrix
+         */
+        Matrix.prototype.scaleToRef = function (scale, result) {
+            for (var index = 0; index < 16; index++) {
+                result.m[index] = this.m[index] * scale;
+            }
+            result._markAsUpdated();
+            return this;
+        };
+        /**
+         * Scale the current Matrix values by a factor and add the result to a given Matrix
+         * @param scale defines the scale factor
+         * @param result defines the Matrix to store the result
+         * @returns the current Matrix
+         */
+        Matrix.prototype.scaleAndAddToRef = function (scale, result) {
+            for (var index = 0; index < 16; index++) {
+                result.m[index] += this.m[index] * scale;
+            }
+            result._markAsUpdated();
+            return this;
+        };
+        /**
          * Writes to the given matrix a normal matrix, computed from this one (using values from identity matrix for fourth row and column).
          * @param ref matrix to store the result
          */
@@ -5150,63 +5343,6 @@ var BABYLON;
             result.m[15] = initialM44;
             result._markAsUpdated();
         };
-        /**
-         * Returns the index-th row of the current matrix as a new Vector4.
-         */
-        Matrix.prototype.getRow = function (index) {
-            if (index < 0 || index > 3) {
-                return null;
-            }
-            var i = index * 4;
-            return new Vector4(this.m[i + 0], this.m[i + 1], this.m[i + 2], this.m[i + 3]);
-        };
-        /**
-         * Sets the index-th row of the current matrix with the passed Vector4 values.
-         * Returns the updated Matrix.
-         */
-        Matrix.prototype.setRow = function (index, row) {
-            if (index < 0 || index > 3) {
-                return this;
-            }
-            var i = index * 4;
-            this.m[i + 0] = row.x;
-            this.m[i + 1] = row.y;
-            this.m[i + 2] = row.z;
-            this.m[i + 3] = row.w;
-            this._markAsUpdated();
-            return this;
-        };
-        /**
-         * Compute the transpose of the matrix.
-         * Returns a new Matrix.
-         */
-        Matrix.prototype.transpose = function () {
-            return Matrix.Transpose(this);
-        };
-        /**
-         * Compute the transpose of the matrix.
-         * Returns the current matrix.
-         */
-        Matrix.prototype.transposeToRef = function (result) {
-            Matrix.TransposeToRef(this, result);
-            return this;
-        };
-        /**
-         * Sets the index-th row of the current matrix with the passed 4 x float values.
-         * Returns the updated Matrix.
-         */
-        Matrix.prototype.setRowFromFloats = function (index, x, y, z, w) {
-            if (index < 0 || index > 3) {
-                return this;
-            }
-            var i = index * 4;
-            this.m[i + 0] = x;
-            this.m[i + 1] = y;
-            this.m[i + 2] = z;
-            this.m[i + 3] = w;
-            this._markAsUpdated();
-            return this;
-        };
         Object.defineProperty(Matrix, "IdentityReadOnly", {
             /**
              * Static identity matrix to be used as readonly matrix
@@ -12499,7 +12635,7 @@ var BABYLON;
             this.applyStates();
             this._drawCalls.addCount(1, false);
             // Render
-            var drawMode = this.DrawMode(fillMode);
+            var drawMode = this._drawMode(fillMode);
             var indexFormat = this._uintIndicesCurrentlySet ? this._gl.UNSIGNED_INT : this._gl.UNSIGNED_SHORT;
             var mult = this._uintIndicesCurrentlySet ? 4 : 2;
             if (instancesCount) {
@@ -12513,7 +12649,7 @@ var BABYLON;
             // Apply states
             this.applyStates();
             this._drawCalls.addCount(1, false);
-            var drawMode = this.DrawMode(fillMode);
+            var drawMode = this._drawMode(fillMode);
             if (instancesCount) {
                 this._gl.drawArraysInstanced(drawMode, verticesStart, verticesCount, instancesCount);
             }
@@ -12521,7 +12657,7 @@ var BABYLON;
                 this._gl.drawArrays(drawMode, verticesStart, verticesCount);
             }
         };
-        Engine.prototype.DrawMode = function (fillMode) {
+        Engine.prototype._drawMode = function (fillMode) {
             switch (fillMode) {
                 // Triangle views
                 case BABYLON.Material.TriangleFillMode:
@@ -15915,10 +16051,10 @@ var BABYLON;
                 this._isReady = false;
                 return;
             }
-            this._isReady = true;
             if (this.onReady) {
                 this.onReady(this);
             }
+            this._isReady = true;
         };
         /**
          * Get an animation by name
@@ -21648,6 +21784,7 @@ var BABYLON;
             this.onRenderingGroupObservable = new BABYLON.Observable();
             // Animations
             this.animations = [];
+            this._registeredForLateAnimationBindings = new BABYLON.SmartArrayNoDuplicate(256);
             /**
              * This observable event is triggered when any ponter event is triggered. It is registered during Scene.attachControl() and it is called BEFORE the 3D engine process anything (mesh/sprite picking for instance).
              * You have the possibility to skip the process and the call to onPointerObservable by setting PointerInfoPre.skipOnPointerObservable to true
@@ -23168,22 +23305,46 @@ var BABYLON;
         // Animations
         /**
          * Will start the animation sequence of a given target
-         * @param target - the target
-         * @param {number} from - from which frame should animation start
-         * @param {number} to - till which frame should animation run.
-         * @param {boolean} [loop] - should the animation loop
-         * @param {number} [speedRatio] - the speed in which to run the animation
-         * @param {Function} [onAnimationEnd] function to be executed when the animation ended.
-         * @param {BABYLON.Animatable} [animatable] an animatable object. If not provided a new one will be created from the given params.
-         * Returns {BABYLON.Animatable} the animatable object created for this animation
-         * See BABYLON.Animatable
-         */
-        Scene.prototype.beginAnimation = function (target, from, to, loop, speedRatio, onAnimationEnd, animatable) {
+         * @param target defines the target
+         * @param from defines from which frame should animation start
+         * @param to defines until which frame should animation run.
+         * @param weight defines the weight to apply to the animation (1.0 by default)
+         * @param loop defines if the animation loops
+         * @param speedRatio defines the speed in which to run the animation (1.0 by default)
+         * @param onAnimationEnd defines the function to be executed when the animation ends
+         * @param animatable defines an animatable object. If not provided a new one will be created from the given params
+         * @returns the animatable object created for this animation
+         * @see BABYLON.Animatable
+         */
+        Scene.prototype.beginWeightedAnimation = function (target, from, to, weight, loop, speedRatio, onAnimationEnd, animatable) {
+            if (weight === void 0) { weight = 1.0; }
             if (speedRatio === void 0) { speedRatio = 1.0; }
+            var returnedAnimatable = this.beginAnimation(target, from, to, loop, speedRatio, onAnimationEnd, animatable, false);
+            returnedAnimatable.weight = weight;
+            return returnedAnimatable;
+        };
+        /**
+         * Will start the animation sequence of a given target
+         * @param target defines the target
+         * @param from defines from which frame should animation start
+         * @param to defines until which frame should animation run.
+         * @param loop defines if the animation loops
+         * @param speedRatio defines the speed in which to run the animation (1.0 by default)
+         * @param onAnimationEnd defines the function to be executed when the animation ends
+         * @param animatable defines an animatable object. If not provided a new one will be created from the given params
+         * @param stopCurrent defines if the current animations must be stopped first (true by default)
+         * @returns the animatable object created for this animation
+         * @see BABYLON.Animatable
+         */
+        Scene.prototype.beginAnimation = function (target, from, to, loop, speedRatio, onAnimationEnd, animatable, stopCurrent) {
+            if (speedRatio === void 0) { speedRatio = 1.0; }
+            if (stopCurrent === void 0) { stopCurrent = true; }
             if (from > to && speedRatio > 0) {
                 speedRatio *= -1;
             }
-            this.stopAnimation(target);
+            if (stopCurrent) {
+                this.stopAnimation(target);
+            }
             if (!animatable) {
                 animatable = new BABYLON.Animatable(this, target, from, to, loop, speedRatio, onAnimationEnd);
             }
@@ -23195,10 +23356,12 @@ var BABYLON;
             if (target.getAnimatables) {
                 var animatables = target.getAnimatables();
                 for (var index = 0; index < animatables.length; index++) {
-                    this.beginAnimation(animatables[index], from, to, loop, speedRatio, onAnimationEnd, animatable);
+                    this.beginAnimation(animatables[index], from, to, loop, speedRatio, onAnimationEnd, animatable, stopCurrent);
                 }
             }
-            animatable.reset();
+            if (stopCurrent) {
+                animatable.reset();
+            }
             return animatable;
         };
         /**
@@ -23296,6 +23459,62 @@ var BABYLON;
             for (var index = 0; index < this._activeAnimatables.length; index++) {
                 this._activeAnimatables[index]._animate(this._animationTime);
             }
+            // Late animation bindings
+            this._processLateAnimationBindings();
+        };
+        /** @ignore */
+        Scene.prototype._registerTargetForLateAnimationBinding = function (runtimeAnimation) {
+            var target = runtimeAnimation.target;
+            this._registeredForLateAnimationBindings.pushNoDuplicate(target);
+            if (!target._lateAnimationHolders) {
+                target._lateAnimationHolders = {};
+            }
+            if (!target._lateAnimationHolders[runtimeAnimation.targetPath]) {
+                target._lateAnimationHolders[runtimeAnimation.targetPath] = {
+                    totalWeight: 0,
+                    animations: []
+                };
+            }
+            target._lateAnimationHolders[runtimeAnimation.targetPath].animations.push(runtimeAnimation);
+            target._lateAnimationHolders[runtimeAnimation.targetPath].totalWeight += runtimeAnimation.weight;
+        };
+        Scene.prototype._processLateAnimationBindings = function () {
+            if (!this._registeredForLateAnimationBindings.length) {
+                return;
+            }
+            for (var index = 0; index < this._registeredForLateAnimationBindings.length; index++) {
+                var target = this._registeredForLateAnimationBindings.data[index];
+                for (var path in target._lateAnimationHolders) {
+                    var holder = target._lateAnimationHolders[path];
+                    // Sanity check
+                    if (!holder.animations[0].originalValue.scaleAndAddToRef) {
+                        continue;
+                    }
+                    var normalizer = 1.0;
+                    var finalValue = void 0;
+                    if (holder.totalWeight < 1.0) {
+                        // We need to mix the original value in
+                        var originalValue = holder.animations[0].originalValue;
+                        finalValue = originalValue.scale(1.0 - holder.totalWeight);
+                    }
+                    else {
+                        // We need to normalize the weights
+                        normalizer = holder.totalWeight;
+                    }
+                    for (var animIndex = 0; animIndex < holder.animations.length; animIndex++) {
+                        var runtimeAnimation = holder.animations[animIndex];
+                        if (finalValue) {
+                            runtimeAnimation.currentValue.scaleAndAddToRef(runtimeAnimation.weight / normalizer, finalValue);
+                        }
+                        else {
+                            finalValue = runtimeAnimation.currentValue.scale(runtimeAnimation.weight / normalizer);
+                        }
+                    }
+                    runtimeAnimation.target[path] = finalValue;
+                }
+                target._lateAnimationHolders = {};
+            }
+            this._registeredForLateAnimationBindings.reset();
         };
         // Matrix
         Scene.prototype._switchToAlternateCameraConfiguration = function (active) {
@@ -24925,6 +25144,7 @@ var BABYLON;
             this._activeSkeletons.dispose();
             this._softwareSkinnedMeshes.dispose();
             this._renderTargets.dispose();
+            this._registeredForLateAnimationBindings.dispose();
             if (this._boundingBoxRenderer) {
                 this._boundingBoxRenderer.dispose();
             }
@@ -46153,7 +46373,7 @@ var BABYLON;
         function DirectionalLight(name, direction, scene) {
             var _this = _super.call(this, name, scene) || this;
             _this._shadowFrustumSize = 0;
-            _this._shadowOrthoScale = 0.5;
+            _this._shadowOrthoScale = 0.1;
             /**
              * Automatically compute the projection matrix to best fit (including all the casters)
              * on each frame.
@@ -47568,16 +47788,74 @@ var BABYLON;
 var BABYLON;
 (function (BABYLON) {
     var RuntimeAnimation = /** @class */ (function () {
-        function RuntimeAnimation(target, animation) {
+        /**
+         * Create a new RuntimeAnimation object
+         * @param target defines the target of the animation
+         * @param animation defines the source {BABYLON.Animation} object
+         * @param scene defines the hosting scene
+         */
+        function RuntimeAnimation(target, animation, scene) {
             this._offsetsCache = {};
             this._highLimitsCache = {};
             this._stopped = false;
             this._blendingFactor = 0;
+            this._weight = 1.0;
             this._ratioOffset = 0;
             this._animation = animation;
             this._target = target;
+            this._scene = scene;
             animation._runtimeAnimations.push(this);
         }
+        Object.defineProperty(RuntimeAnimation.prototype, "weight", {
+            /**
+             * Gets the weight of the runtime animation
+             */
+            get: function () {
+                return this._weight;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Object.defineProperty(RuntimeAnimation.prototype, "originalValue", {
+            /**
+             * Gets the original value of the runtime animation
+             */
+            get: function () {
+                return this._originalValue;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Object.defineProperty(RuntimeAnimation.prototype, "currentValue", {
+            /**
+             * Gets the current value of the runtime animation
+             */
+            get: function () {
+                return this._currentValue;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Object.defineProperty(RuntimeAnimation.prototype, "targetPath", {
+            /**
+             * Gets the path where to store the animated value in the target
+             */
+            get: function () {
+                return this._targetPath;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Object.defineProperty(RuntimeAnimation.prototype, "target", {
+            /**
+             * Gets the actual target of the runtime animation
+             */
+            get: function () {
+                return this._activeTarget;
+            },
+            enumerable: true,
+            configurable: true
+        });
         Object.defineProperty(RuntimeAnimation.prototype, "animation", {
             get: function () {
                 return this._animation;
@@ -47590,7 +47868,7 @@ var BABYLON;
             this._highLimitsCache = {};
             this.currentFrame = 0;
             this._blendingFactor = 0;
-            this._originalBlendValue = null;
+            this._originalValue = null;
         };
         RuntimeAnimation.prototype.isStopped = function () {
             return this._stopped;
@@ -47718,8 +47996,13 @@ var BABYLON;
             }
             return this._getKeyValue(keys[keys.length - 1].value);
         };
-        RuntimeAnimation.prototype.setValue = function (currentValue, blend) {
-            if (blend === void 0) { blend = false; }
+        /**
+         * Affect the interpolated value to the target
+         * @param currentValue defines the value computed by the animation
+         * @param weight defines the weight to apply to this value
+         */
+        RuntimeAnimation.prototype.setValue = function (currentValue, weight) {
+            if (weight === void 0) { weight = 1.0; }
             // Set value
             var path;
             var destination;
@@ -47729,43 +48012,62 @@ var BABYLON;
                 for (var index = 1; index < targetPropertyPath.length - 1; index++) {
                     property = property[targetPropertyPath[index]];
                 }
-                path = targetPropertyPath[targetPropertyPath.length - 1];
+                path = [targetPropertyPath.length - 1];
                 destination = property;
             }
             else {
                 path = targetPropertyPath[0];
                 destination = this._target;
             }
+            this._targetPath = path;
+            this._activeTarget = destination;
+            this._weight = weight;
             // Blending
             var enableBlending = this._target && this._target.animationPropertiesOverride ? this._target.animationPropertiesOverride.enableBlending : this._animation.enableBlending;
             var blendingSpeed = this._target && this._target.animationPropertiesOverride ? this._target.animationPropertiesOverride.blendingSpeed : this._animation.blendingSpeed;
-            if (enableBlending && this._blendingFactor <= 1.0) {
-                if (!this._originalBlendValue) {
-                    if (destination[path].clone) {
-                        this._originalBlendValue = destination[path].clone();
+            if (enableBlending && this._blendingFactor <= 1.0 || weight !== -1.0) {
+                if (!this._originalValue) {
+                    var originalValue = void 0;
+                    if (destination.getRestPose) {
+                        originalValue = destination.getRestPose();
                     }
                     else {
-                        this._originalBlendValue = destination[path];
+                        originalValue = destination[path];
+                    }
+                    if (originalValue.clone) {
+                        this._originalValue = originalValue.clone();
+                    }
+                    else {
+                        this._originalValue = originalValue;
                     }
                 }
-                if (this._originalBlendValue.prototype) {
-                    if (this._originalBlendValue.prototype.Lerp) {
-                        destination[path] = this._originalBlendValue.construtor.prototype.Lerp(currentValue, this._originalBlendValue, this._blendingFactor);
+            }
+            if (enableBlending && this._blendingFactor <= 1.0) {
+                if (this._originalValue.prototype) {
+                    if (this._originalValue.prototype.Lerp) {
+                        this._currentValue = this._originalValue.construtor.prototype.Lerp(currentValue, this._originalValue, this._blendingFactor);
                     }
                     else {
-                        destination[path] = currentValue;
+                        this._currentValue = currentValue;
                     }
                 }
-                else if (this._originalBlendValue.m) {
-                    destination[path] = BABYLON.Matrix.Lerp(this._originalBlendValue, currentValue, this._blendingFactor);
+                else if (this._originalValue.m) {
+                    this._currentValue = BABYLON.Matrix.Lerp(this._originalValue, currentValue, this._blendingFactor);
                 }
                 else {
-                    destination[path] = this._originalBlendValue * (1.0 - this._blendingFactor) + this._blendingFactor * currentValue;
+                    this._currentValue = this._originalValue * (1.0 - this._blendingFactor) + this._blendingFactor * currentValue;
                 }
                 this._blendingFactor += blendingSpeed;
+                destination[path] = this._currentValue;
             }
             else {
-                destination[path] = currentValue;
+                this._currentValue = currentValue;
+                if (weight !== -1.0) {
+                    this._scene._registerTargetForLateAnimationBinding(this);
+                }
+                else {
+                    destination[path] = this._currentValue;
+                }
             }
             if (this._target.markAsDirty) {
                 this._target.markAsDirty(this._animation.targetProperty);
@@ -47777,6 +48079,10 @@ var BABYLON;
             }
             return this._animation.loopMode;
         };
+        /**
+         * Move the current animation to a given frame
+         * @param frame defines the frame to move to
+         */
         RuntimeAnimation.prototype.goToFrame = function (frame) {
             var keys = this._animation.getKeys();
             if (frame < keys[0].frame) {
@@ -47786,14 +48092,24 @@ var BABYLON;
                 frame = keys[keys.length - 1].frame;
             }
             var currentValue = this._interpolate(frame, 0, this._getCorrectLoopMode());
-            this.setValue(currentValue);
+            this.setValue(currentValue, -1);
         };
         RuntimeAnimation.prototype._prepareForSpeedRatioChange = function (newSpeedRatio) {
             var newRatio = this._previousDelay * (this._animation.framePerSecond * newSpeedRatio) / 1000.0;
             this._ratioOffset = this._previousRatio - newRatio;
         };
-        RuntimeAnimation.prototype.animate = function (delay, from, to, loop, speedRatio, blend) {
-            if (blend === void 0) { blend = false; }
+        /**
+         * Execute the current animation
+         * @param delay defines the delay to add to the current frame
+         * @param from defines the lower bound of the animation range
+         * @param to defines the upper bound of the animation range
+         * @param loop defines if the current animation must loop
+         * @param speedRatio defines the current speed ratio
+         * @param weight defines the weight of the animation (default is -1 so no weight)
+         * @returns a boolean indicating if the animation has ended
+         */
+        RuntimeAnimation.prototype.animate = function (delay, from, to, loop, speedRatio, weight) {
+            if (weight === void 0) { weight = -1.0; }
             var targetPropertyPath = this._animation.targetPropertyPath;
             if (!targetPropertyPath || targetPropertyPath.length < 1) {
                 this._stopped = true;
@@ -47903,7 +48219,7 @@ var BABYLON;
             var currentFrame = returnValue ? from + ratio % range : to;
             var currentValue = this._interpolate(currentFrame, repeatCount, this._getCorrectLoopMode(), offsetValue, highLimitValue);
             // Set value
-            this.setValue(currentValue);
+            this.setValue(currentValue, weight);
             // Check events
             var events = this._animation.getEvents();
             for (var index = 0; index < events.length; index++) {
@@ -47957,6 +48273,7 @@ var BABYLON;
             this._runtimeAnimations = new Array();
             this._paused = false;
             this._speedRatio = 1;
+            this._weight = -1.0;
             this.animationStarted = false;
             if (animations) {
                 this.appendAnimations(target, animations);
@@ -47965,7 +48282,28 @@ var BABYLON;
             this._scene = scene;
             scene._activeAnimatables.push(this);
         }
+        Object.defineProperty(Animatable.prototype, "weight", {
+            /**
+             * Gets or sets the animatable weight (-1.0 by default meaning not weighted)
+             */
+            get: function () {
+                return this._weight;
+            },
+            set: function (value) {
+                if (value === -1) {
+                    this._weight = -1;
+                    return;
+                }
+                // Else weight must be in [0, 1] range
+                this._weight = Math.min(Math.max(value, 0), 1.0);
+            },
+            enumerable: true,
+            configurable: true
+        });
         Object.defineProperty(Animatable.prototype, "speedRatio", {
+            /**
+             * Gets or sets the speed ratio to apply to the animatable (1.0 by default)
+             */
             get: function () {
                 return this._speedRatio;
             },
@@ -47986,7 +48324,7 @@ var BABYLON;
         Animatable.prototype.appendAnimations = function (target, animations) {
             for (var index = 0; index < animations.length; index++) {
                 var animation = animations[index];
-                this._runtimeAnimations.push(new BABYLON.RuntimeAnimation(target, animation));
+                this._runtimeAnimations.push(new BABYLON.RuntimeAnimation(target, animation, this._scene));
             }
         };
         Animatable.prototype.getAnimationByTargetProperty = function (property) {
@@ -48114,7 +48452,7 @@ var BABYLON;
             var index;
             for (index = 0; index < runtimeAnimations.length; index++) {
                 var animation = runtimeAnimations[index];
-                var isRunning = animation.animate(delay - this._localDelayOffset, this.fromFrame, this.toFrame, this.loopAnimation, this._speedRatio);
+                var isRunning = animation.animate(delay - this._localDelayOffset, this.fromFrame, this.toFrame, this.loopAnimation, this._speedRatio, this._weight);
                 running = running || isRunning;
             }
             this.animationStarted = running;
@@ -56052,11 +56390,11 @@ var BABYLON;
                     buffer: buffer, bufferWidth: bufferWidth, bufferHeight: bufferHeight
                 });
                 vertexData.applyToMesh(ground, updatable);
-                ground._setReady(true);
                 //execute ready callback, if set
                 if (onReady) {
                     onReady(ground);
                 }
+                ground._setReady(true);
             };
             BABYLON.Tools.LoadImage(url, onload, function () { }, scene.database);
             return ground;

+ 443 - 105
dist/preview release/customConfigurations/minimalGLTFViewer/es6.js

@@ -1545,7 +1545,7 @@ var BABYLON;
         /**
          * Multiplies in place each rgb value by scale
          * @param scale defines the scaling factor
-         * @returns the updated Color3.
+         * @returns the updated Color3
          */
         Color3.prototype.scale = function (scale) {
             return new Color3(this.r * scale, this.g * scale, this.b * scale);
@@ -1554,7 +1554,7 @@ var BABYLON;
          * Multiplies the rgb values by scale and stores the result into "result"
          * @param scale defines the scaling factor
          * @param result defines the Color3 object where to store the result
-         * @returns the unmodified current Color3.
+         * @returns the unmodified current Color3
          */
         Color3.prototype.scaleToRef = function (scale, result) {
             result.r = this.r * scale;
@@ -1563,6 +1563,18 @@ var BABYLON;
             return this;
         };
         /**
+         * Scale the current Color3 values by a factor and add the result to a given Color3
+         * @param scale defines the scale factor
+         * @param result defines color to store the result into
+         * @returns the unmodified current Color3
+         */
+        Color3.prototype.scaleAndAddToRef = function (scale, result) {
+            result.r += this.r * scale;
+            result.g += this.g * scale;
+            result.b += this.b * scale;
+            return this;
+        };
+        /**
          * Clamps the rgb values by the min and max values and stores the result into "result"
          * @param min defines minimum clamping value (default is 0)
          * @param max defines maximum clamping value (default is 1)
@@ -1930,7 +1942,7 @@ var BABYLON;
          * Multiplies the current Color4 values by scale and stores the result in "result"
          * @param scale defines the scaling factor to apply
          * @param result defines the Color4 object where to store the result
-         * @returns the current Color4.
+         * @returns the current unmodified Color4
          */
         Color4.prototype.scaleToRef = function (scale, result) {
             result.r = this.r * scale;
@@ -1940,6 +1952,19 @@ var BABYLON;
             return this;
         };
         /**
+         * Scale the current Color4 values by a factor and add the result to a given Color4
+         * @param scale defines the scale factor
+         * @param result defines the Color4 object where to store the result
+         * @returns the unmodified current Color4
+         */
+        Color4.prototype.scaleAndAddToRef = function (scale, result) {
+            result.r += this.r * scale;
+            result.g += this.g * scale;
+            result.b += this.b * scale;
+            result.a += this.a * scale;
+            return this;
+        };
+        /**
          * Clamps the rgb values by the min and max values and stores the result into "result"
          * @param min defines minimum clamping value (default is 0)
          * @param max defines maximum clamping value (default is 1)
@@ -2383,7 +2408,31 @@ var BABYLON;
          * Returns a new Vector2 scaled by "scale" from the current Vector2.
          */
         Vector2.prototype.scale = function (scale) {
-            return new Vector2(this.x * scale, this.y * scale);
+            var result = new Vector2(0, 0);
+            this.scaleToRef(scale, result);
+            return result;
+        };
+        /**
+         * Scale the current Vector2 values by a factor to a given Vector2
+         * @param scale defines the scale factor
+         * @param result defines the Vector2 object where to store the result
+         * @returns the unmodified current Vector2
+         */
+        Vector2.prototype.scaleToRef = function (scale, result) {
+            result.x = this.x * scale;
+            result.y = this.y * scale;
+            return this;
+        };
+        /**
+         * Scale the current Vector2 values by a factor and add the result to a given Vector2
+         * @param scale defines the scale factor
+         * @param result defines the Vector2 object where to store the result
+         * @returns the unmodified current Vector2
+         */
+        Vector2.prototype.scaleAndAddToRef = function (scale, result) {
+            result.x += this.x * scale;
+            result.y += this.y * scale;
+            return this;
         };
         /**
          * Boolean : True if the passed vector coordinates strictly equal the current Vector2 ones.
@@ -2823,6 +2872,18 @@ var BABYLON;
             return this;
         };
         /**
+         * Scale the current Vector3 values by a factor and add the result to a given Vector3
+         * @param scale defines the scale factor
+         * @param result defines the Vector3 object where to store the result
+         * @returns the unmodified current Vector3
+         */
+        Vector3.prototype.scaleAndAddToRef = function (scale, result) {
+            result.x += this.x * scale;
+            result.y += this.y * scale;
+            result.z += this.z * scale;
+            return this;
+        };
+        /**
          * Returns true if the current Vector3 and the passed vector coordinates are strictly equal
          * @param otherVector defines the second operand
          * @returns true if both vectors are equals
@@ -3767,6 +3828,19 @@ var BABYLON;
             return this;
         };
         /**
+         * Scale the current Vector4 values by a factor and add the result to a given Vector4
+         * @param scale defines the scale factor
+         * @param result defines the Vector4 object where to store the result
+         * @returns the unmodified current Vector4
+         */
+        Vector4.prototype.scaleAndAddToRef = function (scale, result) {
+            result.x += this.x * scale;
+            result.y += this.y * scale;
+            result.z += this.z * scale;
+            result.w += this.w * scale;
+            return this;
+        };
+        /**
          * Boolean : True if the current Vector4 coordinates are stricly equal to the passed ones.
          */
         Vector4.prototype.equals = function (otherVector) {
@@ -4293,6 +4367,32 @@ var BABYLON;
             return new Quaternion(this.x * value, this.y * value, this.z * value, this.w * value);
         };
         /**
+         * Scale the current Quaternion values by a factor to a given Quaternion
+         * @param scale defines the scale factor
+         * @param result defines the Quaternion object where to store the result
+         * @returns the unmodified current Quaternion
+         */
+        Quaternion.prototype.scaleToRef = function (scale, result) {
+            result.x = this.x * scale;
+            result.y = this.y * scale;
+            result.z = this.z * scale;
+            result.w = this.w * scale;
+            return this;
+        };
+        /**
+         * Scale the current Quaternion values by a factor and add the result to a given Quaternion
+         * @param scale defines the scale factor
+         * @param result defines the Quaternion object where to store the result
+         * @returns the unmodified current Quaternion
+         */
+        Quaternion.prototype.scaleAndAddToRef = function (scale, result) {
+            result.x += this.x * scale;
+            result.y += this.y * scale;
+            result.z += this.z * scale;
+            result.w += this.w * scale;
+            return this;
+        };
+        /**
          * Returns a new Quaternion set as the quaternion mulplication result of the current one with the passed one "q1".
          */
         Quaternion.prototype.multiply = function (q1) {
@@ -5039,6 +5139,99 @@ var BABYLON;
             return true;
         };
         /**
+         * Returns the index-th row of the current matrix as a new Vector4.
+         */
+        Matrix.prototype.getRow = function (index) {
+            if (index < 0 || index > 3) {
+                return null;
+            }
+            var i = index * 4;
+            return new Vector4(this.m[i + 0], this.m[i + 1], this.m[i + 2], this.m[i + 3]);
+        };
+        /**
+         * Sets the index-th row of the current matrix with the passed Vector4 values.
+         * Returns the updated Matrix.
+         */
+        Matrix.prototype.setRow = function (index, row) {
+            if (index < 0 || index > 3) {
+                return this;
+            }
+            var i = index * 4;
+            this.m[i + 0] = row.x;
+            this.m[i + 1] = row.y;
+            this.m[i + 2] = row.z;
+            this.m[i + 3] = row.w;
+            this._markAsUpdated();
+            return this;
+        };
+        /**
+         * Compute the transpose of the matrix.
+         * Returns a new Matrix.
+         */
+        Matrix.prototype.transpose = function () {
+            return Matrix.Transpose(this);
+        };
+        /**
+         * Compute the transpose of the matrix.
+         * Returns the current matrix.
+         */
+        Matrix.prototype.transposeToRef = function (result) {
+            Matrix.TransposeToRef(this, result);
+            return this;
+        };
+        /**
+         * Sets the index-th row of the current matrix with the passed 4 x float values.
+         * Returns the updated Matrix.
+         */
+        Matrix.prototype.setRowFromFloats = function (index, x, y, z, w) {
+            if (index < 0 || index > 3) {
+                return this;
+            }
+            var i = index * 4;
+            this.m[i + 0] = x;
+            this.m[i + 1] = y;
+            this.m[i + 2] = z;
+            this.m[i + 3] = w;
+            this._markAsUpdated();
+            return this;
+        };
+        /**
+         * Compute a new Matrix set with the current Matrix values multiplied by scale (float)
+         * @param scale defines the scale factor
+         * @returns a new Matrix
+         */
+        Matrix.prototype.scale = function (scale) {
+            var result = new Matrix();
+            this.scaleToRef(scale, result);
+            return result;
+        };
+        /**
+         * Scale the current Matrix values by a factor to a given result Matrix
+         * @param scale defines the scale factor
+         * @param result defines the Matrix to store the result
+         * @returns the current Matrix
+         */
+        Matrix.prototype.scaleToRef = function (scale, result) {
+            for (var index = 0; index < 16; index++) {
+                result.m[index] = this.m[index] * scale;
+            }
+            result._markAsUpdated();
+            return this;
+        };
+        /**
+         * Scale the current Matrix values by a factor and add the result to a given Matrix
+         * @param scale defines the scale factor
+         * @param result defines the Matrix to store the result
+         * @returns the current Matrix
+         */
+        Matrix.prototype.scaleAndAddToRef = function (scale, result) {
+            for (var index = 0; index < 16; index++) {
+                result.m[index] += this.m[index] * scale;
+            }
+            result._markAsUpdated();
+            return this;
+        };
+        /**
          * Writes to the given matrix a normal matrix, computed from this one (using values from identity matrix for fourth row and column).
          * @param ref matrix to store the result
          */
@@ -5123,63 +5316,6 @@ var BABYLON;
             result.m[15] = initialM44;
             result._markAsUpdated();
         };
-        /**
-         * Returns the index-th row of the current matrix as a new Vector4.
-         */
-        Matrix.prototype.getRow = function (index) {
-            if (index < 0 || index > 3) {
-                return null;
-            }
-            var i = index * 4;
-            return new Vector4(this.m[i + 0], this.m[i + 1], this.m[i + 2], this.m[i + 3]);
-        };
-        /**
-         * Sets the index-th row of the current matrix with the passed Vector4 values.
-         * Returns the updated Matrix.
-         */
-        Matrix.prototype.setRow = function (index, row) {
-            if (index < 0 || index > 3) {
-                return this;
-            }
-            var i = index * 4;
-            this.m[i + 0] = row.x;
-            this.m[i + 1] = row.y;
-            this.m[i + 2] = row.z;
-            this.m[i + 3] = row.w;
-            this._markAsUpdated();
-            return this;
-        };
-        /**
-         * Compute the transpose of the matrix.
-         * Returns a new Matrix.
-         */
-        Matrix.prototype.transpose = function () {
-            return Matrix.Transpose(this);
-        };
-        /**
-         * Compute the transpose of the matrix.
-         * Returns the current matrix.
-         */
-        Matrix.prototype.transposeToRef = function (result) {
-            Matrix.TransposeToRef(this, result);
-            return this;
-        };
-        /**
-         * Sets the index-th row of the current matrix with the passed 4 x float values.
-         * Returns the updated Matrix.
-         */
-        Matrix.prototype.setRowFromFloats = function (index, x, y, z, w) {
-            if (index < 0 || index > 3) {
-                return this;
-            }
-            var i = index * 4;
-            this.m[i + 0] = x;
-            this.m[i + 1] = y;
-            this.m[i + 2] = z;
-            this.m[i + 3] = w;
-            this._markAsUpdated();
-            return this;
-        };
         Object.defineProperty(Matrix, "IdentityReadOnly", {
             /**
              * Static identity matrix to be used as readonly matrix
@@ -12472,7 +12608,7 @@ var BABYLON;
             this.applyStates();
             this._drawCalls.addCount(1, false);
             // Render
-            var drawMode = this.DrawMode(fillMode);
+            var drawMode = this._drawMode(fillMode);
             var indexFormat = this._uintIndicesCurrentlySet ? this._gl.UNSIGNED_INT : this._gl.UNSIGNED_SHORT;
             var mult = this._uintIndicesCurrentlySet ? 4 : 2;
             if (instancesCount) {
@@ -12486,7 +12622,7 @@ var BABYLON;
             // Apply states
             this.applyStates();
             this._drawCalls.addCount(1, false);
-            var drawMode = this.DrawMode(fillMode);
+            var drawMode = this._drawMode(fillMode);
             if (instancesCount) {
                 this._gl.drawArraysInstanced(drawMode, verticesStart, verticesCount, instancesCount);
             }
@@ -12494,7 +12630,7 @@ var BABYLON;
                 this._gl.drawArrays(drawMode, verticesStart, verticesCount);
             }
         };
-        Engine.prototype.DrawMode = function (fillMode) {
+        Engine.prototype._drawMode = function (fillMode) {
             switch (fillMode) {
                 // Triangle views
                 case BABYLON.Material.TriangleFillMode:
@@ -15888,10 +16024,10 @@ var BABYLON;
                 this._isReady = false;
                 return;
             }
-            this._isReady = true;
             if (this.onReady) {
                 this.onReady(this);
             }
+            this._isReady = true;
         };
         /**
          * Get an animation by name
@@ -21621,6 +21757,7 @@ var BABYLON;
             this.onRenderingGroupObservable = new BABYLON.Observable();
             // Animations
             this.animations = [];
+            this._registeredForLateAnimationBindings = new BABYLON.SmartArrayNoDuplicate(256);
             /**
              * This observable event is triggered when any ponter event is triggered. It is registered during Scene.attachControl() and it is called BEFORE the 3D engine process anything (mesh/sprite picking for instance).
              * You have the possibility to skip the process and the call to onPointerObservable by setting PointerInfoPre.skipOnPointerObservable to true
@@ -23141,22 +23278,46 @@ var BABYLON;
         // Animations
         /**
          * Will start the animation sequence of a given target
-         * @param target - the target
-         * @param {number} from - from which frame should animation start
-         * @param {number} to - till which frame should animation run.
-         * @param {boolean} [loop] - should the animation loop
-         * @param {number} [speedRatio] - the speed in which to run the animation
-         * @param {Function} [onAnimationEnd] function to be executed when the animation ended.
-         * @param {BABYLON.Animatable} [animatable] an animatable object. If not provided a new one will be created from the given params.
-         * Returns {BABYLON.Animatable} the animatable object created for this animation
-         * See BABYLON.Animatable
-         */
-        Scene.prototype.beginAnimation = function (target, from, to, loop, speedRatio, onAnimationEnd, animatable) {
+         * @param target defines the target
+         * @param from defines from which frame should animation start
+         * @param to defines until which frame should animation run.
+         * @param weight defines the weight to apply to the animation (1.0 by default)
+         * @param loop defines if the animation loops
+         * @param speedRatio defines the speed in which to run the animation (1.0 by default)
+         * @param onAnimationEnd defines the function to be executed when the animation ends
+         * @param animatable defines an animatable object. If not provided a new one will be created from the given params
+         * @returns the animatable object created for this animation
+         * @see BABYLON.Animatable
+         */
+        Scene.prototype.beginWeightedAnimation = function (target, from, to, weight, loop, speedRatio, onAnimationEnd, animatable) {
+            if (weight === void 0) { weight = 1.0; }
             if (speedRatio === void 0) { speedRatio = 1.0; }
+            var returnedAnimatable = this.beginAnimation(target, from, to, loop, speedRatio, onAnimationEnd, animatable, false);
+            returnedAnimatable.weight = weight;
+            return returnedAnimatable;
+        };
+        /**
+         * Will start the animation sequence of a given target
+         * @param target defines the target
+         * @param from defines from which frame should animation start
+         * @param to defines until which frame should animation run.
+         * @param loop defines if the animation loops
+         * @param speedRatio defines the speed in which to run the animation (1.0 by default)
+         * @param onAnimationEnd defines the function to be executed when the animation ends
+         * @param animatable defines an animatable object. If not provided a new one will be created from the given params
+         * @param stopCurrent defines if the current animations must be stopped first (true by default)
+         * @returns the animatable object created for this animation
+         * @see BABYLON.Animatable
+         */
+        Scene.prototype.beginAnimation = function (target, from, to, loop, speedRatio, onAnimationEnd, animatable, stopCurrent) {
+            if (speedRatio === void 0) { speedRatio = 1.0; }
+            if (stopCurrent === void 0) { stopCurrent = true; }
             if (from > to && speedRatio > 0) {
                 speedRatio *= -1;
             }
-            this.stopAnimation(target);
+            if (stopCurrent) {
+                this.stopAnimation(target);
+            }
             if (!animatable) {
                 animatable = new BABYLON.Animatable(this, target, from, to, loop, speedRatio, onAnimationEnd);
             }
@@ -23168,10 +23329,12 @@ var BABYLON;
             if (target.getAnimatables) {
                 var animatables = target.getAnimatables();
                 for (var index = 0; index < animatables.length; index++) {
-                    this.beginAnimation(animatables[index], from, to, loop, speedRatio, onAnimationEnd, animatable);
+                    this.beginAnimation(animatables[index], from, to, loop, speedRatio, onAnimationEnd, animatable, stopCurrent);
                 }
             }
-            animatable.reset();
+            if (stopCurrent) {
+                animatable.reset();
+            }
             return animatable;
         };
         /**
@@ -23269,6 +23432,62 @@ var BABYLON;
             for (var index = 0; index < this._activeAnimatables.length; index++) {
                 this._activeAnimatables[index]._animate(this._animationTime);
             }
+            // Late animation bindings
+            this._processLateAnimationBindings();
+        };
+        /** @ignore */
+        Scene.prototype._registerTargetForLateAnimationBinding = function (runtimeAnimation) {
+            var target = runtimeAnimation.target;
+            this._registeredForLateAnimationBindings.pushNoDuplicate(target);
+            if (!target._lateAnimationHolders) {
+                target._lateAnimationHolders = {};
+            }
+            if (!target._lateAnimationHolders[runtimeAnimation.targetPath]) {
+                target._lateAnimationHolders[runtimeAnimation.targetPath] = {
+                    totalWeight: 0,
+                    animations: []
+                };
+            }
+            target._lateAnimationHolders[runtimeAnimation.targetPath].animations.push(runtimeAnimation);
+            target._lateAnimationHolders[runtimeAnimation.targetPath].totalWeight += runtimeAnimation.weight;
+        };
+        Scene.prototype._processLateAnimationBindings = function () {
+            if (!this._registeredForLateAnimationBindings.length) {
+                return;
+            }
+            for (var index = 0; index < this._registeredForLateAnimationBindings.length; index++) {
+                var target = this._registeredForLateAnimationBindings.data[index];
+                for (var path in target._lateAnimationHolders) {
+                    var holder = target._lateAnimationHolders[path];
+                    // Sanity check
+                    if (!holder.animations[0].originalValue.scaleAndAddToRef) {
+                        continue;
+                    }
+                    var normalizer = 1.0;
+                    var finalValue = void 0;
+                    if (holder.totalWeight < 1.0) {
+                        // We need to mix the original value in
+                        var originalValue = holder.animations[0].originalValue;
+                        finalValue = originalValue.scale(1.0 - holder.totalWeight);
+                    }
+                    else {
+                        // We need to normalize the weights
+                        normalizer = holder.totalWeight;
+                    }
+                    for (var animIndex = 0; animIndex < holder.animations.length; animIndex++) {
+                        var runtimeAnimation = holder.animations[animIndex];
+                        if (finalValue) {
+                            runtimeAnimation.currentValue.scaleAndAddToRef(runtimeAnimation.weight / normalizer, finalValue);
+                        }
+                        else {
+                            finalValue = runtimeAnimation.currentValue.scale(runtimeAnimation.weight / normalizer);
+                        }
+                    }
+                    runtimeAnimation.target[path] = finalValue;
+                }
+                target._lateAnimationHolders = {};
+            }
+            this._registeredForLateAnimationBindings.reset();
         };
         // Matrix
         Scene.prototype._switchToAlternateCameraConfiguration = function (active) {
@@ -24898,6 +25117,7 @@ var BABYLON;
             this._activeSkeletons.dispose();
             this._softwareSkinnedMeshes.dispose();
             this._renderTargets.dispose();
+            this._registeredForLateAnimationBindings.dispose();
             if (this._boundingBoxRenderer) {
                 this._boundingBoxRenderer.dispose();
             }
@@ -46126,7 +46346,7 @@ var BABYLON;
         function DirectionalLight(name, direction, scene) {
             var _this = _super.call(this, name, scene) || this;
             _this._shadowFrustumSize = 0;
-            _this._shadowOrthoScale = 0.5;
+            _this._shadowOrthoScale = 0.1;
             /**
              * Automatically compute the projection matrix to best fit (including all the casters)
              * on each frame.
@@ -47541,16 +47761,74 @@ var BABYLON;
 var BABYLON;
 (function (BABYLON) {
     var RuntimeAnimation = /** @class */ (function () {
-        function RuntimeAnimation(target, animation) {
+        /**
+         * Create a new RuntimeAnimation object
+         * @param target defines the target of the animation
+         * @param animation defines the source {BABYLON.Animation} object
+         * @param scene defines the hosting scene
+         */
+        function RuntimeAnimation(target, animation, scene) {
             this._offsetsCache = {};
             this._highLimitsCache = {};
             this._stopped = false;
             this._blendingFactor = 0;
+            this._weight = 1.0;
             this._ratioOffset = 0;
             this._animation = animation;
             this._target = target;
+            this._scene = scene;
             animation._runtimeAnimations.push(this);
         }
+        Object.defineProperty(RuntimeAnimation.prototype, "weight", {
+            /**
+             * Gets the weight of the runtime animation
+             */
+            get: function () {
+                return this._weight;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Object.defineProperty(RuntimeAnimation.prototype, "originalValue", {
+            /**
+             * Gets the original value of the runtime animation
+             */
+            get: function () {
+                return this._originalValue;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Object.defineProperty(RuntimeAnimation.prototype, "currentValue", {
+            /**
+             * Gets the current value of the runtime animation
+             */
+            get: function () {
+                return this._currentValue;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Object.defineProperty(RuntimeAnimation.prototype, "targetPath", {
+            /**
+             * Gets the path where to store the animated value in the target
+             */
+            get: function () {
+                return this._targetPath;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Object.defineProperty(RuntimeAnimation.prototype, "target", {
+            /**
+             * Gets the actual target of the runtime animation
+             */
+            get: function () {
+                return this._activeTarget;
+            },
+            enumerable: true,
+            configurable: true
+        });
         Object.defineProperty(RuntimeAnimation.prototype, "animation", {
             get: function () {
                 return this._animation;
@@ -47563,7 +47841,7 @@ var BABYLON;
             this._highLimitsCache = {};
             this.currentFrame = 0;
             this._blendingFactor = 0;
-            this._originalBlendValue = null;
+            this._originalValue = null;
         };
         RuntimeAnimation.prototype.isStopped = function () {
             return this._stopped;
@@ -47691,8 +47969,13 @@ var BABYLON;
             }
             return this._getKeyValue(keys[keys.length - 1].value);
         };
-        RuntimeAnimation.prototype.setValue = function (currentValue, blend) {
-            if (blend === void 0) { blend = false; }
+        /**
+         * Affect the interpolated value to the target
+         * @param currentValue defines the value computed by the animation
+         * @param weight defines the weight to apply to this value
+         */
+        RuntimeAnimation.prototype.setValue = function (currentValue, weight) {
+            if (weight === void 0) { weight = 1.0; }
             // Set value
             var path;
             var destination;
@@ -47702,43 +47985,62 @@ var BABYLON;
                 for (var index = 1; index < targetPropertyPath.length - 1; index++) {
                     property = property[targetPropertyPath[index]];
                 }
-                path = targetPropertyPath[targetPropertyPath.length - 1];
+                path = [targetPropertyPath.length - 1];
                 destination = property;
             }
             else {
                 path = targetPropertyPath[0];
                 destination = this._target;
             }
+            this._targetPath = path;
+            this._activeTarget = destination;
+            this._weight = weight;
             // Blending
             var enableBlending = this._target && this._target.animationPropertiesOverride ? this._target.animationPropertiesOverride.enableBlending : this._animation.enableBlending;
             var blendingSpeed = this._target && this._target.animationPropertiesOverride ? this._target.animationPropertiesOverride.blendingSpeed : this._animation.blendingSpeed;
-            if (enableBlending && this._blendingFactor <= 1.0) {
-                if (!this._originalBlendValue) {
-                    if (destination[path].clone) {
-                        this._originalBlendValue = destination[path].clone();
+            if (enableBlending && this._blendingFactor <= 1.0 || weight !== -1.0) {
+                if (!this._originalValue) {
+                    var originalValue = void 0;
+                    if (destination.getRestPose) {
+                        originalValue = destination.getRestPose();
                     }
                     else {
-                        this._originalBlendValue = destination[path];
+                        originalValue = destination[path];
+                    }
+                    if (originalValue.clone) {
+                        this._originalValue = originalValue.clone();
+                    }
+                    else {
+                        this._originalValue = originalValue;
                     }
                 }
-                if (this._originalBlendValue.prototype) {
-                    if (this._originalBlendValue.prototype.Lerp) {
-                        destination[path] = this._originalBlendValue.construtor.prototype.Lerp(currentValue, this._originalBlendValue, this._blendingFactor);
+            }
+            if (enableBlending && this._blendingFactor <= 1.0) {
+                if (this._originalValue.prototype) {
+                    if (this._originalValue.prototype.Lerp) {
+                        this._currentValue = this._originalValue.construtor.prototype.Lerp(currentValue, this._originalValue, this._blendingFactor);
                     }
                     else {
-                        destination[path] = currentValue;
+                        this._currentValue = currentValue;
                     }
                 }
-                else if (this._originalBlendValue.m) {
-                    destination[path] = BABYLON.Matrix.Lerp(this._originalBlendValue, currentValue, this._blendingFactor);
+                else if (this._originalValue.m) {
+                    this._currentValue = BABYLON.Matrix.Lerp(this._originalValue, currentValue, this._blendingFactor);
                 }
                 else {
-                    destination[path] = this._originalBlendValue * (1.0 - this._blendingFactor) + this._blendingFactor * currentValue;
+                    this._currentValue = this._originalValue * (1.0 - this._blendingFactor) + this._blendingFactor * currentValue;
                 }
                 this._blendingFactor += blendingSpeed;
+                destination[path] = this._currentValue;
             }
             else {
-                destination[path] = currentValue;
+                this._currentValue = currentValue;
+                if (weight !== -1.0) {
+                    this._scene._registerTargetForLateAnimationBinding(this);
+                }
+                else {
+                    destination[path] = this._currentValue;
+                }
             }
             if (this._target.markAsDirty) {
                 this._target.markAsDirty(this._animation.targetProperty);
@@ -47750,6 +48052,10 @@ var BABYLON;
             }
             return this._animation.loopMode;
         };
+        /**
+         * Move the current animation to a given frame
+         * @param frame defines the frame to move to
+         */
         RuntimeAnimation.prototype.goToFrame = function (frame) {
             var keys = this._animation.getKeys();
             if (frame < keys[0].frame) {
@@ -47759,14 +48065,24 @@ var BABYLON;
                 frame = keys[keys.length - 1].frame;
             }
             var currentValue = this._interpolate(frame, 0, this._getCorrectLoopMode());
-            this.setValue(currentValue);
+            this.setValue(currentValue, -1);
         };
         RuntimeAnimation.prototype._prepareForSpeedRatioChange = function (newSpeedRatio) {
             var newRatio = this._previousDelay * (this._animation.framePerSecond * newSpeedRatio) / 1000.0;
             this._ratioOffset = this._previousRatio - newRatio;
         };
-        RuntimeAnimation.prototype.animate = function (delay, from, to, loop, speedRatio, blend) {
-            if (blend === void 0) { blend = false; }
+        /**
+         * Execute the current animation
+         * @param delay defines the delay to add to the current frame
+         * @param from defines the lower bound of the animation range
+         * @param to defines the upper bound of the animation range
+         * @param loop defines if the current animation must loop
+         * @param speedRatio defines the current speed ratio
+         * @param weight defines the weight of the animation (default is -1 so no weight)
+         * @returns a boolean indicating if the animation has ended
+         */
+        RuntimeAnimation.prototype.animate = function (delay, from, to, loop, speedRatio, weight) {
+            if (weight === void 0) { weight = -1.0; }
             var targetPropertyPath = this._animation.targetPropertyPath;
             if (!targetPropertyPath || targetPropertyPath.length < 1) {
                 this._stopped = true;
@@ -47876,7 +48192,7 @@ var BABYLON;
             var currentFrame = returnValue ? from + ratio % range : to;
             var currentValue = this._interpolate(currentFrame, repeatCount, this._getCorrectLoopMode(), offsetValue, highLimitValue);
             // Set value
-            this.setValue(currentValue);
+            this.setValue(currentValue, weight);
             // Check events
             var events = this._animation.getEvents();
             for (var index = 0; index < events.length; index++) {
@@ -47930,6 +48246,7 @@ var BABYLON;
             this._runtimeAnimations = new Array();
             this._paused = false;
             this._speedRatio = 1;
+            this._weight = -1.0;
             this.animationStarted = false;
             if (animations) {
                 this.appendAnimations(target, animations);
@@ -47938,7 +48255,28 @@ var BABYLON;
             this._scene = scene;
             scene._activeAnimatables.push(this);
         }
+        Object.defineProperty(Animatable.prototype, "weight", {
+            /**
+             * Gets or sets the animatable weight (-1.0 by default meaning not weighted)
+             */
+            get: function () {
+                return this._weight;
+            },
+            set: function (value) {
+                if (value === -1) {
+                    this._weight = -1;
+                    return;
+                }
+                // Else weight must be in [0, 1] range
+                this._weight = Math.min(Math.max(value, 0), 1.0);
+            },
+            enumerable: true,
+            configurable: true
+        });
         Object.defineProperty(Animatable.prototype, "speedRatio", {
+            /**
+             * Gets or sets the speed ratio to apply to the animatable (1.0 by default)
+             */
             get: function () {
                 return this._speedRatio;
             },
@@ -47959,7 +48297,7 @@ var BABYLON;
         Animatable.prototype.appendAnimations = function (target, animations) {
             for (var index = 0; index < animations.length; index++) {
                 var animation = animations[index];
-                this._runtimeAnimations.push(new BABYLON.RuntimeAnimation(target, animation));
+                this._runtimeAnimations.push(new BABYLON.RuntimeAnimation(target, animation, this._scene));
             }
         };
         Animatable.prototype.getAnimationByTargetProperty = function (property) {
@@ -48087,7 +48425,7 @@ var BABYLON;
             var index;
             for (index = 0; index < runtimeAnimations.length; index++) {
                 var animation = runtimeAnimations[index];
-                var isRunning = animation.animate(delay - this._localDelayOffset, this.fromFrame, this.toFrame, this.loopAnimation, this._speedRatio);
+                var isRunning = animation.animate(delay - this._localDelayOffset, this.fromFrame, this.toFrame, this.loopAnimation, this._speedRatio, this._weight);
                 running = running || isRunning;
             }
             this.animationStarted = running;
@@ -56025,11 +56363,11 @@ var BABYLON;
                     buffer: buffer, bufferWidth: bufferWidth, bufferHeight: bufferHeight
                 });
                 vertexData.applyToMesh(ground, updatable);
-                ground._setReady(true);
                 //execute ready callback, if set
                 if (onReady) {
                     onReady(ground);
                 }
+                ground._setReady(true);
             };
             BABYLON.Tools.LoadImage(url, onload, function () { }, scene.database);
             return ground;

+ 65 - 16
dist/preview release/es6.js

@@ -1565,6 +1565,7 @@ var BABYLON;
         /**
          * Scale the current Color3 values by a factor and add the result to a given Color3
          * @param scale defines the scale factor
+         * @param result defines color to store the result into
          * @returns the unmodified current Color3
          */
         Color3.prototype.scaleAndAddToRef = function (scale, result) {
@@ -1953,6 +1954,7 @@ var BABYLON;
         /**
          * Scale the current Color4 values by a factor and add the result to a given Color4
          * @param scale defines the scale factor
+         * @param result defines the Color4 object where to store the result
          * @returns the unmodified current Color4
          */
         Color4.prototype.scaleAndAddToRef = function (scale, result) {
@@ -2413,6 +2415,7 @@ var BABYLON;
         /**
          * Scale the current Vector2 values by a factor to a given Vector2
          * @param scale defines the scale factor
+         * @param result defines the Vector2 object where to store the result
          * @returns the unmodified current Vector2
          */
         Vector2.prototype.scaleToRef = function (scale, result) {
@@ -2423,6 +2426,7 @@ var BABYLON;
         /**
          * Scale the current Vector2 values by a factor and add the result to a given Vector2
          * @param scale defines the scale factor
+         * @param result defines the Vector2 object where to store the result
          * @returns the unmodified current Vector2
          */
         Vector2.prototype.scaleAndAddToRef = function (scale, result) {
@@ -2870,6 +2874,7 @@ var BABYLON;
         /**
          * Scale the current Vector3 values by a factor and add the result to a given Vector3
          * @param scale defines the scale factor
+         * @param result defines the Vector3 object where to store the result
          * @returns the unmodified current Vector3
          */
         Vector3.prototype.scaleAndAddToRef = function (scale, result) {
@@ -3825,6 +3830,7 @@ var BABYLON;
         /**
          * Scale the current Vector4 values by a factor and add the result to a given Vector4
          * @param scale defines the scale factor
+         * @param result defines the Vector4 object where to store the result
          * @returns the unmodified current Vector4
          */
         Vector4.prototype.scaleAndAddToRef = function (scale, result) {
@@ -4361,8 +4367,9 @@ var BABYLON;
             return new Quaternion(this.x * value, this.y * value, this.z * value, this.w * value);
         };
         /**
-         * Scale the current VectQuaternionor4 values by a factor to a given Quaternion
+         * Scale the current Quaternion values by a factor to a given Quaternion
          * @param scale defines the scale factor
+         * @param result defines the Quaternion object where to store the result
          * @returns the unmodified current Quaternion
          */
         Quaternion.prototype.scaleToRef = function (scale, result) {
@@ -4373,8 +4380,9 @@ var BABYLON;
             return this;
         };
         /**
-         * Scale the current VectQuaternionor4 values by a factor and add the result to a given Quaternion
+         * Scale the current Quaternion values by a factor and add the result to a given Quaternion
          * @param scale defines the scale factor
+         * @param result defines the Quaternion object where to store the result
          * @returns the unmodified current Quaternion
          */
         Quaternion.prototype.scaleAndAddToRef = function (scale, result) {
@@ -5200,6 +5208,7 @@ var BABYLON;
         /**
          * Scale the current Matrix values by a factor to a given result Matrix
          * @param scale defines the scale factor
+         * @param result defines the Matrix to store the result
          * @returns the current Matrix
          */
         Matrix.prototype.scaleToRef = function (scale, result) {
@@ -5212,6 +5221,7 @@ var BABYLON;
         /**
          * Scale the current Matrix values by a factor and add the result to a given Matrix
          * @param scale defines the scale factor
+         * @param result defines the Matrix to store the result
          * @returns the current Matrix
          */
         Matrix.prototype.scaleAndAddToRef = function (scale, result) {
@@ -12598,7 +12608,7 @@ var BABYLON;
             this.applyStates();
             this._drawCalls.addCount(1, false);
             // Render
-            var drawMode = this.DrawMode(fillMode);
+            var drawMode = this._drawMode(fillMode);
             var indexFormat = this._uintIndicesCurrentlySet ? this._gl.UNSIGNED_INT : this._gl.UNSIGNED_SHORT;
             var mult = this._uintIndicesCurrentlySet ? 4 : 2;
             if (instancesCount) {
@@ -12612,7 +12622,7 @@ var BABYLON;
             // Apply states
             this.applyStates();
             this._drawCalls.addCount(1, false);
-            var drawMode = this.DrawMode(fillMode);
+            var drawMode = this._drawMode(fillMode);
             if (instancesCount) {
                 this._gl.drawArraysInstanced(drawMode, verticesStart, verticesCount, instancesCount);
             }
@@ -12620,7 +12630,7 @@ var BABYLON;
                 this._gl.drawArrays(drawMode, verticesStart, verticesCount);
             }
         };
-        Engine.prototype.DrawMode = function (fillMode) {
+        Engine.prototype._drawMode = function (fillMode) {
             switch (fillMode) {
                 // Triangle views
                 case BABYLON.Material.TriangleFillMode:
@@ -23442,6 +23452,9 @@ var BABYLON;
             target._lateAnimationHolders[runtimeAnimation.targetPath].totalWeight += runtimeAnimation.weight;
         };
         Scene.prototype._processLateAnimationBindings = function () {
+            if (!this._registeredForLateAnimationBindings.length) {
+                return;
+            }
             for (var index = 0; index < this._registeredForLateAnimationBindings.length; index++) {
                 var target = this._registeredForLateAnimationBindings.data[index];
                 for (var path in target._lateAnimationHolders) {
@@ -23461,8 +23474,8 @@ var BABYLON;
                         // We need to normalize the weights
                         normalizer = holder.totalWeight;
                     }
-                    for (var index = 0; index < holder.animations.length; index++) {
-                        var runtimeAnimation = holder.animations[index];
+                    for (var animIndex = 0; animIndex < holder.animations.length; animIndex++) {
+                        var runtimeAnimation = holder.animations[animIndex];
                         if (finalValue) {
                             runtimeAnimation.currentValue.scaleAndAddToRef(runtimeAnimation.weight / normalizer, finalValue);
                         }
@@ -47748,6 +47761,12 @@ var BABYLON;
 var BABYLON;
 (function (BABYLON) {
     var RuntimeAnimation = /** @class */ (function () {
+        /**
+         * Create a new RuntimeAnimation object
+         * @param target defines the target of the animation
+         * @param animation defines the source {BABYLON.Animation} object
+         * @param scene defines the hosting scene
+         */
         function RuntimeAnimation(target, animation, scene) {
             this._offsetsCache = {};
             this._highLimitsCache = {};
@@ -47950,6 +47969,11 @@ var BABYLON;
             }
             return this._getKeyValue(keys[keys.length - 1].value);
         };
+        /**
+         * Affect the interpolated value to the target
+         * @param currentValue defines the value computed by the animation
+         * @param weight defines the weight to apply to this value
+         */
         RuntimeAnimation.prototype.setValue = function (currentValue, weight) {
             if (weight === void 0) { weight = 1.0; }
             // Set value
@@ -47976,11 +48000,18 @@ var BABYLON;
             var blendingSpeed = this._target && this._target.animationPropertiesOverride ? this._target.animationPropertiesOverride.blendingSpeed : this._animation.blendingSpeed;
             if (enableBlending && this._blendingFactor <= 1.0 || weight !== -1.0) {
                 if (!this._originalValue) {
-                    if (destination[path].clone) {
-                        this._originalValue = destination[path].clone();
+                    var originalValue = void 0;
+                    if (destination.getRestPose) {
+                        originalValue = destination.getRestPose();
                     }
                     else {
-                        this._originalValue = destination[path];
+                        originalValue = destination[path];
+                    }
+                    if (originalValue.clone) {
+                        this._originalValue = originalValue.clone();
+                    }
+                    else {
+                        this._originalValue = originalValue;
                     }
                 }
             }
@@ -48021,8 +48052,11 @@ var BABYLON;
             }
             return this._animation.loopMode;
         };
-        RuntimeAnimation.prototype.goToFrame = function (frame, weight) {
-            if (weight === void 0) { weight = 1.0; }
+        /**
+         * Move the current animation to a given frame
+         * @param frame defines the frame to move to
+         */
+        RuntimeAnimation.prototype.goToFrame = function (frame) {
             var keys = this._animation.getKeys();
             if (frame < keys[0].frame) {
                 frame = keys[0].frame;
@@ -48031,14 +48065,24 @@ var BABYLON;
                 frame = keys[keys.length - 1].frame;
             }
             var currentValue = this._interpolate(frame, 0, this._getCorrectLoopMode());
-            this.setValue(currentValue, weight);
+            this.setValue(currentValue, -1);
         };
         RuntimeAnimation.prototype._prepareForSpeedRatioChange = function (newSpeedRatio) {
             var newRatio = this._previousDelay * (this._animation.framePerSecond * newSpeedRatio) / 1000.0;
             this._ratioOffset = this._previousRatio - newRatio;
         };
+        /**
+         * Execute the current animation
+         * @param delay defines the delay to add to the current frame
+         * @param from defines the lower bound of the animation range
+         * @param to defines the upper bound of the animation range
+         * @param loop defines if the current animation must loop
+         * @param speedRatio defines the current speed ratio
+         * @param weight defines the weight of the animation (default is -1 so no weight)
+         * @returns a boolean indicating if the animation has ended
+         */
         RuntimeAnimation.prototype.animate = function (delay, from, to, loop, speedRatio, weight) {
-            if (weight === void 0) { weight = 1.0; }
+            if (weight === void 0) { weight = -1.0; }
             var targetPropertyPath = this._animation.targetPropertyPath;
             if (!targetPropertyPath || targetPropertyPath.length < 1) {
                 this._stopped = true;
@@ -48219,6 +48263,11 @@ var BABYLON;
                 return this._weight;
             },
             set: function (value) {
+                if (value === -1) {
+                    this._weight = -1;
+                    return;
+                }
+                // Else weight must be in [0, 1] range
                 this._weight = Math.min(Math.max(value, 0), 1.0);
             },
             enumerable: true,
@@ -48277,7 +48326,7 @@ var BABYLON;
             // Reset to original value
             for (index = 0; index < runtimeAnimations.length; index++) {
                 var animation = runtimeAnimations[index];
-                animation.animate(0, this.fromFrame, this.toFrame, false, this._speedRatio, 1.0);
+                animation.animate(0, this.fromFrame, this.toFrame, false, this._speedRatio);
             }
             this._localDelayOffset = null;
             this._pausedDelay = null;
@@ -48308,7 +48357,7 @@ var BABYLON;
                 this._localDelayOffset -= delay;
             }
             for (var index = 0; index < runtimeAnimations.length; index++) {
-                runtimeAnimations[index].goToFrame(frame, this._weight);
+                runtimeAnimations[index].goToFrame(frame);
             }
         };
         Animatable.prototype.pause = function () {

Разница между файлами не показана из-за своего большого размера
+ 3 - 3
dist/preview release/gui/babylon.gui.min.js


Разница между файлами не показана из-за своего большого размера
+ 4 - 4
dist/preview release/inspector/babylon.inspector.bundle.js


Разница между файлами не показана из-за своего большого размера
+ 3 - 3
dist/preview release/inspector/babylon.inspector.min.js


Разница между файлами не показана из-за своего большого размера
+ 2 - 2
dist/preview release/loaders/babylon.glTF1FileLoader.min.js


Разница между файлами не показана из-за своего большого размера
+ 2 - 2
dist/preview release/loaders/babylon.glTF2FileLoader.min.js


Разница между файлами не показана из-за своего большого размера
+ 3 - 3
dist/preview release/loaders/babylon.glTFFileLoader.min.js


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
dist/preview release/loaders/babylon.objFileLoader.min.js


Разница между файлами не показана из-за своего большого размера
+ 3 - 3
dist/preview release/loaders/babylonjs.loaders.min.js


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
dist/preview release/materialsLibrary/babylon.customMaterial.min.js


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
dist/preview release/materialsLibrary/babylon.shadowOnlyMaterial.min.js


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
dist/preview release/materialsLibrary/babylon.waterMaterial.min.js


Разница между файлами не показана из-за своего большого размера
+ 3 - 3
dist/preview release/materialsLibrary/babylonjs.materials.min.js


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
dist/preview release/postProcessesLibrary/babylon.asciiArtPostProcess.min.js


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
dist/preview release/postProcessesLibrary/babylon.digitalRainPostProcess.min.js


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
dist/preview release/postProcessesLibrary/babylonjs.postProcess.min.js


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
dist/preview release/serializers/babylon.glTF2Serializer.min.js


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
dist/preview release/serializers/babylonjs.serializers.min.js


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

@@ -1,7 +1,7 @@
 {
-  "errors": 7179,
+  "errors": 7154,
   "babylon.typedoc.json": {
-    "errors": 7179,
+    "errors": 7154,
     "AnimationKeyInterpolation": {
       "Enumeration": {
         "Comments": {
@@ -2205,11 +2205,6 @@
             "MissingText": true
           }
         },
-        "speedRatio": {
-          "Comments": {
-            "MissingText": true
-          }
-        },
         "target": {
           "Comments": {
             "MissingText": true
@@ -12135,28 +12130,6 @@
             }
           }
         },
-        "setTexture": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "channel": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "uniform": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "texture": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        },
         "setTextureArray": {
           "Comments": {
             "MissingText": true
@@ -25753,25 +25726,6 @@
           "MissingText": true
         }
       },
-      "Constructor": {
-        "new RuntimeAnimation": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "target": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "animation": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        }
-      },
       "Property": {
         "animation": {
           "Comments": {
@@ -25797,60 +25751,11 @@
             }
           }
         },
-        "animate": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "delay": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "from": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "to": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "loop": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "speedRatio": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "blend": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        },
         "dispose": {
           "Comments": {
             "MissingText": true
           }
         },
-        "goToFrame": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "frame": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        },
         "isStopped": {
           "Comments": {
             "MissingText": true
@@ -25860,23 +25765,6 @@
           "Comments": {
             "MissingText": true
           }
-        },
-        "setValue": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "currentValue": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "blend": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
         }
       }
     },
@@ -27183,33 +27071,6 @@
             }
           }
         },
-        "beginAnimation": {
-          "Comments": {
-            "MissingReturn": true
-          },
-          "Parameter": {
-            "loop": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "speedRatio": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "onAnimationEnd": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "animatable": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        },
         "beginDirectAnimation": {
           "Parameter": {
             "target": {

Разница между файлами не показана из-за своего большого размера
+ 68 - 67
dist/preview release/viewer/babylon.viewer.js


+ 443 - 105
dist/preview release/viewer/babylon.viewer.max.js

@@ -1655,7 +1655,7 @@ var BABYLON;
         /**
          * Multiplies in place each rgb value by scale
          * @param scale defines the scaling factor
-         * @returns the updated Color3.
+         * @returns the updated Color3
          */
         Color3.prototype.scale = function (scale) {
             return new Color3(this.r * scale, this.g * scale, this.b * scale);
@@ -1664,7 +1664,7 @@ var BABYLON;
          * Multiplies the rgb values by scale and stores the result into "result"
          * @param scale defines the scaling factor
          * @param result defines the Color3 object where to store the result
-         * @returns the unmodified current Color3.
+         * @returns the unmodified current Color3
          */
         Color3.prototype.scaleToRef = function (scale, result) {
             result.r = this.r * scale;
@@ -1673,6 +1673,18 @@ var BABYLON;
             return this;
         };
         /**
+         * Scale the current Color3 values by a factor and add the result to a given Color3
+         * @param scale defines the scale factor
+         * @param result defines color to store the result into
+         * @returns the unmodified current Color3
+         */
+        Color3.prototype.scaleAndAddToRef = function (scale, result) {
+            result.r += this.r * scale;
+            result.g += this.g * scale;
+            result.b += this.b * scale;
+            return this;
+        };
+        /**
          * Clamps the rgb values by the min and max values and stores the result into "result"
          * @param min defines minimum clamping value (default is 0)
          * @param max defines maximum clamping value (default is 1)
@@ -2040,7 +2052,7 @@ var BABYLON;
          * Multiplies the current Color4 values by scale and stores the result in "result"
          * @param scale defines the scaling factor to apply
          * @param result defines the Color4 object where to store the result
-         * @returns the current Color4.
+         * @returns the current unmodified Color4
          */
         Color4.prototype.scaleToRef = function (scale, result) {
             result.r = this.r * scale;
@@ -2050,6 +2062,19 @@ var BABYLON;
             return this;
         };
         /**
+         * Scale the current Color4 values by a factor and add the result to a given Color4
+         * @param scale defines the scale factor
+         * @param result defines the Color4 object where to store the result
+         * @returns the unmodified current Color4
+         */
+        Color4.prototype.scaleAndAddToRef = function (scale, result) {
+            result.r += this.r * scale;
+            result.g += this.g * scale;
+            result.b += this.b * scale;
+            result.a += this.a * scale;
+            return this;
+        };
+        /**
          * Clamps the rgb values by the min and max values and stores the result into "result"
          * @param min defines minimum clamping value (default is 0)
          * @param max defines maximum clamping value (default is 1)
@@ -2493,7 +2518,31 @@ var BABYLON;
          * Returns a new Vector2 scaled by "scale" from the current Vector2.
          */
         Vector2.prototype.scale = function (scale) {
-            return new Vector2(this.x * scale, this.y * scale);
+            var result = new Vector2(0, 0);
+            this.scaleToRef(scale, result);
+            return result;
+        };
+        /**
+         * Scale the current Vector2 values by a factor to a given Vector2
+         * @param scale defines the scale factor
+         * @param result defines the Vector2 object where to store the result
+         * @returns the unmodified current Vector2
+         */
+        Vector2.prototype.scaleToRef = function (scale, result) {
+            result.x = this.x * scale;
+            result.y = this.y * scale;
+            return this;
+        };
+        /**
+         * Scale the current Vector2 values by a factor and add the result to a given Vector2
+         * @param scale defines the scale factor
+         * @param result defines the Vector2 object where to store the result
+         * @returns the unmodified current Vector2
+         */
+        Vector2.prototype.scaleAndAddToRef = function (scale, result) {
+            result.x += this.x * scale;
+            result.y += this.y * scale;
+            return this;
         };
         /**
          * Boolean : True if the passed vector coordinates strictly equal the current Vector2 ones.
@@ -2933,6 +2982,18 @@ var BABYLON;
             return this;
         };
         /**
+         * Scale the current Vector3 values by a factor and add the result to a given Vector3
+         * @param scale defines the scale factor
+         * @param result defines the Vector3 object where to store the result
+         * @returns the unmodified current Vector3
+         */
+        Vector3.prototype.scaleAndAddToRef = function (scale, result) {
+            result.x += this.x * scale;
+            result.y += this.y * scale;
+            result.z += this.z * scale;
+            return this;
+        };
+        /**
          * Returns true if the current Vector3 and the passed vector coordinates are strictly equal
          * @param otherVector defines the second operand
          * @returns true if both vectors are equals
@@ -3877,6 +3938,19 @@ var BABYLON;
             return this;
         };
         /**
+         * Scale the current Vector4 values by a factor and add the result to a given Vector4
+         * @param scale defines the scale factor
+         * @param result defines the Vector4 object where to store the result
+         * @returns the unmodified current Vector4
+         */
+        Vector4.prototype.scaleAndAddToRef = function (scale, result) {
+            result.x += this.x * scale;
+            result.y += this.y * scale;
+            result.z += this.z * scale;
+            result.w += this.w * scale;
+            return this;
+        };
+        /**
          * Boolean : True if the current Vector4 coordinates are stricly equal to the passed ones.
          */
         Vector4.prototype.equals = function (otherVector) {
@@ -4403,6 +4477,32 @@ var BABYLON;
             return new Quaternion(this.x * value, this.y * value, this.z * value, this.w * value);
         };
         /**
+         * Scale the current Quaternion values by a factor to a given Quaternion
+         * @param scale defines the scale factor
+         * @param result defines the Quaternion object where to store the result
+         * @returns the unmodified current Quaternion
+         */
+        Quaternion.prototype.scaleToRef = function (scale, result) {
+            result.x = this.x * scale;
+            result.y = this.y * scale;
+            result.z = this.z * scale;
+            result.w = this.w * scale;
+            return this;
+        };
+        /**
+         * Scale the current Quaternion values by a factor and add the result to a given Quaternion
+         * @param scale defines the scale factor
+         * @param result defines the Quaternion object where to store the result
+         * @returns the unmodified current Quaternion
+         */
+        Quaternion.prototype.scaleAndAddToRef = function (scale, result) {
+            result.x += this.x * scale;
+            result.y += this.y * scale;
+            result.z += this.z * scale;
+            result.w += this.w * scale;
+            return this;
+        };
+        /**
          * Returns a new Quaternion set as the quaternion mulplication result of the current one with the passed one "q1".
          */
         Quaternion.prototype.multiply = function (q1) {
@@ -5149,6 +5249,99 @@ var BABYLON;
             return true;
         };
         /**
+         * Returns the index-th row of the current matrix as a new Vector4.
+         */
+        Matrix.prototype.getRow = function (index) {
+            if (index < 0 || index > 3) {
+                return null;
+            }
+            var i = index * 4;
+            return new Vector4(this.m[i + 0], this.m[i + 1], this.m[i + 2], this.m[i + 3]);
+        };
+        /**
+         * Sets the index-th row of the current matrix with the passed Vector4 values.
+         * Returns the updated Matrix.
+         */
+        Matrix.prototype.setRow = function (index, row) {
+            if (index < 0 || index > 3) {
+                return this;
+            }
+            var i = index * 4;
+            this.m[i + 0] = row.x;
+            this.m[i + 1] = row.y;
+            this.m[i + 2] = row.z;
+            this.m[i + 3] = row.w;
+            this._markAsUpdated();
+            return this;
+        };
+        /**
+         * Compute the transpose of the matrix.
+         * Returns a new Matrix.
+         */
+        Matrix.prototype.transpose = function () {
+            return Matrix.Transpose(this);
+        };
+        /**
+         * Compute the transpose of the matrix.
+         * Returns the current matrix.
+         */
+        Matrix.prototype.transposeToRef = function (result) {
+            Matrix.TransposeToRef(this, result);
+            return this;
+        };
+        /**
+         * Sets the index-th row of the current matrix with the passed 4 x float values.
+         * Returns the updated Matrix.
+         */
+        Matrix.prototype.setRowFromFloats = function (index, x, y, z, w) {
+            if (index < 0 || index > 3) {
+                return this;
+            }
+            var i = index * 4;
+            this.m[i + 0] = x;
+            this.m[i + 1] = y;
+            this.m[i + 2] = z;
+            this.m[i + 3] = w;
+            this._markAsUpdated();
+            return this;
+        };
+        /**
+         * Compute a new Matrix set with the current Matrix values multiplied by scale (float)
+         * @param scale defines the scale factor
+         * @returns a new Matrix
+         */
+        Matrix.prototype.scale = function (scale) {
+            var result = new Matrix();
+            this.scaleToRef(scale, result);
+            return result;
+        };
+        /**
+         * Scale the current Matrix values by a factor to a given result Matrix
+         * @param scale defines the scale factor
+         * @param result defines the Matrix to store the result
+         * @returns the current Matrix
+         */
+        Matrix.prototype.scaleToRef = function (scale, result) {
+            for (var index = 0; index < 16; index++) {
+                result.m[index] = this.m[index] * scale;
+            }
+            result._markAsUpdated();
+            return this;
+        };
+        /**
+         * Scale the current Matrix values by a factor and add the result to a given Matrix
+         * @param scale defines the scale factor
+         * @param result defines the Matrix to store the result
+         * @returns the current Matrix
+         */
+        Matrix.prototype.scaleAndAddToRef = function (scale, result) {
+            for (var index = 0; index < 16; index++) {
+                result.m[index] += this.m[index] * scale;
+            }
+            result._markAsUpdated();
+            return this;
+        };
+        /**
          * Writes to the given matrix a normal matrix, computed from this one (using values from identity matrix for fourth row and column).
          * @param ref matrix to store the result
          */
@@ -5233,63 +5426,6 @@ var BABYLON;
             result.m[15] = initialM44;
             result._markAsUpdated();
         };
-        /**
-         * Returns the index-th row of the current matrix as a new Vector4.
-         */
-        Matrix.prototype.getRow = function (index) {
-            if (index < 0 || index > 3) {
-                return null;
-            }
-            var i = index * 4;
-            return new Vector4(this.m[i + 0], this.m[i + 1], this.m[i + 2], this.m[i + 3]);
-        };
-        /**
-         * Sets the index-th row of the current matrix with the passed Vector4 values.
-         * Returns the updated Matrix.
-         */
-        Matrix.prototype.setRow = function (index, row) {
-            if (index < 0 || index > 3) {
-                return this;
-            }
-            var i = index * 4;
-            this.m[i + 0] = row.x;
-            this.m[i + 1] = row.y;
-            this.m[i + 2] = row.z;
-            this.m[i + 3] = row.w;
-            this._markAsUpdated();
-            return this;
-        };
-        /**
-         * Compute the transpose of the matrix.
-         * Returns a new Matrix.
-         */
-        Matrix.prototype.transpose = function () {
-            return Matrix.Transpose(this);
-        };
-        /**
-         * Compute the transpose of the matrix.
-         * Returns the current matrix.
-         */
-        Matrix.prototype.transposeToRef = function (result) {
-            Matrix.TransposeToRef(this, result);
-            return this;
-        };
-        /**
-         * Sets the index-th row of the current matrix with the passed 4 x float values.
-         * Returns the updated Matrix.
-         */
-        Matrix.prototype.setRowFromFloats = function (index, x, y, z, w) {
-            if (index < 0 || index > 3) {
-                return this;
-            }
-            var i = index * 4;
-            this.m[i + 0] = x;
-            this.m[i + 1] = y;
-            this.m[i + 2] = z;
-            this.m[i + 3] = w;
-            this._markAsUpdated();
-            return this;
-        };
         Object.defineProperty(Matrix, "IdentityReadOnly", {
             /**
              * Static identity matrix to be used as readonly matrix
@@ -12582,7 +12718,7 @@ var BABYLON;
             this.applyStates();
             this._drawCalls.addCount(1, false);
             // Render
-            var drawMode = this.DrawMode(fillMode);
+            var drawMode = this._drawMode(fillMode);
             var indexFormat = this._uintIndicesCurrentlySet ? this._gl.UNSIGNED_INT : this._gl.UNSIGNED_SHORT;
             var mult = this._uintIndicesCurrentlySet ? 4 : 2;
             if (instancesCount) {
@@ -12596,7 +12732,7 @@ var BABYLON;
             // Apply states
             this.applyStates();
             this._drawCalls.addCount(1, false);
-            var drawMode = this.DrawMode(fillMode);
+            var drawMode = this._drawMode(fillMode);
             if (instancesCount) {
                 this._gl.drawArraysInstanced(drawMode, verticesStart, verticesCount, instancesCount);
             }
@@ -12604,7 +12740,7 @@ var BABYLON;
                 this._gl.drawArrays(drawMode, verticesStart, verticesCount);
             }
         };
-        Engine.prototype.DrawMode = function (fillMode) {
+        Engine.prototype._drawMode = function (fillMode) {
             switch (fillMode) {
                 // Triangle views
                 case BABYLON.Material.TriangleFillMode:
@@ -15998,10 +16134,10 @@ var BABYLON;
                 this._isReady = false;
                 return;
             }
-            this._isReady = true;
             if (this.onReady) {
                 this.onReady(this);
             }
+            this._isReady = true;
         };
         /**
          * Get an animation by name
@@ -21731,6 +21867,7 @@ var BABYLON;
             this.onRenderingGroupObservable = new BABYLON.Observable();
             // Animations
             this.animations = [];
+            this._registeredForLateAnimationBindings = new BABYLON.SmartArrayNoDuplicate(256);
             /**
              * This observable event is triggered when any ponter event is triggered. It is registered during Scene.attachControl() and it is called BEFORE the 3D engine process anything (mesh/sprite picking for instance).
              * You have the possibility to skip the process and the call to onPointerObservable by setting PointerInfoPre.skipOnPointerObservable to true
@@ -23251,22 +23388,46 @@ var BABYLON;
         // Animations
         /**
          * Will start the animation sequence of a given target
-         * @param target - the target
-         * @param {number} from - from which frame should animation start
-         * @param {number} to - till which frame should animation run.
-         * @param {boolean} [loop] - should the animation loop
-         * @param {number} [speedRatio] - the speed in which to run the animation
-         * @param {Function} [onAnimationEnd] function to be executed when the animation ended.
-         * @param {BABYLON.Animatable} [animatable] an animatable object. If not provided a new one will be created from the given params.
-         * Returns {BABYLON.Animatable} the animatable object created for this animation
-         * See BABYLON.Animatable
-         */
-        Scene.prototype.beginAnimation = function (target, from, to, loop, speedRatio, onAnimationEnd, animatable) {
+         * @param target defines the target
+         * @param from defines from which frame should animation start
+         * @param to defines until which frame should animation run.
+         * @param weight defines the weight to apply to the animation (1.0 by default)
+         * @param loop defines if the animation loops
+         * @param speedRatio defines the speed in which to run the animation (1.0 by default)
+         * @param onAnimationEnd defines the function to be executed when the animation ends
+         * @param animatable defines an animatable object. If not provided a new one will be created from the given params
+         * @returns the animatable object created for this animation
+         * @see BABYLON.Animatable
+         */
+        Scene.prototype.beginWeightedAnimation = function (target, from, to, weight, loop, speedRatio, onAnimationEnd, animatable) {
+            if (weight === void 0) { weight = 1.0; }
             if (speedRatio === void 0) { speedRatio = 1.0; }
+            var returnedAnimatable = this.beginAnimation(target, from, to, loop, speedRatio, onAnimationEnd, animatable, false);
+            returnedAnimatable.weight = weight;
+            return returnedAnimatable;
+        };
+        /**
+         * Will start the animation sequence of a given target
+         * @param target defines the target
+         * @param from defines from which frame should animation start
+         * @param to defines until which frame should animation run.
+         * @param loop defines if the animation loops
+         * @param speedRatio defines the speed in which to run the animation (1.0 by default)
+         * @param onAnimationEnd defines the function to be executed when the animation ends
+         * @param animatable defines an animatable object. If not provided a new one will be created from the given params
+         * @param stopCurrent defines if the current animations must be stopped first (true by default)
+         * @returns the animatable object created for this animation
+         * @see BABYLON.Animatable
+         */
+        Scene.prototype.beginAnimation = function (target, from, to, loop, speedRatio, onAnimationEnd, animatable, stopCurrent) {
+            if (speedRatio === void 0) { speedRatio = 1.0; }
+            if (stopCurrent === void 0) { stopCurrent = true; }
             if (from > to && speedRatio > 0) {
                 speedRatio *= -1;
             }
-            this.stopAnimation(target);
+            if (stopCurrent) {
+                this.stopAnimation(target);
+            }
             if (!animatable) {
                 animatable = new BABYLON.Animatable(this, target, from, to, loop, speedRatio, onAnimationEnd);
             }
@@ -23278,10 +23439,12 @@ var BABYLON;
             if (target.getAnimatables) {
                 var animatables = target.getAnimatables();
                 for (var index = 0; index < animatables.length; index++) {
-                    this.beginAnimation(animatables[index], from, to, loop, speedRatio, onAnimationEnd, animatable);
+                    this.beginAnimation(animatables[index], from, to, loop, speedRatio, onAnimationEnd, animatable, stopCurrent);
                 }
             }
-            animatable.reset();
+            if (stopCurrent) {
+                animatable.reset();
+            }
             return animatable;
         };
         /**
@@ -23379,6 +23542,62 @@ var BABYLON;
             for (var index = 0; index < this._activeAnimatables.length; index++) {
                 this._activeAnimatables[index]._animate(this._animationTime);
             }
+            // Late animation bindings
+            this._processLateAnimationBindings();
+        };
+        /** @ignore */
+        Scene.prototype._registerTargetForLateAnimationBinding = function (runtimeAnimation) {
+            var target = runtimeAnimation.target;
+            this._registeredForLateAnimationBindings.pushNoDuplicate(target);
+            if (!target._lateAnimationHolders) {
+                target._lateAnimationHolders = {};
+            }
+            if (!target._lateAnimationHolders[runtimeAnimation.targetPath]) {
+                target._lateAnimationHolders[runtimeAnimation.targetPath] = {
+                    totalWeight: 0,
+                    animations: []
+                };
+            }
+            target._lateAnimationHolders[runtimeAnimation.targetPath].animations.push(runtimeAnimation);
+            target._lateAnimationHolders[runtimeAnimation.targetPath].totalWeight += runtimeAnimation.weight;
+        };
+        Scene.prototype._processLateAnimationBindings = function () {
+            if (!this._registeredForLateAnimationBindings.length) {
+                return;
+            }
+            for (var index = 0; index < this._registeredForLateAnimationBindings.length; index++) {
+                var target = this._registeredForLateAnimationBindings.data[index];
+                for (var path in target._lateAnimationHolders) {
+                    var holder = target._lateAnimationHolders[path];
+                    // Sanity check
+                    if (!holder.animations[0].originalValue.scaleAndAddToRef) {
+                        continue;
+                    }
+                    var normalizer = 1.0;
+                    var finalValue = void 0;
+                    if (holder.totalWeight < 1.0) {
+                        // We need to mix the original value in
+                        var originalValue = holder.animations[0].originalValue;
+                        finalValue = originalValue.scale(1.0 - holder.totalWeight);
+                    }
+                    else {
+                        // We need to normalize the weights
+                        normalizer = holder.totalWeight;
+                    }
+                    for (var animIndex = 0; animIndex < holder.animations.length; animIndex++) {
+                        var runtimeAnimation = holder.animations[animIndex];
+                        if (finalValue) {
+                            runtimeAnimation.currentValue.scaleAndAddToRef(runtimeAnimation.weight / normalizer, finalValue);
+                        }
+                        else {
+                            finalValue = runtimeAnimation.currentValue.scale(runtimeAnimation.weight / normalizer);
+                        }
+                    }
+                    runtimeAnimation.target[path] = finalValue;
+                }
+                target._lateAnimationHolders = {};
+            }
+            this._registeredForLateAnimationBindings.reset();
         };
         // Matrix
         Scene.prototype._switchToAlternateCameraConfiguration = function (active) {
@@ -25008,6 +25227,7 @@ var BABYLON;
             this._activeSkeletons.dispose();
             this._softwareSkinnedMeshes.dispose();
             this._renderTargets.dispose();
+            this._registeredForLateAnimationBindings.dispose();
             if (this._boundingBoxRenderer) {
                 this._boundingBoxRenderer.dispose();
             }
@@ -46236,7 +46456,7 @@ var BABYLON;
         function DirectionalLight(name, direction, scene) {
             var _this = _super.call(this, name, scene) || this;
             _this._shadowFrustumSize = 0;
-            _this._shadowOrthoScale = 0.5;
+            _this._shadowOrthoScale = 0.1;
             /**
              * Automatically compute the projection matrix to best fit (including all the casters)
              * on each frame.
@@ -47651,16 +47871,74 @@ var BABYLON;
 var BABYLON;
 (function (BABYLON) {
     var RuntimeAnimation = /** @class */ (function () {
-        function RuntimeAnimation(target, animation) {
+        /**
+         * Create a new RuntimeAnimation object
+         * @param target defines the target of the animation
+         * @param animation defines the source {BABYLON.Animation} object
+         * @param scene defines the hosting scene
+         */
+        function RuntimeAnimation(target, animation, scene) {
             this._offsetsCache = {};
             this._highLimitsCache = {};
             this._stopped = false;
             this._blendingFactor = 0;
+            this._weight = 1.0;
             this._ratioOffset = 0;
             this._animation = animation;
             this._target = target;
+            this._scene = scene;
             animation._runtimeAnimations.push(this);
         }
+        Object.defineProperty(RuntimeAnimation.prototype, "weight", {
+            /**
+             * Gets the weight of the runtime animation
+             */
+            get: function () {
+                return this._weight;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Object.defineProperty(RuntimeAnimation.prototype, "originalValue", {
+            /**
+             * Gets the original value of the runtime animation
+             */
+            get: function () {
+                return this._originalValue;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Object.defineProperty(RuntimeAnimation.prototype, "currentValue", {
+            /**
+             * Gets the current value of the runtime animation
+             */
+            get: function () {
+                return this._currentValue;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Object.defineProperty(RuntimeAnimation.prototype, "targetPath", {
+            /**
+             * Gets the path where to store the animated value in the target
+             */
+            get: function () {
+                return this._targetPath;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Object.defineProperty(RuntimeAnimation.prototype, "target", {
+            /**
+             * Gets the actual target of the runtime animation
+             */
+            get: function () {
+                return this._activeTarget;
+            },
+            enumerable: true,
+            configurable: true
+        });
         Object.defineProperty(RuntimeAnimation.prototype, "animation", {
             get: function () {
                 return this._animation;
@@ -47673,7 +47951,7 @@ var BABYLON;
             this._highLimitsCache = {};
             this.currentFrame = 0;
             this._blendingFactor = 0;
-            this._originalBlendValue = null;
+            this._originalValue = null;
         };
         RuntimeAnimation.prototype.isStopped = function () {
             return this._stopped;
@@ -47801,8 +48079,13 @@ var BABYLON;
             }
             return this._getKeyValue(keys[keys.length - 1].value);
         };
-        RuntimeAnimation.prototype.setValue = function (currentValue, blend) {
-            if (blend === void 0) { blend = false; }
+        /**
+         * Affect the interpolated value to the target
+         * @param currentValue defines the value computed by the animation
+         * @param weight defines the weight to apply to this value
+         */
+        RuntimeAnimation.prototype.setValue = function (currentValue, weight) {
+            if (weight === void 0) { weight = 1.0; }
             // Set value
             var path;
             var destination;
@@ -47812,43 +48095,62 @@ var BABYLON;
                 for (var index = 1; index < targetPropertyPath.length - 1; index++) {
                     property = property[targetPropertyPath[index]];
                 }
-                path = targetPropertyPath[targetPropertyPath.length - 1];
+                path = [targetPropertyPath.length - 1];
                 destination = property;
             }
             else {
                 path = targetPropertyPath[0];
                 destination = this._target;
             }
+            this._targetPath = path;
+            this._activeTarget = destination;
+            this._weight = weight;
             // Blending
             var enableBlending = this._target && this._target.animationPropertiesOverride ? this._target.animationPropertiesOverride.enableBlending : this._animation.enableBlending;
             var blendingSpeed = this._target && this._target.animationPropertiesOverride ? this._target.animationPropertiesOverride.blendingSpeed : this._animation.blendingSpeed;
-            if (enableBlending && this._blendingFactor <= 1.0) {
-                if (!this._originalBlendValue) {
-                    if (destination[path].clone) {
-                        this._originalBlendValue = destination[path].clone();
+            if (enableBlending && this._blendingFactor <= 1.0 || weight !== -1.0) {
+                if (!this._originalValue) {
+                    var originalValue = void 0;
+                    if (destination.getRestPose) {
+                        originalValue = destination.getRestPose();
                     }
                     else {
-                        this._originalBlendValue = destination[path];
+                        originalValue = destination[path];
+                    }
+                    if (originalValue.clone) {
+                        this._originalValue = originalValue.clone();
+                    }
+                    else {
+                        this._originalValue = originalValue;
                     }
                 }
-                if (this._originalBlendValue.prototype) {
-                    if (this._originalBlendValue.prototype.Lerp) {
-                        destination[path] = this._originalBlendValue.construtor.prototype.Lerp(currentValue, this._originalBlendValue, this._blendingFactor);
+            }
+            if (enableBlending && this._blendingFactor <= 1.0) {
+                if (this._originalValue.prototype) {
+                    if (this._originalValue.prototype.Lerp) {
+                        this._currentValue = this._originalValue.construtor.prototype.Lerp(currentValue, this._originalValue, this._blendingFactor);
                     }
                     else {
-                        destination[path] = currentValue;
+                        this._currentValue = currentValue;
                     }
                 }
-                else if (this._originalBlendValue.m) {
-                    destination[path] = BABYLON.Matrix.Lerp(this._originalBlendValue, currentValue, this._blendingFactor);
+                else if (this._originalValue.m) {
+                    this._currentValue = BABYLON.Matrix.Lerp(this._originalValue, currentValue, this._blendingFactor);
                 }
                 else {
-                    destination[path] = this._originalBlendValue * (1.0 - this._blendingFactor) + this._blendingFactor * currentValue;
+                    this._currentValue = this._originalValue * (1.0 - this._blendingFactor) + this._blendingFactor * currentValue;
                 }
                 this._blendingFactor += blendingSpeed;
+                destination[path] = this._currentValue;
             }
             else {
-                destination[path] = currentValue;
+                this._currentValue = currentValue;
+                if (weight !== -1.0) {
+                    this._scene._registerTargetForLateAnimationBinding(this);
+                }
+                else {
+                    destination[path] = this._currentValue;
+                }
             }
             if (this._target.markAsDirty) {
                 this._target.markAsDirty(this._animation.targetProperty);
@@ -47860,6 +48162,10 @@ var BABYLON;
             }
             return this._animation.loopMode;
         };
+        /**
+         * Move the current animation to a given frame
+         * @param frame defines the frame to move to
+         */
         RuntimeAnimation.prototype.goToFrame = function (frame) {
             var keys = this._animation.getKeys();
             if (frame < keys[0].frame) {
@@ -47869,14 +48175,24 @@ var BABYLON;
                 frame = keys[keys.length - 1].frame;
             }
             var currentValue = this._interpolate(frame, 0, this._getCorrectLoopMode());
-            this.setValue(currentValue);
+            this.setValue(currentValue, -1);
         };
         RuntimeAnimation.prototype._prepareForSpeedRatioChange = function (newSpeedRatio) {
             var newRatio = this._previousDelay * (this._animation.framePerSecond * newSpeedRatio) / 1000.0;
             this._ratioOffset = this._previousRatio - newRatio;
         };
-        RuntimeAnimation.prototype.animate = function (delay, from, to, loop, speedRatio, blend) {
-            if (blend === void 0) { blend = false; }
+        /**
+         * Execute the current animation
+         * @param delay defines the delay to add to the current frame
+         * @param from defines the lower bound of the animation range
+         * @param to defines the upper bound of the animation range
+         * @param loop defines if the current animation must loop
+         * @param speedRatio defines the current speed ratio
+         * @param weight defines the weight of the animation (default is -1 so no weight)
+         * @returns a boolean indicating if the animation has ended
+         */
+        RuntimeAnimation.prototype.animate = function (delay, from, to, loop, speedRatio, weight) {
+            if (weight === void 0) { weight = -1.0; }
             var targetPropertyPath = this._animation.targetPropertyPath;
             if (!targetPropertyPath || targetPropertyPath.length < 1) {
                 this._stopped = true;
@@ -47986,7 +48302,7 @@ var BABYLON;
             var currentFrame = returnValue ? from + ratio % range : to;
             var currentValue = this._interpolate(currentFrame, repeatCount, this._getCorrectLoopMode(), offsetValue, highLimitValue);
             // Set value
-            this.setValue(currentValue);
+            this.setValue(currentValue, weight);
             // Check events
             var events = this._animation.getEvents();
             for (var index = 0; index < events.length; index++) {
@@ -48040,6 +48356,7 @@ var BABYLON;
             this._runtimeAnimations = new Array();
             this._paused = false;
             this._speedRatio = 1;
+            this._weight = -1.0;
             this.animationStarted = false;
             if (animations) {
                 this.appendAnimations(target, animations);
@@ -48048,7 +48365,28 @@ var BABYLON;
             this._scene = scene;
             scene._activeAnimatables.push(this);
         }
+        Object.defineProperty(Animatable.prototype, "weight", {
+            /**
+             * Gets or sets the animatable weight (-1.0 by default meaning not weighted)
+             */
+            get: function () {
+                return this._weight;
+            },
+            set: function (value) {
+                if (value === -1) {
+                    this._weight = -1;
+                    return;
+                }
+                // Else weight must be in [0, 1] range
+                this._weight = Math.min(Math.max(value, 0), 1.0);
+            },
+            enumerable: true,
+            configurable: true
+        });
         Object.defineProperty(Animatable.prototype, "speedRatio", {
+            /**
+             * Gets or sets the speed ratio to apply to the animatable (1.0 by default)
+             */
             get: function () {
                 return this._speedRatio;
             },
@@ -48069,7 +48407,7 @@ var BABYLON;
         Animatable.prototype.appendAnimations = function (target, animations) {
             for (var index = 0; index < animations.length; index++) {
                 var animation = animations[index];
-                this._runtimeAnimations.push(new BABYLON.RuntimeAnimation(target, animation));
+                this._runtimeAnimations.push(new BABYLON.RuntimeAnimation(target, animation, this._scene));
             }
         };
         Animatable.prototype.getAnimationByTargetProperty = function (property) {
@@ -48197,7 +48535,7 @@ var BABYLON;
             var index;
             for (index = 0; index < runtimeAnimations.length; index++) {
                 var animation = runtimeAnimations[index];
-                var isRunning = animation.animate(delay - this._localDelayOffset, this.fromFrame, this.toFrame, this.loopAnimation, this._speedRatio);
+                var isRunning = animation.animate(delay - this._localDelayOffset, this.fromFrame, this.toFrame, this.loopAnimation, this._speedRatio, this._weight);
                 running = running || isRunning;
             }
             this.animationStarted = running;
@@ -56844,11 +57182,11 @@ var BABYLON;
                     buffer: buffer, bufferWidth: bufferWidth, bufferHeight: bufferHeight
                 });
                 vertexData.applyToMesh(ground, updatable);
-                ground._setReady(true);
                 //execute ready callback, if set
                 if (onReady) {
                     onReady(ground);
                 }
+                ground._setReady(true);
             };
             BABYLON.Tools.LoadImage(url, onload, function () { }, scene.database);
             return ground;

+ 1 - 1
src/Animations/babylon.animatable.ts

@@ -140,7 +140,7 @@
             }
 
             for (var index = 0; index < runtimeAnimations.length; index++) {
-                runtimeAnimations[index].goToFrame(frame, this._weight);
+                runtimeAnimations[index].goToFrame(frame);
             }
         }
 

+ 27 - 3
src/Animations/babylon.runtimeAnimation.ts

@@ -52,7 +52,12 @@
             return this._activeTarget;
         }
 
-        
+        /**
+         * Create a new RuntimeAnimation object
+         * @param target defines the target of the animation
+         * @param animation defines the source {BABYLON.Animation} object
+         * @param scene defines the hosting scene
+         */
         public constructor(target: any, animation: Animation, scene: Scene) {
             this._animation = animation;
             this._target = target;
@@ -218,6 +223,11 @@
             return this._getKeyValue(keys[keys.length - 1].value);
         }
 
+        /**
+         * Affect the interpolated value to the target
+         * @param currentValue defines the value computed by the animation
+         * @param weight defines the weight to apply to this value
+         */
         public setValue(currentValue: any, weight = 1.0): void {
             // Set value
             var path: any;
@@ -304,7 +314,11 @@
             return this._animation.loopMode;
         }
 
-        public goToFrame(frame: number, weight = 1.0): void {
+        /**
+         * Move the current animation to a given frame
+         * @param frame defines the frame to move to
+         */
+        public goToFrame(frame: number): void {
             let keys = this._animation.getKeys();
 
             if (frame < keys[0].frame) {
@@ -315,7 +329,7 @@
 
             var currentValue = this._interpolate(frame, 0, this._getCorrectLoopMode());
 
-            this.setValue(currentValue, weight);
+            this.setValue(currentValue, -1);
         }
 
         public _prepareForSpeedRatioChange(newSpeedRatio: number): void {
@@ -328,6 +342,16 @@
         private _previousDelay: number;
         private _previousRatio: number;
 
+        /**
+         * Execute the current animation
+         * @param delay defines the delay to add to the current frame
+         * @param from defines the lower bound of the animation range
+         * @param to defines the upper bound of the animation range
+         * @param loop defines if the current animation must loop
+         * @param speedRatio defines the current speed ratio
+         * @param weight defines the weight of the animation (default is -1 so no weight)
+         * @returns a boolean indicating if the animation has ended
+         */
         public animate(delay: number, from: number, to: number, loop: boolean, speedRatio: number, weight = -1.0): boolean {
             let targetPropertyPath = this._animation.targetPropertyPath
             if (!targetPropertyPath || targetPropertyPath.length < 1) {

+ 12 - 2
src/Math/babylon.math.ts

@@ -170,6 +170,7 @@
         /**
          * Scale the current Color3 values by a factor and add the result to a given Color3  
          * @param scale defines the scale factor
+         * @param result defines color to store the result into
          * @returns the unmodified current Color3 
          */
         public scaleAndAddToRef(scale: number, result: Color3): Color3 {
@@ -578,6 +579,7 @@
         /**
          * Scale the current Color4 values by a factor and add the result to a given Color4  
          * @param scale defines the scale factor
+         * @param result defines the Color4 object where to store the result
          * @returns the unmodified current Color4 
          */
         public scaleAndAddToRef(scale: number, result: Color4): Color4 {
@@ -1064,6 +1066,7 @@
         /**
          * Scale the current Vector2 values by a factor to a given Vector2  
          * @param scale defines the scale factor
+         * @param result defines the Vector2 object where to store the result
          * @returns the unmodified current Vector2 
          */
         public scaleToRef(scale: number, result: Vector2): Vector2 {
@@ -1075,6 +1078,7 @@
         /**
          * Scale the current Vector2 values by a factor and add the result to a given Vector2  
          * @param scale defines the scale factor
+         * @param result defines the Vector2 object where to store the result
          * @returns the unmodified current Vector2 
          */
         public scaleAndAddToRef(scale: number, result: Vector2): Vector2 {
@@ -1568,6 +1572,7 @@
         /**
          * Scale the current Vector3 values by a factor and add the result to a given Vector3  
          * @param scale defines the scale factor
+         * @param result defines the Vector3 object where to store the result
          * @returns the unmodified current Vector3 
          */
         public scaleAndAddToRef(scale: number, result: Vector3): Vector3 {
@@ -2619,6 +2624,7 @@
         /**
          * Scale the current Vector4 values by a factor and add the result to a given Vector4  
          * @param scale defines the scale factor
+         * @param result defines the Vector4 object where to store the result
          * @returns the unmodified current Vector4 
          */
         public scaleAndAddToRef(scale: number, result: Vector4): Vector4 {
@@ -3166,8 +3172,9 @@
         }
 
         /**
-         * Scale the current VectQuaternionor4 values by a factor to a given Quaternion  
+         * Scale the current Quaternion values by a factor to a given Quaternion  
          * @param scale defines the scale factor
+         * @param result defines the Quaternion object where to store the result
          * @returns the unmodified current Quaternion 
          */
         public scaleToRef(scale: number, result: Quaternion): Quaternion {
@@ -3179,8 +3186,9 @@
         }         
 
         /**
-         * Scale the current VectQuaternionor4 values by a factor and add the result to a given Quaternion  
+         * Scale the current Quaternion values by a factor and add the result to a given Quaternion  
          * @param scale defines the scale factor
+         * @param result defines the Quaternion object where to store the result
          * @returns the unmodified current Quaternion 
          */
         public scaleAndAddToRef(scale: number, result: Quaternion): Quaternion {
@@ -4081,6 +4089,7 @@
         /**
          * Scale the current Matrix values by a factor to a given result Matrix  
          * @param scale defines the scale factor
+         * @param result defines the Matrix to store the result
          * @returns the current Matrix  
          */
         public scaleToRef(scale: number, result: Matrix): Matrix {
@@ -4094,6 +4103,7 @@
         /**
          * Scale the current Matrix values by a factor and add the result to a given Matrix  
          * @param scale defines the scale factor
+         * @param result defines the Matrix to store the result
          * @returns the current Matrix  
          */
         public scaleAndAddToRef(scale: number, result: Matrix): Matrix {