@babylonjs/serializers 8.5.0 → 8.6.1

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 (37) hide show
  1. package/glTF/2.0/Extensions/KHR_draco_mesh_compression.js +3 -3
  2. package/glTF/2.0/Extensions/KHR_draco_mesh_compression.js.map +1 -1
  3. package/glTF/2.0/Extensions/KHR_lights_punctual.js.map +1 -1
  4. package/glTF/2.0/Extensions/KHR_materials_anisotropy.js +1 -0
  5. package/glTF/2.0/Extensions/KHR_materials_anisotropy.js.map +1 -1
  6. package/glTF/2.0/Extensions/KHR_materials_clearcoat.js +1 -0
  7. package/glTF/2.0/Extensions/KHR_materials_clearcoat.js.map +1 -1
  8. package/glTF/2.0/Extensions/KHR_materials_diffuse_transmission.js +4 -3
  9. package/glTF/2.0/Extensions/KHR_materials_diffuse_transmission.js.map +1 -1
  10. package/glTF/2.0/Extensions/KHR_materials_dispersion.js +1 -0
  11. package/glTF/2.0/Extensions/KHR_materials_dispersion.js.map +1 -1
  12. package/glTF/2.0/Extensions/KHR_materials_ior.js +1 -0
  13. package/glTF/2.0/Extensions/KHR_materials_ior.js.map +1 -1
  14. package/glTF/2.0/Extensions/KHR_materials_iridescence.js +1 -0
  15. package/glTF/2.0/Extensions/KHR_materials_iridescence.js.map +1 -1
  16. package/glTF/2.0/Extensions/KHR_materials_specular.js +1 -0
  17. package/glTF/2.0/Extensions/KHR_materials_specular.js.map +1 -1
  18. package/glTF/2.0/Extensions/KHR_materials_unlit.js +1 -0
  19. package/glTF/2.0/Extensions/KHR_materials_unlit.js.map +1 -1
  20. package/glTF/2.0/Extensions/KHR_materials_volume.js +1 -0
  21. package/glTF/2.0/Extensions/KHR_materials_volume.js.map +1 -1
  22. package/glTF/2.0/bufferManager.js +6 -4
  23. package/glTF/2.0/bufferManager.js.map +1 -1
  24. package/glTF/2.0/dataWriter.js.map +1 -1
  25. package/glTF/2.0/glTFAnimation.js.map +1 -1
  26. package/glTF/2.0/glTFExporter.d.ts +2 -2
  27. package/glTF/2.0/glTFExporter.js +14 -8
  28. package/glTF/2.0/glTFExporter.js.map +1 -1
  29. package/glTF/2.0/glTFMaterialExporter.d.ts +1 -1
  30. package/glTF/2.0/glTFMaterialExporter.js +26 -26
  31. package/glTF/2.0/glTFMaterialExporter.js.map +1 -1
  32. package/glTF/2.0/glTFUtilities.d.ts +1 -1
  33. package/glTF/2.0/glTFUtilities.js +8 -8
  34. package/glTF/2.0/glTFUtilities.js.map +1 -1
  35. package/package.json +3 -3
  36. package/stl/stlSerializer.js +2 -1
  37. package/stl/stlSerializer.js.map +1 -1
@@ -1,9 +1,11 @@
1
1
  import { DataWriter } from "./dataWriter.js";
2
- function getHighestByteAlignment(byteLength) {
3
- if (byteLength % 4 === 0)
2
+ function GetHighestByteAlignment(byteLength) {
3
+ if (byteLength % 4 === 0) {
4
4
  return 4;
5
- if (byteLength % 2 === 0)
5
+ }
6
+ if (byteLength % 2 === 0) {
6
7
  return 2;
8
+ }
7
9
  return 1;
8
10
  }
9
11
  /**
@@ -38,7 +40,7 @@ export class BufferManager {
38
40
  });
39
41
  const dataWriter = new DataWriter(totalByteLength);
40
42
  // Order the bufferViews in descending order of their alignment requirements
41
- const orderedBufferViews = Array.from(this._bufferViewToData.keys()).sort((a, b) => getHighestByteAlignment(b.byteLength) - getHighestByteAlignment(a.byteLength));
43
+ const orderedBufferViews = Array.from(this._bufferViewToData.keys()).sort((a, b) => GetHighestByteAlignment(b.byteLength) - GetHighestByteAlignment(a.byteLength));
42
44
  // Fill in the bufferViews list and missing bufferView index references while writing the binary
43
45
  for (const bufferView of orderedBufferViews) {
44
46
  bufferView.byteOffset = dataWriter.byteOffset;
@@ -1 +1 @@
1
- {"version":3,"file":"bufferManager.js","sourceRoot":"","sources":["../../../../../dev/serializers/src/glTF/2.0/bufferManager.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAQ1C,SAAS,uBAAuB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U,CAAC,CAAC;QACnC,OAAO,UAAW,CAAC;IACvB,CAAC;IAEM,2BAA2B,CAAC,UAAuB;QACtD,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;QACnC,IAAI,CAAC,uBAAuB,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,CAAC,uBAAuB,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC;QACjG,OAAO,IAAI,CAAC,uBAAuB,CAAC,GAAG,CAAC,UAAU,CAAE,CAAC;IACzD,CAAC;IAEM,OAAO,CAAC,UAAuB;QAClC,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;QACnC,OAAO,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,UAAU,CAAE,CAAC;IACnD,CAAC;IAEO,iBAAiB,CAAC,UAAwB;QAC9C,IAAI,UAAU,KAAK,SAAS,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;YACtE,MAAM,IAAI,KAAK,CAAC,cAAc,UAAU,8BAA8B,CAAC,CAAC;QAC5E,CAAC;IACL,CAAC;CACJ","sourcesContent":["import type { TypedArray } from \"core/types\";\nimport type { AccessorComponentType, AccessorType, IAccessor, IBufferView } from \"babylonjs-gltf2interface\";\nimport { DataWriter } from \"./dataWriter\";\n\ntype TypedArrayForglTF = Exclude<TypedArray, Float64Array | BigInt64Array | BigUint64Array>;\n\ninterface IPropertyWithBufferView {\n bufferView?: number;\n}\n\nfunction getHighestByteAlignment(byteLength: number): number {\n if (byteLength % 4 === 0) return 4;\n if (byteLength % 2 === 0) return 2;\n return 1;\n}\n\n/**\n * Utility class to centralize the management of binary data, bufferViews, and the objects that reference them.\n * @internal\n */\nexport class BufferManager {\n /**\n * Maps a bufferView to its data\n */\n private _bufferViewToData: Map<IBufferView, TypedArrayForglTF> = new Map<IBufferView, TypedArrayForglTF>();\n\n /**\n * Maps a bufferView to glTF objects that reference it via a \"bufferView\" property (e.g. accessors, images)\n */\n private _bufferViewToProperties: Map<IBufferView, IPropertyWithBufferView[]> = new Map<IBufferView, IPropertyWithBufferView[]>();\n\n /**\n * Maps an accessor to its bufferView\n */\n private _accessorToBufferView: Map<IAccessor, IBufferView> = new Map<IAccessor, IBufferView>();\n\n /**\n * Generates a binary buffer from the stored bufferViews. Also populates the bufferViews list.\n * @param bufferViews The list of bufferViews to be populated while writing the binary\n * @returns The binary buffer\n */\n public generateBinary(bufferViews: IBufferView[]): Uint8Array {\n // Construct a DataWriter with the total byte length to prevent resizing\n let totalByteLength = 0;\n this._bufferViewToData.forEach((data) => {\n totalByteLength += data.byteLength;\n });\n const dataWriter = new DataWriter(totalByteLength);\n\n // Order the bufferViews in descending order of their alignment requirements\n const orderedBufferViews = Array.from(this._bufferViewToData.keys()).sort((a, b) => getHighestByteAlignment(b.byteLength) - getHighestByteAlignment(a.byteLength));\n\n // Fill in the bufferViews list and missing bufferView index references while writing the binary\n for (const bufferView of orderedBufferViews) {\n bufferView.byteOffset = dataWriter.byteOffset;\n bufferViews.push(bufferView);\n\n const bufferViewIndex = bufferViews.length - 1;\n const properties = this.getPropertiesWithBufferView(bufferView);\n for (const object of properties) {\n object.bufferView = bufferViewIndex;\n }\n\n dataWriter.writeTypedArray(this._bufferViewToData.get(bufferView)!);\n\n this._bufferViewToData.delete(bufferView); // Try to free up memory ASAP\n }\n\n return dataWriter.getOutputData();\n }\n\n /**\n * Creates a buffer view based on the supplied arguments\n * @param data a TypedArray to create the bufferView for\n * @param byteStride byte distance between consecutive elements\n * @returns bufferView for glTF\n */\n public createBufferView(data: TypedArrayForglTF, byteStride?: number): IBufferView {\n const bufferView: IBufferView = {\n buffer: 0,\n byteOffset: undefined, // byteOffset will be set later, when we write the binary and decide bufferView ordering\n byteLength: data.byteLength,\n byteStride: byteStride,\n };\n this._bufferViewToData.set(bufferView, data);\n return bufferView;\n }\n\n /**\n * Creates an accessor based on the supplied arguments and assigns it to the bufferView\n * @param bufferView The glTF bufferView referenced by this accessor\n * @param type The type of the accessor\n * @param componentType The datatype of components in the attribute\n * @param count The number of attributes referenced by this accessor\n * @param byteOffset The offset relative to the start of the bufferView in bytes\n * @param minMax Minimum and maximum value of each component in this attribute\n * @param normalized Specifies whether integer data values are normalized before usage\n * @returns accessor for glTF\n */\n public createAccessor(\n bufferView: IBufferView,\n type: AccessorType,\n componentType: AccessorComponentType,\n count: number,\n byteOffset?: number,\n minMax?: { min: number[]; max: number[] },\n normalized?: boolean\n ): IAccessor {\n this._verifyBufferView(bufferView);\n const accessor: IAccessor = {\n bufferView: undefined, // bufferView will be set to a real index later, once we write the binary and decide bufferView ordering\n componentType: componentType,\n count: count,\n type: type,\n min: minMax?.min,\n max: minMax?.max,\n normalized: normalized,\n byteOffset: byteOffset,\n };\n this.setBufferView(accessor, bufferView);\n this._accessorToBufferView.set(accessor, bufferView);\n return accessor;\n }\n\n /**\n * Assigns a bufferView to a glTF object that references it\n * @param object The glTF object\n * @param bufferView The bufferView to assign\n */\n public setBufferView(object: IPropertyWithBufferView, bufferView: IBufferView) {\n this._verifyBufferView(bufferView);\n const properties = this.getPropertiesWithBufferView(bufferView);\n properties.push(object);\n }\n\n /**\n * Removes buffer view from the binary data, as well as from all its known references\n * @param bufferView the bufferView to remove\n */\n public removeBufferView(bufferView: IBufferView): void {\n const properties = this.getPropertiesWithBufferView(bufferView);\n for (const object of properties) {\n if (object.bufferView !== undefined) {\n delete object.bufferView;\n }\n }\n\n this._bufferViewToData.delete(bufferView);\n this._bufferViewToProperties.delete(bufferView);\n this._accessorToBufferView.forEach((bv, accessor) => {\n if (bv === bufferView) {\n // Additionally, remove byteOffset from accessor referencing this bufferView\n if (accessor.byteOffset !== undefined) {\n delete accessor.byteOffset;\n }\n this._accessorToBufferView.delete(accessor);\n }\n });\n }\n\n public getBufferView(accessor: IAccessor): IBufferView {\n const bufferView = this._accessorToBufferView.get(accessor);\n this._verifyBufferView(bufferView);\n return bufferView!;\n }\n\n public getPropertiesWithBufferView(bufferView: IBufferView): IPropertyWithBufferView[] {\n this._verifyBufferView(bufferView);\n this._bufferViewToProperties.set(bufferView, this._bufferViewToProperties.get(bufferView) ?? []);\n return this._bufferViewToProperties.get(bufferView)!;\n }\n\n public getData(bufferView: IBufferView): TypedArrayForglTF {\n this._verifyBufferView(bufferView);\n return this._bufferViewToData.get(bufferView)!;\n }\n\n private _verifyBufferView(bufferView?: IBufferView): void {\n if (bufferView === undefined || !this._bufferViewToData.has(bufferView)) {\n throw new Error(`BufferView ${bufferView} not found in BufferManager.`);\n }\n }\n}\n"]}
1
+ {"version":3,"file":"bufferManager.js","sourceRoot":"","sources":["../../../../../dev/serializers/src/glTF/2.0/bufferManager.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAQ1C,SAAS,uBAAuB,CAAC,UAAkB;IAC/C,IAAI,UAAU,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,CAAC,CAAC;IACb,CAAC;IACD,IAAI,UAAU,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,CAAC,CAAC;IACb,CAAC;IACD,OAAO,CAAC,CAAC;AACb,CAAC;AAED;;;GAGG;AACH,MAAM,OAAO,aAAa;IAA1B;QACI;;WAEG;QACK,sBAAiB,GAAwC,IAAI,GAAG,EAAkC,CAAC;QAE3G;;WAEG;QACK,4BAAuB,GAAgD,IAAI,GAAG,EAA0C,CAAC;QAEjI;;WAEG;QACK,0BAAqB,GAAgC,IAAI,GAAG,EAA0B,CAAC;IAoJnG,CAAC;IAlJG;;;;OAIG;IACI,cAAc,CAAC,WAA0B;QAC5C,wEAAwE;QACxE,IAAI,eAAe,GAAG,CAAC,CAAC;QACxB,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YACpC,eAAe,IAAI,IAAI,CAAC,UAAU,CAAC;QACvC,CAAC,CAAC,CAAC;QACH,MAAM,UAAU,GAA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UAAU,8BAA8B,CAAC,CAAC;QAC5E,CAAC;IACL,CAAC;CACJ","sourcesContent":["import type { TypedArray } from \"core/types\";\nimport type { AccessorComponentType, AccessorType, IAccessor, IBufferView } from \"babylonjs-gltf2interface\";\nimport { DataWriter } from \"./dataWriter\";\n\ntype TypedArrayForglTF = Exclude<TypedArray, Float64Array | BigInt64Array | BigUint64Array>;\n\ninterface IPropertyWithBufferView {\n bufferView?: number;\n}\n\nfunction GetHighestByteAlignment(byteLength: number): number {\n if (byteLength % 4 === 0) {\n return 4;\n }\n if (byteLength % 2 === 0) {\n return 2;\n }\n return 1;\n}\n\n/**\n * Utility class to centralize the management of binary data, bufferViews, and the objects that reference them.\n * @internal\n */\nexport class BufferManager {\n /**\n * Maps a bufferView to its data\n */\n private _bufferViewToData: Map<IBufferView, TypedArrayForglTF> = new Map<IBufferView, TypedArrayForglTF>();\n\n /**\n * Maps a bufferView to glTF objects that reference it via a \"bufferView\" property (e.g. accessors, images)\n */\n private _bufferViewToProperties: Map<IBufferView, IPropertyWithBufferView[]> = new Map<IBufferView, IPropertyWithBufferView[]>();\n\n /**\n * Maps an accessor to its bufferView\n */\n private _accessorToBufferView: Map<IAccessor, IBufferView> = new Map<IAccessor, IBufferView>();\n\n /**\n * Generates a binary buffer from the stored bufferViews. Also populates the bufferViews list.\n * @param bufferViews The list of bufferViews to be populated while writing the binary\n * @returns The binary buffer\n */\n public generateBinary(bufferViews: IBufferView[]): Uint8Array {\n // Construct a DataWriter with the total byte length to prevent resizing\n let totalByteLength = 0;\n this._bufferViewToData.forEach((data) => {\n totalByteLength += data.byteLength;\n });\n const dataWriter = new DataWriter(totalByteLength);\n\n // Order the bufferViews in descending order of their alignment requirements\n const orderedBufferViews = Array.from(this._bufferViewToData.keys()).sort((a, b) => GetHighestByteAlignment(b.byteLength) - GetHighestByteAlignment(a.byteLength));\n\n // Fill in the bufferViews list and missing bufferView index references while writing the binary\n for (const bufferView of orderedBufferViews) {\n bufferView.byteOffset = dataWriter.byteOffset;\n bufferViews.push(bufferView);\n\n const bufferViewIndex = bufferViews.length - 1;\n const properties = this.getPropertiesWithBufferView(bufferView);\n for (const object of properties) {\n object.bufferView = bufferViewIndex;\n }\n\n dataWriter.writeTypedArray(this._bufferViewToData.get(bufferView)!);\n\n this._bufferViewToData.delete(bufferView); // Try to free up memory ASAP\n }\n\n return dataWriter.getOutputData();\n }\n\n /**\n * Creates a buffer view based on the supplied arguments\n * @param data a TypedArray to create the bufferView for\n * @param byteStride byte distance between consecutive elements\n * @returns bufferView for glTF\n */\n public createBufferView(data: TypedArrayForglTF, byteStride?: number): IBufferView {\n const bufferView: IBufferView = {\n buffer: 0,\n byteOffset: undefined, // byteOffset will be set later, when we write the binary and decide bufferView ordering\n byteLength: data.byteLength,\n byteStride: byteStride,\n };\n this._bufferViewToData.set(bufferView, data);\n return bufferView;\n }\n\n /**\n * Creates an accessor based on the supplied arguments and assigns it to the bufferView\n * @param bufferView The glTF bufferView referenced by this accessor\n * @param type The type of the accessor\n * @param componentType The datatype of components in the attribute\n * @param count The number of attributes referenced by this accessor\n * @param byteOffset The offset relative to the start of the bufferView in bytes\n * @param minMax Minimum and maximum value of each component in this attribute\n * @param normalized Specifies whether integer data values are normalized before usage\n * @returns accessor for glTF\n */\n public createAccessor(\n bufferView: IBufferView,\n type: AccessorType,\n componentType: AccessorComponentType,\n count: number,\n byteOffset?: number,\n minMax?: { min: number[]; max: number[] },\n normalized?: boolean\n ): IAccessor {\n this._verifyBufferView(bufferView);\n const accessor: IAccessor = {\n bufferView: undefined, // bufferView will be set to a real index later, once we write the binary and decide bufferView ordering\n componentType: componentType,\n count: count,\n type: type,\n min: minMax?.min,\n max: minMax?.max,\n normalized: normalized,\n byteOffset: byteOffset,\n };\n this.setBufferView(accessor, bufferView);\n this._accessorToBufferView.set(accessor, bufferView);\n return accessor;\n }\n\n /**\n * Assigns a bufferView to a glTF object that references it\n * @param object The glTF object\n * @param bufferView The bufferView to assign\n */\n public setBufferView(object: IPropertyWithBufferView, bufferView: IBufferView) {\n this._verifyBufferView(bufferView);\n const properties = this.getPropertiesWithBufferView(bufferView);\n properties.push(object);\n }\n\n /**\n * Removes buffer view from the binary data, as well as from all its known references\n * @param bufferView the bufferView to remove\n */\n public removeBufferView(bufferView: IBufferView): void {\n const properties = this.getPropertiesWithBufferView(bufferView);\n for (const object of properties) {\n if (object.bufferView !== undefined) {\n delete object.bufferView;\n }\n }\n\n this._bufferViewToData.delete(bufferView);\n this._bufferViewToProperties.delete(bufferView);\n this._accessorToBufferView.forEach((bv, accessor) => {\n if (bv === bufferView) {\n // Additionally, remove byteOffset from accessor referencing this bufferView\n if (accessor.byteOffset !== undefined) {\n delete accessor.byteOffset;\n }\n this._accessorToBufferView.delete(accessor);\n }\n });\n }\n\n public getBufferView(accessor: IAccessor): IBufferView {\n const bufferView = this._accessorToBufferView.get(accessor);\n this._verifyBufferView(bufferView);\n return bufferView!;\n }\n\n public getPropertiesWithBufferView(bufferView: IBufferView): IPropertyWithBufferView[] {\n this._verifyBufferView(bufferView);\n this._bufferViewToProperties.set(bufferView, this._bufferViewToProperties.get(bufferView) ?? []);\n return this._bufferViewToProperties.get(bufferView)!;\n }\n\n public getData(bufferView: IBufferView): TypedArrayForglTF {\n this._verifyBufferView(bufferView);\n return this._bufferViewToData.get(bufferView)!;\n }\n\n private _verifyBufferView(bufferView?: IBufferView): void {\n if (bufferView === undefined || !this._bufferViewToData.has(bufferView)) {\n throw new Error(`BufferView ${bufferView} not found in BufferManager.`);\n }\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"dataWriter.js","sourceRoot":"","sources":["../../../../../dev/serializers/src/glTF/2.0/dataWriter.ts"],"names":[],"mappings":"AAIA,MAAM,uBAAuB,GAAG,IAAI,GAAG,CAA4E;IAC/G,CAAC,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACz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C,CAAC,CAAC;QACzB,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;QACzD,IAAI,CAAC,WAAW,IAAI,CAAC,CAAC;IAC1B,CAAC;IAEO,gBAAgB,CAAC,UAAkB;QACvC,MAAM,aAAa,GAAG,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QACnD,IAAI,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC;YACxC,MAAM,OAAO,GAAG,IAAI,UAAU,CAAC,aAAa,GAAG,CAAC,CAAC,CAAC;YAClD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACxB,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC;YACrB,IAAI,CAAC,SAAS,GAAG,IAAI,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QACrD,CAAC;IACL,CAAC;CACJ","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\n/* eslint-disable babylonjs/available */\r\nimport type { TypedArray } from \"core/types\";\r\n\r\nconst TypedArrayToWriteMethod = new Map<Function, (dataView: DataView, byteOffset: number, value: number) => void>([\r\n [Int8Array, (d, b, v) => d.setInt8(b, v)],\r\n [Uint8Array, (dv, bo, v) => dv.setUint8(bo, v)],\r\n [Uint8ClampedArray, (dv, bo, v) => dv.setUint8(bo, v)],\r\n [Int16Array, (dv, bo, v) => dv.setInt16(bo, v, true)],\r\n [Uint16Array, (dv, bo, v) => dv.setUint16(bo, v, true)],\r\n [Int32Array, (dv, bo, v) => dv.setInt32(bo, v, true)],\r\n [Uint32Array, (dv, bo, v) => dv.setUint32(bo, v, true)],\r\n [Float32Array, (dv, bo, v) => dv.setFloat32(bo, v, true)],\r\n [Float64Array, (dv, bo, v) => dv.setFloat64(bo, v, true)],\r\n]);\r\n\r\n/** @internal */\r\nexport class DataWriter {\r\n private _data: Uint8Array;\r\n private _dataView: DataView;\r\n private _byteOffset: number;\r\n\r\n public writeTypedArray(value: Exclude<TypedArray, BigInt64Array | BigUint64Array>): void {\r\n this._checkGrowBuffer(value.byteLength);\r\n const setMethod = TypedArrayToWriteMethod.get(value.constructor)!;\r\n for (let i = 0; i < value.length; i++) {\r\n setMethod(this._dataView, this._byteOffset, value[i] as number);\r\n this._byteOffset += value.BYTES_PER_ELEMENT;\r\n }\r\n }\r\n\r\n public constructor(byteLength: number) {\r\n this._data = new Uint8Array(byteLength);\r\n this._dataView = new DataView(this._data.buffer);\r\n this._byteOffset = 0;\r\n }\r\n\r\n public get byteOffset(): number {\r\n return this._byteOffset;\r\n }\r\n\r\n public getOutputData(): Uint8Array {\r\n return new Uint8Array(this._data.buffer, 0, this._byteOffset);\r\n }\r\n\r\n public writeUInt8(value: number): void {\r\n this._checkGrowBuffer(1);\r\n this._dataView.setUint8(this._byteOffset, value);\r\n this._byteOffset++;\r\n }\r\n\r\n public writeInt8(value: number): void {\r\n this._checkGrowBuffer(1);\r\n this._dataView.setInt8(this._byteOffset, value);\r\n this._byteOffset++;\r\n }\r\n\r\n public writeInt16(entry: number): void {\r\n this._checkGrowBuffer(2);\r\n this._dataView.setInt16(this._byteOffset, entry, true);\r\n this._byteOffset += 2;\r\n }\r\n\r\n public writeUInt16(value: number): void {\r\n this._checkGrowBuffer(2);\r\n this._dataView.setUint16(this._byteOffset, value, true);\r\n this._byteOffset += 2;\r\n }\r\n\r\n public writeInt32(entry: number): void {\r\n this._checkGrowBuffer(4);\r\n this._dataView.setInt32(this._byteOffset, entry, true);\r\n this._byteOffset += 4;\r\n }\r\n\r\n public writeUInt32(value: number): void {\r\n this._checkGrowBuffer(4);\r\n this._dataView.setUint32(this._byteOffset, value, true);\r\n this._byteOffset += 4;\r\n }\r\n\r\n public writeFloat32(value: number): void {\r\n this._checkGrowBuffer(4);\r\n this._dataView.setFloat32(this._byteOffset, value, true);\r\n this._byteOffset += 4;\r\n }\r\n\r\n public writeFloat64(value: number): void {\r\n this._checkGrowBuffer(8);\r\n this._dataView.setFloat64(this._byteOffset, value, true);\r\n this._byteOffset += 8;\r\n }\r\n\r\n private _checkGrowBuffer(byteLength: number): void {\r\n const newByteLength = this.byteOffset + byteLength;\r\n if (newByteLength > this._data.byteLength) {\r\n const newData = new Uint8Array(newByteLength * 2);\r\n newData.set(this._data);\r\n this._data = newData;\r\n this._dataView = new DataView(this._data.buffer);\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"dataWriter.js","sourceRoot":"","sources":["../../../../../dev/serializers/src/glTF/2.0/dataWriter.ts"],"names":[],"mappings":"AAIA,MAAM,uBAAuB,GAAG,IAAI,GAAG,CAA4E;IAC/G,CAAC,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACzC,CAAC,UAAU,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;IAC/C,CAAC,iBAAiB,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;IACtD,CAAC,UAAU,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;IACrD,CAAC,WAAW,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,SAAS,CAAC,EAAE,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;IACvD,CAAC,UAAU,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE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able babylonjs/available */\r\nimport type { TypedArray } from \"core/types\";\r\n\r\nconst TypedArrayToWriteMethod = new Map<Function, (dataView: DataView, byteOffset: number, value: number) => void>([\r\n [Int8Array, (d, b, v) => d.setInt8(b, v)],\r\n [Uint8Array, (dv, bo, v) => dv.setUint8(bo, v)],\r\n [Uint8ClampedArray, (dv, bo, v) => dv.setUint8(bo, v)],\r\n [Int16Array, (dv, bo, v) => dv.setInt16(bo, v, true)],\r\n [Uint16Array, (dv, bo, v) => dv.setUint16(bo, v, true)],\r\n [Int32Array, (dv, bo, v) => dv.setInt32(bo, v, true)],\r\n [Uint32Array, (dv, bo, v) => dv.setUint32(bo, v, true)],\r\n [Float32Array, (dv, bo, v) => dv.setFloat32(bo, v, true)],\r\n [Float64Array, (dv, bo, v) => dv.setFloat64(bo, v, true)],\r\n]);\r\n\r\n/** @internal */\r\nexport class DataWriter {\r\n private _data: Uint8Array;\r\n private _dataView: DataView;\r\n private _byteOffset: number;\r\n\r\n public writeTypedArray(value: Exclude<TypedArray, BigInt64Array | BigUint64Array>): void {\r\n this._checkGrowBuffer(value.byteLength);\r\n const setMethod = TypedArrayToWriteMethod.get(value.constructor)!;\r\n for (let i = 0; i < value.length; i++) {\r\n setMethod(this._dataView, this._byteOffset, value[i]);\r\n this._byteOffset += value.BYTES_PER_ELEMENT;\r\n }\r\n }\r\n\r\n public constructor(byteLength: number) {\r\n this._data = new Uint8Array(byteLength);\r\n this._dataView = new DataView(this._data.buffer);\r\n this._byteOffset = 0;\r\n }\r\n\r\n public get byteOffset(): number {\r\n return this._byteOffset;\r\n }\r\n\r\n public getOutputData(): Uint8Array {\r\n return new Uint8Array(this._data.buffer, 0, this._byteOffset);\r\n }\r\n\r\n public writeUInt8(value: number): void {\r\n this._checkGrowBuffer(1);\r\n this._dataView.setUint8(this._byteOffset, value);\r\n this._byteOffset++;\r\n }\r\n\r\n public writeInt8(value: number): void {\r\n this._checkGrowBuffer(1);\r\n this._dataView.setInt8(this._byteOffset, value);\r\n this._byteOffset++;\r\n }\r\n\r\n public writeInt16(entry: number): void {\r\n this._checkGrowBuffer(2);\r\n this._dataView.setInt16(this._byteOffset, entry, true);\r\n this._byteOffset += 2;\r\n }\r\n\r\n public writeUInt16(value: number): void {\r\n this._checkGrowBuffer(2);\r\n this._dataView.setUint16(this._byteOffset, value, true);\r\n this._byteOffset += 2;\r\n }\r\n\r\n public writeInt32(entry: number): void {\r\n this._checkGrowBuffer(4);\r\n this._dataView.setInt32(this._byteOffset, entry, true);\r\n this._byteOffset += 4;\r\n }\r\n\r\n public writeUInt32(value: number): void {\r\n this._checkGrowBuffer(4);\r\n this._dataView.setUint32(this._byteOffset, value, true);\r\n this._byteOffset += 4;\r\n }\r\n\r\n public writeFloat32(value: number): void {\r\n this._checkGrowBuffer(4);\r\n this._dataView.setFloat32(this._byteOffset, value, true);\r\n this._byteOffset += 4;\r\n }\r\n\r\n public writeFloat64(value: number): void {\r\n this._checkGrowBuffer(8);\r\n this._dataView.setFloat64(this._byteOffset, value, true);\r\n this._byteOffset += 8;\r\n }\r\n\r\n private _checkGrowBuffer(byteLength: number): void {\r\n const newByteLength = this.byteOffset + byteLength;\r\n if (newByteLength > this._data.byteLength) {\r\n const newData = new Uint8Array(newByteLength * 2);\r\n newData.set(this._data);\r\n this._data = newData;\r\n this._dataView = new DataView(this._data.buffer);\r\n }\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"glTFAnimation.js","sourceRoot":"","sources":["../../../../../dev/serializers/src/glTF/2.0/glTFAnimation.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,6CAA+B;AAC7D,OAAO,EAAE,KAAK,EAAE,sCAAwB;AACxC,OAAO,EAAE,SAAS,EAAE,gDAAkC;AACtD,OAAO,EAAE,aAAa,EAAE,gDAAkC;AAE1D,OAAO,EAAE,WAAW,EAAE,6CAA+B;AACrD,OAAO,EAAE,IAAI,EAAE,uCAAyB;AAKxC,OAAO,EAAE,M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AAC,CAAC;QACxC,CAAC,CAAC,CAAC;QAEH,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;IAClC,CAAC;CACJ","sourcesContent":["import type { IAnimation, INode, IBufferView, IAccessor, IAnimationSampler, IAnimationChannel } from \"babylonjs-gltf2interface\";\r\nimport { AnimationSamplerInterpolation, AnimationChannelTargetPath, AccessorType, AccessorComponentType } from \"babylonjs-gltf2interface\";\r\nimport type { Node } from \"core/node\";\r\nimport type { Nullable } from \"core/types\";\r\nimport { Vector3, Quaternion } from \"core/Maths/math.vector\";\r\nimport { Tools } from \"core/Misc/tools\";\r\nimport { Animation } from \"core/Animations/animation\";\r\nimport { TransformNode } from \"core/Meshes/transformNode\";\r\nimport type { Scene } from \"core/scene\";\r\nimport { MorphTarget } from \"core/Morph/morphTarget\";\r\nimport { Mesh } from \"core/Meshes/mesh\";\r\n\r\nimport type { IAnimationKey } from \"core/Animations/animationKey\";\r\nimport { AnimationKeyInterpolation } from \"core/Animations/animationKey\";\r\n\r\nimport { Camera } from \"core/Cameras/camera\";\r\nimport { Light } from \"core/Lights/light\";\r\nimport type { BufferManager } from \"./bufferManager\";\r\nimport { GetAccessorElementCount, ConvertToRightHandedPosition, ConvertCameraRotationToGLTF, ConvertToRightHandedRotation } from \"./glTFUtilities\";\r\n\r\n/**\r\n * @internal\r\n * Interface to store animation data.\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\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 * @internal\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\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 * @internal\r\n * Enum for handling in tangent and out tangent.\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\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/**\r\n * @internal\r\n * Utility class for generating glTF animation data from BabylonJS.\r\n */\r\nexport class _GLTFAnimation {\r\n /**\r\n * Determine if a node is transformable - ie has properties it should be part of animation of transformation.\r\n * @param babylonNode the node to test\r\n * @returns true if can be animated, false otherwise. False if the parameter is null or undefined.\r\n */\r\n private static _IsTransformable(babylonNode: Node): boolean {\r\n return babylonNode && (babylonNode instanceof TransformNode || babylonNode instanceof Camera || babylonNode instanceof Light);\r\n }\r\n\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 useQuaternion - Specifies if quaternions are used.\r\n * @returns nullable IAnimationData\r\n */\r\n public static _CreateNodeAnimation(\r\n babylonTransformNode: Node,\r\n animation: Animation,\r\n animationChannelTargetPath: AnimationChannelTargetPath,\r\n useQuaternion: boolean,\r\n animationSampleRate: number\r\n ): Nullable<_IAnimationData> {\r\n if (this._IsTransformable(babylonTransformNode)) {\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\r\n const interpolation = interpolationOrBake.interpolationType;\r\n const shouldBakeAnimation = interpolationOrBake.shouldBakeAnimation;\r\n\r\n if (shouldBakeAnimation) {\r\n _GLTFAnimation._CreateBakedAnimation(\r\n babylonTransformNode,\r\n animation,\r\n animationChannelTargetPath,\r\n minMaxKeyFrames.min,\r\n minMaxKeyFrames.max,\r\n animation.framePerSecond,\r\n animationSampleRate,\r\n inputs,\r\n outputs,\r\n minMaxKeyFrames,\r\n useQuaternion\r\n );\r\n } else {\r\n if (interpolation === AnimationSamplerInterpolation.LINEAR || interpolation === AnimationSamplerInterpolation.STEP) {\r\n _GLTFAnimation._CreateLinearOrStepAnimation(babylonTransformNode, animation, animationChannelTargetPath, inputs, outputs, useQuaternion);\r\n } else if (interpolation === AnimationSamplerInterpolation.CUBICSPLINE) {\r\n _GLTFAnimation._CreateCubicSplineAnimation(babylonTransformNode, animation, animationChannelTargetPath, inputs, outputs, useQuaternion);\r\n } else {\r\n _GLTFAnimation._CreateBakedAnimation(\r\n babylonTransformNode,\r\n animation,\r\n animationChannelTargetPath,\r\n minMaxKeyFrames.min,\r\n minMaxKeyFrames.max,\r\n animation.framePerSecond,\r\n animationSampleRate,\r\n inputs,\r\n outputs,\r\n minMaxKeyFrames,\r\n useQuaternion\r\n );\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\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 const 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 } 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 bufferManager\r\n * @param bufferViews\r\n * @param accessors\r\n * @param animationSampleRate\r\n */\r\n public static _CreateNodeAnimationFromNodeAnimations(\r\n babylonNode: Node,\r\n runtimeGLTFAnimation: IAnimation,\r\n idleGLTFAnimations: IAnimation[],\r\n nodeMap: Map<Node, number>,\r\n nodes: INode[],\r\n bufferManager: BufferManager,\r\n bufferViews: IBufferView[],\r\n accessors: IAccessor[],\r\n animationSampleRate: number,\r\n useRightHanded: boolean,\r\n shouldExportAnimation?: (animation: Animation) => boolean\r\n ) {\r\n let glTFAnimation: IAnimation;\r\n if (_GLTFAnimation._IsTransformable(babylonNode)) {\r\n if (babylonNode.animations) {\r\n for (const animation of babylonNode.animations) {\r\n if (shouldExportAnimation && !shouldExportAnimation(animation)) {\r\n continue;\r\n }\r\n const 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(\r\n `${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 bufferManager,\r\n bufferViews,\r\n accessors,\r\n animationInfo.useQuaternion,\r\n animationSampleRate,\r\n useRightHanded\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 bufferManager\r\n * @param bufferViews\r\n * @param accessors\r\n * @param animationSampleRate\r\n */\r\n public static _CreateMorphTargetAnimationFromMorphTargetAnimations(\r\n babylonNode: Node,\r\n runtimeGLTFAnimation: IAnimation,\r\n idleGLTFAnimations: IAnimation[],\r\n nodeMap: Map<Node, number>,\r\n nodes: INode[],\r\n bufferManager: BufferManager,\r\n bufferViews: IBufferView[],\r\n accessors: IAccessor[],\r\n animationSampleRate: number,\r\n useRightHanded: boolean,\r\n shouldExportAnimation?: (animation: Animation) => boolean\r\n ) {\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 if (shouldExportAnimation && !shouldExportAnimation(animation)) {\r\n continue;\r\n }\r\n const combinedAnimation = new Animation(\r\n `${animation.name}`,\r\n \"influence\",\r\n animation.framePerSecond,\r\n animation.dataType,\r\n animation.loopMode,\r\n animation.enableBlending\r\n );\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 const 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(\r\n 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 bufferManager,\r\n bufferViews,\r\n accessors,\r\n animationInfo.useQuaternion,\r\n animationSampleRate,\r\n useRightHanded,\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 * @internal\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 bufferManager\r\n * @param bufferViews\r\n * @param accessors\r\n * @param animationSampleRate\r\n */\r\n public static _CreateNodeAndMorphAnimationFromAnimationGroups(\r\n babylonScene: Scene,\r\n glTFAnimations: IAnimation[],\r\n nodeMap: Map<Node, number>,\r\n bufferManager: BufferManager,\r\n bufferViews: IBufferView[],\r\n accessors: IAccessor[],\r\n animationSampleRate: number,\r\n leftHandedNodes: Set<Node>,\r\n shouldExportAnimation?: (animation: Animation) => boolean\r\n ) {\r\n let glTFAnimation: IAnimation;\r\n if (babylonScene.animationGroups) {\r\n const animationGroups = babylonScene.animationGroups;\r\n for (const 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 (shouldExportAnimation && !shouldExportAnimation(animation)) {\r\n continue;\r\n }\r\n\r\n const convertToRightHanded = leftHandedNodes.has(target);\r\n\r\n if (this._IsTransformable(target) || (target.length === 1 && this._IsTransformable(target[0]))) {\r\n const animationInfo = _GLTFAnimation._DeduceAnimationInfo(targetAnimation.animation);\r\n if (animationInfo) {\r\n const babylonTransformNode = this._IsTransformable(target) ? target : this._IsTransformable(target[0]) ? target[0] : null;\r\n if (babylonTransformNode) {\r\n _GLTFAnimation._AddAnimation(\r\n `${animation.name}`,\r\n glTFAnimation,\r\n babylonTransformNode,\r\n animation,\r\n animationInfo.dataAccessorType,\r\n animationInfo.animationChannelTargetPath,\r\n nodeMap,\r\n bufferManager,\r\n bufferViews,\r\n accessors,\r\n animationInfo.useQuaternion,\r\n animationSampleRate,\r\n convertToRightHanded\r\n );\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 } else {\r\n // this is the place for the KHR_animation_pointer.\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(\r\n `${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 }\r\n animationKeys.push(morphTargetAnimation.getKeys()[i]);\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(\r\n `${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 bufferManager,\r\n bufferViews,\r\n accessors,\r\n animationInfo.useQuaternion,\r\n animationSampleRate,\r\n false,\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(\r\n name: string,\r\n glTFAnimation: IAnimation,\r\n babylonTransformNode: Node,\r\n animation: Animation,\r\n dataAccessorType: AccessorType,\r\n animationChannelTargetPath: AnimationChannelTargetPath,\r\n nodeMap: Map<Node, number>,\r\n bufferManager: BufferManager,\r\n bufferViews: IBufferView[],\r\n accessors: IAccessor[],\r\n useQuaternion: boolean,\r\n animationSampleRate: number,\r\n convertToRightHanded: boolean,\r\n morphAnimationChannels?: number\r\n ) {\r\n const animationData = _GLTFAnimation._CreateNodeAnimation(babylonTransformNode, animation, animationChannelTargetPath, 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 animationSampler: IAnimationSampler;\r\n let animationChannel: IAnimationChannel;\r\n\r\n if (animationData) {\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 const 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 const nodeIndex = nodeMap.get(babylonTransformNode);\r\n\r\n // Create buffer view and accessor for key frames.\r\n const inputData = new Float32Array(animationData.inputs);\r\n bufferView = bufferManager.createBufferView(inputData);\r\n accessor = bufferManager.createAccessor(bufferView, AccessorType.SCALAR, AccessorComponentType.FLOAT, animationData.inputs.length, undefined, {\r\n min: [animationData.inputsMin],\r\n max: [animationData.inputsMax],\r\n });\r\n accessors.push(accessor);\r\n keyframeAccessorIndex = accessors.length - 1;\r\n\r\n // Perform conversions on keyed values while also building their buffer.\r\n const rotationQuaternion = new Quaternion();\r\n const eulerVec3 = new Vector3();\r\n const position = new Vector3();\r\n const isCamera = babylonTransformNode instanceof Camera;\r\n\r\n const elementCount = GetAccessorElementCount(dataAccessorType);\r\n const outputData = new Float32Array(animationData.outputs.length * elementCount);\r\n animationData.outputs.forEach(function (output: number[], index: number) {\r\n let outputToWrite: number[] = output;\r\n if (convertToRightHanded) {\r\n switch (animationChannelTargetPath) {\r\n case AnimationChannelTargetPath.TRANSLATION:\r\n Vector3.FromArrayToRef(output, 0, position);\r\n ConvertToRightHandedPosition(position);\r\n position.toArray(outputToWrite);\r\n break;\r\n case AnimationChannelTargetPath.ROTATION:\r\n if (output.length === 4) {\r\n Quaternion.FromArrayToRef(output, 0, rotationQuaternion);\r\n } else {\r\n outputToWrite = new Array(4); // Will need 4, not 3, for a quaternion\r\n Vector3.FromArrayToRef(output, 0, eulerVec3);\r\n Quaternion.FromEulerVectorToRef(eulerVec3, rotationQuaternion);\r\n }\r\n\r\n if (isCamera) {\r\n ConvertCameraRotationToGLTF(rotationQuaternion);\r\n } else {\r\n if (!Quaternion.IsIdentity(rotationQuaternion)) {\r\n ConvertToRightHandedRotation(rotationQuaternion);\r\n }\r\n }\r\n\r\n rotationQuaternion.toArray(outputToWrite);\r\n break;\r\n }\r\n } else {\r\n switch (animationChannelTargetPath) {\r\n case AnimationChannelTargetPath.ROTATION:\r\n if (output.length === 4) {\r\n Quaternion.FromArrayToRef(output, 0, rotationQuaternion);\r\n } else {\r\n outputToWrite = new Array(4); // Will need 4, not 3, for a quaternion\r\n Vector3.FromArrayToRef(output, 0, eulerVec3);\r\n Quaternion.FromEulerVectorToRef(eulerVec3, rotationQuaternion);\r\n }\r\n\r\n if (isCamera) {\r\n ConvertCameraRotationToGLTF(rotationQuaternion);\r\n }\r\n\r\n rotationQuaternion.toArray(outputToWrite);\r\n break;\r\n }\r\n }\r\n outputData.set(outputToWrite, index * elementCount);\r\n });\r\n\r\n // Create buffer view and accessor for keyed values.\r\n bufferView = bufferManager.createBufferView(outputData);\r\n accessor = bufferManager.createAccessor(bufferView, dataAccessorType, AccessorComponentType.FLOAT, animationData.outputs.length);\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 sampleRate\r\n * @param inputs input key frames of the animation\r\n * @param outputs output key frame data of the animation\r\n * @param minMaxFrames\r\n * @param minMaxFrames.min\r\n * @param minMaxFrames.max\r\n * @param useQuaternion specifies if quaternions should be used\r\n */\r\n private static _CreateBakedAnimation(\r\n babylonTransformNode: Node,\r\n animation: Animation,\r\n animationChannelTargetPath: AnimationChannelTargetPath,\r\n minFrame: number,\r\n maxFrame: number,\r\n fps: number,\r\n sampleRate: number,\r\n inputs: number[],\r\n outputs: number[][],\r\n minMaxFrames: { min: number; max: number },\r\n useQuaternion: boolean\r\n ) {\r\n let value: number | Vector3 | Quaternion;\r\n const 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 const 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) {\r\n // set the first frame to itself\r\n endFrame = currKeyFrame.frame;\r\n } else {\r\n continue;\r\n }\r\n } else {\r\n endFrame = nextKeyFrame.frame;\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 } 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 const 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, 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(\r\n factor: number,\r\n babylonTransformNode: Node,\r\n animation: Animation,\r\n animationChannelTargetPath: AnimationChannelTargetPath,\r\n useQuaternion: boolean\r\n ): Vector3 | Quaternion {\r\n const basePositionRotationOrScale = _GLTFAnimation._GetBasePositionRotationOrScale(babylonTransformNode, animationChannelTargetPath, useQuaternion);\r\n // handles single component x, y, z or w component animation by using a base property and animating over a component.\r\n const property = animation.targetProperty.split(\".\");\r\n const componentName = property ? property[1] : \"\"; // x, y, z, or w component\r\n const value = useQuaternion ? Quaternion.FromArray(basePositionRotationOrScale).normalize() : Vector3.FromArray(basePositionRotationOrScale);\r\n\r\n switch (componentName) {\r\n case \"x\":\r\n case \"y\":\r\n case \"z\": {\r\n value[componentName] = 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 name \"${componentName}\"!`);\r\n }\r\n }\r\n\r\n return value;\r\n }\r\n\r\n private static _SetInterpolatedValue(\r\n babylonTransformNode: Node,\r\n value: number | Vector3 | Quaternion,\r\n time: number,\r\n animation: Animation,\r\n animationChannelTargetPath: AnimationChannelTargetPath,\r\n quaternionCache: Quaternion,\r\n inputs: number[],\r\n outputs: number[][],\r\n useQuaternion: boolean\r\n ) {\r\n let cacheValue: Vector3 | Quaternion | number;\r\n inputs.push(time);\r\n\r\n if (animationChannelTargetPath === AnimationChannelTargetPath.WEIGHTS) {\r\n outputs.push([value as number]);\r\n return;\r\n }\r\n\r\n if (animation.dataType === Animation.ANIMATIONTYPE_FLOAT) {\r\n value = this._ConvertFactorToVector3OrQuaternion(value as number, babylonTransformNode, animation, animationChannelTargetPath, useQuaternion);\r\n }\r\n\r\n if (animationChannelTargetPath === AnimationChannelTargetPath.ROTATION) {\r\n if (useQuaternion) {\r\n quaternionCache = value as Quaternion;\r\n } else {\r\n cacheValue = value as Vector3;\r\n Quaternion.RotationYawPitchRollToRef(cacheValue.y, cacheValue.x, cacheValue.z, quaternionCache);\r\n }\r\n outputs.push(quaternionCache.asArray());\r\n } else {\r\n // scaling and position animation\r\n cacheValue = value as Vector3;\r\n outputs.push(cacheValue.asArray());\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 inputs Array to store the key frame times\r\n * @param outputs Array to store the key frame data\r\n * @param useQuaternion Specifies if quaternions are used in the animation\r\n */\r\n private static _CreateLinearOrStepAnimation(\r\n babylonTransformNode: Node,\r\n animation: Animation,\r\n animationChannelTargetPath: AnimationChannelTargetPath,\r\n inputs: number[],\r\n outputs: number[][],\r\n useQuaternion: boolean\r\n ) {\r\n for (const keyFrame of animation.getKeys()) {\r\n inputs.push(keyFrame.frame / animation.framePerSecond); // keyframes in seconds.\r\n _GLTFAnimation._AddKeyframeValue(keyFrame, animation, outputs, animationChannelTargetPath, babylonTransformNode, 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 inputs Array to store the key frame times\r\n * @param outputs Array to store the key frame data\r\n * @param useQuaternion Specifies if quaternions are used in the animation\r\n */\r\n private static _CreateCubicSplineAnimation(\r\n babylonTransformNode: Node,\r\n animation: Animation,\r\n animationChannelTargetPath: AnimationChannelTargetPath,\r\n inputs: number[],\r\n outputs: number[][],\r\n useQuaternion: boolean\r\n ) {\r\n animation.getKeys().forEach(function (keyFrame) {\r\n inputs.push(keyFrame.frame / animation.framePerSecond); // keyframes in seconds.\r\n _GLTFAnimation._AddSplineTangent(_TangentType.INTANGENT, outputs, animationChannelTargetPath, AnimationSamplerInterpolation.CUBICSPLINE, keyFrame, useQuaternion);\r\n _GLTFAnimation._AddKeyframeValue(keyFrame, animation, outputs, animationChannelTargetPath, babylonTransformNode, useQuaternion);\r\n\r\n _GLTFAnimation._AddSplineTangent(_TangentType.OUTTANGENT, outputs, animationChannelTargetPath, AnimationSamplerInterpolation.CUBICSPLINE, keyFrame, useQuaternion);\r\n });\r\n }\r\n\r\n private static _GetBasePositionRotationOrScale(babylonTransformNode: Node, animationChannelTargetPath: AnimationChannelTargetPath, useQuaternion: boolean) {\r\n let basePositionRotationOrScale: number[];\r\n if (animationChannelTargetPath === AnimationChannelTargetPath.ROTATION) {\r\n if (useQuaternion) {\r\n const q = (babylonTransformNode as TransformNode).rotationQuaternion;\r\n basePositionRotationOrScale = (q ?? Quaternion.Identity()).asArray();\r\n } else {\r\n const r: Vector3 = (babylonTransformNode as TransformNode).rotation;\r\n basePositionRotationOrScale = (r ?? Vector3.Zero()).asArray();\r\n }\r\n } else if (animationChannelTargetPath === AnimationChannelTargetPath.TRANSLATION) {\r\n const p: Vector3 = (babylonTransformNode as TransformNode).position;\r\n basePositionRotationOrScale = (p ?? Vector3.Zero()).asArray();\r\n } else {\r\n // scale\r\n const s: Vector3 = (babylonTransformNode as TransformNode).scaling;\r\n basePositionRotationOrScale = (s ?? Vector3.One()).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 babylonTransformNode\r\n * @param useQuaternion\r\n */\r\n private static _AddKeyframeValue(\r\n keyFrame: IAnimationKey,\r\n animation: Animation,\r\n outputs: number[][],\r\n animationChannelTargetPath: AnimationChannelTargetPath,\r\n babylonTransformNode: Node,\r\n useQuaternion: boolean\r\n ) {\r\n let newPositionRotationOrScale: Nullable<Vector3 | Quaternion | number>;\r\n const animationType = animation.dataType;\r\n if (animationType === Animation.ANIMATIONTYPE_VECTOR3) {\r\n let value = keyFrame.value.asArray();\r\n if (animationChannelTargetPath === AnimationChannelTargetPath.ROTATION) {\r\n const array = Vector3.FromArray(value);\r\n const rotationQuaternion = Quaternion.RotationYawPitchRoll(array.y, array.x, array.z);\r\n value = rotationQuaternion.asArray();\r\n }\r\n outputs.push(value); // scale vector.\r\n } else if (animationType === Animation.ANIMATIONTYPE_FLOAT) {\r\n if (animationChannelTargetPath === AnimationChannelTargetPath.WEIGHTS) {\r\n outputs.push([keyFrame.value]);\r\n } else {\r\n // 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(\r\n keyFrame.value as number,\r\n babylonTransformNode,\r\n animation,\r\n animationChannelTargetPath,\r\n useQuaternion\r\n );\r\n if (newPositionRotationOrScale) {\r\n if (animationChannelTargetPath === AnimationChannelTargetPath.ROTATION) {\r\n const posRotScale = useQuaternion\r\n ? (newPositionRotationOrScale as Quaternion)\r\n : Quaternion.RotationYawPitchRoll(newPositionRotationOrScale.y, newPositionRotationOrScale.x, newPositionRotationOrScale.z).normalize();\r\n outputs.push(posRotScale.asArray());\r\n }\r\n outputs.push(newPositionRotationOrScale.asArray());\r\n }\r\n }\r\n } else if (animationType === Animation.ANIMATIONTYPE_QUATERNION) {\r\n outputs.push((keyFrame.value as Quaternion).normalize().asArray());\r\n } else {\r\n Tools.Error(\"glTFAnimation: Unsupported key frame values for animation!\");\r\n }\r\n }\r\n\r\n /**\r\n * @internal\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(\r\n keyFrames: IAnimationKey[],\r\n animationChannelTargetPath: AnimationChannelTargetPath,\r\n useQuaternion: boolean\r\n ): { 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 } else {\r\n interpolationType = AnimationSamplerInterpolation.CUBICSPLINE;\r\n }\r\n } else {\r\n if (interpolationType) {\r\n if (\r\n interpolationType === AnimationSamplerInterpolation.CUBICSPLINE ||\r\n (key.interpolation && key.interpolation === AnimationKeyInterpolation.STEP && interpolationType !== AnimationSamplerInterpolation.STEP)\r\n ) {\r\n interpolationType = AnimationSamplerInterpolation.LINEAR;\r\n shouldBakeAnimation = true;\r\n break;\r\n }\r\n } else {\r\n if (key.interpolation && key.interpolation === AnimationKeyInterpolation.STEP) {\r\n interpolationType = AnimationSamplerInterpolation.STEP;\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 useQuaternion Specifies if quaternions are used\r\n */\r\n private static _AddSplineTangent(\r\n tangentType: _TangentType,\r\n outputs: number[][],\r\n animationChannelTargetPath: AnimationChannelTargetPath,\r\n interpolation: AnimationSamplerInterpolation,\r\n keyFrame: IAnimationKey,\r\n useQuaternion: boolean\r\n ) {\r\n let tangent: number[];\r\n const 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 } else {\r\n const array = tangentValue as Vector3;\r\n tangent = Quaternion.RotationYawPitchRoll(array.y, array.x, array.z).asArray();\r\n }\r\n } else {\r\n tangent = [0, 0, 0, 0];\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 } else {\r\n if (tangentValue) {\r\n tangent = (tangentValue as Vector3).asArray();\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":["../../../../../dev/serializers/src/glTF/2.0/glTFAnimation.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,6CAA+B;AAC7D,OAAO,EAAE,KAAK,EAAE,sCAAwB;AACxC,OAAO,EAAE,SAAS,EAAE,gDAAkC;AACtD,OAAO,EAAE,aAAa,EAAE,gDAAkC;AAE1D,OAAO,EAAE,WAAW,EAAE,6CAA+B;AACrD,OAAO,EAAE,IAAI,EAAE,uCAAyB;AAKxC,OAAO,EAAE,MAAM,EAAE,0CAA4B;AAC7C,OAAO,EAAE,KAAK,EAAE,wCAA0B;AAE1C,OAAO,EAAE,uBAAuB,EAAE,4BAA4B,EAAE,2BAA2B,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAC;AAiDnJ;;;GAGG;AACH,gEAAgE;AAChE,IAAK,YASJ;AATD,WAAK,YAAY;IACb;;OAEG;IACH,yDAAS,CAAA;IACT;;OAEG;IACH,2DAAU,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C;qBAAM,CAAC;oBACJ,OAAO,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;gBAC3B,CAAC;YACL,CAAC;iBAAM,IAAI,0BAA0B,uDAAuC,EAAE,CAAC;gBAC3E,IAAI,YAAY,EAAE,CAAC;oBACf,OAAO,GAAG,CAAC,YAAsB,CAAC,CAAC;gBACvC,CAAC;qBAAM,CAAC;oBACJ,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC;gBAClB,CAAC;YACL,CAAC;iBAAM,CAAC;gBACJ,IAAI,YAAY,EAAE,CAAC;oBACf,OAAO,GAAI,YAAwB,CAAC,OAAO,EAAE,CAAC;gBAClD,CAAC;qBAAM,CAAC;oBACJ,OAAO,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;gBACxB,CAAC;YACL,CAAC;YAED,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC1B,CAAC;IACL,CAAC;IAED;;;;OAIG;IACK,MAAM,CAAC,yBAAyB,CAAC,SAA0B;QAC/D,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;IAClC,CAAC;CACJ","sourcesContent":["import type { IAnimation, INode, IBufferView, IAccessor, IAnimationSampler, IAnimationChannel } from \"babylonjs-gltf2interface\";\r\nimport { AnimationSamplerInterpolation, AnimationChannelTargetPath, AccessorType, AccessorComponentType } from \"babylonjs-gltf2interface\";\r\nimport type { Node } from \"core/node\";\r\nimport type { Nullable } from \"core/types\";\r\nimport { Vector3, Quaternion } from \"core/Maths/math.vector\";\r\nimport { Tools } from \"core/Misc/tools\";\r\nimport { Animation } from \"core/Animations/animation\";\r\nimport { TransformNode } from \"core/Meshes/transformNode\";\r\nimport type { Scene } from \"core/scene\";\r\nimport { MorphTarget } from \"core/Morph/morphTarget\";\r\nimport { Mesh } from \"core/Meshes/mesh\";\r\n\r\nimport type { IAnimationKey } from \"core/Animations/animationKey\";\r\nimport { AnimationKeyInterpolation } from \"core/Animations/animationKey\";\r\n\r\nimport { Camera } from \"core/Cameras/camera\";\r\nimport { Light } from \"core/Lights/light\";\r\nimport type { BufferManager } from \"./bufferManager\";\r\nimport { GetAccessorElementCount, ConvertToRightHandedPosition, ConvertCameraRotationToGLTF, ConvertToRightHandedRotation } from \"./glTFUtilities\";\r\n\r\n/**\r\n * @internal\r\n * Interface to store animation data.\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\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 * @internal\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\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 * @internal\r\n * Enum for handling in tangent and out tangent.\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\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/**\r\n * @internal\r\n * Utility class for generating glTF animation data from BabylonJS.\r\n */\r\nexport class _GLTFAnimation {\r\n /**\r\n * Determine if a node is transformable - ie has properties it should be part of animation of transformation.\r\n * @param babylonNode the node to test\r\n * @returns true if can be animated, false otherwise. False if the parameter is null or undefined.\r\n */\r\n private static _IsTransformable(babylonNode: Node): boolean {\r\n return babylonNode && (babylonNode instanceof TransformNode || babylonNode instanceof Camera || babylonNode instanceof Light);\r\n }\r\n\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 useQuaternion - Specifies if quaternions are used.\r\n * @returns nullable IAnimationData\r\n */\r\n public static _CreateNodeAnimation(\r\n babylonTransformNode: Node,\r\n animation: Animation,\r\n animationChannelTargetPath: AnimationChannelTargetPath,\r\n useQuaternion: boolean,\r\n animationSampleRate: number\r\n ): Nullable<_IAnimationData> {\r\n if (this._IsTransformable(babylonTransformNode)) {\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\r\n const interpolation = interpolationOrBake.interpolationType;\r\n const shouldBakeAnimation = interpolationOrBake.shouldBakeAnimation;\r\n\r\n if (shouldBakeAnimation) {\r\n _GLTFAnimation._CreateBakedAnimation(\r\n babylonTransformNode,\r\n animation,\r\n animationChannelTargetPath,\r\n minMaxKeyFrames.min,\r\n minMaxKeyFrames.max,\r\n animation.framePerSecond,\r\n animationSampleRate,\r\n inputs,\r\n outputs,\r\n minMaxKeyFrames,\r\n useQuaternion\r\n );\r\n } else {\r\n if (interpolation === AnimationSamplerInterpolation.LINEAR || interpolation === AnimationSamplerInterpolation.STEP) {\r\n _GLTFAnimation._CreateLinearOrStepAnimation(babylonTransformNode, animation, animationChannelTargetPath, inputs, outputs, useQuaternion);\r\n } else if (interpolation === AnimationSamplerInterpolation.CUBICSPLINE) {\r\n _GLTFAnimation._CreateCubicSplineAnimation(babylonTransformNode, animation, animationChannelTargetPath, inputs, outputs, useQuaternion);\r\n } else {\r\n _GLTFAnimation._CreateBakedAnimation(\r\n babylonTransformNode,\r\n animation,\r\n animationChannelTargetPath,\r\n minMaxKeyFrames.min,\r\n minMaxKeyFrames.max,\r\n animation.framePerSecond,\r\n animationSampleRate,\r\n inputs,\r\n outputs,\r\n minMaxKeyFrames,\r\n useQuaternion\r\n );\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\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 const 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 } 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 bufferManager\r\n * @param bufferViews\r\n * @param accessors\r\n * @param animationSampleRate\r\n */\r\n public static _CreateNodeAnimationFromNodeAnimations(\r\n babylonNode: Node,\r\n runtimeGLTFAnimation: IAnimation,\r\n idleGLTFAnimations: IAnimation[],\r\n nodeMap: Map<Node, number>,\r\n nodes: INode[],\r\n bufferManager: BufferManager,\r\n bufferViews: IBufferView[],\r\n accessors: IAccessor[],\r\n animationSampleRate: number,\r\n useRightHanded: boolean,\r\n shouldExportAnimation?: (animation: Animation) => boolean\r\n ) {\r\n let glTFAnimation: IAnimation;\r\n if (_GLTFAnimation._IsTransformable(babylonNode)) {\r\n if (babylonNode.animations) {\r\n for (const animation of babylonNode.animations) {\r\n if (shouldExportAnimation && !shouldExportAnimation(animation)) {\r\n continue;\r\n }\r\n const 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(\r\n `${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 bufferManager,\r\n bufferViews,\r\n accessors,\r\n animationInfo.useQuaternion,\r\n animationSampleRate,\r\n useRightHanded\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 bufferManager\r\n * @param bufferViews\r\n * @param accessors\r\n * @param animationSampleRate\r\n */\r\n public static _CreateMorphTargetAnimationFromMorphTargetAnimations(\r\n babylonNode: Node,\r\n runtimeGLTFAnimation: IAnimation,\r\n idleGLTFAnimations: IAnimation[],\r\n nodeMap: Map<Node, number>,\r\n nodes: INode[],\r\n bufferManager: BufferManager,\r\n bufferViews: IBufferView[],\r\n accessors: IAccessor[],\r\n animationSampleRate: number,\r\n useRightHanded: boolean,\r\n shouldExportAnimation?: (animation: Animation) => boolean\r\n ) {\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 if (shouldExportAnimation && !shouldExportAnimation(animation)) {\r\n continue;\r\n }\r\n const combinedAnimation = new Animation(\r\n `${animation.name}`,\r\n \"influence\",\r\n animation.framePerSecond,\r\n animation.dataType,\r\n animation.loopMode,\r\n animation.enableBlending\r\n );\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 const 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(\r\n 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 bufferManager,\r\n bufferViews,\r\n accessors,\r\n animationInfo.useQuaternion,\r\n animationSampleRate,\r\n useRightHanded,\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 * @internal\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 bufferManager\r\n * @param bufferViews\r\n * @param accessors\r\n * @param animationSampleRate\r\n */\r\n public static _CreateNodeAndMorphAnimationFromAnimationGroups(\r\n babylonScene: Scene,\r\n glTFAnimations: IAnimation[],\r\n nodeMap: Map<Node, number>,\r\n bufferManager: BufferManager,\r\n bufferViews: IBufferView[],\r\n accessors: IAccessor[],\r\n animationSampleRate: number,\r\n leftHandedNodes: Set<Node>,\r\n shouldExportAnimation?: (animation: Animation) => boolean\r\n ) {\r\n let glTFAnimation: IAnimation;\r\n if (babylonScene.animationGroups) {\r\n const animationGroups = babylonScene.animationGroups;\r\n for (const 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 (shouldExportAnimation && !shouldExportAnimation(animation)) {\r\n continue;\r\n }\r\n\r\n const convertToRightHanded = leftHandedNodes.has(target);\r\n\r\n if (this._IsTransformable(target) || (target.length === 1 && this._IsTransformable(target[0]))) {\r\n const animationInfo = _GLTFAnimation._DeduceAnimationInfo(targetAnimation.animation);\r\n if (animationInfo) {\r\n const babylonTransformNode = this._IsTransformable(target) ? target : this._IsTransformable(target[0]) ? target[0] : null;\r\n if (babylonTransformNode) {\r\n _GLTFAnimation._AddAnimation(\r\n `${animation.name}`,\r\n glTFAnimation,\r\n babylonTransformNode,\r\n animation,\r\n animationInfo.dataAccessorType,\r\n animationInfo.animationChannelTargetPath,\r\n nodeMap,\r\n bufferManager,\r\n bufferViews,\r\n accessors,\r\n animationInfo.useQuaternion,\r\n animationSampleRate,\r\n convertToRightHanded\r\n );\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 : (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 } else {\r\n // this is the place for the KHR_animation_pointer.\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(\r\n `${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 }\r\n animationKeys.push(morphTargetAnimation.getKeys()[i]);\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(\r\n `${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 bufferManager,\r\n bufferViews,\r\n accessors,\r\n animationInfo.useQuaternion,\r\n animationSampleRate,\r\n false,\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(\r\n name: string,\r\n glTFAnimation: IAnimation,\r\n babylonTransformNode: Node,\r\n animation: Animation,\r\n dataAccessorType: AccessorType,\r\n animationChannelTargetPath: AnimationChannelTargetPath,\r\n nodeMap: Map<Node, number>,\r\n bufferManager: BufferManager,\r\n bufferViews: IBufferView[],\r\n accessors: IAccessor[],\r\n useQuaternion: boolean,\r\n animationSampleRate: number,\r\n convertToRightHanded: boolean,\r\n morphAnimationChannels?: number\r\n ) {\r\n const animationData = _GLTFAnimation._CreateNodeAnimation(babylonTransformNode, animation, animationChannelTargetPath, 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 animationSampler: IAnimationSampler;\r\n let animationChannel: IAnimationChannel;\r\n\r\n if (animationData) {\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 const 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 const nodeIndex = nodeMap.get(babylonTransformNode);\r\n\r\n // Create buffer view and accessor for key frames.\r\n const inputData = new Float32Array(animationData.inputs);\r\n bufferView = bufferManager.createBufferView(inputData);\r\n accessor = bufferManager.createAccessor(bufferView, AccessorType.SCALAR, AccessorComponentType.FLOAT, animationData.inputs.length, undefined, {\r\n min: [animationData.inputsMin],\r\n max: [animationData.inputsMax],\r\n });\r\n accessors.push(accessor);\r\n keyframeAccessorIndex = accessors.length - 1;\r\n\r\n // Perform conversions on keyed values while also building their buffer.\r\n const rotationQuaternion = new Quaternion();\r\n const eulerVec3 = new Vector3();\r\n const position = new Vector3();\r\n const isCamera = babylonTransformNode instanceof Camera;\r\n\r\n const elementCount = GetAccessorElementCount(dataAccessorType);\r\n const outputData = new Float32Array(animationData.outputs.length * elementCount);\r\n animationData.outputs.forEach(function (output: number[], index: number) {\r\n let outputToWrite: number[] = output;\r\n if (convertToRightHanded) {\r\n switch (animationChannelTargetPath) {\r\n case AnimationChannelTargetPath.TRANSLATION:\r\n Vector3.FromArrayToRef(output, 0, position);\r\n ConvertToRightHandedPosition(position);\r\n position.toArray(outputToWrite);\r\n break;\r\n case AnimationChannelTargetPath.ROTATION:\r\n if (output.length === 4) {\r\n Quaternion.FromArrayToRef(output, 0, rotationQuaternion);\r\n } else {\r\n outputToWrite = new Array(4); // Will need 4, not 3, for a quaternion\r\n Vector3.FromArrayToRef(output, 0, eulerVec3);\r\n Quaternion.FromEulerVectorToRef(eulerVec3, rotationQuaternion);\r\n }\r\n\r\n if (isCamera) {\r\n ConvertCameraRotationToGLTF(rotationQuaternion);\r\n } else {\r\n if (!Quaternion.IsIdentity(rotationQuaternion)) {\r\n ConvertToRightHandedRotation(rotationQuaternion);\r\n }\r\n }\r\n\r\n rotationQuaternion.toArray(outputToWrite);\r\n break;\r\n }\r\n } else {\r\n switch (animationChannelTargetPath) {\r\n case AnimationChannelTargetPath.ROTATION:\r\n if (output.length === 4) {\r\n Quaternion.FromArrayToRef(output, 0, rotationQuaternion);\r\n } else {\r\n outputToWrite = new Array(4); // Will need 4, not 3, for a quaternion\r\n Vector3.FromArrayToRef(output, 0, eulerVec3);\r\n Quaternion.FromEulerVectorToRef(eulerVec3, rotationQuaternion);\r\n }\r\n\r\n if (isCamera) {\r\n ConvertCameraRotationToGLTF(rotationQuaternion);\r\n }\r\n\r\n rotationQuaternion.toArray(outputToWrite);\r\n break;\r\n }\r\n }\r\n outputData.set(outputToWrite, index * elementCount);\r\n });\r\n\r\n // Create buffer view and accessor for keyed values.\r\n bufferView = bufferManager.createBufferView(outputData);\r\n accessor = bufferManager.createAccessor(bufferView, dataAccessorType, AccessorComponentType.FLOAT, animationData.outputs.length);\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 sampleRate\r\n * @param inputs input key frames of the animation\r\n * @param outputs output key frame data of the animation\r\n * @param minMaxFrames\r\n * @param minMaxFrames.min\r\n * @param minMaxFrames.max\r\n * @param useQuaternion specifies if quaternions should be used\r\n */\r\n private static _CreateBakedAnimation(\r\n babylonTransformNode: Node,\r\n animation: Animation,\r\n animationChannelTargetPath: AnimationChannelTargetPath,\r\n minFrame: number,\r\n maxFrame: number,\r\n fps: number,\r\n sampleRate: number,\r\n inputs: number[],\r\n outputs: number[][],\r\n minMaxFrames: { min: number; max: number },\r\n useQuaternion: boolean\r\n ) {\r\n let value: number | Vector3 | Quaternion;\r\n const 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 const 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) {\r\n // set the first frame to itself\r\n endFrame = currKeyFrame.frame;\r\n } else {\r\n continue;\r\n }\r\n } else {\r\n endFrame = nextKeyFrame.frame;\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 } 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 const 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, 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(\r\n factor: number,\r\n babylonTransformNode: Node,\r\n animation: Animation,\r\n animationChannelTargetPath: AnimationChannelTargetPath,\r\n useQuaternion: boolean\r\n ): Vector3 | Quaternion {\r\n const basePositionRotationOrScale = _GLTFAnimation._GetBasePositionRotationOrScale(babylonTransformNode, animationChannelTargetPath, useQuaternion);\r\n // handles single component x, y, z or w component animation by using a base property and animating over a component.\r\n const property = animation.targetProperty.split(\".\");\r\n const componentName = property ? property[1] : \"\"; // x, y, z, or w component\r\n const value = useQuaternion ? Quaternion.FromArray(basePositionRotationOrScale).normalize() : Vector3.FromArray(basePositionRotationOrScale);\r\n\r\n switch (componentName) {\r\n case \"x\":\r\n case \"y\":\r\n case \"z\": {\r\n value[componentName] = 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 name \"${componentName}\"!`);\r\n }\r\n }\r\n\r\n return value;\r\n }\r\n\r\n private static _SetInterpolatedValue(\r\n babylonTransformNode: Node,\r\n value: number | Vector3 | Quaternion,\r\n time: number,\r\n animation: Animation,\r\n animationChannelTargetPath: AnimationChannelTargetPath,\r\n quaternionCache: Quaternion,\r\n inputs: number[],\r\n outputs: number[][],\r\n useQuaternion: boolean\r\n ) {\r\n let cacheValue: Vector3 | Quaternion | number;\r\n inputs.push(time);\r\n\r\n if (animationChannelTargetPath === AnimationChannelTargetPath.WEIGHTS) {\r\n outputs.push([value as number]);\r\n return;\r\n }\r\n\r\n if (animation.dataType === Animation.ANIMATIONTYPE_FLOAT) {\r\n value = this._ConvertFactorToVector3OrQuaternion(value as number, babylonTransformNode, animation, animationChannelTargetPath, useQuaternion);\r\n }\r\n\r\n if (animationChannelTargetPath === AnimationChannelTargetPath.ROTATION) {\r\n if (useQuaternion) {\r\n quaternionCache = value as Quaternion;\r\n } else {\r\n cacheValue = value as Vector3;\r\n Quaternion.RotationYawPitchRollToRef(cacheValue.y, cacheValue.x, cacheValue.z, quaternionCache);\r\n }\r\n outputs.push(quaternionCache.asArray());\r\n } else {\r\n // scaling and position animation\r\n cacheValue = value as Vector3;\r\n outputs.push(cacheValue.asArray());\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 inputs Array to store the key frame times\r\n * @param outputs Array to store the key frame data\r\n * @param useQuaternion Specifies if quaternions are used in the animation\r\n */\r\n private static _CreateLinearOrStepAnimation(\r\n babylonTransformNode: Node,\r\n animation: Animation,\r\n animationChannelTargetPath: AnimationChannelTargetPath,\r\n inputs: number[],\r\n outputs: number[][],\r\n useQuaternion: boolean\r\n ) {\r\n for (const keyFrame of animation.getKeys()) {\r\n inputs.push(keyFrame.frame / animation.framePerSecond); // keyframes in seconds.\r\n _GLTFAnimation._AddKeyframeValue(keyFrame, animation, outputs, animationChannelTargetPath, babylonTransformNode, 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 inputs Array to store the key frame times\r\n * @param outputs Array to store the key frame data\r\n * @param useQuaternion Specifies if quaternions are used in the animation\r\n */\r\n private static _CreateCubicSplineAnimation(\r\n babylonTransformNode: Node,\r\n animation: Animation,\r\n animationChannelTargetPath: AnimationChannelTargetPath,\r\n inputs: number[],\r\n outputs: number[][],\r\n useQuaternion: boolean\r\n ) {\r\n animation.getKeys().forEach(function (keyFrame) {\r\n inputs.push(keyFrame.frame / animation.framePerSecond); // keyframes in seconds.\r\n _GLTFAnimation._AddSplineTangent(_TangentType.INTANGENT, outputs, animationChannelTargetPath, AnimationSamplerInterpolation.CUBICSPLINE, keyFrame, useQuaternion);\r\n _GLTFAnimation._AddKeyframeValue(keyFrame, animation, outputs, animationChannelTargetPath, babylonTransformNode, useQuaternion);\r\n\r\n _GLTFAnimation._AddSplineTangent(_TangentType.OUTTANGENT, outputs, animationChannelTargetPath, AnimationSamplerInterpolation.CUBICSPLINE, keyFrame, useQuaternion);\r\n });\r\n }\r\n\r\n private static _GetBasePositionRotationOrScale(babylonTransformNode: Node, animationChannelTargetPath: AnimationChannelTargetPath, useQuaternion: boolean) {\r\n let basePositionRotationOrScale: number[];\r\n if (animationChannelTargetPath === AnimationChannelTargetPath.ROTATION) {\r\n if (useQuaternion) {\r\n const q = (babylonTransformNode as TransformNode).rotationQuaternion;\r\n basePositionRotationOrScale = (q ?? Quaternion.Identity()).asArray();\r\n } else {\r\n const r: Vector3 = (babylonTransformNode as TransformNode).rotation;\r\n basePositionRotationOrScale = (r ?? Vector3.Zero()).asArray();\r\n }\r\n } else if (animationChannelTargetPath === AnimationChannelTargetPath.TRANSLATION) {\r\n const p: Vector3 = (babylonTransformNode as TransformNode).position;\r\n basePositionRotationOrScale = (p ?? Vector3.Zero()).asArray();\r\n } else {\r\n // scale\r\n const s: Vector3 = (babylonTransformNode as TransformNode).scaling;\r\n basePositionRotationOrScale = (s ?? Vector3.One()).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 babylonTransformNode\r\n * @param useQuaternion\r\n */\r\n private static _AddKeyframeValue(\r\n keyFrame: IAnimationKey,\r\n animation: Animation,\r\n outputs: number[][],\r\n animationChannelTargetPath: AnimationChannelTargetPath,\r\n babylonTransformNode: Node,\r\n useQuaternion: boolean\r\n ) {\r\n let newPositionRotationOrScale: Nullable<Vector3 | Quaternion | number>;\r\n const animationType = animation.dataType;\r\n if (animationType === Animation.ANIMATIONTYPE_VECTOR3) {\r\n let value = keyFrame.value.asArray();\r\n if (animationChannelTargetPath === AnimationChannelTargetPath.ROTATION) {\r\n const array = Vector3.FromArray(value);\r\n const rotationQuaternion = Quaternion.RotationYawPitchRoll(array.y, array.x, array.z);\r\n value = rotationQuaternion.asArray();\r\n }\r\n outputs.push(value); // scale vector.\r\n } else if (animationType === Animation.ANIMATIONTYPE_FLOAT) {\r\n if (animationChannelTargetPath === AnimationChannelTargetPath.WEIGHTS) {\r\n outputs.push([keyFrame.value]);\r\n } else {\r\n // 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(\r\n keyFrame.value as number,\r\n babylonTransformNode,\r\n animation,\r\n animationChannelTargetPath,\r\n useQuaternion\r\n );\r\n if (newPositionRotationOrScale) {\r\n if (animationChannelTargetPath === AnimationChannelTargetPath.ROTATION) {\r\n const posRotScale = useQuaternion\r\n ? (newPositionRotationOrScale as Quaternion)\r\n : Quaternion.RotationYawPitchRoll(newPositionRotationOrScale.y, newPositionRotationOrScale.x, newPositionRotationOrScale.z).normalize();\r\n outputs.push(posRotScale.asArray());\r\n }\r\n outputs.push(newPositionRotationOrScale.asArray());\r\n }\r\n }\r\n } else if (animationType === Animation.ANIMATIONTYPE_QUATERNION) {\r\n outputs.push((keyFrame.value as Quaternion).normalize().asArray());\r\n } else {\r\n Tools.Error(\"glTFAnimation: Unsupported key frame values for animation!\");\r\n }\r\n }\r\n\r\n /**\r\n * @internal\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(\r\n keyFrames: IAnimationKey[],\r\n animationChannelTargetPath: AnimationChannelTargetPath,\r\n useQuaternion: boolean\r\n ): { 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 } else {\r\n interpolationType = AnimationSamplerInterpolation.CUBICSPLINE;\r\n }\r\n } else {\r\n if (interpolationType) {\r\n if (\r\n interpolationType === AnimationSamplerInterpolation.CUBICSPLINE ||\r\n (key.interpolation && key.interpolation === AnimationKeyInterpolation.STEP && interpolationType !== AnimationSamplerInterpolation.STEP)\r\n ) {\r\n interpolationType = AnimationSamplerInterpolation.LINEAR;\r\n shouldBakeAnimation = true;\r\n break;\r\n }\r\n } else {\r\n if (key.interpolation && key.interpolation === AnimationKeyInterpolation.STEP) {\r\n interpolationType = AnimationSamplerInterpolation.STEP;\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 useQuaternion Specifies if quaternions are used\r\n */\r\n private static _AddSplineTangent(\r\n tangentType: _TangentType,\r\n outputs: number[][],\r\n animationChannelTargetPath: AnimationChannelTargetPath,\r\n interpolation: AnimationSamplerInterpolation,\r\n keyFrame: IAnimationKey,\r\n useQuaternion: boolean\r\n ) {\r\n let tangent: number[];\r\n const 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 } else {\r\n const array = tangentValue as Vector3;\r\n tangent = Quaternion.RotationYawPitchRoll(array.y, array.x, array.z).asArray();\r\n }\r\n } else {\r\n tangent = [0, 0, 0, 0];\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 } else {\r\n if (tangentValue) {\r\n tangent = (tangentValue as Vector3).asArray();\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"]}
@@ -52,8 +52,8 @@ export declare class GLTFExporter {
52
52
  readonly _materialNeedsUVsSet: Set<Material>;
53
53
  private static readonly _ExtensionNames;
54
54
  private static readonly _ExtensionFactories;
55
- private _applyExtension;
56
- private _applyExtensions;
55
+ private _ApplyExtension;
56
+ private _ApplyExtensions;
57
57
  _extensionsPreExportTextureAsync(context: string, babylonTexture: Texture, mimeType: ImageMimeType): Promise<Nullable<BaseTexture>>;
58
58
  _extensionsPostExportNodeAsync(context: string, node: INode, babylonNode: Node, nodeMap: Map<Node, number>, convertToRightHanded: boolean): Promise<Nullable<INode>>;
59
59
  _extensionsPostExportMaterialAsync(context: string, material: IMaterial, babylonMaterial: Material): Promise<Nullable<IMaterial>>;
@@ -129,31 +129,37 @@ class ExporterState {
129
129
  }
130
130
  /** @internal */
131
131
  export class GLTFExporter {
132
- _applyExtension(node, extensions, index, actionAsync) {
132
+ // eslint-disable-next-line @typescript-eslint/naming-convention
133
+ _ApplyExtension(node, extensions, index, actionAsync) {
133
134
  if (index >= extensions.length) {
134
135
  return Promise.resolve(node);
135
136
  }
136
137
  const currentPromise = actionAsync(extensions[index], node);
137
138
  if (!currentPromise) {
138
- return this._applyExtension(node, extensions, index + 1, actionAsync);
139
+ return this._ApplyExtension(node, extensions, index + 1, actionAsync);
139
140
  }
140
- return currentPromise.then((newNode) => (newNode ? this._applyExtension(newNode, extensions, index + 1, actionAsync) : null));
141
+ return currentPromise.then((newNode) => (newNode ? this._ApplyExtension(newNode, extensions, index + 1, actionAsync) : null));
141
142
  }
142
- _applyExtensions(node, actionAsync) {
143
+ // eslint-disable-next-line @typescript-eslint/naming-convention
144
+ _ApplyExtensions(node, actionAsync) {
143
145
  const extensions = [];
144
146
  for (const name of GLTFExporter._ExtensionNames) {
145
147
  extensions.push(this._extensions[name]);
146
148
  }
147
- return this._applyExtension(node, extensions, 0, actionAsync);
149
+ return this._ApplyExtension(node, extensions, 0, actionAsync);
148
150
  }
149
151
  _extensionsPreExportTextureAsync(context, babylonTexture, mimeType) {
150
- return this._applyExtensions(babylonTexture, (extension, node) => extension.preExportTextureAsync && extension.preExportTextureAsync(context, node, mimeType));
152
+ // eslint-disable-next-line @typescript-eslint/promise-function-async
153
+ return this._ApplyExtensions(babylonTexture, (extension, node) => extension.preExportTextureAsync && extension.preExportTextureAsync(context, node, mimeType));
151
154
  }
152
155
  _extensionsPostExportNodeAsync(context, node, babylonNode, nodeMap, convertToRightHanded) {
153
- return this._applyExtensions(node, (extension, node) => extension.postExportNodeAsync && extension.postExportNodeAsync(context, node, babylonNode, nodeMap, convertToRightHanded, this._bufferManager));
156
+ return this._ApplyExtensions(node,
157
+ // eslint-disable-next-line @typescript-eslint/promise-function-async
158
+ (extension, node) => extension.postExportNodeAsync && extension.postExportNodeAsync(context, node, babylonNode, nodeMap, convertToRightHanded, this._bufferManager));
154
159
  }
155
160
  _extensionsPostExportMaterialAsync(context, material, babylonMaterial) {
156
- return this._applyExtensions(material, (extension, node) => extension.postExportMaterialAsync && extension.postExportMaterialAsync(context, node, babylonMaterial));
161
+ // eslint-disable-next-line @typescript-eslint/promise-function-async
162
+ return this._ApplyExtensions(material, (extension, node) => extension.postExportMaterialAsync && extension.postExportMaterialAsync(context, node, babylonMaterial));
157
163
  }
158
164
  _extensionsPostExportMaterialAdditionalTextures(context, material, babylonMaterial) {
159
165
  const output = [];