babylonjs-loaders 8.26.0 → 8.26.2

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.
@@ -195,12 +195,15 @@ type DefaultExtensionOptions<BaseExtensionOptions> = {
195
195
  */
196
196
  enabled?: boolean;
197
197
  } & BaseExtensionOptions;
198
- abstract class GLTFLoaderOptions {
199
- protected copyFrom(options?: Partial<Readonly<GLTFLoaderOptions>>): void;
200
- /**
201
- * Raised when the asset has been parsed
202
- */
203
- abstract onParsed?: ((loaderData: IGLTFLoaderData) => void) | undefined;
198
+ /**
199
+ * This class contains all the concrete (not abstract) glTF options, excluding callbacks.
200
+ * The purpose of this class is to make it easy to provide a way to mutate the default
201
+ * loader options (see the GLTFLoaderDefaultOptions instance below) without duplicating
202
+ * all the options in yet another object. Since this class is instantiated for the default
203
+ * options object, abstract properties and callbacks are not included, it's more just
204
+ * flag-type options.
205
+ */
206
+ class GLTFLoaderBaseOptions {
204
207
  /**
205
208
  * 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.
206
209
  */
@@ -214,10 +217,6 @@ abstract class GLTFLoaderOptions {
214
217
  * The animation start mode. Defaults to FIRST.
215
218
  */
216
219
  animationStartMode: GLTFLoaderAnimationStartMode;
217
- /**
218
- * Defines if the loader should capture performance counters.
219
- */
220
- abstract capturePerformanceCounters: boolean;
221
220
  /**
222
221
  * Defines if the loader should compile materials before raising the success callback. Defaults to false.
223
222
  */
@@ -234,19 +233,6 @@ abstract class GLTFLoaderOptions {
234
233
  * Defines if the loader should create instances when multiple glTF nodes point to the same glTF mesh. Defaults to true.
235
234
  */
236
235
  createInstances: boolean;
237
- /**
238
- * 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.
239
- * You can also pass null if you don't want a root node to be created.
240
- */
241
- customRootNode?: Nullable<TransformNode>;
242
- /**
243
- * Defines options for glTF extensions.
244
- */
245
- extensionOptions: {
246
- [Extension in keyof GLTFLoaderExtensionOptions]?: {
247
- [Option in keyof DefaultExtensionOptions<GLTFLoaderExtensionOptions[Extension]>]: DefaultExtensionOptions<GLTFLoaderExtensionOptions[Extension]>[Option];
248
- };
249
- };
250
236
  /**
251
237
  * If true, load all materials defined in the file, even if not used by any mesh. Defaults to false.
252
238
  */
@@ -268,42 +254,6 @@ abstract class GLTFLoaderOptions {
268
254
  * Defines if the loader should load skins. Defaults to true.
269
255
  */
270
256
  loadSkins: boolean;
271
- /**
272
- * If true, enable logging for the loader. Defaults to false.
273
- */
274
- abstract loggingEnabled: boolean;
275
- /**
276
- * Callback raised when the loader creates a camera after parsing the glTF properties of the camera.
277
- */
278
- abstract onCameraLoaded?: (camera: Camera) => void;
279
- /**
280
- * Callback raised when the loader creates a material after parsing the glTF properties of the material.
281
- */
282
- abstract onMaterialLoaded?: (material: Material) => void;
283
- /**
284
- * Callback raised when the loader creates a mesh after parsing the glTF properties of the mesh.
285
- * 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, ...)
286
- */
287
- abstract onMeshLoaded?: (mesh: AbstractMesh) => void;
288
- /**
289
- * Callback raised when the loader creates a skin after parsing the glTF properties of the skin node.
290
- * @see https://doc.babylonjs.com/features/featuresDeepDive/importers/glTF/glTFSkinning#ignoring-the-transform-of-the-skinned-mesh
291
- */
292
- abstract onSkinLoaded?: (node: TransformNode, skinnedNode: TransformNode) => void;
293
- /**
294
- * Callback raised when the loader creates a texture after parsing the glTF properties of the texture.
295
- */
296
- abstract onTextureLoaded?: (texture: BaseTexture) => void;
297
- /**
298
- * Callback raised after the asset is validated.
299
- */
300
- abstract onValidated?: (results: GLTF2.IGLTFValidationResults) => void;
301
- /**
302
- * Function called before loading a url referenced by the asset.
303
- * @param url url referenced by the asset
304
- * @returns Async url to load
305
- */
306
- preprocessUrlAsync: (url: string) => Promise<string>;
307
257
  /**
308
258
  * If true, do not load any materials defined in the file. Defaults to false.
309
259
  */
@@ -342,6 +292,72 @@ abstract class GLTFLoaderOptions {
342
292
  */
343
293
  validate: boolean;
344
294
  }
295
+ /**
296
+ * The default GLTF loader options.
297
+ * Override the properties of this object to globally change the default loader options.
298
+ * To specify options for a specific load call, pass those options into the associated load function.
299
+ */
300
+ export const GLTFLoaderDefaultOptions: GLTFLoaderBaseOptions;
301
+ abstract class GLTFLoaderOptions extends GLTFLoaderBaseOptions {
302
+ protected copyFrom(options?: Partial<Readonly<GLTFLoaderOptions>>): void;
303
+ /**
304
+ * Raised when the asset has been parsed
305
+ */
306
+ abstract onParsed?: ((loaderData: IGLTFLoaderData) => void) | undefined;
307
+ /**
308
+ * Defines if the loader should capture performance counters.
309
+ */
310
+ abstract capturePerformanceCounters: boolean;
311
+ /**
312
+ * 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.
313
+ * You can also pass null if you don't want a root node to be created.
314
+ */
315
+ customRootNode?: Nullable<TransformNode>;
316
+ /**
317
+ * Defines options for glTF extensions.
318
+ */
319
+ extensionOptions: {
320
+ [Extension in keyof GLTFLoaderExtensionOptions]?: {
321
+ [Option in keyof DefaultExtensionOptions<GLTFLoaderExtensionOptions[Extension]>]: DefaultExtensionOptions<GLTFLoaderExtensionOptions[Extension]>[Option];
322
+ };
323
+ };
324
+ /**
325
+ * If true, enable logging for the loader. Defaults to false.
326
+ */
327
+ abstract loggingEnabled: boolean;
328
+ /**
329
+ * Callback raised when the loader creates a camera after parsing the glTF properties of the camera.
330
+ */
331
+ abstract onCameraLoaded?: (camera: Camera) => void;
332
+ /**
333
+ * Callback raised when the loader creates a material after parsing the glTF properties of the material.
334
+ */
335
+ abstract onMaterialLoaded?: (material: Material) => void;
336
+ /**
337
+ * Callback raised when the loader creates a mesh after parsing the glTF properties of the mesh.
338
+ * 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, ...)
339
+ */
340
+ abstract onMeshLoaded?: (mesh: AbstractMesh) => void;
341
+ /**
342
+ * Callback raised when the loader creates a skin after parsing the glTF properties of the skin node.
343
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/importers/glTF/glTFSkinning#ignoring-the-transform-of-the-skinned-mesh
344
+ */
345
+ abstract onSkinLoaded?: (node: TransformNode, skinnedNode: TransformNode) => void;
346
+ /**
347
+ * Callback raised when the loader creates a texture after parsing the glTF properties of the texture.
348
+ */
349
+ abstract onTextureLoaded?: (texture: BaseTexture) => void;
350
+ /**
351
+ * Callback raised after the asset is validated.
352
+ */
353
+ abstract onValidated?: (results: GLTF2.IGLTFValidationResults) => void;
354
+ /**
355
+ * Function called before loading a url referenced by the asset.
356
+ * @param url url referenced by the asset
357
+ * @returns Async url to load
358
+ */
359
+ preprocessUrlAsync: (url: string) => Promise<string>;
360
+ }
345
361
  /**
346
362
  * File loader for loading glTF files into a scene.
347
363
  */
@@ -5794,12 +5810,15 @@ declare module BABYLON {
5794
5810
  */
5795
5811
  enabled?: boolean;
5796
5812
  } & BaseExtensionOptions;
5797
- abstract class GLTFLoaderOptions {
5798
- protected copyFrom(options?: Partial<Readonly<GLTFLoaderOptions>>): void;
5799
- /**
5800
- * Raised when the asset has been parsed
5801
- */
5802
- abstract onParsed?: ((loaderData: IGLTFLoaderData) => void) | undefined;
5813
+ /**
5814
+ * This class contains all the concrete (not abstract) glTF options, excluding callbacks.
5815
+ * The purpose of this class is to make it easy to provide a way to mutate the default
5816
+ * loader options (see the GLTFLoaderDefaultOptions instance below) without duplicating
5817
+ * all the options in yet another object. Since this class is instantiated for the default
5818
+ * options object, abstract properties and callbacks are not included, it's more just
5819
+ * flag-type options.
5820
+ */
5821
+ class GLTFLoaderBaseOptions {
5803
5822
  /**
5804
5823
  * 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.
5805
5824
  */
@@ -5813,10 +5832,6 @@ declare module BABYLON {
5813
5832
  * The animation start mode. Defaults to FIRST.
5814
5833
  */
5815
5834
  animationStartMode: GLTFLoaderAnimationStartMode;
5816
- /**
5817
- * Defines if the loader should capture performance counters.
5818
- */
5819
- abstract capturePerformanceCounters: boolean;
5820
5835
  /**
5821
5836
  * Defines if the loader should compile materials before raising the success callback. Defaults to false.
5822
5837
  */
@@ -5833,19 +5848,6 @@ declare module BABYLON {
5833
5848
  * Defines if the loader should create instances when multiple glTF nodes point to the same glTF mesh. Defaults to true.
5834
5849
  */
5835
5850
  createInstances: boolean;
5836
- /**
5837
- * 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.
5838
- * You can also pass null if you don't want a root node to be created.
5839
- */
5840
- customRootNode?: Nullable<TransformNode>;
5841
- /**
5842
- * Defines options for glTF extensions.
5843
- */
5844
- extensionOptions: {
5845
- [Extension in keyof GLTFLoaderExtensionOptions]?: {
5846
- [Option in keyof DefaultExtensionOptions<GLTFLoaderExtensionOptions[Extension]>]: DefaultExtensionOptions<GLTFLoaderExtensionOptions[Extension]>[Option];
5847
- };
5848
- };
5849
5851
  /**
5850
5852
  * If true, load all materials defined in the file, even if not used by any mesh. Defaults to false.
5851
5853
  */
@@ -5867,42 +5869,6 @@ declare module BABYLON {
5867
5869
  * Defines if the loader should load skins. Defaults to true.
5868
5870
  */
5869
5871
  loadSkins: boolean;
5870
- /**
5871
- * If true, enable logging for the loader. Defaults to false.
5872
- */
5873
- abstract loggingEnabled: boolean;
5874
- /**
5875
- * Callback raised when the loader creates a camera after parsing the glTF properties of the camera.
5876
- */
5877
- abstract onCameraLoaded?: (camera: Camera) => void;
5878
- /**
5879
- * Callback raised when the loader creates a material after parsing the glTF properties of the material.
5880
- */
5881
- abstract onMaterialLoaded?: (material: Material) => void;
5882
- /**
5883
- * Callback raised when the loader creates a mesh after parsing the glTF properties of the mesh.
5884
- * 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, ...)
5885
- */
5886
- abstract onMeshLoaded?: (mesh: AbstractMesh) => void;
5887
- /**
5888
- * Callback raised when the loader creates a skin after parsing the glTF properties of the skin node.
5889
- * @see https://doc.babylonjs.com/features/featuresDeepDive/importers/glTF/glTFSkinning#ignoring-the-transform-of-the-skinned-mesh
5890
- */
5891
- abstract onSkinLoaded?: (node: TransformNode, skinnedNode: TransformNode) => void;
5892
- /**
5893
- * Callback raised when the loader creates a texture after parsing the glTF properties of the texture.
5894
- */
5895
- abstract onTextureLoaded?: (texture: BaseTexture) => void;
5896
- /**
5897
- * Callback raised after the asset is validated.
5898
- */
5899
- abstract onValidated?: (results: GLTF2.IGLTFValidationResults) => void;
5900
- /**
5901
- * Function called before loading a url referenced by the asset.
5902
- * @param url url referenced by the asset
5903
- * @returns Async url to load
5904
- */
5905
- preprocessUrlAsync: (url: string) => Promise<string>;
5906
5872
  /**
5907
5873
  * If true, do not load any materials defined in the file. Defaults to false.
5908
5874
  */
@@ -5941,6 +5907,72 @@ declare module BABYLON {
5941
5907
  */
5942
5908
  validate: boolean;
5943
5909
  }
5910
+ /**
5911
+ * The default GLTF loader options.
5912
+ * Override the properties of this object to globally change the default loader options.
5913
+ * To specify options for a specific load call, pass those options into the associated load function.
5914
+ */
5915
+ export var GLTFLoaderDefaultOptions: GLTFLoaderBaseOptions;
5916
+ abstract class GLTFLoaderOptions extends GLTFLoaderBaseOptions {
5917
+ protected copyFrom(options?: Partial<Readonly<GLTFLoaderOptions>>): void;
5918
+ /**
5919
+ * Raised when the asset has been parsed
5920
+ */
5921
+ abstract onParsed?: ((loaderData: IGLTFLoaderData) => void) | undefined;
5922
+ /**
5923
+ * Defines if the loader should capture performance counters.
5924
+ */
5925
+ abstract capturePerformanceCounters: boolean;
5926
+ /**
5927
+ * 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.
5928
+ * You can also pass null if you don't want a root node to be created.
5929
+ */
5930
+ customRootNode?: Nullable<TransformNode>;
5931
+ /**
5932
+ * Defines options for glTF extensions.
5933
+ */
5934
+ extensionOptions: {
5935
+ [Extension in keyof GLTFLoaderExtensionOptions]?: {
5936
+ [Option in keyof DefaultExtensionOptions<GLTFLoaderExtensionOptions[Extension]>]: DefaultExtensionOptions<GLTFLoaderExtensionOptions[Extension]>[Option];
5937
+ };
5938
+ };
5939
+ /**
5940
+ * If true, enable logging for the loader. Defaults to false.
5941
+ */
5942
+ abstract loggingEnabled: boolean;
5943
+ /**
5944
+ * Callback raised when the loader creates a camera after parsing the glTF properties of the camera.
5945
+ */
5946
+ abstract onCameraLoaded?: (camera: Camera) => void;
5947
+ /**
5948
+ * Callback raised when the loader creates a material after parsing the glTF properties of the material.
5949
+ */
5950
+ abstract onMaterialLoaded?: (material: Material) => void;
5951
+ /**
5952
+ * Callback raised when the loader creates a mesh after parsing the glTF properties of the mesh.
5953
+ * 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, ...)
5954
+ */
5955
+ abstract onMeshLoaded?: (mesh: AbstractMesh) => void;
5956
+ /**
5957
+ * Callback raised when the loader creates a skin after parsing the glTF properties of the skin node.
5958
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/importers/glTF/glTFSkinning#ignoring-the-transform-of-the-skinned-mesh
5959
+ */
5960
+ abstract onSkinLoaded?: (node: TransformNode, skinnedNode: TransformNode) => void;
5961
+ /**
5962
+ * Callback raised when the loader creates a texture after parsing the glTF properties of the texture.
5963
+ */
5964
+ abstract onTextureLoaded?: (texture: BaseTexture) => void;
5965
+ /**
5966
+ * Callback raised after the asset is validated.
5967
+ */
5968
+ abstract onValidated?: (results: GLTF2.IGLTFValidationResults) => void;
5969
+ /**
5970
+ * Function called before loading a url referenced by the asset.
5971
+ * @param url url referenced by the asset
5972
+ * @returns Async url to load
5973
+ */
5974
+ preprocessUrlAsync: (url: string) => Promise<string>;
5975
+ }
5944
5976
  /**
5945
5977
  * File loader for loading glTF files into a scene.
5946
5978
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "babylonjs-loaders",
3
- "version": "8.26.0",
3
+ "version": "8.26.2",
4
4
  "main": "babylonjs.loaders.min.js",
5
5
  "types": "babylonjs.loaders.module.d.ts",
6
6
  "files": [
@@ -15,8 +15,8 @@
15
15
  "test:escheck": "es-check es6 ./babylonjs.loaders.js"
16
16
  },
17
17
  "dependencies": {
18
- "babylonjs": "^8.26.0",
19
- "babylonjs-gltf2interface": "^8.26.0"
18
+ "babylonjs": "^8.26.2",
19
+ "babylonjs-gltf2interface": "^8.26.2"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@dev/build-tools": "1.0.0",