babylonjs-serializers 5.38.0 → 5.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/babylon.glTF2Serializer.js +53 -61
- package/babylon.glTF2Serializer.js.map +1 -1
- package/babylon.glTF2Serializer.min.js +1 -1
- package/babylon.glTF2Serializer.min.js.map +1 -1
- package/babylonjs.serializers.js +53 -61
- package/babylonjs.serializers.js.map +1 -1
- package/babylonjs.serializers.min.js +1 -1
- package/babylonjs.serializers.min.js.map +1 -1
- package/package.json +3 -3
|
@@ -2121,80 +2121,72 @@ var _GLTFAnimation = /** @class */ (function () {
|
|
|
2121
2121
|
minMaxFrames.max = maxUsedFrame;
|
|
2122
2122
|
}
|
|
2123
2123
|
};
|
|
2124
|
-
_GLTFAnimation._ConvertFactorToVector3OrQuaternion = function (factor, babylonTransformNode, animation,
|
|
2125
|
-
var property;
|
|
2126
|
-
var componentName;
|
|
2127
|
-
var value = null;
|
|
2124
|
+
_GLTFAnimation._ConvertFactorToVector3OrQuaternion = function (factor, babylonTransformNode, animation, animationChannelTargetPath, convertToRightHandedSystem, useQuaternion) {
|
|
2128
2125
|
var basePositionRotationOrScale = _GLTFAnimation._GetBasePositionRotationOrScale(babylonTransformNode, animationChannelTargetPath, convertToRightHandedSystem, useQuaternion);
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Error("glTFAnimation: Unsupported component type \"".concat(componentName, "\" for scale animation!"));
|
|
2153
|
-
}
|
|
2126
|
+
// handles single component x, y, z or w component animation by using a base property and animating over a component.
|
|
2127
|
+
var property = animation.targetProperty.split(".");
|
|
2128
|
+
var componentName = property ? property[1] : ""; // x, y, or z component
|
|
2129
|
+
var value = useQuaternion ? core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.FromArray(basePositionRotationOrScale).normalize() : core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArray(basePositionRotationOrScale);
|
|
2130
|
+
switch (componentName) {
|
|
2131
|
+
case "x": {
|
|
2132
|
+
value[componentName] = convertToRightHandedSystem && useQuaternion && animationChannelTargetPath !== "scale" /* SCALE */ ? -factor : factor;
|
|
2133
|
+
break;
|
|
2134
|
+
}
|
|
2135
|
+
case "y": {
|
|
2136
|
+
value[componentName] = convertToRightHandedSystem && useQuaternion && animationChannelTargetPath !== "scale" /* SCALE */ ? -factor : factor;
|
|
2137
|
+
break;
|
|
2138
|
+
}
|
|
2139
|
+
case "z": {
|
|
2140
|
+
value[componentName] = convertToRightHandedSystem && !useQuaternion && animationChannelTargetPath !== "scale" /* SCALE */ ? -factor : factor;
|
|
2141
|
+
break;
|
|
2142
|
+
}
|
|
2143
|
+
case "w": {
|
|
2144
|
+
value.w = factor;
|
|
2145
|
+
break;
|
|
2146
|
+
}
|
|
2147
|
+
default: {
|
|
2148
|
+
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Error("glTFAnimation: Unsupported component name \"".concat(componentName, "\"!"));
|
|
2154
2149
|
}
|
|
2155
2150
|
}
|
|
2156
2151
|
return value;
|
|
2157
2152
|
};
|
|
2158
2153
|
_GLTFAnimation._SetInterpolatedValue = function (babylonTransformNode, value, time, animation, animationChannelTargetPath, quaternionCache, inputs, outputs, convertToRightHandedSystem, useQuaternion) {
|
|
2159
|
-
var animationType = animation.dataType;
|
|
2160
2154
|
var cacheValue;
|
|
2161
2155
|
inputs.push(time);
|
|
2162
|
-
if (
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2156
|
+
if (animationChannelTargetPath === "weights" /* WEIGHTS */) {
|
|
2157
|
+
outputs.push([value]);
|
|
2158
|
+
return;
|
|
2159
|
+
}
|
|
2160
|
+
if (animation.dataType === core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Animation.ANIMATIONTYPE_FLOAT) {
|
|
2161
|
+
value = this._ConvertFactorToVector3OrQuaternion(value, babylonTransformNode, animation, animationChannelTargetPath, convertToRightHandedSystem, useQuaternion);
|
|
2162
|
+
}
|
|
2163
|
+
if (animationChannelTargetPath === "rotation" /* ROTATION */) {
|
|
2164
|
+
if (useQuaternion) {
|
|
2165
|
+
quaternionCache = value;
|
|
2166
2166
|
}
|
|
2167
|
-
|
|
2168
|
-
|
|
2167
|
+
else {
|
|
2168
|
+
cacheValue = value;
|
|
2169
|
+
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.RotationYawPitchRollToRef(cacheValue.y, cacheValue.x, cacheValue.z, quaternionCache);
|
|
2169
2170
|
}
|
|
2170
|
-
if (
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
else {
|
|
2175
|
-
cacheValue = value;
|
|
2176
|
-
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.RotationYawPitchRollToRef(cacheValue.y, cacheValue.x, cacheValue.z, quaternionCache);
|
|
2177
|
-
}
|
|
2178
|
-
if (convertToRightHandedSystem) {
|
|
2179
|
-
_glTFUtilities__WEBPACK_IMPORTED_MODULE_1__._GLTFUtilities._GetRightHandedQuaternionFromRef(quaternionCache);
|
|
2180
|
-
if (!babylonTransformNode.parent) {
|
|
2181
|
-
quaternionCache = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.FromArray([0, 1, 0, 0]).multiply(quaternionCache);
|
|
2182
|
-
}
|
|
2171
|
+
if (convertToRightHandedSystem) {
|
|
2172
|
+
_glTFUtilities__WEBPACK_IMPORTED_MODULE_1__._GLTFUtilities._GetRightHandedQuaternionFromRef(quaternionCache);
|
|
2173
|
+
if (!babylonTransformNode.parent) {
|
|
2174
|
+
quaternionCache = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.FromArray([0, 1, 0, 0]).multiply(quaternionCache);
|
|
2183
2175
|
}
|
|
2184
|
-
outputs.push(quaternionCache.asArray());
|
|
2185
2176
|
}
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2177
|
+
outputs.push(quaternionCache.asArray());
|
|
2178
|
+
}
|
|
2179
|
+
else {
|
|
2180
|
+
// scaling and position animation
|
|
2181
|
+
cacheValue = value;
|
|
2182
|
+
if (convertToRightHandedSystem && animationChannelTargetPath !== "scale" /* SCALE */) {
|
|
2183
|
+
_glTFUtilities__WEBPACK_IMPORTED_MODULE_1__._GLTFUtilities._GetRightHandedPositionVector3FromRef(cacheValue);
|
|
2184
|
+
if (!babylonTransformNode.parent) {
|
|
2185
|
+
cacheValue.x *= -1;
|
|
2186
|
+
cacheValue.z *= -1;
|
|
2195
2187
|
}
|
|
2196
|
-
outputs.push(cacheValue.asArray());
|
|
2197
2188
|
}
|
|
2189
|
+
outputs.push(cacheValue.asArray());
|
|
2198
2190
|
}
|
|
2199
2191
|
};
|
|
2200
2192
|
/**
|
|
@@ -2311,7 +2303,7 @@ var _GLTFAnimation = /** @class */ (function () {
|
|
|
2311
2303
|
}
|
|
2312
2304
|
else {
|
|
2313
2305
|
// handles single component x, y, z or w component animation by using a base property and animating over a component.
|
|
2314
|
-
newPositionRotationOrScale = this._ConvertFactorToVector3OrQuaternion(keyFrame.value, babylonTransformNode, animation,
|
|
2306
|
+
newPositionRotationOrScale = this._ConvertFactorToVector3OrQuaternion(keyFrame.value, babylonTransformNode, animation, animationChannelTargetPath, convertToRightHandedSystem, useQuaternion);
|
|
2315
2307
|
if (newPositionRotationOrScale) {
|
|
2316
2308
|
if (animationChannelTargetPath === "rotation" /* ROTATION */) {
|
|
2317
2309
|
var posRotScale = useQuaternion
|