@onerjs/serializers 8.28.6 → 8.28.8
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/glTF/2.0/Extensions/KHR_materials_anisotropy.js +1 -1
- package/glTF/2.0/Extensions/KHR_materials_anisotropy.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.js +1 -1
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_clearcoat_anisotropy.js +1 -1
- package/glTF/2.0/Extensions/KHR_materials_clearcoat_anisotropy.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_clearcoat_color.js +1 -1
- package/glTF/2.0/Extensions/KHR_materials_clearcoat_color.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_clearcoat_darkening.js +1 -1
- package/glTF/2.0/Extensions/KHR_materials_clearcoat_darkening.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_clearcoat_ior.js +1 -1
- package/glTF/2.0/Extensions/KHR_materials_clearcoat_ior.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_diffuse_roughness.js +1 -1
- package/glTF/2.0/Extensions/KHR_materials_diffuse_roughness.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_iridescence.js +1 -1
- package/glTF/2.0/Extensions/KHR_materials_iridescence.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_specular.js +1 -1
- package/glTF/2.0/Extensions/KHR_materials_specular.js.map +1 -1
- package/glTF/2.0/glTFExporter.js +1 -1
- package/glTF/2.0/glTFExporter.js.map +1 -1
- package/glTF/2.0/glTFExporter2.d.ts +113 -0
- package/glTF/2.0/glTFExporter2.js +1198 -0
- package/glTF/2.0/glTFExporter2.js.map +1 -0
- package/glTF/2.0/glTFMaterialExporter.d.ts +1 -1
- package/glTF/2.0/glTFMaterialExporter.js.map +1 -1
- package/glTF/2.0/glTFSerializer.d.ts +8 -0
- package/glTF/2.0/glTFSerializer.js +17 -0
- package/glTF/2.0/glTFSerializer.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import type { IBufferView, IAccessor, INode, IScene, IMesh, IMaterial, ITexture, IImage, ISampler, IAnimation, IMeshPrimitive, IGLTF, ITextureInfo, ISkin, ICamera, ImageMimeType } from "babylonjs-gltf2interface";
|
|
2
|
+
import type { Nullable } from "@onerjs/core/types.js";
|
|
3
|
+
import type { Node } from "@onerjs/core/node.js";
|
|
4
|
+
import type { BaseTexture } from "@onerjs/core/Materials/Textures/baseTexture.js";
|
|
5
|
+
import { Material } from "@onerjs/core/Materials/material.js";
|
|
6
|
+
import type { Scene } from "@onerjs/core/scene.js";
|
|
7
|
+
import type { IGLTFExporterExtensionV2 } from "./glTFExporterExtension.js";
|
|
8
|
+
import { GLTFMaterialExporter } from "./glTFMaterialExporter.js";
|
|
9
|
+
import type { IExportOptions } from "./glTFSerializer.js";
|
|
10
|
+
import { GLTFData } from "./glTFData.js";
|
|
11
|
+
import { BufferManager } from "./bufferManager.js";
|
|
12
|
+
/** @internal */
|
|
13
|
+
export declare class GLTFExporter {
|
|
14
|
+
readonly _glTF: IGLTF;
|
|
15
|
+
readonly _animations: IAnimation[];
|
|
16
|
+
readonly _accessors: IAccessor[];
|
|
17
|
+
readonly _bufferViews: IBufferView[];
|
|
18
|
+
readonly _cameras: ICamera[];
|
|
19
|
+
readonly _images: IImage[];
|
|
20
|
+
readonly _materials: IMaterial[];
|
|
21
|
+
readonly _meshes: IMesh[];
|
|
22
|
+
readonly _nodes: INode[];
|
|
23
|
+
readonly _samplers: ISampler[];
|
|
24
|
+
readonly _scenes: IScene[];
|
|
25
|
+
readonly _skins: ISkin[];
|
|
26
|
+
readonly _textures: ITexture[];
|
|
27
|
+
readonly _babylonScene: Scene;
|
|
28
|
+
readonly _imageData: {
|
|
29
|
+
[fileName: string]: {
|
|
30
|
+
data: ArrayBuffer;
|
|
31
|
+
mimeType: ImageMimeType;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Baked animation sample rate
|
|
36
|
+
*/
|
|
37
|
+
private _animationSampleRate;
|
|
38
|
+
private readonly _options;
|
|
39
|
+
_shouldUseGlb: boolean;
|
|
40
|
+
readonly _materialExporter: GLTFMaterialExporter;
|
|
41
|
+
private readonly _extensions;
|
|
42
|
+
readonly _bufferManager: BufferManager;
|
|
43
|
+
private readonly _shouldExportNodeMap;
|
|
44
|
+
private readonly _nodeMap;
|
|
45
|
+
readonly _materialMap: Map<Material, number>;
|
|
46
|
+
private readonly _camerasMap;
|
|
47
|
+
private readonly _nodesCameraMap;
|
|
48
|
+
private readonly _skinMap;
|
|
49
|
+
private readonly _nodesSkinMap;
|
|
50
|
+
readonly _materialNeedsUVsSet: Set<Material>;
|
|
51
|
+
private static readonly _ExtensionNames;
|
|
52
|
+
private static readonly _ExtensionFactories;
|
|
53
|
+
private static readonly _ExtensionOrders;
|
|
54
|
+
private _ApplyExtension;
|
|
55
|
+
private _ApplyExtensions;
|
|
56
|
+
_extensionsPostExportNodeAsync(context: string, node: INode, babylonNode: Node, nodeMap: Map<Node, number>, convertToRightHanded: boolean): Promise<Nullable<INode>>;
|
|
57
|
+
_extensionsPostExportMaterialAsync(context: string, material: IMaterial, babylonMaterial: Material): Promise<Nullable<IMaterial>>;
|
|
58
|
+
/**
|
|
59
|
+
* Get additional textures for a material
|
|
60
|
+
* @param context The context when loading the asset
|
|
61
|
+
* @param material The glTF material
|
|
62
|
+
* @param babylonMaterial The Babylon.js material
|
|
63
|
+
* @returns List of additional textures
|
|
64
|
+
*/
|
|
65
|
+
_extensionsPostExportMaterialAdditionalTexturesAsync(context: string, material: IMaterial, babylonMaterial: Material): Promise<BaseTexture[]>;
|
|
66
|
+
_extensionsPostExportTextures(context: string, textureInfo: ITextureInfo, babylonTexture: BaseTexture): void;
|
|
67
|
+
_extensionsPostExportMeshPrimitive(primitive: IMeshPrimitive): void;
|
|
68
|
+
_extensionsPreGenerateBinaryAsync(): Promise<void>;
|
|
69
|
+
private _forEachExtensions;
|
|
70
|
+
private _extensionsOnExporting;
|
|
71
|
+
private _loadExtensions;
|
|
72
|
+
constructor(babylonScene?: Nullable<Scene>, options?: IExportOptions);
|
|
73
|
+
dispose(): void;
|
|
74
|
+
get options(): Required<IExportOptions>;
|
|
75
|
+
static RegisterExtension(name: string, factory: (exporter: GLTFExporter) => IGLTFExporterExtensionV2, order?: number): void;
|
|
76
|
+
static UnregisterExtension(name: string): boolean;
|
|
77
|
+
private _generateJSON;
|
|
78
|
+
generateGLTFAsync(glTFPrefix: string): Promise<GLTFData>;
|
|
79
|
+
private _generateBinaryAsync;
|
|
80
|
+
/**
|
|
81
|
+
* Pads the number to a multiple of 4
|
|
82
|
+
* @param num number to pad
|
|
83
|
+
* @returns padded number
|
|
84
|
+
*/
|
|
85
|
+
private _getPadding;
|
|
86
|
+
generateGLBAsync(glTFPrefix: string): Promise<GLTFData>;
|
|
87
|
+
private _setNodeTransformation;
|
|
88
|
+
private _setCameraTransformation;
|
|
89
|
+
private _listAvailableCameras;
|
|
90
|
+
private _exportAndAssignCameras;
|
|
91
|
+
private _listAvailableSkeletons;
|
|
92
|
+
private _exportAndAssignSkeletons;
|
|
93
|
+
private _exportSceneAsync;
|
|
94
|
+
private _shouldExportNode;
|
|
95
|
+
private _exportNodesAsync;
|
|
96
|
+
private _collectBuffers;
|
|
97
|
+
private _exportBuffers;
|
|
98
|
+
/**
|
|
99
|
+
* Processes a node to be exported to the glTF file
|
|
100
|
+
* @returns A promise that resolves once the node has been exported
|
|
101
|
+
* @internal
|
|
102
|
+
*/
|
|
103
|
+
private _exportNodeAsync;
|
|
104
|
+
/**
|
|
105
|
+
* Creates a glTF node from a Babylon.js node. If skipped, returns null.
|
|
106
|
+
* @internal
|
|
107
|
+
*/
|
|
108
|
+
private _createNodeAsync;
|
|
109
|
+
private _exportIndices;
|
|
110
|
+
private _exportVertexBuffer;
|
|
111
|
+
private _exportMaterialAsync;
|
|
112
|
+
private _exportMeshAsync;
|
|
113
|
+
}
|