babylonjs-loaders 7.22.5 → 7.23.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.
@@ -5,6 +5,14 @@ export * from "babylonjs-loaders/OBJ/index";
5
5
  export * from "babylonjs-loaders/STL/index";
6
6
  export * from "babylonjs-loaders/SPLAT/index";
7
7
 
8
+ }
9
+ declare module "babylonjs-loaders/dynamic" {
10
+ /**
11
+ * Registers the async plugin factories for all built-in loaders.
12
+ * Loaders will be dynamically imported on demand, only when a SceneLoader load operation needs each respective loader.
13
+ */
14
+ export function registerBuiltInLoaders(): void;
15
+
8
16
  }
9
17
  declare module "babylonjs-loaders/glTF/index" {
10
18
  export * from "babylonjs-loaders/glTF/glTFFileLoader";
@@ -45,6 +53,22 @@ export class GLTFValidation {
45
53
  static ValidateAsync(data: string | Uint8Array, rootUrl: string, fileName: string, getExternalResource: (uri: string) => Promise<Uint8Array>): Promise<GLTF2.IGLTFValidationResults>;
46
54
  }
47
55
 
56
+ }
57
+ declare module "babylonjs-loaders/glTF/glTFFileLoader.metadata" {
58
+ export const GLTFMagicBase64Encoded = "Z2xURg";
59
+ export const GLTFFileLoaderMetadata: {
60
+ readonly name: "gltf";
61
+ readonly extensions: {
62
+ readonly ".gltf": {
63
+ readonly isBinary: false;
64
+ };
65
+ readonly ".glb": {
66
+ readonly isBinary: true;
67
+ };
68
+ };
69
+ readonly canDirectLoad: (data: string) => boolean;
70
+ };
71
+
48
72
  }
49
73
  declare module "babylonjs-loaders/glTF/glTFFileLoader" {
50
74
  import * as GLTF2 from "babylonjs-gltf2interface";
@@ -54,16 +78,15 @@ import { Camera } from "babylonjs/Cameras/camera";
54
78
  import { BaseTexture } from "babylonjs/Materials/Textures/baseTexture";
55
79
  import { Material } from "babylonjs/Materials/material";
56
80
  import { AbstractMesh } from "babylonjs/Meshes/abstractMesh";
57
- import { ISceneLoaderPluginFactory, ISceneLoaderPluginAsync, ISceneLoaderProgressEvent, ISceneLoaderAsyncResult } from "babylonjs/Loading/sceneLoader";
58
- import { SceneLoaderPluginOptions } from "babylonjs/Loading/sceneLoader";
81
+ import { ISceneLoaderPluginFactory, ISceneLoaderPluginAsync, ISceneLoaderProgressEvent, ISceneLoaderAsyncResult, SceneLoaderPluginOptions } from "babylonjs/Loading/sceneLoader";
59
82
  import { AssetContainer } from "babylonjs/assetContainer";
60
83
  import { Scene, IDisposable } from "babylonjs/scene";
61
84
  import { WebRequest } from "babylonjs/Misc/webRequest";
62
85
  import { IFileRequest } from "babylonjs/Misc/fileRequest";
63
86
  import { IDataBuffer } from "babylonjs/Misc/dataReader";
87
+ import { GLTFFileLoaderMetadata } from "babylonjs-loaders/glTF/glTFFileLoader.metadata";
64
88
  import { LoadFileError } from "babylonjs/Misc/fileTools";
65
89
  import { TransformNode } from "babylonjs/Meshes/transformNode";
66
- const PLUGIN_GLTF = "gltf";
67
90
  /**
68
91
  * Defines options for glTF loader extensions. This interface is extended by specific extensions.
69
92
  */
@@ -74,7 +97,7 @@ module "babylonjs/Loading/sceneLoader" {
74
97
  /**
75
98
  * Defines options for the glTF loader.
76
99
  */
77
- [PLUGIN_GLTF]: Partial<GLTFLoaderOptions>;
100
+ [GLTFFileLoaderMetadata.name]: Partial<GLTFLoaderOptions>;
78
101
  }
79
102
  }
80
103
  /**
@@ -452,11 +475,10 @@ export class GLTFFileLoader extends GLTFLoaderOptions implements IDisposable, IS
452
475
  private _state;
453
476
  private _progressCallback?;
454
477
  private _requests;
455
- private static readonly _MagicBase64Encoded;
456
478
  /**
457
479
  * Name of the loader ("gltf")
458
480
  */
459
- readonly name: string;
481
+ readonly name: "gltf";
460
482
  /** @internal */
461
483
  readonly extensions: {
462
484
  readonly ".gltf": {
@@ -820,6 +842,34 @@ export interface IKHRLightsPunctual_Light extends GLTF2.IKHRLightsPunctual_Light
820
842
  _babylonLight?: Light;
821
843
  }
822
844
 
845
+ }
846
+ declare module "babylonjs-loaders/glTF/2.0/glTFLoaderExtensionRegistry" {
847
+ import { GLTFLoader } from "babylonjs-loaders/glTF/2.0/glTFLoader";
848
+ import { IGLTFLoaderExtension } from "babylonjs-loaders/glTF/2.0/glTFLoaderExtension";
849
+ interface IRegisteredGLTFExtension {
850
+ isGLTFExtension: boolean;
851
+ factory: GLTFExtensionFactory;
852
+ }
853
+ export type GLTFExtensionFactory = (loader: GLTFLoader) => IGLTFLoaderExtension | Promise<IGLTFLoaderExtension>;
854
+ /**
855
+ * All currently registered glTF 2.0 loader extensions.
856
+ */
857
+ export const registeredGLTFExtensions: ReadonlyMap<string, Readonly<IRegisteredGLTFExtension>>;
858
+ /**
859
+ * Registers a loader extension.
860
+ * @param name The name of the loader extension.
861
+ * @param isGLTFExtension If the loader extension is a glTF extension, then it will only be used for glTF files that use the corresponding glTF extension. Otherwise, it will be used for all loaded glTF files.
862
+ * @param factory The factory function that creates the loader extension.
863
+ */
864
+ export function registerGLTFExtension(name: string, isGLTFExtension: boolean, factory: GLTFExtensionFactory): void;
865
+ /**
866
+ * Unregisters a loader extension.
867
+ * @param name The name of the loader extension.
868
+ * @returns A boolean indicating whether the extension has been unregistered
869
+ */
870
+ export function unregisterGLTFExtension(name: string): boolean;
871
+ export {};
872
+
823
873
  }
824
874
  declare module "babylonjs-loaders/glTF/2.0/glTFLoaderExtension" {
825
875
  import { Nullable } from "babylonjs/types";
@@ -1048,7 +1098,6 @@ import { ISceneLoaderAsyncResult, ISceneLoaderProgressEvent } from "babylonjs/Lo
1048
1098
  import { Scene } from "babylonjs/scene";
1049
1099
  import { IProperty } from "babylonjs-gltf2interface";
1050
1100
  import { IGLTF, ISampler, INode, IScene, IMesh, IAccessor, ICamera, IAnimation, IBuffer, IBufferView, IMaterial, ITextureInfo, ITexture, IImage, IMeshPrimitive, IArrayItem, IAnimationChannel } from "babylonjs-loaders/glTF/2.0/glTFLoaderInterfaces";
1051
- import { IGLTFLoaderExtension } from "babylonjs-loaders/glTF/2.0/glTFLoaderExtension";
1052
1101
  import { IGLTFLoader, IGLTFLoaderData } from "babylonjs-loaders/glTF/glTFFileLoader";
1053
1102
  import { GLTFFileLoader } from "babylonjs-loaders/glTF/glTFFileLoader";
1054
1103
  import { IDataBuffer } from "babylonjs/Misc/dataReader";
@@ -1056,6 +1105,8 @@ import { Light } from "babylonjs/Lights/light";
1056
1105
  import { AssetContainer } from "babylonjs/assetContainer";
1057
1106
  import { AnimationPropertyInfo } from "babylonjs-loaders/glTF/2.0/glTFLoaderAnimation";
1058
1107
  import { IObjectInfo } from "babylonjs/ObjectModel/objectModelInterfaces";
1108
+ import { GLTFExtensionFactory } from "babylonjs-loaders/glTF/2.0/glTFLoaderExtensionRegistry";
1109
+ export { GLTFFileLoader };
1059
1110
  interface IWithMetadata {
1060
1111
  metadata: any;
1061
1112
  _internalMetadata: any;
@@ -1118,7 +1169,6 @@ export class GLTFLoader implements IGLTFLoader {
1118
1169
  private _rootBabylonMesh;
1119
1170
  private _defaultBabylonMaterialData;
1120
1171
  private readonly _postSceneLoadActions;
1121
- private static _RegisteredExtensions;
1122
1172
  /**
1123
1173
  * The default glTF sampler.
1124
1174
  */
@@ -1127,12 +1177,14 @@ export class GLTFLoader implements IGLTFLoader {
1127
1177
  * Registers a loader extension.
1128
1178
  * @param name The name of the loader extension.
1129
1179
  * @param factory The factory function that creates the loader extension.
1180
+ * @deprecated Please use registerGLTFExtension instead.
1130
1181
  */
1131
- static RegisterExtension(name: string, factory: (loader: GLTFLoader) => IGLTFLoaderExtension): void;
1182
+ static RegisterExtension(name: string, factory: GLTFExtensionFactory): void;
1132
1183
  /**
1133
1184
  * Unregisters a loader extension.
1134
1185
  * @param name The name of the loader extension.
1135
1186
  * @returns A boolean indicating whether the extension has been unregistered
1187
+ * @deprecated Please use unregisterGLTFExtension instead.
1136
1188
  */
1137
1189
  static UnregisterExtension(name: string): boolean;
1138
1190
  /**
@@ -1176,8 +1228,7 @@ export class GLTFLoader implements IGLTFLoader {
1176
1228
  private _loadAsync;
1177
1229
  private _loadData;
1178
1230
  private _setupData;
1179
- private _loadExtensions;
1180
- private _checkExtensions;
1231
+ private _loadExtensionsAsync;
1181
1232
  private _createRootNode;
1182
1233
  /**
1183
1234
  * Loads a glTF scene.
@@ -1455,7 +1506,6 @@ export class GLTFLoader implements IGLTFLoader {
1455
1506
  */
1456
1507
  endPerformanceCounter(counterName: string): void;
1457
1508
  }
1458
- export {};
1459
1509
 
1460
1510
  }
1461
1511
  declare module "babylonjs-loaders/glTF/2.0/Extensions/interactivityUtils" {
@@ -1560,6 +1610,13 @@ export class GLTFPathToObjectConverter<T> implements IPathToObjectConverter<T> {
1560
1610
  convert(path: string): IObjectInfo<T>;
1561
1611
  }
1562
1612
 
1613
+ }
1614
+ declare module "babylonjs-loaders/glTF/2.0/Extensions/dynamic" {
1615
+ /**
1616
+ * Registers the built-in glTF 2.0 extension async factories, which dynamically imports and loads each glTF extension on demand (e.g. only when a glTF model uses the extension).
1617
+ */
1618
+ export function registerBuiltInGLTFExtensions(): void;
1619
+
1563
1620
  }
1564
1621
  declare module "babylonjs-loaders/glTF/2.0/Extensions/MSFT_sRGBFactors" {
1565
1622
  import { Nullable } from "babylonjs/types";
@@ -4030,6 +4087,17 @@ export class GLTFBinaryExtension extends GLTFLoaderExtension {
4030
4087
  loadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderString: string) => void): boolean;
4031
4088
  }
4032
4089
 
4090
+ }
4091
+ declare module "babylonjs-loaders/STL/stlFileLoader.metadata" {
4092
+ export const STLFileLoaderMetadata: {
4093
+ readonly name: "stl";
4094
+ readonly extensions: {
4095
+ readonly ".stl": {
4096
+ readonly isBinary: true;
4097
+ };
4098
+ };
4099
+ };
4100
+
4033
4101
  }
4034
4102
  declare module "babylonjs-loaders/STL/stlFileLoader" {
4035
4103
  import { Nullable } from "babylonjs/types";
@@ -4037,13 +4105,13 @@ import { AbstractMesh } from "babylonjs/Meshes/abstractMesh";
4037
4105
  import { ISceneLoaderPlugin } from "babylonjs/Loading/sceneLoader";
4038
4106
  import { AssetContainer } from "babylonjs/assetContainer";
4039
4107
  import { Scene } from "babylonjs/scene";
4040
- const PLUGIN_STL = "stl";
4108
+ import { STLFileLoaderMetadata } from "babylonjs-loaders/STL/stlFileLoader.metadata";
4041
4109
  module "babylonjs/Loading/sceneLoader" {
4042
4110
  interface SceneLoaderPluginOptions {
4043
4111
  /**
4044
4112
  * Defines options for the stl loader.
4045
4113
  */
4046
- [PLUGIN_STL]: {};
4114
+ [STLFileLoaderMetadata.name]: {};
4047
4115
  }
4048
4116
  }
4049
4117
  /**
@@ -4062,7 +4130,7 @@ export class STLFileLoader implements ISceneLoaderPlugin {
4062
4130
  /**
4063
4131
  * Defines the name of the plugin.
4064
4132
  */
4065
- readonly name: string;
4133
+ readonly name: "stl";
4066
4134
  /**
4067
4135
  * Defines the extensions the stl loader is able to load.
4068
4136
  * force data to come in as an ArrayBuffer
@@ -4109,24 +4177,50 @@ export class STLFileLoader implements ISceneLoaderPlugin {
4109
4177
  private _parseBinary;
4110
4178
  private _parseASCII;
4111
4179
  }
4112
- export {};
4113
4180
 
4114
4181
  }
4115
4182
  declare module "babylonjs-loaders/STL/index" {
4116
4183
  export * from "babylonjs-loaders/STL/stlFileLoader";
4117
4184
 
4185
+ }
4186
+ declare module "babylonjs-loaders/SPLAT/splatLoadingOptions" {
4187
+ /**
4188
+ * Options for loading Gaussian Splatting and PLY files
4189
+ */
4190
+ export type SPLATLoadingOptions = {
4191
+ /**
4192
+ * Defines if buffers should be kept in memory for editing purposes
4193
+ */
4194
+ keepInRam?: boolean;
4195
+ };
4196
+
4197
+ }
4198
+ declare module "babylonjs-loaders/SPLAT/splatFileLoader.metadata" {
4199
+ export const SPLATFileLoaderMetadata: {
4200
+ readonly name: "splat";
4201
+ readonly extensions: {
4202
+ readonly ".splat": {
4203
+ readonly isBinary: true;
4204
+ };
4205
+ readonly ".ply": {
4206
+ readonly isBinary: true;
4207
+ };
4208
+ };
4209
+ };
4210
+
4118
4211
  }
4119
4212
  declare module "babylonjs-loaders/SPLAT/splatFileLoader" {
4120
- import { ISceneLoaderPluginAsync, ISceneLoaderPluginFactory, ISceneLoaderPlugin, ISceneLoaderAsyncResult, ISceneLoaderProgressEvent } from "babylonjs/Loading/sceneLoader";
4213
+ import { ISceneLoaderPluginAsync, ISceneLoaderPluginFactory, ISceneLoaderAsyncResult, ISceneLoaderProgressEvent, SceneLoaderPluginOptions } from "babylonjs/Loading/sceneLoader";
4214
+ import { SPLATFileLoaderMetadata } from "babylonjs-loaders/SPLAT/splatFileLoader.metadata";
4121
4215
  import { AssetContainer } from "babylonjs/assetContainer";
4122
4216
  import { Scene } from "babylonjs/scene";
4123
- const PLUGIN_SPLAT = "splat";
4217
+ import { SPLATLoadingOptions } from "babylonjs-loaders/SPLAT/splatLoadingOptions";
4124
4218
  module "babylonjs/Loading/sceneLoader" {
4125
4219
  interface SceneLoaderPluginOptions {
4126
4220
  /**
4127
4221
  * Defines options for the splat loader.
4128
4222
  */
4129
- [PLUGIN_SPLAT]: {};
4223
+ [SPLATFileLoaderMetadata.name]: Partial<SPLATLoadingOptions>;
4130
4224
  }
4131
4225
  }
4132
4226
  /**
@@ -4138,7 +4232,9 @@ export class SPLATFileLoader implements ISceneLoaderPluginAsync, ISceneLoaderPlu
4138
4232
  /**
4139
4233
  * Defines the name of the plugin.
4140
4234
  */
4141
- readonly name: string;
4235
+ readonly name: "splat";
4236
+ private _assetContainer;
4237
+ private readonly _loadingOptions;
4142
4238
  /**
4143
4239
  * Defines the extensions the splat loader is able to load.
4144
4240
  * force data to come in as an ArrayBuffer
@@ -4153,21 +4249,15 @@ export class SPLATFileLoader implements ISceneLoaderPluginAsync, ISceneLoaderPlu
4153
4249
  };
4154
4250
  /**
4155
4251
  * Creates loader for gaussian splatting files
4252
+ * @param loadingOptions options for loading and parsing splat and PLY files.
4156
4253
  */
4157
- constructor();
4158
- /**
4159
- * Instantiates a gaussian splatting file loader plugin.
4160
- * @returns the created plugin
4161
- */
4162
- createPlugin(): ISceneLoaderPluginAsync | ISceneLoaderPlugin;
4163
- /**
4164
- * If the data string can be loaded directly.
4165
- * @returns if the data can be loaded directly
4166
- */
4167
- canDirectLoad(): boolean;
4254
+ constructor(loadingOptions?: Partial<Readonly<SPLATLoadingOptions>>);
4255
+ private static readonly _DefaultLoadingOptions;
4256
+ /** @internal */
4257
+ createPlugin(options: SceneLoaderPluginOptions): ISceneLoaderPluginAsync;
4168
4258
  /**
4169
4259
  * Imports from the loaded gaussian splatting data and adds them to the scene
4170
- * @param _meshesNames a string or array of strings of the mesh names that should be loaded from the file
4260
+ * @param meshesNames a string or array of strings of the mesh names that should be loaded from the file
4171
4261
  * @param scene the scene the meshes should be added to
4172
4262
  * @param data the gaussian splatting data to load
4173
4263
  * @param rootUrl root url to load from
@@ -4175,28 +4265,39 @@ export class SPLATFileLoader implements ISceneLoaderPluginAsync, ISceneLoaderPlu
4175
4265
  * @param fileName Defines the name of the file to load
4176
4266
  * @returns a promise containing the loaded meshes, particles, skeletons and animations
4177
4267
  */
4178
- importMeshAsync(_meshesNames: any, scene: Scene, data: any, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<ISceneLoaderAsyncResult>;
4268
+ importMeshAsync(meshesNames: any, scene: Scene, data: any, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<ISceneLoaderAsyncResult>;
4269
+ private static _BuildPointCloud;
4270
+ private static _BuildMesh;
4271
+ private _parse;
4179
4272
  /**
4180
- * Imports all objects from the loaded gaussian splatting data and adds them to the scene
4273
+ * Load into an asset container.
4274
+ * @param scene The scene to load into
4275
+ * @param data The data to import
4276
+ * @param rootUrl The root url for scene and resources
4277
+ * @returns The loaded asset container
4278
+ */
4279
+ loadAssetContainerAsync(scene: Scene, data: string, rootUrl: string): Promise<AssetContainer>;
4280
+ /**
4281
+ * Imports all objects from the loaded OBJ data and adds them to the scene
4181
4282
  * @param scene the scene the objects should be added to
4182
- * @param data the gaussian splatting data to load
4183
- * @param _rootUrl root url to load from
4283
+ * @param data the OBJ data to load
4284
+ * @param rootUrl root url to load from
4184
4285
  * @returns a promise which completes when objects have been loaded to the scene
4185
4286
  */
4186
- loadAsync(scene: Scene, data: any, _rootUrl: string): Promise<void>;
4287
+ loadAsync(scene: Scene, data: string, rootUrl: string): Promise<void>;
4187
4288
  /**
4188
- * Load into an asset container.
4189
- * @param _scene The scene to load into
4190
- * @param _data The data to import
4191
- * @param _rootUrl The root url for scene and resources
4192
- * @returns The loaded asset container
4289
+ * Code from https://github.com/dylanebert/gsplat.js/blob/main/src/loaders/PLYLoader.ts Under MIT license
4290
+ * Converts a .ply data array buffer to splat
4291
+ * if data array buffer is not ply, returns the original buffer
4292
+ * @param data the .ply data to load
4293
+ * @returns the loaded splat buffer
4193
4294
  */
4194
- loadAssetContainerAsync(_scene: Scene, _data: string, _rootUrl: string): Promise<AssetContainer>;
4295
+ private static _ConvertPLYToSplat;
4195
4296
  }
4196
- export {};
4197
4297
 
4198
4298
  }
4199
4299
  declare module "babylonjs-loaders/SPLAT/index" {
4300
+ export * from "babylonjs-loaders/SPLAT/splatLoadingOptions";
4200
4301
  export * from "babylonjs-loaders/SPLAT/splatFileLoader";
4201
4302
 
4202
4303
  }
@@ -4418,20 +4519,27 @@ export type OBJLoadingOptions = {
4418
4519
  useLegacyBehavior: boolean;
4419
4520
  };
4420
4521
 
4522
+ }
4523
+ declare module "babylonjs-loaders/OBJ/objFileLoader.metadata" {
4524
+ export const OBJFileLoaderMetadata: {
4525
+ readonly name: "obj";
4526
+ readonly extensions: ".obj";
4527
+ };
4528
+
4421
4529
  }
4422
4530
  declare module "babylonjs-loaders/OBJ/objFileLoader" {
4423
4531
  import { Vector2 } from "babylonjs/Maths/math.vector";
4424
4532
  import { ISceneLoaderPluginAsync, ISceneLoaderPluginFactory, ISceneLoaderPlugin, ISceneLoaderAsyncResult } from "babylonjs/Loading/sceneLoader";
4425
4533
  import { AssetContainer } from "babylonjs/assetContainer";
4426
4534
  import { Scene } from "babylonjs/scene";
4535
+ import { OBJFileLoaderMetadata } from "babylonjs-loaders/OBJ/objFileLoader.metadata";
4427
4536
  import { OBJLoadingOptions } from "babylonjs-loaders/OBJ/objLoadingOptions";
4428
- const PLUGIN_OBJ = "obj";
4429
4537
  module "babylonjs/Loading/sceneLoader" {
4430
4538
  interface SceneLoaderPluginOptions {
4431
4539
  /**
4432
4540
  * Defines options for the obj loader.
4433
4541
  */
4434
- [PLUGIN_OBJ]: {};
4542
+ [OBJFileLoaderMetadata.name]: {};
4435
4543
  }
4436
4544
  }
4437
4545
  /**
@@ -4486,11 +4594,11 @@ export class OBJFileLoader implements ISceneLoaderPluginAsync, ISceneLoaderPlugi
4486
4594
  /**
4487
4595
  * Defines the name of the plugin.
4488
4596
  */
4489
- readonly name: string;
4597
+ readonly name: "obj";
4490
4598
  /**
4491
4599
  * Defines the extension the plugin is able to load.
4492
4600
  */
4493
- readonly extensions: string;
4601
+ readonly extensions: ".obj";
4494
4602
  private _assetContainer;
4495
4603
  private _loadingOptions;
4496
4604
  /**
@@ -4559,7 +4667,6 @@ export class OBJFileLoader implements ISceneLoaderPluginAsync, ISceneLoaderPlugi
4559
4667
  */
4560
4668
  private _parseSolid;
4561
4669
  }
4562
- export {};
4563
4670
 
4564
4671
  }
4565
4672
  declare module "babylonjs-loaders/OBJ/mtlFileLoader" {
@@ -4670,6 +4777,13 @@ declare module "babylonjs-loaders" {
4670
4777
  declare module BABYLON {
4671
4778
 
4672
4779
 
4780
+ /**
4781
+ * Registers the async plugin factories for all built-in loaders.
4782
+ * Loaders will be dynamically imported on demand, only when a SceneLoader load operation needs each respective loader.
4783
+ */
4784
+ export function registerBuiltInLoaders(): void;
4785
+
4786
+
4673
4787
 
4674
4788
 
4675
4789
  /**
@@ -4702,7 +4816,21 @@ declare module BABYLON {
4702
4816
  }
4703
4817
 
4704
4818
 
4705
- const PLUGIN_GLTF = "gltf";
4819
+ export const GLTFMagicBase64Encoded = "Z2xURg";
4820
+ export var GLTFFileLoaderMetadata: {
4821
+ readonly name: "gltf";
4822
+ readonly extensions: {
4823
+ readonly ".gltf": {
4824
+ readonly isBinary: false;
4825
+ };
4826
+ readonly ".glb": {
4827
+ readonly isBinary: true;
4828
+ };
4829
+ };
4830
+ readonly canDirectLoad: (data: string) => boolean;
4831
+ };
4832
+
4833
+
4706
4834
  /**
4707
4835
  * Defines options for glTF loader extensions. This interface is extended by specific extensions.
4708
4836
  */
@@ -4712,7 +4840,7 @@ declare module BABYLON {
4712
4840
  /**
4713
4841
  * Defines options for the glTF loader.
4714
4842
  */
4715
- [PLUGIN_GLTF]: Partial<GLTFLoaderOptions>;
4843
+ [GLTFFileLoaderMetadata.name]: Partial<GLTFLoaderOptions>;
4716
4844
  }
4717
4845
  /**
4718
4846
  * Mode that determines the coordinate system to use.
@@ -5089,11 +5217,10 @@ declare module BABYLON {
5089
5217
  private _state;
5090
5218
  private _progressCallback?;
5091
5219
  private _requests;
5092
- private static readonly _MagicBase64Encoded;
5093
5220
  /**
5094
5221
  * Name of the loader ("gltf")
5095
5222
  */
5096
- readonly name = "gltf";
5223
+ readonly name: "gltf";
5097
5224
  /** @internal */
5098
5225
  readonly extensions: {
5099
5226
  readonly ".gltf": {
@@ -5452,6 +5579,37 @@ declare module BABYLON.GLTF2.Loader {
5452
5579
 
5453
5580
 
5454
5581
 
5582
+ }
5583
+ declare module BABYLON {
5584
+
5585
+
5586
+ }
5587
+ declare module BABYLON.GLTF2 {
5588
+ interface IRegisteredGLTFExtension {
5589
+ isGLTFExtension: boolean;
5590
+ factory: GLTFExtensionFactory;
5591
+ }
5592
+ export type GLTFExtensionFactory = (loader: BABYLON.GLTF2.GLTFLoader) => BABYLON.GLTF2.IGLTFLoaderExtension | Promise<BABYLON.GLTF2.IGLTFLoaderExtension>;
5593
+ /**
5594
+ * All currently registered glTF 2.0 loader extensions.
5595
+ */
5596
+ export var registeredGLTFExtensions: ReadonlyMap<string, Readonly<IRegisteredGLTFExtension>>;
5597
+ /**
5598
+ * Registers a loader extension.
5599
+ * @param name The name of the loader extension.
5600
+ * @param isGLTFExtension If the loader extension is a glTF extension, then it will only be used for glTF files that use the corresponding glTF extension. Otherwise, it will be used for all loaded glTF files.
5601
+ * @param factory The factory function that creates the loader extension.
5602
+ */
5603
+ export function registerGLTFExtension(name: string, isGLTFExtension: boolean, factory: GLTFExtensionFactory): void;
5604
+ /**
5605
+ * Unregisters a loader extension.
5606
+ * @param name The name of the loader extension.
5607
+ * @returns A boolean indicating whether the extension has been unregistered
5608
+ */
5609
+ export function unregisterGLTFExtension(name: string): boolean;
5610
+
5611
+
5612
+
5455
5613
  }
5456
5614
  declare module BABYLON {
5457
5615
 
@@ -5724,7 +5882,6 @@ declare module BABYLON.GLTF2 {
5724
5882
  private _rootBabylonMesh;
5725
5883
  private _defaultBabylonMaterialData;
5726
5884
  private readonly _postSceneLoadActions;
5727
- private static _RegisteredExtensions;
5728
5885
  /**
5729
5886
  * The default glTF sampler.
5730
5887
  */
@@ -5733,12 +5890,14 @@ declare module BABYLON.GLTF2 {
5733
5890
  * Registers a loader extension.
5734
5891
  * @param name The name of the loader extension.
5735
5892
  * @param factory The factory function that creates the loader extension.
5893
+ * @deprecated Please use registerGLTFExtension instead.
5736
5894
  */
5737
- static RegisterExtension(name: string, factory: (loader: GLTFLoader) => BABYLON.GLTF2.IGLTFLoaderExtension): void;
5895
+ static RegisterExtension(name: string, factory: BABYLON.GLTF2.GLTFExtensionFactory): void;
5738
5896
  /**
5739
5897
  * Unregisters a loader extension.
5740
5898
  * @param name The name of the loader extension.
5741
5899
  * @returns A boolean indicating whether the extension has been unregistered
5900
+ * @deprecated Please use unregisterGLTFExtension instead.
5742
5901
  */
5743
5902
  static UnregisterExtension(name: string): boolean;
5744
5903
  /**
@@ -5782,8 +5941,7 @@ declare module BABYLON.GLTF2 {
5782
5941
  private _loadAsync;
5783
5942
  private _loadData;
5784
5943
  private _setupData;
5785
- private _loadExtensions;
5786
- private _checkExtensions;
5944
+ private _loadExtensionsAsync;
5787
5945
  private _createRootNode;
5788
5946
  /**
5789
5947
  * Loads a glTF scene.
@@ -6158,6 +6316,19 @@ declare module BABYLON.GLTF2.Loader.Extensions {
6158
6316
 
6159
6317
 
6160
6318
 
6319
+ }
6320
+ declare module BABYLON {
6321
+
6322
+
6323
+ }
6324
+ declare module BABYLON.GLTF2.Loader.Extensions {
6325
+ /**
6326
+ * Registers the built-in glTF 2.0 extension async factories, which dynamically imports and loads each glTF extension on demand (e.g. only when a glTF model uses the extension).
6327
+ */
6328
+ export function registerBuiltInGLTFExtensions(): void;
6329
+
6330
+
6331
+
6161
6332
  }
6162
6333
  declare module BABYLON {
6163
6334
 
@@ -8567,12 +8738,21 @@ declare module BABYLON.GLTF1 {
8567
8738
  }
8568
8739
  declare module BABYLON {
8569
8740
 
8570
- const PLUGIN_STL = "stl";
8741
+ export var STLFileLoaderMetadata: {
8742
+ readonly name: "stl";
8743
+ readonly extensions: {
8744
+ readonly ".stl": {
8745
+ readonly isBinary: true;
8746
+ };
8747
+ };
8748
+ };
8749
+
8750
+
8571
8751
  interface SceneLoaderPluginOptions {
8572
8752
  /**
8573
8753
  * Defines options for the stl loader.
8574
8754
  */
8575
- [PLUGIN_STL]: {};
8755
+ [STLFileLoaderMetadata.name]: {};
8576
8756
  }
8577
8757
  /**
8578
8758
  * STL file type loader.
@@ -8590,7 +8770,7 @@ declare module BABYLON {
8590
8770
  /**
8591
8771
  * Defines the name of the plugin.
8592
8772
  */
8593
- readonly name = "stl";
8773
+ readonly name: "stl";
8594
8774
  /**
8595
8775
  * Defines the extensions the stl loader is able to load.
8596
8776
  * force data to come in as an ArrayBuffer
@@ -8641,12 +8821,35 @@ declare module BABYLON {
8641
8821
 
8642
8822
 
8643
8823
 
8644
- const PLUGIN_SPLAT = "splat";
8824
+ /**
8825
+ * Options for loading Gaussian Splatting and PLY files
8826
+ */
8827
+ export type SPLATLoadingOptions = {
8828
+ /**
8829
+ * Defines if buffers should be kept in memory for editing purposes
8830
+ */
8831
+ keepInRam?: boolean;
8832
+ };
8833
+
8834
+
8835
+ export var SPLATFileLoaderMetadata: {
8836
+ readonly name: "splat";
8837
+ readonly extensions: {
8838
+ readonly ".splat": {
8839
+ readonly isBinary: true;
8840
+ };
8841
+ readonly ".ply": {
8842
+ readonly isBinary: true;
8843
+ };
8844
+ };
8845
+ };
8846
+
8847
+
8645
8848
  interface SceneLoaderPluginOptions {
8646
8849
  /**
8647
8850
  * Defines options for the splat loader.
8648
8851
  */
8649
- [PLUGIN_SPLAT]: {};
8852
+ [SPLATFileLoaderMetadata.name]: Partial<SPLATLoadingOptions>;
8650
8853
  }
8651
8854
  /**
8652
8855
  * @experimental
@@ -8657,7 +8860,9 @@ declare module BABYLON {
8657
8860
  /**
8658
8861
  * Defines the name of the plugin.
8659
8862
  */
8660
- readonly name = "splat";
8863
+ readonly name: "splat";
8864
+ private _assetContainer;
8865
+ private readonly _loadingOptions;
8661
8866
  /**
8662
8867
  * Defines the extensions the splat loader is able to load.
8663
8868
  * force data to come in as an ArrayBuffer
@@ -8672,21 +8877,15 @@ declare module BABYLON {
8672
8877
  };
8673
8878
  /**
8674
8879
  * Creates loader for gaussian splatting files
8880
+ * @param loadingOptions options for loading and parsing splat and PLY files.
8675
8881
  */
8676
- constructor();
8677
- /**
8678
- * Instantiates a gaussian splatting file loader plugin.
8679
- * @returns the created plugin
8680
- */
8681
- createPlugin(): ISceneLoaderPluginAsync | ISceneLoaderPlugin;
8682
- /**
8683
- * If the data string can be loaded directly.
8684
- * @returns if the data can be loaded directly
8685
- */
8686
- canDirectLoad(): boolean;
8882
+ constructor(loadingOptions?: Partial<Readonly<SPLATLoadingOptions>>);
8883
+ private static readonly _DefaultLoadingOptions;
8884
+ /** @internal */
8885
+ createPlugin(options: SceneLoaderPluginOptions): ISceneLoaderPluginAsync;
8687
8886
  /**
8688
8887
  * Imports from the loaded gaussian splatting data and adds them to the scene
8689
- * @param _meshesNames a string or array of strings of the mesh names that should be loaded from the file
8888
+ * @param meshesNames a string or array of strings of the mesh names that should be loaded from the file
8690
8889
  * @param scene the scene the meshes should be added to
8691
8890
  * @param data the gaussian splatting data to load
8692
8891
  * @param rootUrl root url to load from
@@ -8694,23 +8893,34 @@ declare module BABYLON {
8694
8893
  * @param fileName Defines the name of the file to load
8695
8894
  * @returns a promise containing the loaded meshes, particles, skeletons and animations
8696
8895
  */
8697
- importMeshAsync(_meshesNames: any, scene: Scene, data: any, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<ISceneLoaderAsyncResult>;
8896
+ importMeshAsync(meshesNames: any, scene: Scene, data: any, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<ISceneLoaderAsyncResult>;
8897
+ private static _BuildPointCloud;
8898
+ private static _BuildMesh;
8899
+ private _parse;
8698
8900
  /**
8699
- * Imports all objects from the loaded gaussian splatting data and adds them to the scene
8901
+ * Load into an asset container.
8902
+ * @param scene The scene to load into
8903
+ * @param data The data to import
8904
+ * @param rootUrl The root url for scene and resources
8905
+ * @returns The loaded asset container
8906
+ */
8907
+ loadAssetContainerAsync(scene: Scene, data: string, rootUrl: string): Promise<AssetContainer>;
8908
+ /**
8909
+ * Imports all objects from the loaded OBJ data and adds them to the scene
8700
8910
  * @param scene the scene the objects should be added to
8701
- * @param data the gaussian splatting data to load
8702
- * @param _rootUrl root url to load from
8911
+ * @param data the OBJ data to load
8912
+ * @param rootUrl root url to load from
8703
8913
  * @returns a promise which completes when objects have been loaded to the scene
8704
8914
  */
8705
- loadAsync(scene: Scene, data: any, _rootUrl: string): Promise<void>;
8915
+ loadAsync(scene: Scene, data: string, rootUrl: string): Promise<void>;
8706
8916
  /**
8707
- * Load into an asset container.
8708
- * @param _scene The scene to load into
8709
- * @param _data The data to import
8710
- * @param _rootUrl The root url for scene and resources
8711
- * @returns The loaded asset container
8917
+ * Code from https://github.com/dylanebert/gsplat.js/blob/main/src/loaders/PLYLoader.ts Under MIT license
8918
+ * Converts a .ply data array buffer to splat
8919
+ * if data array buffer is not ply, returns the original buffer
8920
+ * @param data the .ply data to load
8921
+ * @returns the loaded splat buffer
8712
8922
  */
8713
- loadAssetContainerAsync(_scene: Scene, _data: string, _rootUrl: string): Promise<AssetContainer>;
8923
+ private static _ConvertPLYToSplat;
8714
8924
  }
8715
8925
 
8716
8926
 
@@ -8927,12 +9137,17 @@ declare module BABYLON {
8927
9137
  };
8928
9138
 
8929
9139
 
8930
- const PLUGIN_OBJ = "obj";
9140
+ export var OBJFileLoaderMetadata: {
9141
+ readonly name: "obj";
9142
+ readonly extensions: ".obj";
9143
+ };
9144
+
9145
+
8931
9146
  interface SceneLoaderPluginOptions {
8932
9147
  /**
8933
9148
  * Defines options for the obj loader.
8934
9149
  */
8935
- [PLUGIN_OBJ]: {};
9150
+ [OBJFileLoaderMetadata.name]: {};
8936
9151
  }
8937
9152
  /**
8938
9153
  * OBJ file type loader.
@@ -8986,11 +9201,11 @@ declare module BABYLON {
8986
9201
  /**
8987
9202
  * Defines the name of the plugin.
8988
9203
  */
8989
- readonly name = "obj";
9204
+ readonly name: "obj";
8990
9205
  /**
8991
9206
  * Defines the extension the plugin is able to load.
8992
9207
  */
8993
- readonly extensions = ".obj";
9208
+ readonly extensions: ".obj";
8994
9209
  private _assetContainer;
8995
9210
  private _loadingOptions;
8996
9211
  /**