|
@@ -17316,6 +17316,9 @@ var BABYLON;
|
|
|
* Gets or sets the animation properties override
|
|
|
*/
|
|
|
get: function () {
|
|
|
+ if (!this._animationPropertiesOverride) {
|
|
|
+ return this._scene.animationPropertiesOverride;
|
|
|
+ }
|
|
|
return this._animationPropertiesOverride;
|
|
|
},
|
|
|
set: function (value) {
|
|
@@ -23234,6 +23237,7 @@ var BABYLON;
|
|
|
* Gets or sets a boolean indicating if animations are enabled
|
|
|
*/
|
|
|
this.animationsEnabled = true;
|
|
|
+ this._animationPropertiesOverride = null;
|
|
|
/**
|
|
|
* Gets or sets a boolean indicating if a constant deltatime has to be used
|
|
|
* This is mostly useful for testing purposes when you do not want the animations to scale with the framerate
|
|
@@ -23827,6 +23831,19 @@ var BABYLON;
|
|
|
enumerable: true,
|
|
|
configurable: true
|
|
|
});
|
|
|
+ Object.defineProperty(Scene.prototype, "animationPropertiesOverride", {
|
|
|
+ /**
|
|
|
+ * Gets or sets the animation properties override
|
|
|
+ */
|
|
|
+ get: function () {
|
|
|
+ return this._animationPropertiesOverride;
|
|
|
+ },
|
|
|
+ set: function (value) {
|
|
|
+ this._animationPropertiesOverride = value;
|
|
|
+ },
|
|
|
+ enumerable: true,
|
|
|
+ configurable: true
|
|
|
+ });
|
|
|
Object.defineProperty(Scene.prototype, "onDispose", {
|
|
|
/** Sets a function to be executed when this scene is disposed. */
|
|
|
set: function (callback) {
|
|
@@ -51180,15 +51197,7 @@ var BABYLON;
|
|
|
}
|
|
|
}
|
|
|
if (enableBlending && this._blendingFactor <= 1.0) {
|
|
|
- if (this._originalBlendValue.prototype) {
|
|
|
- if (this._originalBlendValue.prototype.Lerp) {
|
|
|
- this._currentValue = this._originalBlendValue.construtor.prototype.Lerp(currentValue, this._originalBlendValue, this._blendingFactor);
|
|
|
- }
|
|
|
- else {
|
|
|
- this._currentValue = currentValue;
|
|
|
- }
|
|
|
- }
|
|
|
- else if (this._originalBlendValue.m) {
|
|
|
+ if (this._originalBlendValue.m) {
|
|
|
if (BABYLON.Animation.AllowMatrixDecomposeForInterpolation) {
|
|
|
if (this._currentValue) {
|
|
|
BABYLON.Matrix.DecomposeLerpToRef(this._originalBlendValue, currentValue, this._blendingFactor, this._currentValue);
|
|
@@ -51206,6 +51215,18 @@ var BABYLON;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ else if (this._originalBlendValue.constructor) {
|
|
|
+ var constructor = this._originalBlendValue.constructor;
|
|
|
+ if (constructor.Lerp) {
|
|
|
+ this._currentValue = constructor.Lerp(this._originalBlendValue, currentValue, this._blendingFactor);
|
|
|
+ }
|
|
|
+ else if (constructor.Slerp) {
|
|
|
+ this._currentValue = constructor.Slerp(this._originalBlendValue, currentValue, this._blendingFactor);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ this._currentValue = currentValue;
|
|
|
+ }
|
|
|
+ }
|
|
|
else {
|
|
|
this._currentValue = this._originalBlendValue * (1.0 - this._blendingFactor) + this._blendingFactor * currentValue;
|
|
|
}
|
|
@@ -76948,10 +76969,10 @@ var BABYLON;
|
|
|
return true;
|
|
|
};
|
|
|
/**
|
|
|
- * Translate the bone in local or world space.
|
|
|
- * @param vec The amount to translate the bone.
|
|
|
- * @param space The space that the translation is in.
|
|
|
- * @param mesh The mesh that this bone is attached to. This is only used in world space.
|
|
|
+ * Translate the bone in local or world space
|
|
|
+ * @param vec The amount to translate the bone
|
|
|
+ * @param space The space that the translation is in
|
|
|
+ * @param mesh The mesh that this bone is attached to. This is only used in world space
|
|
|
*/
|
|
|
Bone.prototype.translate = function (vec, space, mesh) {
|
|
|
if (space === void 0) { space = BABYLON.Space.LOCAL; }
|
|
@@ -76991,10 +77012,10 @@ var BABYLON;
|
|
|
this.markAsDirty();
|
|
|
};
|
|
|
/**
|
|
|
- * Set the postion of the bone in local or world space.
|
|
|
- * @param position The position to set the bone.
|
|
|
- * @param space The space that the position is in.
|
|
|
- * @param mesh The mesh that this bone is attached to. This is only used in world space.
|
|
|
+ * Set the postion of the bone in local or world space
|
|
|
+ * @param position The position to set the bone
|
|
|
+ * @param space The space that the position is in
|
|
|
+ * @param mesh The mesh that this bone is attached to. This is only used in world space
|
|
|
*/
|
|
|
Bone.prototype.setPosition = function (position, space, mesh) {
|
|
|
if (space === void 0) { space = BABYLON.Space.LOCAL; }
|
|
@@ -77031,19 +77052,19 @@ var BABYLON;
|
|
|
this.markAsDirty();
|
|
|
};
|
|
|
/**
|
|
|
- * Set the absolute postion of the bone (world space).
|
|
|
- * @param position The position to set the bone.
|
|
|
- * @param mesh The mesh that this bone is attached to.
|
|
|
+ * Set the absolute postion of the bone (world space)
|
|
|
+ * @param position The position to set the bone
|
|
|
+ * @param mesh The mesh that this bone is attached to
|
|
|
*/
|
|
|
Bone.prototype.setAbsolutePosition = function (position, mesh) {
|
|
|
this.setPosition(position, BABYLON.Space.WORLD, mesh);
|
|
|
};
|
|
|
/**
|
|
|
- * Adds an additional scale to the bone on the x, y and z axes.
|
|
|
- * @param x The additional scale of the bone on the x axis.
|
|
|
- * @param y The additional scale of the bone on the y axis.
|
|
|
- * @param z The additional scale of the bone on the z axis.
|
|
|
- * @param scaleChildren Set this to true if children of the bone should be scaled.
|
|
|
+ * Adds an additional scale to the bone on the x, y and z axes
|
|
|
+ * @param x The additional scale of the bone on the x axis
|
|
|
+ * @param y The additional scale of the bone on the y axis
|
|
|
+ * @param z The additional scale of the bone on the z axis
|
|
|
+ * @param scaleChildren Set this to true if children of the bone should be scaled
|
|
|
*/
|
|
|
Bone.prototype.setAdditionalScale = function (x, y, z, scaleChildren) {
|
|
|
if (scaleChildren === void 0) { scaleChildren = false; }
|
|
@@ -77174,10 +77195,19 @@ var BABYLON;
|
|
|
* Set the quaternion rotation of the bone in local of world space.
|
|
|
* @param quat The quaternion rotation that the bone should be set to.
|
|
|
* @param space The space that the rotation is in.
|
|
|
- * @param mesh The mesh that this bone is attached to. This is only used in world space.
|
|
|
+ * @param mesh The mesh that this bone is attached to. This is only used in world space.
|
|
|
*/
|
|
|
Bone.prototype.setRotationQuaternion = function (quat, space, mesh) {
|
|
|
if (space === void 0) { space = BABYLON.Space.LOCAL; }
|
|
|
+ if (space === BABYLON.Space.LOCAL) {
|
|
|
+ var position = Bone._tmpVecs[0];
|
|
|
+ var scaling = Bone._tmpVecs[1];
|
|
|
+ var localMatrix = this.getLocalMatrix();
|
|
|
+ localMatrix.decompose(scaling, undefined, position);
|
|
|
+ BABYLON.Matrix.ComposeToRef(scaling, quat, position, localMatrix);
|
|
|
+ this.markAsDirty();
|
|
|
+ return;
|
|
|
+ }
|
|
|
var rotMatInv = Bone._tmpMats[0];
|
|
|
if (!this._getNegativeRotationToRef(rotMatInv, space, mesh)) {
|
|
|
return;
|
|
@@ -77526,10 +77556,10 @@ var BABYLON;
|
|
|
return result;
|
|
|
};
|
|
|
/**
|
|
|
- * Copy the rotation matrix of the bone to a matrix. The rotation can be in either local or world space.
|
|
|
- * @param space The space that the rotation should be in.
|
|
|
- * @param mesh The mesh that this bone is attached to. This is only used in world space.
|
|
|
- * @param result The quaternion that the rotation should be copied to.
|
|
|
+ * Copy the rotation matrix of the bone to a matrix. The rotation can be in either local or world space
|
|
|
+ * @param space The space that the rotation should be in
|
|
|
+ * @param mesh The mesh that this bone is attached to. This is only used in world space
|
|
|
+ * @param result The quaternion that the rotation should be copied to
|
|
|
*/
|
|
|
Bone.prototype.getRotationMatrixToRef = function (space, mesh, result) {
|
|
|
if (space === void 0) { space = BABYLON.Space.LOCAL; }
|
|
@@ -77552,9 +77582,9 @@ var BABYLON;
|
|
|
}
|
|
|
};
|
|
|
/**
|
|
|
- * Get the world position of a point that is in the local space of the bone.
|
|
|
+ * Get the world position of a point that is in the local space of the bone
|
|
|
* @param position The local position
|
|
|
- * @param mesh The mesh that this bone is attached to.
|
|
|
+ * @param mesh The mesh that this bone is attached to
|
|
|
* @returns The world position
|
|
|
*/
|
|
|
Bone.prototype.getAbsolutePositionFromLocal = function (position, mesh) {
|
|
@@ -77564,10 +77594,10 @@ var BABYLON;
|
|
|
return result;
|
|
|
};
|
|
|
/**
|
|
|
- * Get the world position of a point that is in the local space of the bone and copy it to the result param.
|
|
|
+ * Get the world position of a point that is in the local space of the bone and copy it to the result param
|
|
|
* @param position The local position
|
|
|
- * @param mesh The mesh that this bone is attached to.
|
|
|
- * @param result The vector3 that the world position should be copied to.
|
|
|
+ * @param mesh The mesh that this bone is attached to
|
|
|
+ * @param result The vector3 that the world position should be copied to
|
|
|
*/
|
|
|
Bone.prototype.getAbsolutePositionFromLocalToRef = function (position, mesh, result) {
|
|
|
if (mesh === void 0) { mesh = null; }
|
|
@@ -77588,9 +77618,9 @@ var BABYLON;
|
|
|
BABYLON.Vector3.TransformCoordinatesToRef(position, tmat, result);
|
|
|
};
|
|
|
/**
|
|
|
- * Get the local position of a point that is in world space.
|
|
|
+ * Get the local position of a point that is in world space
|
|
|
* @param position The world position
|
|
|
- * @param mesh The mesh that this bone is attached to.
|
|
|
+ * @param mesh The mesh that this bone is attached to
|
|
|
* @returns The local position
|
|
|
*/
|
|
|
Bone.prototype.getLocalPositionFromAbsolute = function (position, mesh) {
|
|
@@ -77600,10 +77630,10 @@ var BABYLON;
|
|
|
return result;
|
|
|
};
|
|
|
/**
|
|
|
- * Get the local position of a point that is in world space and copy it to the result param.
|
|
|
+ * Get the local position of a point that is in world space and copy it to the result param
|
|
|
* @param position The world position
|
|
|
- * @param mesh The mesh that this bone is attached to.
|
|
|
- * @param result The vector3 that the local position should be copied to.
|
|
|
+ * @param mesh The mesh that this bone is attached to
|
|
|
+ * @param result The vector3 that the local position should be copied to
|
|
|
*/
|
|
|
Bone.prototype.getLocalPositionFromAbsoluteToRef = function (position, mesh, result) {
|
|
|
if (mesh === void 0) { mesh = null; }
|
|
@@ -78313,6 +78343,7 @@ var BABYLON;
|
|
|
* Specifies if the skeleton should be serialized.
|
|
|
*/
|
|
|
this.doNotSerialize = false;
|
|
|
+ this._animationPropertiesOverride = null;
|
|
|
// Events
|
|
|
/**
|
|
|
* An event triggered before computing the skeleton's matrices
|
|
@@ -78324,6 +78355,22 @@ var BABYLON;
|
|
|
//make sure it will recalculate the matrix next time prepare is called.
|
|
|
this._isDirty = true;
|
|
|
}
|
|
|
+ Object.defineProperty(Skeleton.prototype, "animationPropertiesOverride", {
|
|
|
+ /**
|
|
|
+ * Gets or sets the animation properties override
|
|
|
+ */
|
|
|
+ get: function () {
|
|
|
+ if (!this._animationPropertiesOverride) {
|
|
|
+ return this._scene.animationPropertiesOverride;
|
|
|
+ }
|
|
|
+ return this._animationPropertiesOverride;
|
|
|
+ },
|
|
|
+ set: function (value) {
|
|
|
+ this._animationPropertiesOverride = value;
|
|
|
+ },
|
|
|
+ enumerable: true,
|
|
|
+ configurable: true
|
|
|
+ });
|
|
|
// Members
|
|
|
Skeleton.prototype.getTransformMatrices = function (mesh) {
|
|
|
if (this.needInitialSkinMatrix && mesh._bonesTransformMatrices) {
|