@onerjs/serializers 8.23.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.
- package/OBJ/index.d.ts +1 -0
- package/OBJ/index.js +2 -0
- package/OBJ/index.js.map +1 -0
- package/OBJ/objSerializer.d.ts +21 -0
- package/OBJ/objSerializer.js +171 -0
- package/OBJ/objSerializer.js.map +1 -0
- package/USDZ/index.d.ts +1 -0
- package/USDZ/index.js +3 -0
- package/USDZ/index.js.map +1 -0
- package/USDZ/usdzExporter.d.ts +50 -0
- package/USDZ/usdzExporter.js +589 -0
- package/USDZ/usdzExporter.js.map +1 -0
- package/exportUtils.d.ts +12 -0
- package/exportUtils.js +37 -0
- package/exportUtils.js.map +1 -0
- package/glTF/2.0/Extensions/EXT_materials_diffuse_roughness.d.ts +24 -0
- package/glTF/2.0/Extensions/EXT_materials_diffuse_roughness.js +61 -0
- package/glTF/2.0/Extensions/EXT_materials_diffuse_roughness.js.map +1 -0
- package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.d.ts +36 -0
- package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js +109 -0
- package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_draco_mesh_compression.d.ts +32 -0
- package/glTF/2.0/Extensions/KHR_draco_mesh_compression.js +135 -0
- package/glTF/2.0/Extensions/KHR_draco_mesh_compression.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_lights_punctual.d.ts +39 -0
- package/glTF/2.0/Extensions/KHR_lights_punctual.js +145 -0
- package/glTF/2.0/Extensions/KHR_lights_punctual.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_anisotropy.d.ts +24 -0
- package/glTF/2.0/Extensions/KHR_materials_anisotropy.js +62 -0
- package/glTF/2.0/Extensions/KHR_materials_anisotropy.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.d.ts +24 -0
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.js +85 -0
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_diffuse_transmission.d.ts +40 -0
- package/glTF/2.0/Extensions/KHR_materials_diffuse_transmission.js +118 -0
- package/glTF/2.0/Extensions/KHR_materials_diffuse_transmission.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_dispersion.d.ts +31 -0
- package/glTF/2.0/Extensions/KHR_materials_dispersion.js +63 -0
- package/glTF/2.0/Extensions/KHR_materials_dispersion.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_emissive_strength.d.ts +27 -0
- package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js +54 -0
- package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_ior.d.ts +29 -0
- package/glTF/2.0/Extensions/KHR_materials_ior.js +55 -0
- package/glTF/2.0/Extensions/KHR_materials_ior.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_iridescence.d.ts +24 -0
- package/glTF/2.0/Extensions/KHR_materials_iridescence.js +69 -0
- package/glTF/2.0/Extensions/KHR_materials_iridescence.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_sheen.d.ts +24 -0
- package/glTF/2.0/Extensions/KHR_materials_sheen.js +66 -0
- package/glTF/2.0/Extensions/KHR_materials_sheen.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_specular.d.ts +41 -0
- package/glTF/2.0/Extensions/KHR_materials_specular.js +94 -0
- package/glTF/2.0/Extensions/KHR_materials_specular.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_transmission.d.ts +41 -0
- package/glTF/2.0/Extensions/KHR_materials_transmission.js +92 -0
- package/glTF/2.0/Extensions/KHR_materials_transmission.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_unlit.d.ts +20 -0
- package/glTF/2.0/Extensions/KHR_materials_unlit.js +46 -0
- package/glTF/2.0/Extensions/KHR_materials_unlit.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_volume.d.ts +40 -0
- package/glTF/2.0/Extensions/KHR_materials_volume.js +96 -0
- package/glTF/2.0/Extensions/KHR_materials_volume.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_texture_transform.d.ts +21 -0
- package/glTF/2.0/Extensions/KHR_texture_transform.js +93 -0
- package/glTF/2.0/Extensions/KHR_texture_transform.js.map +1 -0
- package/glTF/2.0/Extensions/index.d.ts +17 -0
- package/glTF/2.0/Extensions/index.js +18 -0
- package/glTF/2.0/Extensions/index.js.map +1 -0
- package/glTF/2.0/bufferManager.d.ts +68 -0
- package/glTF/2.0/bufferManager.js +154 -0
- package/glTF/2.0/bufferManager.js.map +1 -0
- package/glTF/2.0/dataWriter.d.ts +20 -0
- package/glTF/2.0/dataWriter.js +83 -0
- package/glTF/2.0/dataWriter.js.map +1 -0
- package/glTF/2.0/glTFAnimation.d.ts +191 -0
- package/glTF/2.0/glTFAnimation.js +786 -0
- package/glTF/2.0/glTFAnimation.js.map +1 -0
- package/glTF/2.0/glTFData.d.ts +21 -0
- package/glTF/2.0/glTFData.js +30 -0
- package/glTF/2.0/glTFData.js.map +1 -0
- package/glTF/2.0/glTFExporter.d.ts +109 -0
- package/glTF/2.0/glTFExporter.js +1166 -0
- package/glTF/2.0/glTFExporter.js.map +1 -0
- package/glTF/2.0/glTFExporterExtension.d.ts +77 -0
- package/glTF/2.0/glTFExporterExtension.js +4 -0
- package/glTF/2.0/glTFExporterExtension.js.map +1 -0
- package/glTF/2.0/glTFMaterialExporter.d.ts +99 -0
- package/glTF/2.0/glTFMaterialExporter.js +778 -0
- package/glTF/2.0/glTFMaterialExporter.js.map +1 -0
- package/glTF/2.0/glTFMorphTargetsUtilities.d.ts +14 -0
- package/glTF/2.0/glTFMorphTargetsUtilities.js +149 -0
- package/glTF/2.0/glTFMorphTargetsUtilities.js.map +1 -0
- package/glTF/2.0/glTFSerializer.d.ts +78 -0
- package/glTF/2.0/glTFSerializer.js +39 -0
- package/glTF/2.0/glTFSerializer.js.map +1 -0
- package/glTF/2.0/glTFUtilities.d.ts +89 -0
- package/glTF/2.0/glTFUtilities.js +349 -0
- package/glTF/2.0/glTFUtilities.js.map +1 -0
- package/glTF/2.0/index.d.ts +4 -0
- package/glTF/2.0/index.js +6 -0
- package/glTF/2.0/index.js.map +1 -0
- package/glTF/glTFFileExporter.d.ts +20 -0
- package/glTF/glTFFileExporter.js +4 -0
- package/glTF/glTFFileExporter.js.map +1 -0
- package/glTF/index.d.ts +2 -0
- package/glTF/index.js +4 -0
- package/glTF/index.js.map +1 -0
- package/index.d.ts +4 -0
- package/index.js +6 -0
- package/index.js.map +1 -0
- package/legacy/legacy-glTF2Serializer.d.ts +2 -0
- package/legacy/legacy-glTF2Serializer.js +45 -0
- package/legacy/legacy-glTF2Serializer.js.map +1 -0
- package/legacy/legacy-objSerializer.d.ts +1 -0
- package/legacy/legacy-objSerializer.js +14 -0
- package/legacy/legacy-objSerializer.js.map +1 -0
- package/legacy/legacy-stlSerializer.d.ts +1 -0
- package/legacy/legacy-stlSerializer.js +14 -0
- package/legacy/legacy-stlSerializer.js.map +1 -0
- package/legacy/legacy-usdzSerializer.d.ts +1 -0
- package/legacy/legacy-usdzSerializer.js +14 -0
- package/legacy/legacy-usdzSerializer.js.map +1 -0
- package/legacy/legacy.d.ts +5 -0
- package/legacy/legacy.js +8 -0
- package/legacy/legacy.js.map +1 -0
- package/license.md +71 -0
- package/package.json +49 -0
- package/readme.md +29 -0
- package/stl/index.d.ts +1 -0
- package/stl/index.js +2 -0
- package/stl/index.js.map +1 -0
- package/stl/stlSerializer.d.ts +20 -0
- package/stl/stlSerializer.js +135 -0
- package/stl/stlSerializer.js.map +1 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export * from "./EXT_mesh_gpu_instancing.js";
|
|
2
|
+
export * from "./KHR_draco_mesh_compression.js";
|
|
3
|
+
export * from "./KHR_lights_punctual.js";
|
|
4
|
+
export * from "./KHR_materials_anisotropy.js";
|
|
5
|
+
export * from "./KHR_materials_clearcoat.js";
|
|
6
|
+
export * from "./KHR_materials_diffuse_transmission.js";
|
|
7
|
+
export * from "./KHR_materials_dispersion.js";
|
|
8
|
+
export * from "./KHR_materials_emissive_strength.js";
|
|
9
|
+
export * from "./KHR_materials_ior.js";
|
|
10
|
+
export * from "./KHR_materials_iridescence.js";
|
|
11
|
+
export * from "./KHR_materials_sheen.js";
|
|
12
|
+
export * from "./KHR_materials_specular.js";
|
|
13
|
+
export * from "./KHR_materials_transmission.js";
|
|
14
|
+
export * from "./KHR_materials_unlit.js";
|
|
15
|
+
export * from "./KHR_materials_volume.js";
|
|
16
|
+
export * from "./EXT_materials_diffuse_roughness.js";
|
|
17
|
+
export * from "./KHR_texture_transform.js";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export * from "./EXT_mesh_gpu_instancing.js";
|
|
2
|
+
export * from "./KHR_draco_mesh_compression.js";
|
|
3
|
+
export * from "./KHR_lights_punctual.js";
|
|
4
|
+
export * from "./KHR_materials_anisotropy.js";
|
|
5
|
+
export * from "./KHR_materials_clearcoat.js";
|
|
6
|
+
export * from "./KHR_materials_diffuse_transmission.js";
|
|
7
|
+
export * from "./KHR_materials_dispersion.js";
|
|
8
|
+
export * from "./KHR_materials_emissive_strength.js";
|
|
9
|
+
export * from "./KHR_materials_ior.js";
|
|
10
|
+
export * from "./KHR_materials_iridescence.js";
|
|
11
|
+
export * from "./KHR_materials_sheen.js";
|
|
12
|
+
export * from "./KHR_materials_specular.js";
|
|
13
|
+
export * from "./KHR_materials_transmission.js";
|
|
14
|
+
export * from "./KHR_materials_unlit.js";
|
|
15
|
+
export * from "./KHR_materials_volume.js";
|
|
16
|
+
export * from "./EXT_materials_diffuse_roughness.js";
|
|
17
|
+
export * from "./KHR_texture_transform.js";
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../dev/serializers/src/glTF/2.0/Extensions/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sCAAsC,CAAC;AACrD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mCAAmC,CAAC;AAClD,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mCAAmC,CAAC;AAClD,cAAc,yBAAyB,CAAC","sourcesContent":["export * from \"./EXT_mesh_gpu_instancing\";\r\nexport * from \"./KHR_draco_mesh_compression\";\r\nexport * from \"./KHR_lights_punctual\";\r\nexport * from \"./KHR_materials_anisotropy\";\r\nexport * from \"./KHR_materials_clearcoat\";\r\nexport * from \"./KHR_materials_diffuse_transmission\";\r\nexport * from \"./KHR_materials_dispersion\";\r\nexport * from \"./KHR_materials_emissive_strength\";\r\nexport * from \"./KHR_materials_ior\";\r\nexport * from \"./KHR_materials_iridescence\";\r\nexport * from \"./KHR_materials_sheen\";\r\nexport * from \"./KHR_materials_specular\";\r\nexport * from \"./KHR_materials_transmission\";\r\nexport * from \"./KHR_materials_unlit\";\r\nexport * from \"./KHR_materials_volume\";\r\nexport * from \"./EXT_materials_diffuse_roughness\";\r\nexport * from \"./KHR_texture_transform\";\r\n"]}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { TypedArray } from "@babylonjs/core/types.js";
|
|
2
|
+
import type { AccessorComponentType, AccessorType, IAccessor, IBufferView } from "babylonjs-gltf2interface";
|
|
3
|
+
type TypedArrayForglTF = Exclude<TypedArray, Float64Array | BigInt64Array | BigUint64Array>;
|
|
4
|
+
interface IPropertyWithBufferView {
|
|
5
|
+
bufferView?: number;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Utility class to centralize the management of binary data, bufferViews, and the objects that reference them.
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export declare class BufferManager {
|
|
12
|
+
/**
|
|
13
|
+
* Maps a bufferView to its data
|
|
14
|
+
*/
|
|
15
|
+
private _bufferViewToData;
|
|
16
|
+
/**
|
|
17
|
+
* Maps a bufferView to glTF objects that reference it via a "bufferView" property (e.g. accessors, images)
|
|
18
|
+
*/
|
|
19
|
+
private _bufferViewToProperties;
|
|
20
|
+
/**
|
|
21
|
+
* Maps an accessor to its bufferView
|
|
22
|
+
*/
|
|
23
|
+
private _accessorToBufferView;
|
|
24
|
+
/**
|
|
25
|
+
* Generates a binary buffer from the stored bufferViews. Also populates the bufferViews list.
|
|
26
|
+
* @param bufferViews The list of bufferViews to be populated while writing the binary
|
|
27
|
+
* @returns The binary buffer
|
|
28
|
+
*/
|
|
29
|
+
generateBinary(bufferViews: IBufferView[]): Uint8Array;
|
|
30
|
+
/**
|
|
31
|
+
* Creates a buffer view based on the supplied arguments
|
|
32
|
+
* @param data a TypedArray to create the bufferView for
|
|
33
|
+
* @param byteStride byte distance between consecutive elements
|
|
34
|
+
* @returns bufferView for glTF
|
|
35
|
+
*/
|
|
36
|
+
createBufferView(data: TypedArrayForglTF, byteStride?: number): IBufferView;
|
|
37
|
+
/**
|
|
38
|
+
* Creates an accessor based on the supplied arguments and assigns it to the bufferView
|
|
39
|
+
* @param bufferView The glTF bufferView referenced by this accessor
|
|
40
|
+
* @param type The type of the accessor
|
|
41
|
+
* @param componentType The datatype of components in the attribute
|
|
42
|
+
* @param count The number of attributes referenced by this accessor
|
|
43
|
+
* @param byteOffset The offset relative to the start of the bufferView in bytes
|
|
44
|
+
* @param minMax Minimum and maximum value of each component in this attribute
|
|
45
|
+
* @param normalized Specifies whether integer data values are normalized before usage
|
|
46
|
+
* @returns accessor for glTF
|
|
47
|
+
*/
|
|
48
|
+
createAccessor(bufferView: IBufferView, type: AccessorType, componentType: AccessorComponentType, count: number, byteOffset?: number, minMax?: {
|
|
49
|
+
min: number[];
|
|
50
|
+
max: number[];
|
|
51
|
+
}, normalized?: boolean): IAccessor;
|
|
52
|
+
/**
|
|
53
|
+
* Assigns a bufferView to a glTF object that references it
|
|
54
|
+
* @param object The glTF object
|
|
55
|
+
* @param bufferView The bufferView to assign
|
|
56
|
+
*/
|
|
57
|
+
setBufferView(object: IPropertyWithBufferView, bufferView: IBufferView): void;
|
|
58
|
+
/**
|
|
59
|
+
* Removes buffer view from the binary data, as well as from all its known references
|
|
60
|
+
* @param bufferView the bufferView to remove
|
|
61
|
+
*/
|
|
62
|
+
removeBufferView(bufferView: IBufferView): void;
|
|
63
|
+
getBufferView(accessor: IAccessor): IBufferView;
|
|
64
|
+
getPropertiesWithBufferView(bufferView: IBufferView): IPropertyWithBufferView[];
|
|
65
|
+
getData(bufferView: IBufferView): TypedArrayForglTF;
|
|
66
|
+
private _verifyBufferView;
|
|
67
|
+
}
|
|
68
|
+
export {};
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { DataWriter } from "./dataWriter.js";
|
|
2
|
+
function GetHighestByteAlignment(byteLength) {
|
|
3
|
+
if (byteLength % 4 === 0) {
|
|
4
|
+
return 4;
|
|
5
|
+
}
|
|
6
|
+
if (byteLength % 2 === 0) {
|
|
7
|
+
return 2;
|
|
8
|
+
}
|
|
9
|
+
return 1;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Utility class to centralize the management of binary data, bufferViews, and the objects that reference them.
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export class BufferManager {
|
|
16
|
+
constructor() {
|
|
17
|
+
/**
|
|
18
|
+
* Maps a bufferView to its data
|
|
19
|
+
*/
|
|
20
|
+
this._bufferViewToData = new Map();
|
|
21
|
+
/**
|
|
22
|
+
* Maps a bufferView to glTF objects that reference it via a "bufferView" property (e.g. accessors, images)
|
|
23
|
+
*/
|
|
24
|
+
this._bufferViewToProperties = new Map();
|
|
25
|
+
/**
|
|
26
|
+
* Maps an accessor to its bufferView
|
|
27
|
+
*/
|
|
28
|
+
this._accessorToBufferView = new Map();
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Generates a binary buffer from the stored bufferViews. Also populates the bufferViews list.
|
|
32
|
+
* @param bufferViews The list of bufferViews to be populated while writing the binary
|
|
33
|
+
* @returns The binary buffer
|
|
34
|
+
*/
|
|
35
|
+
generateBinary(bufferViews) {
|
|
36
|
+
// Construct a DataWriter with the total byte length to prevent resizing
|
|
37
|
+
let totalByteLength = 0;
|
|
38
|
+
this._bufferViewToData.forEach((data) => {
|
|
39
|
+
totalByteLength += data.byteLength;
|
|
40
|
+
});
|
|
41
|
+
const dataWriter = new DataWriter(totalByteLength);
|
|
42
|
+
// Order the bufferViews in descending order of their alignment requirements
|
|
43
|
+
const orderedBufferViews = Array.from(this._bufferViewToData.keys()).sort((a, b) => GetHighestByteAlignment(b.byteLength) - GetHighestByteAlignment(a.byteLength));
|
|
44
|
+
// Fill in the bufferViews list and missing bufferView index references while writing the binary
|
|
45
|
+
for (const bufferView of orderedBufferViews) {
|
|
46
|
+
bufferView.byteOffset = dataWriter.byteOffset;
|
|
47
|
+
bufferViews.push(bufferView);
|
|
48
|
+
const bufferViewIndex = bufferViews.length - 1;
|
|
49
|
+
const properties = this.getPropertiesWithBufferView(bufferView);
|
|
50
|
+
for (const object of properties) {
|
|
51
|
+
object.bufferView = bufferViewIndex;
|
|
52
|
+
}
|
|
53
|
+
dataWriter.writeTypedArray(this._bufferViewToData.get(bufferView));
|
|
54
|
+
this._bufferViewToData.delete(bufferView); // Try to free up memory ASAP
|
|
55
|
+
}
|
|
56
|
+
return dataWriter.getOutputData();
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Creates a buffer view based on the supplied arguments
|
|
60
|
+
* @param data a TypedArray to create the bufferView for
|
|
61
|
+
* @param byteStride byte distance between consecutive elements
|
|
62
|
+
* @returns bufferView for glTF
|
|
63
|
+
*/
|
|
64
|
+
createBufferView(data, byteStride) {
|
|
65
|
+
const bufferView = {
|
|
66
|
+
buffer: 0,
|
|
67
|
+
byteOffset: undefined, // byteOffset will be set later, when we write the binary and decide bufferView ordering
|
|
68
|
+
byteLength: data.byteLength,
|
|
69
|
+
byteStride: byteStride,
|
|
70
|
+
};
|
|
71
|
+
this._bufferViewToData.set(bufferView, data);
|
|
72
|
+
return bufferView;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Creates an accessor based on the supplied arguments and assigns it to the bufferView
|
|
76
|
+
* @param bufferView The glTF bufferView referenced by this accessor
|
|
77
|
+
* @param type The type of the accessor
|
|
78
|
+
* @param componentType The datatype of components in the attribute
|
|
79
|
+
* @param count The number of attributes referenced by this accessor
|
|
80
|
+
* @param byteOffset The offset relative to the start of the bufferView in bytes
|
|
81
|
+
* @param minMax Minimum and maximum value of each component in this attribute
|
|
82
|
+
* @param normalized Specifies whether integer data values are normalized before usage
|
|
83
|
+
* @returns accessor for glTF
|
|
84
|
+
*/
|
|
85
|
+
createAccessor(bufferView, type, componentType, count, byteOffset, minMax, normalized) {
|
|
86
|
+
this._verifyBufferView(bufferView);
|
|
87
|
+
const accessor = {
|
|
88
|
+
bufferView: undefined, // bufferView will be set to a real index later, once we write the binary and decide bufferView ordering
|
|
89
|
+
componentType: componentType,
|
|
90
|
+
count: count,
|
|
91
|
+
type: type,
|
|
92
|
+
min: minMax?.min,
|
|
93
|
+
max: minMax?.max,
|
|
94
|
+
normalized: normalized,
|
|
95
|
+
byteOffset: byteOffset,
|
|
96
|
+
};
|
|
97
|
+
this.setBufferView(accessor, bufferView);
|
|
98
|
+
this._accessorToBufferView.set(accessor, bufferView);
|
|
99
|
+
return accessor;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Assigns a bufferView to a glTF object that references it
|
|
103
|
+
* @param object The glTF object
|
|
104
|
+
* @param bufferView The bufferView to assign
|
|
105
|
+
*/
|
|
106
|
+
setBufferView(object, bufferView) {
|
|
107
|
+
this._verifyBufferView(bufferView);
|
|
108
|
+
const properties = this.getPropertiesWithBufferView(bufferView);
|
|
109
|
+
properties.push(object);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Removes buffer view from the binary data, as well as from all its known references
|
|
113
|
+
* @param bufferView the bufferView to remove
|
|
114
|
+
*/
|
|
115
|
+
removeBufferView(bufferView) {
|
|
116
|
+
const properties = this.getPropertiesWithBufferView(bufferView);
|
|
117
|
+
for (const object of properties) {
|
|
118
|
+
if (object.bufferView !== undefined) {
|
|
119
|
+
delete object.bufferView;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
this._bufferViewToData.delete(bufferView);
|
|
123
|
+
this._bufferViewToProperties.delete(bufferView);
|
|
124
|
+
this._accessorToBufferView.forEach((bv, accessor) => {
|
|
125
|
+
if (bv === bufferView) {
|
|
126
|
+
// Additionally, remove byteOffset from accessor referencing this bufferView
|
|
127
|
+
if (accessor.byteOffset !== undefined) {
|
|
128
|
+
delete accessor.byteOffset;
|
|
129
|
+
}
|
|
130
|
+
this._accessorToBufferView.delete(accessor);
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
getBufferView(accessor) {
|
|
135
|
+
const bufferView = this._accessorToBufferView.get(accessor);
|
|
136
|
+
this._verifyBufferView(bufferView);
|
|
137
|
+
return bufferView;
|
|
138
|
+
}
|
|
139
|
+
getPropertiesWithBufferView(bufferView) {
|
|
140
|
+
this._verifyBufferView(bufferView);
|
|
141
|
+
this._bufferViewToProperties.set(bufferView, this._bufferViewToProperties.get(bufferView) ?? []);
|
|
142
|
+
return this._bufferViewToProperties.get(bufferView);
|
|
143
|
+
}
|
|
144
|
+
getData(bufferView) {
|
|
145
|
+
this._verifyBufferView(bufferView);
|
|
146
|
+
return this._bufferViewToData.get(bufferView);
|
|
147
|
+
}
|
|
148
|
+
_verifyBufferView(bufferView) {
|
|
149
|
+
if (bufferView === undefined || !this._bufferViewToData.has(bufferView)) {
|
|
150
|
+
throw new Error(`BufferView ${bufferView} not found in BufferManager.`);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
//# sourceMappingURL=bufferManager.js.map
|
|
@@ -0,0 +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,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,GAAG,IAAI,UAAU,CAAC,eAAe,CAAC,CAAC;QAEnD,4EAA4E;QAC5E,MAAM,kBAAkB,GAAG,KAAK,CAAC,IAA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orComponentType, 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"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { TypedArray } from "@babylonjs/core/types.js";
|
|
2
|
+
/** @internal */
|
|
3
|
+
export declare class DataWriter {
|
|
4
|
+
private _data;
|
|
5
|
+
private _dataView;
|
|
6
|
+
private _byteOffset;
|
|
7
|
+
writeTypedArray(value: Exclude<TypedArray, BigInt64Array | BigUint64Array>): void;
|
|
8
|
+
constructor(byteLength: number);
|
|
9
|
+
get byteOffset(): number;
|
|
10
|
+
getOutputData(): Uint8Array;
|
|
11
|
+
writeUInt8(value: number): void;
|
|
12
|
+
writeInt8(value: number): void;
|
|
13
|
+
writeInt16(entry: number): void;
|
|
14
|
+
writeUInt16(value: number): void;
|
|
15
|
+
writeInt32(entry: number): void;
|
|
16
|
+
writeUInt32(value: number): void;
|
|
17
|
+
writeFloat32(value: number): void;
|
|
18
|
+
writeFloat64(value: number): void;
|
|
19
|
+
private _checkGrowBuffer;
|
|
20
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
const TypedArrayToWriteMethod = new Map([
|
|
2
|
+
[Int8Array, (d, b, v) => d.setInt8(b, v)],
|
|
3
|
+
[Uint8Array, (dv, bo, v) => dv.setUint8(bo, v)],
|
|
4
|
+
[Uint8ClampedArray, (dv, bo, v) => dv.setUint8(bo, v)],
|
|
5
|
+
[Int16Array, (dv, bo, v) => dv.setInt16(bo, v, true)],
|
|
6
|
+
[Uint16Array, (dv, bo, v) => dv.setUint16(bo, v, true)],
|
|
7
|
+
[Int32Array, (dv, bo, v) => dv.setInt32(bo, v, true)],
|
|
8
|
+
[Uint32Array, (dv, bo, v) => dv.setUint32(bo, v, true)],
|
|
9
|
+
[Float32Array, (dv, bo, v) => dv.setFloat32(bo, v, true)],
|
|
10
|
+
[Float64Array, (dv, bo, v) => dv.setFloat64(bo, v, true)],
|
|
11
|
+
]);
|
|
12
|
+
/** @internal */
|
|
13
|
+
export class DataWriter {
|
|
14
|
+
writeTypedArray(value) {
|
|
15
|
+
this._checkGrowBuffer(value.byteLength);
|
|
16
|
+
const setMethod = TypedArrayToWriteMethod.get(value.constructor);
|
|
17
|
+
for (let i = 0; i < value.length; i++) {
|
|
18
|
+
setMethod(this._dataView, this._byteOffset, value[i]);
|
|
19
|
+
this._byteOffset += value.BYTES_PER_ELEMENT;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
constructor(byteLength) {
|
|
23
|
+
this._data = new Uint8Array(byteLength);
|
|
24
|
+
this._dataView = new DataView(this._data.buffer);
|
|
25
|
+
this._byteOffset = 0;
|
|
26
|
+
}
|
|
27
|
+
get byteOffset() {
|
|
28
|
+
return this._byteOffset;
|
|
29
|
+
}
|
|
30
|
+
getOutputData() {
|
|
31
|
+
return new Uint8Array(this._data.buffer, 0, this._byteOffset);
|
|
32
|
+
}
|
|
33
|
+
writeUInt8(value) {
|
|
34
|
+
this._checkGrowBuffer(1);
|
|
35
|
+
this._dataView.setUint8(this._byteOffset, value);
|
|
36
|
+
this._byteOffset++;
|
|
37
|
+
}
|
|
38
|
+
writeInt8(value) {
|
|
39
|
+
this._checkGrowBuffer(1);
|
|
40
|
+
this._dataView.setInt8(this._byteOffset, value);
|
|
41
|
+
this._byteOffset++;
|
|
42
|
+
}
|
|
43
|
+
writeInt16(entry) {
|
|
44
|
+
this._checkGrowBuffer(2);
|
|
45
|
+
this._dataView.setInt16(this._byteOffset, entry, true);
|
|
46
|
+
this._byteOffset += 2;
|
|
47
|
+
}
|
|
48
|
+
writeUInt16(value) {
|
|
49
|
+
this._checkGrowBuffer(2);
|
|
50
|
+
this._dataView.setUint16(this._byteOffset, value, true);
|
|
51
|
+
this._byteOffset += 2;
|
|
52
|
+
}
|
|
53
|
+
writeInt32(entry) {
|
|
54
|
+
this._checkGrowBuffer(4);
|
|
55
|
+
this._dataView.setInt32(this._byteOffset, entry, true);
|
|
56
|
+
this._byteOffset += 4;
|
|
57
|
+
}
|
|
58
|
+
writeUInt32(value) {
|
|
59
|
+
this._checkGrowBuffer(4);
|
|
60
|
+
this._dataView.setUint32(this._byteOffset, value, true);
|
|
61
|
+
this._byteOffset += 4;
|
|
62
|
+
}
|
|
63
|
+
writeFloat32(value) {
|
|
64
|
+
this._checkGrowBuffer(4);
|
|
65
|
+
this._dataView.setFloat32(this._byteOffset, value, true);
|
|
66
|
+
this._byteOffset += 4;
|
|
67
|
+
}
|
|
68
|
+
writeFloat64(value) {
|
|
69
|
+
this._checkGrowBuffer(8);
|
|
70
|
+
this._dataView.setFloat64(this._byteOffset, value, true);
|
|
71
|
+
this._byteOffset += 8;
|
|
72
|
+
}
|
|
73
|
+
_checkGrowBuffer(byteLength) {
|
|
74
|
+
const newByteLength = this.byteOffset + byteLength;
|
|
75
|
+
if (newByteLength > this._data.byteLength) {
|
|
76
|
+
const newData = new Uint8Array(newByteLength * 2);
|
|
77
|
+
newData.set(this._data);
|
|
78
|
+
this._data = newData;
|
|
79
|
+
this._dataView = new DataView(this._data.buffer);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=dataWriter.js.map
|
|
@@ -0,0 +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;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,QA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ention */\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]);\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"]}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import type { IAnimation, INode, IBufferView, IAccessor } from "babylonjs-gltf2interface";
|
|
2
|
+
import { AnimationSamplerInterpolation, AnimationChannelTargetPath, AccessorType } from "babylonjs-gltf2interface";
|
|
3
|
+
import type { Node } from "@babylonjs/core/node.js";
|
|
4
|
+
import type { Nullable } from "@babylonjs/core/types.js";
|
|
5
|
+
import { Animation } from "@babylonjs/core/Animations/animation.js";
|
|
6
|
+
import type { Scene } from "@babylonjs/core/scene.js";
|
|
7
|
+
import type { BufferManager } from "./bufferManager.js";
|
|
8
|
+
/**
|
|
9
|
+
* @internal
|
|
10
|
+
* Interface to store animation data.
|
|
11
|
+
*/
|
|
12
|
+
export interface _IAnimationData {
|
|
13
|
+
/**
|
|
14
|
+
* Keyframe data.
|
|
15
|
+
*/
|
|
16
|
+
inputs: number[];
|
|
17
|
+
/**
|
|
18
|
+
* Value data.
|
|
19
|
+
*/
|
|
20
|
+
outputs: number[][];
|
|
21
|
+
/**
|
|
22
|
+
* Animation interpolation data.
|
|
23
|
+
*/
|
|
24
|
+
samplerInterpolation: AnimationSamplerInterpolation;
|
|
25
|
+
/**
|
|
26
|
+
* Minimum keyframe value.
|
|
27
|
+
*/
|
|
28
|
+
inputsMin: number;
|
|
29
|
+
/**
|
|
30
|
+
* Maximum keyframe value.
|
|
31
|
+
*/
|
|
32
|
+
inputsMax: number;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* @internal
|
|
36
|
+
*/
|
|
37
|
+
export interface _IAnimationInfo {
|
|
38
|
+
/**
|
|
39
|
+
* The target channel for the animation
|
|
40
|
+
*/
|
|
41
|
+
animationChannelTargetPath: AnimationChannelTargetPath;
|
|
42
|
+
/**
|
|
43
|
+
* The glTF accessor type for the data.
|
|
44
|
+
*/
|
|
45
|
+
dataAccessorType: AccessorType.VEC3 | AccessorType.VEC4 | AccessorType.SCALAR;
|
|
46
|
+
/**
|
|
47
|
+
* Specifies if quaternions should be used.
|
|
48
|
+
*/
|
|
49
|
+
useQuaternion: boolean;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* @internal
|
|
53
|
+
* Utility class for generating glTF animation data from BabylonJS.
|
|
54
|
+
*/
|
|
55
|
+
export declare class _GLTFAnimation {
|
|
56
|
+
/**
|
|
57
|
+
* Determine if a node is transformable - ie has properties it should be part of animation of transformation.
|
|
58
|
+
* @param babylonNode the node to test
|
|
59
|
+
* @returns true if can be animated, false otherwise. False if the parameter is null or undefined.
|
|
60
|
+
*/
|
|
61
|
+
private static _IsTransformable;
|
|
62
|
+
/**
|
|
63
|
+
* @ignore
|
|
64
|
+
*
|
|
65
|
+
* Creates glTF channel animation from BabylonJS animation.
|
|
66
|
+
* @param babylonTransformNode - BabylonJS mesh.
|
|
67
|
+
* @param animation - animation.
|
|
68
|
+
* @param animationChannelTargetPath - The target animation channel.
|
|
69
|
+
* @param useQuaternion - Specifies if quaternions are used.
|
|
70
|
+
* @returns nullable IAnimationData
|
|
71
|
+
*/
|
|
72
|
+
static _CreateNodeAnimation(babylonTransformNode: Node, animation: Animation, animationChannelTargetPath: AnimationChannelTargetPath, useQuaternion: boolean, animationSampleRate: number): Nullable<_IAnimationData>;
|
|
73
|
+
private static _DeduceAnimationInfo;
|
|
74
|
+
/**
|
|
75
|
+
* @ignore
|
|
76
|
+
* Create node animations from the transform node animations
|
|
77
|
+
* @param babylonNode
|
|
78
|
+
* @param runtimeGLTFAnimation
|
|
79
|
+
* @param idleGLTFAnimations
|
|
80
|
+
* @param nodeMap
|
|
81
|
+
* @param nodes
|
|
82
|
+
* @param bufferManager
|
|
83
|
+
* @param bufferViews
|
|
84
|
+
* @param accessors
|
|
85
|
+
* @param animationSampleRate
|
|
86
|
+
*/
|
|
87
|
+
static _CreateNodeAnimationFromNodeAnimations(babylonNode: Node, runtimeGLTFAnimation: IAnimation, idleGLTFAnimations: IAnimation[], nodeMap: Map<Node, number>, nodes: INode[], bufferManager: BufferManager, bufferViews: IBufferView[], accessors: IAccessor[], animationSampleRate: number, useRightHanded: boolean, shouldExportAnimation?: (animation: Animation) => boolean): void;
|
|
88
|
+
/**
|
|
89
|
+
* @ignore
|
|
90
|
+
* Create individual morph animations from the mesh's morph target animation tracks
|
|
91
|
+
* @param babylonNode
|
|
92
|
+
* @param runtimeGLTFAnimation
|
|
93
|
+
* @param idleGLTFAnimations
|
|
94
|
+
* @param nodeMap
|
|
95
|
+
* @param nodes
|
|
96
|
+
* @param bufferManager
|
|
97
|
+
* @param bufferViews
|
|
98
|
+
* @param accessors
|
|
99
|
+
* @param animationSampleRate
|
|
100
|
+
*/
|
|
101
|
+
static _CreateMorphTargetAnimationFromMorphTargetAnimations(babylonNode: Node, runtimeGLTFAnimation: IAnimation, idleGLTFAnimations: IAnimation[], nodeMap: Map<Node, number>, nodes: INode[], bufferManager: BufferManager, bufferViews: IBufferView[], accessors: IAccessor[], animationSampleRate: number, useRightHanded: boolean, shouldExportAnimation?: (animation: Animation) => boolean): void;
|
|
102
|
+
/**
|
|
103
|
+
* @internal
|
|
104
|
+
* Create node and morph animations from the animation groups
|
|
105
|
+
* @param babylonScene
|
|
106
|
+
* @param glTFAnimations
|
|
107
|
+
* @param nodeMap
|
|
108
|
+
* @param nodes
|
|
109
|
+
* @param bufferManager
|
|
110
|
+
* @param bufferViews
|
|
111
|
+
* @param accessors
|
|
112
|
+
* @param animationSampleRate
|
|
113
|
+
*/
|
|
114
|
+
static _CreateNodeAndMorphAnimationFromAnimationGroups(babylonScene: Scene, glTFAnimations: IAnimation[], nodeMap: Map<Node, number>, bufferManager: BufferManager, bufferViews: IBufferView[], accessors: IAccessor[], animationSampleRate: number, leftHandedNodes: Set<Node>, shouldExportAnimation?: (animation: Animation) => boolean): void;
|
|
115
|
+
private static _AddAnimation;
|
|
116
|
+
/**
|
|
117
|
+
* Create a baked animation
|
|
118
|
+
* @param babylonTransformNode BabylonJS mesh
|
|
119
|
+
* @param animation BabylonJS animation corresponding to the BabylonJS mesh
|
|
120
|
+
* @param animationChannelTargetPath animation target channel
|
|
121
|
+
* @param minFrame minimum animation frame
|
|
122
|
+
* @param maxFrame maximum animation frame
|
|
123
|
+
* @param fps frames per second of the animation
|
|
124
|
+
* @param sampleRate
|
|
125
|
+
* @param inputs input key frames of the animation
|
|
126
|
+
* @param outputs output key frame data of the animation
|
|
127
|
+
* @param minMaxFrames
|
|
128
|
+
* @param minMaxFrames.min
|
|
129
|
+
* @param minMaxFrames.max
|
|
130
|
+
* @param useQuaternion specifies if quaternions should be used
|
|
131
|
+
*/
|
|
132
|
+
private static _CreateBakedAnimation;
|
|
133
|
+
private static _ConvertFactorToVector3OrQuaternion;
|
|
134
|
+
private static _SetInterpolatedValue;
|
|
135
|
+
/**
|
|
136
|
+
* Creates linear animation from the animation key frames
|
|
137
|
+
* @param babylonTransformNode BabylonJS mesh
|
|
138
|
+
* @param animation BabylonJS animation
|
|
139
|
+
* @param animationChannelTargetPath The target animation channel
|
|
140
|
+
* @param inputs Array to store the key frame times
|
|
141
|
+
* @param outputs Array to store the key frame data
|
|
142
|
+
* @param useQuaternion Specifies if quaternions are used in the animation
|
|
143
|
+
*/
|
|
144
|
+
private static _CreateLinearOrStepAnimation;
|
|
145
|
+
/**
|
|
146
|
+
* Creates cubic spline animation from the animation key frames
|
|
147
|
+
* @param babylonTransformNode BabylonJS mesh
|
|
148
|
+
* @param animation BabylonJS animation
|
|
149
|
+
* @param animationChannelTargetPath The target animation channel
|
|
150
|
+
* @param inputs Array to store the key frame times
|
|
151
|
+
* @param outputs Array to store the key frame data
|
|
152
|
+
* @param useQuaternion Specifies if quaternions are used in the animation
|
|
153
|
+
*/
|
|
154
|
+
private static _CreateCubicSplineAnimation;
|
|
155
|
+
private static _GetBasePositionRotationOrScale;
|
|
156
|
+
/**
|
|
157
|
+
* Adds a key frame value
|
|
158
|
+
* @param keyFrame
|
|
159
|
+
* @param animation
|
|
160
|
+
* @param outputs
|
|
161
|
+
* @param animationChannelTargetPath
|
|
162
|
+
* @param babylonTransformNode
|
|
163
|
+
* @param useQuaternion
|
|
164
|
+
*/
|
|
165
|
+
private static _AddKeyframeValue;
|
|
166
|
+
/**
|
|
167
|
+
* @internal
|
|
168
|
+
* Determine the interpolation based on the key frames
|
|
169
|
+
* @param keyFrames
|
|
170
|
+
* @param animationChannelTargetPath
|
|
171
|
+
* @param useQuaternion
|
|
172
|
+
*/
|
|
173
|
+
private static _DeduceInterpolation;
|
|
174
|
+
/**
|
|
175
|
+
* Adds an input tangent or output tangent to the output data
|
|
176
|
+
* If an input tangent or output tangent is missing, it uses the zero vector or zero quaternion
|
|
177
|
+
* @param tangentType Specifies which type of tangent to handle (inTangent or outTangent)
|
|
178
|
+
* @param outputs The animation data by keyframe
|
|
179
|
+
* @param animationChannelTargetPath The target animation channel
|
|
180
|
+
* @param interpolation The interpolation type
|
|
181
|
+
* @param keyFrame The key frame with the animation data
|
|
182
|
+
* @param useQuaternion Specifies if quaternions are used
|
|
183
|
+
*/
|
|
184
|
+
private static _AddSplineTangent;
|
|
185
|
+
/**
|
|
186
|
+
* Get the minimum and maximum key frames' frame values
|
|
187
|
+
* @param keyFrames animation key frames
|
|
188
|
+
* @returns the minimum and maximum key frame value
|
|
189
|
+
*/
|
|
190
|
+
private static _CalculateMinMaxKeyFrames;
|
|
191
|
+
}
|