babylonjs-loaders 6.39.0 → 6.40.0

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.
@@ -89,6 +89,7 @@ export abstract class GLTFLoaderExtension {
89
89
  * @param rootUrl
90
90
  * @param onSuccess
91
91
  * @param onError
92
+ * @returns true to stop further extensions from loading the runtime
92
93
  */
93
94
  loadRuntimeAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess?: (gltfRuntime: IGLTFRuntime) => void, onError?: (message: string) => void): boolean;
94
95
  /**
@@ -97,6 +98,7 @@ export abstract class GLTFLoaderExtension {
97
98
  * @param gltfRuntime
98
99
  * @param onSuccess
99
100
  * @param onError
101
+ * @returns true to stop further extensions from creating the runtime
100
102
  */
101
103
  loadRuntimeExtensionsAsync(gltfRuntime: IGLTFRuntime, onSuccess: () => void, onError?: (message: string) => void): boolean;
102
104
  /**
@@ -107,6 +109,7 @@ export abstract class GLTFLoaderExtension {
107
109
  * @param onSuccess
108
110
  * @param onError
109
111
  * @param onProgress
112
+ * @returns true to stop further extensions from loading this buffer
110
113
  */
111
114
  loadBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void, onProgress?: () => void): boolean;
112
115
  /**
@@ -116,6 +119,7 @@ export abstract class GLTFLoaderExtension {
116
119
  * @param id
117
120
  * @param onSuccess
118
121
  * @param onError
122
+ * @returns true to stop further extensions from loading this texture data
119
123
  */
120
124
  loadTextureBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void): boolean;
121
125
  /**
@@ -126,6 +130,7 @@ export abstract class GLTFLoaderExtension {
126
130
  * @param buffer
127
131
  * @param onSuccess
128
132
  * @param onError
133
+ * @returns true to stop further extensions from loading this texture
129
134
  */
130
135
  createTextureAsync(gltfRuntime: IGLTFRuntime, id: string, buffer: ArrayBufferView, onSuccess: (texture: Texture) => void, onError: (message: string) => void): boolean;
131
136
  /**
@@ -135,6 +140,7 @@ export abstract class GLTFLoaderExtension {
135
140
  * @param id
136
141
  * @param onSuccess
137
142
  * @param onError
143
+ * @returns true to stop further extensions from loading this shader data
138
144
  */
139
145
  loadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderString: string) => void, onError: (message: string) => void): boolean;
140
146
  /**
@@ -144,6 +150,7 @@ export abstract class GLTFLoaderExtension {
144
150
  * @param id
145
151
  * @param onSuccess
146
152
  * @param onError
153
+ * @returns true to stop further extensions from loading this material
147
154
  */
148
155
  loadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: Material) => void, onError: (message: string) => void): boolean;
149
156
  static LoadRuntimeAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess?: (gltfRuntime: IGLTFRuntime) => void, onError?: (message: string) => void): void;
@@ -601,16 +608,19 @@ export class GLTFUtils {
601
608
  * @param uniform the name of the shader's uniform
602
609
  * @param value the value of the uniform
603
610
  * @param type the uniform's type (EParameterType FLOAT, VEC2, VEC3 or VEC4)
611
+ * @returns true if set, else false
604
612
  */
605
613
  static SetUniform(shaderMaterial: ShaderMaterial | Effect, uniform: string, value: any, type: number): boolean;
606
614
  /**
607
615
  * Returns the wrap mode of the texture
608
616
  * @param mode the mode value
617
+ * @returns the wrap mode (TEXTURE_WRAP_ADDRESSMODE, MIRROR_ADDRESSMODE or CLAMP_ADDRESSMODE)
609
618
  */
610
619
  static GetWrapMode(mode: number): number;
611
620
  /**
612
621
  * Returns the byte stride giving an accessor
613
622
  * @param accessor the GLTF accessor objet
623
+ * @returns the byte stride
614
624
  */
615
625
  static GetByteStrideFromType(accessor: IGLTFAccessor): number;
616
626
  /**
@@ -624,17 +634,20 @@ export class GLTFUtils {
624
634
  * Returns a buffer from its accessor
625
635
  * @param gltfRuntime the GLTF runtime
626
636
  * @param accessor the GLTF accessor
637
+ * @returns an array buffer view
627
638
  */
628
639
  static GetBufferFromAccessor(gltfRuntime: IGLTFRuntime, accessor: IGLTFAccessor): any;
629
640
  /**
630
641
  * Decodes a buffer view into a string
631
642
  * @param view the buffer view
643
+ * @returns a string
632
644
  */
633
645
  static DecodeBufferToText(view: ArrayBufferView): string;
634
646
  /**
635
647
  * Returns the default material of gltf. Related to
636
648
  * https://github.com/KhronosGroup/glTF/tree/master/specification/1.0#appendix-a-default-material
637
649
  * @param scene the Babylon.js scene
650
+ * @returns the default Babylon material
638
651
  */
639
652
  static GetDefaultMaterial(scene: Scene): ShaderMaterial;
640
653
  private static _DefaultMaterial;
@@ -876,6 +889,9 @@ export class GLTFPathToObjectConverter<T> implements IPathToObjectConverter<T> {
876
889
  * - "/materials/2/emissiveFactor"
877
890
  * - "/materials/2/pbrMetallicRoughness/baseColorFactor"
878
891
  * - "/materials/2/extensions/KHR_materials_emissive_strength/emissiveStrength"
892
+ *
893
+ * @param path The path to convert
894
+ * @returns The object and info associated with the path
879
895
  */
880
896
  convert(path: string): IObjectInfo<T>;
881
897
  }
@@ -2062,7 +2078,7 @@ export class MSFT_lod implements IGLTFLoaderExtension {
2062
2078
  loadBufferAsync(context: string, buffer: IBuffer, byteOffset: number, byteLength: number): Nullable<Promise<ArrayBufferView>>;
2063
2079
  private _loadBufferLOD;
2064
2080
  /**
2065
- * Gets an array of LOD properties from lowest to highest.
2081
+ * @returns an array of LOD properties from lowest to highest.
2066
2082
  * @param context
2067
2083
  * @param property
2068
2084
  * @param array
@@ -2238,9 +2254,9 @@ export class GLTFLoader implements IGLTFLoader {
2238
2254
  */
2239
2255
  get babylonScene(): Scene;
2240
2256
  /**
2241
- * The root Babylon mesh when loading the asset.
2257
+ * The root Babylon node when loading the asset.
2242
2258
  */
2243
- get rootBabylonMesh(): Nullable<Mesh>;
2259
+ get rootBabylonMesh(): Nullable<TransformNode>;
2244
2260
  /**
2245
2261
  * The root url when loading the asset.
2246
2262
  */
@@ -3210,9 +3226,15 @@ export class GLTFFileLoader implements IDisposable, ISceneLoaderPluginAsync, ISc
3210
3226
  alwaysComputeSkeletonRootNode: boolean;
3211
3227
  /**
3212
3228
  * Function called before loading a url referenced by the asset.
3213
- * @param url
3229
+ * @param url url referenced by the asset
3230
+ * @returns Async url to load
3214
3231
  */
3215
3232
  preprocessUrlAsync: (url: string) => Promise<string>;
3233
+ /**
3234
+ * 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.
3235
+ * You can also pass null if you don't want a root node to be created.
3236
+ */
3237
+ customRootNode?: Nullable<TransformNode>;
3216
3238
  /**
3217
3239
  * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
3218
3240
  * 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, ...)
@@ -3906,11 +3928,13 @@ export class SPLATFileLoader implements ISceneLoaderPluginAsync, ISceneLoaderPlu
3906
3928
  * Code from https://github.com/dylanebert/gsplat.js/blob/main/src/loaders/PLYLoader.ts Under MIT license
3907
3929
  * Loads a .ply from data array buffer
3908
3930
  * if data array buffer is not ply, returns the original buffer
3931
+ * @param data the data to load
3932
+ * @returns the loaded buffer
3909
3933
  */
3910
3934
  private _loadPLY;
3911
3935
  /**
3912
3936
  * Imports from the loaded gaussian splatting data and adds them to the scene
3913
- * @param meshesNames a string or array of strings of the mesh names that should be loaded from the file
3937
+ * @param _meshesNames a string or array of strings of the mesh names that should be loaded from the file
3914
3938
  * @param scene the scene the meshes should be added to
3915
3939
  * @param data the gaussian splatting data to load
3916
3940
  * @param rootUrl root url to load from
@@ -3921,15 +3945,15 @@ export class SPLATFileLoader implements ISceneLoaderPluginAsync, ISceneLoaderPlu
3921
3945
  * Imports all objects from the loaded gaussian splatting data and adds them to the scene
3922
3946
  * @param scene the scene the objects should be added to
3923
3947
  * @param data the gaussian splatting data to load
3924
- * @param rootUrl root url to load from
3948
+ * @param _rootUrl root url to load from
3925
3949
  * @returns a promise which completes when objects have been loaded to the scene
3926
3950
  */
3927
3951
  loadAsync(scene: Scene, data: any, _rootUrl: string): Promise<void>;
3928
3952
  /**
3929
3953
  * Load into an asset container.
3930
- * @param scene The scene to load into
3931
- * @param data The data to import
3932
- * @param rootUrl The root url for scene and resources
3954
+ * @param _scene The scene to load into
3955
+ * @param _data The data to import
3956
+ * @param _rootUrl The root url for scene and resources
3933
3957
  * @returns The loaded asset container
3934
3958
  */
3935
3959
  loadAssetContainerAsync(_scene: Scene, _data: string, _rootUrl: string): Promise<AssetContainer>;
@@ -4147,6 +4171,7 @@ declare module BABYLON.GLTF1 {
4147
4171
  * @param rootUrl
4148
4172
  * @param onSuccess
4149
4173
  * @param onError
4174
+ * @returns true to stop further extensions from loading the runtime
4150
4175
  */
4151
4176
  loadRuntimeAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess?: (gltfRuntime: BABYLON.GLTF1.IGLTFRuntime) => void, onError?: (message: string) => void): boolean;
4152
4177
  /**
@@ -4155,6 +4180,7 @@ declare module BABYLON.GLTF1 {
4155
4180
  * @param gltfRuntime
4156
4181
  * @param onSuccess
4157
4182
  * @param onError
4183
+ * @returns true to stop further extensions from creating the runtime
4158
4184
  */
4159
4185
  loadRuntimeExtensionsAsync(gltfRuntime: BABYLON.GLTF1.IGLTFRuntime, onSuccess: () => void, onError?: (message: string) => void): boolean;
4160
4186
  /**
@@ -4165,6 +4191,7 @@ declare module BABYLON.GLTF1 {
4165
4191
  * @param onSuccess
4166
4192
  * @param onError
4167
4193
  * @param onProgress
4194
+ * @returns true to stop further extensions from loading this buffer
4168
4195
  */
4169
4196
  loadBufferAsync(gltfRuntime: BABYLON.GLTF1.IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void, onProgress?: () => void): boolean;
4170
4197
  /**
@@ -4174,6 +4201,7 @@ declare module BABYLON.GLTF1 {
4174
4201
  * @param id
4175
4202
  * @param onSuccess
4176
4203
  * @param onError
4204
+ * @returns true to stop further extensions from loading this texture data
4177
4205
  */
4178
4206
  loadTextureBufferAsync(gltfRuntime: BABYLON.GLTF1.IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void): boolean;
4179
4207
  /**
@@ -4184,6 +4212,7 @@ declare module BABYLON.GLTF1 {
4184
4212
  * @param buffer
4185
4213
  * @param onSuccess
4186
4214
  * @param onError
4215
+ * @returns true to stop further extensions from loading this texture
4187
4216
  */
4188
4217
  createTextureAsync(gltfRuntime: BABYLON.GLTF1.IGLTFRuntime, id: string, buffer: ArrayBufferView, onSuccess: (texture: Texture) => void, onError: (message: string) => void): boolean;
4189
4218
  /**
@@ -4193,6 +4222,7 @@ declare module BABYLON.GLTF1 {
4193
4222
  * @param id
4194
4223
  * @param onSuccess
4195
4224
  * @param onError
4225
+ * @returns true to stop further extensions from loading this shader data
4196
4226
  */
4197
4227
  loadShaderStringAsync(gltfRuntime: BABYLON.GLTF1.IGLTFRuntime, id: string, onSuccess: (shaderString: string) => void, onError: (message: string) => void): boolean;
4198
4228
  /**
@@ -4202,6 +4232,7 @@ declare module BABYLON.GLTF1 {
4202
4232
  * @param id
4203
4233
  * @param onSuccess
4204
4234
  * @param onError
4235
+ * @returns true to stop further extensions from loading this material
4205
4236
  */
4206
4237
  loadMaterialAsync(gltfRuntime: BABYLON.GLTF1.IGLTFRuntime, id: string, onSuccess: (material: Material) => void, onError: (message: string) => void): boolean;
4207
4238
  static LoadRuntimeAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess?: (gltfRuntime: BABYLON.GLTF1.IGLTFRuntime) => void, onError?: (message: string) => void): void;
@@ -4656,16 +4687,19 @@ declare module BABYLON.GLTF1 {
4656
4687
  * @param uniform the name of the shader's uniform
4657
4688
  * @param value the value of the uniform
4658
4689
  * @param type the uniform's type (EParameterType FLOAT, VEC2, VEC3 or VEC4)
4690
+ * @returns true if set, else false
4659
4691
  */
4660
4692
  static SetUniform(shaderMaterial: ShaderMaterial | Effect, uniform: string, value: any, type: number): boolean;
4661
4693
  /**
4662
4694
  * Returns the wrap mode of the texture
4663
4695
  * @param mode the mode value
4696
+ * @returns the wrap mode (TEXTURE_WRAP_ADDRESSMODE, MIRROR_ADDRESSMODE or CLAMP_ADDRESSMODE)
4664
4697
  */
4665
4698
  static GetWrapMode(mode: number): number;
4666
4699
  /**
4667
4700
  * Returns the byte stride giving an accessor
4668
4701
  * @param accessor the GLTF accessor objet
4702
+ * @returns the byte stride
4669
4703
  */
4670
4704
  static GetByteStrideFromType(accessor: BABYLON.GLTF1.IGLTFAccessor): number;
4671
4705
  /**
@@ -4679,17 +4713,20 @@ declare module BABYLON.GLTF1 {
4679
4713
  * Returns a buffer from its accessor
4680
4714
  * @param gltfRuntime the GLTF runtime
4681
4715
  * @param accessor the GLTF accessor
4716
+ * @returns an array buffer view
4682
4717
  */
4683
4718
  static GetBufferFromAccessor(gltfRuntime: BABYLON.GLTF1.IGLTFRuntime, accessor: BABYLON.GLTF1.IGLTFAccessor): any;
4684
4719
  /**
4685
4720
  * Decodes a buffer view into a string
4686
4721
  * @param view the buffer view
4722
+ * @returns a string
4687
4723
  */
4688
4724
  static DecodeBufferToText(view: ArrayBufferView): string;
4689
4725
  /**
4690
4726
  * Returns the default material of gltf. Related to
4691
4727
  * https://github.com/KhronosGroup/glTF/tree/master/specification/1.0#appendix-a-default-material
4692
4728
  * @param scene the Babylon.js scene
4729
+ * @returns the default Babylon material
4693
4730
  */
4694
4731
  static GetDefaultMaterial(scene: Scene): ShaderMaterial;
4695
4732
  private static _DefaultMaterial;
@@ -4932,6 +4969,9 @@ declare module BABYLON.GLTF2.Loader.Extensions {
4932
4969
  * - "/materials/2/emissiveFactor"
4933
4970
  * - "/materials/2/pbrMetallicRoughness/baseColorFactor"
4934
4971
  * - "/materials/2/extensions/KHR_materials_emissive_strength/emissiveStrength"
4972
+ *
4973
+ * @param path The path to convert
4974
+ * @returns The object and info associated with the path
4935
4975
  */
4936
4976
  convert(path: string): IObjectInfo<T>;
4937
4977
  }
@@ -6102,7 +6142,7 @@ declare module BABYLON.GLTF2.Loader.Extensions {
6102
6142
  loadBufferAsync(context: string, buffer: BABYLON.GLTF2.Loader.IBuffer, byteOffset: number, byteLength: number): Nullable<Promise<ArrayBufferView>>;
6103
6143
  private _loadBufferLOD;
6104
6144
  /**
6105
- * Gets an array of LOD properties from lowest to highest.
6145
+ * @returns an array of LOD properties from lowest to highest.
6106
6146
  * @param context
6107
6147
  * @param property
6108
6148
  * @param array
@@ -6260,9 +6300,9 @@ declare module BABYLON.GLTF2 {
6260
6300
  */
6261
6301
  get babylonScene(): Scene;
6262
6302
  /**
6263
- * The root Babylon mesh when loading the asset.
6303
+ * The root Babylon node when loading the asset.
6264
6304
  */
6265
- get rootBabylonMesh(): Nullable<Mesh>;
6305
+ get rootBabylonMesh(): Nullable<TransformNode>;
6266
6306
  /**
6267
6307
  * The root url when loading the asset.
6268
6308
  */
@@ -7205,9 +7245,15 @@ declare module BABYLON {
7205
7245
  alwaysComputeSkeletonRootNode: boolean;
7206
7246
  /**
7207
7247
  * Function called before loading a url referenced by the asset.
7208
- * @param url
7248
+ * @param url url referenced by the asset
7249
+ * @returns Async url to load
7209
7250
  */
7210
7251
  preprocessUrlAsync: (url: string) => Promise<string>;
7252
+ /**
7253
+ * 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.
7254
+ * You can also pass null if you don't want a root node to be created.
7255
+ */
7256
+ customRootNode?: Nullable<TransformNode>;
7211
7257
  /**
7212
7258
  * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
7213
7259
  * 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, ...)
@@ -7858,11 +7904,13 @@ declare module BABYLON {
7858
7904
  * Code from https://github.com/dylanebert/gsplat.js/blob/main/src/loaders/PLYLoader.ts Under MIT license
7859
7905
  * Loads a .ply from data array buffer
7860
7906
  * if data array buffer is not ply, returns the original buffer
7907
+ * @param data the data to load
7908
+ * @returns the loaded buffer
7861
7909
  */
7862
7910
  private _loadPLY;
7863
7911
  /**
7864
7912
  * Imports from the loaded gaussian splatting data and adds them to the scene
7865
- * @param meshesNames a string or array of strings of the mesh names that should be loaded from the file
7913
+ * @param _meshesNames a string or array of strings of the mesh names that should be loaded from the file
7866
7914
  * @param scene the scene the meshes should be added to
7867
7915
  * @param data the gaussian splatting data to load
7868
7916
  * @param rootUrl root url to load from
@@ -7873,15 +7921,15 @@ declare module BABYLON {
7873
7921
  * Imports all objects from the loaded gaussian splatting data and adds them to the scene
7874
7922
  * @param scene the scene the objects should be added to
7875
7923
  * @param data the gaussian splatting data to load
7876
- * @param rootUrl root url to load from
7924
+ * @param _rootUrl root url to load from
7877
7925
  * @returns a promise which completes when objects have been loaded to the scene
7878
7926
  */
7879
7927
  loadAsync(scene: Scene, data: any, _rootUrl: string): Promise<void>;
7880
7928
  /**
7881
7929
  * Load into an asset container.
7882
- * @param scene The scene to load into
7883
- * @param data The data to import
7884
- * @param rootUrl The root url for scene and resources
7930
+ * @param _scene The scene to load into
7931
+ * @param _data The data to import
7932
+ * @param _rootUrl The root url for scene and resources
7885
7933
  * @returns The loaded asset container
7886
7934
  */
7887
7935
  loadAssetContainerAsync(_scene: Scene, _data: string, _rootUrl: string): Promise<AssetContainer>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "babylonjs-loaders",
3
- "version": "6.39.0",
3
+ "version": "6.40.0",
4
4
  "main": "babylonjs.loaders.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": "^6.39.0",
19
- "babylonjs-gltf2interface": "^6.39.0"
18
+ "babylonjs": "^6.40.0",
19
+ "babylonjs-gltf2interface": "^6.40.0"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@dev/build-tools": "1.0.0",