David Catuhe %!s(int64=7) %!d(string=hai) anos
pai
achega
a4441fed72

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 6326 - 6325
Playground/babylon.d.txt


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 3397 - 3403
dist/preview release/babylon.d.ts


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 8 - 8
dist/preview release/babylon.js


+ 36 - 59
dist/preview release/babylon.max.js

@@ -29688,7 +29688,7 @@ var BABYLON;
                 case VertexBuffer.BYTE: {
                     var value = dataView.getInt8(byteOffset);
                     if (normalized) {
-                        value = (value + 0.5) / 127.5;
+                        value = Math.max(value / 127, -1);
                     }
                     return value;
                 }
@@ -29702,7 +29702,7 @@ var BABYLON;
                 case VertexBuffer.SHORT: {
                     var value = dataView.getInt16(byteOffset, true);
                     if (normalized) {
-                        value = (value + 0.5) / 16383.5;
+                        value = Math.max(value / 16383, -1);
                     }
                     return value;
                 }
@@ -38824,17 +38824,16 @@ var BABYLON;
             if (!data) {
                 return null;
             }
-            var defaultStride = BABYLON.VertexBuffer.DeduceStride(vertexBuffer.getKind());
-            var defaultByteStride = defaultStride * BABYLON.VertexBuffer.GetTypeByteLength(vertexBuffer.type);
-            var count = this._totalVertices * defaultStride;
-            if (vertexBuffer.type !== BABYLON.VertexBuffer.FLOAT || vertexBuffer.byteStride !== defaultByteStride) {
+            var tightlyPackedByteStride = vertexBuffer.getSize() * BABYLON.VertexBuffer.GetTypeByteLength(vertexBuffer.type);
+            var count = this._totalVertices * vertexBuffer.getSize();
+            if (vertexBuffer.type !== BABYLON.VertexBuffer.FLOAT || vertexBuffer.byteStride !== tightlyPackedByteStride) {
                 var copy_1 = new Array(count);
                 vertexBuffer.forEach(count, function (value, index) {
                     copy_1[index] = value;
                 });
                 return copy_1;
             }
-            if (!(data instanceof Array || data instanceof Float32Array) || vertexBuffer.byteOffset !== 0 || data.length !== count) {
+            if (!((data instanceof Array) || (data instanceof Float32Array)) || vertexBuffer.byteOffset !== 0 || data.length !== count) {
                 if (data instanceof Array) {
                     var offset = vertexBuffer.byteOffset / 4;
                     return BABYLON.Tools.Slice(data, offset, offset + count);
@@ -51882,8 +51881,13 @@ var BABYLON;
         });
         /**
          * Resets the runtime animation to the beginning
+         * @param restoreOriginal defines whether to restore the target property to the original value
          */
-        RuntimeAnimation.prototype.reset = function () {
+        RuntimeAnimation.prototype.reset = function (restoreOriginal) {
+            if (restoreOriginal === void 0) { restoreOriginal = false; }
+            if (restoreOriginal && this._originalValue != null) {
+                this.setValue(this._originalValue, -1);
+            }
             this._offsetsCache = {};
             this._highLimitsCache = {};
             this._currentFrame = 0;
@@ -51923,36 +51927,18 @@ var BABYLON;
             return this._animation._interpolate(currentFrame, repeatCount, this._workValue, loopMode, offsetValue, highLimitValue);
         };
         /**
-         * Affect the interpolated value to the target
+         * Apply 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
+         * @param weight defines the weight to apply to this value (Defaults to 1.0)
          */
         RuntimeAnimation.prototype.setValue = function (currentValue, weight) {
             if (weight === void 0) { weight = 1.0; }
-            if (this._target instanceof Array) {
-                for (var _i = 0, _a = this._target; _i < _a.length; _i++) {
-                    var target = _a[_i];
-                    this._setValue(target, currentValue, weight);
-                }
-            }
-            else {
-                this._setValue(this._target, currentValue, weight);
-            }
-        };
-        /**
-         * Sets the value of the runtime animation
-         * @param target The target property of the runtime animation
-         * @param currentValue The current value to use for the runtime animation
-         * @param weight The weight to use for the runtime animation (Defaults to 1.0)
-         */
-        RuntimeAnimation.prototype._setValue = function (target, currentValue, weight) {
-            if (weight === void 0) { weight = 1.0; }
             // Set value
             var path;
             var destination;
             var targetPropertyPath = this._animation.targetPropertyPath;
             if (targetPropertyPath.length > 1) {
-                var property = target[targetPropertyPath[0]];
+                var property = this._target[targetPropertyPath[0]];
                 for (var index = 1; index < targetPropertyPath.length - 1; index++) {
                     property = property[targetPropertyPath[index]];
                 }
@@ -51961,14 +51947,28 @@ var BABYLON;
             }
             else {
                 path = targetPropertyPath[0];
-                destination = target;
+                destination = this._target;
             }
             this._targetPath = path;
             this._activeTarget = destination;
             this._weight = weight;
+            if (!this._originalValue) {
+                var originalValue = void 0;
+                if (destination.getRestPose && path === "_matrix") { // For bones
+                    originalValue = destination.getRestPose();
+                }
+                else {
+                    originalValue = destination[path];
+                }
+                if (originalValue.clone) {
+                    this._originalValue = originalValue.clone();
+                }
+                else {
+                    this._originalValue = originalValue;
+                }
+            }
             // Blending
-            var enableBlending = target && target.animationPropertiesOverride ? target.animationPropertiesOverride.enableBlending : this._animation.enableBlending;
-            var blendingSpeed = target && target.animationPropertiesOverride ? target.animationPropertiesOverride.blendingSpeed : this._animation.blendingSpeed;
+            var enableBlending = this._target && this._target.animationPropertiesOverride ? this._target.animationPropertiesOverride.enableBlending : this._animation.enableBlending;
             if (enableBlending && this._blendingFactor <= 1.0) {
                 if (!this._originalBlendValue) {
                     var originalValue = destination[path];
@@ -51979,25 +51979,6 @@ var BABYLON;
                         this._originalBlendValue = originalValue;
                     }
                 }
-            }
-            if (weight !== -1.0) {
-                if (!this._originalValue) {
-                    var originalValue = void 0;
-                    if (destination.getRestPose && path === "_matrix") { // For bones
-                        originalValue = destination.getRestPose();
-                    }
-                    else {
-                        originalValue = destination[path];
-                    }
-                    if (originalValue.clone) {
-                        this._originalValue = originalValue.clone();
-                    }
-                    else {
-                        this._originalValue = originalValue;
-                    }
-                }
-            }
-            if (enableBlending && this._blendingFactor <= 1.0) {
                 if (this._originalBlendValue.m) { // Matrix
                     if (BABYLON.Animation.AllowMatrixDecomposeForInterpolation) {
                         if (this._currentValue) {
@@ -52031,6 +52012,7 @@ var BABYLON;
                         this._currentValue = currentValue;
                     }
                 }
+                var blendingSpeed = this._target && this._target.animationPropertiesOverride ? this._target.animationPropertiesOverride.blendingSpeed : this._animation.blendingSpeed;
                 this._blendingFactor += blendingSpeed;
             }
             else {
@@ -52042,8 +52024,8 @@ var BABYLON;
             else {
                 destination[path] = this._currentValue;
             }
-            if (target.markAsDirty) {
-                target.markAsDirty(this._animation.targetProperty);
+            if (this._target.markAsDirty) {
+                this._target.markAsDirty(this._animation.targetProperty);
             }
         };
         /**
@@ -52376,12 +52358,7 @@ var BABYLON;
         Animatable.prototype.reset = function () {
             var runtimeAnimations = this._runtimeAnimations;
             for (var index = 0; index < runtimeAnimations.length; index++) {
-                runtimeAnimations[index].reset();
-            }
-            // 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);
+                runtimeAnimations[index].reset(true);
             }
             this._localDelayOffset = null;
             this._pausedDelay = null;

+ 36 - 59
dist/preview release/babylon.no-module.max.js

@@ -29655,7 +29655,7 @@ var BABYLON;
                 case VertexBuffer.BYTE: {
                     var value = dataView.getInt8(byteOffset);
                     if (normalized) {
-                        value = (value + 0.5) / 127.5;
+                        value = Math.max(value / 127, -1);
                     }
                     return value;
                 }
@@ -29669,7 +29669,7 @@ var BABYLON;
                 case VertexBuffer.SHORT: {
                     var value = dataView.getInt16(byteOffset, true);
                     if (normalized) {
-                        value = (value + 0.5) / 16383.5;
+                        value = Math.max(value / 16383, -1);
                     }
                     return value;
                 }
@@ -38791,17 +38791,16 @@ var BABYLON;
             if (!data) {
                 return null;
             }
-            var defaultStride = BABYLON.VertexBuffer.DeduceStride(vertexBuffer.getKind());
-            var defaultByteStride = defaultStride * BABYLON.VertexBuffer.GetTypeByteLength(vertexBuffer.type);
-            var count = this._totalVertices * defaultStride;
-            if (vertexBuffer.type !== BABYLON.VertexBuffer.FLOAT || vertexBuffer.byteStride !== defaultByteStride) {
+            var tightlyPackedByteStride = vertexBuffer.getSize() * BABYLON.VertexBuffer.GetTypeByteLength(vertexBuffer.type);
+            var count = this._totalVertices * vertexBuffer.getSize();
+            if (vertexBuffer.type !== BABYLON.VertexBuffer.FLOAT || vertexBuffer.byteStride !== tightlyPackedByteStride) {
                 var copy_1 = new Array(count);
                 vertexBuffer.forEach(count, function (value, index) {
                     copy_1[index] = value;
                 });
                 return copy_1;
             }
-            if (!(data instanceof Array || data instanceof Float32Array) || vertexBuffer.byteOffset !== 0 || data.length !== count) {
+            if (!((data instanceof Array) || (data instanceof Float32Array)) || vertexBuffer.byteOffset !== 0 || data.length !== count) {
                 if (data instanceof Array) {
                     var offset = vertexBuffer.byteOffset / 4;
                     return BABYLON.Tools.Slice(data, offset, offset + count);
@@ -51849,8 +51848,13 @@ var BABYLON;
         });
         /**
          * Resets the runtime animation to the beginning
+         * @param restoreOriginal defines whether to restore the target property to the original value
          */
-        RuntimeAnimation.prototype.reset = function () {
+        RuntimeAnimation.prototype.reset = function (restoreOriginal) {
+            if (restoreOriginal === void 0) { restoreOriginal = false; }
+            if (restoreOriginal && this._originalValue != null) {
+                this.setValue(this._originalValue, -1);
+            }
             this._offsetsCache = {};
             this._highLimitsCache = {};
             this._currentFrame = 0;
@@ -51890,36 +51894,18 @@ var BABYLON;
             return this._animation._interpolate(currentFrame, repeatCount, this._workValue, loopMode, offsetValue, highLimitValue);
         };
         /**
-         * Affect the interpolated value to the target
+         * Apply 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
+         * @param weight defines the weight to apply to this value (Defaults to 1.0)
          */
         RuntimeAnimation.prototype.setValue = function (currentValue, weight) {
             if (weight === void 0) { weight = 1.0; }
-            if (this._target instanceof Array) {
-                for (var _i = 0, _a = this._target; _i < _a.length; _i++) {
-                    var target = _a[_i];
-                    this._setValue(target, currentValue, weight);
-                }
-            }
-            else {
-                this._setValue(this._target, currentValue, weight);
-            }
-        };
-        /**
-         * Sets the value of the runtime animation
-         * @param target The target property of the runtime animation
-         * @param currentValue The current value to use for the runtime animation
-         * @param weight The weight to use for the runtime animation (Defaults to 1.0)
-         */
-        RuntimeAnimation.prototype._setValue = function (target, currentValue, weight) {
-            if (weight === void 0) { weight = 1.0; }
             // Set value
             var path;
             var destination;
             var targetPropertyPath = this._animation.targetPropertyPath;
             if (targetPropertyPath.length > 1) {
-                var property = target[targetPropertyPath[0]];
+                var property = this._target[targetPropertyPath[0]];
                 for (var index = 1; index < targetPropertyPath.length - 1; index++) {
                     property = property[targetPropertyPath[index]];
                 }
@@ -51928,14 +51914,28 @@ var BABYLON;
             }
             else {
                 path = targetPropertyPath[0];
-                destination = target;
+                destination = this._target;
             }
             this._targetPath = path;
             this._activeTarget = destination;
             this._weight = weight;
+            if (!this._originalValue) {
+                var originalValue = void 0;
+                if (destination.getRestPose && path === "_matrix") { // For bones
+                    originalValue = destination.getRestPose();
+                }
+                else {
+                    originalValue = destination[path];
+                }
+                if (originalValue.clone) {
+                    this._originalValue = originalValue.clone();
+                }
+                else {
+                    this._originalValue = originalValue;
+                }
+            }
             // Blending
-            var enableBlending = target && target.animationPropertiesOverride ? target.animationPropertiesOverride.enableBlending : this._animation.enableBlending;
-            var blendingSpeed = target && target.animationPropertiesOverride ? target.animationPropertiesOverride.blendingSpeed : this._animation.blendingSpeed;
+            var enableBlending = this._target && this._target.animationPropertiesOverride ? this._target.animationPropertiesOverride.enableBlending : this._animation.enableBlending;
             if (enableBlending && this._blendingFactor <= 1.0) {
                 if (!this._originalBlendValue) {
                     var originalValue = destination[path];
@@ -51946,25 +51946,6 @@ var BABYLON;
                         this._originalBlendValue = originalValue;
                     }
                 }
-            }
-            if (weight !== -1.0) {
-                if (!this._originalValue) {
-                    var originalValue = void 0;
-                    if (destination.getRestPose && path === "_matrix") { // For bones
-                        originalValue = destination.getRestPose();
-                    }
-                    else {
-                        originalValue = destination[path];
-                    }
-                    if (originalValue.clone) {
-                        this._originalValue = originalValue.clone();
-                    }
-                    else {
-                        this._originalValue = originalValue;
-                    }
-                }
-            }
-            if (enableBlending && this._blendingFactor <= 1.0) {
                 if (this._originalBlendValue.m) { // Matrix
                     if (BABYLON.Animation.AllowMatrixDecomposeForInterpolation) {
                         if (this._currentValue) {
@@ -51998,6 +51979,7 @@ var BABYLON;
                         this._currentValue = currentValue;
                     }
                 }
+                var blendingSpeed = this._target && this._target.animationPropertiesOverride ? this._target.animationPropertiesOverride.blendingSpeed : this._animation.blendingSpeed;
                 this._blendingFactor += blendingSpeed;
             }
             else {
@@ -52009,8 +51991,8 @@ var BABYLON;
             else {
                 destination[path] = this._currentValue;
             }
-            if (target.markAsDirty) {
-                target.markAsDirty(this._animation.targetProperty);
+            if (this._target.markAsDirty) {
+                this._target.markAsDirty(this._animation.targetProperty);
             }
         };
         /**
@@ -52343,12 +52325,7 @@ var BABYLON;
         Animatable.prototype.reset = function () {
             var runtimeAnimations = this._runtimeAnimations;
             for (var index = 0; index < runtimeAnimations.length; index++) {
-                runtimeAnimations[index].reset();
-            }
-            // 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);
+                runtimeAnimations[index].reset(true);
             }
             this._localDelayOffset = null;
             this._pausedDelay = null;

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 8 - 8
dist/preview release/babylon.worker.js


+ 36 - 59
dist/preview release/es6.js

@@ -29655,7 +29655,7 @@ var BABYLON;
                 case VertexBuffer.BYTE: {
                     var value = dataView.getInt8(byteOffset);
                     if (normalized) {
-                        value = (value + 0.5) / 127.5;
+                        value = Math.max(value / 127, -1);
                     }
                     return value;
                 }
@@ -29669,7 +29669,7 @@ var BABYLON;
                 case VertexBuffer.SHORT: {
                     var value = dataView.getInt16(byteOffset, true);
                     if (normalized) {
-                        value = (value + 0.5) / 16383.5;
+                        value = Math.max(value / 16383, -1);
                     }
                     return value;
                 }
@@ -38791,17 +38791,16 @@ var BABYLON;
             if (!data) {
                 return null;
             }
-            var defaultStride = BABYLON.VertexBuffer.DeduceStride(vertexBuffer.getKind());
-            var defaultByteStride = defaultStride * BABYLON.VertexBuffer.GetTypeByteLength(vertexBuffer.type);
-            var count = this._totalVertices * defaultStride;
-            if (vertexBuffer.type !== BABYLON.VertexBuffer.FLOAT || vertexBuffer.byteStride !== defaultByteStride) {
+            var tightlyPackedByteStride = vertexBuffer.getSize() * BABYLON.VertexBuffer.GetTypeByteLength(vertexBuffer.type);
+            var count = this._totalVertices * vertexBuffer.getSize();
+            if (vertexBuffer.type !== BABYLON.VertexBuffer.FLOAT || vertexBuffer.byteStride !== tightlyPackedByteStride) {
                 var copy_1 = new Array(count);
                 vertexBuffer.forEach(count, function (value, index) {
                     copy_1[index] = value;
                 });
                 return copy_1;
             }
-            if (!(data instanceof Array || data instanceof Float32Array) || vertexBuffer.byteOffset !== 0 || data.length !== count) {
+            if (!((data instanceof Array) || (data instanceof Float32Array)) || vertexBuffer.byteOffset !== 0 || data.length !== count) {
                 if (data instanceof Array) {
                     var offset = vertexBuffer.byteOffset / 4;
                     return BABYLON.Tools.Slice(data, offset, offset + count);
@@ -51849,8 +51848,13 @@ var BABYLON;
         });
         /**
          * Resets the runtime animation to the beginning
+         * @param restoreOriginal defines whether to restore the target property to the original value
          */
-        RuntimeAnimation.prototype.reset = function () {
+        RuntimeAnimation.prototype.reset = function (restoreOriginal) {
+            if (restoreOriginal === void 0) { restoreOriginal = false; }
+            if (restoreOriginal && this._originalValue != null) {
+                this.setValue(this._originalValue, -1);
+            }
             this._offsetsCache = {};
             this._highLimitsCache = {};
             this._currentFrame = 0;
@@ -51890,36 +51894,18 @@ var BABYLON;
             return this._animation._interpolate(currentFrame, repeatCount, this._workValue, loopMode, offsetValue, highLimitValue);
         };
         /**
-         * Affect the interpolated value to the target
+         * Apply 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
+         * @param weight defines the weight to apply to this value (Defaults to 1.0)
          */
         RuntimeAnimation.prototype.setValue = function (currentValue, weight) {
             if (weight === void 0) { weight = 1.0; }
-            if (this._target instanceof Array) {
-                for (var _i = 0, _a = this._target; _i < _a.length; _i++) {
-                    var target = _a[_i];
-                    this._setValue(target, currentValue, weight);
-                }
-            }
-            else {
-                this._setValue(this._target, currentValue, weight);
-            }
-        };
-        /**
-         * Sets the value of the runtime animation
-         * @param target The target property of the runtime animation
-         * @param currentValue The current value to use for the runtime animation
-         * @param weight The weight to use for the runtime animation (Defaults to 1.0)
-         */
-        RuntimeAnimation.prototype._setValue = function (target, currentValue, weight) {
-            if (weight === void 0) { weight = 1.0; }
             // Set value
             var path;
             var destination;
             var targetPropertyPath = this._animation.targetPropertyPath;
             if (targetPropertyPath.length > 1) {
-                var property = target[targetPropertyPath[0]];
+                var property = this._target[targetPropertyPath[0]];
                 for (var index = 1; index < targetPropertyPath.length - 1; index++) {
                     property = property[targetPropertyPath[index]];
                 }
@@ -51928,14 +51914,28 @@ var BABYLON;
             }
             else {
                 path = targetPropertyPath[0];
-                destination = target;
+                destination = this._target;
             }
             this._targetPath = path;
             this._activeTarget = destination;
             this._weight = weight;
+            if (!this._originalValue) {
+                var originalValue = void 0;
+                if (destination.getRestPose && path === "_matrix") { // For bones
+                    originalValue = destination.getRestPose();
+                }
+                else {
+                    originalValue = destination[path];
+                }
+                if (originalValue.clone) {
+                    this._originalValue = originalValue.clone();
+                }
+                else {
+                    this._originalValue = originalValue;
+                }
+            }
             // Blending
-            var enableBlending = target && target.animationPropertiesOverride ? target.animationPropertiesOverride.enableBlending : this._animation.enableBlending;
-            var blendingSpeed = target && target.animationPropertiesOverride ? target.animationPropertiesOverride.blendingSpeed : this._animation.blendingSpeed;
+            var enableBlending = this._target && this._target.animationPropertiesOverride ? this._target.animationPropertiesOverride.enableBlending : this._animation.enableBlending;
             if (enableBlending && this._blendingFactor <= 1.0) {
                 if (!this._originalBlendValue) {
                     var originalValue = destination[path];
@@ -51946,25 +51946,6 @@ var BABYLON;
                         this._originalBlendValue = originalValue;
                     }
                 }
-            }
-            if (weight !== -1.0) {
-                if (!this._originalValue) {
-                    var originalValue = void 0;
-                    if (destination.getRestPose && path === "_matrix") { // For bones
-                        originalValue = destination.getRestPose();
-                    }
-                    else {
-                        originalValue = destination[path];
-                    }
-                    if (originalValue.clone) {
-                        this._originalValue = originalValue.clone();
-                    }
-                    else {
-                        this._originalValue = originalValue;
-                    }
-                }
-            }
-            if (enableBlending && this._blendingFactor <= 1.0) {
                 if (this._originalBlendValue.m) { // Matrix
                     if (BABYLON.Animation.AllowMatrixDecomposeForInterpolation) {
                         if (this._currentValue) {
@@ -51998,6 +51979,7 @@ var BABYLON;
                         this._currentValue = currentValue;
                     }
                 }
+                var blendingSpeed = this._target && this._target.animationPropertiesOverride ? this._target.animationPropertiesOverride.blendingSpeed : this._animation.blendingSpeed;
                 this._blendingFactor += blendingSpeed;
             }
             else {
@@ -52009,8 +51991,8 @@ var BABYLON;
             else {
                 destination[path] = this._currentValue;
             }
-            if (target.markAsDirty) {
-                target.markAsDirty(this._animation.targetProperty);
+            if (this._target.markAsDirty) {
+                this._target.markAsDirty(this._animation.targetProperty);
             }
         };
         /**
@@ -52343,12 +52325,7 @@ var BABYLON;
         Animatable.prototype.reset = function () {
             var runtimeAnimations = this._runtimeAnimations;
             for (var index = 0; index < runtimeAnimations.length; index++) {
-                runtimeAnimations[index].reset();
-            }
-            // 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);
+                runtimeAnimations[index].reset(true);
             }
             this._localDelayOffset = null;
             this._pausedDelay = null;

+ 6 - 6
dist/preview release/loaders/babylon.glTF2FileLoader.js

@@ -1534,13 +1534,12 @@ var BABYLON;
                                 value: key.value[targetIndex],
                                 outTangent: key.outTangent ? key.outTangent[targetIndex] : undefined
                             }); }));
-                            var morphTargets = new Array();
                             _this._forEachPrimitive(targetNode, function (babylonMesh) {
                                 var morphTarget = babylonMesh.morphTargetManager.getTarget(targetIndex);
-                                morphTarget.animations.push(babylonAnimation);
-                                morphTargets.push(morphTarget);
+                                var babylonAnimationClone = babylonAnimation.clone();
+                                morphTarget.animations.push(babylonAnimationClone);
+                                babylonAnimationGroup.addTargetedAnimation(babylonAnimationClone, morphTarget);
                             });
-                            babylonAnimationGroup.addTargetedAnimation(babylonAnimation, morphTargets);
                         };
                         for (var targetIndex = 0; targetIndex < targetNode._numMorphTargets; targetIndex++) {
                             _loop_1(targetIndex);
@@ -1553,9 +1552,10 @@ var BABYLON;
                         if (targetNode._babylonAnimationTargets) {
                             for (var _i = 0, _a = targetNode._babylonAnimationTargets; _i < _a.length; _i++) {
                                 var babylonAnimationTarget = _a[_i];
-                                babylonAnimationTarget.animations.push(babylonAnimation);
+                                var babylonAnimationClone = babylonAnimation.clone();
+                                babylonAnimationTarget.animations.push(babylonAnimationClone);
+                                babylonAnimationGroup.addTargetedAnimation(babylonAnimationClone, babylonAnimationTarget);
                             }
-                            babylonAnimationGroup.addTargetedAnimation(babylonAnimation, targetNode._babylonAnimationTargets);
                         }
                     }
                 });

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1 - 1
dist/preview release/loaders/babylon.glTF2FileLoader.min.js


+ 6 - 6
dist/preview release/loaders/babylon.glTFFileLoader.js

@@ -3749,13 +3749,12 @@ var BABYLON;
                                 value: key.value[targetIndex],
                                 outTangent: key.outTangent ? key.outTangent[targetIndex] : undefined
                             }); }));
-                            var morphTargets = new Array();
                             _this._forEachPrimitive(targetNode, function (babylonMesh) {
                                 var morphTarget = babylonMesh.morphTargetManager.getTarget(targetIndex);
-                                morphTarget.animations.push(babylonAnimation);
-                                morphTargets.push(morphTarget);
+                                var babylonAnimationClone = babylonAnimation.clone();
+                                morphTarget.animations.push(babylonAnimationClone);
+                                babylonAnimationGroup.addTargetedAnimation(babylonAnimationClone, morphTarget);
                             });
-                            babylonAnimationGroup.addTargetedAnimation(babylonAnimation, morphTargets);
                         };
                         for (var targetIndex = 0; targetIndex < targetNode._numMorphTargets; targetIndex++) {
                             _loop_1(targetIndex);
@@ -3768,9 +3767,10 @@ var BABYLON;
                         if (targetNode._babylonAnimationTargets) {
                             for (var _i = 0, _a = targetNode._babylonAnimationTargets; _i < _a.length; _i++) {
                                 var babylonAnimationTarget = _a[_i];
-                                babylonAnimationTarget.animations.push(babylonAnimation);
+                                var babylonAnimationClone = babylonAnimation.clone();
+                                babylonAnimationTarget.animations.push(babylonAnimationClone);
+                                babylonAnimationGroup.addTargetedAnimation(babylonAnimationClone, babylonAnimationTarget);
                             }
-                            babylonAnimationGroup.addTargetedAnimation(babylonAnimation, targetNode._babylonAnimationTargets);
                         }
                     }
                 });

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 2 - 2
dist/preview release/loaders/babylon.glTFFileLoader.min.js


+ 6 - 6
dist/preview release/loaders/babylonjs.loaders.js

@@ -4731,13 +4731,12 @@ var BABYLON;
                                 value: key.value[targetIndex],
                                 outTangent: key.outTangent ? key.outTangent[targetIndex] : undefined
                             }); }));
-                            var morphTargets = new Array();
                             _this._forEachPrimitive(targetNode, function (babylonMesh) {
                                 var morphTarget = babylonMesh.morphTargetManager.getTarget(targetIndex);
-                                morphTarget.animations.push(babylonAnimation);
-                                morphTargets.push(morphTarget);
+                                var babylonAnimationClone = babylonAnimation.clone();
+                                morphTarget.animations.push(babylonAnimationClone);
+                                babylonAnimationGroup.addTargetedAnimation(babylonAnimationClone, morphTarget);
                             });
-                            babylonAnimationGroup.addTargetedAnimation(babylonAnimation, morphTargets);
                         };
                         for (var targetIndex = 0; targetIndex < targetNode._numMorphTargets; targetIndex++) {
                             _loop_1(targetIndex);
@@ -4750,9 +4749,10 @@ var BABYLON;
                         if (targetNode._babylonAnimationTargets) {
                             for (var _i = 0, _a = targetNode._babylonAnimationTargets; _i < _a.length; _i++) {
                                 var babylonAnimationTarget = _a[_i];
-                                babylonAnimationTarget.animations.push(babylonAnimation);
+                                var babylonAnimationClone = babylonAnimation.clone();
+                                babylonAnimationTarget.animations.push(babylonAnimationClone);
+                                babylonAnimationGroup.addTargetedAnimation(babylonAnimationClone, babylonAnimationTarget);
                             }
-                            babylonAnimationGroup.addTargetedAnimation(babylonAnimation, targetNode._babylonAnimationTargets);
                         }
                     }
                 });

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 2 - 2
dist/preview release/loaders/babylonjs.loaders.min.js


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 8 - 8
dist/preview release/viewer/babylon.viewer.js


+ 36 - 59
dist/preview release/viewer/babylon.viewer.max.js

@@ -29776,7 +29776,7 @@ var BABYLON;
                 case VertexBuffer.BYTE: {
                     var value = dataView.getInt8(byteOffset);
                     if (normalized) {
-                        value = (value + 0.5) / 127.5;
+                        value = Math.max(value / 127, -1);
                     }
                     return value;
                 }
@@ -29790,7 +29790,7 @@ var BABYLON;
                 case VertexBuffer.SHORT: {
                     var value = dataView.getInt16(byteOffset, true);
                     if (normalized) {
-                        value = (value + 0.5) / 16383.5;
+                        value = Math.max(value / 16383, -1);
                     }
                     return value;
                 }
@@ -38912,17 +38912,16 @@ var BABYLON;
             if (!data) {
                 return null;
             }
-            var defaultStride = BABYLON.VertexBuffer.DeduceStride(vertexBuffer.getKind());
-            var defaultByteStride = defaultStride * BABYLON.VertexBuffer.GetTypeByteLength(vertexBuffer.type);
-            var count = this._totalVertices * defaultStride;
-            if (vertexBuffer.type !== BABYLON.VertexBuffer.FLOAT || vertexBuffer.byteStride !== defaultByteStride) {
+            var tightlyPackedByteStride = vertexBuffer.getSize() * BABYLON.VertexBuffer.GetTypeByteLength(vertexBuffer.type);
+            var count = this._totalVertices * vertexBuffer.getSize();
+            if (vertexBuffer.type !== BABYLON.VertexBuffer.FLOAT || vertexBuffer.byteStride !== tightlyPackedByteStride) {
                 var copy_1 = new Array(count);
                 vertexBuffer.forEach(count, function (value, index) {
                     copy_1[index] = value;
                 });
                 return copy_1;
             }
-            if (!(data instanceof Array || data instanceof Float32Array) || vertexBuffer.byteOffset !== 0 || data.length !== count) {
+            if (!((data instanceof Array) || (data instanceof Float32Array)) || vertexBuffer.byteOffset !== 0 || data.length !== count) {
                 if (data instanceof Array) {
                     var offset = vertexBuffer.byteOffset / 4;
                     return BABYLON.Tools.Slice(data, offset, offset + count);
@@ -51970,8 +51969,13 @@ var BABYLON;
         });
         /**
          * Resets the runtime animation to the beginning
+         * @param restoreOriginal defines whether to restore the target property to the original value
          */
-        RuntimeAnimation.prototype.reset = function () {
+        RuntimeAnimation.prototype.reset = function (restoreOriginal) {
+            if (restoreOriginal === void 0) { restoreOriginal = false; }
+            if (restoreOriginal && this._originalValue != null) {
+                this.setValue(this._originalValue, -1);
+            }
             this._offsetsCache = {};
             this._highLimitsCache = {};
             this._currentFrame = 0;
@@ -52011,36 +52015,18 @@ var BABYLON;
             return this._animation._interpolate(currentFrame, repeatCount, this._workValue, loopMode, offsetValue, highLimitValue);
         };
         /**
-         * Affect the interpolated value to the target
+         * Apply 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
+         * @param weight defines the weight to apply to this value (Defaults to 1.0)
          */
         RuntimeAnimation.prototype.setValue = function (currentValue, weight) {
             if (weight === void 0) { weight = 1.0; }
-            if (this._target instanceof Array) {
-                for (var _i = 0, _a = this._target; _i < _a.length; _i++) {
-                    var target = _a[_i];
-                    this._setValue(target, currentValue, weight);
-                }
-            }
-            else {
-                this._setValue(this._target, currentValue, weight);
-            }
-        };
-        /**
-         * Sets the value of the runtime animation
-         * @param target The target property of the runtime animation
-         * @param currentValue The current value to use for the runtime animation
-         * @param weight The weight to use for the runtime animation (Defaults to 1.0)
-         */
-        RuntimeAnimation.prototype._setValue = function (target, currentValue, weight) {
-            if (weight === void 0) { weight = 1.0; }
             // Set value
             var path;
             var destination;
             var targetPropertyPath = this._animation.targetPropertyPath;
             if (targetPropertyPath.length > 1) {
-                var property = target[targetPropertyPath[0]];
+                var property = this._target[targetPropertyPath[0]];
                 for (var index = 1; index < targetPropertyPath.length - 1; index++) {
                     property = property[targetPropertyPath[index]];
                 }
@@ -52049,14 +52035,28 @@ var BABYLON;
             }
             else {
                 path = targetPropertyPath[0];
-                destination = target;
+                destination = this._target;
             }
             this._targetPath = path;
             this._activeTarget = destination;
             this._weight = weight;
+            if (!this._originalValue) {
+                var originalValue = void 0;
+                if (destination.getRestPose && path === "_matrix") { // For bones
+                    originalValue = destination.getRestPose();
+                }
+                else {
+                    originalValue = destination[path];
+                }
+                if (originalValue.clone) {
+                    this._originalValue = originalValue.clone();
+                }
+                else {
+                    this._originalValue = originalValue;
+                }
+            }
             // Blending
-            var enableBlending = target && target.animationPropertiesOverride ? target.animationPropertiesOverride.enableBlending : this._animation.enableBlending;
-            var blendingSpeed = target && target.animationPropertiesOverride ? target.animationPropertiesOverride.blendingSpeed : this._animation.blendingSpeed;
+            var enableBlending = this._target && this._target.animationPropertiesOverride ? this._target.animationPropertiesOverride.enableBlending : this._animation.enableBlending;
             if (enableBlending && this._blendingFactor <= 1.0) {
                 if (!this._originalBlendValue) {
                     var originalValue = destination[path];
@@ -52067,25 +52067,6 @@ var BABYLON;
                         this._originalBlendValue = originalValue;
                     }
                 }
-            }
-            if (weight !== -1.0) {
-                if (!this._originalValue) {
-                    var originalValue = void 0;
-                    if (destination.getRestPose && path === "_matrix") { // For bones
-                        originalValue = destination.getRestPose();
-                    }
-                    else {
-                        originalValue = destination[path];
-                    }
-                    if (originalValue.clone) {
-                        this._originalValue = originalValue.clone();
-                    }
-                    else {
-                        this._originalValue = originalValue;
-                    }
-                }
-            }
-            if (enableBlending && this._blendingFactor <= 1.0) {
                 if (this._originalBlendValue.m) { // Matrix
                     if (BABYLON.Animation.AllowMatrixDecomposeForInterpolation) {
                         if (this._currentValue) {
@@ -52119,6 +52100,7 @@ var BABYLON;
                         this._currentValue = currentValue;
                     }
                 }
+                var blendingSpeed = this._target && this._target.animationPropertiesOverride ? this._target.animationPropertiesOverride.blendingSpeed : this._animation.blendingSpeed;
                 this._blendingFactor += blendingSpeed;
             }
             else {
@@ -52130,8 +52112,8 @@ var BABYLON;
             else {
                 destination[path] = this._currentValue;
             }
-            if (target.markAsDirty) {
-                target.markAsDirty(this._animation.targetProperty);
+            if (this._target.markAsDirty) {
+                this._target.markAsDirty(this._animation.targetProperty);
             }
         };
         /**
@@ -52464,12 +52446,7 @@ var BABYLON;
         Animatable.prototype.reset = function () {
             var runtimeAnimations = this._runtimeAnimations;
             for (var index = 0; index < runtimeAnimations.length; index++) {
-                runtimeAnimations[index].reset();
-            }
-            // 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);
+                runtimeAnimations[index].reset(true);
             }
             this._localDelayOffset = null;
             this._pausedDelay = null;

+ 2 - 2
src/Animations/babylon.runtimeAnimation.ts

@@ -246,7 +246,7 @@
             this._activeTarget = destination;
             this._weight = weight;
 
-            if (!this._originalValue) {
+            if (!this._originalValue ) {
                 let originalValue: any;
 
                 if (destination.getRestPose && path === "_matrix") { // For bones
@@ -255,7 +255,7 @@
                     originalValue = destination[path];
                 }
 
-                if (originalValue.clone) {
+                if (originalValue && originalValue.clone) {
                     this._originalValue = originalValue.clone();
                 } else {
                     this._originalValue = originalValue;

BIN=BIN
tests/validation/ReferenceImages/pbrglossy.png


BIN=BIN
tests/validation/ReferenceImages/pbrrough.png