babylonjs-loaders 8.25.2 → 8.26.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -161,12 +161,15 @@ declare module BABYLON {
161
161
  */
162
162
  enabled?: boolean;
163
163
  } & BaseExtensionOptions;
164
- abstract class GLTFLoaderOptions {
165
- protected copyFrom(options?: Partial<Readonly<GLTFLoaderOptions>>): void;
166
- /**
167
- * Raised when the asset has been parsed
168
- */
169
- abstract onParsed?: ((loaderData: IGLTFLoaderData) => void) | undefined;
164
+ /**
165
+ * This class contains all the concrete (not abstract) glTF options, excluding callbacks.
166
+ * The purpose of this class is to make it easy to provide a way to mutate the default
167
+ * loader options (see the GLTFLoaderDefaultOptions instance below) without duplicating
168
+ * all the options in yet another object. Since this class is instantiated for the default
169
+ * options object, abstract properties and callbacks are not included, it's more just
170
+ * flag-type options.
171
+ */
172
+ class GLTFLoaderBaseOptions {
170
173
  /**
171
174
  * 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.
172
175
  */
@@ -180,10 +183,6 @@ declare module BABYLON {
180
183
  * The animation start mode. Defaults to FIRST.
181
184
  */
182
185
  animationStartMode: GLTFLoaderAnimationStartMode;
183
- /**
184
- * Defines if the loader should capture performance counters.
185
- */
186
- abstract capturePerformanceCounters: boolean;
187
186
  /**
188
187
  * Defines if the loader should compile materials before raising the success callback. Defaults to false.
189
188
  */
@@ -200,19 +199,6 @@ declare module BABYLON {
200
199
  * Defines if the loader should create instances when multiple glTF nodes point to the same glTF mesh. Defaults to true.
201
200
  */
202
201
  createInstances: boolean;
203
- /**
204
- * Defines the node to use as the root of the hierarchy when loading the scene (default: undefined). If not defined, a root node will be automatically created.
205
- * You can also pass null if you don't want a root node to be created.
206
- */
207
- customRootNode?: Nullable<TransformNode>;
208
- /**
209
- * Defines options for glTF extensions.
210
- */
211
- extensionOptions: {
212
- [Extension in keyof GLTFLoaderExtensionOptions]?: {
213
- [Option in keyof DefaultExtensionOptions<GLTFLoaderExtensionOptions[Extension]>]: DefaultExtensionOptions<GLTFLoaderExtensionOptions[Extension]>[Option];
214
- };
215
- };
216
202
  /**
217
203
  * If true, load all materials defined in the file, even if not used by any mesh. Defaults to false.
218
204
  */
@@ -234,42 +220,6 @@ declare module BABYLON {
234
220
  * Defines if the loader should load skins. Defaults to true.
235
221
  */
236
222
  loadSkins: boolean;
237
- /**
238
- * If true, enable logging for the loader. Defaults to false.
239
- */
240
- abstract loggingEnabled: boolean;
241
- /**
242
- * Callback raised when the loader creates a camera after parsing the glTF properties of the camera.
243
- */
244
- abstract onCameraLoaded?: (camera: Camera) => void;
245
- /**
246
- * Callback raised when the loader creates a material after parsing the glTF properties of the material.
247
- */
248
- abstract onMaterialLoaded?: (material: Material) => void;
249
- /**
250
- * Callback raised when the loader creates a mesh after parsing the glTF properties of the mesh.
251
- * 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, ...)
252
- */
253
- abstract onMeshLoaded?: (mesh: AbstractMesh) => void;
254
- /**
255
- * Callback raised when the loader creates a skin after parsing the glTF properties of the skin node.
256
- * @see https://doc.babylonjs.com/features/featuresDeepDive/importers/glTF/glTFSkinning#ignoring-the-transform-of-the-skinned-mesh
257
- */
258
- abstract onSkinLoaded?: (node: TransformNode, skinnedNode: TransformNode) => void;
259
- /**
260
- * Callback raised when the loader creates a texture after parsing the glTF properties of the texture.
261
- */
262
- abstract onTextureLoaded?: (texture: BaseTexture) => void;
263
- /**
264
- * Callback raised after the asset is validated.
265
- */
266
- abstract onValidated?: (results: GLTF2.IGLTFValidationResults) => void;
267
- /**
268
- * Function called before loading a url referenced by the asset.
269
- * @param url url referenced by the asset
270
- * @returns Async url to load
271
- */
272
- preprocessUrlAsync: (url: string) => Promise<string>;
273
223
  /**
274
224
  * If true, do not load any materials defined in the file. Defaults to false.
275
225
  */
@@ -308,6 +258,72 @@ declare module BABYLON {
308
258
  */
309
259
  validate: boolean;
310
260
  }
261
+ /**
262
+ * The default GLTF loader options.
263
+ * Override the properties of this object to globally change the default loader options.
264
+ * To specify options for a specific load call, pass those options into the associated load function.
265
+ */
266
+ export var GLTFLoaderDefaultOptions: GLTFLoaderBaseOptions;
267
+ abstract class GLTFLoaderOptions extends GLTFLoaderBaseOptions {
268
+ protected copyFrom(options?: Partial<Readonly<GLTFLoaderOptions>>): void;
269
+ /**
270
+ * Raised when the asset has been parsed
271
+ */
272
+ abstract onParsed?: ((loaderData: IGLTFLoaderData) => void) | undefined;
273
+ /**
274
+ * Defines if the loader should capture performance counters.
275
+ */
276
+ abstract capturePerformanceCounters: boolean;
277
+ /**
278
+ * Defines the node to use as the root of the hierarchy when loading the scene (default: undefined). If not defined, a root node will be automatically created.
279
+ * You can also pass null if you don't want a root node to be created.
280
+ */
281
+ customRootNode?: Nullable<TransformNode>;
282
+ /**
283
+ * Defines options for glTF extensions.
284
+ */
285
+ extensionOptions: {
286
+ [Extension in keyof GLTFLoaderExtensionOptions]?: {
287
+ [Option in keyof DefaultExtensionOptions<GLTFLoaderExtensionOptions[Extension]>]: DefaultExtensionOptions<GLTFLoaderExtensionOptions[Extension]>[Option];
288
+ };
289
+ };
290
+ /**
291
+ * If true, enable logging for the loader. Defaults to false.
292
+ */
293
+ abstract loggingEnabled: boolean;
294
+ /**
295
+ * Callback raised when the loader creates a camera after parsing the glTF properties of the camera.
296
+ */
297
+ abstract onCameraLoaded?: (camera: Camera) => void;
298
+ /**
299
+ * Callback raised when the loader creates a material after parsing the glTF properties of the material.
300
+ */
301
+ abstract onMaterialLoaded?: (material: Material) => void;
302
+ /**
303
+ * Callback raised when the loader creates a mesh after parsing the glTF properties of the mesh.
304
+ * 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, ...)
305
+ */
306
+ abstract onMeshLoaded?: (mesh: AbstractMesh) => void;
307
+ /**
308
+ * Callback raised when the loader creates a skin after parsing the glTF properties of the skin node.
309
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/importers/glTF/glTFSkinning#ignoring-the-transform-of-the-skinned-mesh
310
+ */
311
+ abstract onSkinLoaded?: (node: TransformNode, skinnedNode: TransformNode) => void;
312
+ /**
313
+ * Callback raised when the loader creates a texture after parsing the glTF properties of the texture.
314
+ */
315
+ abstract onTextureLoaded?: (texture: BaseTexture) => void;
316
+ /**
317
+ * Callback raised after the asset is validated.
318
+ */
319
+ abstract onValidated?: (results: GLTF2.IGLTFValidationResults) => void;
320
+ /**
321
+ * Function called before loading a url referenced by the asset.
322
+ * @param url url referenced by the asset
323
+ * @returns Async url to load
324
+ */
325
+ preprocessUrlAsync: (url: string) => Promise<string>;
326
+ }
311
327
  /**
312
328
  * File loader for loading glTF files into a scene.
313
329
  */