|
138 | 138 | return null;
|
139 | 139 | }
|
140 | 140 |
|
141 |
| - private static _loadData(rootUrl: string, sceneFilename: string, scene: Scene, onSuccess: (plugin: ISceneLoaderPlugin | ISceneLoaderPluginAsync, data: any) => void, onProgress: (event: ProgressEvent) => void, onError: (message: Nullable<string>, exception?: any) => void): void { |
| 141 | + private static _loadData(rootUrl: string, sceneFilename: string, scene: Scene, onSuccess: (plugin: ISceneLoaderPlugin | ISceneLoaderPluginAsync, data: any) => void, onProgress: (event: ProgressEvent) => void, onError: (message: Nullable<string>, exception?: any) => void, pluginExtension?: string): void { |
142 | 142 | var directLoad = SceneLoader._getDirectLoad(sceneFilename);
|
143 |
| - var registeredPlugin = directLoad ? SceneLoader._getPluginForDirectLoad(sceneFilename) : SceneLoader._getPluginForFilename(sceneFilename); |
| 143 | + var registeredPlugin = pluginExtension ? SceneLoader._getPluginForExtension(pluginExtension) : (directLoad ? SceneLoader._getPluginForDirectLoad(sceneFilename) : SceneLoader._getPluginForFilename(sceneFilename)); |
144 | 144 | var plugin = registeredPlugin.plugin;
|
145 | 145 | var useArrayBuffer = registeredPlugin.isBinary;
|
146 | 146 | var database: Database;
|
|
187 | 187 | }
|
188 | 188 | // Loading file from disk via input file or drag'n'drop
|
189 | 189 | else {
|
190 |
| - var fileOrString = <any> sceneFilename; |
| 190 | + var fileOrString = <any>sceneFilename; |
191 | 191 |
|
192 | 192 | if (fileOrString.name) { // File
|
193 | 193 | Tools.ReadFile(fileOrString, dataCallback, onProgress, useArrayBuffer);
|
|
234 | 234 | * @param onProgress a callback with a progress event for each file being loaded
|
235 | 235 | * @param onError a callback with the scene, a message, and possibly an exception when import fails
|
236 | 236 | */
|
237 |
| - public static ImportMesh(meshNames: any, rootUrl: string, sceneFilename: string, scene: Scene, onSuccess: Nullable<(meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => void> = null, onProgress: Nullable<(event: ProgressEvent) => void> = null, onError: Nullable<(scene: Scene, message: string, exception?: any) => void> = null): void { |
| 237 | + public static ImportMesh(meshNames: any, rootUrl: string, sceneFilename: string, scene: Scene, onSuccess: Nullable<(meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => void> = null, onProgress: Nullable<(event: ProgressEvent) => void> = null, onError: Nullable<(scene: Scene, message: string, exception?: any) => void> = null, pluginExtension?: string): void { |
238 | 238 | if (sceneFilename.substr && sceneFilename.substr(0, 1) === "/") {
|
239 | 239 | Tools.Error("Wrong sceneFilename parameter");
|
240 | 240 | return;
|
|
297 | 297 | }
|
298 | 298 | }, progressHandler, errorHandler);
|
299 | 299 | }
|
300 |
| - }, progressHandler, errorHandler); |
| 300 | + }, progressHandler, errorHandler, pluginExtension); |
301 | 301 | }
|
302 | 302 |
|
303 | 303 | /**
|
|
309 | 309 | * @param onProgress a callback with a progress event for each file being loaded
|
310 | 310 | * @param onError a callback with the scene, a message, and possibly an exception when import fails
|
311 | 311 | */
|
312 |
| - public static Load(rootUrl: string, sceneFilename: any, engine: Engine, onSuccess?: (scene: Scene) => void, onProgress?: (event: ProgressEvent) => void, onError?: (scene: Scene, message: string, exception?: any) => void): void { |
313 |
| - SceneLoader.Append(rootUrl, sceneFilename, new Scene(engine), onSuccess, onProgress, onError); |
| 312 | + public static Load(rootUrl: string, sceneFilename: any, engine: Engine, onSuccess?: (scene: Scene) => void, onProgress?: (event: ProgressEvent) => void, onError?: (scene: Scene, message: string, exception?: any) => void, pluginExtension?: string): void { |
| 313 | + SceneLoader.Append(rootUrl, sceneFilename, new Scene(engine), onSuccess, onProgress, onError, pluginExtension); |
314 | 314 | }
|
315 | 315 |
|
316 | 316 | /**
|
|
322 | 322 | * @param onProgress a callback with a progress event for each file being loaded
|
323 | 323 | * @param onError a callback with the scene, a message, and possibly an exception when import fails
|
324 | 324 | */
|
325 |
| - public static Append(rootUrl: string, sceneFilename: any, scene: Scene, onSuccess?: (scene: Scene) => void, onProgress?: (event: ProgressEvent) => void, onError?: (scene: Scene, message: string, exception?: any) => void): void { |
| 325 | + public static Append(rootUrl: string, sceneFilename: any, scene: Scene, onSuccess?: (scene: Scene) => void, onProgress?: (event: ProgressEvent) => void, onError?: (scene: Scene, message: string, exception?: any) => void, pluginExtension?: string): void { |
326 | 326 | if (sceneFilename.substr && sceneFilename.substr(0, 1) === "/") {
|
327 | 327 | Tools.Error("Wrong sceneFilename parameter");
|
328 | 328 | return;
|
|
387 | 387 | scene.getEngine().hideLoadingUI();
|
388 | 388 | });
|
389 | 389 | }
|
390 |
| - }, progressHandler, errorHandler); |
| 390 | + }, progressHandler, errorHandler, pluginExtension); |
391 | 391 | }
|
392 | 392 | };
|
393 | 393 | }
|
0 commit comments