@babylonjs/loaders 5.0.0-rc.5 → 5.0.0-rc.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/OBJ/index.d.ts +4 -4
  2. package/OBJ/index.js +4 -4
  3. package/OBJ/mtlFileLoader.d.ts +41 -41
  4. package/OBJ/mtlFileLoader.js +232 -232
  5. package/OBJ/objFileLoader.d.ts +126 -126
  6. package/OBJ/objFileLoader.js +296 -296
  7. package/OBJ/objLoadingOptions.d.ts +43 -43
  8. package/OBJ/objLoadingOptions.js +1 -1
  9. package/OBJ/solidParser.d.ts +154 -154
  10. package/OBJ/solidParser.js +693 -693
  11. package/STL/index.d.ts +1 -1
  12. package/STL/index.js +1 -1
  13. package/STL/stlFileLoader.d.ts +64 -64
  14. package/STL/stlFileLoader.js +233 -233
  15. package/glTF/1.0/glTFBinaryExtension.d.ts +13 -13
  16. package/glTF/1.0/glTFBinaryExtension.js +60 -60
  17. package/glTF/1.0/glTFLoader.d.ts +136 -136
  18. package/glTF/1.0/glTFLoader.js +1815 -1815
  19. package/glTF/1.0/glTFLoaderInterfaces.d.ts +412 -412
  20. package/glTF/1.0/glTFLoaderInterfaces.js +95 -95
  21. package/glTF/1.0/glTFLoaderUtils.d.ts +62 -62
  22. package/glTF/1.0/glTFLoaderUtils.js +250 -250
  23. package/glTF/1.0/glTFMaterialsCommonExtension.d.ts +10 -10
  24. package/glTF/1.0/glTFMaterialsCommonExtension.js +129 -129
  25. package/glTF/1.0/index.d.ts +5 -5
  26. package/glTF/1.0/index.js +5 -5
  27. package/glTF/2.0/Extensions/EXT_lights_image_based.d.ts +43 -43
  28. package/glTF/2.0/Extensions/EXT_lights_image_based.js +117 -117
  29. package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.d.ts +36 -36
  30. package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js +88 -88
  31. package/glTF/2.0/Extensions/EXT_meshopt_compression.d.ts +34 -34
  32. package/glTF/2.0/Extensions/EXT_meshopt_compression.js +49 -49
  33. package/glTF/2.0/Extensions/EXT_texture_webp.d.ts +29 -29
  34. package/glTF/2.0/Extensions/EXT_texture_webp.js +40 -40
  35. package/glTF/2.0/Extensions/ExtrasAsMetadata.d.ts +50 -50
  36. package/glTF/2.0/Extensions/ExtrasAsMetadata.js +73 -73
  37. package/glTF/2.0/Extensions/KHR_draco_mesh_compression.d.ts +39 -39
  38. package/glTF/2.0/Extensions/KHR_draco_mesh_compression.js +112 -112
  39. package/glTF/2.0/Extensions/KHR_lights_punctual.d.ts +36 -36
  40. package/glTF/2.0/Extensions/KHR_lights_punctual.js +89 -89
  41. package/glTF/2.0/Extensions/KHR_materials_clearcoat.d.ts +39 -39
  42. package/glTF/2.0/Extensions/KHR_materials_clearcoat.js +94 -94
  43. package/glTF/2.0/Extensions/KHR_materials_emissive_strength.d.ts +38 -38
  44. package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js +53 -53
  45. package/glTF/2.0/Extensions/KHR_materials_ior.d.ts +42 -42
  46. package/glTF/2.0/Extensions/KHR_materials_ior.js +62 -62
  47. package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.d.ts +38 -38
  48. package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js +80 -80
  49. package/glTF/2.0/Extensions/KHR_materials_sheen.d.ts +39 -39
  50. package/glTF/2.0/Extensions/KHR_materials_sheen.js +84 -84
  51. package/glTF/2.0/Extensions/KHR_materials_specular.d.ts +38 -38
  52. package/glTF/2.0/Extensions/KHR_materials_specular.js +74 -74
  53. package/glTF/2.0/Extensions/KHR_materials_translucency.d.ts +39 -39
  54. package/glTF/2.0/Extensions/KHR_materials_translucency.js +83 -83
  55. package/glTF/2.0/Extensions/KHR_materials_transmission.d.ts +38 -38
  56. package/glTF/2.0/Extensions/KHR_materials_transmission.js +288 -288
  57. package/glTF/2.0/Extensions/KHR_materials_unlit.d.ts +38 -38
  58. package/glTF/2.0/Extensions/KHR_materials_unlit.js +73 -73
  59. package/glTF/2.0/Extensions/KHR_materials_variants.d.ts +87 -87
  60. package/glTF/2.0/Extensions/KHR_materials_variants.js +254 -254
  61. package/glTF/2.0/Extensions/KHR_materials_volume.d.ts +39 -39
  62. package/glTF/2.0/Extensions/KHR_materials_volume.js +85 -85
  63. package/glTF/2.0/Extensions/KHR_mesh_quantization.d.ts +22 -22
  64. package/glTF/2.0/Extensions/KHR_mesh_quantization.js +23 -23
  65. package/glTF/2.0/Extensions/KHR_texture_basisu.d.ts +29 -29
  66. package/glTF/2.0/Extensions/KHR_texture_basisu.js +40 -40
  67. package/glTF/2.0/Extensions/KHR_texture_transform.d.ts +33 -33
  68. package/glTF/2.0/Extensions/KHR_texture_transform.js +61 -61
  69. package/glTF/2.0/Extensions/KHR_xmp_json_ld.d.ts +32 -32
  70. package/glTF/2.0/Extensions/KHR_xmp_json_ld.js +49 -49
  71. package/glTF/2.0/Extensions/MSFT_audio_emitter.d.ts +54 -54
  72. package/glTF/2.0/Extensions/MSFT_audio_emitter.js +240 -240
  73. package/glTF/2.0/Extensions/MSFT_lod.d.ts +109 -109
  74. package/glTF/2.0/Extensions/MSFT_lod.js +369 -369
  75. package/glTF/2.0/Extensions/MSFT_minecraftMesh.d.ts +14 -14
  76. package/glTF/2.0/Extensions/MSFT_minecraftMesh.js +36 -36
  77. package/glTF/2.0/Extensions/MSFT_sRGBFactors.d.ts +14 -14
  78. package/glTF/2.0/Extensions/MSFT_sRGBFactors.js +36 -36
  79. package/glTF/2.0/Extensions/index.d.ts +26 -26
  80. package/glTF/2.0/Extensions/index.js +26 -26
  81. package/glTF/2.0/glTFLoader.d.ts +405 -405
  82. package/glTF/2.0/glTFLoader.js +2366 -2366
  83. package/glTF/2.0/glTFLoaderExtension.d.ts +152 -152
  84. package/glTF/2.0/glTFLoaderExtension.js +1 -1
  85. package/glTF/2.0/glTFLoaderInterfaces.d.ts +211 -211
  86. package/glTF/2.0/glTFLoaderInterfaces.js +1 -1
  87. package/glTF/2.0/index.d.ts +4 -4
  88. package/glTF/2.0/index.js +4 -4
  89. package/glTF/glTFFileLoader.d.ts +433 -433
  90. package/glTF/glTFFileLoader.js +927 -927
  91. package/glTF/glTFValidation.d.ts +29 -29
  92. package/glTF/glTFValidation.js +123 -123
  93. package/glTF/index.d.ts +5 -5
  94. package/glTF/index.js +5 -5
  95. package/index.d.ts +3 -3
  96. package/index.js +3 -3
  97. package/legacy/legacy-glTF.d.ts +2 -2
  98. package/legacy/legacy-glTF.js +18 -18
  99. package/legacy/legacy-glTF1.d.ts +2 -2
  100. package/legacy/legacy-glTF1.js +14 -14
  101. package/legacy/legacy-glTF1FileLoader.d.ts +2 -2
  102. package/legacy/legacy-glTF1FileLoader.js +3 -3
  103. package/legacy/legacy-glTF2.d.ts +2 -2
  104. package/legacy/legacy-glTF2.js +32 -32
  105. package/legacy/legacy-glTF2FileLoader.d.ts +2 -2
  106. package/legacy/legacy-glTF2FileLoader.js +3 -3
  107. package/legacy/legacy-glTFFileLoader.d.ts +3 -3
  108. package/legacy/legacy-glTFFileLoader.js +4 -4
  109. package/legacy/legacy-objFileLoader.d.ts +1 -1
  110. package/legacy/legacy-objFileLoader.js +12 -12
  111. package/legacy/legacy-stlFileLoader.d.ts +1 -1
  112. package/legacy/legacy-stlFileLoader.js +12 -12
  113. package/legacy/legacy.d.ts +6 -6
  114. package/legacy/legacy.js +7 -7
  115. package/package.json +3 -3
@@ -1,405 +1,405 @@
1
- import { Nullable } from "@babylonjs/core/types.js";
2
- import { Camera } from "@babylonjs/core/Cameras/camera.js";
3
- import { AnimationGroup } from "@babylonjs/core/Animations/animationGroup.js";
4
- import { Material } from "@babylonjs/core/Materials/material.js";
5
- import { BaseTexture } from "@babylonjs/core/Materials/Textures/baseTexture.js";
6
- import { TransformNode } from "@babylonjs/core/Meshes/transformNode.js";
7
- import { AbstractMesh } from "@babylonjs/core/Meshes/abstractMesh.js";
8
- import { Mesh } from "@babylonjs/core/Meshes/mesh.js";
9
- import { ISceneLoaderAsyncResult, ISceneLoaderProgressEvent } from "@babylonjs/core/Loading/sceneLoader.js";
10
- import { Scene } from "@babylonjs/core/scene.js";
11
- import { IProperty } from "babylonjs-gltf2interface";
12
- import { IGLTF, ISampler, INode, IScene, IMesh, IAccessor, ICamera, IAnimation, IAnimationChannel, IBuffer, IBufferView, IMaterial, ITextureInfo, ITexture, IImage, IMeshPrimitive, IArrayItem as IArrItem } from "./glTFLoaderInterfaces";
13
- import { IGLTFLoaderExtension } from "./glTFLoaderExtension";
14
- import { IGLTFLoader, GLTFFileLoader, IGLTFLoaderData } from "../glTFFileLoader";
15
- import { IAnimatable } from "@babylonjs/core/Animations/animatable.interface.js";
16
- import { IDataBuffer } from "@babylonjs/core/Misc/dataReader.js";
17
- import { Light } from "@babylonjs/core/Lights/light.js";
18
- import { AssetContainer } from "@babylonjs/core/assetContainer.js";
19
- /**
20
- * Helper class for working with arrays when loading the glTF asset
21
- */
22
- export declare class ArrayItem {
23
- /**
24
- * Gets an item from the given array.
25
- * @param context The context when loading the asset
26
- * @param array The array to get the item from
27
- * @param index The index to the array
28
- * @returns The array item
29
- */
30
- static Get<T>(context: string, array: ArrayLike<T> | undefined, index: number | undefined): T;
31
- /**
32
- * Assign an `index` field to each item of the given array.
33
- * @param array The array of items
34
- */
35
- static Assign(array?: IArrItem[]): void;
36
- }
37
- /**
38
- * The glTF 2.0 loader
39
- */
40
- export declare class GLTFLoader implements IGLTFLoader {
41
- /** @hidden */
42
- _completePromises: Promise<any>[];
43
- /** @hidden */
44
- _assetContainer: Nullable<AssetContainer>;
45
- /** Storage */
46
- _babylonLights: Light[];
47
- /** @hidden */
48
- _disableInstancedMesh: number;
49
- private readonly _parent;
50
- private readonly _extensions;
51
- private _disposed;
52
- private _rootUrl;
53
- private _fileName;
54
- private _uniqueRootUrl;
55
- private _gltf;
56
- private _bin;
57
- private _babylonScene;
58
- private _rootBabylonMesh;
59
- private _defaultBabylonMaterialData;
60
- private _postSceneLoadActions;
61
- private static _RegisteredExtensions;
62
- /**
63
- * The default glTF sampler.
64
- */
65
- static readonly DefaultSampler: ISampler;
66
- /**
67
- * Registers a loader extension.
68
- * @param name The name of the loader extension.
69
- * @param factory The factory function that creates the loader extension.
70
- */
71
- static RegisterExtension(name: string, factory: (loader: GLTFLoader) => IGLTFLoaderExtension): void;
72
- /**
73
- * Unregisters a loader extension.
74
- * @param name The name of the loader extension.
75
- * @returns A boolean indicating whether the extension has been unregistered
76
- */
77
- static UnregisterExtension(name: string): boolean;
78
- /**
79
- * The object that represents the glTF JSON.
80
- */
81
- get gltf(): IGLTF;
82
- /**
83
- * The BIN chunk of a binary glTF.
84
- */
85
- get bin(): Nullable<IDataBuffer>;
86
- /**
87
- * The parent file loader.
88
- */
89
- get parent(): GLTFFileLoader;
90
- /**
91
- * The Babylon scene when loading the asset.
92
- */
93
- get babylonScene(): Scene;
94
- /**
95
- * The root Babylon mesh when loading the asset.
96
- */
97
- get rootBabylonMesh(): Nullable<Mesh>;
98
- /**
99
- * @param parent
100
- * @hidden
101
- */
102
- constructor(parent: GLTFFileLoader);
103
- /** @hidden */
104
- dispose(): void;
105
- /**
106
- * @param meshesNames
107
- * @param scene
108
- * @param container
109
- * @param data
110
- * @param rootUrl
111
- * @param onProgress
112
- * @param fileName
113
- * @hidden
114
- */
115
- importMeshAsync(meshesNames: any, scene: Scene, container: Nullable<AssetContainer>, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<ISceneLoaderAsyncResult>;
116
- /**
117
- * @param scene
118
- * @param data
119
- * @param rootUrl
120
- * @param onProgress
121
- * @param fileName
122
- * @hidden
123
- */
124
- loadAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<void>;
125
- private _loadAsync;
126
- private _loadData;
127
- private _setupData;
128
- private _loadExtensions;
129
- private _checkExtensions;
130
- private _createRootNode;
131
- /**
132
- * Loads a glTF scene.
133
- * @param context The context when loading the asset
134
- * @param scene The glTF scene property
135
- * @returns A promise that resolves when the load is complete
136
- */
137
- loadSceneAsync(context: string, scene: IScene): Promise<void>;
138
- private _forEachPrimitive;
139
- private _getGeometries;
140
- private _getMeshes;
141
- private _getTransformNodes;
142
- private _getSkeletons;
143
- private _getAnimationGroups;
144
- private _startAnimations;
145
- /**
146
- * Loads a glTF node.
147
- * @param context The context when loading the asset
148
- * @param node The glTF node property
149
- * @param assign A function called synchronously after parsing the glTF properties
150
- * @returns A promise that resolves with the loaded Babylon mesh when the load is complete
151
- */
152
- loadNodeAsync(context: string, node: INode, assign?: (babylonTransformNode: TransformNode) => void): Promise<TransformNode>;
153
- private _loadMeshAsync;
154
- /**
155
- * @hidden Define this method to modify the default behavior when loading data for mesh primitives.
156
- * @param context The context when loading the asset
157
- * @param name The mesh name when loading the asset
158
- * @param node The glTF node when loading the asset
159
- * @param mesh The glTF mesh when loading the asset
160
- * @param primitive The glTF mesh primitive property
161
- * @param assign A function called synchronously after parsing the glTF properties
162
- * @returns A promise that resolves with the loaded mesh when the load is complete or null if not handled
163
- */
164
- _loadMeshPrimitiveAsync(context: string, name: string, node: INode, mesh: IMesh, primitive: IMeshPrimitive, assign: (babylonMesh: AbstractMesh) => void): Promise<AbstractMesh>;
165
- private _loadVertexDataAsync;
166
- private _createMorphTargets;
167
- private _loadMorphTargetsAsync;
168
- private _loadMorphTargetVertexDataAsync;
169
- private static _LoadTransform;
170
- private _loadSkinAsync;
171
- private _loadBones;
172
- private _findSkeletonRootNode;
173
- private _loadBone;
174
- private _loadSkinInverseBindMatricesDataAsync;
175
- private _updateBoneMatrices;
176
- private _getNodeMatrix;
177
- /**
178
- * Loads a glTF camera.
179
- * @param context The context when loading the asset
180
- * @param camera The glTF camera property
181
- * @param assign A function called synchronously after parsing the glTF properties
182
- * @returns A promise that resolves with the loaded Babylon camera when the load is complete
183
- */
184
- loadCameraAsync(context: string, camera: ICamera, assign?: (babylonCamera: Camera) => void): Promise<Camera>;
185
- private _loadAnimationsAsync;
186
- /**
187
- * Loads a glTF animation.
188
- * @param context The context when loading the asset
189
- * @param animation The glTF animation property
190
- * @returns A promise that resolves with the loaded Babylon animation group when the load is complete
191
- */
192
- loadAnimationAsync(context: string, animation: IAnimation): Promise<AnimationGroup>;
193
- /**
194
- * @hidden Loads a glTF animation channel.
195
- * @param context The context when loading the asset
196
- * @param animationContext The context of the animation when loading the asset
197
- * @param animation The glTF animation property
198
- * @param channel The glTF animation channel property
199
- * @param babylonAnimationGroup The babylon animation group property
200
- * @param animationTargetOverride The babylon animation channel target override property. My be null.
201
- * @returns A void promise when the channel load is complete
202
- */
203
- _loadAnimationChannelAsync(context: string, animationContext: string, animation: IAnimation, channel: IAnimationChannel, babylonAnimationGroup: AnimationGroup, animationTargetOverride?: Nullable<IAnimatable>): Promise<void>;
204
- private _loadAnimationSamplerAsync;
205
- /**
206
- * Loads a glTF buffer.
207
- * @param context The context when loading the asset
208
- * @param buffer The glTF buffer property
209
- * @param byteOffset The byte offset to use
210
- * @param byteLength The byte length to use
211
- * @returns A promise that resolves with the loaded data when the load is complete
212
- */
213
- loadBufferAsync(context: string, buffer: IBuffer, byteOffset: number, byteLength: number): Promise<ArrayBufferView>;
214
- /**
215
- * Loads a glTF buffer view.
216
- * @param context The context when loading the asset
217
- * @param bufferView The glTF buffer view property
218
- * @returns A promise that resolves with the loaded data when the load is complete
219
- */
220
- loadBufferViewAsync(context: string, bufferView: IBufferView): Promise<ArrayBufferView>;
221
- private _loadAccessorAsync;
222
- /**
223
- * @param context
224
- * @param accessor
225
- * @hidden
226
- */
227
- _loadFloatAccessorAsync(context: string, accessor: IAccessor): Promise<Float32Array>;
228
- private _loadIndicesAccessorAsync;
229
- private _loadVertexBufferViewAsync;
230
- private _loadVertexAccessorAsync;
231
- private _loadMaterialMetallicRoughnessPropertiesAsync;
232
- /**
233
- * @param context
234
- * @param material
235
- * @param babylonMesh
236
- * @param babylonDrawMode
237
- * @param assign
238
- * @hidden
239
- */
240
- _loadMaterialAsync(context: string, material: IMaterial, babylonMesh: Nullable<Mesh>, babylonDrawMode: number, assign?: (babylonMaterial: Material) => void): Promise<Material>;
241
- private _createDefaultMaterial;
242
- /**
243
- * Creates a Babylon material from a glTF material.
244
- * @param context The context when loading the asset
245
- * @param material The glTF material property
246
- * @param babylonDrawMode The draw mode for the Babylon material
247
- * @returns The Babylon material
248
- */
249
- createMaterial(context: string, material: IMaterial, babylonDrawMode: number): Material;
250
- /**
251
- * Loads properties from a glTF material into a Babylon material.
252
- * @param context The context when loading the asset
253
- * @param material The glTF material property
254
- * @param babylonMaterial The Babylon material
255
- * @returns A promise that resolves when the load is complete
256
- */
257
- loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Promise<void>;
258
- /**
259
- * Loads the normal, occlusion, and emissive properties from a glTF material into a Babylon material.
260
- * @param context The context when loading the asset
261
- * @param material The glTF material property
262
- * @param babylonMaterial The Babylon material
263
- * @returns A promise that resolves when the load is complete
264
- */
265
- loadMaterialBasePropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Promise<void>;
266
- /**
267
- * Loads the alpha properties from a glTF material into a Babylon material.
268
- * Must be called after the setting the albedo texture of the Babylon material when the material has an albedo texture.
269
- * @param context The context when loading the asset
270
- * @param material The glTF material property
271
- * @param babylonMaterial The Babylon material
272
- */
273
- loadMaterialAlphaProperties(context: string, material: IMaterial, babylonMaterial: Material): void;
274
- /**
275
- * Loads a glTF texture info.
276
- * @param context The context when loading the asset
277
- * @param textureInfo The glTF texture info property
278
- * @param assign A function called synchronously after parsing the glTF properties
279
- * @returns A promise that resolves with the loaded Babylon texture when the load is complete
280
- */
281
- loadTextureInfoAsync(context: string, textureInfo: ITextureInfo, assign?: (babylonTexture: BaseTexture) => void): Promise<BaseTexture>;
282
- /**
283
- * @param context
284
- * @param texture
285
- * @param assign
286
- * @hidden
287
- */
288
- _loadTextureAsync(context: string, texture: ITexture, assign?: (babylonTexture: BaseTexture) => void): Promise<BaseTexture>;
289
- /**
290
- * @param context
291
- * @param sampler
292
- * @param image
293
- * @param assign
294
- * @param textureLoaderOptions
295
- * @param useSRGBBuffer
296
- * @hidden
297
- */
298
- _createTextureAsync(context: string, sampler: ISampler, image: IImage, assign?: (babylonTexture: BaseTexture) => void, textureLoaderOptions?: any, useSRGBBuffer?: boolean): Promise<BaseTexture>;
299
- private _loadSampler;
300
- /**
301
- * Loads a glTF image.
302
- * @param context The context when loading the asset
303
- * @param image The glTF image property
304
- * @returns A promise that resolves with the loaded data when the load is complete
305
- */
306
- loadImageAsync(context: string, image: IImage): Promise<ArrayBufferView>;
307
- /**
308
- * Loads a glTF uri.
309
- * @param context The context when loading the asset
310
- * @param property The glTF property associated with the uri
311
- * @param uri The base64 or relative uri
312
- * @returns A promise that resolves with the loaded data when the load is complete
313
- */
314
- loadUriAsync(context: string, property: IProperty, uri: string): Promise<ArrayBufferView>;
315
- /**
316
- * Adds a JSON pointer to the metadata of the Babylon object at `<object>.metadata.gltf.pointers`.
317
- * @param babylonObject the Babylon object with metadata
318
- * @param babylonObject.metadata
319
- * @param pointer the JSON pointer
320
- */
321
- static AddPointerMetadata(babylonObject: {
322
- metadata: any;
323
- }, pointer: string): void;
324
- private static _GetTextureWrapMode;
325
- private static _GetTextureSamplingMode;
326
- private static _GetTypedArrayConstructor;
327
- private static _GetTypedArray;
328
- private static _GetNumComponents;
329
- private static _ValidateUri;
330
- /**
331
- * @param context
332
- * @param mode
333
- * @hidden
334
- */
335
- static _GetDrawMode(context: string, mode: number | undefined): number;
336
- private _compileMaterialsAsync;
337
- private _compileShadowGeneratorsAsync;
338
- private _forEachExtensions;
339
- private _applyExtensions;
340
- private _extensionsOnLoading;
341
- private _extensionsOnReady;
342
- private _extensionsLoadSceneAsync;
343
- private _extensionsLoadNodeAsync;
344
- private _extensionsLoadCameraAsync;
345
- private _extensionsLoadVertexDataAsync;
346
- private _extensionsLoadMeshPrimitiveAsync;
347
- private _extensionsLoadMaterialAsync;
348
- private _extensionsCreateMaterial;
349
- private _extensionsLoadMaterialPropertiesAsync;
350
- private _extensionsLoadTextureInfoAsync;
351
- private _extensionsLoadTextureAsync;
352
- private _extensionsLoadAnimationAsync;
353
- private _extensionsLoadSkinAsync;
354
- private _extensionsLoadUriAsync;
355
- private _extensionsLoadBufferViewAsync;
356
- private _extensionsLoadBufferAsync;
357
- /**
358
- * Helper method called by a loader extension to load an glTF extension.
359
- * @param context The context when loading the asset
360
- * @param property The glTF property to load the extension from
361
- * @param extensionName The name of the extension to load
362
- * @param actionAsync The action to run
363
- * @returns The promise returned by actionAsync or null if the extension does not exist
364
- */
365
- static LoadExtensionAsync<TExtension = any, TResult = void>(context: string, property: IProperty, extensionName: string, actionAsync: (extensionContext: string, extension: TExtension) => Nullable<Promise<TResult>>): Nullable<Promise<TResult>>;
366
- /**
367
- * Helper method called by a loader extension to load a glTF extra.
368
- * @param context The context when loading the asset
369
- * @param property The glTF property to load the extra from
370
- * @param extensionName The name of the extension to load
371
- * @param actionAsync The action to run
372
- * @returns The promise returned by actionAsync or null if the extra does not exist
373
- */
374
- static LoadExtraAsync<TExtra = any, TResult = void>(context: string, property: IProperty, extensionName: string, actionAsync: (extraContext: string, extra: TExtra) => Nullable<Promise<TResult>>): Nullable<Promise<TResult>>;
375
- /**
376
- * Checks for presence of an extension.
377
- * @param name The name of the extension to check
378
- * @returns A boolean indicating the presence of the given extension name in `extensionsUsed`
379
- */
380
- isExtensionUsed(name: string): boolean;
381
- /**
382
- * Increments the indentation level and logs a message.
383
- * @param message The message to log
384
- */
385
- logOpen(message: string): void;
386
- /**
387
- * Decrements the indentation level.
388
- */
389
- logClose(): void;
390
- /**
391
- * Logs a message
392
- * @param message The message to log
393
- */
394
- log(message: string): void;
395
- /**
396
- * Starts a performance counter.
397
- * @param counterName The name of the performance counter
398
- */
399
- startPerformanceCounter(counterName: string): void;
400
- /**
401
- * Ends a performance counter.
402
- * @param counterName The name of the performance counter
403
- */
404
- endPerformanceCounter(counterName: string): void;
405
- }
1
+ import { Nullable } from "@babylonjs/core/types.js";
2
+ import { Camera } from "@babylonjs/core/Cameras/camera.js";
3
+ import { AnimationGroup } from "@babylonjs/core/Animations/animationGroup.js";
4
+ import { Material } from "@babylonjs/core/Materials/material.js";
5
+ import { BaseTexture } from "@babylonjs/core/Materials/Textures/baseTexture.js";
6
+ import { TransformNode } from "@babylonjs/core/Meshes/transformNode.js";
7
+ import { AbstractMesh } from "@babylonjs/core/Meshes/abstractMesh.js";
8
+ import { Mesh } from "@babylonjs/core/Meshes/mesh.js";
9
+ import { ISceneLoaderAsyncResult, ISceneLoaderProgressEvent } from "@babylonjs/core/Loading/sceneLoader.js";
10
+ import { Scene } from "@babylonjs/core/scene.js";
11
+ import { IProperty } from "babylonjs-gltf2interface";
12
+ import { IGLTF, ISampler, INode, IScene, IMesh, IAccessor, ICamera, IAnimation, IAnimationChannel, IBuffer, IBufferView, IMaterial, ITextureInfo, ITexture, IImage, IMeshPrimitive, IArrayItem as IArrItem } from "./glTFLoaderInterfaces";
13
+ import { IGLTFLoaderExtension } from "./glTFLoaderExtension";
14
+ import { IGLTFLoader, GLTFFileLoader, IGLTFLoaderData } from "../glTFFileLoader";
15
+ import { IAnimatable } from "@babylonjs/core/Animations/animatable.interface.js";
16
+ import { IDataBuffer } from "@babylonjs/core/Misc/dataReader.js";
17
+ import { Light } from "@babylonjs/core/Lights/light.js";
18
+ import { AssetContainer } from "@babylonjs/core/assetContainer.js";
19
+ /**
20
+ * Helper class for working with arrays when loading the glTF asset
21
+ */
22
+ export declare class ArrayItem {
23
+ /**
24
+ * Gets an item from the given array.
25
+ * @param context The context when loading the asset
26
+ * @param array The array to get the item from
27
+ * @param index The index to the array
28
+ * @returns The array item
29
+ */
30
+ static Get<T>(context: string, array: ArrayLike<T> | undefined, index: number | undefined): T;
31
+ /**
32
+ * Assign an `index` field to each item of the given array.
33
+ * @param array The array of items
34
+ */
35
+ static Assign(array?: IArrItem[]): void;
36
+ }
37
+ /**
38
+ * The glTF 2.0 loader
39
+ */
40
+ export declare class GLTFLoader implements IGLTFLoader {
41
+ /** @hidden */
42
+ _completePromises: Promise<any>[];
43
+ /** @hidden */
44
+ _assetContainer: Nullable<AssetContainer>;
45
+ /** Storage */
46
+ _babylonLights: Light[];
47
+ /** @hidden */
48
+ _disableInstancedMesh: number;
49
+ private readonly _parent;
50
+ private readonly _extensions;
51
+ private _disposed;
52
+ private _rootUrl;
53
+ private _fileName;
54
+ private _uniqueRootUrl;
55
+ private _gltf;
56
+ private _bin;
57
+ private _babylonScene;
58
+ private _rootBabylonMesh;
59
+ private _defaultBabylonMaterialData;
60
+ private _postSceneLoadActions;
61
+ private static _RegisteredExtensions;
62
+ /**
63
+ * The default glTF sampler.
64
+ */
65
+ static readonly DefaultSampler: ISampler;
66
+ /**
67
+ * Registers a loader extension.
68
+ * @param name The name of the loader extension.
69
+ * @param factory The factory function that creates the loader extension.
70
+ */
71
+ static RegisterExtension(name: string, factory: (loader: GLTFLoader) => IGLTFLoaderExtension): void;
72
+ /**
73
+ * Unregisters a loader extension.
74
+ * @param name The name of the loader extension.
75
+ * @returns A boolean indicating whether the extension has been unregistered
76
+ */
77
+ static UnregisterExtension(name: string): boolean;
78
+ /**
79
+ * The object that represents the glTF JSON.
80
+ */
81
+ get gltf(): IGLTF;
82
+ /**
83
+ * The BIN chunk of a binary glTF.
84
+ */
85
+ get bin(): Nullable<IDataBuffer>;
86
+ /**
87
+ * The parent file loader.
88
+ */
89
+ get parent(): GLTFFileLoader;
90
+ /**
91
+ * The Babylon scene when loading the asset.
92
+ */
93
+ get babylonScene(): Scene;
94
+ /**
95
+ * The root Babylon mesh when loading the asset.
96
+ */
97
+ get rootBabylonMesh(): Nullable<Mesh>;
98
+ /**
99
+ * @param parent
100
+ * @hidden
101
+ */
102
+ constructor(parent: GLTFFileLoader);
103
+ /** @hidden */
104
+ dispose(): void;
105
+ /**
106
+ * @param meshesNames
107
+ * @param scene
108
+ * @param container
109
+ * @param data
110
+ * @param rootUrl
111
+ * @param onProgress
112
+ * @param fileName
113
+ * @hidden
114
+ */
115
+ importMeshAsync(meshesNames: any, scene: Scene, container: Nullable<AssetContainer>, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<ISceneLoaderAsyncResult>;
116
+ /**
117
+ * @param scene
118
+ * @param data
119
+ * @param rootUrl
120
+ * @param onProgress
121
+ * @param fileName
122
+ * @hidden
123
+ */
124
+ loadAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<void>;
125
+ private _loadAsync;
126
+ private _loadData;
127
+ private _setupData;
128
+ private _loadExtensions;
129
+ private _checkExtensions;
130
+ private _createRootNode;
131
+ /**
132
+ * Loads a glTF scene.
133
+ * @param context The context when loading the asset
134
+ * @param scene The glTF scene property
135
+ * @returns A promise that resolves when the load is complete
136
+ */
137
+ loadSceneAsync(context: string, scene: IScene): Promise<void>;
138
+ private _forEachPrimitive;
139
+ private _getGeometries;
140
+ private _getMeshes;
141
+ private _getTransformNodes;
142
+ private _getSkeletons;
143
+ private _getAnimationGroups;
144
+ private _startAnimations;
145
+ /**
146
+ * Loads a glTF node.
147
+ * @param context The context when loading the asset
148
+ * @param node The glTF node property
149
+ * @param assign A function called synchronously after parsing the glTF properties
150
+ * @returns A promise that resolves with the loaded Babylon mesh when the load is complete
151
+ */
152
+ loadNodeAsync(context: string, node: INode, assign?: (babylonTransformNode: TransformNode) => void): Promise<TransformNode>;
153
+ private _loadMeshAsync;
154
+ /**
155
+ * @hidden Define this method to modify the default behavior when loading data for mesh primitives.
156
+ * @param context The context when loading the asset
157
+ * @param name The mesh name when loading the asset
158
+ * @param node The glTF node when loading the asset
159
+ * @param mesh The glTF mesh when loading the asset
160
+ * @param primitive The glTF mesh primitive property
161
+ * @param assign A function called synchronously after parsing the glTF properties
162
+ * @returns A promise that resolves with the loaded mesh when the load is complete or null if not handled
163
+ */
164
+ _loadMeshPrimitiveAsync(context: string, name: string, node: INode, mesh: IMesh, primitive: IMeshPrimitive, assign: (babylonMesh: AbstractMesh) => void): Promise<AbstractMesh>;
165
+ private _loadVertexDataAsync;
166
+ private _createMorphTargets;
167
+ private _loadMorphTargetsAsync;
168
+ private _loadMorphTargetVertexDataAsync;
169
+ private static _LoadTransform;
170
+ private _loadSkinAsync;
171
+ private _loadBones;
172
+ private _findSkeletonRootNode;
173
+ private _loadBone;
174
+ private _loadSkinInverseBindMatricesDataAsync;
175
+ private _updateBoneMatrices;
176
+ private _getNodeMatrix;
177
+ /**
178
+ * Loads a glTF camera.
179
+ * @param context The context when loading the asset
180
+ * @param camera The glTF camera property
181
+ * @param assign A function called synchronously after parsing the glTF properties
182
+ * @returns A promise that resolves with the loaded Babylon camera when the load is complete
183
+ */
184
+ loadCameraAsync(context: string, camera: ICamera, assign?: (babylonCamera: Camera) => void): Promise<Camera>;
185
+ private _loadAnimationsAsync;
186
+ /**
187
+ * Loads a glTF animation.
188
+ * @param context The context when loading the asset
189
+ * @param animation The glTF animation property
190
+ * @returns A promise that resolves with the loaded Babylon animation group when the load is complete
191
+ */
192
+ loadAnimationAsync(context: string, animation: IAnimation): Promise<AnimationGroup>;
193
+ /**
194
+ * @hidden Loads a glTF animation channel.
195
+ * @param context The context when loading the asset
196
+ * @param animationContext The context of the animation when loading the asset
197
+ * @param animation The glTF animation property
198
+ * @param channel The glTF animation channel property
199
+ * @param babylonAnimationGroup The babylon animation group property
200
+ * @param animationTargetOverride The babylon animation channel target override property. My be null.
201
+ * @returns A void promise when the channel load is complete
202
+ */
203
+ _loadAnimationChannelAsync(context: string, animationContext: string, animation: IAnimation, channel: IAnimationChannel, babylonAnimationGroup: AnimationGroup, animationTargetOverride?: Nullable<IAnimatable>): Promise<void>;
204
+ private _loadAnimationSamplerAsync;
205
+ /**
206
+ * Loads a glTF buffer.
207
+ * @param context The context when loading the asset
208
+ * @param buffer The glTF buffer property
209
+ * @param byteOffset The byte offset to use
210
+ * @param byteLength The byte length to use
211
+ * @returns A promise that resolves with the loaded data when the load is complete
212
+ */
213
+ loadBufferAsync(context: string, buffer: IBuffer, byteOffset: number, byteLength: number): Promise<ArrayBufferView>;
214
+ /**
215
+ * Loads a glTF buffer view.
216
+ * @param context The context when loading the asset
217
+ * @param bufferView The glTF buffer view property
218
+ * @returns A promise that resolves with the loaded data when the load is complete
219
+ */
220
+ loadBufferViewAsync(context: string, bufferView: IBufferView): Promise<ArrayBufferView>;
221
+ private _loadAccessorAsync;
222
+ /**
223
+ * @param context
224
+ * @param accessor
225
+ * @hidden
226
+ */
227
+ _loadFloatAccessorAsync(context: string, accessor: IAccessor): Promise<Float32Array>;
228
+ private _loadIndicesAccessorAsync;
229
+ private _loadVertexBufferViewAsync;
230
+ private _loadVertexAccessorAsync;
231
+ private _loadMaterialMetallicRoughnessPropertiesAsync;
232
+ /**
233
+ * @param context
234
+ * @param material
235
+ * @param babylonMesh
236
+ * @param babylonDrawMode
237
+ * @param assign
238
+ * @hidden
239
+ */
240
+ _loadMaterialAsync(context: string, material: IMaterial, babylonMesh: Nullable<Mesh>, babylonDrawMode: number, assign?: (babylonMaterial: Material) => void): Promise<Material>;
241
+ private _createDefaultMaterial;
242
+ /**
243
+ * Creates a Babylon material from a glTF material.
244
+ * @param context The context when loading the asset
245
+ * @param material The glTF material property
246
+ * @param babylonDrawMode The draw mode for the Babylon material
247
+ * @returns The Babylon material
248
+ */
249
+ createMaterial(context: string, material: IMaterial, babylonDrawMode: number): Material;
250
+ /**
251
+ * Loads properties from a glTF material into a Babylon material.
252
+ * @param context The context when loading the asset
253
+ * @param material The glTF material property
254
+ * @param babylonMaterial The Babylon material
255
+ * @returns A promise that resolves when the load is complete
256
+ */
257
+ loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Promise<void>;
258
+ /**
259
+ * Loads the normal, occlusion, and emissive properties from a glTF material into a Babylon material.
260
+ * @param context The context when loading the asset
261
+ * @param material The glTF material property
262
+ * @param babylonMaterial The Babylon material
263
+ * @returns A promise that resolves when the load is complete
264
+ */
265
+ loadMaterialBasePropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Promise<void>;
266
+ /**
267
+ * Loads the alpha properties from a glTF material into a Babylon material.
268
+ * Must be called after the setting the albedo texture of the Babylon material when the material has an albedo texture.
269
+ * @param context The context when loading the asset
270
+ * @param material The glTF material property
271
+ * @param babylonMaterial The Babylon material
272
+ */
273
+ loadMaterialAlphaProperties(context: string, material: IMaterial, babylonMaterial: Material): void;
274
+ /**
275
+ * Loads a glTF texture info.
276
+ * @param context The context when loading the asset
277
+ * @param textureInfo The glTF texture info property
278
+ * @param assign A function called synchronously after parsing the glTF properties
279
+ * @returns A promise that resolves with the loaded Babylon texture when the load is complete
280
+ */
281
+ loadTextureInfoAsync(context: string, textureInfo: ITextureInfo, assign?: (babylonTexture: BaseTexture) => void): Promise<BaseTexture>;
282
+ /**
283
+ * @param context
284
+ * @param texture
285
+ * @param assign
286
+ * @hidden
287
+ */
288
+ _loadTextureAsync(context: string, texture: ITexture, assign?: (babylonTexture: BaseTexture) => void): Promise<BaseTexture>;
289
+ /**
290
+ * @param context
291
+ * @param sampler
292
+ * @param image
293
+ * @param assign
294
+ * @param textureLoaderOptions
295
+ * @param useSRGBBuffer
296
+ * @hidden
297
+ */
298
+ _createTextureAsync(context: string, sampler: ISampler, image: IImage, assign?: (babylonTexture: BaseTexture) => void, textureLoaderOptions?: any, useSRGBBuffer?: boolean): Promise<BaseTexture>;
299
+ private _loadSampler;
300
+ /**
301
+ * Loads a glTF image.
302
+ * @param context The context when loading the asset
303
+ * @param image The glTF image property
304
+ * @returns A promise that resolves with the loaded data when the load is complete
305
+ */
306
+ loadImageAsync(context: string, image: IImage): Promise<ArrayBufferView>;
307
+ /**
308
+ * Loads a glTF uri.
309
+ * @param context The context when loading the asset
310
+ * @param property The glTF property associated with the uri
311
+ * @param uri The base64 or relative uri
312
+ * @returns A promise that resolves with the loaded data when the load is complete
313
+ */
314
+ loadUriAsync(context: string, property: IProperty, uri: string): Promise<ArrayBufferView>;
315
+ /**
316
+ * Adds a JSON pointer to the metadata of the Babylon object at `<object>.metadata.gltf.pointers`.
317
+ * @param babylonObject the Babylon object with metadata
318
+ * @param babylonObject.metadata
319
+ * @param pointer the JSON pointer
320
+ */
321
+ static AddPointerMetadata(babylonObject: {
322
+ metadata: any;
323
+ }, pointer: string): void;
324
+ private static _GetTextureWrapMode;
325
+ private static _GetTextureSamplingMode;
326
+ private static _GetTypedArrayConstructor;
327
+ private static _GetTypedArray;
328
+ private static _GetNumComponents;
329
+ private static _ValidateUri;
330
+ /**
331
+ * @param context
332
+ * @param mode
333
+ * @hidden
334
+ */
335
+ static _GetDrawMode(context: string, mode: number | undefined): number;
336
+ private _compileMaterialsAsync;
337
+ private _compileShadowGeneratorsAsync;
338
+ private _forEachExtensions;
339
+ private _applyExtensions;
340
+ private _extensionsOnLoading;
341
+ private _extensionsOnReady;
342
+ private _extensionsLoadSceneAsync;
343
+ private _extensionsLoadNodeAsync;
344
+ private _extensionsLoadCameraAsync;
345
+ private _extensionsLoadVertexDataAsync;
346
+ private _extensionsLoadMeshPrimitiveAsync;
347
+ private _extensionsLoadMaterialAsync;
348
+ private _extensionsCreateMaterial;
349
+ private _extensionsLoadMaterialPropertiesAsync;
350
+ private _extensionsLoadTextureInfoAsync;
351
+ private _extensionsLoadTextureAsync;
352
+ private _extensionsLoadAnimationAsync;
353
+ private _extensionsLoadSkinAsync;
354
+ private _extensionsLoadUriAsync;
355
+ private _extensionsLoadBufferViewAsync;
356
+ private _extensionsLoadBufferAsync;
357
+ /**
358
+ * Helper method called by a loader extension to load an glTF extension.
359
+ * @param context The context when loading the asset
360
+ * @param property The glTF property to load the extension from
361
+ * @param extensionName The name of the extension to load
362
+ * @param actionAsync The action to run
363
+ * @returns The promise returned by actionAsync or null if the extension does not exist
364
+ */
365
+ static LoadExtensionAsync<TExtension = any, TResult = void>(context: string, property: IProperty, extensionName: string, actionAsync: (extensionContext: string, extension: TExtension) => Nullable<Promise<TResult>>): Nullable<Promise<TResult>>;
366
+ /**
367
+ * Helper method called by a loader extension to load a glTF extra.
368
+ * @param context The context when loading the asset
369
+ * @param property The glTF property to load the extra from
370
+ * @param extensionName The name of the extension to load
371
+ * @param actionAsync The action to run
372
+ * @returns The promise returned by actionAsync or null if the extra does not exist
373
+ */
374
+ static LoadExtraAsync<TExtra = any, TResult = void>(context: string, property: IProperty, extensionName: string, actionAsync: (extraContext: string, extra: TExtra) => Nullable<Promise<TResult>>): Nullable<Promise<TResult>>;
375
+ /**
376
+ * Checks for presence of an extension.
377
+ * @param name The name of the extension to check
378
+ * @returns A boolean indicating the presence of the given extension name in `extensionsUsed`
379
+ */
380
+ isExtensionUsed(name: string): boolean;
381
+ /**
382
+ * Increments the indentation level and logs a message.
383
+ * @param message The message to log
384
+ */
385
+ logOpen(message: string): void;
386
+ /**
387
+ * Decrements the indentation level.
388
+ */
389
+ logClose(): void;
390
+ /**
391
+ * Logs a message
392
+ * @param message The message to log
393
+ */
394
+ log(message: string): void;
395
+ /**
396
+ * Starts a performance counter.
397
+ * @param counterName The name of the performance counter
398
+ */
399
+ startPerformanceCounter(counterName: string): void;
400
+ /**
401
+ * Ends a performance counter.
402
+ * @param counterName The name of the performance counter
403
+ */
404
+ endPerformanceCounter(counterName: string): void;
405
+ }