babylonjs-loaders 7.19.1 → 7.20.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.
- package/babylon.glTF1FileLoader.js +62 -39
- package/babylon.glTF1FileLoader.min.js +1 -1
- package/babylon.glTF1FileLoader.min.js.map +1 -1
- package/babylon.glTF2FileLoader.js +87 -46
- package/babylon.glTF2FileLoader.min.js +1 -1
- package/babylon.glTF2FileLoader.min.js.map +1 -1
- package/babylon.glTFFileLoader.js +87 -46
- package/babylon.glTFFileLoader.min.js +1 -1
- package/babylon.glTFFileLoader.min.js.map +1 -1
- package/babylon.objFileLoader.js +6 -2
- package/babylon.objFileLoader.min.js +1 -1
- package/babylon.objFileLoader.min.js.map +1 -1
- package/babylon.stlFileLoader.js +3 -2
- package/babylon.stlFileLoader.min.js.map +1 -1
- package/babylonjs.loaders.d.ts +120 -37
- package/babylonjs.loaders.js +97 -49
- package/babylonjs.loaders.min.js +1 -1
- package/babylonjs.loaders.min.js.map +1 -1
- package/babylonjs.loaders.module.d.ts +258 -76
- package/package.json +3 -3
|
@@ -54,7 +54,8 @@ import { Camera } from "babylonjs/Cameras/camera";
|
|
|
54
54
|
import { BaseTexture } from "babylonjs/Materials/Textures/baseTexture";
|
|
55
55
|
import { Material } from "babylonjs/Materials/material";
|
|
56
56
|
import { AbstractMesh } from "babylonjs/Meshes/abstractMesh";
|
|
57
|
-
import { ISceneLoaderPluginFactory, ISceneLoaderPluginAsync, ISceneLoaderProgressEvent,
|
|
57
|
+
import { ISceneLoaderPluginFactory, ISceneLoaderPluginAsync, ISceneLoaderProgressEvent, ISceneLoaderAsyncResult } from "babylonjs/Loading/sceneLoader";
|
|
58
|
+
import { SceneLoaderPluginOptions } from "babylonjs/Loading/sceneLoader";
|
|
58
59
|
import { AssetContainer } from "babylonjs/assetContainer";
|
|
59
60
|
import { Scene, IDisposable } from "babylonjs/scene";
|
|
60
61
|
import { WebRequest } from "babylonjs/Misc/webRequest";
|
|
@@ -62,6 +63,20 @@ import { IFileRequest } from "babylonjs/Misc/fileRequest";
|
|
|
62
63
|
import { IDataBuffer } from "babylonjs/Misc/dataReader";
|
|
63
64
|
import { LoadFileError } from "babylonjs/Misc/fileTools";
|
|
64
65
|
import { TransformNode } from "babylonjs/Meshes/transformNode";
|
|
66
|
+
const PLUGIN_GLTF = "gltf";
|
|
67
|
+
/**
|
|
68
|
+
* Defines options for glTF loader extensions. This interface is extended by specific extensions.
|
|
69
|
+
*/
|
|
70
|
+
export interface GLTFLoaderExtensionOptions extends Record<string, Record<string, unknown> | undefined> {
|
|
71
|
+
}
|
|
72
|
+
module "babylonjs/Loading/sceneLoader" {
|
|
73
|
+
interface SceneLoaderPluginOptions {
|
|
74
|
+
/**
|
|
75
|
+
* Defines options for the glTF loader.
|
|
76
|
+
*/
|
|
77
|
+
[PLUGIN_GLTF]?: Partial<GLTFLoaderOptions>;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
65
80
|
/**
|
|
66
81
|
* Mode that determines the coordinate system to use.
|
|
67
82
|
*/
|
|
@@ -146,35 +161,16 @@ export interface IGLTFLoader extends IDisposable {
|
|
|
146
161
|
loadAsync: (scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string) => Promise<void>;
|
|
147
162
|
}
|
|
148
163
|
/**
|
|
149
|
-
*
|
|
164
|
+
* Adds default/implicit options to extension specific options.
|
|
150
165
|
*/
|
|
151
|
-
|
|
152
|
-
/** @internal */
|
|
153
|
-
static _CreateGLTF1Loader: (parent: GLTFFileLoader) => IGLTFLoader;
|
|
154
|
-
/** @internal */
|
|
155
|
-
static _CreateGLTF2Loader: (parent: GLTFFileLoader) => IGLTFLoader;
|
|
166
|
+
type DefaultExtensionOptions<BaseExtensionOptions> = {
|
|
156
167
|
/**
|
|
157
|
-
*
|
|
168
|
+
* Defines if the extension is enabled
|
|
158
169
|
*/
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
*/
|
|
164
|
-
set onParsed(callback: (loaderData: IGLTFLoaderData) => void);
|
|
165
|
-
/**
|
|
166
|
-
* 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.
|
|
167
|
-
* Textures always loads asynchronously. For example, the success callback can compute the bounding information of the loaded meshes when incremental loading is disabled.
|
|
168
|
-
* Defaults to true.
|
|
169
|
-
* @internal
|
|
170
|
-
*/
|
|
171
|
-
static IncrementalLoading: boolean;
|
|
172
|
-
/**
|
|
173
|
-
* Set this property to true in order to work with homogeneous coordinates, available with some converters and exporters.
|
|
174
|
-
* Defaults to false. See https://en.wikipedia.org/wiki/Homogeneous_coordinates.
|
|
175
|
-
* @internal
|
|
176
|
-
*/
|
|
177
|
-
static HomogeneousCoordinates: boolean;
|
|
170
|
+
enabled?: boolean;
|
|
171
|
+
} & BaseExtensionOptions;
|
|
172
|
+
class GLTFLoaderOptions {
|
|
173
|
+
constructor(options?: Partial<Readonly<GLTFLoaderOptions>>);
|
|
178
174
|
/**
|
|
179
175
|
* The coordinate system mode. Defaults to AUTO.
|
|
180
176
|
*/
|
|
@@ -264,6 +260,45 @@ export class GLTFFileLoader implements IDisposable, ISceneLoaderPluginAsync, ISc
|
|
|
264
260
|
* You can also pass null if you don't want a root node to be created.
|
|
265
261
|
*/
|
|
266
262
|
customRootNode?: Nullable<TransformNode>;
|
|
263
|
+
/**
|
|
264
|
+
* Defines options for glTF extensions.
|
|
265
|
+
*/
|
|
266
|
+
extensionOptions: {
|
|
267
|
+
[Extension in keyof GLTFLoaderExtensionOptions]: {
|
|
268
|
+
[Option in keyof DefaultExtensionOptions<GLTFLoaderExtensionOptions[Extension]>]: DefaultExtensionOptions<GLTFLoaderExtensionOptions[Extension]>[Option];
|
|
269
|
+
};
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* File loader for loading glTF files into a scene.
|
|
274
|
+
*/
|
|
275
|
+
export class GLTFFileLoader extends GLTFLoaderOptions implements IDisposable, ISceneLoaderPluginAsync, ISceneLoaderPluginFactory {
|
|
276
|
+
/** @internal */
|
|
277
|
+
static _CreateGLTF1Loader: (parent: GLTFFileLoader) => IGLTFLoader;
|
|
278
|
+
/** @internal */
|
|
279
|
+
static _CreateGLTF2Loader: (parent: GLTFFileLoader) => IGLTFLoader;
|
|
280
|
+
/**
|
|
281
|
+
* Raised when the asset has been parsed
|
|
282
|
+
*/
|
|
283
|
+
onParsedObservable: Observable<IGLTFLoaderData>;
|
|
284
|
+
private _onParsedObserver;
|
|
285
|
+
/**
|
|
286
|
+
* Raised when the asset has been parsed
|
|
287
|
+
*/
|
|
288
|
+
set onParsed(callback: (loaderData: IGLTFLoaderData) => void);
|
|
289
|
+
/**
|
|
290
|
+
* 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.
|
|
291
|
+
* Textures always loads asynchronously. For example, the success callback can compute the bounding information of the loaded meshes when incremental loading is disabled.
|
|
292
|
+
* Defaults to true.
|
|
293
|
+
* @internal
|
|
294
|
+
*/
|
|
295
|
+
static IncrementalLoading: boolean;
|
|
296
|
+
/**
|
|
297
|
+
* Set this property to true in order to work with homogeneous coordinates, available with some converters and exporters.
|
|
298
|
+
* Defaults to false. See https://en.wikipedia.org/wiki/Homogeneous_coordinates.
|
|
299
|
+
* @internal
|
|
300
|
+
*/
|
|
301
|
+
static HomogeneousCoordinates: boolean;
|
|
267
302
|
/**
|
|
268
303
|
* Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
|
|
269
304
|
* 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, ...)
|
|
@@ -380,13 +415,20 @@ export class GLTFFileLoader implements IDisposable, ISceneLoaderPluginAsync, ISc
|
|
|
380
415
|
private _state;
|
|
381
416
|
private _progressCallback?;
|
|
382
417
|
private _requests;
|
|
383
|
-
private static _MagicBase64Encoded;
|
|
418
|
+
private static readonly _MagicBase64Encoded;
|
|
384
419
|
/**
|
|
385
420
|
* Name of the loader ("gltf")
|
|
386
421
|
*/
|
|
387
|
-
name: string;
|
|
422
|
+
readonly name: string;
|
|
388
423
|
/** @internal */
|
|
389
|
-
extensions:
|
|
424
|
+
readonly extensions: {
|
|
425
|
+
readonly ".gltf": {
|
|
426
|
+
readonly isBinary: false;
|
|
427
|
+
};
|
|
428
|
+
readonly ".glb": {
|
|
429
|
+
readonly isBinary: true;
|
|
430
|
+
};
|
|
431
|
+
};
|
|
390
432
|
/**
|
|
391
433
|
* Disposes the loader, releases resources during load, and cancels any outstanding requests.
|
|
392
434
|
*/
|
|
@@ -424,7 +466,7 @@ export class GLTFFileLoader implements IDisposable, ISceneLoaderPluginAsync, ISc
|
|
|
424
466
|
*/
|
|
425
467
|
rewriteRootURL?(rootUrl: string, responseURL?: string): string;
|
|
426
468
|
/** @internal */
|
|
427
|
-
createPlugin(): ISceneLoaderPluginAsync;
|
|
469
|
+
createPlugin(options: SceneLoaderPluginOptions): ISceneLoaderPluginAsync;
|
|
428
470
|
/**
|
|
429
471
|
* The loader state or null if the loader is not active.
|
|
430
472
|
*/
|
|
@@ -478,6 +520,7 @@ export class GLTFFileLoader implements IDisposable, ISceneLoaderPluginAsync, ISc
|
|
|
478
520
|
private _endPerformanceCounterEnabled;
|
|
479
521
|
private _endPerformanceCounterDisabled;
|
|
480
522
|
}
|
|
523
|
+
export {};
|
|
481
524
|
|
|
482
525
|
}
|
|
483
526
|
declare module "babylonjs-loaders/glTF/2.0/index" {
|
|
@@ -1535,6 +1578,20 @@ import { INode, IMaterial, IBuffer, IScene } from "babylonjs-loaders/glTF/2.0/gl
|
|
|
1535
1578
|
import { IGLTFLoaderExtension } from "babylonjs-loaders/glTF/2.0/glTFLoaderExtension";
|
|
1536
1579
|
import { GLTFLoader } from "babylonjs-loaders/glTF/2.0/glTFLoader";
|
|
1537
1580
|
import { IProperty } from "babylonjs-gltf2interface";
|
|
1581
|
+
const NAME = "MSFT_lod";
|
|
1582
|
+
module "babylonjs-loaders/glTF/glTFFileLoader" {
|
|
1583
|
+
interface GLTFLoaderExtensionOptions {
|
|
1584
|
+
/**
|
|
1585
|
+
* Defines options for the MSFT_lod extension.
|
|
1586
|
+
*/
|
|
1587
|
+
[NAME]?: Partial<{
|
|
1588
|
+
/**
|
|
1589
|
+
* Maximum number of LODs to load, starting from the lowest LOD.
|
|
1590
|
+
*/
|
|
1591
|
+
maxLODsToLoad: number;
|
|
1592
|
+
}>;
|
|
1593
|
+
}
|
|
1594
|
+
}
|
|
1538
1595
|
/**
|
|
1539
1596
|
* [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Vendor/MSFT_lod/README.md)
|
|
1540
1597
|
*/
|
|
@@ -1617,6 +1674,7 @@ export class MSFT_lod implements IGLTFLoaderExtension {
|
|
|
1617
1674
|
private _disposeTransformNode;
|
|
1618
1675
|
private _disposeMaterials;
|
|
1619
1676
|
}
|
|
1677
|
+
export {};
|
|
1620
1678
|
|
|
1621
1679
|
}
|
|
1622
1680
|
declare module "babylonjs-loaders/glTF/2.0/Extensions/MSFT_audio_emitter" {
|
|
@@ -3693,9 +3751,18 @@ export class GLTFBinaryExtension extends GLTFLoaderExtension {
|
|
|
3693
3751
|
declare module "babylonjs-loaders/STL/stlFileLoader" {
|
|
3694
3752
|
import { Nullable } from "babylonjs/types";
|
|
3695
3753
|
import { AbstractMesh } from "babylonjs/Meshes/abstractMesh";
|
|
3696
|
-
import { ISceneLoaderPlugin
|
|
3754
|
+
import { ISceneLoaderPlugin } from "babylonjs/Loading/sceneLoader";
|
|
3697
3755
|
import { AssetContainer } from "babylonjs/assetContainer";
|
|
3698
3756
|
import { Scene } from "babylonjs/scene";
|
|
3757
|
+
const PLUGIN_STL = "stl";
|
|
3758
|
+
module "babylonjs/Loading/sceneLoader" {
|
|
3759
|
+
interface SceneLoaderPluginOptions {
|
|
3760
|
+
/**
|
|
3761
|
+
* Defines options for the stl loader.
|
|
3762
|
+
*/
|
|
3763
|
+
[PLUGIN_STL]?: {};
|
|
3764
|
+
}
|
|
3765
|
+
}
|
|
3699
3766
|
/**
|
|
3700
3767
|
* STL file type loader.
|
|
3701
3768
|
* This is a babylon scene loader plugin.
|
|
@@ -3712,13 +3779,17 @@ export class STLFileLoader implements ISceneLoaderPlugin {
|
|
|
3712
3779
|
/**
|
|
3713
3780
|
* Defines the name of the plugin.
|
|
3714
3781
|
*/
|
|
3715
|
-
name: string;
|
|
3782
|
+
readonly name: string;
|
|
3716
3783
|
/**
|
|
3717
3784
|
* Defines the extensions the stl loader is able to load.
|
|
3718
3785
|
* force data to come in as an ArrayBuffer
|
|
3719
3786
|
* we'll convert to string if it looks like it's an ASCII .stl
|
|
3720
3787
|
*/
|
|
3721
|
-
extensions:
|
|
3788
|
+
readonly extensions: {
|
|
3789
|
+
readonly ".stl": {
|
|
3790
|
+
readonly isBinary: true;
|
|
3791
|
+
};
|
|
3792
|
+
};
|
|
3722
3793
|
/**
|
|
3723
3794
|
* Defines if Y and Z axes are swapped or not when loading an STL file.
|
|
3724
3795
|
* The default is false to maintain backward compatibility. When set to
|
|
@@ -3755,6 +3826,7 @@ export class STLFileLoader implements ISceneLoaderPlugin {
|
|
|
3755
3826
|
private _parseBinary;
|
|
3756
3827
|
private _parseASCII;
|
|
3757
3828
|
}
|
|
3829
|
+
export {};
|
|
3758
3830
|
|
|
3759
3831
|
}
|
|
3760
3832
|
declare module "babylonjs-loaders/STL/index" {
|
|
@@ -3762,9 +3834,18 @@ export * from "babylonjs-loaders/STL/stlFileLoader";
|
|
|
3762
3834
|
|
|
3763
3835
|
}
|
|
3764
3836
|
declare module "babylonjs-loaders/SPLAT/splatFileLoader" {
|
|
3765
|
-
import { ISceneLoaderPluginAsync, ISceneLoaderPluginFactory, ISceneLoaderPlugin, ISceneLoaderAsyncResult,
|
|
3837
|
+
import { ISceneLoaderPluginAsync, ISceneLoaderPluginFactory, ISceneLoaderPlugin, ISceneLoaderAsyncResult, ISceneLoaderProgressEvent } from "babylonjs/Loading/sceneLoader";
|
|
3766
3838
|
import { AssetContainer } from "babylonjs/assetContainer";
|
|
3767
3839
|
import { Scene } from "babylonjs/scene";
|
|
3840
|
+
const PLUGIN_SPLAT = "splat";
|
|
3841
|
+
module "babylonjs/Loading/sceneLoader" {
|
|
3842
|
+
interface SceneLoaderPluginOptions {
|
|
3843
|
+
/**
|
|
3844
|
+
* Defines options for the splat loader.
|
|
3845
|
+
*/
|
|
3846
|
+
[PLUGIN_SPLAT]?: {};
|
|
3847
|
+
}
|
|
3848
|
+
}
|
|
3768
3849
|
/**
|
|
3769
3850
|
* @experimental
|
|
3770
3851
|
* SPLAT file type loader.
|
|
@@ -3774,12 +3855,19 @@ export class SPLATFileLoader implements ISceneLoaderPluginAsync, ISceneLoaderPlu
|
|
|
3774
3855
|
/**
|
|
3775
3856
|
* Defines the name of the plugin.
|
|
3776
3857
|
*/
|
|
3777
|
-
name: string;
|
|
3858
|
+
readonly name: string;
|
|
3778
3859
|
/**
|
|
3779
3860
|
* Defines the extensions the splat loader is able to load.
|
|
3780
3861
|
* force data to come in as an ArrayBuffer
|
|
3781
3862
|
*/
|
|
3782
|
-
extensions:
|
|
3863
|
+
readonly extensions: {
|
|
3864
|
+
readonly ".splat": {
|
|
3865
|
+
readonly isBinary: true;
|
|
3866
|
+
};
|
|
3867
|
+
readonly ".ply": {
|
|
3868
|
+
readonly isBinary: true;
|
|
3869
|
+
};
|
|
3870
|
+
};
|
|
3783
3871
|
/**
|
|
3784
3872
|
* Creates loader for gaussian splatting files
|
|
3785
3873
|
*/
|
|
@@ -3822,6 +3910,7 @@ export class SPLATFileLoader implements ISceneLoaderPluginAsync, ISceneLoaderPlu
|
|
|
3822
3910
|
*/
|
|
3823
3911
|
loadAssetContainerAsync(_scene: Scene, _data: string, _rootUrl: string): Promise<AssetContainer>;
|
|
3824
3912
|
}
|
|
3913
|
+
export {};
|
|
3825
3914
|
|
|
3826
3915
|
}
|
|
3827
3916
|
declare module "babylonjs-loaders/SPLAT/index" {
|
|
@@ -4050,6 +4139,15 @@ import { ISceneLoaderPluginAsync, ISceneLoaderPluginFactory, ISceneLoaderPlugin,
|
|
|
4050
4139
|
import { AssetContainer } from "babylonjs/assetContainer";
|
|
4051
4140
|
import { Scene } from "babylonjs/scene";
|
|
4052
4141
|
import { OBJLoadingOptions } from "babylonjs-loaders/OBJ/objLoadingOptions";
|
|
4142
|
+
const PLUGIN_OBJ = "obj";
|
|
4143
|
+
module "babylonjs/Loading/sceneLoader" {
|
|
4144
|
+
interface SceneLoaderPluginOptions {
|
|
4145
|
+
/**
|
|
4146
|
+
* Defines options for the obj loader.
|
|
4147
|
+
*/
|
|
4148
|
+
[PLUGIN_OBJ]?: {};
|
|
4149
|
+
}
|
|
4150
|
+
}
|
|
4053
4151
|
/**
|
|
4054
4152
|
* OBJ file type loader.
|
|
4055
4153
|
* This is a babylon scene loader plugin.
|
|
@@ -4102,11 +4200,11 @@ export class OBJFileLoader implements ISceneLoaderPluginAsync, ISceneLoaderPlugi
|
|
|
4102
4200
|
/**
|
|
4103
4201
|
* Defines the name of the plugin.
|
|
4104
4202
|
*/
|
|
4105
|
-
name: string;
|
|
4203
|
+
readonly name: string;
|
|
4106
4204
|
/**
|
|
4107
4205
|
* Defines the extension the plugin is able to load.
|
|
4108
4206
|
*/
|
|
4109
|
-
extensions: string;
|
|
4207
|
+
readonly extensions: string;
|
|
4110
4208
|
private _assetContainer;
|
|
4111
4209
|
private _loadingOptions;
|
|
4112
4210
|
/**
|
|
@@ -4175,6 +4273,7 @@ export class OBJFileLoader implements ISceneLoaderPluginAsync, ISceneLoaderPlugi
|
|
|
4175
4273
|
*/
|
|
4176
4274
|
private _parseSolid;
|
|
4177
4275
|
}
|
|
4276
|
+
export {};
|
|
4178
4277
|
|
|
4179
4278
|
}
|
|
4180
4279
|
declare module "babylonjs-loaders/OBJ/mtlFileLoader" {
|
|
@@ -4317,6 +4416,18 @@ declare module BABYLON {
|
|
|
4317
4416
|
}
|
|
4318
4417
|
|
|
4319
4418
|
|
|
4419
|
+
const PLUGIN_GLTF = "gltf";
|
|
4420
|
+
/**
|
|
4421
|
+
* Defines options for glTF loader extensions. This interface is extended by specific extensions.
|
|
4422
|
+
*/
|
|
4423
|
+
export interface GLTFLoaderExtensionOptions extends Record<string, Record<string, unknown> | undefined> {
|
|
4424
|
+
}
|
|
4425
|
+
interface SceneLoaderPluginOptions {
|
|
4426
|
+
/**
|
|
4427
|
+
* Defines options for the glTF loader.
|
|
4428
|
+
*/
|
|
4429
|
+
[PLUGIN_GLTF]?: Partial<GLTFLoaderOptions>;
|
|
4430
|
+
}
|
|
4320
4431
|
/**
|
|
4321
4432
|
* Mode that determines the coordinate system to use.
|
|
4322
4433
|
*/
|
|
@@ -4401,35 +4512,16 @@ declare module BABYLON {
|
|
|
4401
4512
|
loadAsync: (scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string) => Promise<void>;
|
|
4402
4513
|
}
|
|
4403
4514
|
/**
|
|
4404
|
-
*
|
|
4515
|
+
* Adds default/implicit options to extension specific options.
|
|
4405
4516
|
*/
|
|
4406
|
-
|
|
4407
|
-
/** @internal */
|
|
4408
|
-
static _CreateGLTF1Loader: (parent: GLTFFileLoader) => IGLTFLoader;
|
|
4409
|
-
/** @internal */
|
|
4410
|
-
static _CreateGLTF2Loader: (parent: GLTFFileLoader) => IGLTFLoader;
|
|
4411
|
-
/**
|
|
4412
|
-
* Raised when the asset has been parsed
|
|
4413
|
-
*/
|
|
4414
|
-
onParsedObservable: Observable<IGLTFLoaderData>;
|
|
4415
|
-
private _onParsedObserver;
|
|
4416
|
-
/**
|
|
4417
|
-
* Raised when the asset has been parsed
|
|
4418
|
-
*/
|
|
4419
|
-
set onParsed(callback: (loaderData: IGLTFLoaderData) => void);
|
|
4420
|
-
/**
|
|
4421
|
-
* 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.
|
|
4422
|
-
* Textures always loads asynchronously. For example, the success callback can compute the bounding information of the loaded meshes when incremental loading is disabled.
|
|
4423
|
-
* Defaults to true.
|
|
4424
|
-
* @internal
|
|
4425
|
-
*/
|
|
4426
|
-
static IncrementalLoading: boolean;
|
|
4517
|
+
type DefaultExtensionOptions<BaseExtensionOptions> = {
|
|
4427
4518
|
/**
|
|
4428
|
-
*
|
|
4429
|
-
* Defaults to false. See https://en.wikipedia.org/wiki/Homogeneous_coordinates.
|
|
4430
|
-
* @internal
|
|
4519
|
+
* Defines if the extension is enabled
|
|
4431
4520
|
*/
|
|
4432
|
-
|
|
4521
|
+
enabled?: boolean;
|
|
4522
|
+
} & BaseExtensionOptions;
|
|
4523
|
+
class GLTFLoaderOptions {
|
|
4524
|
+
constructor(options?: Partial<Readonly<GLTFLoaderOptions>>);
|
|
4433
4525
|
/**
|
|
4434
4526
|
* The coordinate system mode. Defaults to AUTO.
|
|
4435
4527
|
*/
|
|
@@ -4519,6 +4611,45 @@ declare module BABYLON {
|
|
|
4519
4611
|
* You can also pass null if you don't want a root node to be created.
|
|
4520
4612
|
*/
|
|
4521
4613
|
customRootNode?: Nullable<TransformNode>;
|
|
4614
|
+
/**
|
|
4615
|
+
* Defines options for glTF extensions.
|
|
4616
|
+
*/
|
|
4617
|
+
extensionOptions: {
|
|
4618
|
+
[Extension in keyof GLTFLoaderExtensionOptions]: {
|
|
4619
|
+
[Option in keyof DefaultExtensionOptions<GLTFLoaderExtensionOptions[Extension]>]: DefaultExtensionOptions<GLTFLoaderExtensionOptions[Extension]>[Option];
|
|
4620
|
+
};
|
|
4621
|
+
};
|
|
4622
|
+
}
|
|
4623
|
+
/**
|
|
4624
|
+
* File loader for loading glTF files into a scene.
|
|
4625
|
+
*/
|
|
4626
|
+
export class GLTFFileLoader extends GLTFLoaderOptions implements IDisposable, ISceneLoaderPluginAsync, ISceneLoaderPluginFactory {
|
|
4627
|
+
/** @internal */
|
|
4628
|
+
static _CreateGLTF1Loader: (parent: GLTFFileLoader) => IGLTFLoader;
|
|
4629
|
+
/** @internal */
|
|
4630
|
+
static _CreateGLTF2Loader: (parent: GLTFFileLoader) => IGLTFLoader;
|
|
4631
|
+
/**
|
|
4632
|
+
* Raised when the asset has been parsed
|
|
4633
|
+
*/
|
|
4634
|
+
onParsedObservable: Observable<IGLTFLoaderData>;
|
|
4635
|
+
private _onParsedObserver;
|
|
4636
|
+
/**
|
|
4637
|
+
* Raised when the asset has been parsed
|
|
4638
|
+
*/
|
|
4639
|
+
set onParsed(callback: (loaderData: IGLTFLoaderData) => void);
|
|
4640
|
+
/**
|
|
4641
|
+
* 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.
|
|
4642
|
+
* Textures always loads asynchronously. For example, the success callback can compute the bounding information of the loaded meshes when incremental loading is disabled.
|
|
4643
|
+
* Defaults to true.
|
|
4644
|
+
* @internal
|
|
4645
|
+
*/
|
|
4646
|
+
static IncrementalLoading: boolean;
|
|
4647
|
+
/**
|
|
4648
|
+
* Set this property to true in order to work with homogeneous coordinates, available with some converters and exporters.
|
|
4649
|
+
* Defaults to false. See https://en.wikipedia.org/wiki/Homogeneous_coordinates.
|
|
4650
|
+
* @internal
|
|
4651
|
+
*/
|
|
4652
|
+
static HomogeneousCoordinates: boolean;
|
|
4522
4653
|
/**
|
|
4523
4654
|
* Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
|
|
4524
4655
|
* 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, ...)
|
|
@@ -4635,13 +4766,20 @@ declare module BABYLON {
|
|
|
4635
4766
|
private _state;
|
|
4636
4767
|
private _progressCallback?;
|
|
4637
4768
|
private _requests;
|
|
4638
|
-
private static _MagicBase64Encoded;
|
|
4769
|
+
private static readonly _MagicBase64Encoded;
|
|
4639
4770
|
/**
|
|
4640
4771
|
* Name of the loader ("gltf")
|
|
4641
4772
|
*/
|
|
4642
|
-
name
|
|
4773
|
+
readonly name = "gltf";
|
|
4643
4774
|
/** @internal */
|
|
4644
|
-
extensions:
|
|
4775
|
+
readonly extensions: {
|
|
4776
|
+
readonly ".gltf": {
|
|
4777
|
+
readonly isBinary: false;
|
|
4778
|
+
};
|
|
4779
|
+
readonly ".glb": {
|
|
4780
|
+
readonly isBinary: true;
|
|
4781
|
+
};
|
|
4782
|
+
};
|
|
4645
4783
|
/**
|
|
4646
4784
|
* Disposes the loader, releases resources during load, and cancels any outstanding requests.
|
|
4647
4785
|
*/
|
|
@@ -4679,7 +4817,7 @@ declare module BABYLON {
|
|
|
4679
4817
|
*/
|
|
4680
4818
|
rewriteRootURL?(rootUrl: string, responseURL?: string): string;
|
|
4681
4819
|
/** @internal */
|
|
4682
|
-
createPlugin(): ISceneLoaderPluginAsync;
|
|
4820
|
+
createPlugin(options: SceneLoaderPluginOptions): ISceneLoaderPluginAsync;
|
|
4683
4821
|
/**
|
|
4684
4822
|
* The loader state or null if the loader is not active.
|
|
4685
4823
|
*/
|
|
@@ -5737,7 +5875,19 @@ declare module BABYLON {
|
|
|
5737
5875
|
|
|
5738
5876
|
}
|
|
5739
5877
|
declare module BABYLON.GLTF2.Loader.Extensions {
|
|
5740
|
-
|
|
5878
|
+
const NAME = "MSFT_lod";
|
|
5879
|
+
interface GLTFLoaderExtensionOptions {
|
|
5880
|
+
/**
|
|
5881
|
+
* Defines options for the MSFT_lod extension.
|
|
5882
|
+
*/
|
|
5883
|
+
[NAME]?: Partial<{
|
|
5884
|
+
/**
|
|
5885
|
+
* Maximum number of LODs to load, starting from the lowest LOD.
|
|
5886
|
+
*/
|
|
5887
|
+
maxLODsToLoad: number;
|
|
5888
|
+
}>;
|
|
5889
|
+
}
|
|
5890
|
+
/**
|
|
5741
5891
|
* [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Vendor/MSFT_lod/README.md)
|
|
5742
5892
|
*/
|
|
5743
5893
|
export class MSFT_lod implements BABYLON.GLTF2.IGLTFLoaderExtension {
|
|
@@ -7892,6 +8042,13 @@ declare module BABYLON.GLTF1 {
|
|
|
7892
8042
|
|
|
7893
8043
|
}
|
|
7894
8044
|
declare module BABYLON {
|
|
8045
|
+
const PLUGIN_STL = "stl";
|
|
8046
|
+
interface SceneLoaderPluginOptions {
|
|
8047
|
+
/**
|
|
8048
|
+
* Defines options for the stl loader.
|
|
8049
|
+
*/
|
|
8050
|
+
[PLUGIN_STL]?: {};
|
|
8051
|
+
}
|
|
7895
8052
|
/**
|
|
7896
8053
|
* STL file type loader.
|
|
7897
8054
|
* This is a babylon scene loader plugin.
|
|
@@ -7908,13 +8065,17 @@ declare module BABYLON {
|
|
|
7908
8065
|
/**
|
|
7909
8066
|
* Defines the name of the plugin.
|
|
7910
8067
|
*/
|
|
7911
|
-
name
|
|
8068
|
+
readonly name = "stl";
|
|
7912
8069
|
/**
|
|
7913
8070
|
* Defines the extensions the stl loader is able to load.
|
|
7914
8071
|
* force data to come in as an ArrayBuffer
|
|
7915
8072
|
* we'll convert to string if it looks like it's an ASCII .stl
|
|
7916
8073
|
*/
|
|
7917
|
-
extensions:
|
|
8074
|
+
readonly extensions: {
|
|
8075
|
+
readonly ".stl": {
|
|
8076
|
+
readonly isBinary: true;
|
|
8077
|
+
};
|
|
8078
|
+
};
|
|
7918
8079
|
/**
|
|
7919
8080
|
* Defines if Y and Z axes are swapped or not when loading an STL file.
|
|
7920
8081
|
* The default is false to maintain backward compatibility. When set to
|
|
@@ -7955,6 +8116,13 @@ declare module BABYLON {
|
|
|
7955
8116
|
|
|
7956
8117
|
|
|
7957
8118
|
|
|
8119
|
+
const PLUGIN_SPLAT = "splat";
|
|
8120
|
+
interface SceneLoaderPluginOptions {
|
|
8121
|
+
/**
|
|
8122
|
+
* Defines options for the splat loader.
|
|
8123
|
+
*/
|
|
8124
|
+
[PLUGIN_SPLAT]?: {};
|
|
8125
|
+
}
|
|
7958
8126
|
/**
|
|
7959
8127
|
* @experimental
|
|
7960
8128
|
* SPLAT file type loader.
|
|
@@ -7964,12 +8132,19 @@ declare module BABYLON {
|
|
|
7964
8132
|
/**
|
|
7965
8133
|
* Defines the name of the plugin.
|
|
7966
8134
|
*/
|
|
7967
|
-
name
|
|
8135
|
+
readonly name = "splat";
|
|
7968
8136
|
/**
|
|
7969
8137
|
* Defines the extensions the splat loader is able to load.
|
|
7970
8138
|
* force data to come in as an ArrayBuffer
|
|
7971
8139
|
*/
|
|
7972
|
-
extensions:
|
|
8140
|
+
readonly extensions: {
|
|
8141
|
+
readonly ".splat": {
|
|
8142
|
+
readonly isBinary: true;
|
|
8143
|
+
};
|
|
8144
|
+
readonly ".ply": {
|
|
8145
|
+
readonly isBinary: true;
|
|
8146
|
+
};
|
|
8147
|
+
};
|
|
7973
8148
|
/**
|
|
7974
8149
|
* Creates loader for gaussian splatting files
|
|
7975
8150
|
*/
|
|
@@ -8224,6 +8399,13 @@ declare module BABYLON {
|
|
|
8224
8399
|
};
|
|
8225
8400
|
|
|
8226
8401
|
|
|
8402
|
+
const PLUGIN_OBJ = "obj";
|
|
8403
|
+
interface SceneLoaderPluginOptions {
|
|
8404
|
+
/**
|
|
8405
|
+
* Defines options for the obj loader.
|
|
8406
|
+
*/
|
|
8407
|
+
[PLUGIN_OBJ]?: {};
|
|
8408
|
+
}
|
|
8227
8409
|
/**
|
|
8228
8410
|
* OBJ file type loader.
|
|
8229
8411
|
* This is a babylon scene loader plugin.
|
|
@@ -8276,11 +8458,11 @@ declare module BABYLON {
|
|
|
8276
8458
|
/**
|
|
8277
8459
|
* Defines the name of the plugin.
|
|
8278
8460
|
*/
|
|
8279
|
-
name
|
|
8461
|
+
readonly name = "obj";
|
|
8280
8462
|
/**
|
|
8281
8463
|
* Defines the extension the plugin is able to load.
|
|
8282
8464
|
*/
|
|
8283
|
-
extensions
|
|
8465
|
+
readonly extensions = ".obj";
|
|
8284
8466
|
private _assetContainer;
|
|
8285
8467
|
private _loadingOptions;
|
|
8286
8468
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "babylonjs-loaders",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.20.1",
|
|
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": "^7.
|
|
19
|
-
"babylonjs-gltf2interface": "^7.
|
|
18
|
+
"babylonjs": "^7.20.1",
|
|
19
|
+
"babylonjs-gltf2interface": "^7.20.1"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@dev/build-tools": "1.0.0",
|