babylonjs-serializers 9.26.2 → 9.27.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/babylon.glTF2Serializer.js +1 -1
- package/babylon.glTF2Serializer.js.map +1 -1
- package/babylon.glTF2Serializer.min.js +1 -1
- package/babylon.glTF2Serializer.min.js.map +1 -1
- package/babylonjs.serializers.d.ts +133 -3
- package/babylonjs.serializers.es5.js +1374 -1268
- package/babylonjs.serializers.js +1 -1
- package/babylonjs.serializers.js.map +1 -1
- package/babylonjs.serializers.min.js +1 -1
- package/babylonjs.serializers.min.js.map +1 -1
- package/babylonjs.serializers.module.d.ts +281 -7
- package/package.json +3 -3
|
@@ -263,11 +263,84 @@ declare module "babylonjs-serializers/glTF/2.0/glTFSerializer" {
|
|
|
263
263
|
import { Node } from "babylonjs/node";
|
|
264
264
|
import { Scene } from "babylonjs/scene";
|
|
265
265
|
import { Animation } from "babylonjs/Animations/animation";
|
|
266
|
+
import { AnimationGroup } from "babylonjs/Animations/animationGroup";
|
|
267
|
+
import { Camera } from "babylonjs/Cameras/camera";
|
|
268
|
+
import { Material } from "babylonjs/Materials/material";
|
|
269
|
+
import { IKHRInteractivity } from "babylonjs-gltf2interface";
|
|
266
270
|
import { GLTFData } from "babylonjs-serializers/glTF/2.0/glTFData";
|
|
271
|
+
/**
|
|
272
|
+
* Indexed glTF root collections that KHR_interactivity references can target.
|
|
273
|
+
*/
|
|
274
|
+
export type KhrInteractivityRootCollection = "nodes" | "animations" | "cameras" | "materials" | "meshes" | "textures" | "images" | "samplers" | "skins" | "scenes";
|
|
267
275
|
/**
|
|
268
276
|
* Mesh compression methods.
|
|
269
277
|
*/
|
|
270
278
|
export type MeshCompressionMethod = "None" | "Draco";
|
|
279
|
+
/**
|
|
280
|
+
* Final entity remapping context exposed to a KHR_interactivity export provider.
|
|
281
|
+
*/
|
|
282
|
+
export interface IKHRInteractivityExportContext {
|
|
283
|
+
/**
|
|
284
|
+
* Gets the final number of glTF nodes.
|
|
285
|
+
* @returns final glTF node count
|
|
286
|
+
*/
|
|
287
|
+
getNodeCount(): number;
|
|
288
|
+
/**
|
|
289
|
+
* Gets the final glTF node index for a Babylon node.
|
|
290
|
+
* @param node Babylon node to resolve
|
|
291
|
+
* @returns final glTF node index, or undefined when the node was not exported
|
|
292
|
+
*/
|
|
293
|
+
getNodeIndex(node: Node): number | undefined;
|
|
294
|
+
/**
|
|
295
|
+
* Gets the final glTF animation index for a Babylon animation group.
|
|
296
|
+
* @param animation Babylon animation group to resolve
|
|
297
|
+
* @returns final glTF animation index, or undefined when the animation was not exported
|
|
298
|
+
*/
|
|
299
|
+
getAnimationIndex(animation: AnimationGroup): number | undefined;
|
|
300
|
+
/**
|
|
301
|
+
* Gets the final glTF camera index for a Babylon camera.
|
|
302
|
+
* @param camera Babylon camera to resolve
|
|
303
|
+
* @returns final glTF camera index, or undefined when the camera was not exported
|
|
304
|
+
*/
|
|
305
|
+
getCameraIndex(camera: Camera): number | undefined;
|
|
306
|
+
/**
|
|
307
|
+
* Gets the final glTF material index for a Babylon material.
|
|
308
|
+
* @param material Babylon material to resolve
|
|
309
|
+
* @returns final glTF material index, or undefined when the material was not exported
|
|
310
|
+
*/
|
|
311
|
+
getMaterialIndex(material: Material): number | undefined;
|
|
312
|
+
/**
|
|
313
|
+
* Gets the final glTF index for an imported Babylon entity in a root collection.
|
|
314
|
+
* @param collection target glTF root collection
|
|
315
|
+
* @param entity imported Babylon entity associated with the source entry
|
|
316
|
+
* @returns final glTF index, or undefined when the entity was not exported uniquely
|
|
317
|
+
*/
|
|
318
|
+
getRootIndex?(collection: KhrInteractivityRootCollection, entity: object): number | undefined;
|
|
319
|
+
/**
|
|
320
|
+
* Writes a companion extension on an already-exported glTF node.
|
|
321
|
+
* @param nodeIndex final glTF node index
|
|
322
|
+
* @param extensionName companion extension name
|
|
323
|
+
* @param value companion extension payload
|
|
324
|
+
*/
|
|
325
|
+
setNodeExtension(nodeIndex: number, extensionName: string, value: unknown): void;
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Supplies a detached canonical KHR_interactivity document to the glTF serializer.
|
|
329
|
+
*/
|
|
330
|
+
export interface IKHRInteractivityExportProvider {
|
|
331
|
+
/** Whether KHR_interactivity must be listed in extensionsRequired. */
|
|
332
|
+
readonly required: boolean;
|
|
333
|
+
/** Additional operation or companion extensions referenced by the graph. */
|
|
334
|
+
readonly additionalExtensionsUsed: readonly string[];
|
|
335
|
+
/** Additional extensions that must be listed in extensionsRequired. */
|
|
336
|
+
readonly additionalExtensionsRequired: readonly string[];
|
|
337
|
+
/**
|
|
338
|
+
* Builds the extension after final glTF entity indices are available.
|
|
339
|
+
* @param context final serializer remapping context
|
|
340
|
+
* @returns canonical KHR_interactivity extension payload
|
|
341
|
+
*/
|
|
342
|
+
build(context: IKHRInteractivityExportContext): IKHRInteractivity;
|
|
343
|
+
}
|
|
271
344
|
/**
|
|
272
345
|
* Holds a collection of exporter options and parameters
|
|
273
346
|
*/
|
|
@@ -304,7 +377,8 @@ export interface IExportOptions {
|
|
|
304
377
|
*/
|
|
305
378
|
exportUnusedUVs?: boolean;
|
|
306
379
|
/**
|
|
307
|
-
* Remove no-op root nodes when possible. Defaults to true.
|
|
380
|
+
* Remove no-op root nodes when possible. Defaults to true. No-op roots are preserved when
|
|
381
|
+
* {@link khrInteractivity} is provided because the graph may reference them.
|
|
308
382
|
*/
|
|
309
383
|
removeNoopRootNodes?: boolean;
|
|
310
384
|
/**
|
|
@@ -316,6 +390,11 @@ export interface IExportOptions {
|
|
|
316
390
|
* Indicates what compression method to apply to mesh data.
|
|
317
391
|
*/
|
|
318
392
|
meshCompressionMethod?: MeshCompressionMethod;
|
|
393
|
+
/**
|
|
394
|
+
* Canonical KHR_interactivity export provider. The provider is evaluated only after scene
|
|
395
|
+
* nodes and animations have their final glTF indices.
|
|
396
|
+
*/
|
|
397
|
+
khrInteractivity?: IKHRInteractivityExportProvider;
|
|
319
398
|
}
|
|
320
399
|
/**
|
|
321
400
|
* Class for generating glTF data from a Babylon scene.
|
|
@@ -544,9 +623,11 @@ import { Material } from "babylonjs/Materials/material";
|
|
|
544
623
|
import { Scene } from "babylonjs/scene";
|
|
545
624
|
import { IGLTFExporterExtensionV2 } from "babylonjs-serializers/glTF/2.0/glTFExporterExtension";
|
|
546
625
|
import { GLTFMaterialExporter } from "babylonjs-serializers/glTF/2.0/glTFMaterialExporter";
|
|
547
|
-
import { IExportOptions } from "babylonjs-serializers/glTF/2.0/glTFSerializer";
|
|
626
|
+
import { IExportOptions, KhrInteractivityRootCollection } from "babylonjs-serializers/glTF/2.0/glTFSerializer";
|
|
548
627
|
import { GLTFData } from "babylonjs-serializers/glTF/2.0/glTFData";
|
|
549
628
|
import { BufferManager } from "babylonjs-serializers/glTF/2.0/bufferManager";
|
|
629
|
+
import { Camera } from "babylonjs/Cameras/camera";
|
|
630
|
+
import { AnimationGroup } from "babylonjs/Animations/animationGroup";
|
|
550
631
|
/** @internal */
|
|
551
632
|
export class GLTFExporter {
|
|
552
633
|
readonly _glTF: IGLTF;
|
|
@@ -577,6 +658,7 @@ export class GLTFExporter {
|
|
|
577
658
|
readonly _bufferManager: BufferManager;
|
|
578
659
|
private readonly _shouldExportNodeMap;
|
|
579
660
|
private readonly _nodeMap;
|
|
661
|
+
private readonly _animationGroupMap;
|
|
580
662
|
readonly _materialMap: Map<Material, number>;
|
|
581
663
|
private readonly _camerasMap;
|
|
582
664
|
private readonly _nodesCameraMap;
|
|
@@ -606,7 +688,7 @@ export class GLTFExporter {
|
|
|
606
688
|
private _loadExtensions;
|
|
607
689
|
constructor(babylonScene?: Nullable<Scene>, options?: IExportOptions);
|
|
608
690
|
dispose(): void;
|
|
609
|
-
get options(): Required<IExportOptions>;
|
|
691
|
+
get options(): Required<Omit<IExportOptions, "khrInteractivity">> & Pick<IExportOptions, "khrInteractivity">;
|
|
610
692
|
static RegisterExtension(name: string, factory: (exporter: GLTFExporter) => IGLTFExporterExtensionV2, order?: number): void;
|
|
611
693
|
static UnregisterExtension(name: string): boolean;
|
|
612
694
|
private _generateJSON;
|
|
@@ -626,6 +708,18 @@ export class GLTFExporter {
|
|
|
626
708
|
private _listAvailableSkeletons;
|
|
627
709
|
private _exportAndAssignSkeletons;
|
|
628
710
|
private _exportSceneAsync;
|
|
711
|
+
/** @internal */
|
|
712
|
+
_getNodeIndex(node: Node): number | undefined;
|
|
713
|
+
/** @internal */
|
|
714
|
+
_getAnimationIndex(animationGroup: AnimationGroup): number | undefined;
|
|
715
|
+
/** @internal */
|
|
716
|
+
_getCameraIndex(camera: Camera): number | undefined;
|
|
717
|
+
/** @internal */
|
|
718
|
+
_getMaterialIndex(material: Material): number | undefined;
|
|
719
|
+
/** @internal */
|
|
720
|
+
_getRootIndex(collection: KhrInteractivityRootCollection, entity: object): number | undefined;
|
|
721
|
+
/** @internal */
|
|
722
|
+
_setNodeExtension(nodeIndex: number, extensionName: string, value: unknown): void;
|
|
629
723
|
private _shouldExportNode;
|
|
630
724
|
private _exportNodesAsync;
|
|
631
725
|
private _collectBuffers;
|
|
@@ -677,6 +771,7 @@ import { IAnimation, INode, IBufferView, IAccessor, AnimationSamplerInterpolatio
|
|
|
677
771
|
import { Node } from "babylonjs/node";
|
|
678
772
|
import { Nullable } from "babylonjs/types";
|
|
679
773
|
import { Animation } from "babylonjs/Animations/animation";
|
|
774
|
+
import { AnimationGroup } from "babylonjs/Animations/animationGroup";
|
|
680
775
|
import { Scene } from "babylonjs/scene";
|
|
681
776
|
import { BufferManager } from "babylonjs-serializers/glTF/2.0/bufferManager";
|
|
682
777
|
/**
|
|
@@ -757,6 +852,8 @@ export class _GLTFAnimation {
|
|
|
757
852
|
* @param bufferViews
|
|
758
853
|
* @param accessors
|
|
759
854
|
* @param animationSampleRate
|
|
855
|
+
* @param useRightHanded
|
|
856
|
+
* @param shouldExportAnimation
|
|
760
857
|
*/
|
|
761
858
|
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;
|
|
762
859
|
/**
|
|
@@ -771,6 +868,8 @@ export class _GLTFAnimation {
|
|
|
771
868
|
* @param bufferViews
|
|
772
869
|
* @param accessors
|
|
773
870
|
* @param animationSampleRate
|
|
871
|
+
* @param useRightHanded
|
|
872
|
+
* @param shouldExportAnimation
|
|
774
873
|
*/
|
|
775
874
|
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;
|
|
776
875
|
/**
|
|
@@ -784,8 +883,11 @@ export class _GLTFAnimation {
|
|
|
784
883
|
* @param bufferViews
|
|
785
884
|
* @param accessors
|
|
786
885
|
* @param animationSampleRate
|
|
886
|
+
* @param leftHandedNodes nodes that require right-handed conversion
|
|
887
|
+
* @param shouldExportAnimation optional animation filter
|
|
888
|
+
* @param animationGroupMap final glTF animation index for each exported Babylon animation group
|
|
787
889
|
*/
|
|
788
|
-
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;
|
|
890
|
+
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, animationGroupMap?: Map<AnimationGroup, number>): void;
|
|
789
891
|
private static _AddAnimation;
|
|
790
892
|
/**
|
|
791
893
|
* Create a baked animation
|
|
@@ -964,6 +1066,7 @@ declare module "babylonjs-serializers/glTF/2.0/Extensions/pure" {
|
|
|
964
1066
|
export * from "babylonjs-serializers/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.pure";
|
|
965
1067
|
export * from "babylonjs-serializers/glTF/2.0/Extensions/KHR_draco_mesh_compression.pure";
|
|
966
1068
|
export * from "babylonjs-serializers/glTF/2.0/Extensions/KHR_lights_punctual.pure";
|
|
1069
|
+
export * from "babylonjs-serializers/glTF/2.0/Extensions/KHR_interactivity.pure";
|
|
967
1070
|
export * from "babylonjs-serializers/glTF/2.0/Extensions/EXT_lights_area.pure";
|
|
968
1071
|
export * from "babylonjs-serializers/glTF/2.0/Extensions/KHR_materials_anisotropy.pure";
|
|
969
1072
|
export * from "babylonjs-serializers/glTF/2.0/Extensions/KHR_materials_clearcoat.pure";
|
|
@@ -992,6 +1095,7 @@ declare module "babylonjs-serializers/glTF/2.0/Extensions/index" {
|
|
|
992
1095
|
export * from "babylonjs-serializers/glTF/2.0/Extensions/EXT_mesh_gpu_instancing";
|
|
993
1096
|
export * from "babylonjs-serializers/glTF/2.0/Extensions/KHR_draco_mesh_compression";
|
|
994
1097
|
export * from "babylonjs-serializers/glTF/2.0/Extensions/KHR_lights_punctual";
|
|
1098
|
+
export * from "babylonjs-serializers/glTF/2.0/Extensions/KHR_interactivity";
|
|
995
1099
|
export * from "babylonjs-serializers/glTF/2.0/Extensions/EXT_lights_area";
|
|
996
1100
|
export * from "babylonjs-serializers/glTF/2.0/Extensions/KHR_materials_anisotropy";
|
|
997
1101
|
export * from "babylonjs-serializers/glTF/2.0/Extensions/KHR_materials_clearcoat";
|
|
@@ -1951,6 +2055,46 @@ declare module "babylonjs-serializers/glTF/2.0/Extensions/KHR_lights_punctual" {
|
|
|
1951
2055
|
*/
|
|
1952
2056
|
export * from "babylonjs-serializers/glTF/2.0/Extensions/KHR_lights_punctual.pure";
|
|
1953
2057
|
|
|
2058
|
+
}
|
|
2059
|
+
declare module "babylonjs-serializers/glTF/2.0/Extensions/KHR_interactivity.pure" {
|
|
2060
|
+
import { IGLTFExporterExtensionV2 } from "babylonjs-serializers/glTF/2.0/glTFExporterExtension";
|
|
2061
|
+
import { GLTFExporter } from "babylonjs-serializers/glTF/2.0/glTFExporter";
|
|
2062
|
+
/**
|
|
2063
|
+
* [Specification](https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_interactivity)
|
|
2064
|
+
*/
|
|
2065
|
+
export class KHR_interactivity implements IGLTFExporterExtensionV2 {
|
|
2066
|
+
private _exporter;
|
|
2067
|
+
/** The extension name. */
|
|
2068
|
+
readonly name: string;
|
|
2069
|
+
/** Whether this extension is enabled for the current export. */
|
|
2070
|
+
readonly enabled: boolean;
|
|
2071
|
+
/** Whether this extension is required for the exported asset. */
|
|
2072
|
+
readonly required: boolean;
|
|
2073
|
+
/**
|
|
2074
|
+
* @param _exporter owning glTF exporter
|
|
2075
|
+
*/
|
|
2076
|
+
constructor(_exporter: GLTFExporter);
|
|
2077
|
+
/** @internal */
|
|
2078
|
+
dispose(): void;
|
|
2079
|
+
/** @internal */
|
|
2080
|
+
get wasUsed(): boolean;
|
|
2081
|
+
/** @internal */
|
|
2082
|
+
onExporting(): void;
|
|
2083
|
+
}
|
|
2084
|
+
/**
|
|
2085
|
+
* Registers the KHR_interactivity glTF serializer extension with the {@link GLTFExporter}.
|
|
2086
|
+
* Safe to call multiple times; only the first call has an effect.
|
|
2087
|
+
*/
|
|
2088
|
+
export function RegisterKHR_interactivity(): void;
|
|
2089
|
+
|
|
2090
|
+
}
|
|
2091
|
+
declare module "babylonjs-serializers/glTF/2.0/Extensions/KHR_interactivity" {
|
|
2092
|
+
/**
|
|
2093
|
+
* Re-exports the pure implementation and applies the runtime registration side effect.
|
|
2094
|
+
* Import "./KHR_interactivity.pure" for tree-shakeable, side-effect-free usage.
|
|
2095
|
+
*/
|
|
2096
|
+
export * from "babylonjs-serializers/glTF/2.0/Extensions/KHR_interactivity.pure";
|
|
2097
|
+
|
|
1954
2098
|
}
|
|
1955
2099
|
declare module "babylonjs-serializers/glTF/2.0/Extensions/KHR_draco_mesh_compression.pure" {
|
|
1956
2100
|
import { IGLTFExporterExtensionV2 } from "babylonjs-serializers/glTF/2.0/glTFExporterExtension";
|
|
@@ -4428,10 +4572,79 @@ declare namespace BABYLON {
|
|
|
4428
4572
|
export function OmitDefaultValues<T extends object>(object: T, defaultValues: Partial<T>): T;
|
|
4429
4573
|
|
|
4430
4574
|
|
|
4575
|
+
/**
|
|
4576
|
+
* Indexed glTF root collections that KHR_interactivity references can target.
|
|
4577
|
+
*/
|
|
4578
|
+
export type KhrInteractivityRootCollection = "nodes" | "animations" | "cameras" | "materials" | "meshes" | "textures" | "images" | "samplers" | "skins" | "scenes";
|
|
4431
4579
|
/**
|
|
4432
4580
|
* Mesh compression methods.
|
|
4433
4581
|
*/
|
|
4434
4582
|
export type MeshCompressionMethod = "None" | "Draco";
|
|
4583
|
+
/**
|
|
4584
|
+
* Final entity remapping context exposed to a KHR_interactivity export provider.
|
|
4585
|
+
*/
|
|
4586
|
+
export interface IKHRInteractivityExportContext {
|
|
4587
|
+
/**
|
|
4588
|
+
* Gets the final number of glTF nodes.
|
|
4589
|
+
* @returns final glTF node count
|
|
4590
|
+
*/
|
|
4591
|
+
getNodeCount(): number;
|
|
4592
|
+
/**
|
|
4593
|
+
* Gets the final glTF node index for a Babylon node.
|
|
4594
|
+
* @param node Babylon node to resolve
|
|
4595
|
+
* @returns final glTF node index, or undefined when the node was not exported
|
|
4596
|
+
*/
|
|
4597
|
+
getNodeIndex(node: Node): number | undefined;
|
|
4598
|
+
/**
|
|
4599
|
+
* Gets the final glTF animation index for a Babylon animation group.
|
|
4600
|
+
* @param animation Babylon animation group to resolve
|
|
4601
|
+
* @returns final glTF animation index, or undefined when the animation was not exported
|
|
4602
|
+
*/
|
|
4603
|
+
getAnimationIndex(animation: AnimationGroup): number | undefined;
|
|
4604
|
+
/**
|
|
4605
|
+
* Gets the final glTF camera index for a Babylon camera.
|
|
4606
|
+
* @param camera Babylon camera to resolve
|
|
4607
|
+
* @returns final glTF camera index, or undefined when the camera was not exported
|
|
4608
|
+
*/
|
|
4609
|
+
getCameraIndex(camera: Camera): number | undefined;
|
|
4610
|
+
/**
|
|
4611
|
+
* Gets the final glTF material index for a Babylon material.
|
|
4612
|
+
* @param material Babylon material to resolve
|
|
4613
|
+
* @returns final glTF material index, or undefined when the material was not exported
|
|
4614
|
+
*/
|
|
4615
|
+
getMaterialIndex(material: Material): number | undefined;
|
|
4616
|
+
/**
|
|
4617
|
+
* Gets the final glTF index for an imported Babylon entity in a root collection.
|
|
4618
|
+
* @param collection target glTF root collection
|
|
4619
|
+
* @param entity imported Babylon entity associated with the source entry
|
|
4620
|
+
* @returns final glTF index, or undefined when the entity was not exported uniquely
|
|
4621
|
+
*/
|
|
4622
|
+
getRootIndex?(collection: KhrInteractivityRootCollection, entity: object): number | undefined;
|
|
4623
|
+
/**
|
|
4624
|
+
* Writes a companion extension on an already-exported glTF node.
|
|
4625
|
+
* @param nodeIndex final glTF node index
|
|
4626
|
+
* @param extensionName companion extension name
|
|
4627
|
+
* @param value companion extension payload
|
|
4628
|
+
*/
|
|
4629
|
+
setNodeExtension(nodeIndex: number, extensionName: string, value: unknown): void;
|
|
4630
|
+
}
|
|
4631
|
+
/**
|
|
4632
|
+
* Supplies a detached canonical KHR_interactivity document to the glTF serializer.
|
|
4633
|
+
*/
|
|
4634
|
+
export interface IKHRInteractivityExportProvider {
|
|
4635
|
+
/** Whether KHR_interactivity must be listed in extensionsRequired. */
|
|
4636
|
+
readonly required: boolean;
|
|
4637
|
+
/** Additional operation or companion extensions referenced by the graph. */
|
|
4638
|
+
readonly additionalExtensionsUsed: readonly string[];
|
|
4639
|
+
/** Additional extensions that must be listed in extensionsRequired. */
|
|
4640
|
+
readonly additionalExtensionsRequired: readonly string[];
|
|
4641
|
+
/**
|
|
4642
|
+
* Builds the extension after final glTF entity indices are available.
|
|
4643
|
+
* @param context final serializer remapping context
|
|
4644
|
+
* @returns canonical KHR_interactivity extension payload
|
|
4645
|
+
*/
|
|
4646
|
+
build(context: IKHRInteractivityExportContext): BABYLON.GLTF2.IKHRInteractivity;
|
|
4647
|
+
}
|
|
4435
4648
|
/**
|
|
4436
4649
|
* Holds a collection of exporter options and parameters
|
|
4437
4650
|
*/
|
|
@@ -4468,7 +4681,8 @@ declare namespace BABYLON {
|
|
|
4468
4681
|
*/
|
|
4469
4682
|
exportUnusedUVs?: boolean;
|
|
4470
4683
|
/**
|
|
4471
|
-
* Remove no-op root nodes when possible. Defaults to true.
|
|
4684
|
+
* Remove no-op root nodes when possible. Defaults to true. No-op roots are preserved when
|
|
4685
|
+
* {@link khrInteractivity} is provided because the graph may reference them.
|
|
4472
4686
|
*/
|
|
4473
4687
|
removeNoopRootNodes?: boolean;
|
|
4474
4688
|
/**
|
|
@@ -4480,6 +4694,11 @@ declare namespace BABYLON {
|
|
|
4480
4694
|
* Indicates what compression method to apply to mesh data.
|
|
4481
4695
|
*/
|
|
4482
4696
|
meshCompressionMethod?: MeshCompressionMethod;
|
|
4697
|
+
/**
|
|
4698
|
+
* Canonical KHR_interactivity export provider. The provider is evaluated only after scene
|
|
4699
|
+
* nodes and animations have their final glTF indices.
|
|
4700
|
+
*/
|
|
4701
|
+
khrInteractivity?: IKHRInteractivityExportProvider;
|
|
4483
4702
|
}
|
|
4484
4703
|
/**
|
|
4485
4704
|
* Class for generating glTF data from a Babylon scene.
|
|
@@ -4707,6 +4926,7 @@ declare namespace BABYLON {
|
|
|
4707
4926
|
readonly _bufferManager: BufferManager;
|
|
4708
4927
|
private readonly _shouldExportNodeMap;
|
|
4709
4928
|
private readonly _nodeMap;
|
|
4929
|
+
private readonly _animationGroupMap;
|
|
4710
4930
|
readonly _materialMap: Map<Material, number>;
|
|
4711
4931
|
private readonly _camerasMap;
|
|
4712
4932
|
private readonly _nodesCameraMap;
|
|
@@ -4736,7 +4956,7 @@ declare namespace BABYLON {
|
|
|
4736
4956
|
private _loadExtensions;
|
|
4737
4957
|
constructor(babylonScene?: Nullable<Scene>, options?: IExportOptions);
|
|
4738
4958
|
dispose(): void;
|
|
4739
|
-
get options(): Required<IExportOptions>;
|
|
4959
|
+
get options(): Required<Omit<IExportOptions, "khrInteractivity">> & Pick<IExportOptions, "khrInteractivity">;
|
|
4740
4960
|
static RegisterExtension(name: string, factory: (exporter: GLTFExporter) => IGLTFExporterExtensionV2, order?: number): void;
|
|
4741
4961
|
static UnregisterExtension(name: string): boolean;
|
|
4742
4962
|
private _generateJSON;
|
|
@@ -4756,6 +4976,18 @@ declare namespace BABYLON {
|
|
|
4756
4976
|
private _listAvailableSkeletons;
|
|
4757
4977
|
private _exportAndAssignSkeletons;
|
|
4758
4978
|
private _exportSceneAsync;
|
|
4979
|
+
/** @internal */
|
|
4980
|
+
_getNodeIndex(node: Node): number | undefined;
|
|
4981
|
+
/** @internal */
|
|
4982
|
+
_getAnimationIndex(animationGroup: AnimationGroup): number | undefined;
|
|
4983
|
+
/** @internal */
|
|
4984
|
+
_getCameraIndex(camera: Camera): number | undefined;
|
|
4985
|
+
/** @internal */
|
|
4986
|
+
_getMaterialIndex(material: Material): number | undefined;
|
|
4987
|
+
/** @internal */
|
|
4988
|
+
_getRootIndex(collection: KhrInteractivityRootCollection, entity: object): number | undefined;
|
|
4989
|
+
/** @internal */
|
|
4990
|
+
_setNodeExtension(nodeIndex: number, extensionName: string, value: unknown): void;
|
|
4759
4991
|
private _shouldExportNode;
|
|
4760
4992
|
private _exportNodesAsync;
|
|
4761
4993
|
private _collectBuffers;
|
|
@@ -4879,6 +5111,8 @@ declare namespace BABYLON {
|
|
|
4879
5111
|
* @param bufferViews
|
|
4880
5112
|
* @param accessors
|
|
4881
5113
|
* @param animationSampleRate
|
|
5114
|
+
* @param useRightHanded
|
|
5115
|
+
* @param shouldExportAnimation
|
|
4882
5116
|
*/
|
|
4883
5117
|
static _CreateNodeAnimationFromNodeAnimations(babylonNode: Node, runtimeGLTFAnimation: BABYLON.GLTF2.IAnimation, idleGLTFAnimations: BABYLON.GLTF2.IAnimation[], nodeMap: Map<Node, number>, nodes: BABYLON.GLTF2.INode[], bufferManager: BufferManager, bufferViews: BABYLON.GLTF2.IBufferView[], accessors: BABYLON.GLTF2.IAccessor[], animationSampleRate: number, useRightHanded: boolean, shouldExportAnimation?: (animation: Animation) => boolean): void;
|
|
4884
5118
|
/**
|
|
@@ -4893,6 +5127,8 @@ declare namespace BABYLON {
|
|
|
4893
5127
|
* @param bufferViews
|
|
4894
5128
|
* @param accessors
|
|
4895
5129
|
* @param animationSampleRate
|
|
5130
|
+
* @param useRightHanded
|
|
5131
|
+
* @param shouldExportAnimation
|
|
4896
5132
|
*/
|
|
4897
5133
|
static _CreateMorphTargetAnimationFromMorphTargetAnimations(babylonNode: Node, runtimeGLTFAnimation: BABYLON.GLTF2.IAnimation, idleGLTFAnimations: BABYLON.GLTF2.IAnimation[], nodeMap: Map<Node, number>, nodes: BABYLON.GLTF2.INode[], bufferManager: BufferManager, bufferViews: BABYLON.GLTF2.IBufferView[], accessors: BABYLON.GLTF2.IAccessor[], animationSampleRate: number, useRightHanded: boolean, shouldExportAnimation?: (animation: Animation) => boolean): void;
|
|
4898
5134
|
/**
|
|
@@ -4906,8 +5142,11 @@ declare namespace BABYLON {
|
|
|
4906
5142
|
* @param bufferViews
|
|
4907
5143
|
* @param accessors
|
|
4908
5144
|
* @param animationSampleRate
|
|
5145
|
+
* @param leftHandedNodes nodes that require right-handed conversion
|
|
5146
|
+
* @param shouldExportAnimation optional animation filter
|
|
5147
|
+
* @param animationGroupMap final glTF animation index for each exported Babylon animation group
|
|
4909
5148
|
*/
|
|
4910
|
-
static _CreateNodeAndMorphAnimationFromAnimationGroups(babylonScene: Scene, glTFAnimations: BABYLON.GLTF2.IAnimation[], nodeMap: Map<Node, number>, bufferManager: BufferManager, bufferViews: BABYLON.GLTF2.IBufferView[], accessors: BABYLON.GLTF2.IAccessor[], animationSampleRate: number, leftHandedNodes: Set<Node>, shouldExportAnimation?: (animation: Animation) => boolean): void;
|
|
5149
|
+
static _CreateNodeAndMorphAnimationFromAnimationGroups(babylonScene: Scene, glTFAnimations: BABYLON.GLTF2.IAnimation[], nodeMap: Map<Node, number>, bufferManager: BufferManager, bufferViews: BABYLON.GLTF2.IBufferView[], accessors: BABYLON.GLTF2.IAccessor[], animationSampleRate: number, leftHandedNodes: Set<Node>, shouldExportAnimation?: (animation: Animation) => boolean, animationGroupMap?: Map<AnimationGroup, number>): void;
|
|
4911
5150
|
private static _AddAnimation;
|
|
4912
5151
|
/**
|
|
4913
5152
|
* Create a baked animation
|
|
@@ -5871,6 +6110,41 @@ declare namespace BABYLON {
|
|
|
5871
6110
|
*/
|
|
5872
6111
|
|
|
5873
6112
|
|
|
6113
|
+
/**
|
|
6114
|
+
* [Specification](https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_interactivity)
|
|
6115
|
+
*/
|
|
6116
|
+
export class KHR_interactivity implements IGLTFExporterExtensionV2 {
|
|
6117
|
+
private _exporter;
|
|
6118
|
+
/** The extension name. */
|
|
6119
|
+
readonly name = "KHR_interactivity";
|
|
6120
|
+
/** Whether this extension is enabled for the current export. */
|
|
6121
|
+
readonly enabled: boolean;
|
|
6122
|
+
/** Whether this extension is required for the exported asset. */
|
|
6123
|
+
readonly required: boolean;
|
|
6124
|
+
/**
|
|
6125
|
+
* @param _exporter owning glTF exporter
|
|
6126
|
+
*/
|
|
6127
|
+
constructor(_exporter: GLTFExporter);
|
|
6128
|
+
/** @internal */
|
|
6129
|
+
dispose(): void;
|
|
6130
|
+
/** @internal */
|
|
6131
|
+
get wasUsed(): boolean;
|
|
6132
|
+
/** @internal */
|
|
6133
|
+
onExporting(): void;
|
|
6134
|
+
}
|
|
6135
|
+
/**
|
|
6136
|
+
* Registers the KHR_interactivity glTF serializer extension with the {@link GLTFExporter}.
|
|
6137
|
+
* Safe to call multiple times; only the first call has an effect.
|
|
6138
|
+
*/
|
|
6139
|
+
export function RegisterKHR_interactivity(): void;
|
|
6140
|
+
|
|
6141
|
+
|
|
6142
|
+
/**
|
|
6143
|
+
* Re-exports the pure implementation and applies the runtime registration side effect.
|
|
6144
|
+
* Import "./KHR_interactivity.pure" for tree-shakeable, side-effect-free usage.
|
|
6145
|
+
*/
|
|
6146
|
+
|
|
6147
|
+
|
|
5874
6148
|
/**
|
|
5875
6149
|
* [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_draco_mesh_compression/README.md)
|
|
5876
6150
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "babylonjs-serializers",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.27.1",
|
|
4
4
|
"main": "babylonjs.serializers.min.js",
|
|
5
5
|
"types": "babylonjs.serializers.module.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"test:escheck": "es-check es6 ./babylonjs.serializers.js"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"babylonjs": "9.
|
|
20
|
-
"babylonjs-gltf2interface": "9.
|
|
19
|
+
"babylonjs": "9.27.1",
|
|
20
|
+
"babylonjs-gltf2interface": "9.27.1"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@dev/build-tools": "1.0.0",
|