@babylonjs/loaders 5.0.0-rc.5 → 5.0.0-rc.9
Sign up to get free protection for your applications and to get access to all the features.
- package/OBJ/index.d.ts +4 -4
- package/OBJ/index.js +4 -4
- package/OBJ/mtlFileLoader.d.ts +41 -41
- package/OBJ/mtlFileLoader.js +232 -232
- package/OBJ/objFileLoader.d.ts +126 -126
- package/OBJ/objFileLoader.js +296 -296
- package/OBJ/objLoadingOptions.d.ts +43 -43
- package/OBJ/objLoadingOptions.js +1 -1
- package/OBJ/solidParser.d.ts +154 -154
- package/OBJ/solidParser.js +693 -693
- package/STL/index.d.ts +1 -1
- package/STL/index.js +1 -1
- package/STL/stlFileLoader.d.ts +64 -64
- package/STL/stlFileLoader.js +233 -233
- package/glTF/1.0/glTFBinaryExtension.d.ts +13 -13
- package/glTF/1.0/glTFBinaryExtension.js +60 -60
- package/glTF/1.0/glTFLoader.d.ts +136 -136
- package/glTF/1.0/glTFLoader.js +1815 -1815
- package/glTF/1.0/glTFLoaderInterfaces.d.ts +412 -412
- package/glTF/1.0/glTFLoaderInterfaces.js +95 -95
- package/glTF/1.0/glTFLoaderUtils.d.ts +62 -62
- package/glTF/1.0/glTFLoaderUtils.js +250 -250
- package/glTF/1.0/glTFMaterialsCommonExtension.d.ts +10 -10
- package/glTF/1.0/glTFMaterialsCommonExtension.js +129 -129
- package/glTF/1.0/index.d.ts +5 -5
- package/glTF/1.0/index.js +5 -5
- package/glTF/2.0/Extensions/EXT_lights_image_based.d.ts +43 -43
- package/glTF/2.0/Extensions/EXT_lights_image_based.js +117 -117
- package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.d.ts +36 -36
- package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js +88 -88
- package/glTF/2.0/Extensions/EXT_meshopt_compression.d.ts +34 -34
- package/glTF/2.0/Extensions/EXT_meshopt_compression.js +49 -49
- package/glTF/2.0/Extensions/EXT_texture_webp.d.ts +29 -29
- package/glTF/2.0/Extensions/EXT_texture_webp.js +40 -40
- package/glTF/2.0/Extensions/ExtrasAsMetadata.d.ts +50 -50
- package/glTF/2.0/Extensions/ExtrasAsMetadata.js +73 -73
- package/glTF/2.0/Extensions/KHR_draco_mesh_compression.d.ts +39 -39
- package/glTF/2.0/Extensions/KHR_draco_mesh_compression.js +112 -112
- package/glTF/2.0/Extensions/KHR_lights_punctual.d.ts +36 -36
- package/glTF/2.0/Extensions/KHR_lights_punctual.js +89 -89
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.d.ts +39 -39
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.js +94 -94
- package/glTF/2.0/Extensions/KHR_materials_emissive_strength.d.ts +38 -38
- package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js +53 -53
- package/glTF/2.0/Extensions/KHR_materials_ior.d.ts +42 -42
- package/glTF/2.0/Extensions/KHR_materials_ior.js +62 -62
- package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.d.ts +38 -38
- package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js +80 -80
- package/glTF/2.0/Extensions/KHR_materials_sheen.d.ts +39 -39
- package/glTF/2.0/Extensions/KHR_materials_sheen.js +84 -84
- package/glTF/2.0/Extensions/KHR_materials_specular.d.ts +38 -38
- package/glTF/2.0/Extensions/KHR_materials_specular.js +74 -74
- package/glTF/2.0/Extensions/KHR_materials_translucency.d.ts +39 -39
- package/glTF/2.0/Extensions/KHR_materials_translucency.js +83 -83
- package/glTF/2.0/Extensions/KHR_materials_transmission.d.ts +38 -38
- package/glTF/2.0/Extensions/KHR_materials_transmission.js +288 -288
- package/glTF/2.0/Extensions/KHR_materials_unlit.d.ts +38 -38
- package/glTF/2.0/Extensions/KHR_materials_unlit.js +73 -73
- package/glTF/2.0/Extensions/KHR_materials_variants.d.ts +87 -87
- package/glTF/2.0/Extensions/KHR_materials_variants.js +254 -254
- package/glTF/2.0/Extensions/KHR_materials_volume.d.ts +39 -39
- package/glTF/2.0/Extensions/KHR_materials_volume.js +85 -85
- package/glTF/2.0/Extensions/KHR_mesh_quantization.d.ts +22 -22
- package/glTF/2.0/Extensions/KHR_mesh_quantization.js +23 -23
- package/glTF/2.0/Extensions/KHR_texture_basisu.d.ts +29 -29
- package/glTF/2.0/Extensions/KHR_texture_basisu.js +40 -40
- package/glTF/2.0/Extensions/KHR_texture_transform.d.ts +33 -33
- package/glTF/2.0/Extensions/KHR_texture_transform.js +61 -61
- package/glTF/2.0/Extensions/KHR_xmp_json_ld.d.ts +32 -32
- package/glTF/2.0/Extensions/KHR_xmp_json_ld.js +49 -49
- package/glTF/2.0/Extensions/MSFT_audio_emitter.d.ts +54 -54
- package/glTF/2.0/Extensions/MSFT_audio_emitter.js +240 -240
- package/glTF/2.0/Extensions/MSFT_lod.d.ts +109 -109
- package/glTF/2.0/Extensions/MSFT_lod.js +369 -369
- package/glTF/2.0/Extensions/MSFT_minecraftMesh.d.ts +14 -14
- package/glTF/2.0/Extensions/MSFT_minecraftMesh.js +36 -36
- package/glTF/2.0/Extensions/MSFT_sRGBFactors.d.ts +14 -14
- package/glTF/2.0/Extensions/MSFT_sRGBFactors.js +36 -36
- package/glTF/2.0/Extensions/index.d.ts +26 -26
- package/glTF/2.0/Extensions/index.js +26 -26
- package/glTF/2.0/glTFLoader.d.ts +405 -405
- package/glTF/2.0/glTFLoader.js +2366 -2366
- package/glTF/2.0/glTFLoaderExtension.d.ts +152 -152
- package/glTF/2.0/glTFLoaderExtension.js +1 -1
- package/glTF/2.0/glTFLoaderInterfaces.d.ts +211 -211
- package/glTF/2.0/glTFLoaderInterfaces.js +1 -1
- package/glTF/2.0/index.d.ts +4 -4
- package/glTF/2.0/index.js +4 -4
- package/glTF/glTFFileLoader.d.ts +433 -433
- package/glTF/glTFFileLoader.js +927 -927
- package/glTF/glTFValidation.d.ts +29 -29
- package/glTF/glTFValidation.js +123 -123
- package/glTF/index.d.ts +5 -5
- package/glTF/index.js +5 -5
- package/index.d.ts +3 -3
- package/index.js +3 -3
- package/legacy/legacy-glTF.d.ts +2 -2
- package/legacy/legacy-glTF.js +18 -18
- package/legacy/legacy-glTF1.d.ts +2 -2
- package/legacy/legacy-glTF1.js +14 -14
- package/legacy/legacy-glTF1FileLoader.d.ts +2 -2
- package/legacy/legacy-glTF1FileLoader.js +3 -3
- package/legacy/legacy-glTF2.d.ts +2 -2
- package/legacy/legacy-glTF2.js +32 -32
- package/legacy/legacy-glTF2FileLoader.d.ts +2 -2
- package/legacy/legacy-glTF2FileLoader.js +3 -3
- package/legacy/legacy-glTFFileLoader.d.ts +3 -3
- package/legacy/legacy-glTFFileLoader.js +4 -4
- package/legacy/legacy-objFileLoader.d.ts +1 -1
- package/legacy/legacy-objFileLoader.js +12 -12
- package/legacy/legacy-stlFileLoader.d.ts +1 -1
- package/legacy/legacy-stlFileLoader.js +12 -12
- package/legacy/legacy.d.ts +6 -6
- package/legacy/legacy.js +7 -7
- package/package.json +3 -3
package/glTF/glTFFileLoader.d.ts
CHANGED
@@ -1,433 +1,433 @@
|
|
1
|
-
import * as GLTF2 from "babylonjs-gltf2interface";
|
2
|
-
import { Nullable } from "@babylonjs/core/types.js";
|
3
|
-
import { Observable } from "@babylonjs/core/Misc/observable.js";
|
4
|
-
import { Camera } from "@babylonjs/core/Cameras/camera.js";
|
5
|
-
import { BaseTexture } from "@babylonjs/core/Materials/Textures/baseTexture.js";
|
6
|
-
import { Material } from "@babylonjs/core/Materials/material.js";
|
7
|
-
import { AbstractMesh } from "@babylonjs/core/Meshes/abstractMesh.js";
|
8
|
-
import { ISceneLoaderPluginFactory, ISceneLoaderPlugin, ISceneLoaderPluginAsync, ISceneLoaderProgressEvent, ISceneLoaderPluginExtensions, ISceneLoaderAsyncResult } from "@babylonjs/core/Loading/sceneLoader.js";
|
9
|
-
import { AssetContainer } from "@babylonjs/core/assetContainer.js";
|
10
|
-
import { Scene, IDisposable } from "@babylonjs/core/scene.js";
|
11
|
-
import { WebRequest } from "@babylonjs/core/Misc/webRequest.js";
|
12
|
-
import { IFileRequest } from "@babylonjs/core/Misc/fileRequest.js";
|
13
|
-
import { IDataBuffer } from "@babylonjs/core/Misc/dataReader.js";
|
14
|
-
import { LoadFileError } from "@babylonjs/core/Misc/fileTools.js";
|
15
|
-
/**
|
16
|
-
* Mode that determines the coordinate system to use.
|
17
|
-
*/
|
18
|
-
export declare enum GLTFLoaderCoordinateSystemMode {
|
19
|
-
/**
|
20
|
-
* Automatically convert the glTF right-handed data to the appropriate system based on the current coordinate system mode of the scene.
|
21
|
-
*/
|
22
|
-
AUTO = 0,
|
23
|
-
/**
|
24
|
-
* Sets the useRightHandedSystem flag on the scene.
|
25
|
-
*/
|
26
|
-
FORCE_RIGHT_HANDED = 1
|
27
|
-
}
|
28
|
-
/**
|
29
|
-
* Mode that determines what animations will start.
|
30
|
-
*/
|
31
|
-
export declare enum GLTFLoaderAnimationStartMode {
|
32
|
-
/**
|
33
|
-
* No animation will start.
|
34
|
-
*/
|
35
|
-
NONE = 0,
|
36
|
-
/**
|
37
|
-
* The first animation will start.
|
38
|
-
*/
|
39
|
-
FIRST = 1,
|
40
|
-
/**
|
41
|
-
* All animations will start.
|
42
|
-
*/
|
43
|
-
ALL = 2
|
44
|
-
}
|
45
|
-
/**
|
46
|
-
* Interface that contains the data for the glTF asset.
|
47
|
-
*/
|
48
|
-
export interface IGLTFLoaderData {
|
49
|
-
/**
|
50
|
-
* The object that represents the glTF JSON.
|
51
|
-
*/
|
52
|
-
json: Object;
|
53
|
-
/**
|
54
|
-
* The BIN chunk of a binary glTF.
|
55
|
-
*/
|
56
|
-
bin: Nullable<IDataBuffer>;
|
57
|
-
}
|
58
|
-
/**
|
59
|
-
* Interface for extending the loader.
|
60
|
-
*/
|
61
|
-
export interface IGLTFLoaderExtension {
|
62
|
-
/**
|
63
|
-
* The name of this extension.
|
64
|
-
*/
|
65
|
-
readonly name: string;
|
66
|
-
/**
|
67
|
-
* Defines whether this extension is enabled.
|
68
|
-
*/
|
69
|
-
enabled: boolean;
|
70
|
-
/**
|
71
|
-
* Defines the order of this extension.
|
72
|
-
* The loader sorts the extensions using these values when loading.
|
73
|
-
*/
|
74
|
-
order?: number;
|
75
|
-
}
|
76
|
-
/**
|
77
|
-
* Loader state.
|
78
|
-
*/
|
79
|
-
export declare enum GLTFLoaderState {
|
80
|
-
/**
|
81
|
-
* The asset is loading.
|
82
|
-
*/
|
83
|
-
LOADING = 0,
|
84
|
-
/**
|
85
|
-
* The asset is ready for rendering.
|
86
|
-
*/
|
87
|
-
READY = 1,
|
88
|
-
/**
|
89
|
-
* The asset is completely loaded.
|
90
|
-
*/
|
91
|
-
COMPLETE = 2
|
92
|
-
}
|
93
|
-
/** @hidden */
|
94
|
-
export interface IGLTFLoader extends IDisposable {
|
95
|
-
importMeshAsync: (meshesNames: any, scene: Scene, container: Nullable<AssetContainer>, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string) => Promise<ISceneLoaderAsyncResult>;
|
96
|
-
loadAsync: (scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string) => Promise<void>;
|
97
|
-
}
|
98
|
-
/**
|
99
|
-
* File loader for loading glTF files into a scene.
|
100
|
-
*/
|
101
|
-
export declare class GLTFFileLoader implements IDisposable, ISceneLoaderPluginAsync, ISceneLoaderPluginFactory {
|
102
|
-
/** @hidden */
|
103
|
-
static _CreateGLTF1Loader: (parent: GLTFFileLoader) => IGLTFLoader;
|
104
|
-
/** @hidden */
|
105
|
-
static _CreateGLTF2Loader: (parent: GLTFFileLoader) => IGLTFLoader;
|
106
|
-
/**
|
107
|
-
* Raised when the asset has been parsed
|
108
|
-
*/
|
109
|
-
onParsedObservable: Observable<IGLTFLoaderData>;
|
110
|
-
private _onParsedObserver;
|
111
|
-
/**
|
112
|
-
* Raised when the asset has been parsed
|
113
|
-
*/
|
114
|
-
set onParsed(callback: (loaderData: IGLTFLoaderData) => void);
|
115
|
-
/**
|
116
|
-
* Set this property to false to disable incremental loading which delays the loader from calling the success callback until after loading the meshes and shaders.
|
117
|
-
* Textures always loads asynchronously. For example, the success callback can compute the bounding information of the loaded meshes when incremental loading is disabled.
|
118
|
-
* Defaults to true.
|
119
|
-
* @hidden
|
120
|
-
*/
|
121
|
-
static IncrementalLoading: boolean;
|
122
|
-
/**
|
123
|
-
* Set this property to true in order to work with homogeneous coordinates, available with some converters and exporters.
|
124
|
-
* Defaults to false. See https://en.wikipedia.org/wiki/Homogeneous_coordinates.
|
125
|
-
* @hidden
|
126
|
-
*/
|
127
|
-
static HomogeneousCoordinates: boolean;
|
128
|
-
/**
|
129
|
-
* The coordinate system mode. Defaults to AUTO.
|
130
|
-
*/
|
131
|
-
coordinateSystemMode: GLTFLoaderCoordinateSystemMode;
|
132
|
-
/**
|
133
|
-
* The animation start mode. Defaults to FIRST.
|
134
|
-
*/
|
135
|
-
animationStartMode: GLTFLoaderAnimationStartMode;
|
136
|
-
/**
|
137
|
-
* Defines if the loader should compile materials before raising the success callback. Defaults to false.
|
138
|
-
*/
|
139
|
-
compileMaterials: boolean;
|
140
|
-
/**
|
141
|
-
* Defines if the loader should also compile materials with clip planes. Defaults to false.
|
142
|
-
*/
|
143
|
-
useClipPlane: boolean;
|
144
|
-
/**
|
145
|
-
* Defines if the loader should compile shadow generators before raising the success callback. Defaults to false.
|
146
|
-
*/
|
147
|
-
compileShadowGenerators: boolean;
|
148
|
-
/**
|
149
|
-
* Defines if the Alpha blended materials are only applied as coverage.
|
150
|
-
* If false, (default) The luminance of each pixel will reduce its opacity to simulate the behaviour of most physical materials.
|
151
|
-
* If true, no extra effects are applied to transparent pixels.
|
152
|
-
*/
|
153
|
-
transparencyAsCoverage: boolean;
|
154
|
-
/**
|
155
|
-
* Defines if the loader should use range requests when load binary glTF files from HTTP.
|
156
|
-
* Enabling will disable offline support and glTF validator.
|
157
|
-
* Defaults to false.
|
158
|
-
*/
|
159
|
-
useRangeRequests: boolean;
|
160
|
-
/**
|
161
|
-
* Defines if the loader should create instances when multiple glTF nodes point to the same glTF mesh. Defaults to true.
|
162
|
-
*/
|
163
|
-
createInstances: boolean;
|
164
|
-
/**
|
165
|
-
* Defines if the loader should always compute the bounding boxes of meshes and not use the min/max values from the position accessor. Defaults to false.
|
166
|
-
*/
|
167
|
-
alwaysComputeBoundingBox: boolean;
|
168
|
-
/**
|
169
|
-
* If true, load all materials defined in the file, even if not used by any mesh. Defaults to false.
|
170
|
-
*/
|
171
|
-
loadAllMaterials: boolean;
|
172
|
-
/**
|
173
|
-
* If true, load only the materials defined in the file. Defaults to false.
|
174
|
-
*/
|
175
|
-
loadOnlyMaterials: boolean;
|
176
|
-
/**
|
177
|
-
* If true, do not load any materials defined in the file. Defaults to false.
|
178
|
-
*/
|
179
|
-
skipMaterials: boolean;
|
180
|
-
/**
|
181
|
-
* If true, load the color (gamma encoded) textures into sRGB buffers (if supported by the GPU), which will yield more accurate results when sampling the texture. Defaults to true.
|
182
|
-
*/
|
183
|
-
useSRGBBuffers: boolean;
|
184
|
-
/**
|
185
|
-
* When loading glTF animations, which are defined in seconds, target them to this FPS. Defaults to 60.
|
186
|
-
*/
|
187
|
-
targetFps: number;
|
188
|
-
/**
|
189
|
-
* Defines if the loader should always compute the nearest common ancestor of the skeleton joints instead of using `skin.skeleton`. Defaults to false.
|
190
|
-
* Set this to true if loading assets with invalid `skin.skeleton` values.
|
191
|
-
*/
|
192
|
-
alwaysComputeSkeletonRootNode: boolean;
|
193
|
-
/**
|
194
|
-
* Function called before loading a url referenced by the asset.
|
195
|
-
* @param url
|
196
|
-
*/
|
197
|
-
preprocessUrlAsync: (url: string) => Promise<string>;
|
198
|
-
/**
|
199
|
-
* Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
|
200
|
-
* Note that the observable is raised as soon as the mesh object is created, meaning some data may not have been setup yet for this mesh (vertex data, morph targets, material, ...)
|
201
|
-
*/
|
202
|
-
readonly onMeshLoadedObservable: Observable<AbstractMesh>;
|
203
|
-
private _onMeshLoadedObserver;
|
204
|
-
/**
|
205
|
-
* Callback raised when the loader creates a mesh after parsing the glTF properties of the mesh.
|
206
|
-
* Note that the callback is called as soon as the mesh object is created, meaning some data may not have been setup yet for this mesh (vertex data, morph targets, material, ...)
|
207
|
-
*/
|
208
|
-
set onMeshLoaded(callback: (mesh: AbstractMesh) => void);
|
209
|
-
/**
|
210
|
-
* Observable raised when the loader creates a texture after parsing the glTF properties of the texture.
|
211
|
-
*/
|
212
|
-
readonly onTextureLoadedObservable: Observable<BaseTexture>;
|
213
|
-
private _onTextureLoadedObserver;
|
214
|
-
/**
|
215
|
-
* Callback raised when the loader creates a texture after parsing the glTF properties of the texture.
|
216
|
-
*/
|
217
|
-
set onTextureLoaded(callback: (texture: BaseTexture) => void);
|
218
|
-
/**
|
219
|
-
* Observable raised when the loader creates a material after parsing the glTF properties of the material.
|
220
|
-
*/
|
221
|
-
readonly onMaterialLoadedObservable: Observable<Material>;
|
222
|
-
private _onMaterialLoadedObserver;
|
223
|
-
/**
|
224
|
-
* Callback raised when the loader creates a material after parsing the glTF properties of the material.
|
225
|
-
*/
|
226
|
-
set onMaterialLoaded(callback: (material: Material) => void);
|
227
|
-
/**
|
228
|
-
* Observable raised when the loader creates a camera after parsing the glTF properties of the camera.
|
229
|
-
*/
|
230
|
-
readonly onCameraLoadedObservable: Observable<Camera>;
|
231
|
-
private _onCameraLoadedObserver;
|
232
|
-
/**
|
233
|
-
* Callback raised when the loader creates a camera after parsing the glTF properties of the camera.
|
234
|
-
*/
|
235
|
-
set onCameraLoaded(callback: (camera: Camera) => void);
|
236
|
-
/**
|
237
|
-
* Observable raised when the asset is completely loaded, immediately before the loader is disposed.
|
238
|
-
* For assets with LODs, raised when all of the LODs are complete.
|
239
|
-
* For assets without LODs, raised when the model is complete, immediately after the loader resolves the returned promise.
|
240
|
-
*/
|
241
|
-
readonly onCompleteObservable: Observable<void>;
|
242
|
-
private _onCompleteObserver;
|
243
|
-
/**
|
244
|
-
* Callback raised when the asset is completely loaded, immediately before the loader is disposed.
|
245
|
-
* For assets with LODs, raised when all of the LODs are complete.
|
246
|
-
* For assets without LODs, raised when the model is complete, immediately after the loader resolves the returned promise.
|
247
|
-
*/
|
248
|
-
set onComplete(callback: () => void);
|
249
|
-
/**
|
250
|
-
* Observable raised when an error occurs.
|
251
|
-
*/
|
252
|
-
readonly onErrorObservable: Observable<any>;
|
253
|
-
private _onErrorObserver;
|
254
|
-
/**
|
255
|
-
* Callback raised when an error occurs.
|
256
|
-
*/
|
257
|
-
set onError(callback: (reason: any) => void);
|
258
|
-
/**
|
259
|
-
* Observable raised after the loader is disposed.
|
260
|
-
*/
|
261
|
-
readonly onDisposeObservable: Observable<void>;
|
262
|
-
private _onDisposeObserver;
|
263
|
-
/**
|
264
|
-
* Callback raised after the loader is disposed.
|
265
|
-
*/
|
266
|
-
set onDispose(callback: () => void);
|
267
|
-
/**
|
268
|
-
* Observable raised after a loader extension is created.
|
269
|
-
* Set additional options for a loader extension in this event.
|
270
|
-
*/
|
271
|
-
readonly onExtensionLoadedObservable: Observable<IGLTFLoaderExtension>;
|
272
|
-
private _onExtensionLoadedObserver;
|
273
|
-
/**
|
274
|
-
* Callback raised after a loader extension is created.
|
275
|
-
*/
|
276
|
-
set onExtensionLoaded(callback: (extension: IGLTFLoaderExtension) => void);
|
277
|
-
/**
|
278
|
-
* Defines if the loader logging is enabled.
|
279
|
-
*/
|
280
|
-
get loggingEnabled(): boolean;
|
281
|
-
set loggingEnabled(value: boolean);
|
282
|
-
/**
|
283
|
-
* Defines if the loader should capture performance counters.
|
284
|
-
*/
|
285
|
-
get capturePerformanceCounters(): boolean;
|
286
|
-
set capturePerformanceCounters(value: boolean);
|
287
|
-
/**
|
288
|
-
* Defines if the loader should validate the asset.
|
289
|
-
*/
|
290
|
-
validate: boolean;
|
291
|
-
/**
|
292
|
-
* Observable raised after validation when validate is set to true. The event data is the result of the validation.
|
293
|
-
*/
|
294
|
-
readonly onValidatedObservable: Observable<GLTF2.IGLTFValidationResults>;
|
295
|
-
private _onValidatedObserver;
|
296
|
-
/**
|
297
|
-
* Callback raised after a loader extension is created.
|
298
|
-
*/
|
299
|
-
set onValidated(callback: (results: GLTF2.IGLTFValidationResults) => void);
|
300
|
-
private _loader;
|
301
|
-
private _state;
|
302
|
-
private _progressCallback?;
|
303
|
-
private _requests;
|
304
|
-
private static _MagicBase64Encoded;
|
305
|
-
/**
|
306
|
-
* Name of the loader ("gltf")
|
307
|
-
*/
|
308
|
-
name: string;
|
309
|
-
/** @hidden */
|
310
|
-
extensions: ISceneLoaderPluginExtensions;
|
311
|
-
/**
|
312
|
-
* Disposes the loader, releases resources during load, and cancels any outstanding requests.
|
313
|
-
*/
|
314
|
-
dispose(): void;
|
315
|
-
/**
|
316
|
-
* @param scene
|
317
|
-
* @param fileOrUrl
|
318
|
-
* @param onSuccess
|
319
|
-
* @param onProgress
|
320
|
-
* @param useArrayBuffer
|
321
|
-
* @param onError
|
322
|
-
* @hidden
|
323
|
-
*/
|
324
|
-
loadFile(scene: Scene, fileOrUrl: File | string, onSuccess: (data: any, responseURL?: string) => void, onProgress?: (ev: ISceneLoaderProgressEvent) => void, useArrayBuffer?: boolean, onError?: (request?: WebRequest, exception?: LoadFileError) => void): IFileRequest;
|
325
|
-
/**
|
326
|
-
* @param meshesNames
|
327
|
-
* @param scene
|
328
|
-
* @param data
|
329
|
-
* @param rootUrl
|
330
|
-
* @param onProgress
|
331
|
-
* @param fileName
|
332
|
-
* @hidden
|
333
|
-
*/
|
334
|
-
importMeshAsync(meshesNames: any, scene: Scene, data: any, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<ISceneLoaderAsyncResult>;
|
335
|
-
/**
|
336
|
-
* @param scene
|
337
|
-
* @param data
|
338
|
-
* @param rootUrl
|
339
|
-
* @param onProgress
|
340
|
-
* @param fileName
|
341
|
-
* @hidden
|
342
|
-
*/
|
343
|
-
loadAsync(scene: Scene, data: any, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<void>;
|
344
|
-
/**
|
345
|
-
* @param scene
|
346
|
-
* @param data
|
347
|
-
* @param rootUrl
|
348
|
-
* @param onProgress
|
349
|
-
* @param fileName
|
350
|
-
* @hidden
|
351
|
-
*/
|
352
|
-
loadAssetContainerAsync(scene: Scene, data: any, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<AssetContainer>;
|
353
|
-
/**
|
354
|
-
* @param data
|
355
|
-
* @hidden
|
356
|
-
*/
|
357
|
-
canDirectLoad(data: string): boolean;
|
358
|
-
/**
|
359
|
-
* @param scene
|
360
|
-
* @param data
|
361
|
-
* @hidden
|
362
|
-
*/
|
363
|
-
directLoad(scene: Scene, data: string): Promise<any>;
|
364
|
-
/**
|
365
|
-
* The callback that allows custom handling of the root url based on the response url.
|
366
|
-
* @param rootUrl the original root url
|
367
|
-
* @param responseURL the response url if available
|
368
|
-
* @returns the new root url
|
369
|
-
*/
|
370
|
-
rewriteRootURL?(rootUrl: string, responseURL?: string): string;
|
371
|
-
/** @hidden */
|
372
|
-
createPlugin(): ISceneLoaderPlugin | ISceneLoaderPluginAsync;
|
373
|
-
/**
|
374
|
-
* The loader state or null if the loader is not active.
|
375
|
-
*/
|
376
|
-
get loaderState(): Nullable<GLTFLoaderState>;
|
377
|
-
/**
|
378
|
-
* Observable raised when the loader state changes.
|
379
|
-
*/
|
380
|
-
onLoaderStateChangedObservable: Observable<Nullable<GLTFLoaderState>>;
|
381
|
-
/**
|
382
|
-
* Returns a promise that resolves when the asset is completely loaded.
|
383
|
-
* @returns a promise that resolves when the asset is completely loaded.
|
384
|
-
*/
|
385
|
-
whenCompleteAsync(): Promise<void>;
|
386
|
-
/**
|
387
|
-
* @param state
|
388
|
-
* @hidden
|
389
|
-
*/
|
390
|
-
_setState(state: GLTFLoaderState): void;
|
391
|
-
/**
|
392
|
-
* @param scene
|
393
|
-
* @param fileOrUrl
|
394
|
-
* @param onSuccess
|
395
|
-
* @param useArrayBuffer
|
396
|
-
* @param onError
|
397
|
-
* @param onOpened
|
398
|
-
* @hidden
|
399
|
-
*/
|
400
|
-
_loadFile(scene: Scene, fileOrUrl: File | string, onSuccess: (data: string | ArrayBuffer) => void, useArrayBuffer?: boolean, onError?: (request?: WebRequest) => void, onOpened?: (request: WebRequest) => void): IFileRequest;
|
401
|
-
private _onProgress;
|
402
|
-
private _validate;
|
403
|
-
private _getLoader;
|
404
|
-
private _parseJson;
|
405
|
-
private _unpackBinaryAsync;
|
406
|
-
private _unpackBinaryV1Async;
|
407
|
-
private _unpackBinaryV2Async;
|
408
|
-
private static _parseVersion;
|
409
|
-
private static _compareVersion;
|
410
|
-
private static readonly _logSpaces;
|
411
|
-
private _logIndentLevel;
|
412
|
-
private _loggingEnabled;
|
413
|
-
/** @hidden */
|
414
|
-
_log: (message: string) => void;
|
415
|
-
/**
|
416
|
-
* @param message
|
417
|
-
* @hidden
|
418
|
-
*/
|
419
|
-
_logOpen(message: string): void;
|
420
|
-
/** @hidden */
|
421
|
-
_logClose(): void;
|
422
|
-
private _logEnabled;
|
423
|
-
private _logDisabled;
|
424
|
-
private _capturePerformanceCounters;
|
425
|
-
/** @hidden */
|
426
|
-
_startPerformanceCounter: (counterName: string) => void;
|
427
|
-
/** @hidden */
|
428
|
-
_endPerformanceCounter: (counterName: string) => void;
|
429
|
-
private _startPerformanceCounterEnabled;
|
430
|
-
private _startPerformanceCounterDisabled;
|
431
|
-
private _endPerformanceCounterEnabled;
|
432
|
-
private _endPerformanceCounterDisabled;
|
433
|
-
}
|
1
|
+
import * as GLTF2 from "babylonjs-gltf2interface";
|
2
|
+
import { Nullable } from "@babylonjs/core/types.js";
|
3
|
+
import { Observable } from "@babylonjs/core/Misc/observable.js";
|
4
|
+
import { Camera } from "@babylonjs/core/Cameras/camera.js";
|
5
|
+
import { BaseTexture } from "@babylonjs/core/Materials/Textures/baseTexture.js";
|
6
|
+
import { Material } from "@babylonjs/core/Materials/material.js";
|
7
|
+
import { AbstractMesh } from "@babylonjs/core/Meshes/abstractMesh.js";
|
8
|
+
import { ISceneLoaderPluginFactory, ISceneLoaderPlugin, ISceneLoaderPluginAsync, ISceneLoaderProgressEvent, ISceneLoaderPluginExtensions, ISceneLoaderAsyncResult } from "@babylonjs/core/Loading/sceneLoader.js";
|
9
|
+
import { AssetContainer } from "@babylonjs/core/assetContainer.js";
|
10
|
+
import { Scene, IDisposable } from "@babylonjs/core/scene.js";
|
11
|
+
import { WebRequest } from "@babylonjs/core/Misc/webRequest.js";
|
12
|
+
import { IFileRequest } from "@babylonjs/core/Misc/fileRequest.js";
|
13
|
+
import { IDataBuffer } from "@babylonjs/core/Misc/dataReader.js";
|
14
|
+
import { LoadFileError } from "@babylonjs/core/Misc/fileTools.js";
|
15
|
+
/**
|
16
|
+
* Mode that determines the coordinate system to use.
|
17
|
+
*/
|
18
|
+
export declare enum GLTFLoaderCoordinateSystemMode {
|
19
|
+
/**
|
20
|
+
* Automatically convert the glTF right-handed data to the appropriate system based on the current coordinate system mode of the scene.
|
21
|
+
*/
|
22
|
+
AUTO = 0,
|
23
|
+
/**
|
24
|
+
* Sets the useRightHandedSystem flag on the scene.
|
25
|
+
*/
|
26
|
+
FORCE_RIGHT_HANDED = 1
|
27
|
+
}
|
28
|
+
/**
|
29
|
+
* Mode that determines what animations will start.
|
30
|
+
*/
|
31
|
+
export declare enum GLTFLoaderAnimationStartMode {
|
32
|
+
/**
|
33
|
+
* No animation will start.
|
34
|
+
*/
|
35
|
+
NONE = 0,
|
36
|
+
/**
|
37
|
+
* The first animation will start.
|
38
|
+
*/
|
39
|
+
FIRST = 1,
|
40
|
+
/**
|
41
|
+
* All animations will start.
|
42
|
+
*/
|
43
|
+
ALL = 2
|
44
|
+
}
|
45
|
+
/**
|
46
|
+
* Interface that contains the data for the glTF asset.
|
47
|
+
*/
|
48
|
+
export interface IGLTFLoaderData {
|
49
|
+
/**
|
50
|
+
* The object that represents the glTF JSON.
|
51
|
+
*/
|
52
|
+
json: Object;
|
53
|
+
/**
|
54
|
+
* The BIN chunk of a binary glTF.
|
55
|
+
*/
|
56
|
+
bin: Nullable<IDataBuffer>;
|
57
|
+
}
|
58
|
+
/**
|
59
|
+
* Interface for extending the loader.
|
60
|
+
*/
|
61
|
+
export interface IGLTFLoaderExtension {
|
62
|
+
/**
|
63
|
+
* The name of this extension.
|
64
|
+
*/
|
65
|
+
readonly name: string;
|
66
|
+
/**
|
67
|
+
* Defines whether this extension is enabled.
|
68
|
+
*/
|
69
|
+
enabled: boolean;
|
70
|
+
/**
|
71
|
+
* Defines the order of this extension.
|
72
|
+
* The loader sorts the extensions using these values when loading.
|
73
|
+
*/
|
74
|
+
order?: number;
|
75
|
+
}
|
76
|
+
/**
|
77
|
+
* Loader state.
|
78
|
+
*/
|
79
|
+
export declare enum GLTFLoaderState {
|
80
|
+
/**
|
81
|
+
* The asset is loading.
|
82
|
+
*/
|
83
|
+
LOADING = 0,
|
84
|
+
/**
|
85
|
+
* The asset is ready for rendering.
|
86
|
+
*/
|
87
|
+
READY = 1,
|
88
|
+
/**
|
89
|
+
* The asset is completely loaded.
|
90
|
+
*/
|
91
|
+
COMPLETE = 2
|
92
|
+
}
|
93
|
+
/** @hidden */
|
94
|
+
export interface IGLTFLoader extends IDisposable {
|
95
|
+
importMeshAsync: (meshesNames: any, scene: Scene, container: Nullable<AssetContainer>, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string) => Promise<ISceneLoaderAsyncResult>;
|
96
|
+
loadAsync: (scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string) => Promise<void>;
|
97
|
+
}
|
98
|
+
/**
|
99
|
+
* File loader for loading glTF files into a scene.
|
100
|
+
*/
|
101
|
+
export declare class GLTFFileLoader implements IDisposable, ISceneLoaderPluginAsync, ISceneLoaderPluginFactory {
|
102
|
+
/** @hidden */
|
103
|
+
static _CreateGLTF1Loader: (parent: GLTFFileLoader) => IGLTFLoader;
|
104
|
+
/** @hidden */
|
105
|
+
static _CreateGLTF2Loader: (parent: GLTFFileLoader) => IGLTFLoader;
|
106
|
+
/**
|
107
|
+
* Raised when the asset has been parsed
|
108
|
+
*/
|
109
|
+
onParsedObservable: Observable<IGLTFLoaderData>;
|
110
|
+
private _onParsedObserver;
|
111
|
+
/**
|
112
|
+
* Raised when the asset has been parsed
|
113
|
+
*/
|
114
|
+
set onParsed(callback: (loaderData: IGLTFLoaderData) => void);
|
115
|
+
/**
|
116
|
+
* Set this property to false to disable incremental loading which delays the loader from calling the success callback until after loading the meshes and shaders.
|
117
|
+
* Textures always loads asynchronously. For example, the success callback can compute the bounding information of the loaded meshes when incremental loading is disabled.
|
118
|
+
* Defaults to true.
|
119
|
+
* @hidden
|
120
|
+
*/
|
121
|
+
static IncrementalLoading: boolean;
|
122
|
+
/**
|
123
|
+
* Set this property to true in order to work with homogeneous coordinates, available with some converters and exporters.
|
124
|
+
* Defaults to false. See https://en.wikipedia.org/wiki/Homogeneous_coordinates.
|
125
|
+
* @hidden
|
126
|
+
*/
|
127
|
+
static HomogeneousCoordinates: boolean;
|
128
|
+
/**
|
129
|
+
* The coordinate system mode. Defaults to AUTO.
|
130
|
+
*/
|
131
|
+
coordinateSystemMode: GLTFLoaderCoordinateSystemMode;
|
132
|
+
/**
|
133
|
+
* The animation start mode. Defaults to FIRST.
|
134
|
+
*/
|
135
|
+
animationStartMode: GLTFLoaderAnimationStartMode;
|
136
|
+
/**
|
137
|
+
* Defines if the loader should compile materials before raising the success callback. Defaults to false.
|
138
|
+
*/
|
139
|
+
compileMaterials: boolean;
|
140
|
+
/**
|
141
|
+
* Defines if the loader should also compile materials with clip planes. Defaults to false.
|
142
|
+
*/
|
143
|
+
useClipPlane: boolean;
|
144
|
+
/**
|
145
|
+
* Defines if the loader should compile shadow generators before raising the success callback. Defaults to false.
|
146
|
+
*/
|
147
|
+
compileShadowGenerators: boolean;
|
148
|
+
/**
|
149
|
+
* Defines if the Alpha blended materials are only applied as coverage.
|
150
|
+
* If false, (default) The luminance of each pixel will reduce its opacity to simulate the behaviour of most physical materials.
|
151
|
+
* If true, no extra effects are applied to transparent pixels.
|
152
|
+
*/
|
153
|
+
transparencyAsCoverage: boolean;
|
154
|
+
/**
|
155
|
+
* Defines if the loader should use range requests when load binary glTF files from HTTP.
|
156
|
+
* Enabling will disable offline support and glTF validator.
|
157
|
+
* Defaults to false.
|
158
|
+
*/
|
159
|
+
useRangeRequests: boolean;
|
160
|
+
/**
|
161
|
+
* Defines if the loader should create instances when multiple glTF nodes point to the same glTF mesh. Defaults to true.
|
162
|
+
*/
|
163
|
+
createInstances: boolean;
|
164
|
+
/**
|
165
|
+
* Defines if the loader should always compute the bounding boxes of meshes and not use the min/max values from the position accessor. Defaults to false.
|
166
|
+
*/
|
167
|
+
alwaysComputeBoundingBox: boolean;
|
168
|
+
/**
|
169
|
+
* If true, load all materials defined in the file, even if not used by any mesh. Defaults to false.
|
170
|
+
*/
|
171
|
+
loadAllMaterials: boolean;
|
172
|
+
/**
|
173
|
+
* If true, load only the materials defined in the file. Defaults to false.
|
174
|
+
*/
|
175
|
+
loadOnlyMaterials: boolean;
|
176
|
+
/**
|
177
|
+
* If true, do not load any materials defined in the file. Defaults to false.
|
178
|
+
*/
|
179
|
+
skipMaterials: boolean;
|
180
|
+
/**
|
181
|
+
* If true, load the color (gamma encoded) textures into sRGB buffers (if supported by the GPU), which will yield more accurate results when sampling the texture. Defaults to true.
|
182
|
+
*/
|
183
|
+
useSRGBBuffers: boolean;
|
184
|
+
/**
|
185
|
+
* When loading glTF animations, which are defined in seconds, target them to this FPS. Defaults to 60.
|
186
|
+
*/
|
187
|
+
targetFps: number;
|
188
|
+
/**
|
189
|
+
* Defines if the loader should always compute the nearest common ancestor of the skeleton joints instead of using `skin.skeleton`. Defaults to false.
|
190
|
+
* Set this to true if loading assets with invalid `skin.skeleton` values.
|
191
|
+
*/
|
192
|
+
alwaysComputeSkeletonRootNode: boolean;
|
193
|
+
/**
|
194
|
+
* Function called before loading a url referenced by the asset.
|
195
|
+
* @param url
|
196
|
+
*/
|
197
|
+
preprocessUrlAsync: (url: string) => Promise<string>;
|
198
|
+
/**
|
199
|
+
* Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
|
200
|
+
* Note that the observable is raised as soon as the mesh object is created, meaning some data may not have been setup yet for this mesh (vertex data, morph targets, material, ...)
|
201
|
+
*/
|
202
|
+
readonly onMeshLoadedObservable: Observable<AbstractMesh>;
|
203
|
+
private _onMeshLoadedObserver;
|
204
|
+
/**
|
205
|
+
* Callback raised when the loader creates a mesh after parsing the glTF properties of the mesh.
|
206
|
+
* Note that the callback is called as soon as the mesh object is created, meaning some data may not have been setup yet for this mesh (vertex data, morph targets, material, ...)
|
207
|
+
*/
|
208
|
+
set onMeshLoaded(callback: (mesh: AbstractMesh) => void);
|
209
|
+
/**
|
210
|
+
* Observable raised when the loader creates a texture after parsing the glTF properties of the texture.
|
211
|
+
*/
|
212
|
+
readonly onTextureLoadedObservable: Observable<BaseTexture>;
|
213
|
+
private _onTextureLoadedObserver;
|
214
|
+
/**
|
215
|
+
* Callback raised when the loader creates a texture after parsing the glTF properties of the texture.
|
216
|
+
*/
|
217
|
+
set onTextureLoaded(callback: (texture: BaseTexture) => void);
|
218
|
+
/**
|
219
|
+
* Observable raised when the loader creates a material after parsing the glTF properties of the material.
|
220
|
+
*/
|
221
|
+
readonly onMaterialLoadedObservable: Observable<Material>;
|
222
|
+
private _onMaterialLoadedObserver;
|
223
|
+
/**
|
224
|
+
* Callback raised when the loader creates a material after parsing the glTF properties of the material.
|
225
|
+
*/
|
226
|
+
set onMaterialLoaded(callback: (material: Material) => void);
|
227
|
+
/**
|
228
|
+
* Observable raised when the loader creates a camera after parsing the glTF properties of the camera.
|
229
|
+
*/
|
230
|
+
readonly onCameraLoadedObservable: Observable<Camera>;
|
231
|
+
private _onCameraLoadedObserver;
|
232
|
+
/**
|
233
|
+
* Callback raised when the loader creates a camera after parsing the glTF properties of the camera.
|
234
|
+
*/
|
235
|
+
set onCameraLoaded(callback: (camera: Camera) => void);
|
236
|
+
/**
|
237
|
+
* Observable raised when the asset is completely loaded, immediately before the loader is disposed.
|
238
|
+
* For assets with LODs, raised when all of the LODs are complete.
|
239
|
+
* For assets without LODs, raised when the model is complete, immediately after the loader resolves the returned promise.
|
240
|
+
*/
|
241
|
+
readonly onCompleteObservable: Observable<void>;
|
242
|
+
private _onCompleteObserver;
|
243
|
+
/**
|
244
|
+
* Callback raised when the asset is completely loaded, immediately before the loader is disposed.
|
245
|
+
* For assets with LODs, raised when all of the LODs are complete.
|
246
|
+
* For assets without LODs, raised when the model is complete, immediately after the loader resolves the returned promise.
|
247
|
+
*/
|
248
|
+
set onComplete(callback: () => void);
|
249
|
+
/**
|
250
|
+
* Observable raised when an error occurs.
|
251
|
+
*/
|
252
|
+
readonly onErrorObservable: Observable<any>;
|
253
|
+
private _onErrorObserver;
|
254
|
+
/**
|
255
|
+
* Callback raised when an error occurs.
|
256
|
+
*/
|
257
|
+
set onError(callback: (reason: any) => void);
|
258
|
+
/**
|
259
|
+
* Observable raised after the loader is disposed.
|
260
|
+
*/
|
261
|
+
readonly onDisposeObservable: Observable<void>;
|
262
|
+
private _onDisposeObserver;
|
263
|
+
/**
|
264
|
+
* Callback raised after the loader is disposed.
|
265
|
+
*/
|
266
|
+
set onDispose(callback: () => void);
|
267
|
+
/**
|
268
|
+
* Observable raised after a loader extension is created.
|
269
|
+
* Set additional options for a loader extension in this event.
|
270
|
+
*/
|
271
|
+
readonly onExtensionLoadedObservable: Observable<IGLTFLoaderExtension>;
|
272
|
+
private _onExtensionLoadedObserver;
|
273
|
+
/**
|
274
|
+
* Callback raised after a loader extension is created.
|
275
|
+
*/
|
276
|
+
set onExtensionLoaded(callback: (extension: IGLTFLoaderExtension) => void);
|
277
|
+
/**
|
278
|
+
* Defines if the loader logging is enabled.
|
279
|
+
*/
|
280
|
+
get loggingEnabled(): boolean;
|
281
|
+
set loggingEnabled(value: boolean);
|
282
|
+
/**
|
283
|
+
* Defines if the loader should capture performance counters.
|
284
|
+
*/
|
285
|
+
get capturePerformanceCounters(): boolean;
|
286
|
+
set capturePerformanceCounters(value: boolean);
|
287
|
+
/**
|
288
|
+
* Defines if the loader should validate the asset.
|
289
|
+
*/
|
290
|
+
validate: boolean;
|
291
|
+
/**
|
292
|
+
* Observable raised after validation when validate is set to true. The event data is the result of the validation.
|
293
|
+
*/
|
294
|
+
readonly onValidatedObservable: Observable<GLTF2.IGLTFValidationResults>;
|
295
|
+
private _onValidatedObserver;
|
296
|
+
/**
|
297
|
+
* Callback raised after a loader extension is created.
|
298
|
+
*/
|
299
|
+
set onValidated(callback: (results: GLTF2.IGLTFValidationResults) => void);
|
300
|
+
private _loader;
|
301
|
+
private _state;
|
302
|
+
private _progressCallback?;
|
303
|
+
private _requests;
|
304
|
+
private static _MagicBase64Encoded;
|
305
|
+
/**
|
306
|
+
* Name of the loader ("gltf")
|
307
|
+
*/
|
308
|
+
name: string;
|
309
|
+
/** @hidden */
|
310
|
+
extensions: ISceneLoaderPluginExtensions;
|
311
|
+
/**
|
312
|
+
* Disposes the loader, releases resources during load, and cancels any outstanding requests.
|
313
|
+
*/
|
314
|
+
dispose(): void;
|
315
|
+
/**
|
316
|
+
* @param scene
|
317
|
+
* @param fileOrUrl
|
318
|
+
* @param onSuccess
|
319
|
+
* @param onProgress
|
320
|
+
* @param useArrayBuffer
|
321
|
+
* @param onError
|
322
|
+
* @hidden
|
323
|
+
*/
|
324
|
+
loadFile(scene: Scene, fileOrUrl: File | string, onSuccess: (data: any, responseURL?: string) => void, onProgress?: (ev: ISceneLoaderProgressEvent) => void, useArrayBuffer?: boolean, onError?: (request?: WebRequest, exception?: LoadFileError) => void): IFileRequest;
|
325
|
+
/**
|
326
|
+
* @param meshesNames
|
327
|
+
* @param scene
|
328
|
+
* @param data
|
329
|
+
* @param rootUrl
|
330
|
+
* @param onProgress
|
331
|
+
* @param fileName
|
332
|
+
* @hidden
|
333
|
+
*/
|
334
|
+
importMeshAsync(meshesNames: any, scene: Scene, data: any, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<ISceneLoaderAsyncResult>;
|
335
|
+
/**
|
336
|
+
* @param scene
|
337
|
+
* @param data
|
338
|
+
* @param rootUrl
|
339
|
+
* @param onProgress
|
340
|
+
* @param fileName
|
341
|
+
* @hidden
|
342
|
+
*/
|
343
|
+
loadAsync(scene: Scene, data: any, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<void>;
|
344
|
+
/**
|
345
|
+
* @param scene
|
346
|
+
* @param data
|
347
|
+
* @param rootUrl
|
348
|
+
* @param onProgress
|
349
|
+
* @param fileName
|
350
|
+
* @hidden
|
351
|
+
*/
|
352
|
+
loadAssetContainerAsync(scene: Scene, data: any, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<AssetContainer>;
|
353
|
+
/**
|
354
|
+
* @param data
|
355
|
+
* @hidden
|
356
|
+
*/
|
357
|
+
canDirectLoad(data: string): boolean;
|
358
|
+
/**
|
359
|
+
* @param scene
|
360
|
+
* @param data
|
361
|
+
* @hidden
|
362
|
+
*/
|
363
|
+
directLoad(scene: Scene, data: string): Promise<any>;
|
364
|
+
/**
|
365
|
+
* The callback that allows custom handling of the root url based on the response url.
|
366
|
+
* @param rootUrl the original root url
|
367
|
+
* @param responseURL the response url if available
|
368
|
+
* @returns the new root url
|
369
|
+
*/
|
370
|
+
rewriteRootURL?(rootUrl: string, responseURL?: string): string;
|
371
|
+
/** @hidden */
|
372
|
+
createPlugin(): ISceneLoaderPlugin | ISceneLoaderPluginAsync;
|
373
|
+
/**
|
374
|
+
* The loader state or null if the loader is not active.
|
375
|
+
*/
|
376
|
+
get loaderState(): Nullable<GLTFLoaderState>;
|
377
|
+
/**
|
378
|
+
* Observable raised when the loader state changes.
|
379
|
+
*/
|
380
|
+
onLoaderStateChangedObservable: Observable<Nullable<GLTFLoaderState>>;
|
381
|
+
/**
|
382
|
+
* Returns a promise that resolves when the asset is completely loaded.
|
383
|
+
* @returns a promise that resolves when the asset is completely loaded.
|
384
|
+
*/
|
385
|
+
whenCompleteAsync(): Promise<void>;
|
386
|
+
/**
|
387
|
+
* @param state
|
388
|
+
* @hidden
|
389
|
+
*/
|
390
|
+
_setState(state: GLTFLoaderState): void;
|
391
|
+
/**
|
392
|
+
* @param scene
|
393
|
+
* @param fileOrUrl
|
394
|
+
* @param onSuccess
|
395
|
+
* @param useArrayBuffer
|
396
|
+
* @param onError
|
397
|
+
* @param onOpened
|
398
|
+
* @hidden
|
399
|
+
*/
|
400
|
+
_loadFile(scene: Scene, fileOrUrl: File | string, onSuccess: (data: string | ArrayBuffer) => void, useArrayBuffer?: boolean, onError?: (request?: WebRequest) => void, onOpened?: (request: WebRequest) => void): IFileRequest;
|
401
|
+
private _onProgress;
|
402
|
+
private _validate;
|
403
|
+
private _getLoader;
|
404
|
+
private _parseJson;
|
405
|
+
private _unpackBinaryAsync;
|
406
|
+
private _unpackBinaryV1Async;
|
407
|
+
private _unpackBinaryV2Async;
|
408
|
+
private static _parseVersion;
|
409
|
+
private static _compareVersion;
|
410
|
+
private static readonly _logSpaces;
|
411
|
+
private _logIndentLevel;
|
412
|
+
private _loggingEnabled;
|
413
|
+
/** @hidden */
|
414
|
+
_log: (message: string) => void;
|
415
|
+
/**
|
416
|
+
* @param message
|
417
|
+
* @hidden
|
418
|
+
*/
|
419
|
+
_logOpen(message: string): void;
|
420
|
+
/** @hidden */
|
421
|
+
_logClose(): void;
|
422
|
+
private _logEnabled;
|
423
|
+
private _logDisabled;
|
424
|
+
private _capturePerformanceCounters;
|
425
|
+
/** @hidden */
|
426
|
+
_startPerformanceCounter: (counterName: string) => void;
|
427
|
+
/** @hidden */
|
428
|
+
_endPerformanceCounter: (counterName: string) => void;
|
429
|
+
private _startPerformanceCounterEnabled;
|
430
|
+
private _startPerformanceCounterDisabled;
|
431
|
+
private _endPerformanceCounterEnabled;
|
432
|
+
private _endPerformanceCounterDisabled;
|
433
|
+
}
|