@babylonjs/serializers 6.6.1 → 6.7.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.
@@ -44,32 +44,30 @@ export class _GLTFAnimation {
44
44
  * @param babylonTransformNode - BabylonJS mesh.
45
45
  * @param animation - animation.
46
46
  * @param animationChannelTargetPath - The target animation channel.
47
- * @param convertToRightHandedSystem - Specifies if the values should be converted to right-handed.
48
47
  * @param useQuaternion - Specifies if quaternions are used.
49
48
  * @returns nullable IAnimationData
50
49
  */
51
- static _CreateNodeAnimation(babylonTransformNode, animation, animationChannelTargetPath, convertToRightHandedSystem, useQuaternion, animationSampleRate) {
50
+ static _CreateNodeAnimation(babylonTransformNode, animation, animationChannelTargetPath, useQuaternion, animationSampleRate) {
52
51
  if (this._IsTransformable(babylonTransformNode)) {
53
52
  const inputs = [];
54
53
  const outputs = [];
55
54
  const keyFrames = animation.getKeys();
56
55
  const minMaxKeyFrames = _GLTFAnimation._CalculateMinMaxKeyFrames(keyFrames);
57
56
  const interpolationOrBake = _GLTFAnimation._DeduceInterpolation(keyFrames, animationChannelTargetPath, useQuaternion);
58
- const frameDelta = minMaxKeyFrames.max - minMaxKeyFrames.min;
59
57
  const interpolation = interpolationOrBake.interpolationType;
60
58
  const shouldBakeAnimation = interpolationOrBake.shouldBakeAnimation;
61
59
  if (shouldBakeAnimation) {
62
- _GLTFAnimation._CreateBakedAnimation(babylonTransformNode, animation, animationChannelTargetPath, minMaxKeyFrames.min, minMaxKeyFrames.max, animation.framePerSecond, animationSampleRate, inputs, outputs, minMaxKeyFrames, convertToRightHandedSystem, useQuaternion);
60
+ _GLTFAnimation._CreateBakedAnimation(babylonTransformNode, animation, animationChannelTargetPath, minMaxKeyFrames.min, minMaxKeyFrames.max, animation.framePerSecond, animationSampleRate, inputs, outputs, minMaxKeyFrames, useQuaternion);
63
61
  }
64
62
  else {
65
63
  if (interpolation === "LINEAR" /* AnimationSamplerInterpolation.LINEAR */ || interpolation === "STEP" /* AnimationSamplerInterpolation.STEP */) {
66
- _GLTFAnimation._CreateLinearOrStepAnimation(babylonTransformNode, animation, animationChannelTargetPath, frameDelta, inputs, outputs, convertToRightHandedSystem, useQuaternion);
64
+ _GLTFAnimation._CreateLinearOrStepAnimation(babylonTransformNode, animation, animationChannelTargetPath, inputs, outputs, useQuaternion);
67
65
  }
68
66
  else if (interpolation === "CUBICSPLINE" /* AnimationSamplerInterpolation.CUBICSPLINE */) {
69
- _GLTFAnimation._CreateCubicSplineAnimation(babylonTransformNode, animation, animationChannelTargetPath, frameDelta, inputs, outputs, convertToRightHandedSystem, useQuaternion);
67
+ _GLTFAnimation._CreateCubicSplineAnimation(babylonTransformNode, animation, animationChannelTargetPath, inputs, outputs, useQuaternion);
70
68
  }
71
69
  else {
72
- _GLTFAnimation._CreateBakedAnimation(babylonTransformNode, animation, animationChannelTargetPath, minMaxKeyFrames.min, minMaxKeyFrames.max, animation.framePerSecond, animationSampleRate, inputs, outputs, minMaxKeyFrames, convertToRightHandedSystem, useQuaternion);
70
+ _GLTFAnimation._CreateBakedAnimation(babylonTransformNode, animation, animationChannelTargetPath, minMaxKeyFrames.min, minMaxKeyFrames.max, animation.framePerSecond, animationSampleRate, inputs, outputs, minMaxKeyFrames, useQuaternion);
73
71
  }
74
72
  }
75
73
  if (inputs.length && outputs.length) {
@@ -138,10 +136,9 @@ export class _GLTFAnimation {
138
136
  * @param binaryWriter
139
137
  * @param bufferViews
140
138
  * @param accessors
141
- * @param convertToRightHandedSystem
142
139
  * @param animationSampleRate
143
140
  */
144
- static _CreateNodeAnimationFromNodeAnimations(babylonNode, runtimeGLTFAnimation, idleGLTFAnimations, nodeMap, nodes, binaryWriter, bufferViews, accessors, convertToRightHandedSystem, animationSampleRate, shouldExportAnimation) {
141
+ static _CreateNodeAnimationFromNodeAnimations(babylonNode, runtimeGLTFAnimation, idleGLTFAnimations, nodeMap, nodes, binaryWriter, bufferViews, accessors, animationSampleRate, shouldExportAnimation) {
145
142
  let glTFAnimation;
146
143
  if (_GLTFAnimation._IsTransformable(babylonNode)) {
147
144
  if (babylonNode.animations) {
@@ -156,7 +153,7 @@ export class _GLTFAnimation {
156
153
  samplers: [],
157
154
  channels: [],
158
155
  };
159
- _GLTFAnimation._AddAnimation(`${animation.name}`, animation.hasRunningRuntimeAnimations ? runtimeGLTFAnimation : glTFAnimation, babylonNode, animation, animationInfo.dataAccessorType, animationInfo.animationChannelTargetPath, nodeMap, binaryWriter, bufferViews, accessors, convertToRightHandedSystem, animationInfo.useQuaternion, animationSampleRate);
156
+ _GLTFAnimation._AddAnimation(`${animation.name}`, animation.hasRunningRuntimeAnimations ? runtimeGLTFAnimation : glTFAnimation, babylonNode, animation, animationInfo.dataAccessorType, animationInfo.animationChannelTargetPath, nodeMap, binaryWriter, bufferViews, accessors, animationInfo.useQuaternion, animationSampleRate);
160
157
  if (glTFAnimation.samplers.length && glTFAnimation.channels.length) {
161
158
  idleGLTFAnimations.push(glTFAnimation);
162
159
  }
@@ -176,10 +173,9 @@ export class _GLTFAnimation {
176
173
  * @param binaryWriter
177
174
  * @param bufferViews
178
175
  * @param accessors
179
- * @param convertToRightHandedSystem
180
176
  * @param animationSampleRate
181
177
  */
182
- static _CreateMorphTargetAnimationFromMorphTargetAnimations(babylonNode, runtimeGLTFAnimation, idleGLTFAnimations, nodeMap, nodes, binaryWriter, bufferViews, accessors, convertToRightHandedSystem, animationSampleRate, shouldExportAnimation) {
178
+ static _CreateMorphTargetAnimationFromMorphTargetAnimations(babylonNode, runtimeGLTFAnimation, idleGLTFAnimations, nodeMap, nodes, binaryWriter, bufferViews, accessors, animationSampleRate, shouldExportAnimation) {
183
179
  let glTFAnimation;
184
180
  if (babylonNode instanceof Mesh) {
185
181
  const morphTargetManager = babylonNode.morphTargetManager;
@@ -212,7 +208,7 @@ export class _GLTFAnimation {
212
208
  samplers: [],
213
209
  channels: [],
214
210
  };
215
- _GLTFAnimation._AddAnimation(animation.name, animation.hasRunningRuntimeAnimations ? runtimeGLTFAnimation : glTFAnimation, babylonNode, combinedAnimation, animationInfo.dataAccessorType, animationInfo.animationChannelTargetPath, nodeMap, binaryWriter, bufferViews, accessors, convertToRightHandedSystem, animationInfo.useQuaternion, animationSampleRate, morphTargetManager.numTargets);
211
+ _GLTFAnimation._AddAnimation(animation.name, animation.hasRunningRuntimeAnimations ? runtimeGLTFAnimation : glTFAnimation, babylonNode, combinedAnimation, animationInfo.dataAccessorType, animationInfo.animationChannelTargetPath, nodeMap, binaryWriter, bufferViews, accessors, animationInfo.useQuaternion, animationSampleRate, morphTargetManager.numTargets);
216
212
  if (glTFAnimation.samplers.length && glTFAnimation.channels.length) {
217
213
  idleGLTFAnimations.push(glTFAnimation);
218
214
  }
@@ -232,10 +228,9 @@ export class _GLTFAnimation {
232
228
  * @param binaryWriter
233
229
  * @param bufferViews
234
230
  * @param accessors
235
- * @param convertToRightHandedSystemMap
236
231
  * @param animationSampleRate
237
232
  */
238
- static _CreateNodeAndMorphAnimationFromAnimationGroups(babylonScene, glTFAnimations, nodeMap, nodes, binaryWriter, bufferViews, accessors, convertToRightHandedSystemMap, animationSampleRate, shouldExportAnimation) {
233
+ static _CreateNodeAndMorphAnimationFromAnimationGroups(babylonScene, glTFAnimations, nodeMap, binaryWriter, bufferViews, accessors, animationSampleRate, shouldExportAnimation) {
239
234
  var _a;
240
235
  let glTFAnimation;
241
236
  if (babylonScene.animationGroups) {
@@ -262,8 +257,7 @@ export class _GLTFAnimation {
262
257
  if (animationInfo) {
263
258
  const babylonTransformNode = this._IsTransformable(target) ? target : this._IsTransformable(target[0]) ? target[0] : null;
264
259
  if (babylonTransformNode) {
265
- const convertToRightHandedSystem = convertToRightHandedSystemMap[babylonTransformNode.uniqueId];
266
- _GLTFAnimation._AddAnimation(`${animation.name}`, glTFAnimation, babylonTransformNode, animation, animationInfo.dataAccessorType, animationInfo.animationChannelTargetPath, nodeMap, binaryWriter, bufferViews, accessors, convertToRightHandedSystem, animationInfo.useQuaternion, animationSampleRate);
260
+ _GLTFAnimation._AddAnimation(`${animation.name}`, glTFAnimation, babylonTransformNode, animation, animationInfo.dataAccessorType, animationInfo.animationChannelTargetPath, nodeMap, binaryWriter, bufferViews, accessors, animationInfo.useQuaternion, animationSampleRate);
267
261
  }
268
262
  }
269
263
  }
@@ -342,7 +336,7 @@ export class _GLTFAnimation {
342
336
  combinedAnimationGroup.setKeys(animationKeys);
343
337
  const animationInfo = _GLTFAnimation._DeduceAnimationInfo(combinedAnimationGroup);
344
338
  if (animationInfo) {
345
- _GLTFAnimation._AddAnimation(`${animationGroup.name}_${mesh.name}_MorphWeightAnimation`, glTFAnimation, mesh, combinedAnimationGroup, animationInfo.dataAccessorType, animationInfo.animationChannelTargetPath, nodeMap, binaryWriter, bufferViews, accessors, false, animationInfo.useQuaternion, animationSampleRate, morphTargetManager === null || morphTargetManager === void 0 ? void 0 : morphTargetManager.numTargets);
339
+ _GLTFAnimation._AddAnimation(`${animationGroup.name}_${mesh.name}_MorphWeightAnimation`, glTFAnimation, mesh, combinedAnimationGroup, animationInfo.dataAccessorType, animationInfo.animationChannelTargetPath, nodeMap, binaryWriter, bufferViews, accessors, animationInfo.useQuaternion, animationSampleRate, morphTargetManager === null || morphTargetManager === void 0 ? void 0 : morphTargetManager.numTargets);
346
340
  }
347
341
  });
348
342
  if (glTFAnimation.channels.length && glTFAnimation.samplers.length) {
@@ -351,8 +345,8 @@ export class _GLTFAnimation {
351
345
  }
352
346
  }
353
347
  }
354
- static _AddAnimation(name, glTFAnimation, babylonTransformNode, animation, dataAccessorType, animationChannelTargetPath, nodeMap, binaryWriter, bufferViews, accessors, convertToRightHandedSystem, useQuaternion, animationSampleRate, morphAnimationChannels) {
355
- const animationData = _GLTFAnimation._CreateNodeAnimation(babylonTransformNode, animation, animationChannelTargetPath, convertToRightHandedSystem, useQuaternion, animationSampleRate);
348
+ static _AddAnimation(name, glTFAnimation, babylonTransformNode, animation, dataAccessorType, animationChannelTargetPath, nodeMap, binaryWriter, bufferViews, accessors, useQuaternion, animationSampleRate, morphAnimationChannels) {
349
+ const animationData = _GLTFAnimation._CreateNodeAnimation(babylonTransformNode, animation, animationChannelTargetPath, useQuaternion, animationSampleRate);
356
350
  let bufferView;
357
351
  let accessor;
358
352
  let keyframeAccessorIndex;
@@ -436,10 +430,9 @@ export class _GLTFAnimation {
436
430
  * @param minMaxFrames
437
431
  * @param minMaxFrames.min
438
432
  * @param minMaxFrames.max
439
- * @param convertToRightHandedSystem converts the values to right-handed
440
433
  * @param useQuaternion specifies if quaternions should be used
441
434
  */
442
- static _CreateBakedAnimation(babylonTransformNode, animation, animationChannelTargetPath, minFrame, maxFrame, fps, sampleRate, inputs, outputs, minMaxFrames, convertToRightHandedSystem, useQuaternion) {
435
+ static _CreateBakedAnimation(babylonTransformNode, animation, animationChannelTargetPath, minFrame, maxFrame, fps, sampleRate, inputs, outputs, minMaxFrames, useQuaternion) {
443
436
  let value;
444
437
  const quaternionCache = Quaternion.Identity();
445
438
  let previousTime = null;
@@ -493,7 +486,7 @@ export class _GLTFAnimation {
493
486
  loopMode: animation.loopMode,
494
487
  };
495
488
  value = animation._interpolate(f, state);
496
- _GLTFAnimation._SetInterpolatedValue(babylonTransformNode, value, time, animation, animationChannelTargetPath, quaternionCache, inputs, outputs, convertToRightHandedSystem, useQuaternion);
489
+ _GLTFAnimation._SetInterpolatedValue(babylonTransformNode, value, time, animation, animationChannelTargetPath, quaternionCache, inputs, outputs, useQuaternion);
497
490
  }
498
491
  }
499
492
  }
@@ -501,23 +494,17 @@ export class _GLTFAnimation {
501
494
  minMaxFrames.max = maxUsedFrame;
502
495
  }
503
496
  }
504
- static _ConvertFactorToVector3OrQuaternion(factor, babylonTransformNode, animation, animationChannelTargetPath, convertToRightHandedSystem, useQuaternion) {
505
- const basePositionRotationOrScale = _GLTFAnimation._GetBasePositionRotationOrScale(babylonTransformNode, animationChannelTargetPath, convertToRightHandedSystem, useQuaternion);
497
+ static _ConvertFactorToVector3OrQuaternion(factor, babylonTransformNode, animation, animationChannelTargetPath, useQuaternion) {
498
+ const basePositionRotationOrScale = _GLTFAnimation._GetBasePositionRotationOrScale(babylonTransformNode, animationChannelTargetPath, useQuaternion);
506
499
  // handles single component x, y, z or w component animation by using a base property and animating over a component.
507
500
  const property = animation.targetProperty.split(".");
508
- const componentName = property ? property[1] : ""; // x, y, or z component
501
+ const componentName = property ? property[1] : ""; // x, y, z, or w component
509
502
  const value = useQuaternion ? Quaternion.FromArray(basePositionRotationOrScale).normalize() : Vector3.FromArray(basePositionRotationOrScale);
510
503
  switch (componentName) {
511
- case "x": {
512
- value[componentName] = convertToRightHandedSystem && useQuaternion && animationChannelTargetPath !== "scale" /* AnimationChannelTargetPath.SCALE */ ? -factor : factor;
513
- break;
514
- }
515
- case "y": {
516
- value[componentName] = convertToRightHandedSystem && useQuaternion && animationChannelTargetPath !== "scale" /* AnimationChannelTargetPath.SCALE */ ? -factor : factor;
517
- break;
518
- }
504
+ case "x":
505
+ case "y":
519
506
  case "z": {
520
- value[componentName] = convertToRightHandedSystem && !useQuaternion && animationChannelTargetPath !== "scale" /* AnimationChannelTargetPath.SCALE */ ? -factor : factor;
507
+ value[componentName] = factor;
521
508
  break;
522
509
  }
523
510
  case "w": {
@@ -530,7 +517,7 @@ export class _GLTFAnimation {
530
517
  }
531
518
  return value;
532
519
  }
533
- static _SetInterpolatedValue(babylonTransformNode, value, time, animation, animationChannelTargetPath, quaternionCache, inputs, outputs, convertToRightHandedSystem, useQuaternion) {
520
+ static _SetInterpolatedValue(babylonTransformNode, value, time, animation, animationChannelTargetPath, quaternionCache, inputs, outputs, useQuaternion) {
534
521
  let cacheValue;
535
522
  inputs.push(time);
536
523
  if (animationChannelTargetPath === "weights" /* AnimationChannelTargetPath.WEIGHTS */) {
@@ -538,7 +525,7 @@ export class _GLTFAnimation {
538
525
  return;
539
526
  }
540
527
  if (animation.dataType === Animation.ANIMATIONTYPE_FLOAT) {
541
- value = this._ConvertFactorToVector3OrQuaternion(value, babylonTransformNode, animation, animationChannelTargetPath, convertToRightHandedSystem, useQuaternion);
528
+ value = this._ConvertFactorToVector3OrQuaternion(value, babylonTransformNode, animation, animationChannelTargetPath, useQuaternion);
542
529
  }
543
530
  if (animationChannelTargetPath === "rotation" /* AnimationChannelTargetPath.ROTATION */) {
544
531
  if (useQuaternion) {
@@ -548,24 +535,11 @@ export class _GLTFAnimation {
548
535
  cacheValue = value;
549
536
  Quaternion.RotationYawPitchRollToRef(cacheValue.y, cacheValue.x, cacheValue.z, quaternionCache);
550
537
  }
551
- if (convertToRightHandedSystem) {
552
- _GLTFUtilities._GetRightHandedQuaternionFromRef(quaternionCache);
553
- if (!babylonTransformNode.parent) {
554
- quaternionCache = Quaternion.FromArray([0, 1, 0, 0]).multiply(quaternionCache);
555
- }
556
- }
557
538
  outputs.push(quaternionCache.asArray());
558
539
  }
559
540
  else {
560
541
  // scaling and position animation
561
542
  cacheValue = value;
562
- if (convertToRightHandedSystem && animationChannelTargetPath !== "scale" /* AnimationChannelTargetPath.SCALE */) {
563
- _GLTFUtilities._GetRightHandedPositionVector3FromRef(cacheValue);
564
- if (!babylonTransformNode.parent) {
565
- cacheValue.x *= -1;
566
- cacheValue.z *= -1;
567
- }
568
- }
569
543
  outputs.push(cacheValue.asArray());
570
544
  }
571
545
  }
@@ -574,16 +548,14 @@ export class _GLTFAnimation {
574
548
  * @param babylonTransformNode BabylonJS mesh
575
549
  * @param animation BabylonJS animation
576
550
  * @param animationChannelTargetPath The target animation channel
577
- * @param frameDelta The difference between the last and first frame of the animation
578
551
  * @param inputs Array to store the key frame times
579
552
  * @param outputs Array to store the key frame data
580
- * @param convertToRightHandedSystem Specifies if the position data should be converted to right handed
581
553
  * @param useQuaternion Specifies if quaternions are used in the animation
582
554
  */
583
- static _CreateLinearOrStepAnimation(babylonTransformNode, animation, animationChannelTargetPath, frameDelta, inputs, outputs, convertToRightHandedSystem, useQuaternion) {
555
+ static _CreateLinearOrStepAnimation(babylonTransformNode, animation, animationChannelTargetPath, inputs, outputs, useQuaternion) {
584
556
  for (const keyFrame of animation.getKeys()) {
585
557
  inputs.push(keyFrame.frame / animation.framePerSecond); // keyframes in seconds.
586
- _GLTFAnimation._AddKeyframeValue(keyFrame, animation, outputs, animationChannelTargetPath, babylonTransformNode, convertToRightHandedSystem, useQuaternion);
558
+ _GLTFAnimation._AddKeyframeValue(keyFrame, animation, outputs, animationChannelTargetPath, babylonTransformNode, useQuaternion);
587
559
  }
588
560
  }
589
561
  /**
@@ -594,42 +566,31 @@ export class _GLTFAnimation {
594
566
  * @param frameDelta The difference between the last and first frame of the animation
595
567
  * @param inputs Array to store the key frame times
596
568
  * @param outputs Array to store the key frame data
597
- * @param convertToRightHandedSystem Specifies if the position data should be converted to right handed
598
569
  * @param useQuaternion Specifies if quaternions are used in the animation
599
570
  */
600
- static _CreateCubicSplineAnimation(babylonTransformNode, animation, animationChannelTargetPath, frameDelta, inputs, outputs, convertToRightHandedSystem, useQuaternion) {
571
+ static _CreateCubicSplineAnimation(babylonTransformNode, animation, animationChannelTargetPath, inputs, outputs, useQuaternion) {
601
572
  animation.getKeys().forEach(function (keyFrame) {
602
573
  inputs.push(keyFrame.frame / animation.framePerSecond); // keyframes in seconds.
603
- _GLTFAnimation._AddSplineTangent(babylonTransformNode, _TangentType.INTANGENT, outputs, animationChannelTargetPath, "CUBICSPLINE" /* AnimationSamplerInterpolation.CUBICSPLINE */, keyFrame, frameDelta, useQuaternion, convertToRightHandedSystem);
604
- _GLTFAnimation._AddKeyframeValue(keyFrame, animation, outputs, animationChannelTargetPath, babylonTransformNode, convertToRightHandedSystem, useQuaternion);
605
- _GLTFAnimation._AddSplineTangent(babylonTransformNode, _TangentType.OUTTANGENT, outputs, animationChannelTargetPath, "CUBICSPLINE" /* AnimationSamplerInterpolation.CUBICSPLINE */, keyFrame, frameDelta, useQuaternion, convertToRightHandedSystem);
574
+ _GLTFAnimation._AddSplineTangent(_TangentType.INTANGENT, outputs, animationChannelTargetPath, "CUBICSPLINE" /* AnimationSamplerInterpolation.CUBICSPLINE */, keyFrame, useQuaternion);
575
+ _GLTFAnimation._AddKeyframeValue(keyFrame, animation, outputs, animationChannelTargetPath, babylonTransformNode, useQuaternion);
576
+ _GLTFAnimation._AddSplineTangent(_TangentType.OUTTANGENT, outputs, animationChannelTargetPath, "CUBICSPLINE" /* AnimationSamplerInterpolation.CUBICSPLINE */, keyFrame, useQuaternion);
606
577
  });
607
578
  }
608
- static _GetBasePositionRotationOrScale(babylonTransformNode, animationChannelTargetPath, convertToRightHandedSystem, useQuaternion) {
579
+ static _GetBasePositionRotationOrScale(babylonTransformNode, animationChannelTargetPath, useQuaternion) {
609
580
  let basePositionRotationOrScale;
610
581
  if (animationChannelTargetPath === "rotation" /* AnimationChannelTargetPath.ROTATION */) {
611
582
  if (useQuaternion) {
612
583
  const q = babylonTransformNode.rotationQuaternion;
613
584
  basePositionRotationOrScale = (q !== null && q !== void 0 ? q : Quaternion.Identity()).asArray();
614
- if (convertToRightHandedSystem) {
615
- _GLTFUtilities._GetRightHandedQuaternionArrayFromRef(basePositionRotationOrScale);
616
- if (!babylonTransformNode.parent) {
617
- basePositionRotationOrScale = Quaternion.FromArray([0, 1, 0, 0]).multiply(Quaternion.FromArray(basePositionRotationOrScale)).asArray();
618
- }
619
- }
620
585
  }
621
586
  else {
622
587
  const r = babylonTransformNode.rotation;
623
588
  basePositionRotationOrScale = (r !== null && r !== void 0 ? r : Vector3.Zero()).asArray();
624
- _GLTFUtilities._GetRightHandedNormalArray3FromRef(basePositionRotationOrScale);
625
589
  }
626
590
  }
627
591
  else if (animationChannelTargetPath === "translation" /* AnimationChannelTargetPath.TRANSLATION */) {
628
592
  const p = babylonTransformNode.position;
629
593
  basePositionRotationOrScale = (p !== null && p !== void 0 ? p : Vector3.Zero()).asArray();
630
- if (convertToRightHandedSystem) {
631
- _GLTFUtilities._GetRightHandedPositionArray3FromRef(basePositionRotationOrScale);
632
- }
633
594
  }
634
595
  else {
635
596
  // scale
@@ -645,35 +606,18 @@ export class _GLTFAnimation {
645
606
  * @param outputs
646
607
  * @param animationChannelTargetPath
647
608
  * @param babylonTransformNode
648
- * @param convertToRightHandedSystem
649
609
  * @param useQuaternion
650
610
  */
651
- static _AddKeyframeValue(keyFrame, animation, outputs, animationChannelTargetPath, babylonTransformNode, convertToRightHandedSystem, useQuaternion) {
652
- let value;
611
+ static _AddKeyframeValue(keyFrame, animation, outputs, animationChannelTargetPath, babylonTransformNode, useQuaternion) {
653
612
  let newPositionRotationOrScale;
654
613
  const animationType = animation.dataType;
655
614
  if (animationType === Animation.ANIMATIONTYPE_VECTOR3) {
656
- value = keyFrame.value.asArray();
615
+ let value = keyFrame.value.asArray();
657
616
  if (animationChannelTargetPath === "rotation" /* AnimationChannelTargetPath.ROTATION */) {
658
617
  const array = Vector3.FromArray(value);
659
- let rotationQuaternion = Quaternion.RotationYawPitchRoll(array.y, array.x, array.z);
660
- if (convertToRightHandedSystem) {
661
- _GLTFUtilities._GetRightHandedQuaternionFromRef(rotationQuaternion);
662
- if (!babylonTransformNode.parent) {
663
- rotationQuaternion = Quaternion.FromArray([0, 1, 0, 0]).multiply(rotationQuaternion);
664
- }
665
- }
618
+ const rotationQuaternion = Quaternion.RotationYawPitchRoll(array.y, array.x, array.z);
666
619
  value = rotationQuaternion.asArray();
667
620
  }
668
- else if (animationChannelTargetPath === "translation" /* AnimationChannelTargetPath.TRANSLATION */) {
669
- if (convertToRightHandedSystem) {
670
- _GLTFUtilities._GetRightHandedNormalArray3FromRef(value);
671
- if (!babylonTransformNode.parent) {
672
- value[0] *= -1;
673
- value[2] *= -1;
674
- }
675
- }
676
- }
677
621
  outputs.push(value); // scale vector.
678
622
  }
679
623
  else if (animationType === Animation.ANIMATIONTYPE_FLOAT) {
@@ -682,42 +626,20 @@ export class _GLTFAnimation {
682
626
  }
683
627
  else {
684
628
  // handles single component x, y, z or w component animation by using a base property and animating over a component.
685
- newPositionRotationOrScale = this._ConvertFactorToVector3OrQuaternion(keyFrame.value, babylonTransformNode, animation, animationChannelTargetPath, convertToRightHandedSystem, useQuaternion);
629
+ newPositionRotationOrScale = this._ConvertFactorToVector3OrQuaternion(keyFrame.value, babylonTransformNode, animation, animationChannelTargetPath, useQuaternion);
686
630
  if (newPositionRotationOrScale) {
687
631
  if (animationChannelTargetPath === "rotation" /* AnimationChannelTargetPath.ROTATION */) {
688
- let posRotScale = useQuaternion
632
+ const posRotScale = useQuaternion
689
633
  ? newPositionRotationOrScale
690
634
  : Quaternion.RotationYawPitchRoll(newPositionRotationOrScale.y, newPositionRotationOrScale.x, newPositionRotationOrScale.z).normalize();
691
- if (convertToRightHandedSystem) {
692
- _GLTFUtilities._GetRightHandedQuaternionFromRef(posRotScale);
693
- if (!babylonTransformNode.parent) {
694
- posRotScale = Quaternion.FromArray([0, 1, 0, 0]).multiply(posRotScale);
695
- }
696
- }
697
635
  outputs.push(posRotScale.asArray());
698
636
  }
699
- else if (animationChannelTargetPath === "translation" /* AnimationChannelTargetPath.TRANSLATION */) {
700
- if (convertToRightHandedSystem) {
701
- _GLTFUtilities._GetRightHandedNormalVector3FromRef(newPositionRotationOrScale);
702
- if (!babylonTransformNode.parent) {
703
- newPositionRotationOrScale.x *= -1;
704
- newPositionRotationOrScale.z *= -1;
705
- }
706
- }
707
- }
708
637
  outputs.push(newPositionRotationOrScale.asArray());
709
638
  }
710
639
  }
711
640
  }
712
641
  else if (animationType === Animation.ANIMATIONTYPE_QUATERNION) {
713
- value = keyFrame.value.normalize().asArray();
714
- if (convertToRightHandedSystem) {
715
- _GLTFUtilities._GetRightHandedQuaternionArrayFromRef(value);
716
- if (!babylonTransformNode.parent) {
717
- value = Quaternion.FromArray([0, 1, 0, 0]).multiply(Quaternion.FromArray(value)).asArray();
718
- }
719
- }
720
- outputs.push(value);
642
+ outputs.push(keyFrame.value.normalize().asArray());
721
643
  }
722
644
  else {
723
645
  Tools.Error("glTFAnimation: Unsupported key frame values for animation!");
@@ -785,9 +707,8 @@ export class _GLTFAnimation {
785
707
  * @param keyFrame The key frame with the animation data
786
708
  * @param frameDelta Time difference between two frames used to scale the tangent by the frame delta
787
709
  * @param useQuaternion Specifies if quaternions are used
788
- * @param convertToRightHandedSystem Specifies if the values should be converted to right-handed
789
710
  */
790
- static _AddSplineTangent(babylonTransformNode, tangentType, outputs, animationChannelTargetPath, interpolation, keyFrame, frameDelta, useQuaternion, convertToRightHandedSystem) {
711
+ static _AddSplineTangent(tangentType, outputs, animationChannelTargetPath, interpolation, keyFrame, useQuaternion) {
791
712
  let tangent;
792
713
  const tangentValue = tangentType === _TangentType.INTANGENT ? keyFrame.inTangent : keyFrame.outTangent;
793
714
  if (interpolation === "CUBICSPLINE" /* AnimationSamplerInterpolation.CUBICSPLINE */) {
@@ -800,12 +721,6 @@ export class _GLTFAnimation {
800
721
  const array = tangentValue;
801
722
  tangent = Quaternion.RotationYawPitchRoll(array.y, array.x, array.z).asArray();
802
723
  }
803
- if (convertToRightHandedSystem) {
804
- _GLTFUtilities._GetRightHandedQuaternionArrayFromRef(tangent);
805
- if (!babylonTransformNode.parent) {
806
- tangent = Quaternion.FromArray([0, 1, 0, 0]).multiply(Quaternion.FromArray(tangent)).asArray();
807
- }
808
- }
809
724
  }
810
725
  else {
811
726
  tangent = [0, 0, 0, 0];
@@ -822,15 +737,6 @@ export class _GLTFAnimation {
822
737
  else {
823
738
  if (tangentValue) {
824
739
  tangent = tangentValue.asArray();
825
- if (convertToRightHandedSystem) {
826
- if (animationChannelTargetPath === "translation" /* AnimationChannelTargetPath.TRANSLATION */) {
827
- _GLTFUtilities._GetRightHandedPositionArray3FromRef(tangent);
828
- if (!babylonTransformNode.parent) {
829
- tangent[0] *= -1; // x
830
- tangent[2] *= -1; // z
831
- }
832
- }
833
- }
834
740
  }
835
741
  else {
836
742
  tangent = [0, 0, 0];