|
@@ -29688,7 +29688,7 @@ var BABYLON;
|
|
case VertexBuffer.BYTE: {
|
|
case VertexBuffer.BYTE: {
|
|
var value = dataView.getInt8(byteOffset);
|
|
var value = dataView.getInt8(byteOffset);
|
|
if (normalized) {
|
|
if (normalized) {
|
|
- value = (value + 0.5) / 127.5;
|
|
|
|
|
|
+ value = Math.max(value / 127, -1);
|
|
}
|
|
}
|
|
return value;
|
|
return value;
|
|
}
|
|
}
|
|
@@ -29702,7 +29702,7 @@ var BABYLON;
|
|
case VertexBuffer.SHORT: {
|
|
case VertexBuffer.SHORT: {
|
|
var value = dataView.getInt16(byteOffset, true);
|
|
var value = dataView.getInt16(byteOffset, true);
|
|
if (normalized) {
|
|
if (normalized) {
|
|
- value = (value + 0.5) / 16383.5;
|
|
|
|
|
|
+ value = Math.max(value / 16383, -1);
|
|
}
|
|
}
|
|
return value;
|
|
return value;
|
|
}
|
|
}
|
|
@@ -38824,17 +38824,16 @@ var BABYLON;
|
|
if (!data) {
|
|
if (!data) {
|
|
return null;
|
|
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);
|
|
var copy_1 = new Array(count);
|
|
vertexBuffer.forEach(count, function (value, index) {
|
|
vertexBuffer.forEach(count, function (value, index) {
|
|
copy_1[index] = value;
|
|
copy_1[index] = value;
|
|
});
|
|
});
|
|
return copy_1;
|
|
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) {
|
|
if (data instanceof Array) {
|
|
var offset = vertexBuffer.byteOffset / 4;
|
|
var offset = vertexBuffer.byteOffset / 4;
|
|
return BABYLON.Tools.Slice(data, offset, offset + count);
|
|
return BABYLON.Tools.Slice(data, offset, offset + count);
|
|
@@ -51882,8 +51881,13 @@ var BABYLON;
|
|
});
|
|
});
|
|
/**
|
|
/**
|
|
* Resets the runtime animation to the beginning
|
|
* 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._offsetsCache = {};
|
|
this._highLimitsCache = {};
|
|
this._highLimitsCache = {};
|
|
this._currentFrame = 0;
|
|
this._currentFrame = 0;
|
|
@@ -51923,36 +51927,18 @@ var BABYLON;
|
|
return this._animation._interpolate(currentFrame, repeatCount, this._workValue, loopMode, offsetValue, highLimitValue);
|
|
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 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) {
|
|
RuntimeAnimation.prototype.setValue = function (currentValue, weight) {
|
|
if (weight === void 0) { weight = 1.0; }
|
|
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
|
|
// Set value
|
|
var path;
|
|
var path;
|
|
var destination;
|
|
var destination;
|
|
var targetPropertyPath = this._animation.targetPropertyPath;
|
|
var targetPropertyPath = this._animation.targetPropertyPath;
|
|
if (targetPropertyPath.length > 1) {
|
|
if (targetPropertyPath.length > 1) {
|
|
- var property = target[targetPropertyPath[0]];
|
|
|
|
|
|
+ var property = this._target[targetPropertyPath[0]];
|
|
for (var index = 1; index < targetPropertyPath.length - 1; index++) {
|
|
for (var index = 1; index < targetPropertyPath.length - 1; index++) {
|
|
property = property[targetPropertyPath[index]];
|
|
property = property[targetPropertyPath[index]];
|
|
}
|
|
}
|
|
@@ -51961,14 +51947,28 @@ var BABYLON;
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
path = targetPropertyPath[0];
|
|
path = targetPropertyPath[0];
|
|
- destination = target;
|
|
|
|
|
|
+ destination = this._target;
|
|
}
|
|
}
|
|
this._targetPath = path;
|
|
this._targetPath = path;
|
|
this._activeTarget = destination;
|
|
this._activeTarget = destination;
|
|
this._weight = weight;
|
|
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
|
|
// 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 (enableBlending && this._blendingFactor <= 1.0) {
|
|
if (!this._originalBlendValue) {
|
|
if (!this._originalBlendValue) {
|
|
var originalValue = destination[path];
|
|
var originalValue = destination[path];
|
|
@@ -51979,25 +51979,6 @@ var BABYLON;
|
|
this._originalBlendValue = originalValue;
|
|
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 (this._originalBlendValue.m) { // Matrix
|
|
if (BABYLON.Animation.AllowMatrixDecomposeForInterpolation) {
|
|
if (BABYLON.Animation.AllowMatrixDecomposeForInterpolation) {
|
|
if (this._currentValue) {
|
|
if (this._currentValue) {
|
|
@@ -52031,6 +52012,7 @@ var BABYLON;
|
|
this._currentValue = currentValue;
|
|
this._currentValue = currentValue;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ var blendingSpeed = this._target && this._target.animationPropertiesOverride ? this._target.animationPropertiesOverride.blendingSpeed : this._animation.blendingSpeed;
|
|
this._blendingFactor += blendingSpeed;
|
|
this._blendingFactor += blendingSpeed;
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
@@ -52042,8 +52024,8 @@ var BABYLON;
|
|
else {
|
|
else {
|
|
destination[path] = this._currentValue;
|
|
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 () {
|
|
Animatable.prototype.reset = function () {
|
|
var runtimeAnimations = this._runtimeAnimations;
|
|
var runtimeAnimations = this._runtimeAnimations;
|
|
for (var index = 0; index < runtimeAnimations.length; index++) {
|
|
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._localDelayOffset = null;
|
|
this._pausedDelay = null;
|
|
this._pausedDelay = null;
|