@babylonjs/serializers 5.0.0-alpha.8 → 5.0.0-beta.3

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.
Files changed (58) hide show
  1. package/OBJ/index.js +1 -1
  2. package/OBJ/objSerializer.js +19 -12
  3. package/OBJ/objSerializer.js.map +1 -1
  4. package/glTF/2.0/Extensions/KHR_lights_punctual.js +8 -8
  5. package/glTF/2.0/Extensions/KHR_lights_punctual.js.map +1 -1
  6. package/glTF/2.0/Extensions/KHR_materials_clearcoat.d.ts +24 -0
  7. package/glTF/2.0/Extensions/KHR_materials_clearcoat.js +91 -0
  8. package/glTF/2.0/Extensions/KHR_materials_clearcoat.js.map +1 -0
  9. package/glTF/2.0/Extensions/KHR_materials_sheen.d.ts +6 -11
  10. package/glTF/2.0/Extensions/KHR_materials_sheen.js +13 -37
  11. package/glTF/2.0/Extensions/KHR_materials_sheen.js.map +1 -1
  12. package/glTF/2.0/Extensions/KHR_materials_unlit.js +3 -3
  13. package/glTF/2.0/Extensions/KHR_texture_transform.js +4 -4
  14. package/glTF/2.0/Extensions/index.d.ts +1 -0
  15. package/glTF/2.0/Extensions/index.js +5 -4
  16. package/glTF/2.0/Extensions/index.js.map +1 -1
  17. package/glTF/2.0/glTFAnimation.js +10 -9
  18. package/glTF/2.0/glTFAnimation.js.map +1 -1
  19. package/glTF/2.0/glTFData.js +1 -1
  20. package/glTF/2.0/glTFData.js.map +1 -1
  21. package/glTF/2.0/glTFExporter.d.ts +7 -0
  22. package/glTF/2.0/glTFExporter.js +133 -97
  23. package/glTF/2.0/glTFExporter.js.map +1 -1
  24. package/glTF/2.0/glTFExporterExtension.js.map +1 -1
  25. package/glTF/2.0/glTFMaterialExporter.d.ts +8 -6
  26. package/glTF/2.0/glTFMaterialExporter.js +67 -48
  27. package/glTF/2.0/glTFMaterialExporter.js.map +1 -1
  28. package/glTF/2.0/glTFSerializer.d.ts +4 -0
  29. package/glTF/2.0/glTFSerializer.js +1 -1
  30. package/glTF/2.0/glTFSerializer.js.map +1 -1
  31. package/glTF/2.0/glTFUtilities.d.ts +1 -2
  32. package/glTF/2.0/glTFUtilities.js +1 -5
  33. package/glTF/2.0/glTFUtilities.js.map +1 -1
  34. package/glTF/2.0/index.d.ts +1 -1
  35. package/glTF/2.0/index.js +8 -8
  36. package/glTF/2.0/index.js.map +1 -1
  37. package/glTF/2.0/shaders/textureTransform.fragment.js +3 -3
  38. package/glTF/2.0/shaders/textureTransform.fragment.js.map +1 -1
  39. package/glTF/index.d.ts +1 -1
  40. package/glTF/index.js +2 -2
  41. package/glTF/index.js.map +1 -1
  42. package/index.d.ts +3 -3
  43. package/index.js +3 -3
  44. package/index.js.map +1 -1
  45. package/legacy/legacy-glTF2Serializer.d.ts +1 -1
  46. package/legacy/legacy-glTF2Serializer.js +7 -7
  47. package/legacy/legacy-glTF2Serializer.js.map +1 -1
  48. package/legacy/legacy-objSerializer.d.ts +1 -1
  49. package/legacy/legacy-objSerializer.js +2 -2
  50. package/legacy/legacy-objSerializer.js.map +1 -1
  51. package/legacy/legacy-stlSerializer.d.ts +1 -1
  52. package/legacy/legacy-stlSerializer.js +2 -2
  53. package/legacy/legacy-stlSerializer.js.map +1 -1
  54. package/legacy/legacy.js +4 -4
  55. package/package.json +7 -4
  56. package/stl/index.js +1 -1
  57. package/stl/stlSerializer.js +2 -2
  58. package/stl/stlSerializer.js.map +1 -1
@@ -1,5 +1,6 @@
1
- export * from "./KHR_texture_transform";
2
- export * from "./KHR_lights_punctual";
3
- export * from "./KHR_materials_sheen";
4
- export * from "./KHR_materials_unlit";
1
+ export * from "./KHR_texture_transform.js";
2
+ export * from "./KHR_lights_punctual.js";
3
+ export * from "./KHR_materials_clearcoat.js";
4
+ export * from "./KHR_materials_sheen.js";
5
+ export * from "./KHR_materials_unlit.js";
5
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../sourceES6/serializers/src/glTF/2.0/Extensions/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC","sourcesContent":["export * from \"./KHR_texture_transform\";\r\nexport * from \"./KHR_lights_punctual\";\r\nexport * from \"./KHR_materials_sheen\";\r\nexport * from \"./KHR_materials_unlit\";"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../sourceES6/serializers/src/glTF/2.0/Extensions/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC","sourcesContent":["export * from \"./KHR_texture_transform\";\r\nexport * from \"./KHR_lights_punctual\";\r\nexport * from \"./KHR_materials_clearcoat\";\r\nexport * from \"./KHR_materials_sheen\";\r\nexport * from \"./KHR_materials_unlit\";"]}
@@ -1,11 +1,11 @@
1
- import { Vector3, Quaternion } from "@babylonjs/core/Maths/math.vector";
2
- import { Tools } from "@babylonjs/core/Misc/tools";
3
- import { Animation } from "@babylonjs/core/Animations/animation";
4
- import { TransformNode } from "@babylonjs/core/Meshes/transformNode";
5
- import { MorphTarget } from "@babylonjs/core/Morph/morphTarget";
6
- import { Mesh } from "@babylonjs/core/Meshes/mesh";
7
- import { _GLTFUtilities } from "./glTFUtilities";
8
- import { AnimationKeyInterpolation } from '@babylonjs/core/Animations/animationKey';
1
+ import { Vector3, Quaternion } from "@babylonjs/core/Maths/math.vector.js";
2
+ import { Tools } from "@babylonjs/core/Misc/tools.js";
3
+ import { Animation } from "@babylonjs/core/Animations/animation.js";
4
+ import { TransformNode } from "@babylonjs/core/Meshes/transformNode.js";
5
+ import { MorphTarget } from "@babylonjs/core/Morph/morphTarget.js";
6
+ import { Mesh } from "@babylonjs/core/Meshes/mesh.js";
7
+ import { _GLTFUtilities } from "./glTFUtilities.js";
8
+ import { AnimationKeyInterpolation } from '@babylonjs/core/Animations/animationKey.js';
9
9
  /**
10
10
  * @hidden
11
11
  * Enum for handling in tangent and out tangent.
@@ -309,7 +309,8 @@ var _GLTFAnimation = /** @class */ (function () {
309
309
  animationKeys.push(morphTargetAnimation.getKeys()[i]);
310
310
  }
311
311
  else {
312
- animationKeys.push({ frame: animationGroup.from + (animationGroupFrameDiff / numAnimationKeys) * i,
312
+ animationKeys.push({
313
+ frame: animationGroup.from + (animationGroupFrameDiff / numAnimationKeys) * i,
313
314
  value: morphTarget.influence,
314
315
  inTangent: sampleAnimationKeys[0].inTangent ? 0 : undefined,
315
316
  outTangent: sampleAnimationKeys[0].outTangent ? 0 : undefined
@@ -1 +1 @@
1
- {"version":3,"file":"glTFAnimation.js","sourceRoot":"","sources":["../../../../sourceES6/serializers/src/glTF/2.0/glTFAnimation.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAErE,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAChE,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AAGnD,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAiB,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AA+CnG;;;GAGG;AACH,IAAK,YASJ;AATD,WAAK,YAAY;IACb;;OAEG;IACH,yDAAS,CAAA;IACT;;OAEG;IACH,2DAAU,CAAA;AACd,CAAC,EATI,YAAY,KAAZ,YAAY,QAShB;AACD;;;GAGG;AACH;IAAA;IAm6BA,CAAC;IAl6BG;;;;;;;;;;OAUG;IACW,mCAAoB,GAAlC,UAA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ACJ;iBACJ;qBACI;oBACD,OAAO,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;iBACvB;aACJ;YAED,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;SACzB;IACL,CAAC;IAED;;;;OAIG;IACY,uCAAwB,GAAvC,UAAwC,SAA0B;QAC9D,IAAI,GAAG,GAAW,QAAQ,CAAC;QAC3B,IAAI,GAAG,GAAW,CAAC,QAAQ,CAAC;QAC5B,SAAS,CAAC,OAAO,CAAC,UAAU,QAAQ;YAChC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;YACpC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;QACxC,CAAC,CAAC,CAAC;QAEH,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;IAElC,CAAC;IACL,qBAAC;AAAD,CAAC,AAn6BD,IAm6BC","sourcesContent":["import { AnimationSamplerInterpolation, AnimationChannelTargetPath, AccessorType, IAnimation, INode, IBufferView, IAccessor, IAnimationSampler, IAnimationChannel, AccessorComponentType } from \"babylonjs-gltf2interface\";\r\nimport { Node } from \"@babylonjs/core/node\";\r\nimport { Nullable } from \"@babylonjs/core/types\";\r\nimport { Vector3, Quaternion } from \"@babylonjs/core/Maths/math.vector\";\r\nimport { Tools } from \"@babylonjs/core/Misc/tools\";\r\nimport { Animation } from \"@babylonjs/core/Animations/animation\";\r\nimport { TransformNode } from \"@babylonjs/core/Meshes/transformNode\";\r\nimport { Scene } from \"@babylonjs/core/scene\";\r\nimport { MorphTarget } from \"@babylonjs/core/Morph/morphTarget\";\r\nimport { Mesh } from \"@babylonjs/core/Meshes/mesh\";\r\n\r\nimport { _BinaryWriter } from \"./glTFExporter\";\r\nimport { _GLTFUtilities } from \"./glTFUtilities\";\r\nimport { IAnimationKey, AnimationKeyInterpolation } from '@babylonjs/core/Animations/animationKey';\r\n\r\n/**\r\n * @hidden\r\n * Interface to store animation data.\r\n */\r\nexport interface _IAnimationData {\r\n /**\r\n * Keyframe data.\r\n */\r\n inputs: number[];\r\n /**\r\n * Value data.\r\n */\r\n outputs: number[][];\r\n /**\r\n * Animation interpolation data.\r\n */\r\n samplerInterpolation: AnimationSamplerInterpolation;\r\n /**\r\n * Minimum keyframe value.\r\n */\r\n inputsMin: number;\r\n /**\r\n * Maximum keyframe value.\r\n */\r\n inputsMax: number;\r\n}\r\n\r\n/**\r\n * @hidden\r\n */\r\nexport interface _IAnimationInfo {\r\n /**\r\n * The target channel for the animation\r\n */\r\n animationChannelTargetPath: AnimationChannelTargetPath;\r\n /**\r\n * The glTF accessor type for the data.\r\n */\r\n dataAccessorType: AccessorType.VEC3 | AccessorType.VEC4 | AccessorType.SCALAR;\r\n /**\r\n * Specifies if quaternions should be used.\r\n */\r\n useQuaternion: boolean;\r\n}\r\n\r\n/**\r\n * @hidden\r\n * Enum for handling in tangent and out tangent.\r\n */\r\nenum _TangentType {\r\n /**\r\n * Specifies that input tangents are used.\r\n */\r\n INTANGENT,\r\n /**\r\n * Specifies that output tangents are used.\r\n */\r\n OUTTANGENT\r\n}\r\n/**\r\n * @hidden\r\n * Utility class for generating glTF animation data from BabylonJS.\r\n */\r\nexport class _GLTFAnimation {\r\n /**\r\n * @ignore\r\n *\r\n * Creates glTF channel animation from BabylonJS animation.\r\n * @param babylonTransformNode - BabylonJS mesh.\r\n * @param animation - animation.\r\n * @param animationChannelTargetPath - The target animation channel.\r\n * @param convertToRightHandedSystem - Specifies if the values should be converted to right-handed.\r\n * @param useQuaternion - Specifies if quaternions are used.\r\n * @returns nullable IAnimationData\r\n */\r\n public static _CreateNodeAnimation(babylonTransformNode: TransformNode, animation: Animation, animationChannelTargetPath: AnimationChannelTargetPath, convertToRightHandedSystem: boolean, useQuaternion: boolean, animationSampleRate: number): Nullable<_IAnimationData> {\r\n const inputs: number[] = [];\r\n const outputs: number[][] = [];\r\n const keyFrames = animation.getKeys();\r\n const minMaxKeyFrames = _GLTFAnimation.calculateMinMaxKeyFrames(keyFrames);\r\n const interpolationOrBake = _GLTFAnimation._DeduceInterpolation(keyFrames, animationChannelTargetPath, useQuaternion);\r\n const frameDelta = minMaxKeyFrames.max - minMaxKeyFrames.min;\r\n\r\n const interpolation = interpolationOrBake.interpolationType;\r\n const shouldBakeAnimation = interpolationOrBake.shouldBakeAnimation;\r\n\r\n if (shouldBakeAnimation) {\r\n _GLTFAnimation._CreateBakedAnimation(babylonTransformNode, animation, animationChannelTargetPath, minMaxKeyFrames.min, minMaxKeyFrames.max, animation.framePerSecond, animationSampleRate, inputs, outputs, minMaxKeyFrames, convertToRightHandedSystem, useQuaternion);\r\n }\r\n else {\r\n if (interpolation === AnimationSamplerInterpolation.LINEAR || interpolation === AnimationSamplerInterpolation.STEP) {\r\n _GLTFAnimation._CreateLinearOrStepAnimation(babylonTransformNode, animation, animationChannelTargetPath, frameDelta, inputs, outputs, convertToRightHandedSystem, useQuaternion);\r\n\r\n }\r\n else if (interpolation === AnimationSamplerInterpolation.CUBICSPLINE) {\r\n _GLTFAnimation._CreateCubicSplineAnimation(babylonTransformNode, animation, animationChannelTargetPath, frameDelta, inputs, outputs, convertToRightHandedSystem, useQuaternion);\r\n }\r\n else {\r\n _GLTFAnimation._CreateBakedAnimation(babylonTransformNode, animation, animationChannelTargetPath, minMaxKeyFrames.min, minMaxKeyFrames.max, animation.framePerSecond, animationSampleRate, inputs, outputs, minMaxKeyFrames, convertToRightHandedSystem, useQuaternion);\r\n }\r\n }\r\n\r\n if (inputs.length && outputs.length) {\r\n const result: _IAnimationData = {\r\n inputs: inputs,\r\n outputs: outputs,\r\n samplerInterpolation: interpolation,\r\n inputsMin: shouldBakeAnimation ? minMaxKeyFrames.min : Tools.FloatRound(minMaxKeyFrames.min / animation.framePerSecond),\r\n inputsMax: shouldBakeAnimation ? minMaxKeyFrames.max : Tools.FloatRound(minMaxKeyFrames.max / animation.framePerSecond)\r\n };\r\n\r\n return result;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n private static _DeduceAnimationInfo(animation: Animation): Nullable<_IAnimationInfo> {\r\n let animationChannelTargetPath: Nullable<AnimationChannelTargetPath> = null;\r\n let dataAccessorType = AccessorType.VEC3;\r\n let useQuaternion: boolean = false;\r\n let property = animation.targetProperty.split('.');\r\n switch (property[0]) {\r\n case 'scaling': {\r\n animationChannelTargetPath = AnimationChannelTargetPath.SCALE;\r\n break;\r\n }\r\n case 'position': {\r\n animationChannelTargetPath = AnimationChannelTargetPath.TRANSLATION;\r\n break;\r\n }\r\n case 'rotation': {\r\n dataAccessorType = AccessorType.VEC4;\r\n animationChannelTargetPath = AnimationChannelTargetPath.ROTATION;\r\n break;\r\n }\r\n case 'rotationQuaternion': {\r\n dataAccessorType = AccessorType.VEC4;\r\n useQuaternion = true;\r\n animationChannelTargetPath = AnimationChannelTargetPath.ROTATION;\r\n break;\r\n }\r\n case 'influence': {\r\n dataAccessorType = AccessorType.SCALAR;\r\n animationChannelTargetPath = AnimationChannelTargetPath.WEIGHTS;\r\n break;\r\n }\r\n default: {\r\n Tools.Error(`Unsupported animatable property ${property[0]}`);\r\n }\r\n }\r\n if (animationChannelTargetPath) {\r\n return { animationChannelTargetPath: animationChannelTargetPath, dataAccessorType: dataAccessorType, useQuaternion: useQuaternion };\r\n }\r\n else {\r\n Tools.Error('animation channel target path and data accessor type could be deduced');\r\n }\r\n return null;\r\n }\r\n\r\n /**\r\n * @ignore\r\n * Create node animations from the transform node animations\r\n * @param babylonNode\r\n * @param runtimeGLTFAnimation\r\n * @param idleGLTFAnimations\r\n * @param nodeMap\r\n * @param nodes\r\n * @param binaryWriter\r\n * @param bufferViews\r\n * @param accessors\r\n * @param convertToRightHandedSystem\r\n * @param animationSampleRate\r\n */\r\n public static _CreateNodeAnimationFromNodeAnimations(babylonNode: Node, runtimeGLTFAnimation: IAnimation, idleGLTFAnimations: IAnimation[], nodeMap: { [key: number]: number }, nodes: INode[], binaryWriter: _BinaryWriter, bufferViews: IBufferView[], accessors: IAccessor[], convertToRightHandedSystem: boolean, animationSampleRate: number) {\r\n let glTFAnimation: IAnimation;\r\n if (babylonNode instanceof TransformNode) {\r\n if (babylonNode.animations) {\r\n for (let animation of babylonNode.animations) {\r\n let animationInfo = _GLTFAnimation._DeduceAnimationInfo(animation);\r\n if (animationInfo) {\r\n glTFAnimation = {\r\n name: animation.name,\r\n samplers: [],\r\n channels: []\r\n };\r\n _GLTFAnimation.AddAnimation(`${animation.name}`,\r\n animation.hasRunningRuntimeAnimations ? runtimeGLTFAnimation : glTFAnimation,\r\n babylonNode,\r\n animation,\r\n animationInfo.dataAccessorType,\r\n animationInfo.animationChannelTargetPath,\r\n nodeMap,\r\n binaryWriter,\r\n bufferViews,\r\n accessors,\r\n convertToRightHandedSystem,\r\n animationInfo.useQuaternion,\r\n animationSampleRate\r\n );\r\n if (glTFAnimation.samplers.length && glTFAnimation.channels.length) {\r\n idleGLTFAnimations.push(glTFAnimation);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @ignore\r\n * Create individual morph animations from the mesh's morph target animation tracks\r\n * @param babylonNode\r\n * @param runtimeGLTFAnimation\r\n * @param idleGLTFAnimations\r\n * @param nodeMap\r\n * @param nodes\r\n * @param binaryWriter\r\n * @param bufferViews\r\n * @param accessors\r\n * @param convertToRightHandedSystem\r\n * @param animationSampleRate\r\n */\r\n public static _CreateMorphTargetAnimationFromMorphTargetAnimations(babylonNode: Node, runtimeGLTFAnimation: IAnimation, idleGLTFAnimations: IAnimation[], nodeMap: { [key: number]: number }, nodes: INode[], binaryWriter: _BinaryWriter, bufferViews: IBufferView[], accessors: IAccessor[], convertToRightHandedSystem: boolean, animationSampleRate: number) {\r\n let glTFAnimation: IAnimation;\r\n if (babylonNode instanceof Mesh) {\r\n const morphTargetManager = babylonNode.morphTargetManager;\r\n if (morphTargetManager) {\r\n for (let i = 0; i < morphTargetManager.numTargets; ++i) {\r\n const morphTarget = morphTargetManager.getTarget(i);\r\n for (const animation of morphTarget.animations) {\r\n const combinedAnimation = new Animation(`${animation.name}`,\r\n \"influence\",\r\n animation.framePerSecond,\r\n animation.dataType,\r\n animation.loopMode,\r\n animation.enableBlending);\r\n const combinedAnimationKeys: IAnimationKey[] = [];\r\n const animationKeys = animation.getKeys();\r\n\r\n for (let j = 0; j < animationKeys.length; ++j) {\r\n let animationKey = animationKeys[j];\r\n for (let k = 0; k < morphTargetManager.numTargets; ++k) {\r\n if (k == i) {\r\n combinedAnimationKeys.push(animationKey);\r\n } else {\r\n combinedAnimationKeys.push({ frame: animationKey.frame, value: 0 });\r\n }\r\n }\r\n }\r\n combinedAnimation.setKeys(combinedAnimationKeys);\r\n const animationInfo = _GLTFAnimation._DeduceAnimationInfo(combinedAnimation);\r\n if (animationInfo) {\r\n glTFAnimation = {\r\n name: combinedAnimation.name,\r\n samplers: [],\r\n channels: []\r\n };\r\n _GLTFAnimation.AddAnimation(animation.name,\r\n animation.hasRunningRuntimeAnimations ? runtimeGLTFAnimation : glTFAnimation,\r\n babylonNode,\r\n combinedAnimation,\r\n animationInfo.dataAccessorType,\r\n animationInfo.animationChannelTargetPath,\r\n nodeMap,\r\n binaryWriter,\r\n bufferViews,\r\n accessors,\r\n convertToRightHandedSystem,\r\n animationInfo.useQuaternion,\r\n animationSampleRate,\r\n morphTargetManager.numTargets\r\n );\r\n if (glTFAnimation.samplers.length && glTFAnimation.channels.length) {\r\n idleGLTFAnimations.push(glTFAnimation);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @ignore\r\n * Create node and morph animations from the animation groups\r\n * @param babylonScene\r\n * @param glTFAnimations\r\n * @param nodeMap\r\n * @param nodes\r\n * @param binaryWriter\r\n * @param bufferViews\r\n * @param accessors\r\n * @param convertToRightHandedSystemMap\r\n * @param animationSampleRate\r\n */\r\n public static _CreateNodeAndMorphAnimationFromAnimationGroups(babylonScene: Scene, glTFAnimations: IAnimation[], nodeMap: { [key: number]: number }, nodes: INode[], binaryWriter: _BinaryWriter, bufferViews: IBufferView[], accessors: IAccessor[], convertToRightHandedSystemMap: { [nodeId: number]: boolean }, animationSampleRate: number) {\r\n let glTFAnimation: IAnimation;\r\n if (babylonScene.animationGroups) {\r\n const animationGroups = babylonScene.animationGroups;\r\n for (let animationGroup of animationGroups) {\r\n const morphAnimations: Map<Mesh, Map<MorphTarget, Animation>> = new Map();\r\n const sampleAnimations: Map<Mesh, Animation> = new Map();\r\n const morphAnimationMeshes: Set<Mesh> = new Set();\r\n const animationGroupFrameDiff = animationGroup.to - animationGroup.from;\r\n glTFAnimation = {\r\n name: animationGroup.name,\r\n channels: [],\r\n samplers: []\r\n };\r\n for (let i = 0; i < animationGroup.targetedAnimations.length; ++i) {\r\n const targetAnimation = animationGroup.targetedAnimations[i];\r\n const target = targetAnimation.target;\r\n const animation = targetAnimation.animation;\r\n if (target instanceof TransformNode || target.length === 1 && target[0] instanceof TransformNode) {\r\n const animationInfo = _GLTFAnimation._DeduceAnimationInfo(targetAnimation.animation);\r\n if (animationInfo) {\r\n const babylonTransformNode = target instanceof TransformNode ? target as TransformNode : target[0] as TransformNode;\r\n const convertToRightHandedSystem = convertToRightHandedSystemMap[babylonTransformNode.uniqueId];\r\n _GLTFAnimation.AddAnimation(`${animation.name}`,\r\n glTFAnimation,\r\n babylonTransformNode,\r\n animation,\r\n animationInfo.dataAccessorType,\r\n animationInfo.animationChannelTargetPath,\r\n nodeMap,\r\n binaryWriter,\r\n bufferViews,\r\n accessors,\r\n convertToRightHandedSystem,\r\n animationInfo.useQuaternion,\r\n animationSampleRate\r\n );\r\n }\r\n } else if (target instanceof MorphTarget || target.length === 1 && target[0] instanceof MorphTarget) {\r\n const animationInfo = _GLTFAnimation._DeduceAnimationInfo(targetAnimation.animation);\r\n if (animationInfo) {\r\n const babylonMorphTarget = target instanceof MorphTarget ? target as MorphTarget : target[0] as MorphTarget;\r\n if (babylonMorphTarget) {\r\n const babylonMorphTargetManager = babylonScene.morphTargetManagers.find((morphTargetManager) => {\r\n for (let j = 0; j < morphTargetManager.numTargets; ++j) {\r\n if (morphTargetManager.getTarget(j) === babylonMorphTarget) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n });\r\n if (babylonMorphTargetManager) {\r\n const babylonMesh = babylonScene.meshes.find((mesh) => {\r\n return (mesh as Mesh).morphTargetManager === babylonMorphTargetManager;\r\n }) as Mesh;\r\n if (babylonMesh) {\r\n if (!morphAnimations.has(babylonMesh)) {\r\n morphAnimations.set(babylonMesh, new Map());\r\n }\r\n morphAnimations.get(babylonMesh)?.set(babylonMorphTarget, animation);\r\n morphAnimationMeshes.add(babylonMesh);\r\n sampleAnimations.set(babylonMesh, animation);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n morphAnimationMeshes.forEach((mesh) => {\r\n const morphTargetManager = mesh.morphTargetManager!;\r\n let combinedAnimationGroup: Nullable<Animation> = null;\r\n const animationKeys: IAnimationKey[] = [];\r\n const sampleAnimation = sampleAnimations.get(mesh)!;\r\n const sampleAnimationKeys = sampleAnimation.getKeys();\r\n const numAnimationKeys = sampleAnimationKeys.length;\r\n /*\r\n Due to how glTF expects morph target animation data to be formatted, we need to rearrange the individual morph target animation tracks,\r\n such that we have a single animation, where a given keyframe input value has successive output values for each morph target belonging to the manager.\r\n See: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#animations\r\n\r\n We do this via constructing a new Animation track, and interleaving the frames of each morph target animation track in the current Animation Group\r\n We reuse the Babylon Animation data structure for ease of handling export of cubic spline animation keys, and to reuse the\r\n existing _GLTFAnimation.AddAnimation codepath with minimal modification, however the constructed Babylon Animation is NOT intended for use in-engine.\r\n */\r\n for (let i = 0; i < numAnimationKeys; ++i) {\r\n for (let j = 0; j < morphTargetManager.numTargets; ++j) {\r\n const morphTarget = morphTargetManager.getTarget(j);\r\n const animationsByMorphTarget = morphAnimations.get(mesh);\r\n if (animationsByMorphTarget) {\r\n const morphTargetAnimation = animationsByMorphTarget.get(morphTarget);\r\n if (morphTargetAnimation) {\r\n if (!combinedAnimationGroup) {\r\n combinedAnimationGroup = new Animation(`${animationGroup.name}_${mesh.name}_MorphWeightAnimation`,\r\n \"influence\",\r\n morphTargetAnimation.framePerSecond,\r\n Animation.ANIMATIONTYPE_FLOAT,\r\n morphTargetAnimation.loopMode,\r\n morphTargetAnimation.enableBlending);\r\n }\r\n animationKeys.push(morphTargetAnimation.getKeys()[i]);\r\n }\r\n else {\r\n animationKeys.push({ frame: animationGroup.from + (animationGroupFrameDiff / numAnimationKeys) * i,\r\n value: morphTarget.influence,\r\n inTangent: sampleAnimationKeys[0].inTangent ? 0 : undefined,\r\n outTangent: sampleAnimationKeys[0].outTangent ? 0 : undefined\r\n });\r\n }\r\n }\r\n }\r\n }\r\n combinedAnimationGroup!.setKeys(animationKeys);\r\n const animationInfo = _GLTFAnimation._DeduceAnimationInfo(combinedAnimationGroup!);\r\n if (animationInfo) {\r\n _GLTFAnimation.AddAnimation(`${animationGroup.name}_${mesh.name}_MorphWeightAnimation`,\r\n glTFAnimation,\r\n mesh,\r\n combinedAnimationGroup!,\r\n animationInfo.dataAccessorType,\r\n animationInfo.animationChannelTargetPath,\r\n nodeMap,\r\n binaryWriter,\r\n bufferViews,\r\n accessors,\r\n false,\r\n animationInfo.useQuaternion,\r\n animationSampleRate,\r\n morphTargetManager?.numTargets\r\n );\r\n }\r\n });\r\n if (glTFAnimation.channels.length && glTFAnimation.samplers.length) {\r\n glTFAnimations.push(glTFAnimation);\r\n }\r\n }\r\n }\r\n }\r\n\r\n private static AddAnimation(name: string, glTFAnimation: IAnimation, babylonTransformNode: TransformNode, animation: Animation, dataAccessorType: AccessorType, animationChannelTargetPath: AnimationChannelTargetPath, nodeMap: { [key: number]: number }, binaryWriter: _BinaryWriter, bufferViews: IBufferView[], accessors: IAccessor[], convertToRightHandedSystem: boolean, useQuaternion: boolean, animationSampleRate: number, morphAnimationChannels?: number) {\r\n const animationData = _GLTFAnimation._CreateNodeAnimation(babylonTransformNode, animation, animationChannelTargetPath, convertToRightHandedSystem, useQuaternion, animationSampleRate);\r\n let bufferView: IBufferView;\r\n let accessor: IAccessor;\r\n let keyframeAccessorIndex: number;\r\n let dataAccessorIndex: number;\r\n let outputLength: number;\r\n let animationSampler: IAnimationSampler;\r\n let animationChannel: IAnimationChannel;\r\n\r\n if (animationData) {\r\n\r\n /*\r\n * Now that we have the glTF converted morph target animation data,\r\n * we can remove redundant input data so that we have n input frames,\r\n * and morphAnimationChannels * n output frames\r\n */\r\n if (morphAnimationChannels) {\r\n let index = 0;\r\n let currentInput: number = 0;\r\n let newInputs: number[] = [];\r\n while (animationData.inputs.length > 0) {\r\n currentInput = animationData.inputs.shift()!;\r\n if (index % morphAnimationChannels == 0) {\r\n newInputs.push(currentInput);\r\n }\r\n index++;\r\n }\r\n animationData.inputs = newInputs;\r\n }\r\n\r\n let nodeIndex = nodeMap[babylonTransformNode.uniqueId];\r\n\r\n // Creates buffer view and accessor for key frames.\r\n let byteLength = animationData.inputs.length * 4;\r\n bufferView = _GLTFUtilities._CreateBufferView(0, binaryWriter.getByteOffset(), byteLength, undefined, `${name} keyframe data view`);\r\n bufferViews.push(bufferView);\r\n animationData.inputs.forEach(function (input) {\r\n binaryWriter.setFloat32(input);\r\n });\r\n\r\n accessor = _GLTFUtilities._CreateAccessor(bufferViews.length - 1, `${name} keyframes`, AccessorType.SCALAR, AccessorComponentType.FLOAT, animationData.inputs.length, null, [animationData.inputsMin], [animationData.inputsMax]);\r\n accessors.push(accessor);\r\n keyframeAccessorIndex = accessors.length - 1;\r\n\r\n // create bufferview and accessor for keyed values.\r\n outputLength = animationData.outputs.length;\r\n byteLength = _GLTFUtilities._GetDataAccessorElementCount(dataAccessorType) * 4 * animationData.outputs.length;\r\n\r\n // check for in and out tangents\r\n bufferView = _GLTFUtilities._CreateBufferView(0, binaryWriter.getByteOffset(), byteLength, undefined, `${name} data view`);\r\n bufferViews.push(bufferView);\r\n\r\n animationData.outputs.forEach(function (output) {\r\n output.forEach(function (entry) {\r\n binaryWriter.setFloat32(entry);\r\n });\r\n });\r\n\r\n accessor = _GLTFUtilities._CreateAccessor(bufferViews.length - 1, `${name} data`, dataAccessorType, AccessorComponentType.FLOAT, outputLength, null, null, null);\r\n accessors.push(accessor);\r\n dataAccessorIndex = accessors.length - 1;\r\n\r\n // create sampler\r\n animationSampler = {\r\n interpolation: animationData.samplerInterpolation,\r\n input: keyframeAccessorIndex,\r\n output: dataAccessorIndex\r\n };\r\n glTFAnimation.samplers.push(animationSampler);\r\n\r\n // create channel\r\n animationChannel = {\r\n sampler: glTFAnimation.samplers.length - 1,\r\n target: {\r\n node: nodeIndex,\r\n path: animationChannelTargetPath\r\n }\r\n };\r\n glTFAnimation.channels.push(animationChannel);\r\n }\r\n }\r\n\r\n /**\r\n * Create a baked animation\r\n * @param babylonTransformNode BabylonJS mesh\r\n * @param animation BabylonJS animation corresponding to the BabylonJS mesh\r\n * @param animationChannelTargetPath animation target channel\r\n * @param minFrame minimum animation frame\r\n * @param maxFrame maximum animation frame\r\n * @param fps frames per second of the animation\r\n * @param inputs input key frames of the animation\r\n * @param outputs output key frame data of the animation\r\n * @param convertToRightHandedSystem converts the values to right-handed\r\n * @param useQuaternion specifies if quaternions should be used\r\n */\r\n private static _CreateBakedAnimation(babylonTransformNode: TransformNode, animation: Animation, animationChannelTargetPath: AnimationChannelTargetPath, minFrame: number, maxFrame: number, fps: number, sampleRate: number, inputs: number[], outputs: number[][], minMaxFrames: { min: number, max: number }, convertToRightHandedSystem: boolean, useQuaternion: boolean) {\r\n let value: number | Vector3 | Quaternion;\r\n let quaternionCache: Quaternion = Quaternion.Identity();\r\n let previousTime: Nullable<number> = null;\r\n let time: number;\r\n let maxUsedFrame: Nullable<number> = null;\r\n let currKeyFrame: Nullable<IAnimationKey> = null;\r\n let nextKeyFrame: Nullable<IAnimationKey> = null;\r\n let prevKeyFrame: Nullable<IAnimationKey> = null;\r\n let endFrame: Nullable<number> = null;\r\n minMaxFrames.min = Tools.FloatRound(minFrame / fps);\r\n\r\n let keyFrames = animation.getKeys();\r\n\r\n for (let i = 0, length = keyFrames.length; i < length; ++i) {\r\n endFrame = null;\r\n currKeyFrame = keyFrames[i];\r\n\r\n if (i + 1 < length) {\r\n nextKeyFrame = keyFrames[i + 1];\r\n if (currKeyFrame.value.equals && currKeyFrame.value.equals(nextKeyFrame.value) || currKeyFrame.value === nextKeyFrame.value) {\r\n if (i === 0) { // set the first frame to itself\r\n endFrame = currKeyFrame.frame;\r\n }\r\n else {\r\n continue;\r\n }\r\n }\r\n else {\r\n endFrame = nextKeyFrame.frame;\r\n }\r\n }\r\n else {\r\n // at the last key frame\r\n prevKeyFrame = keyFrames[i - 1];\r\n if (currKeyFrame.value.equals && currKeyFrame.value.equals(prevKeyFrame.value) || currKeyFrame.value === prevKeyFrame.value) {\r\n continue;\r\n }\r\n else {\r\n endFrame = maxFrame;\r\n }\r\n }\r\n if (endFrame) {\r\n for (let f = currKeyFrame.frame; f <= endFrame; f += sampleRate) {\r\n time = Tools.FloatRound(f / fps);\r\n if (time === previousTime) {\r\n continue;\r\n }\r\n previousTime = time;\r\n maxUsedFrame = time;\r\n let state = {\r\n key: 0,\r\n repeatCount: 0,\r\n loopMode: animation.loopMode\r\n };\r\n value = animation._interpolate(f, state);\r\n\r\n _GLTFAnimation._SetInterpolatedValue(babylonTransformNode, value, time, animation, animationChannelTargetPath, quaternionCache, inputs, outputs, convertToRightHandedSystem, useQuaternion);\r\n }\r\n }\r\n }\r\n if (maxUsedFrame) {\r\n minMaxFrames.max = maxUsedFrame;\r\n }\r\n }\r\n\r\n private static _ConvertFactorToVector3OrQuaternion(factor: number, babylonTransformNode: TransformNode, animation: Animation, animationType: number, animationChannelTargetPath: AnimationChannelTargetPath, convertToRightHandedSystem: boolean, useQuaternion: boolean): Nullable<Vector3 | Quaternion> {\r\n let property: string[];\r\n let componentName: string;\r\n let value: Nullable<Quaternion | Vector3> = null;\r\n const basePositionRotationOrScale = _GLTFAnimation._GetBasePositionRotationOrScale(babylonTransformNode, animationChannelTargetPath, convertToRightHandedSystem, useQuaternion);\r\n if (animationType === Animation.ANIMATIONTYPE_FLOAT) { // handles single component x, y, z or w component animation by using a base property and animating over a component.\r\n property = animation.targetProperty.split('.');\r\n componentName = property ? property[1] : ''; // x, y, or z component\r\n value = useQuaternion ? Quaternion.FromArray(basePositionRotationOrScale).normalize() : Vector3.FromArray(basePositionRotationOrScale);\r\n\r\n switch (componentName) {\r\n case 'x': {\r\n value[componentName] = (convertToRightHandedSystem && useQuaternion && (animationChannelTargetPath !== AnimationChannelTargetPath.SCALE)) ? -factor : factor;\r\n break;\r\n }\r\n case 'y': {\r\n value[componentName] = (convertToRightHandedSystem && useQuaternion && (animationChannelTargetPath !== AnimationChannelTargetPath.SCALE)) ? -factor : factor;\r\n break;\r\n }\r\n case 'z': {\r\n value[componentName] = (convertToRightHandedSystem && !useQuaternion && (animationChannelTargetPath !== AnimationChannelTargetPath.SCALE)) ? -factor : factor;\r\n break;\r\n }\r\n case 'w': {\r\n (value as Quaternion).w = factor;\r\n break;\r\n }\r\n default: {\r\n Tools.Error(`glTFAnimation: Unsupported component type \"${componentName}\" for scale animation!`);\r\n }\r\n }\r\n }\r\n\r\n return value;\r\n }\r\n\r\n private static _SetInterpolatedValue(babylonTransformNode: TransformNode, value: Nullable<number | Vector3 | Quaternion>, time: number, animation: Animation, animationChannelTargetPath: AnimationChannelTargetPath, quaternionCache: Quaternion, inputs: number[], outputs: number[][], convertToRightHandedSystem: boolean, useQuaternion: boolean) {\r\n const animationType = animation.dataType;\r\n let cacheValue: Vector3 | Quaternion | number;\r\n inputs.push(time);\r\n if (typeof value === \"number\" && babylonTransformNode instanceof TransformNode) {\r\n value = this._ConvertFactorToVector3OrQuaternion(value as number, babylonTransformNode, animation, animationType, animationChannelTargetPath, convertToRightHandedSystem, useQuaternion);\r\n }\r\n if (value) {\r\n if (animationChannelTargetPath === AnimationChannelTargetPath.ROTATION) {\r\n if (useQuaternion) {\r\n quaternionCache = value as Quaternion;\r\n }\r\n else {\r\n cacheValue = value as Vector3;\r\n Quaternion.RotationYawPitchRollToRef(cacheValue.y, cacheValue.x, cacheValue.z, quaternionCache);\r\n }\r\n if (convertToRightHandedSystem) {\r\n _GLTFUtilities._GetRightHandedQuaternionFromRef(quaternionCache);\r\n\r\n if (!babylonTransformNode.parent) {\r\n quaternionCache = Quaternion.FromArray([0, 1, 0, 0]).multiply(quaternionCache);\r\n }\r\n }\r\n outputs.push(quaternionCache.asArray());\r\n }\r\n else if (animationChannelTargetPath === AnimationChannelTargetPath.WEIGHTS) {\r\n outputs.push([value as number]);\r\n }\r\n else { // scaling and position animation\r\n cacheValue = value as Vector3;\r\n if (convertToRightHandedSystem && (animationChannelTargetPath !== AnimationChannelTargetPath.SCALE)) {\r\n _GLTFUtilities._GetRightHandedPositionVector3FromRef(cacheValue);\r\n if (!babylonTransformNode.parent) {\r\n cacheValue.x *= -1;\r\n cacheValue.z *= -1;\r\n }\r\n }\r\n\r\n outputs.push(cacheValue.asArray());\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Creates linear animation from the animation key frames\r\n * @param babylonTransformNode BabylonJS mesh\r\n * @param animation BabylonJS animation\r\n * @param animationChannelTargetPath The target animation channel\r\n * @param frameDelta The difference between the last and first frame of the animation\r\n * @param inputs Array to store the key frame times\r\n * @param outputs Array to store the key frame data\r\n * @param convertToRightHandedSystem Specifies if the position data should be converted to right handed\r\n * @param useQuaternion Specifies if quaternions are used in the animation\r\n */\r\n private static _CreateLinearOrStepAnimation(babylonTransformNode: TransformNode, animation: Animation, animationChannelTargetPath: AnimationChannelTargetPath, frameDelta: number, inputs: number[], outputs: number[][], convertToRightHandedSystem: boolean, useQuaternion: boolean) {\r\n for (let keyFrame of animation.getKeys()) {\r\n inputs.push(keyFrame.frame / animation.framePerSecond); // keyframes in seconds.\r\n _GLTFAnimation._AddKeyframeValue(keyFrame, animation, outputs, animationChannelTargetPath, babylonTransformNode, convertToRightHandedSystem, useQuaternion);\r\n }\r\n }\r\n\r\n /**\r\n * Creates cubic spline animation from the animation key frames\r\n * @param babylonTransformNode BabylonJS mesh\r\n * @param animation BabylonJS animation\r\n * @param animationChannelTargetPath The target animation channel\r\n * @param frameDelta The difference between the last and first frame of the animation\r\n * @param inputs Array to store the key frame times\r\n * @param outputs Array to store the key frame data\r\n * @param convertToRightHandedSystem Specifies if the position data should be converted to right handed\r\n * @param useQuaternion Specifies if quaternions are used in the animation\r\n */\r\n private static _CreateCubicSplineAnimation(babylonTransformNode: TransformNode, animation: Animation, animationChannelTargetPath: AnimationChannelTargetPath, frameDelta: number, inputs: number[], outputs: number[][], convertToRightHandedSystem: boolean, useQuaternion: boolean) {\r\n animation.getKeys().forEach(function (keyFrame) {\r\n inputs.push(keyFrame.frame / animation.framePerSecond); // keyframes in seconds.\r\n _GLTFAnimation.AddSplineTangent(\r\n babylonTransformNode,\r\n _TangentType.INTANGENT,\r\n outputs,\r\n animationChannelTargetPath,\r\n AnimationSamplerInterpolation.CUBICSPLINE,\r\n keyFrame,\r\n frameDelta,\r\n useQuaternion,\r\n convertToRightHandedSystem\r\n );\r\n _GLTFAnimation._AddKeyframeValue(keyFrame, animation, outputs, animationChannelTargetPath, babylonTransformNode, convertToRightHandedSystem, useQuaternion);\r\n\r\n _GLTFAnimation.AddSplineTangent(\r\n babylonTransformNode,\r\n _TangentType.OUTTANGENT,\r\n outputs,\r\n animationChannelTargetPath,\r\n AnimationSamplerInterpolation.CUBICSPLINE,\r\n keyFrame,\r\n frameDelta,\r\n useQuaternion,\r\n convertToRightHandedSystem\r\n );\r\n });\r\n }\r\n\r\n private static _GetBasePositionRotationOrScale(babylonTransformNode: TransformNode, animationChannelTargetPath: AnimationChannelTargetPath, convertToRightHandedSystem: boolean, useQuaternion: boolean) {\r\n let basePositionRotationOrScale: number[];\r\n if (animationChannelTargetPath === AnimationChannelTargetPath.ROTATION) {\r\n if (useQuaternion) {\r\n if (babylonTransformNode.rotationQuaternion) {\r\n basePositionRotationOrScale = babylonTransformNode.rotationQuaternion.asArray();\r\n if (convertToRightHandedSystem) {\r\n _GLTFUtilities._GetRightHandedQuaternionArrayFromRef(basePositionRotationOrScale);\r\n if (!babylonTransformNode.parent) {\r\n basePositionRotationOrScale = Quaternion.FromArray([0, 1, 0, 0]).multiply(Quaternion.FromArray(basePositionRotationOrScale)).asArray();\r\n }\r\n }\r\n }\r\n else {\r\n basePositionRotationOrScale = Quaternion.Identity().asArray();\r\n }\r\n }\r\n else {\r\n basePositionRotationOrScale = babylonTransformNode.rotation.asArray();\r\n _GLTFUtilities._GetRightHandedNormalArray3FromRef(basePositionRotationOrScale);\r\n }\r\n }\r\n else if (animationChannelTargetPath === AnimationChannelTargetPath.TRANSLATION) {\r\n basePositionRotationOrScale = babylonTransformNode.position.asArray();\r\n if (convertToRightHandedSystem) {\r\n _GLTFUtilities._GetRightHandedPositionArray3FromRef(basePositionRotationOrScale);\r\n }\r\n }\r\n else { // scale\r\n basePositionRotationOrScale = babylonTransformNode.scaling.asArray();\r\n }\r\n return basePositionRotationOrScale;\r\n }\r\n\r\n /**\r\n * Adds a key frame value\r\n * @param keyFrame\r\n * @param animation\r\n * @param outputs\r\n * @param animationChannelTargetPath\r\n * @param basePositionRotationOrScale\r\n * @param convertToRightHandedSystem\r\n * @param useQuaternion\r\n */\r\n private static _AddKeyframeValue(keyFrame: IAnimationKey, animation: Animation, outputs: number[][], animationChannelTargetPath: AnimationChannelTargetPath, babylonTransformNode: TransformNode, convertToRightHandedSystem: boolean, useQuaternion: boolean) {\r\n let value: number[];\r\n let newPositionRotationOrScale: Nullable<Vector3 | Quaternion | number>;\r\n const animationType = animation.dataType;\r\n if (animationType === Animation.ANIMATIONTYPE_VECTOR3) {\r\n value = keyFrame.value.asArray();\r\n if (animationChannelTargetPath === AnimationChannelTargetPath.ROTATION) {\r\n const array = Vector3.FromArray(value);\r\n let rotationQuaternion = Quaternion.RotationYawPitchRoll(array.y, array.x, array.z);\r\n if (convertToRightHandedSystem) {\r\n _GLTFUtilities._GetRightHandedQuaternionFromRef(rotationQuaternion);\r\n\r\n if (!babylonTransformNode.parent) {\r\n rotationQuaternion = Quaternion.FromArray([0, 1, 0, 0]).multiply(rotationQuaternion);\r\n }\r\n }\r\n value = rotationQuaternion.asArray();\r\n }\r\n else if (animationChannelTargetPath === AnimationChannelTargetPath.TRANSLATION) {\r\n if (convertToRightHandedSystem) {\r\n _GLTFUtilities._GetRightHandedNormalArray3FromRef(value);\r\n if (!babylonTransformNode.parent) {\r\n value[0] *= -1;\r\n value[2] *= -1;\r\n }\r\n }\r\n }\r\n outputs.push(value); // scale vector.\r\n\r\n }\r\n else if (animationType === Animation.ANIMATIONTYPE_FLOAT) {\r\n if (animationChannelTargetPath === AnimationChannelTargetPath.WEIGHTS) {\r\n outputs.push([keyFrame.value]);\r\n } else { // handles single component x, y, z or w component animation by using a base property and animating over a component.\r\n newPositionRotationOrScale = this._ConvertFactorToVector3OrQuaternion(keyFrame.value as number, babylonTransformNode, animation, animationType, animationChannelTargetPath, convertToRightHandedSystem, useQuaternion);\r\n if (newPositionRotationOrScale) {\r\n if (animationChannelTargetPath === AnimationChannelTargetPath.ROTATION) {\r\n let posRotScale = useQuaternion ? newPositionRotationOrScale as Quaternion : Quaternion.RotationYawPitchRoll(newPositionRotationOrScale.y, newPositionRotationOrScale.x, newPositionRotationOrScale.z).normalize();\r\n if (convertToRightHandedSystem) {\r\n _GLTFUtilities._GetRightHandedQuaternionFromRef(posRotScale);\r\n\r\n if (!babylonTransformNode.parent) {\r\n posRotScale = Quaternion.FromArray([0, 1, 0, 0]).multiply(posRotScale);\r\n }\r\n }\r\n outputs.push(posRotScale.asArray());\r\n }\r\n else if (animationChannelTargetPath === AnimationChannelTargetPath.TRANSLATION) {\r\n if (convertToRightHandedSystem) {\r\n _GLTFUtilities._GetRightHandedNormalVector3FromRef(newPositionRotationOrScale as Vector3);\r\n\r\n if (!babylonTransformNode.parent) {\r\n newPositionRotationOrScale.x *= -1;\r\n newPositionRotationOrScale.z *= -1;\r\n }\r\n }\r\n }\r\n outputs.push(newPositionRotationOrScale.asArray());\r\n }\r\n }\r\n }\r\n else if (animationType === Animation.ANIMATIONTYPE_QUATERNION) {\r\n value = (keyFrame.value as Quaternion).normalize().asArray();\r\n\r\n if (convertToRightHandedSystem) {\r\n _GLTFUtilities._GetRightHandedQuaternionArrayFromRef(value);\r\n\r\n if (!babylonTransformNode.parent) {\r\n value = Quaternion.FromArray([0, 1, 0, 0]).multiply(Quaternion.FromArray(value)).asArray();\r\n }\r\n }\r\n\r\n outputs.push(value);\r\n }\r\n else {\r\n Tools.Error('glTFAnimation: Unsupported key frame values for animation!');\r\n }\r\n }\r\n\r\n /**\r\n * Determine the interpolation based on the key frames\r\n * @param keyFrames\r\n * @param animationChannelTargetPath\r\n * @param useQuaternion\r\n */\r\n private static _DeduceInterpolation(keyFrames: IAnimationKey[], animationChannelTargetPath: AnimationChannelTargetPath, useQuaternion: boolean): { interpolationType: AnimationSamplerInterpolation, shouldBakeAnimation: boolean } {\r\n let interpolationType: AnimationSamplerInterpolation | undefined;\r\n let shouldBakeAnimation = false;\r\n let key: IAnimationKey;\r\n\r\n if (animationChannelTargetPath === AnimationChannelTargetPath.ROTATION && !useQuaternion) {\r\n return { interpolationType: AnimationSamplerInterpolation.LINEAR, shouldBakeAnimation: true };\r\n }\r\n\r\n for (let i = 0, length = keyFrames.length; i < length; ++i) {\r\n key = keyFrames[i];\r\n if (key.inTangent || key.outTangent) {\r\n if (interpolationType) {\r\n if (interpolationType !== AnimationSamplerInterpolation.CUBICSPLINE) {\r\n interpolationType = AnimationSamplerInterpolation.LINEAR;\r\n shouldBakeAnimation = true;\r\n break;\r\n }\r\n }\r\n else {\r\n interpolationType = AnimationSamplerInterpolation.CUBICSPLINE;\r\n }\r\n }\r\n else {\r\n if (interpolationType) {\r\n if (interpolationType === AnimationSamplerInterpolation.CUBICSPLINE ||\r\n (key.interpolation && (key.interpolation === AnimationKeyInterpolation.STEP) && interpolationType !== AnimationSamplerInterpolation.STEP)) {\r\n interpolationType = AnimationSamplerInterpolation.LINEAR;\r\n shouldBakeAnimation = true;\r\n break;\r\n }\r\n }\r\n else {\r\n if (key.interpolation && (key.interpolation === AnimationKeyInterpolation.STEP)) {\r\n interpolationType = AnimationSamplerInterpolation.STEP;\r\n }\r\n else {\r\n interpolationType = AnimationSamplerInterpolation.LINEAR;\r\n }\r\n }\r\n }\r\n }\r\n if (!interpolationType) {\r\n interpolationType = AnimationSamplerInterpolation.LINEAR;\r\n }\r\n\r\n return { interpolationType: interpolationType, shouldBakeAnimation: shouldBakeAnimation };\r\n }\r\n\r\n /**\r\n * Adds an input tangent or output tangent to the output data\r\n * If an input tangent or output tangent is missing, it uses the zero vector or zero quaternion\r\n * @param tangentType Specifies which type of tangent to handle (inTangent or outTangent)\r\n * @param outputs The animation data by keyframe\r\n * @param animationChannelTargetPath The target animation channel\r\n * @param interpolation The interpolation type\r\n * @param keyFrame The key frame with the animation data\r\n * @param frameDelta Time difference between two frames used to scale the tangent by the frame delta\r\n * @param useQuaternion Specifies if quaternions are used\r\n * @param convertToRightHandedSystem Specifies if the values should be converted to right-handed\r\n */\r\n private static AddSplineTangent(babylonTransformNode: TransformNode, tangentType: _TangentType, outputs: number[][], animationChannelTargetPath: AnimationChannelTargetPath, interpolation: AnimationSamplerInterpolation, keyFrame: IAnimationKey, frameDelta: number, useQuaternion: boolean, convertToRightHandedSystem: boolean) {\r\n let tangent: number[];\r\n let tangentValue: Vector3 | Quaternion | number = tangentType === _TangentType.INTANGENT ? keyFrame.inTangent : keyFrame.outTangent;\r\n if (interpolation === AnimationSamplerInterpolation.CUBICSPLINE) {\r\n if (animationChannelTargetPath === AnimationChannelTargetPath.ROTATION) {\r\n if (tangentValue) {\r\n if (useQuaternion) {\r\n tangent = (tangentValue as Quaternion).asArray();\r\n }\r\n else {\r\n const array = (tangentValue as Vector3);\r\n tangent = Quaternion.RotationYawPitchRoll(array.y, array.x, array.z).asArray();\r\n }\r\n\r\n if (convertToRightHandedSystem) {\r\n _GLTFUtilities._GetRightHandedQuaternionArrayFromRef(tangent);\r\n if (!babylonTransformNode.parent) {\r\n tangent = Quaternion.FromArray([0, 1, 0, 0]).multiply(Quaternion.FromArray(tangent)).asArray();\r\n }\r\n }\r\n }\r\n else {\r\n tangent = [0, 0, 0, 0];\r\n }\r\n }\r\n else if (animationChannelTargetPath === AnimationChannelTargetPath.WEIGHTS) {\r\n if (tangentValue) {\r\n tangent = [tangentValue as number];\r\n } else {\r\n tangent = [0];\r\n }\r\n }\r\n else {\r\n if (tangentValue) {\r\n tangent = (tangentValue as Vector3).asArray();\r\n if (convertToRightHandedSystem) {\r\n if (animationChannelTargetPath === AnimationChannelTargetPath.TRANSLATION) {\r\n _GLTFUtilities._GetRightHandedPositionArray3FromRef(tangent);\r\n if (!babylonTransformNode.parent) {\r\n tangent[0] *= -1; // x\r\n tangent[2] *= -1; // z\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n tangent = [0, 0, 0];\r\n }\r\n }\r\n\r\n outputs.push(tangent);\r\n }\r\n }\r\n\r\n /**\r\n * Get the minimum and maximum key frames' frame values\r\n * @param keyFrames animation key frames\r\n * @returns the minimum and maximum key frame value\r\n */\r\n private static calculateMinMaxKeyFrames(keyFrames: IAnimationKey[]): { min: number, max: number } {\r\n let min: number = Infinity;\r\n let max: number = -Infinity;\r\n keyFrames.forEach(function (keyFrame) {\r\n min = Math.min(min, keyFrame.frame);\r\n max = Math.max(max, keyFrame.frame);\r\n });\r\n\r\n return { min: min, max: max };\r\n\r\n }\r\n}"]}
1
+ {"version":3,"file":"glTFAnimation.js","sourceRoot":"","sources":["../../../../sourceES6/serializers/src/glTF/2.0/glTFAnimation.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACnD,OAA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ChannelTargetPath, AccessorType, IAnimation, INode, IBufferView, IAccessor, IAnimationSampler, IAnimationChannel, AccessorComponentType } from \"babylonjs-gltf2interface\";\r\nimport { Node } from \"@babylonjs/core/node\";\r\nimport { Nullable } from \"@babylonjs/core/types\";\r\nimport { Vector3, Quaternion } from \"@babylonjs/core/Maths/math.vector\";\r\nimport { Tools } from \"@babylonjs/core/Misc/tools\";\r\nimport { Animation } from \"@babylonjs/core/Animations/animation\";\r\nimport { TransformNode } from \"@babylonjs/core/Meshes/transformNode\";\r\nimport { Scene } from \"@babylonjs/core/scene\";\r\nimport { MorphTarget } from \"@babylonjs/core/Morph/morphTarget\";\r\nimport { Mesh } from \"@babylonjs/core/Meshes/mesh\";\r\n\r\nimport { _BinaryWriter } from \"./glTFExporter\";\r\nimport { _GLTFUtilities } from \"./glTFUtilities\";\r\nimport { IAnimationKey, AnimationKeyInterpolation } from '@babylonjs/core/Animations/animationKey';\r\n\r\n/**\r\n * @hidden\r\n * Interface to store animation data.\r\n */\r\nexport interface _IAnimationData {\r\n /**\r\n * Keyframe data.\r\n */\r\n inputs: number[];\r\n /**\r\n * Value data.\r\n */\r\n outputs: number[][];\r\n /**\r\n * Animation interpolation data.\r\n */\r\n samplerInterpolation: AnimationSamplerInterpolation;\r\n /**\r\n * Minimum keyframe value.\r\n */\r\n inputsMin: number;\r\n /**\r\n * Maximum keyframe value.\r\n */\r\n inputsMax: number;\r\n}\r\n\r\n/**\r\n * @hidden\r\n */\r\nexport interface _IAnimationInfo {\r\n /**\r\n * The target channel for the animation\r\n */\r\n animationChannelTargetPath: AnimationChannelTargetPath;\r\n /**\r\n * The glTF accessor type for the data.\r\n */\r\n dataAccessorType: AccessorType.VEC3 | AccessorType.VEC4 | AccessorType.SCALAR;\r\n /**\r\n * Specifies if quaternions should be used.\r\n */\r\n useQuaternion: boolean;\r\n}\r\n\r\n/**\r\n * @hidden\r\n * Enum for handling in tangent and out tangent.\r\n */\r\nenum _TangentType {\r\n /**\r\n * Specifies that input tangents are used.\r\n */\r\n INTANGENT,\r\n /**\r\n * Specifies that output tangents are used.\r\n */\r\n OUTTANGENT\r\n}\r\n/**\r\n * @hidden\r\n * Utility class for generating glTF animation data from BabylonJS.\r\n */\r\nexport class _GLTFAnimation {\r\n /**\r\n * @ignore\r\n *\r\n * Creates glTF channel animation from BabylonJS animation.\r\n * @param babylonTransformNode - BabylonJS mesh.\r\n * @param animation - animation.\r\n * @param animationChannelTargetPath - The target animation channel.\r\n * @param convertToRightHandedSystem - Specifies if the values should be converted to right-handed.\r\n * @param useQuaternion - Specifies if quaternions are used.\r\n * @returns nullable IAnimationData\r\n */\r\n public static _CreateNodeAnimation(babylonTransformNode: TransformNode, animation: Animation, animationChannelTargetPath: AnimationChannelTargetPath, convertToRightHandedSystem: boolean, useQuaternion: boolean, animationSampleRate: number): Nullable<_IAnimationData> {\r\n const inputs: number[] = [];\r\n const outputs: number[][] = [];\r\n const keyFrames = animation.getKeys();\r\n const minMaxKeyFrames = _GLTFAnimation.calculateMinMaxKeyFrames(keyFrames);\r\n const interpolationOrBake = _GLTFAnimation._DeduceInterpolation(keyFrames, animationChannelTargetPath, useQuaternion);\r\n const frameDelta = minMaxKeyFrames.max - minMaxKeyFrames.min;\r\n\r\n const interpolation = interpolationOrBake.interpolationType;\r\n const shouldBakeAnimation = interpolationOrBake.shouldBakeAnimation;\r\n\r\n if (shouldBakeAnimation) {\r\n _GLTFAnimation._CreateBakedAnimation(babylonTransformNode, animation, animationChannelTargetPath, minMaxKeyFrames.min, minMaxKeyFrames.max, animation.framePerSecond, animationSampleRate, inputs, outputs, minMaxKeyFrames, convertToRightHandedSystem, useQuaternion);\r\n }\r\n else {\r\n if (interpolation === AnimationSamplerInterpolation.LINEAR || interpolation === AnimationSamplerInterpolation.STEP) {\r\n _GLTFAnimation._CreateLinearOrStepAnimation(babylonTransformNode, animation, animationChannelTargetPath, frameDelta, inputs, outputs, convertToRightHandedSystem, useQuaternion);\r\n\r\n }\r\n else if (interpolation === AnimationSamplerInterpolation.CUBICSPLINE) {\r\n _GLTFAnimation._CreateCubicSplineAnimation(babylonTransformNode, animation, animationChannelTargetPath, frameDelta, inputs, outputs, convertToRightHandedSystem, useQuaternion);\r\n }\r\n else {\r\n _GLTFAnimation._CreateBakedAnimation(babylonTransformNode, animation, animationChannelTargetPath, minMaxKeyFrames.min, minMaxKeyFrames.max, animation.framePerSecond, animationSampleRate, inputs, outputs, minMaxKeyFrames, convertToRightHandedSystem, useQuaternion);\r\n }\r\n }\r\n\r\n if (inputs.length && outputs.length) {\r\n const result: _IAnimationData = {\r\n inputs: inputs,\r\n outputs: outputs,\r\n samplerInterpolation: interpolation,\r\n inputsMin: shouldBakeAnimation ? minMaxKeyFrames.min : Tools.FloatRound(minMaxKeyFrames.min / animation.framePerSecond),\r\n inputsMax: shouldBakeAnimation ? minMaxKeyFrames.max : Tools.FloatRound(minMaxKeyFrames.max / animation.framePerSecond)\r\n };\r\n\r\n return result;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n private static _DeduceAnimationInfo(animation: Animation): Nullable<_IAnimationInfo> {\r\n let animationChannelTargetPath: Nullable<AnimationChannelTargetPath> = null;\r\n let dataAccessorType = AccessorType.VEC3;\r\n let useQuaternion: boolean = false;\r\n let property = animation.targetProperty.split('.');\r\n switch (property[0]) {\r\n case 'scaling': {\r\n animationChannelTargetPath = AnimationChannelTargetPath.SCALE;\r\n break;\r\n }\r\n case 'position': {\r\n animationChannelTargetPath = AnimationChannelTargetPath.TRANSLATION;\r\n break;\r\n }\r\n case 'rotation': {\r\n dataAccessorType = AccessorType.VEC4;\r\n animationChannelTargetPath = AnimationChannelTargetPath.ROTATION;\r\n break;\r\n }\r\n case 'rotationQuaternion': {\r\n dataAccessorType = AccessorType.VEC4;\r\n useQuaternion = true;\r\n animationChannelTargetPath = AnimationChannelTargetPath.ROTATION;\r\n break;\r\n }\r\n case 'influence': {\r\n dataAccessorType = AccessorType.SCALAR;\r\n animationChannelTargetPath = AnimationChannelTargetPath.WEIGHTS;\r\n break;\r\n }\r\n default: {\r\n Tools.Error(`Unsupported animatable property ${property[0]}`);\r\n }\r\n }\r\n if (animationChannelTargetPath) {\r\n return { animationChannelTargetPath: animationChannelTargetPath, dataAccessorType: dataAccessorType, useQuaternion: useQuaternion };\r\n }\r\n else {\r\n Tools.Error('animation channel target path and data accessor type could be deduced');\r\n }\r\n return null;\r\n }\r\n\r\n /**\r\n * @ignore\r\n * Create node animations from the transform node animations\r\n * @param babylonNode\r\n * @param runtimeGLTFAnimation\r\n * @param idleGLTFAnimations\r\n * @param nodeMap\r\n * @param nodes\r\n * @param binaryWriter\r\n * @param bufferViews\r\n * @param accessors\r\n * @param convertToRightHandedSystem\r\n * @param animationSampleRate\r\n */\r\n public static _CreateNodeAnimationFromNodeAnimations(babylonNode: Node, runtimeGLTFAnimation: IAnimation, idleGLTFAnimations: IAnimation[], nodeMap: { [key: number]: number }, nodes: INode[], binaryWriter: _BinaryWriter, bufferViews: IBufferView[], accessors: IAccessor[], convertToRightHandedSystem: boolean, animationSampleRate: number) {\r\n let glTFAnimation: IAnimation;\r\n if (babylonNode instanceof TransformNode) {\r\n if (babylonNode.animations) {\r\n for (let animation of babylonNode.animations) {\r\n let animationInfo = _GLTFAnimation._DeduceAnimationInfo(animation);\r\n if (animationInfo) {\r\n glTFAnimation = {\r\n name: animation.name,\r\n samplers: [],\r\n channels: []\r\n };\r\n _GLTFAnimation.AddAnimation(`${animation.name}`,\r\n animation.hasRunningRuntimeAnimations ? runtimeGLTFAnimation : glTFAnimation,\r\n babylonNode,\r\n animation,\r\n animationInfo.dataAccessorType,\r\n animationInfo.animationChannelTargetPath,\r\n nodeMap,\r\n binaryWriter,\r\n bufferViews,\r\n accessors,\r\n convertToRightHandedSystem,\r\n animationInfo.useQuaternion,\r\n animationSampleRate\r\n );\r\n if (glTFAnimation.samplers.length && glTFAnimation.channels.length) {\r\n idleGLTFAnimations.push(glTFAnimation);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @ignore\r\n * Create individual morph animations from the mesh's morph target animation tracks\r\n * @param babylonNode\r\n * @param runtimeGLTFAnimation\r\n * @param idleGLTFAnimations\r\n * @param nodeMap\r\n * @param nodes\r\n * @param binaryWriter\r\n * @param bufferViews\r\n * @param accessors\r\n * @param convertToRightHandedSystem\r\n * @param animationSampleRate\r\n */\r\n public static _CreateMorphTargetAnimationFromMorphTargetAnimations(babylonNode: Node, runtimeGLTFAnimation: IAnimation, idleGLTFAnimations: IAnimation[], nodeMap: { [key: number]: number }, nodes: INode[], binaryWriter: _BinaryWriter, bufferViews: IBufferView[], accessors: IAccessor[], convertToRightHandedSystem: boolean, animationSampleRate: number) {\r\n let glTFAnimation: IAnimation;\r\n if (babylonNode instanceof Mesh) {\r\n const morphTargetManager = babylonNode.morphTargetManager;\r\n if (morphTargetManager) {\r\n for (let i = 0; i < morphTargetManager.numTargets; ++i) {\r\n const morphTarget = morphTargetManager.getTarget(i);\r\n for (const animation of morphTarget.animations) {\r\n const combinedAnimation = new Animation(`${animation.name}`,\r\n \"influence\",\r\n animation.framePerSecond,\r\n animation.dataType,\r\n animation.loopMode,\r\n animation.enableBlending);\r\n const combinedAnimationKeys: IAnimationKey[] = [];\r\n const animationKeys = animation.getKeys();\r\n\r\n for (let j = 0; j < animationKeys.length; ++j) {\r\n let animationKey = animationKeys[j];\r\n for (let k = 0; k < morphTargetManager.numTargets; ++k) {\r\n if (k == i) {\r\n combinedAnimationKeys.push(animationKey);\r\n } else {\r\n combinedAnimationKeys.push({ frame: animationKey.frame, value: 0 });\r\n }\r\n }\r\n }\r\n combinedAnimation.setKeys(combinedAnimationKeys);\r\n const animationInfo = _GLTFAnimation._DeduceAnimationInfo(combinedAnimation);\r\n if (animationInfo) {\r\n glTFAnimation = {\r\n name: combinedAnimation.name,\r\n samplers: [],\r\n channels: []\r\n };\r\n _GLTFAnimation.AddAnimation(animation.name,\r\n animation.hasRunningRuntimeAnimations ? runtimeGLTFAnimation : glTFAnimation,\r\n babylonNode,\r\n combinedAnimation,\r\n animationInfo.dataAccessorType,\r\n animationInfo.animationChannelTargetPath,\r\n nodeMap,\r\n binaryWriter,\r\n bufferViews,\r\n accessors,\r\n convertToRightHandedSystem,\r\n animationInfo.useQuaternion,\r\n animationSampleRate,\r\n morphTargetManager.numTargets\r\n );\r\n if (glTFAnimation.samplers.length && glTFAnimation.channels.length) {\r\n idleGLTFAnimations.push(glTFAnimation);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @ignore\r\n * Create node and morph animations from the animation groups\r\n * @param babylonScene\r\n * @param glTFAnimations\r\n * @param nodeMap\r\n * @param nodes\r\n * @param binaryWriter\r\n * @param bufferViews\r\n * @param accessors\r\n * @param convertToRightHandedSystemMap\r\n * @param animationSampleRate\r\n */\r\n public static _CreateNodeAndMorphAnimationFromAnimationGroups(babylonScene: Scene, glTFAnimations: IAnimation[], nodeMap: { [key: number]: number }, nodes: INode[], binaryWriter: _BinaryWriter, bufferViews: IBufferView[], accessors: IAccessor[], convertToRightHandedSystemMap: { [nodeId: number]: boolean }, animationSampleRate: number) {\r\n let glTFAnimation: IAnimation;\r\n if (babylonScene.animationGroups) {\r\n const animationGroups = babylonScene.animationGroups;\r\n for (let animationGroup of animationGroups) {\r\n const morphAnimations: Map<Mesh, Map<MorphTarget, Animation>> = new Map();\r\n const sampleAnimations: Map<Mesh, Animation> = new Map();\r\n const morphAnimationMeshes: Set<Mesh> = new Set();\r\n const animationGroupFrameDiff = animationGroup.to - animationGroup.from;\r\n glTFAnimation = {\r\n name: animationGroup.name,\r\n channels: [],\r\n samplers: []\r\n };\r\n for (let i = 0; i < animationGroup.targetedAnimations.length; ++i) {\r\n const targetAnimation = animationGroup.targetedAnimations[i];\r\n const target = targetAnimation.target;\r\n const animation = targetAnimation.animation;\r\n if (target instanceof TransformNode || target.length === 1 && target[0] instanceof TransformNode) {\r\n const animationInfo = _GLTFAnimation._DeduceAnimationInfo(targetAnimation.animation);\r\n if (animationInfo) {\r\n const babylonTransformNode = target instanceof TransformNode ? target as TransformNode : target[0] as TransformNode;\r\n const convertToRightHandedSystem = convertToRightHandedSystemMap[babylonTransformNode.uniqueId];\r\n _GLTFAnimation.AddAnimation(`${animation.name}`,\r\n glTFAnimation,\r\n babylonTransformNode,\r\n animation,\r\n animationInfo.dataAccessorType,\r\n animationInfo.animationChannelTargetPath,\r\n nodeMap,\r\n binaryWriter,\r\n bufferViews,\r\n accessors,\r\n convertToRightHandedSystem,\r\n animationInfo.useQuaternion,\r\n animationSampleRate\r\n );\r\n }\r\n } else if (target instanceof MorphTarget || target.length === 1 && target[0] instanceof MorphTarget) {\r\n const animationInfo = _GLTFAnimation._DeduceAnimationInfo(targetAnimation.animation);\r\n if (animationInfo) {\r\n const babylonMorphTarget = target instanceof MorphTarget ? target as MorphTarget : target[0] as MorphTarget;\r\n if (babylonMorphTarget) {\r\n const babylonMorphTargetManager = babylonScene.morphTargetManagers.find((morphTargetManager) => {\r\n for (let j = 0; j < morphTargetManager.numTargets; ++j) {\r\n if (morphTargetManager.getTarget(j) === babylonMorphTarget) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n });\r\n if (babylonMorphTargetManager) {\r\n const babylonMesh = babylonScene.meshes.find((mesh) => {\r\n return (mesh as Mesh).morphTargetManager === babylonMorphTargetManager;\r\n }) as Mesh;\r\n if (babylonMesh) {\r\n if (!morphAnimations.has(babylonMesh)) {\r\n morphAnimations.set(babylonMesh, new Map());\r\n }\r\n morphAnimations.get(babylonMesh)?.set(babylonMorphTarget, animation);\r\n morphAnimationMeshes.add(babylonMesh);\r\n sampleAnimations.set(babylonMesh, animation);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n morphAnimationMeshes.forEach((mesh) => {\r\n const morphTargetManager = mesh.morphTargetManager!;\r\n let combinedAnimationGroup: Nullable<Animation> = null;\r\n const animationKeys: IAnimationKey[] = [];\r\n const sampleAnimation = sampleAnimations.get(mesh)!;\r\n const sampleAnimationKeys = sampleAnimation.getKeys();\r\n const numAnimationKeys = sampleAnimationKeys.length;\r\n /*\r\n Due to how glTF expects morph target animation data to be formatted, we need to rearrange the individual morph target animation tracks,\r\n such that we have a single animation, where a given keyframe input value has successive output values for each morph target belonging to the manager.\r\n See: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#animations\r\n\r\n We do this via constructing a new Animation track, and interleaving the frames of each morph target animation track in the current Animation Group\r\n We reuse the Babylon Animation data structure for ease of handling export of cubic spline animation keys, and to reuse the\r\n existing _GLTFAnimation.AddAnimation codepath with minimal modification, however the constructed Babylon Animation is NOT intended for use in-engine.\r\n */\r\n for (let i = 0; i < numAnimationKeys; ++i) {\r\n for (let j = 0; j < morphTargetManager.numTargets; ++j) {\r\n const morphTarget = morphTargetManager.getTarget(j);\r\n const animationsByMorphTarget = morphAnimations.get(mesh);\r\n if (animationsByMorphTarget) {\r\n const morphTargetAnimation = animationsByMorphTarget.get(morphTarget);\r\n if (morphTargetAnimation) {\r\n if (!combinedAnimationGroup) {\r\n combinedAnimationGroup = new Animation(`${animationGroup.name}_${mesh.name}_MorphWeightAnimation`,\r\n \"influence\",\r\n morphTargetAnimation.framePerSecond,\r\n Animation.ANIMATIONTYPE_FLOAT,\r\n morphTargetAnimation.loopMode,\r\n morphTargetAnimation.enableBlending);\r\n }\r\n animationKeys.push(morphTargetAnimation.getKeys()[i]);\r\n }\r\n else {\r\n animationKeys.push({\r\n frame: animationGroup.from + (animationGroupFrameDiff / numAnimationKeys) * i,\r\n value: morphTarget.influence,\r\n inTangent: sampleAnimationKeys[0].inTangent ? 0 : undefined,\r\n outTangent: sampleAnimationKeys[0].outTangent ? 0 : undefined\r\n });\r\n }\r\n }\r\n }\r\n }\r\n combinedAnimationGroup!.setKeys(animationKeys);\r\n const animationInfo = _GLTFAnimation._DeduceAnimationInfo(combinedAnimationGroup!);\r\n if (animationInfo) {\r\n _GLTFAnimation.AddAnimation(`${animationGroup.name}_${mesh.name}_MorphWeightAnimation`,\r\n glTFAnimation,\r\n mesh,\r\n combinedAnimationGroup!,\r\n animationInfo.dataAccessorType,\r\n animationInfo.animationChannelTargetPath,\r\n nodeMap,\r\n binaryWriter,\r\n bufferViews,\r\n accessors,\r\n false,\r\n animationInfo.useQuaternion,\r\n animationSampleRate,\r\n morphTargetManager?.numTargets\r\n );\r\n }\r\n });\r\n if (glTFAnimation.channels.length && glTFAnimation.samplers.length) {\r\n glTFAnimations.push(glTFAnimation);\r\n }\r\n }\r\n }\r\n }\r\n\r\n private static AddAnimation(name: string, glTFAnimation: IAnimation, babylonTransformNode: TransformNode, animation: Animation, dataAccessorType: AccessorType, animationChannelTargetPath: AnimationChannelTargetPath, nodeMap: { [key: number]: number }, binaryWriter: _BinaryWriter, bufferViews: IBufferView[], accessors: IAccessor[], convertToRightHandedSystem: boolean, useQuaternion: boolean, animationSampleRate: number, morphAnimationChannels?: number) {\r\n const animationData = _GLTFAnimation._CreateNodeAnimation(babylonTransformNode, animation, animationChannelTargetPath, convertToRightHandedSystem, useQuaternion, animationSampleRate);\r\n let bufferView: IBufferView;\r\n let accessor: IAccessor;\r\n let keyframeAccessorIndex: number;\r\n let dataAccessorIndex: number;\r\n let outputLength: number;\r\n let animationSampler: IAnimationSampler;\r\n let animationChannel: IAnimationChannel;\r\n\r\n if (animationData) {\r\n\r\n /*\r\n * Now that we have the glTF converted morph target animation data,\r\n * we can remove redundant input data so that we have n input frames,\r\n * and morphAnimationChannels * n output frames\r\n */\r\n if (morphAnimationChannels) {\r\n let index = 0;\r\n let currentInput: number = 0;\r\n let newInputs: number[] = [];\r\n while (animationData.inputs.length > 0) {\r\n currentInput = animationData.inputs.shift()!;\r\n if (index % morphAnimationChannels == 0) {\r\n newInputs.push(currentInput);\r\n }\r\n index++;\r\n }\r\n animationData.inputs = newInputs;\r\n }\r\n\r\n let nodeIndex = nodeMap[babylonTransformNode.uniqueId];\r\n\r\n // Creates buffer view and accessor for key frames.\r\n let byteLength = animationData.inputs.length * 4;\r\n bufferView = _GLTFUtilities._CreateBufferView(0, binaryWriter.getByteOffset(), byteLength, undefined, `${name} keyframe data view`);\r\n bufferViews.push(bufferView);\r\n animationData.inputs.forEach(function (input) {\r\n binaryWriter.setFloat32(input);\r\n });\r\n\r\n accessor = _GLTFUtilities._CreateAccessor(bufferViews.length - 1, `${name} keyframes`, AccessorType.SCALAR, AccessorComponentType.FLOAT, animationData.inputs.length, null, [animationData.inputsMin], [animationData.inputsMax]);\r\n accessors.push(accessor);\r\n keyframeAccessorIndex = accessors.length - 1;\r\n\r\n // create bufferview and accessor for keyed values.\r\n outputLength = animationData.outputs.length;\r\n byteLength = _GLTFUtilities._GetDataAccessorElementCount(dataAccessorType) * 4 * animationData.outputs.length;\r\n\r\n // check for in and out tangents\r\n bufferView = _GLTFUtilities._CreateBufferView(0, binaryWriter.getByteOffset(), byteLength, undefined, `${name} data view`);\r\n bufferViews.push(bufferView);\r\n\r\n animationData.outputs.forEach(function (output) {\r\n output.forEach(function (entry) {\r\n binaryWriter.setFloat32(entry);\r\n });\r\n });\r\n\r\n accessor = _GLTFUtilities._CreateAccessor(bufferViews.length - 1, `${name} data`, dataAccessorType, AccessorComponentType.FLOAT, outputLength, null, null, null);\r\n accessors.push(accessor);\r\n dataAccessorIndex = accessors.length - 1;\r\n\r\n // create sampler\r\n animationSampler = {\r\n interpolation: animationData.samplerInterpolation,\r\n input: keyframeAccessorIndex,\r\n output: dataAccessorIndex\r\n };\r\n glTFAnimation.samplers.push(animationSampler);\r\n\r\n // create channel\r\n animationChannel = {\r\n sampler: glTFAnimation.samplers.length - 1,\r\n target: {\r\n node: nodeIndex,\r\n path: animationChannelTargetPath\r\n }\r\n };\r\n glTFAnimation.channels.push(animationChannel);\r\n }\r\n }\r\n\r\n /**\r\n * Create a baked animation\r\n * @param babylonTransformNode BabylonJS mesh\r\n * @param animation BabylonJS animation corresponding to the BabylonJS mesh\r\n * @param animationChannelTargetPath animation target channel\r\n * @param minFrame minimum animation frame\r\n * @param maxFrame maximum animation frame\r\n * @param fps frames per second of the animation\r\n * @param inputs input key frames of the animation\r\n * @param outputs output key frame data of the animation\r\n * @param convertToRightHandedSystem converts the values to right-handed\r\n * @param useQuaternion specifies if quaternions should be used\r\n */\r\n private static _CreateBakedAnimation(babylonTransformNode: TransformNode, animation: Animation, animationChannelTargetPath: AnimationChannelTargetPath, minFrame: number, maxFrame: number, fps: number, sampleRate: number, inputs: number[], outputs: number[][], minMaxFrames: { min: number, max: number }, convertToRightHandedSystem: boolean, useQuaternion: boolean) {\r\n let value: number | Vector3 | Quaternion;\r\n let quaternionCache: Quaternion = Quaternion.Identity();\r\n let previousTime: Nullable<number> = null;\r\n let time: number;\r\n let maxUsedFrame: Nullable<number> = null;\r\n let currKeyFrame: Nullable<IAnimationKey> = null;\r\n let nextKeyFrame: Nullable<IAnimationKey> = null;\r\n let prevKeyFrame: Nullable<IAnimationKey> = null;\r\n let endFrame: Nullable<number> = null;\r\n minMaxFrames.min = Tools.FloatRound(minFrame / fps);\r\n\r\n let keyFrames = animation.getKeys();\r\n\r\n for (let i = 0, length = keyFrames.length; i < length; ++i) {\r\n endFrame = null;\r\n currKeyFrame = keyFrames[i];\r\n\r\n if (i + 1 < length) {\r\n nextKeyFrame = keyFrames[i + 1];\r\n if (currKeyFrame.value.equals && currKeyFrame.value.equals(nextKeyFrame.value) || currKeyFrame.value === nextKeyFrame.value) {\r\n if (i === 0) { // set the first frame to itself\r\n endFrame = currKeyFrame.frame;\r\n }\r\n else {\r\n continue;\r\n }\r\n }\r\n else {\r\n endFrame = nextKeyFrame.frame;\r\n }\r\n }\r\n else {\r\n // at the last key frame\r\n prevKeyFrame = keyFrames[i - 1];\r\n if (currKeyFrame.value.equals && currKeyFrame.value.equals(prevKeyFrame.value) || currKeyFrame.value === prevKeyFrame.value) {\r\n continue;\r\n }\r\n else {\r\n endFrame = maxFrame;\r\n }\r\n }\r\n if (endFrame) {\r\n for (let f = currKeyFrame.frame; f <= endFrame; f += sampleRate) {\r\n time = Tools.FloatRound(f / fps);\r\n if (time === previousTime) {\r\n continue;\r\n }\r\n previousTime = time;\r\n maxUsedFrame = time;\r\n let state = {\r\n key: 0,\r\n repeatCount: 0,\r\n loopMode: animation.loopMode\r\n };\r\n value = animation._interpolate(f, state);\r\n\r\n _GLTFAnimation._SetInterpolatedValue(babylonTransformNode, value, time, animation, animationChannelTargetPath, quaternionCache, inputs, outputs, convertToRightHandedSystem, useQuaternion);\r\n }\r\n }\r\n }\r\n if (maxUsedFrame) {\r\n minMaxFrames.max = maxUsedFrame;\r\n }\r\n }\r\n\r\n private static _ConvertFactorToVector3OrQuaternion(factor: number, babylonTransformNode: TransformNode, animation: Animation, animationType: number, animationChannelTargetPath: AnimationChannelTargetPath, convertToRightHandedSystem: boolean, useQuaternion: boolean): Nullable<Vector3 | Quaternion> {\r\n let property: string[];\r\n let componentName: string;\r\n let value: Nullable<Quaternion | Vector3> = null;\r\n const basePositionRotationOrScale = _GLTFAnimation._GetBasePositionRotationOrScale(babylonTransformNode, animationChannelTargetPath, convertToRightHandedSystem, useQuaternion);\r\n if (animationType === Animation.ANIMATIONTYPE_FLOAT) { // handles single component x, y, z or w component animation by using a base property and animating over a component.\r\n property = animation.targetProperty.split('.');\r\n componentName = property ? property[1] : ''; // x, y, or z component\r\n value = useQuaternion ? Quaternion.FromArray(basePositionRotationOrScale).normalize() : Vector3.FromArray(basePositionRotationOrScale);\r\n\r\n switch (componentName) {\r\n case 'x': {\r\n value[componentName] = (convertToRightHandedSystem && useQuaternion && (animationChannelTargetPath !== AnimationChannelTargetPath.SCALE)) ? -factor : factor;\r\n break;\r\n }\r\n case 'y': {\r\n value[componentName] = (convertToRightHandedSystem && useQuaternion && (animationChannelTargetPath !== AnimationChannelTargetPath.SCALE)) ? -factor : factor;\r\n break;\r\n }\r\n case 'z': {\r\n value[componentName] = (convertToRightHandedSystem && !useQuaternion && (animationChannelTargetPath !== AnimationChannelTargetPath.SCALE)) ? -factor : factor;\r\n break;\r\n }\r\n case 'w': {\r\n (value as Quaternion).w = factor;\r\n break;\r\n }\r\n default: {\r\n Tools.Error(`glTFAnimation: Unsupported component type \"${componentName}\" for scale animation!`);\r\n }\r\n }\r\n }\r\n\r\n return value;\r\n }\r\n\r\n private static _SetInterpolatedValue(babylonTransformNode: TransformNode, value: Nullable<number | Vector3 | Quaternion>, time: number, animation: Animation, animationChannelTargetPath: AnimationChannelTargetPath, quaternionCache: Quaternion, inputs: number[], outputs: number[][], convertToRightHandedSystem: boolean, useQuaternion: boolean) {\r\n const animationType = animation.dataType;\r\n let cacheValue: Vector3 | Quaternion | number;\r\n inputs.push(time);\r\n if (typeof value === \"number\" && babylonTransformNode instanceof TransformNode) {\r\n value = this._ConvertFactorToVector3OrQuaternion(value as number, babylonTransformNode, animation, animationType, animationChannelTargetPath, convertToRightHandedSystem, useQuaternion);\r\n }\r\n if (value) {\r\n if (animationChannelTargetPath === AnimationChannelTargetPath.ROTATION) {\r\n if (useQuaternion) {\r\n quaternionCache = value as Quaternion;\r\n }\r\n else {\r\n cacheValue = value as Vector3;\r\n Quaternion.RotationYawPitchRollToRef(cacheValue.y, cacheValue.x, cacheValue.z, quaternionCache);\r\n }\r\n if (convertToRightHandedSystem) {\r\n _GLTFUtilities._GetRightHandedQuaternionFromRef(quaternionCache);\r\n\r\n if (!babylonTransformNode.parent) {\r\n quaternionCache = Quaternion.FromArray([0, 1, 0, 0]).multiply(quaternionCache);\r\n }\r\n }\r\n outputs.push(quaternionCache.asArray());\r\n }\r\n else if (animationChannelTargetPath === AnimationChannelTargetPath.WEIGHTS) {\r\n outputs.push([value as number]);\r\n }\r\n else { // scaling and position animation\r\n cacheValue = value as Vector3;\r\n if (convertToRightHandedSystem && (animationChannelTargetPath !== AnimationChannelTargetPath.SCALE)) {\r\n _GLTFUtilities._GetRightHandedPositionVector3FromRef(cacheValue);\r\n if (!babylonTransformNode.parent) {\r\n cacheValue.x *= -1;\r\n cacheValue.z *= -1;\r\n }\r\n }\r\n\r\n outputs.push(cacheValue.asArray());\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Creates linear animation from the animation key frames\r\n * @param babylonTransformNode BabylonJS mesh\r\n * @param animation BabylonJS animation\r\n * @param animationChannelTargetPath The target animation channel\r\n * @param frameDelta The difference between the last and first frame of the animation\r\n * @param inputs Array to store the key frame times\r\n * @param outputs Array to store the key frame data\r\n * @param convertToRightHandedSystem Specifies if the position data should be converted to right handed\r\n * @param useQuaternion Specifies if quaternions are used in the animation\r\n */\r\n private static _CreateLinearOrStepAnimation(babylonTransformNode: TransformNode, animation: Animation, animationChannelTargetPath: AnimationChannelTargetPath, frameDelta: number, inputs: number[], outputs: number[][], convertToRightHandedSystem: boolean, useQuaternion: boolean) {\r\n for (let keyFrame of animation.getKeys()) {\r\n inputs.push(keyFrame.frame / animation.framePerSecond); // keyframes in seconds.\r\n _GLTFAnimation._AddKeyframeValue(keyFrame, animation, outputs, animationChannelTargetPath, babylonTransformNode, convertToRightHandedSystem, useQuaternion);\r\n }\r\n }\r\n\r\n /**\r\n * Creates cubic spline animation from the animation key frames\r\n * @param babylonTransformNode BabylonJS mesh\r\n * @param animation BabylonJS animation\r\n * @param animationChannelTargetPath The target animation channel\r\n * @param frameDelta The difference between the last and first frame of the animation\r\n * @param inputs Array to store the key frame times\r\n * @param outputs Array to store the key frame data\r\n * @param convertToRightHandedSystem Specifies if the position data should be converted to right handed\r\n * @param useQuaternion Specifies if quaternions are used in the animation\r\n */\r\n private static _CreateCubicSplineAnimation(babylonTransformNode: TransformNode, animation: Animation, animationChannelTargetPath: AnimationChannelTargetPath, frameDelta: number, inputs: number[], outputs: number[][], convertToRightHandedSystem: boolean, useQuaternion: boolean) {\r\n animation.getKeys().forEach(function (keyFrame) {\r\n inputs.push(keyFrame.frame / animation.framePerSecond); // keyframes in seconds.\r\n _GLTFAnimation.AddSplineTangent(\r\n babylonTransformNode,\r\n _TangentType.INTANGENT,\r\n outputs,\r\n animationChannelTargetPath,\r\n AnimationSamplerInterpolation.CUBICSPLINE,\r\n keyFrame,\r\n frameDelta,\r\n useQuaternion,\r\n convertToRightHandedSystem\r\n );\r\n _GLTFAnimation._AddKeyframeValue(keyFrame, animation, outputs, animationChannelTargetPath, babylonTransformNode, convertToRightHandedSystem, useQuaternion);\r\n\r\n _GLTFAnimation.AddSplineTangent(\r\n babylonTransformNode,\r\n _TangentType.OUTTANGENT,\r\n outputs,\r\n animationChannelTargetPath,\r\n AnimationSamplerInterpolation.CUBICSPLINE,\r\n keyFrame,\r\n frameDelta,\r\n useQuaternion,\r\n convertToRightHandedSystem\r\n );\r\n });\r\n }\r\n\r\n private static _GetBasePositionRotationOrScale(babylonTransformNode: TransformNode, animationChannelTargetPath: AnimationChannelTargetPath, convertToRightHandedSystem: boolean, useQuaternion: boolean) {\r\n let basePositionRotationOrScale: number[];\r\n if (animationChannelTargetPath === AnimationChannelTargetPath.ROTATION) {\r\n if (useQuaternion) {\r\n if (babylonTransformNode.rotationQuaternion) {\r\n basePositionRotationOrScale = babylonTransformNode.rotationQuaternion.asArray();\r\n if (convertToRightHandedSystem) {\r\n _GLTFUtilities._GetRightHandedQuaternionArrayFromRef(basePositionRotationOrScale);\r\n if (!babylonTransformNode.parent) {\r\n basePositionRotationOrScale = Quaternion.FromArray([0, 1, 0, 0]).multiply(Quaternion.FromArray(basePositionRotationOrScale)).asArray();\r\n }\r\n }\r\n }\r\n else {\r\n basePositionRotationOrScale = Quaternion.Identity().asArray();\r\n }\r\n }\r\n else {\r\n basePositionRotationOrScale = babylonTransformNode.rotation.asArray();\r\n _GLTFUtilities._GetRightHandedNormalArray3FromRef(basePositionRotationOrScale);\r\n }\r\n }\r\n else if (animationChannelTargetPath === AnimationChannelTargetPath.TRANSLATION) {\r\n basePositionRotationOrScale = babylonTransformNode.position.asArray();\r\n if (convertToRightHandedSystem) {\r\n _GLTFUtilities._GetRightHandedPositionArray3FromRef(basePositionRotationOrScale);\r\n }\r\n }\r\n else { // scale\r\n basePositionRotationOrScale = babylonTransformNode.scaling.asArray();\r\n }\r\n return basePositionRotationOrScale;\r\n }\r\n\r\n /**\r\n * Adds a key frame value\r\n * @param keyFrame\r\n * @param animation\r\n * @param outputs\r\n * @param animationChannelTargetPath\r\n * @param basePositionRotationOrScale\r\n * @param convertToRightHandedSystem\r\n * @param useQuaternion\r\n */\r\n private static _AddKeyframeValue(keyFrame: IAnimationKey, animation: Animation, outputs: number[][], animationChannelTargetPath: AnimationChannelTargetPath, babylonTransformNode: TransformNode, convertToRightHandedSystem: boolean, useQuaternion: boolean) {\r\n let value: number[];\r\n let newPositionRotationOrScale: Nullable<Vector3 | Quaternion | number>;\r\n const animationType = animation.dataType;\r\n if (animationType === Animation.ANIMATIONTYPE_VECTOR3) {\r\n value = keyFrame.value.asArray();\r\n if (animationChannelTargetPath === AnimationChannelTargetPath.ROTATION) {\r\n const array = Vector3.FromArray(value);\r\n let rotationQuaternion = Quaternion.RotationYawPitchRoll(array.y, array.x, array.z);\r\n if (convertToRightHandedSystem) {\r\n _GLTFUtilities._GetRightHandedQuaternionFromRef(rotationQuaternion);\r\n\r\n if (!babylonTransformNode.parent) {\r\n rotationQuaternion = Quaternion.FromArray([0, 1, 0, 0]).multiply(rotationQuaternion);\r\n }\r\n }\r\n value = rotationQuaternion.asArray();\r\n }\r\n else if (animationChannelTargetPath === AnimationChannelTargetPath.TRANSLATION) {\r\n if (convertToRightHandedSystem) {\r\n _GLTFUtilities._GetRightHandedNormalArray3FromRef(value);\r\n if (!babylonTransformNode.parent) {\r\n value[0] *= -1;\r\n value[2] *= -1;\r\n }\r\n }\r\n }\r\n outputs.push(value); // scale vector.\r\n\r\n }\r\n else if (animationType === Animation.ANIMATIONTYPE_FLOAT) {\r\n if (animationChannelTargetPath === AnimationChannelTargetPath.WEIGHTS) {\r\n outputs.push([keyFrame.value]);\r\n } else { // handles single component x, y, z or w component animation by using a base property and animating over a component.\r\n newPositionRotationOrScale = this._ConvertFactorToVector3OrQuaternion(keyFrame.value as number, babylonTransformNode, animation, animationType, animationChannelTargetPath, convertToRightHandedSystem, useQuaternion);\r\n if (newPositionRotationOrScale) {\r\n if (animationChannelTargetPath === AnimationChannelTargetPath.ROTATION) {\r\n let posRotScale = useQuaternion ? newPositionRotationOrScale as Quaternion : Quaternion.RotationYawPitchRoll(newPositionRotationOrScale.y, newPositionRotationOrScale.x, newPositionRotationOrScale.z).normalize();\r\n if (convertToRightHandedSystem) {\r\n _GLTFUtilities._GetRightHandedQuaternionFromRef(posRotScale);\r\n\r\n if (!babylonTransformNode.parent) {\r\n posRotScale = Quaternion.FromArray([0, 1, 0, 0]).multiply(posRotScale);\r\n }\r\n }\r\n outputs.push(posRotScale.asArray());\r\n }\r\n else if (animationChannelTargetPath === AnimationChannelTargetPath.TRANSLATION) {\r\n if (convertToRightHandedSystem) {\r\n _GLTFUtilities._GetRightHandedNormalVector3FromRef(newPositionRotationOrScale as Vector3);\r\n\r\n if (!babylonTransformNode.parent) {\r\n newPositionRotationOrScale.x *= -1;\r\n newPositionRotationOrScale.z *= -1;\r\n }\r\n }\r\n }\r\n outputs.push(newPositionRotationOrScale.asArray());\r\n }\r\n }\r\n }\r\n else if (animationType === Animation.ANIMATIONTYPE_QUATERNION) {\r\n value = (keyFrame.value as Quaternion).normalize().asArray();\r\n\r\n if (convertToRightHandedSystem) {\r\n _GLTFUtilities._GetRightHandedQuaternionArrayFromRef(value);\r\n\r\n if (!babylonTransformNode.parent) {\r\n value = Quaternion.FromArray([0, 1, 0, 0]).multiply(Quaternion.FromArray(value)).asArray();\r\n }\r\n }\r\n\r\n outputs.push(value);\r\n }\r\n else {\r\n Tools.Error('glTFAnimation: Unsupported key frame values for animation!');\r\n }\r\n }\r\n\r\n /**\r\n * Determine the interpolation based on the key frames\r\n * @param keyFrames\r\n * @param animationChannelTargetPath\r\n * @param useQuaternion\r\n */\r\n private static _DeduceInterpolation(keyFrames: IAnimationKey[], animationChannelTargetPath: AnimationChannelTargetPath, useQuaternion: boolean): { interpolationType: AnimationSamplerInterpolation, shouldBakeAnimation: boolean } {\r\n let interpolationType: AnimationSamplerInterpolation | undefined;\r\n let shouldBakeAnimation = false;\r\n let key: IAnimationKey;\r\n\r\n if (animationChannelTargetPath === AnimationChannelTargetPath.ROTATION && !useQuaternion) {\r\n return { interpolationType: AnimationSamplerInterpolation.LINEAR, shouldBakeAnimation: true };\r\n }\r\n\r\n for (let i = 0, length = keyFrames.length; i < length; ++i) {\r\n key = keyFrames[i];\r\n if (key.inTangent || key.outTangent) {\r\n if (interpolationType) {\r\n if (interpolationType !== AnimationSamplerInterpolation.CUBICSPLINE) {\r\n interpolationType = AnimationSamplerInterpolation.LINEAR;\r\n shouldBakeAnimation = true;\r\n break;\r\n }\r\n }\r\n else {\r\n interpolationType = AnimationSamplerInterpolation.CUBICSPLINE;\r\n }\r\n }\r\n else {\r\n if (interpolationType) {\r\n if (interpolationType === AnimationSamplerInterpolation.CUBICSPLINE ||\r\n (key.interpolation && (key.interpolation === AnimationKeyInterpolation.STEP) && interpolationType !== AnimationSamplerInterpolation.STEP)) {\r\n interpolationType = AnimationSamplerInterpolation.LINEAR;\r\n shouldBakeAnimation = true;\r\n break;\r\n }\r\n }\r\n else {\r\n if (key.interpolation && (key.interpolation === AnimationKeyInterpolation.STEP)) {\r\n interpolationType = AnimationSamplerInterpolation.STEP;\r\n }\r\n else {\r\n interpolationType = AnimationSamplerInterpolation.LINEAR;\r\n }\r\n }\r\n }\r\n }\r\n if (!interpolationType) {\r\n interpolationType = AnimationSamplerInterpolation.LINEAR;\r\n }\r\n\r\n return { interpolationType: interpolationType, shouldBakeAnimation: shouldBakeAnimation };\r\n }\r\n\r\n /**\r\n * Adds an input tangent or output tangent to the output data\r\n * If an input tangent or output tangent is missing, it uses the zero vector or zero quaternion\r\n * @param tangentType Specifies which type of tangent to handle (inTangent or outTangent)\r\n * @param outputs The animation data by keyframe\r\n * @param animationChannelTargetPath The target animation channel\r\n * @param interpolation The interpolation type\r\n * @param keyFrame The key frame with the animation data\r\n * @param frameDelta Time difference between two frames used to scale the tangent by the frame delta\r\n * @param useQuaternion Specifies if quaternions are used\r\n * @param convertToRightHandedSystem Specifies if the values should be converted to right-handed\r\n */\r\n private static AddSplineTangent(babylonTransformNode: TransformNode, tangentType: _TangentType, outputs: number[][], animationChannelTargetPath: AnimationChannelTargetPath, interpolation: AnimationSamplerInterpolation, keyFrame: IAnimationKey, frameDelta: number, useQuaternion: boolean, convertToRightHandedSystem: boolean) {\r\n let tangent: number[];\r\n let tangentValue: Vector3 | Quaternion | number = tangentType === _TangentType.INTANGENT ? keyFrame.inTangent : keyFrame.outTangent;\r\n if (interpolation === AnimationSamplerInterpolation.CUBICSPLINE) {\r\n if (animationChannelTargetPath === AnimationChannelTargetPath.ROTATION) {\r\n if (tangentValue) {\r\n if (useQuaternion) {\r\n tangent = (tangentValue as Quaternion).asArray();\r\n }\r\n else {\r\n const array = (tangentValue as Vector3);\r\n tangent = Quaternion.RotationYawPitchRoll(array.y, array.x, array.z).asArray();\r\n }\r\n\r\n if (convertToRightHandedSystem) {\r\n _GLTFUtilities._GetRightHandedQuaternionArrayFromRef(tangent);\r\n if (!babylonTransformNode.parent) {\r\n tangent = Quaternion.FromArray([0, 1, 0, 0]).multiply(Quaternion.FromArray(tangent)).asArray();\r\n }\r\n }\r\n }\r\n else {\r\n tangent = [0, 0, 0, 0];\r\n }\r\n }\r\n else if (animationChannelTargetPath === AnimationChannelTargetPath.WEIGHTS) {\r\n if (tangentValue) {\r\n tangent = [tangentValue as number];\r\n } else {\r\n tangent = [0];\r\n }\r\n }\r\n else {\r\n if (tangentValue) {\r\n tangent = (tangentValue as Vector3).asArray();\r\n if (convertToRightHandedSystem) {\r\n if (animationChannelTargetPath === AnimationChannelTargetPath.TRANSLATION) {\r\n _GLTFUtilities._GetRightHandedPositionArray3FromRef(tangent);\r\n if (!babylonTransformNode.parent) {\r\n tangent[0] *= -1; // x\r\n tangent[2] *= -1; // z\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n tangent = [0, 0, 0];\r\n }\r\n }\r\n\r\n outputs.push(tangent);\r\n }\r\n }\r\n\r\n /**\r\n * Get the minimum and maximum key frames' frame values\r\n * @param keyFrames animation key frames\r\n * @returns the minimum and maximum key frame value\r\n */\r\n private static calculateMinMaxKeyFrames(keyFrames: IAnimationKey[]): { min: number, max: number } {\r\n let min: number = Infinity;\r\n let max: number = -Infinity;\r\n keyFrames.forEach(function (keyFrame) {\r\n min = Math.min(min, keyFrame.frame);\r\n max = Math.max(max, keyFrame.frame);\r\n });\r\n\r\n return { min: min, max: max };\r\n\r\n }\r\n}"]}
@@ -37,7 +37,7 @@ var GLTFData = /** @class */ (function () {
37
37
  else if (endsWith(key, ".gltf")) {
38
38
  mimeType = { type: "model/gltf+json" };
39
39
  }
40
- else if (endsWith(key, ".jpeg" || ".jpg")) {
40
+ else if (endsWith(key, ".jpeg") || endsWith(key, ".jpg")) {
41
41
  mimeType = { type: "image/jpeg" /* JPEG */ };
42
42
  }
43
43
  else if (endsWith(key, ".png")) {
@@ -1 +1 @@
1
- {"version":3,"file":"glTFData.js","sourceRoot":"","sources":["../../../../sourceES6/serializers/src/glTF/2.0/glTFData.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH;IAMI;;OAEG;IACH;QACI,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;IACxB,CAAC;IAED;;OAEG;IACI,gCAAa,GAApB;QACI;;;;;UAKE;QACF,SAAS,QAAQ,CAAC,GAAW,EAAE,MAAc;YACzC,OAAO,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QAClE,CAAC;QAED,KAAK,IAAI,GAAG,IAAI,IAAI,CAAC,SAAS,EAAE;YAC5B,IAAI,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;YACvC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;YAChC,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;YACpC,IAAI,CAAC,QAAQ,GAAG,GAAG,CAAC;YACpB,IAAI,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;YAC/B,IAAI,QAAQ,SAAA,CAAC;YAEb,IAAI,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE;gBACvB,QAAQ,GAAG,EAAE,IAAI,EAAE,mBAAmB,EAAE,CAAC;aAC5C;iBACI,IAAI,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE;gBAC5B,QAAQ,GAAG,EAAE,IAAI,EAAE,0BAA0B,EAAE,CAAC;aACnD;iBACI,IAAI,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC,EAAE;gBAC7B,QAAQ,GAAG,EAAE,IAAI,EAAE,iBAAiB,EAAE,CAAC;aAC1C;iBACI,IAAI,QAAQ,CAAC,GAAG,EAAE,OAAO,IAAI,MAAM,CAAC,EAAE;gBACvC,QAAQ,GAAG,EAAE,IAAI,yBAAoB,EAAE,CAAC;aAC3C;iBACI,IAAI,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE;gBAC5B,QAAQ,GAAG,EAAE,IAAI,uBAAmB,EAAE,CAAC;aAC1C;YAED,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC;YACnE,IAAI,CAAC,KAAK,EAAE,CAAC;SAChB;IACL,CAAC;IACL,eAAC;AAAD,CAAC,AAvDD,IAuDC","sourcesContent":["import { ImageMimeType } from \"babylonjs-gltf2interface\";\r\n\r\n/**\r\n * Class for holding and downloading glTF file data\r\n */\r\nexport class GLTFData {\r\n /**\r\n * Object which contains the file name as the key and its data as the value\r\n */\r\n glTFFiles: { [fileName: string]: string | Blob };\r\n\r\n /**\r\n * Initializes the glTF file object\r\n */\r\n public constructor() {\r\n this.glTFFiles = {};\r\n }\r\n\r\n /**\r\n * Downloads the glTF data as files based on their names and data\r\n */\r\n public downloadFiles(): void {\r\n /**\r\n * Checks for a matching suffix at the end of a string (for ES5 and lower)\r\n * @param str Source string\r\n * @param suffix Suffix to search for in the source string\r\n * @returns Boolean indicating whether the suffix was found (true) or not (false)\r\n */\r\n function endsWith(str: string, suffix: string): boolean {\r\n return str.indexOf(suffix, str.length - suffix.length) !== -1;\r\n }\r\n\r\n for (let key in this.glTFFiles) {\r\n let link = document.createElement('a');\r\n document.body.appendChild(link);\r\n link.setAttribute(\"type\", \"hidden\");\r\n link.download = key;\r\n let blob = this.glTFFiles[key];\r\n let mimeType;\r\n\r\n if (endsWith(key, \".glb\")) {\r\n mimeType = { type: \"model/gltf-binary\" };\r\n }\r\n else if (endsWith(key, \".bin\")) {\r\n mimeType = { type: \"application/octet-stream\" };\r\n }\r\n else if (endsWith(key, \".gltf\")) {\r\n mimeType = { type: \"model/gltf+json\" };\r\n }\r\n else if (endsWith(key, \".jpeg\" || \".jpg\")) {\r\n mimeType = { type: ImageMimeType.JPEG };\r\n }\r\n else if (endsWith(key, \".png\")) {\r\n mimeType = { type: ImageMimeType.PNG };\r\n }\r\n\r\n link.href = window.URL.createObjectURL(new Blob([blob], mimeType));\r\n link.click();\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"glTFData.js","sourceRoot":"","sources":["../../../../sourceES6/serializers/src/glTF/2.0/glTFData.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH;IAMI;;OAEG;IACH;QACI,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;IACxB,CAAC;IAED;;OAEG;IACI,gCAAa,GAApB;QACI;;;;;UAKE;QACF,SAAS,QAAQ,CAAC,GAAW,EAAE,MAAc;YACzC,OAAO,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QAClE,CAAC;QAED,KAAK,IAAI,GAAG,IAAI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import { ImageMimeType } from \"babylonjs-gltf2interface\";\r\n\r\n/**\r\n * Class for holding and downloading glTF file data\r\n */\r\nexport class GLTFData {\r\n /**\r\n * Object which contains the file name as the key and its data as the value\r\n */\r\n glTFFiles: { [fileName: string]: string | Blob };\r\n\r\n /**\r\n * Initializes the glTF file object\r\n */\r\n public constructor() {\r\n this.glTFFiles = {};\r\n }\r\n\r\n /**\r\n * Downloads the glTF data as files based on their names and data\r\n */\r\n public downloadFiles(): void {\r\n /**\r\n * Checks for a matching suffix at the end of a string (for ES5 and lower)\r\n * @param str Source string\r\n * @param suffix Suffix to search for in the source string\r\n * @returns Boolean indicating whether the suffix was found (true) or not (false)\r\n */\r\n function endsWith(str: string, suffix: string): boolean {\r\n return str.indexOf(suffix, str.length - suffix.length) !== -1;\r\n }\r\n\r\n for (let key in this.glTFFiles) {\r\n let link = document.createElement('a');\r\n document.body.appendChild(link);\r\n link.setAttribute(\"type\", \"hidden\");\r\n link.download = key;\r\n let blob = this.glTFFiles[key];\r\n let mimeType;\r\n\r\n if (endsWith(key, \".glb\")) {\r\n mimeType = { type: \"model/gltf-binary\" };\r\n }\r\n else if (endsWith(key, \".bin\")) {\r\n mimeType = { type: \"application/octet-stream\" };\r\n }\r\n else if (endsWith(key, \".gltf\")) {\r\n mimeType = { type: \"model/gltf+json\" };\r\n }\r\n else if (endsWith(key, \".jpeg\") || endsWith(key, \".jpg\")) {\r\n mimeType = { type: ImageMimeType.JPEG };\r\n }\r\n else if (endsWith(key, \".png\")) {\r\n mimeType = { type: ImageMimeType.PNG };\r\n }\r\n\r\n link.href = window.URL.createObjectURL(new Blob([blob], mimeType));\r\n link.click();\r\n }\r\n }\r\n}\r\n"]}
@@ -333,6 +333,13 @@ export declare class _Exporter {
333
333
  * @param binaryWriter Buffer to write binary data to
334
334
  */
335
335
  private createSceneAsync;
336
+ /**
337
+ * Getting the nodes and materials that would be exported.
338
+ * @param nodes Babylon transform nodes
339
+ * @returns Array of nodes which would be exported.
340
+ * @returns Set of materials which would be exported.
341
+ */
342
+ private getExportNodes;
336
343
  /**
337
344
  * Creates a mapping of Node unique id to node index and handles animations
338
345
  * @param babylonScene Babylon Scene