babylonjs-serializers 6.6.0 → 6.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/babylon.glTF2Serializer.js +248 -523
- package/babylon.glTF2Serializer.js.map +1 -1
- package/babylon.glTF2Serializer.min.js +1 -1
- package/babylon.glTF2Serializer.min.js.map +1 -1
- package/babylon.objSerializer.js +4 -4
- package/babylon.objSerializer.js.map +1 -1
- package/babylon.stlSerializer.js +4 -4
- package/babylon.stlSerializer.js.map +1 -1
- package/babylonjs.serializers.d.ts +25 -128
- package/babylonjs.serializers.js +250 -525
- 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 +51 -259
- package/package.json +3 -3
|
@@ -23,9 +23,9 @@ export class EXT_mesh_gpu_instancing implements IGLTFExporterExtensionV2 {
|
|
|
23
23
|
dispose(): void;
|
|
24
24
|
/** @internal */
|
|
25
25
|
get wasUsed(): boolean;
|
|
26
|
-
postExportNodeAsync
|
|
26
|
+
postExportNodeAsync(context: string, node: Nullable<INode>, babylonNode: Node, nodeMap: {
|
|
27
27
|
[key: number]: number;
|
|
28
|
-
}, binaryWriter
|
|
28
|
+
}, binaryWriter: _BinaryWriter): Promise<Nullable<INode>>;
|
|
29
29
|
private _buildAccessor;
|
|
30
30
|
}
|
|
31
31
|
|
|
@@ -83,7 +83,7 @@ export class KHR_lights_punctual implements IGLTFExporterExtensionV2 {
|
|
|
83
83
|
* @param nodeMap Node mapping of unique id to glTF node index
|
|
84
84
|
* @returns nullable INode promise
|
|
85
85
|
*/
|
|
86
|
-
postExportNodeAsync(context: string, node: Nullable<INode>, babylonNode: Node, nodeMap
|
|
86
|
+
postExportNodeAsync(context: string, node: Nullable<INode>, babylonNode: Node, nodeMap: {
|
|
87
87
|
[key: number]: number;
|
|
88
88
|
}): Promise<Nullable<INode>>;
|
|
89
89
|
}
|
|
@@ -448,11 +448,10 @@ export class _GLTFAnimation {
|
|
|
448
448
|
* @param babylonTransformNode - BabylonJS mesh.
|
|
449
449
|
* @param animation - animation.
|
|
450
450
|
* @param animationChannelTargetPath - The target animation channel.
|
|
451
|
-
* @param convertToRightHandedSystem - Specifies if the values should be converted to right-handed.
|
|
452
451
|
* @param useQuaternion - Specifies if quaternions are used.
|
|
453
452
|
* @returns nullable IAnimationData
|
|
454
453
|
*/
|
|
455
|
-
static _CreateNodeAnimation(babylonTransformNode: Node, animation: Animation, animationChannelTargetPath: AnimationChannelTargetPath,
|
|
454
|
+
static _CreateNodeAnimation(babylonTransformNode: Node, animation: Animation, animationChannelTargetPath: AnimationChannelTargetPath, useQuaternion: boolean, animationSampleRate: number): Nullable<_IAnimationData>;
|
|
456
455
|
private static _DeduceAnimationInfo;
|
|
457
456
|
/**
|
|
458
457
|
* @ignore
|
|
@@ -465,12 +464,11 @@ export class _GLTFAnimation {
|
|
|
465
464
|
* @param binaryWriter
|
|
466
465
|
* @param bufferViews
|
|
467
466
|
* @param accessors
|
|
468
|
-
* @param convertToRightHandedSystem
|
|
469
467
|
* @param animationSampleRate
|
|
470
468
|
*/
|
|
471
469
|
static _CreateNodeAnimationFromNodeAnimations(babylonNode: Node, runtimeGLTFAnimation: IAnimation, idleGLTFAnimations: IAnimation[], nodeMap: {
|
|
472
470
|
[key: number]: number;
|
|
473
|
-
}, nodes: INode[], binaryWriter: _BinaryWriter, bufferViews: IBufferView[], accessors: IAccessor[],
|
|
471
|
+
}, nodes: INode[], binaryWriter: _BinaryWriter, bufferViews: IBufferView[], accessors: IAccessor[], animationSampleRate: number, shouldExportAnimation?: (animation: Animation) => boolean): void;
|
|
474
472
|
/**
|
|
475
473
|
* @ignore
|
|
476
474
|
* Create individual morph animations from the mesh's morph target animation tracks
|
|
@@ -482,12 +480,11 @@ export class _GLTFAnimation {
|
|
|
482
480
|
* @param binaryWriter
|
|
483
481
|
* @param bufferViews
|
|
484
482
|
* @param accessors
|
|
485
|
-
* @param convertToRightHandedSystem
|
|
486
483
|
* @param animationSampleRate
|
|
487
484
|
*/
|
|
488
485
|
static _CreateMorphTargetAnimationFromMorphTargetAnimations(babylonNode: Node, runtimeGLTFAnimation: IAnimation, idleGLTFAnimations: IAnimation[], nodeMap: {
|
|
489
486
|
[key: number]: number;
|
|
490
|
-
}, nodes: INode[], binaryWriter: _BinaryWriter, bufferViews: IBufferView[], accessors: IAccessor[],
|
|
487
|
+
}, nodes: INode[], binaryWriter: _BinaryWriter, bufferViews: IBufferView[], accessors: IAccessor[], animationSampleRate: number, shouldExportAnimation?: (animation: Animation) => boolean): void;
|
|
491
488
|
/**
|
|
492
489
|
* @ignore
|
|
493
490
|
* Create node and morph animations from the animation groups
|
|
@@ -498,14 +495,11 @@ export class _GLTFAnimation {
|
|
|
498
495
|
* @param binaryWriter
|
|
499
496
|
* @param bufferViews
|
|
500
497
|
* @param accessors
|
|
501
|
-
* @param convertToRightHandedSystemMap
|
|
502
498
|
* @param animationSampleRate
|
|
503
499
|
*/
|
|
504
500
|
static _CreateNodeAndMorphAnimationFromAnimationGroups(babylonScene: Scene, glTFAnimations: IAnimation[], nodeMap: {
|
|
505
501
|
[key: number]: number;
|
|
506
|
-
},
|
|
507
|
-
[nodeId: number]: boolean;
|
|
508
|
-
}, animationSampleRate: number, shouldExportAnimation?: (animation: Animation) => boolean): void;
|
|
502
|
+
}, binaryWriter: _BinaryWriter, bufferViews: IBufferView[], accessors: IAccessor[], animationSampleRate: number, shouldExportAnimation?: (animation: Animation) => boolean): void;
|
|
509
503
|
private static _AddAnimation;
|
|
510
504
|
/**
|
|
511
505
|
* Create a baked animation
|
|
@@ -521,7 +515,6 @@ export class _GLTFAnimation {
|
|
|
521
515
|
* @param minMaxFrames
|
|
522
516
|
* @param minMaxFrames.min
|
|
523
517
|
* @param minMaxFrames.max
|
|
524
|
-
* @param convertToRightHandedSystem converts the values to right-handed
|
|
525
518
|
* @param useQuaternion specifies if quaternions should be used
|
|
526
519
|
*/
|
|
527
520
|
private static _CreateBakedAnimation;
|
|
@@ -532,10 +525,8 @@ export class _GLTFAnimation {
|
|
|
532
525
|
* @param babylonTransformNode BabylonJS mesh
|
|
533
526
|
* @param animation BabylonJS animation
|
|
534
527
|
* @param animationChannelTargetPath The target animation channel
|
|
535
|
-
* @param frameDelta The difference between the last and first frame of the animation
|
|
536
528
|
* @param inputs Array to store the key frame times
|
|
537
529
|
* @param outputs Array to store the key frame data
|
|
538
|
-
* @param convertToRightHandedSystem Specifies if the position data should be converted to right handed
|
|
539
530
|
* @param useQuaternion Specifies if quaternions are used in the animation
|
|
540
531
|
*/
|
|
541
532
|
private static _CreateLinearOrStepAnimation;
|
|
@@ -547,7 +538,6 @@ export class _GLTFAnimation {
|
|
|
547
538
|
* @param frameDelta The difference between the last and first frame of the animation
|
|
548
539
|
* @param inputs Array to store the key frame times
|
|
549
540
|
* @param outputs Array to store the key frame data
|
|
550
|
-
* @param convertToRightHandedSystem Specifies if the position data should be converted to right handed
|
|
551
541
|
* @param useQuaternion Specifies if quaternions are used in the animation
|
|
552
542
|
*/
|
|
553
543
|
private static _CreateCubicSplineAnimation;
|
|
@@ -559,7 +549,6 @@ export class _GLTFAnimation {
|
|
|
559
549
|
* @param outputs
|
|
560
550
|
* @param animationChannelTargetPath
|
|
561
551
|
* @param babylonTransformNode
|
|
562
|
-
* @param convertToRightHandedSystem
|
|
563
552
|
* @param useQuaternion
|
|
564
553
|
*/
|
|
565
554
|
private static _AddKeyframeValue;
|
|
@@ -581,7 +570,6 @@ export class _GLTFAnimation {
|
|
|
581
570
|
* @param keyFrame The key frame with the animation data
|
|
582
571
|
* @param frameDelta Time difference between two frames used to scale the tangent by the frame delta
|
|
583
572
|
* @param useQuaternion Specifies if quaternions are used
|
|
584
|
-
* @param convertToRightHandedSystem Specifies if the values should be converted to right-handed
|
|
585
573
|
*/
|
|
586
574
|
private static _AddSplineTangent;
|
|
587
575
|
/**
|
|
@@ -623,7 +611,6 @@ import { Vector3, Vector4 } from "babylonjs/Maths/math.vector";
|
|
|
623
611
|
import { Node } from "babylonjs/node";
|
|
624
612
|
import { TransformNode } from "babylonjs/Meshes/transformNode";
|
|
625
613
|
import { SubMesh } from "babylonjs/Meshes/subMesh";
|
|
626
|
-
import { MorphTarget } from "babylonjs/Morph/morphTarget";
|
|
627
614
|
import { BaseTexture } from "babylonjs/Materials/Textures/baseTexture";
|
|
628
615
|
import { Texture } from "babylonjs/Materials/Textures/texture";
|
|
629
616
|
import { Material } from "babylonjs/Materials/material";
|
|
@@ -713,27 +700,11 @@ export class _Exporter {
|
|
|
713
700
|
mimeType: ImageMimeType;
|
|
714
701
|
};
|
|
715
702
|
};
|
|
716
|
-
|
|
717
|
-
data: ArrayBuffer;
|
|
718
|
-
mimeType: ImageMimeType;
|
|
719
|
-
}>;
|
|
703
|
+
private _orderedImageData;
|
|
720
704
|
/**
|
|
721
705
|
* Stores a map of the unique id of a node to its index in the node array
|
|
722
706
|
*/
|
|
723
|
-
_nodeMap
|
|
724
|
-
[key: number]: number;
|
|
725
|
-
};
|
|
726
|
-
/**
|
|
727
|
-
* Specifies if the source Babylon scene was left handed, and needed conversion.
|
|
728
|
-
*/
|
|
729
|
-
_convertToRightHandedSystem: boolean;
|
|
730
|
-
/**
|
|
731
|
-
* Specifies if a Babylon node should be converted to right-handed on export
|
|
732
|
-
*/
|
|
733
|
-
_convertToRightHandedSystemMap: {
|
|
734
|
-
[nodeId: number]: boolean;
|
|
735
|
-
};
|
|
736
|
-
_includeCoordinateSystemConversionNodes: boolean;
|
|
707
|
+
private _nodeMap;
|
|
737
708
|
/**
|
|
738
709
|
* Baked animation sample rate
|
|
739
710
|
*/
|
|
@@ -748,9 +719,9 @@ export class _Exporter {
|
|
|
748
719
|
private _applyExtensions;
|
|
749
720
|
_extensionsPreExportTextureAsync(context: string, babylonTexture: Nullable<Texture>, mimeType: ImageMimeType): Promise<Nullable<BaseTexture>>;
|
|
750
721
|
_extensionsPostExportMeshPrimitiveAsync(context: string, meshPrimitive: IMeshPrimitive, babylonSubMesh: SubMesh, binaryWriter: _BinaryWriter): Promise<Nullable<IMeshPrimitive>>;
|
|
751
|
-
_extensionsPostExportNodeAsync(context: string, node: Nullable<INode>, babylonNode: Node, nodeMap
|
|
722
|
+
_extensionsPostExportNodeAsync(context: string, node: Nullable<INode>, babylonNode: Node, nodeMap: {
|
|
752
723
|
[key: number]: number;
|
|
753
|
-
}, binaryWriter
|
|
724
|
+
}, binaryWriter: _BinaryWriter): Promise<Nullable<INode>>;
|
|
754
725
|
_extensionsPostExportMaterialAsync(context: string, material: Nullable<IMaterial>, babylonMaterial: Material): Promise<Nullable<IMaterial>>;
|
|
755
726
|
_extensionsPostExportMaterialAdditionalTextures(context: string, material: IMaterial, babylonMaterial: Material): BaseTexture[];
|
|
756
727
|
_extensionsPostExportTextures(context: string, textureInfo: ITextureInfo, babylonTexture: BaseTexture): void;
|
|
@@ -786,51 +757,40 @@ export class _Exporter {
|
|
|
786
757
|
* clock-wise during export to glTF
|
|
787
758
|
* @param submesh BabylonJS submesh
|
|
788
759
|
* @param primitiveMode Primitive mode of the mesh
|
|
789
|
-
* @param sideOrientation the winding order of the submesh
|
|
790
760
|
* @param vertexBufferKind The type of vertex attribute
|
|
791
761
|
* @param meshAttributeArray The vertex attribute data
|
|
792
762
|
* @param byteOffset The offset to the binary data
|
|
793
763
|
* @param binaryWriter The binary data for the glTF file
|
|
794
|
-
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
795
764
|
*/
|
|
796
765
|
private _reorderVertexAttributeDataBasedOnPrimitiveMode;
|
|
797
766
|
/**
|
|
798
767
|
* Reorders the vertex attributes in the correct triangle mode order . This is necessary when indices are not available and the winding order is
|
|
799
768
|
* clock-wise during export to glTF
|
|
800
769
|
* @param submesh BabylonJS submesh
|
|
801
|
-
* @param primitiveMode Primitive mode of the mesh
|
|
802
|
-
* @param sideOrientation the winding order of the submesh
|
|
803
770
|
* @param vertexBufferKind The type of vertex attribute
|
|
804
771
|
* @param meshAttributeArray The vertex attribute data
|
|
805
772
|
* @param byteOffset The offset to the binary data
|
|
806
773
|
* @param binaryWriter The binary data for the glTF file
|
|
807
|
-
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
808
774
|
*/
|
|
809
775
|
private _reorderTriangleFillMode;
|
|
810
776
|
/**
|
|
811
777
|
* Reorders the vertex attributes in the correct triangle strip order. This is necessary when indices are not available and the winding order is
|
|
812
778
|
* clock-wise during export to glTF
|
|
813
779
|
* @param submesh BabylonJS submesh
|
|
814
|
-
* @param primitiveMode Primitive mode of the mesh
|
|
815
|
-
* @param sideOrientation the winding order of the submesh
|
|
816
780
|
* @param vertexBufferKind The type of vertex attribute
|
|
817
781
|
* @param meshAttributeArray The vertex attribute data
|
|
818
782
|
* @param byteOffset The offset to the binary data
|
|
819
783
|
* @param binaryWriter The binary data for the glTF file
|
|
820
|
-
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
821
784
|
*/
|
|
822
785
|
private _reorderTriangleStripDrawMode;
|
|
823
786
|
/**
|
|
824
787
|
* Reorders the vertex attributes in the correct triangle fan order. This is necessary when indices are not available and the winding order is
|
|
825
788
|
* clock-wise during export to glTF
|
|
826
789
|
* @param submesh BabylonJS submesh
|
|
827
|
-
* @param primitiveMode Primitive mode of the mesh
|
|
828
|
-
* @param sideOrientation the winding order of the submesh
|
|
829
790
|
* @param vertexBufferKind The type of vertex attribute
|
|
830
791
|
* @param meshAttributeArray The vertex attribute data
|
|
831
792
|
* @param byteOffset The offset to the binary data
|
|
832
793
|
* @param binaryWriter The binary data for the glTF file
|
|
833
|
-
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
834
794
|
*/
|
|
835
795
|
private _reorderTriangleFanMode;
|
|
836
796
|
/**
|
|
@@ -838,9 +798,7 @@ export class _Exporter {
|
|
|
838
798
|
* @param vertices The vertices to write to the binary writer
|
|
839
799
|
* @param byteOffset The offset into the binary writer to overwrite binary data
|
|
840
800
|
* @param vertexAttributeKind The vertex attribute type
|
|
841
|
-
* @param meshAttributeArray The vertex attribute data
|
|
842
801
|
* @param binaryWriter The writer containing the binary data
|
|
843
|
-
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
844
802
|
*/
|
|
845
803
|
private _writeVertexAttributeData;
|
|
846
804
|
/**
|
|
@@ -851,10 +809,9 @@ export class _Exporter {
|
|
|
851
809
|
* @param meshAttributeArray Array containing the attribute data
|
|
852
810
|
* @param stride Specifies the space between data
|
|
853
811
|
* @param binaryWriter The buffer to write the binary data to
|
|
854
|
-
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
855
812
|
* @param babylonTransformNode
|
|
856
813
|
*/
|
|
857
|
-
_writeAttributeData(vertexBufferKind: string, attributeComponentKind: AccessorComponentType, meshAttributeArray: FloatArray, stride: number, binaryWriter: _BinaryWriter,
|
|
814
|
+
_writeAttributeData(vertexBufferKind: string, attributeComponentKind: AccessorComponentType, meshAttributeArray: FloatArray, stride: number, binaryWriter: _BinaryWriter, babylonTransformNode: TransformNode): void;
|
|
858
815
|
/**
|
|
859
816
|
* Writes mesh attribute data to a data buffer
|
|
860
817
|
* Returns the bytelength of the data
|
|
@@ -866,10 +823,9 @@ export class _Exporter {
|
|
|
866
823
|
* @param morphTargetAttributeArray
|
|
867
824
|
* @param stride Specifies the space between data
|
|
868
825
|
* @param binaryWriter The buffer to write the binary data to
|
|
869
|
-
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
870
826
|
* @param minMax
|
|
871
827
|
*/
|
|
872
|
-
writeMorphTargetAttributeData(vertexBufferKind: string, attributeComponentKind: AccessorComponentType, meshPrimitive: SubMesh,
|
|
828
|
+
writeMorphTargetAttributeData(vertexBufferKind: string, attributeComponentKind: AccessorComponentType, meshPrimitive: SubMesh, meshAttributeArray: FloatArray, morphTargetAttributeArray: FloatArray, stride: number, binaryWriter: _BinaryWriter, minMax?: any): void;
|
|
873
829
|
/**
|
|
874
830
|
* Generates glTF json data
|
|
875
831
|
* @param shouldUseGlb Indicates whether the json should be written for a glb file
|
|
@@ -904,7 +860,6 @@ export class _Exporter {
|
|
|
904
860
|
* Sets the TRS for each node
|
|
905
861
|
* @param node glTF Node for storing the transformation data
|
|
906
862
|
* @param babylonTransformNode Babylon mesh used as the source for the transformation data
|
|
907
|
-
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
908
863
|
*/
|
|
909
864
|
private _setNodeTransformation;
|
|
910
865
|
private _setCameraTransformation;
|
|
@@ -916,7 +871,6 @@ export class _Exporter {
|
|
|
916
871
|
* @param babylonTransformNode The Babylon mesh to get the vertices data from
|
|
917
872
|
* @param binaryWriter The buffer to write the bufferview data to
|
|
918
873
|
* @param byteStride
|
|
919
|
-
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
920
874
|
*/
|
|
921
875
|
private _createBufferViewKind;
|
|
922
876
|
/**
|
|
@@ -925,7 +879,6 @@ export class _Exporter {
|
|
|
925
879
|
* @param meshPrimitive
|
|
926
880
|
* @param babylonMorphTarget the morph target to be exported
|
|
927
881
|
* @param binaryWriter The buffer to write the bufferview data to
|
|
928
|
-
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
929
882
|
*/
|
|
930
883
|
private _setMorphTargetAttributes;
|
|
931
884
|
/**
|
|
@@ -951,15 +904,8 @@ export class _Exporter {
|
|
|
951
904
|
* @param mesh glTF Mesh object to store the primitive attribute information
|
|
952
905
|
* @param babylonTransformNode Babylon mesh to get the primitive attribute data from
|
|
953
906
|
* @param binaryWriter Buffer to write the attribute data to
|
|
954
|
-
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
955
907
|
*/
|
|
956
908
|
private _setPrimitiveAttributesAsync;
|
|
957
|
-
/**
|
|
958
|
-
* Check if the node is used to convert its descendants from a right handed coordinate system to the Babylon scene's coordinate system.
|
|
959
|
-
* @param node The node to check
|
|
960
|
-
* @returns True if the node is used to convert its descendants from right-handed to left-handed. False otherwise
|
|
961
|
-
*/
|
|
962
|
-
private _isBabylonCoordinateSystemConvertingNode;
|
|
963
909
|
/**
|
|
964
910
|
* Creates a glTF scene based on the array of meshes
|
|
965
911
|
* Returns the the total byte offset
|
|
@@ -976,7 +922,6 @@ export class _Exporter {
|
|
|
976
922
|
private _getExportNodes;
|
|
977
923
|
/**
|
|
978
924
|
* Creates a mapping of Node unique id to node index and handles animations
|
|
979
|
-
* @param babylonScene Babylon Scene
|
|
980
925
|
* @param nodes Babylon transform nodes
|
|
981
926
|
* @param binaryWriter Buffer to write binary data to
|
|
982
927
|
* @returns Node mapping of unique id to index
|
|
@@ -986,7 +931,6 @@ export class _Exporter {
|
|
|
986
931
|
* Creates a glTF node from a Babylon mesh
|
|
987
932
|
* @param babylonNode Source Babylon mesh
|
|
988
933
|
* @param binaryWriter Buffer for storing geometry data
|
|
989
|
-
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
990
934
|
* @returns glTF node
|
|
991
935
|
*/
|
|
992
936
|
private _createNodeAsync;
|
|
@@ -1134,9 +1078,9 @@ export interface IGLTFExporterExtensionV2 extends IGLTFExporterExtension, IDispo
|
|
|
1134
1078
|
* @param babylonNode BabylonJS node
|
|
1135
1079
|
* @returns nullable INode promise
|
|
1136
1080
|
*/
|
|
1137
|
-
postExportNodeAsync?(context: string, node: Nullable<INode>, babylonNode: Node, nodeMap
|
|
1081
|
+
postExportNodeAsync?(context: string, node: Nullable<INode>, babylonNode: Node, nodeMap: {
|
|
1138
1082
|
[key: number]: number;
|
|
1139
|
-
}, binaryWriter
|
|
1083
|
+
}, binaryWriter: _BinaryWriter): Promise<Nullable<INode>>;
|
|
1140
1084
|
/**
|
|
1141
1085
|
* Define this method to modify the default behavior when exporting a material
|
|
1142
1086
|
* @param material glTF material
|
|
@@ -1386,19 +1330,24 @@ export interface IExportOptions {
|
|
|
1386
1330
|
*/
|
|
1387
1331
|
metadataSelector?(metadata: any): any;
|
|
1388
1332
|
/**
|
|
1389
|
-
* The sample rate to bake animation curves
|
|
1333
|
+
* The sample rate to bake animation curves. Defaults to 1 / 60.
|
|
1390
1334
|
*/
|
|
1391
1335
|
animationSampleRate?: number;
|
|
1392
1336
|
/**
|
|
1393
|
-
* Begin serialization without waiting for the scene to be ready
|
|
1337
|
+
* Begin serialization without waiting for the scene to be ready. Defaults to false.
|
|
1394
1338
|
*/
|
|
1395
1339
|
exportWithoutWaitingForScene?: boolean;
|
|
1396
1340
|
/**
|
|
1397
|
-
* Indicates if unused vertex uv attributes should be included in export
|
|
1341
|
+
* Indicates if unused vertex uv attributes should be included in export. Defaults to false.
|
|
1398
1342
|
*/
|
|
1399
1343
|
exportUnusedUVs?: boolean;
|
|
1400
1344
|
/**
|
|
1401
|
-
*
|
|
1345
|
+
* Remove no-op root nodes when possible. Defaults to true.
|
|
1346
|
+
*/
|
|
1347
|
+
removeNoopRootNodes?: boolean;
|
|
1348
|
+
/**
|
|
1349
|
+
* Indicates if coordinate system swapping root nodes should be included in export. Defaults to false.
|
|
1350
|
+
* @deprecated Please use removeNoopRootNodes instead
|
|
1402
1351
|
*/
|
|
1403
1352
|
includeCoordinateSystemConversionNodes?: boolean;
|
|
1404
1353
|
}
|
|
@@ -1432,8 +1381,7 @@ declare module "babylonjs-serializers/glTF/2.0/glTFUtilities" {
|
|
|
1432
1381
|
import { IBufferView, AccessorComponentType, IAccessor } from "babylonjs-gltf2interface";
|
|
1433
1382
|
import { AccessorType } from "babylonjs-gltf2interface";
|
|
1434
1383
|
import { FloatArray, Nullable } from "babylonjs/types";
|
|
1435
|
-
import { Vector4
|
|
1436
|
-
import { Vector3 } from "babylonjs/Maths/math.vector";
|
|
1384
|
+
import { Vector4 } from "babylonjs/Maths/math.vector";
|
|
1437
1385
|
/**
|
|
1438
1386
|
* @internal
|
|
1439
1387
|
*/
|
|
@@ -1466,65 +1414,12 @@ export class _GLTFUtilities {
|
|
|
1466
1414
|
* @param positions Positions array of a mesh
|
|
1467
1415
|
* @param vertexStart Starting vertex offset to calculate min and max values
|
|
1468
1416
|
* @param vertexCount Number of vertices to check for min and max values
|
|
1469
|
-
* @param convertToRightHandedSystem
|
|
1470
1417
|
* @returns min number array and max number array
|
|
1471
1418
|
*/
|
|
1472
|
-
static _CalculateMinMaxPositions(positions: FloatArray, vertexStart: number, vertexCount: number
|
|
1419
|
+
static _CalculateMinMaxPositions(positions: FloatArray, vertexStart: number, vertexCount: number): {
|
|
1473
1420
|
min: number[];
|
|
1474
1421
|
max: number[];
|
|
1475
1422
|
};
|
|
1476
|
-
/**
|
|
1477
|
-
* Converts a new right-handed Vector3
|
|
1478
|
-
* @param vector vector3 array
|
|
1479
|
-
* @returns right-handed Vector3
|
|
1480
|
-
*/
|
|
1481
|
-
static _GetRightHandedPositionVector3(vector: Vector3): Vector3;
|
|
1482
|
-
/**
|
|
1483
|
-
* Converts a Vector3 to right-handed
|
|
1484
|
-
* @param vector Vector3 to convert to right-handed
|
|
1485
|
-
*/
|
|
1486
|
-
static _GetRightHandedPositionVector3FromRef(vector: Vector3): void;
|
|
1487
|
-
/**
|
|
1488
|
-
* Converts a three element number array to right-handed
|
|
1489
|
-
* @param vector number array to convert to right-handed
|
|
1490
|
-
*/
|
|
1491
|
-
static _GetRightHandedPositionArray3FromRef(vector: number[]): void;
|
|
1492
|
-
/**
|
|
1493
|
-
* Converts a new right-handed Vector3
|
|
1494
|
-
* @param vector vector3 array
|
|
1495
|
-
* @returns right-handed Vector3
|
|
1496
|
-
*/
|
|
1497
|
-
static _GetRightHandedNormalVector3(vector: Vector3): Vector3;
|
|
1498
|
-
/**
|
|
1499
|
-
* Converts a Vector3 to right-handed
|
|
1500
|
-
* @param vector Vector3 to convert to right-handed
|
|
1501
|
-
*/
|
|
1502
|
-
static _GetRightHandedNormalVector3FromRef(vector: Vector3): void;
|
|
1503
|
-
/**
|
|
1504
|
-
* Converts a three element number array to right-handed
|
|
1505
|
-
* @param vector number array to convert to right-handed
|
|
1506
|
-
*/
|
|
1507
|
-
static _GetRightHandedNormalArray3FromRef(vector: number[]): void;
|
|
1508
|
-
/**
|
|
1509
|
-
* Converts a Vector4 to right-handed
|
|
1510
|
-
* @param vector Vector4 to convert to right-handed
|
|
1511
|
-
*/
|
|
1512
|
-
static _GetRightHandedVector4FromRef(vector: Vector4): void;
|
|
1513
|
-
/**
|
|
1514
|
-
* Converts a Vector4 to right-handed
|
|
1515
|
-
* @param vector Vector4 to convert to right-handed
|
|
1516
|
-
*/
|
|
1517
|
-
static _GetRightHandedArray4FromRef(vector: number[]): void;
|
|
1518
|
-
/**
|
|
1519
|
-
* Converts a Quaternion to right-handed
|
|
1520
|
-
* @param quaternion Source quaternion to convert to right-handed
|
|
1521
|
-
*/
|
|
1522
|
-
static _GetRightHandedQuaternionFromRef(quaternion: Quaternion): void;
|
|
1523
|
-
/**
|
|
1524
|
-
* Converts a Quaternion to right-handed
|
|
1525
|
-
* @param quaternion Source quaternion to convert to right-handed
|
|
1526
|
-
*/
|
|
1527
|
-
static _GetRightHandedQuaternionArrayFromRef(quaternion: number[]): void;
|
|
1528
1423
|
static _NormalizeTangentFromRef(tangent: Vector4): void;
|
|
1529
1424
|
static _GetDataAccessorElementCount(accessorType: AccessorType): 1 | 3 | 2 | 4 | 9 | 16;
|
|
1530
1425
|
}
|
|
@@ -1673,9 +1568,9 @@ declare module BABYLON {
|
|
|
1673
1568
|
dispose(): void;
|
|
1674
1569
|
/** @internal */
|
|
1675
1570
|
get wasUsed(): boolean;
|
|
1676
|
-
postExportNodeAsync
|
|
1571
|
+
postExportNodeAsync(context: string, node: Nullable<BABYLON.GLTF2.INode>, babylonNode: Node, nodeMap: {
|
|
1677
1572
|
[key: number]: number;
|
|
1678
|
-
}, binaryWriter
|
|
1573
|
+
}, binaryWriter: _BinaryWriter): Promise<Nullable<BABYLON.GLTF2.INode>>;
|
|
1679
1574
|
private _buildAccessor;
|
|
1680
1575
|
}
|
|
1681
1576
|
|
|
@@ -1713,7 +1608,7 @@ declare module BABYLON {
|
|
|
1713
1608
|
* @param nodeMap Node mapping of unique id to glTF node index
|
|
1714
1609
|
* @returns nullable BABYLON.GLTF2.INode promise
|
|
1715
1610
|
*/
|
|
1716
|
-
postExportNodeAsync(context: string, node: Nullable<BABYLON.GLTF2.INode>, babylonNode: Node, nodeMap
|
|
1611
|
+
postExportNodeAsync(context: string, node: Nullable<BABYLON.GLTF2.INode>, babylonNode: Node, nodeMap: {
|
|
1717
1612
|
[key: number]: number;
|
|
1718
1613
|
}): Promise<Nullable<BABYLON.GLTF2.INode>>;
|
|
1719
1614
|
}
|
|
@@ -2011,11 +1906,10 @@ declare module BABYLON {
|
|
|
2011
1906
|
* @param babylonTransformNode - BabylonJS mesh.
|
|
2012
1907
|
* @param animation - animation.
|
|
2013
1908
|
* @param animationChannelTargetPath - The target animation channel.
|
|
2014
|
-
* @param convertToRightHandedSystem - Specifies if the values should be converted to right-handed.
|
|
2015
1909
|
* @param useQuaternion - Specifies if quaternions are used.
|
|
2016
1910
|
* @returns nullable IAnimationData
|
|
2017
1911
|
*/
|
|
2018
|
-
static _CreateNodeAnimation(babylonTransformNode: Node, animation: Animation, animationChannelTargetPath: BABYLON.GLTF2.AnimationChannelTargetPath,
|
|
1912
|
+
static _CreateNodeAnimation(babylonTransformNode: Node, animation: Animation, animationChannelTargetPath: BABYLON.GLTF2.AnimationChannelTargetPath, useQuaternion: boolean, animationSampleRate: number): Nullable<_IAnimationData>;
|
|
2019
1913
|
private static _DeduceAnimationInfo;
|
|
2020
1914
|
/**
|
|
2021
1915
|
* @ignore
|
|
@@ -2028,12 +1922,11 @@ declare module BABYLON {
|
|
|
2028
1922
|
* @param binaryWriter
|
|
2029
1923
|
* @param bufferViews
|
|
2030
1924
|
* @param accessors
|
|
2031
|
-
* @param convertToRightHandedSystem
|
|
2032
1925
|
* @param animationSampleRate
|
|
2033
1926
|
*/
|
|
2034
1927
|
static _CreateNodeAnimationFromNodeAnimations(babylonNode: Node, runtimeGLTFAnimation: BABYLON.GLTF2.IAnimation, idleGLTFAnimations: BABYLON.GLTF2.IAnimation[], nodeMap: {
|
|
2035
1928
|
[key: number]: number;
|
|
2036
|
-
}, nodes: BABYLON.GLTF2.INode[], binaryWriter: _BinaryWriter, bufferViews: BABYLON.GLTF2.IBufferView[], accessors: BABYLON.GLTF2.IAccessor[],
|
|
1929
|
+
}, nodes: BABYLON.GLTF2.INode[], binaryWriter: _BinaryWriter, bufferViews: BABYLON.GLTF2.IBufferView[], accessors: BABYLON.GLTF2.IAccessor[], animationSampleRate: number, shouldExportAnimation?: (animation: Animation) => boolean): void;
|
|
2037
1930
|
/**
|
|
2038
1931
|
* @ignore
|
|
2039
1932
|
* Create individual morph animations from the mesh's morph target animation tracks
|
|
@@ -2045,12 +1938,11 @@ declare module BABYLON {
|
|
|
2045
1938
|
* @param binaryWriter
|
|
2046
1939
|
* @param bufferViews
|
|
2047
1940
|
* @param accessors
|
|
2048
|
-
* @param convertToRightHandedSystem
|
|
2049
1941
|
* @param animationSampleRate
|
|
2050
1942
|
*/
|
|
2051
1943
|
static _CreateMorphTargetAnimationFromMorphTargetAnimations(babylonNode: Node, runtimeGLTFAnimation: BABYLON.GLTF2.IAnimation, idleGLTFAnimations: BABYLON.GLTF2.IAnimation[], nodeMap: {
|
|
2052
1944
|
[key: number]: number;
|
|
2053
|
-
}, nodes: BABYLON.GLTF2.INode[], binaryWriter: _BinaryWriter, bufferViews: BABYLON.GLTF2.IBufferView[], accessors: BABYLON.GLTF2.IAccessor[],
|
|
1945
|
+
}, nodes: BABYLON.GLTF2.INode[], binaryWriter: _BinaryWriter, bufferViews: BABYLON.GLTF2.IBufferView[], accessors: BABYLON.GLTF2.IAccessor[], animationSampleRate: number, shouldExportAnimation?: (animation: Animation) => boolean): void;
|
|
2054
1946
|
/**
|
|
2055
1947
|
* @ignore
|
|
2056
1948
|
* Create node and morph animations from the animation groups
|
|
@@ -2061,14 +1953,11 @@ declare module BABYLON {
|
|
|
2061
1953
|
* @param binaryWriter
|
|
2062
1954
|
* @param bufferViews
|
|
2063
1955
|
* @param accessors
|
|
2064
|
-
* @param convertToRightHandedSystemMap
|
|
2065
1956
|
* @param animationSampleRate
|
|
2066
1957
|
*/
|
|
2067
1958
|
static _CreateNodeAndMorphAnimationFromAnimationGroups(babylonScene: Scene, glTFAnimations: BABYLON.GLTF2.IAnimation[], nodeMap: {
|
|
2068
1959
|
[key: number]: number;
|
|
2069
|
-
},
|
|
2070
|
-
[nodeId: number]: boolean;
|
|
2071
|
-
}, animationSampleRate: number, shouldExportAnimation?: (animation: Animation) => boolean): void;
|
|
1960
|
+
}, binaryWriter: _BinaryWriter, bufferViews: BABYLON.GLTF2.IBufferView[], accessors: BABYLON.GLTF2.IAccessor[], animationSampleRate: number, shouldExportAnimation?: (animation: Animation) => boolean): void;
|
|
2072
1961
|
private static _AddAnimation;
|
|
2073
1962
|
/**
|
|
2074
1963
|
* Create a baked animation
|
|
@@ -2084,7 +1973,6 @@ declare module BABYLON {
|
|
|
2084
1973
|
* @param minMaxFrames
|
|
2085
1974
|
* @param minMaxFrames.min
|
|
2086
1975
|
* @param minMaxFrames.max
|
|
2087
|
-
* @param convertToRightHandedSystem converts the values to right-handed
|
|
2088
1976
|
* @param useQuaternion specifies if quaternions should be used
|
|
2089
1977
|
*/
|
|
2090
1978
|
private static _CreateBakedAnimation;
|
|
@@ -2095,10 +1983,8 @@ declare module BABYLON {
|
|
|
2095
1983
|
* @param babylonTransformNode BabylonJS mesh
|
|
2096
1984
|
* @param animation BabylonJS animation
|
|
2097
1985
|
* @param animationChannelTargetPath The target animation channel
|
|
2098
|
-
* @param frameDelta The difference between the last and first frame of the animation
|
|
2099
1986
|
* @param inputs Array to store the key frame times
|
|
2100
1987
|
* @param outputs Array to store the key frame data
|
|
2101
|
-
* @param convertToRightHandedSystem Specifies if the position data should be converted to right handed
|
|
2102
1988
|
* @param useQuaternion Specifies if quaternions are used in the animation
|
|
2103
1989
|
*/
|
|
2104
1990
|
private static _CreateLinearOrStepAnimation;
|
|
@@ -2110,7 +1996,6 @@ declare module BABYLON {
|
|
|
2110
1996
|
* @param frameDelta The difference between the last and first frame of the animation
|
|
2111
1997
|
* @param inputs Array to store the key frame times
|
|
2112
1998
|
* @param outputs Array to store the key frame data
|
|
2113
|
-
* @param convertToRightHandedSystem Specifies if the position data should be converted to right handed
|
|
2114
1999
|
* @param useQuaternion Specifies if quaternions are used in the animation
|
|
2115
2000
|
*/
|
|
2116
2001
|
private static _CreateCubicSplineAnimation;
|
|
@@ -2122,7 +2007,6 @@ declare module BABYLON {
|
|
|
2122
2007
|
* @param outputs
|
|
2123
2008
|
* @param animationChannelTargetPath
|
|
2124
2009
|
* @param babylonTransformNode
|
|
2125
|
-
* @param convertToRightHandedSystem
|
|
2126
2010
|
* @param useQuaternion
|
|
2127
2011
|
*/
|
|
2128
2012
|
private static _AddKeyframeValue;
|
|
@@ -2144,7 +2028,6 @@ declare module BABYLON {
|
|
|
2144
2028
|
* @param keyFrame The key frame with the animation data
|
|
2145
2029
|
* @param frameDelta Time difference between two frames used to scale the tangent by the frame delta
|
|
2146
2030
|
* @param useQuaternion Specifies if quaternions are used
|
|
2147
|
-
* @param convertToRightHandedSystem Specifies if the values should be converted to right-handed
|
|
2148
2031
|
*/
|
|
2149
2032
|
private static _AddSplineTangent;
|
|
2150
2033
|
/**
|
|
@@ -2258,27 +2141,11 @@ declare module BABYLON {
|
|
|
2258
2141
|
mimeType: BABYLON.GLTF2.ImageMimeType;
|
|
2259
2142
|
};
|
|
2260
2143
|
};
|
|
2261
|
-
|
|
2262
|
-
data: ArrayBuffer;
|
|
2263
|
-
mimeType: BABYLON.GLTF2.ImageMimeType;
|
|
2264
|
-
}>;
|
|
2144
|
+
private _orderedImageData;
|
|
2265
2145
|
/**
|
|
2266
2146
|
* Stores a map of the unique id of a node to its index in the node array
|
|
2267
2147
|
*/
|
|
2268
|
-
_nodeMap
|
|
2269
|
-
[key: number]: number;
|
|
2270
|
-
};
|
|
2271
|
-
/**
|
|
2272
|
-
* Specifies if the source Babylon scene was left handed, and needed conversion.
|
|
2273
|
-
*/
|
|
2274
|
-
_convertToRightHandedSystem: boolean;
|
|
2275
|
-
/**
|
|
2276
|
-
* Specifies if a Babylon node should be converted to right-handed on export
|
|
2277
|
-
*/
|
|
2278
|
-
_convertToRightHandedSystemMap: {
|
|
2279
|
-
[nodeId: number]: boolean;
|
|
2280
|
-
};
|
|
2281
|
-
_includeCoordinateSystemConversionNodes: boolean;
|
|
2148
|
+
private _nodeMap;
|
|
2282
2149
|
/**
|
|
2283
2150
|
* Baked animation sample rate
|
|
2284
2151
|
*/
|
|
@@ -2293,9 +2160,9 @@ declare module BABYLON {
|
|
|
2293
2160
|
private _applyExtensions;
|
|
2294
2161
|
_extensionsPreExportTextureAsync(context: string, babylonTexture: Nullable<Texture>, mimeType: BABYLON.GLTF2.ImageMimeType): Promise<Nullable<BaseTexture>>;
|
|
2295
2162
|
_extensionsPostExportMeshPrimitiveAsync(context: string, meshPrimitive: BABYLON.GLTF2.IMeshPrimitive, babylonSubMesh: SubMesh, binaryWriter: _BinaryWriter): Promise<Nullable<BABYLON.GLTF2.IMeshPrimitive>>;
|
|
2296
|
-
_extensionsPostExportNodeAsync(context: string, node: Nullable<BABYLON.GLTF2.INode>, babylonNode: Node, nodeMap
|
|
2163
|
+
_extensionsPostExportNodeAsync(context: string, node: Nullable<BABYLON.GLTF2.INode>, babylonNode: Node, nodeMap: {
|
|
2297
2164
|
[key: number]: number;
|
|
2298
|
-
}, binaryWriter
|
|
2165
|
+
}, binaryWriter: _BinaryWriter): Promise<Nullable<BABYLON.GLTF2.INode>>;
|
|
2299
2166
|
_extensionsPostExportMaterialAsync(context: string, material: Nullable<BABYLON.GLTF2.IMaterial>, babylonMaterial: Material): Promise<Nullable<BABYLON.GLTF2.IMaterial>>;
|
|
2300
2167
|
_extensionsPostExportMaterialAdditionalTextures(context: string, material: BABYLON.GLTF2.IMaterial, babylonMaterial: Material): BaseTexture[];
|
|
2301
2168
|
_extensionsPostExportTextures(context: string, textureInfo: BABYLON.GLTF2.ITextureInfo, babylonTexture: BaseTexture): void;
|
|
@@ -2331,51 +2198,40 @@ declare module BABYLON {
|
|
|
2331
2198
|
* clock-wise during export to glTF
|
|
2332
2199
|
* @param submesh BabylonJS submesh
|
|
2333
2200
|
* @param primitiveMode Primitive mode of the mesh
|
|
2334
|
-
* @param sideOrientation the winding order of the submesh
|
|
2335
2201
|
* @param vertexBufferKind The type of vertex attribute
|
|
2336
2202
|
* @param meshAttributeArray The vertex attribute data
|
|
2337
2203
|
* @param byteOffset The offset to the binary data
|
|
2338
2204
|
* @param binaryWriter The binary data for the glTF file
|
|
2339
|
-
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
2340
2205
|
*/
|
|
2341
2206
|
private _reorderVertexAttributeDataBasedOnPrimitiveMode;
|
|
2342
2207
|
/**
|
|
2343
2208
|
* Reorders the vertex attributes in the correct triangle mode order . This is necessary when indices are not available and the winding order is
|
|
2344
2209
|
* clock-wise during export to glTF
|
|
2345
2210
|
* @param submesh BabylonJS submesh
|
|
2346
|
-
* @param primitiveMode Primitive mode of the mesh
|
|
2347
|
-
* @param sideOrientation the winding order of the submesh
|
|
2348
2211
|
* @param vertexBufferKind The type of vertex attribute
|
|
2349
2212
|
* @param meshAttributeArray The vertex attribute data
|
|
2350
2213
|
* @param byteOffset The offset to the binary data
|
|
2351
2214
|
* @param binaryWriter The binary data for the glTF file
|
|
2352
|
-
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
2353
2215
|
*/
|
|
2354
2216
|
private _reorderTriangleFillMode;
|
|
2355
2217
|
/**
|
|
2356
2218
|
* Reorders the vertex attributes in the correct triangle strip order. This is necessary when indices are not available and the winding order is
|
|
2357
2219
|
* clock-wise during export to glTF
|
|
2358
2220
|
* @param submesh BabylonJS submesh
|
|
2359
|
-
* @param primitiveMode Primitive mode of the mesh
|
|
2360
|
-
* @param sideOrientation the winding order of the submesh
|
|
2361
2221
|
* @param vertexBufferKind The type of vertex attribute
|
|
2362
2222
|
* @param meshAttributeArray The vertex attribute data
|
|
2363
2223
|
* @param byteOffset The offset to the binary data
|
|
2364
2224
|
* @param binaryWriter The binary data for the glTF file
|
|
2365
|
-
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
2366
2225
|
*/
|
|
2367
2226
|
private _reorderTriangleStripDrawMode;
|
|
2368
2227
|
/**
|
|
2369
2228
|
* Reorders the vertex attributes in the correct triangle fan order. This is necessary when indices are not available and the winding order is
|
|
2370
2229
|
* clock-wise during export to glTF
|
|
2371
2230
|
* @param submesh BabylonJS submesh
|
|
2372
|
-
* @param primitiveMode Primitive mode of the mesh
|
|
2373
|
-
* @param sideOrientation the winding order of the submesh
|
|
2374
2231
|
* @param vertexBufferKind The type of vertex attribute
|
|
2375
2232
|
* @param meshAttributeArray The vertex attribute data
|
|
2376
2233
|
* @param byteOffset The offset to the binary data
|
|
2377
2234
|
* @param binaryWriter The binary data for the glTF file
|
|
2378
|
-
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
2379
2235
|
*/
|
|
2380
2236
|
private _reorderTriangleFanMode;
|
|
2381
2237
|
/**
|
|
@@ -2383,9 +2239,7 @@ declare module BABYLON {
|
|
|
2383
2239
|
* @param vertices The vertices to write to the binary writer
|
|
2384
2240
|
* @param byteOffset The offset into the binary writer to overwrite binary data
|
|
2385
2241
|
* @param vertexAttributeKind The vertex attribute type
|
|
2386
|
-
* @param meshAttributeArray The vertex attribute data
|
|
2387
2242
|
* @param binaryWriter The writer containing the binary data
|
|
2388
|
-
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
2389
2243
|
*/
|
|
2390
2244
|
private _writeVertexAttributeData;
|
|
2391
2245
|
/**
|
|
@@ -2396,10 +2250,9 @@ declare module BABYLON {
|
|
|
2396
2250
|
* @param meshAttributeArray Array containing the attribute data
|
|
2397
2251
|
* @param stride Specifies the space between data
|
|
2398
2252
|
* @param binaryWriter The buffer to write the binary data to
|
|
2399
|
-
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
2400
2253
|
* @param babylonTransformNode
|
|
2401
2254
|
*/
|
|
2402
|
-
_writeAttributeData(vertexBufferKind: string, attributeComponentKind: BABYLON.GLTF2.AccessorComponentType, meshAttributeArray: FloatArray, stride: number, binaryWriter: _BinaryWriter,
|
|
2255
|
+
_writeAttributeData(vertexBufferKind: string, attributeComponentKind: BABYLON.GLTF2.AccessorComponentType, meshAttributeArray: FloatArray, stride: number, binaryWriter: _BinaryWriter, babylonTransformNode: TransformNode): void;
|
|
2403
2256
|
/**
|
|
2404
2257
|
* Writes mesh attribute data to a data buffer
|
|
2405
2258
|
* Returns the bytelength of the data
|
|
@@ -2411,10 +2264,9 @@ declare module BABYLON {
|
|
|
2411
2264
|
* @param morphTargetAttributeArray
|
|
2412
2265
|
* @param stride Specifies the space between data
|
|
2413
2266
|
* @param binaryWriter The buffer to write the binary data to
|
|
2414
|
-
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
2415
2267
|
* @param minMax
|
|
2416
2268
|
*/
|
|
2417
|
-
writeMorphTargetAttributeData(vertexBufferKind: string, attributeComponentKind: BABYLON.GLTF2.AccessorComponentType, meshPrimitive: SubMesh,
|
|
2269
|
+
writeMorphTargetAttributeData(vertexBufferKind: string, attributeComponentKind: BABYLON.GLTF2.AccessorComponentType, meshPrimitive: SubMesh, meshAttributeArray: FloatArray, morphTargetAttributeArray: FloatArray, stride: number, binaryWriter: _BinaryWriter, minMax?: any): void;
|
|
2418
2270
|
/**
|
|
2419
2271
|
* Generates glTF json data
|
|
2420
2272
|
* @param shouldUseGlb Indicates whether the json should be written for a glb file
|
|
@@ -2449,7 +2301,6 @@ declare module BABYLON {
|
|
|
2449
2301
|
* Sets the TRS for each node
|
|
2450
2302
|
* @param node glTF Node for storing the transformation data
|
|
2451
2303
|
* @param babylonTransformNode Babylon mesh used as the source for the transformation data
|
|
2452
|
-
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
2453
2304
|
*/
|
|
2454
2305
|
private _setNodeTransformation;
|
|
2455
2306
|
private _setCameraTransformation;
|
|
@@ -2461,7 +2312,6 @@ declare module BABYLON {
|
|
|
2461
2312
|
* @param babylonTransformNode The Babylon mesh to get the vertices data from
|
|
2462
2313
|
* @param binaryWriter The buffer to write the bufferview data to
|
|
2463
2314
|
* @param byteStride
|
|
2464
|
-
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
2465
2315
|
*/
|
|
2466
2316
|
private _createBufferViewKind;
|
|
2467
2317
|
/**
|
|
@@ -2470,7 +2320,6 @@ declare module BABYLON {
|
|
|
2470
2320
|
* @param meshPrimitive
|
|
2471
2321
|
* @param babylonMorphTarget the morph target to be exported
|
|
2472
2322
|
* @param binaryWriter The buffer to write the bufferview data to
|
|
2473
|
-
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
2474
2323
|
*/
|
|
2475
2324
|
private _setMorphTargetAttributes;
|
|
2476
2325
|
/**
|
|
@@ -2496,15 +2345,8 @@ declare module BABYLON {
|
|
|
2496
2345
|
* @param mesh glTF Mesh object to store the primitive attribute information
|
|
2497
2346
|
* @param babylonTransformNode Babylon mesh to get the primitive attribute data from
|
|
2498
2347
|
* @param binaryWriter Buffer to write the attribute data to
|
|
2499
|
-
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
2500
2348
|
*/
|
|
2501
2349
|
private _setPrimitiveAttributesAsync;
|
|
2502
|
-
/**
|
|
2503
|
-
* Check if the node is used to convert its descendants from a right handed coordinate system to the Babylon scene's coordinate system.
|
|
2504
|
-
* @param node The node to check
|
|
2505
|
-
* @returns True if the node is used to convert its descendants from right-handed to left-handed. False otherwise
|
|
2506
|
-
*/
|
|
2507
|
-
private _isBabylonCoordinateSystemConvertingNode;
|
|
2508
2350
|
/**
|
|
2509
2351
|
* Creates a glTF scene based on the array of meshes
|
|
2510
2352
|
* Returns the the total byte offset
|
|
@@ -2521,7 +2363,6 @@ declare module BABYLON {
|
|
|
2521
2363
|
private _getExportNodes;
|
|
2522
2364
|
/**
|
|
2523
2365
|
* Creates a mapping of Node unique id to node index and handles animations
|
|
2524
|
-
* @param babylonScene Babylon Scene
|
|
2525
2366
|
* @param nodes Babylon transform nodes
|
|
2526
2367
|
* @param binaryWriter Buffer to write binary data to
|
|
2527
2368
|
* @returns Node mapping of unique id to index
|
|
@@ -2531,7 +2372,6 @@ declare module BABYLON {
|
|
|
2531
2372
|
* Creates a glTF node from a Babylon mesh
|
|
2532
2373
|
* @param babylonNode Source Babylon mesh
|
|
2533
2374
|
* @param binaryWriter Buffer for storing geometry data
|
|
2534
|
-
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
2535
2375
|
* @returns glTF node
|
|
2536
2376
|
*/
|
|
2537
2377
|
private _createNodeAsync;
|
|
@@ -2668,9 +2508,9 @@ declare module BABYLON {
|
|
|
2668
2508
|
* @param babylonNode BabylonJS node
|
|
2669
2509
|
* @returns nullable BABYLON.GLTF2.INode promise
|
|
2670
2510
|
*/
|
|
2671
|
-
postExportNodeAsync?(context: string, node: Nullable<BABYLON.GLTF2.INode>, babylonNode: Node, nodeMap
|
|
2511
|
+
postExportNodeAsync?(context: string, node: Nullable<BABYLON.GLTF2.INode>, babylonNode: Node, nodeMap: {
|
|
2672
2512
|
[key: number]: number;
|
|
2673
|
-
}, binaryWriter
|
|
2513
|
+
}, binaryWriter: _BinaryWriter): Promise<Nullable<BABYLON.GLTF2.INode>>;
|
|
2674
2514
|
/**
|
|
2675
2515
|
* Define this method to modify the default behavior when exporting a material
|
|
2676
2516
|
* @param material glTF material
|
|
@@ -2905,19 +2745,24 @@ declare module BABYLON {
|
|
|
2905
2745
|
*/
|
|
2906
2746
|
metadataSelector?(metadata: any): any;
|
|
2907
2747
|
/**
|
|
2908
|
-
* The sample rate to bake animation curves
|
|
2748
|
+
* The sample rate to bake animation curves. Defaults to 1 / 60.
|
|
2909
2749
|
*/
|
|
2910
2750
|
animationSampleRate?: number;
|
|
2911
2751
|
/**
|
|
2912
|
-
* Begin serialization without waiting for the scene to be ready
|
|
2752
|
+
* Begin serialization without waiting for the scene to be ready. Defaults to false.
|
|
2913
2753
|
*/
|
|
2914
2754
|
exportWithoutWaitingForScene?: boolean;
|
|
2915
2755
|
/**
|
|
2916
|
-
* Indicates if unused vertex uv attributes should be included in export
|
|
2756
|
+
* Indicates if unused vertex uv attributes should be included in export. Defaults to false.
|
|
2917
2757
|
*/
|
|
2918
2758
|
exportUnusedUVs?: boolean;
|
|
2919
2759
|
/**
|
|
2920
|
-
*
|
|
2760
|
+
* Remove no-op root nodes when possible. Defaults to true.
|
|
2761
|
+
*/
|
|
2762
|
+
removeNoopRootNodes?: boolean;
|
|
2763
|
+
/**
|
|
2764
|
+
* Indicates if coordinate system swapping root nodes should be included in export. Defaults to false.
|
|
2765
|
+
* @deprecated Please use removeNoopRootNodes instead
|
|
2921
2766
|
*/
|
|
2922
2767
|
includeCoordinateSystemConversionNodes?: boolean;
|
|
2923
2768
|
}
|
|
@@ -2979,65 +2824,12 @@ declare module BABYLON {
|
|
|
2979
2824
|
* @param positions Positions array of a mesh
|
|
2980
2825
|
* @param vertexStart Starting vertex offset to calculate min and max values
|
|
2981
2826
|
* @param vertexCount Number of vertices to check for min and max values
|
|
2982
|
-
* @param convertToRightHandedSystem
|
|
2983
2827
|
* @returns min number array and max number array
|
|
2984
2828
|
*/
|
|
2985
|
-
static _CalculateMinMaxPositions(positions: FloatArray, vertexStart: number, vertexCount: number
|
|
2829
|
+
static _CalculateMinMaxPositions(positions: FloatArray, vertexStart: number, vertexCount: number): {
|
|
2986
2830
|
min: number[];
|
|
2987
2831
|
max: number[];
|
|
2988
2832
|
};
|
|
2989
|
-
/**
|
|
2990
|
-
* Converts a new right-handed Vector3
|
|
2991
|
-
* @param vector vector3 array
|
|
2992
|
-
* @returns right-handed Vector3
|
|
2993
|
-
*/
|
|
2994
|
-
static _GetRightHandedPositionVector3(vector: Vector3): Vector3;
|
|
2995
|
-
/**
|
|
2996
|
-
* Converts a Vector3 to right-handed
|
|
2997
|
-
* @param vector Vector3 to convert to right-handed
|
|
2998
|
-
*/
|
|
2999
|
-
static _GetRightHandedPositionVector3FromRef(vector: Vector3): void;
|
|
3000
|
-
/**
|
|
3001
|
-
* Converts a three element number array to right-handed
|
|
3002
|
-
* @param vector number array to convert to right-handed
|
|
3003
|
-
*/
|
|
3004
|
-
static _GetRightHandedPositionArray3FromRef(vector: number[]): void;
|
|
3005
|
-
/**
|
|
3006
|
-
* Converts a new right-handed Vector3
|
|
3007
|
-
* @param vector vector3 array
|
|
3008
|
-
* @returns right-handed Vector3
|
|
3009
|
-
*/
|
|
3010
|
-
static _GetRightHandedNormalVector3(vector: Vector3): Vector3;
|
|
3011
|
-
/**
|
|
3012
|
-
* Converts a Vector3 to right-handed
|
|
3013
|
-
* @param vector Vector3 to convert to right-handed
|
|
3014
|
-
*/
|
|
3015
|
-
static _GetRightHandedNormalVector3FromRef(vector: Vector3): void;
|
|
3016
|
-
/**
|
|
3017
|
-
* Converts a three element number array to right-handed
|
|
3018
|
-
* @param vector number array to convert to right-handed
|
|
3019
|
-
*/
|
|
3020
|
-
static _GetRightHandedNormalArray3FromRef(vector: number[]): void;
|
|
3021
|
-
/**
|
|
3022
|
-
* Converts a Vector4 to right-handed
|
|
3023
|
-
* @param vector Vector4 to convert to right-handed
|
|
3024
|
-
*/
|
|
3025
|
-
static _GetRightHandedVector4FromRef(vector: Vector4): void;
|
|
3026
|
-
/**
|
|
3027
|
-
* Converts a Vector4 to right-handed
|
|
3028
|
-
* @param vector Vector4 to convert to right-handed
|
|
3029
|
-
*/
|
|
3030
|
-
static _GetRightHandedArray4FromRef(vector: number[]): void;
|
|
3031
|
-
/**
|
|
3032
|
-
* Converts a Quaternion to right-handed
|
|
3033
|
-
* @param quaternion Source quaternion to convert to right-handed
|
|
3034
|
-
*/
|
|
3035
|
-
static _GetRightHandedQuaternionFromRef(quaternion: Quaternion): void;
|
|
3036
|
-
/**
|
|
3037
|
-
* Converts a Quaternion to right-handed
|
|
3038
|
-
* @param quaternion Source quaternion to convert to right-handed
|
|
3039
|
-
*/
|
|
3040
|
-
static _GetRightHandedQuaternionArrayFromRef(quaternion: number[]): void;
|
|
3041
2833
|
static _NormalizeTangentFromRef(tangent: Vector4): void;
|
|
3042
2834
|
static _GetDataAccessorElementCount(accessorType: BABYLON.GLTF2.AccessorType): 1 | 3 | 2 | 4 | 9 | 16;
|
|
3043
2835
|
}
|