@babylonjs/core 7.33.0 → 7.34.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.
Files changed (132) hide show
  1. package/Animations/animatable.core.d.ts +2 -1
  2. package/Animations/animatable.core.js +3 -2
  3. package/Animations/animatable.core.js.map +1 -1
  4. package/Animations/animationGroup.d.ts +2 -1
  5. package/Animations/animationGroup.js +3 -2
  6. package/Animations/animationGroup.js.map +1 -1
  7. package/Cameras/arcRotateCamera.d.ts +14 -0
  8. package/Cameras/arcRotateCamera.js +39 -19
  9. package/Cameras/arcRotateCamera.js.map +1 -1
  10. package/Decorators/nodeDecorator.d.ts +2 -0
  11. package/Decorators/nodeDecorator.js +1 -0
  12. package/Decorators/nodeDecorator.js.map +1 -1
  13. package/Engines/abstractEngine.js +2 -2
  14. package/Engines/abstractEngine.js.map +1 -1
  15. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.d.ts +63 -0
  16. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js +150 -0
  17. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js.map +1 -0
  18. package/FrameGraph/Node/Blocks/Rendering/objectRendererBlock.d.ts +3 -47
  19. package/FrameGraph/Node/Blocks/Rendering/objectRendererBlock.js +2 -129
  20. package/FrameGraph/Node/Blocks/Rendering/objectRendererBlock.js.map +1 -1
  21. package/FrameGraph/Node/Blocks/Rendering/taaObjectRendererBlock.d.ts +40 -0
  22. package/FrameGraph/Node/Blocks/Rendering/taaObjectRendererBlock.js +98 -0
  23. package/FrameGraph/Node/Blocks/Rendering/taaObjectRendererBlock.js.map +1 -0
  24. package/FrameGraph/Node/Blocks/Textures/clearBlock.js +3 -3
  25. package/FrameGraph/Node/Blocks/Textures/clearBlock.js.map +1 -1
  26. package/FrameGraph/Node/Blocks/index.d.ts +3 -2
  27. package/FrameGraph/Node/Blocks/index.js +3 -2
  28. package/FrameGraph/Node/Blocks/index.js.map +1 -1
  29. package/FrameGraph/Passes/renderPass.js +1 -1
  30. package/FrameGraph/Passes/renderPass.js.map +1 -1
  31. package/FrameGraph/Tasks/Rendering/taaObjectRendererTask.d.ts +21 -0
  32. package/FrameGraph/Tasks/Rendering/taaObjectRendererTask.js +110 -0
  33. package/FrameGraph/Tasks/Rendering/taaObjectRendererTask.js.map +1 -0
  34. package/FrameGraph/frameGraph.d.ts +6 -0
  35. package/FrameGraph/frameGraph.js +15 -1
  36. package/FrameGraph/frameGraph.js.map +1 -1
  37. package/FrameGraph/frameGraphRenderContext.d.ts +3 -2
  38. package/FrameGraph/frameGraphRenderContext.js +9 -4
  39. package/FrameGraph/frameGraphRenderContext.js.map +1 -1
  40. package/FrameGraph/frameGraphTask.js +5 -1
  41. package/FrameGraph/frameGraphTask.js.map +1 -1
  42. package/FrameGraph/frameGraphTextureManager.d.ts +8 -0
  43. package/FrameGraph/frameGraphTextureManager.js +51 -7
  44. package/FrameGraph/frameGraphTextureManager.js.map +1 -1
  45. package/FrameGraph/frameGraphTypes.d.ts +2 -0
  46. package/FrameGraph/frameGraphTypes.js.map +1 -1
  47. package/FrameGraph/index.d.ts +3 -2
  48. package/FrameGraph/index.js +3 -2
  49. package/FrameGraph/index.js.map +1 -1
  50. package/Layers/layer.d.ts +4 -0
  51. package/Layers/layer.js +13 -2
  52. package/Layers/layer.js.map +1 -1
  53. package/Loading/sceneLoader.d.ts +11 -8
  54. package/Loading/sceneLoader.js +64 -35
  55. package/Loading/sceneLoader.js.map +1 -1
  56. package/Materials/GaussianSplatting/gaussianSplattingMaterial.d.ts +2 -0
  57. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +12 -0
  58. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
  59. package/Materials/Node/Blocks/GaussianSplatting/gaussianBlock.js +6 -1
  60. package/Materials/Node/Blocks/GaussianSplatting/gaussianBlock.js.map +1 -1
  61. package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.js +9 -2
  62. package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.js.map +1 -1
  63. package/Materials/Node/Blocks/GaussianSplatting/index.d.ts +2 -0
  64. package/Materials/Node/Blocks/GaussianSplatting/index.js +3 -0
  65. package/Materials/Node/Blocks/GaussianSplatting/index.js.map +1 -1
  66. package/Materials/Node/Blocks/GaussianSplatting/splatReaderBlock.js +10 -3
  67. package/Materials/Node/Blocks/GaussianSplatting/splatReaderBlock.js.map +1 -1
  68. package/Materials/Node/nodeMaterial.d.ts +1 -1
  69. package/Materials/Node/nodeMaterial.js +1 -1
  70. package/Materials/Node/nodeMaterial.js.map +1 -1
  71. package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +2 -0
  72. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +7 -2
  73. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
  74. package/Meshes/abstractMesh.hotSpot.js +2 -0
  75. package/Meshes/abstractMesh.hotSpot.js.map +1 -1
  76. package/Meshes/csg2.js +0 -3
  77. package/Meshes/csg2.js.map +1 -1
  78. package/Misc/webRequest.fetch.d.ts +16 -0
  79. package/Misc/webRequest.fetch.js +33 -0
  80. package/Misc/webRequest.fetch.js.map +1 -0
  81. package/PostProcesses/RenderPipeline/Pipelines/index.d.ts +2 -0
  82. package/PostProcesses/RenderPipeline/Pipelines/index.js +2 -0
  83. package/PostProcesses/RenderPipeline/Pipelines/index.js.map +1 -1
  84. package/PostProcesses/RenderPipeline/Pipelines/taaRenderingPipeline.d.ts +6 -8
  85. package/PostProcesses/RenderPipeline/Pipelines/taaRenderingPipeline.js +32 -49
  86. package/PostProcesses/RenderPipeline/Pipelines/taaRenderingPipeline.js.map +1 -1
  87. package/PostProcesses/thinTAAPostProcess.d.ts +72 -0
  88. package/PostProcesses/thinTAAPostProcess.js +149 -0
  89. package/PostProcesses/thinTAAPostProcess.js.map +1 -0
  90. package/PostProcesses/volumetricLightScatteringPostProcess.js.map +1 -1
  91. package/Rendering/IBLShadows/iblShadowsAccumulationPass.d.ts +3 -3
  92. package/Rendering/IBLShadows/iblShadowsAccumulationPass.js +7 -7
  93. package/Rendering/IBLShadows/iblShadowsAccumulationPass.js.map +1 -1
  94. package/Rendering/IBLShadows/iblShadowsRenderPipeline.d.ts +70 -69
  95. package/Rendering/IBLShadows/iblShadowsRenderPipeline.js +102 -112
  96. package/Rendering/IBLShadows/iblShadowsRenderPipeline.js.map +1 -1
  97. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js +1 -2
  98. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js.map +1 -1
  99. package/Rendering/geometryBufferRenderer.js +8 -6
  100. package/Rendering/geometryBufferRenderer.js.map +1 -1
  101. package/Shaders/geometry.vertex.js +1 -1
  102. package/Shaders/geometry.vertex.js.map +1 -1
  103. package/Shaders/layer.fragment.js +3 -1
  104. package/Shaders/layer.fragment.js.map +1 -1
  105. package/Shaders/volumetricLightScattering.fragment.js +1 -1
  106. package/Shaders/volumetricLightScattering.fragment.js.map +1 -1
  107. package/ShadersWGSL/ShadersInclude/gaussianSplatting.d.ts +5 -0
  108. package/ShadersWGSL/ShadersInclude/gaussianSplatting.js +47 -0
  109. package/ShadersWGSL/ShadersInclude/gaussianSplatting.js.map +1 -0
  110. package/ShadersWGSL/ShadersInclude/gaussianSplattingFragmentDeclaration.d.ts +7 -0
  111. package/ShadersWGSL/ShadersInclude/gaussianSplattingFragmentDeclaration.js +20 -0
  112. package/ShadersWGSL/ShadersInclude/gaussianSplattingFragmentDeclaration.js.map +1 -0
  113. package/ShadersWGSL/ShadersInclude/gaussianSplattingUboDeclaration.d.ts +7 -0
  114. package/ShadersWGSL/ShadersInclude/gaussianSplattingUboDeclaration.js +13 -0
  115. package/ShadersWGSL/ShadersInclude/gaussianSplattingUboDeclaration.js.map +1 -0
  116. package/ShadersWGSL/ShadersInclude/gaussianSplattingVertexDeclaration.d.ts +5 -0
  117. package/ShadersWGSL/ShadersInclude/gaussianSplattingVertexDeclaration.js +10 -0
  118. package/ShadersWGSL/ShadersInclude/gaussianSplattingVertexDeclaration.js.map +1 -0
  119. package/ShadersWGSL/gaussianSplatting.fragment.d.ts +10 -0
  120. package/ShadersWGSL/gaussianSplatting.fragment.js +23 -0
  121. package/ShadersWGSL/gaussianSplatting.fragment.js.map +1 -0
  122. package/ShadersWGSL/gaussianSplatting.vertex.d.ts +14 -0
  123. package/ShadersWGSL/gaussianSplatting.vertex.js +31 -0
  124. package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -0
  125. package/ShadersWGSL/geometry.vertex.js +1 -1
  126. package/ShadersWGSL/geometry.vertex.js.map +1 -1
  127. package/ShadersWGSL/layer.fragment.js +4 -2
  128. package/ShadersWGSL/layer.fragment.js.map +1 -1
  129. package/ShadersWGSL/taa.fragment.d.ts +5 -0
  130. package/ShadersWGSL/taa.fragment.js +11 -0
  131. package/ShadersWGSL/taa.fragment.js.map +1 -0
  132. package/package.json +1 -1
@@ -81,6 +81,7 @@ export interface ISceneLoaderPluginExtensions {
81
81
  */
82
82
  readonly [extension: string]: {
83
83
  readonly isBinary: boolean;
84
+ readonly mimeType?: string;
84
85
  };
85
86
  }
86
87
  /**
@@ -259,6 +260,7 @@ interface IRegisteredPlugin {
259
260
  * Defines if the plugin supports binary data
260
261
  */
261
262
  isBinary: boolean;
263
+ mimeType?: string;
262
264
  }
263
265
  /**
264
266
  * Defines options for SceneLoader plugins. This interface is extended by specific plugins.
@@ -463,9 +465,9 @@ export declare class SceneLoader {
463
465
  * @param onError a callback with the scene, a message, and possibly an exception when import fails
464
466
  * @param pluginExtension the extension used to determine the plugin
465
467
  * @param name defines the name of the file, if the data is binary
466
- * @returns The loaded plugin
468
+ * @deprecated Please use ImportMeshAsync instead
467
469
  */
468
- static ImportMesh(meshNames: string | readonly string[] | null | undefined, rootUrl: string, sceneFilename?: SceneSource, scene?: Nullable<Scene>, onSuccess?: Nullable<SceneLoaderSuccessCallback>, onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>, onError?: Nullable<(scene: Scene, message: string, exception?: any) => void>, pluginExtension?: Nullable<string>, name?: string): Nullable<ISceneLoaderPlugin | ISceneLoaderPluginAsync>;
470
+ static ImportMesh(meshNames: string | readonly string[] | null | undefined, rootUrl: string, sceneFilename?: SceneSource, scene?: Nullable<Scene>, onSuccess?: Nullable<SceneLoaderSuccessCallback>, onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>, onError?: Nullable<(scene: Scene, message: string, exception?: any) => void>, pluginExtension?: Nullable<string>, name?: string): void;
469
471
  /**
470
472
  * Import meshes into a scene
471
473
  * @param meshNames an array of mesh names, a single mesh name, or empty string for all meshes that filter what meshes are imported
@@ -488,9 +490,9 @@ export declare class SceneLoader {
488
490
  * @param onError a callback with the scene, a message, and possibly an exception when import fails
489
491
  * @param pluginExtension the extension used to determine the plugin
490
492
  * @param name defines the filename, if the data is binary
491
- * @returns The loaded plugin
493
+ * @deprecated Please use LoadAsync instead
492
494
  */
493
- static Load(rootUrl: string, sceneFilename?: SceneSource, engine?: Nullable<AbstractEngine>, onSuccess?: Nullable<(scene: Scene) => void>, onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>, onError?: Nullable<(scene: Scene, message: string, exception?: any) => void>, pluginExtension?: Nullable<string>, name?: string): Nullable<ISceneLoaderPlugin | ISceneLoaderPluginAsync>;
495
+ static Load(rootUrl: string, sceneFilename?: SceneSource, engine?: Nullable<AbstractEngine>, onSuccess?: Nullable<(scene: Scene) => void>, onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>, onError?: Nullable<(scene: Scene, message: string, exception?: any) => void>, pluginExtension?: Nullable<string>, name?: string): void;
494
496
  /**
495
497
  * Load a scene
496
498
  * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)
@@ -512,9 +514,9 @@ export declare class SceneLoader {
512
514
  * @param onError a callback with the scene, a message, and possibly an exception when import fails
513
515
  * @param pluginExtension the extension used to determine the plugin
514
516
  * @param name defines the name of the file, if the data is binary
515
- * @returns The loaded plugin
517
+ * @deprecated Please use AppendAsync instead
516
518
  */
517
- static Append(rootUrl: string, sceneFilename?: SceneSource, scene?: Nullable<Scene>, onSuccess?: Nullable<(scene: Scene) => void>, onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>, onError?: Nullable<(scene: Scene, message: string, exception?: any) => void>, pluginExtension?: Nullable<string>, name?: string): Nullable<ISceneLoaderPlugin | ISceneLoaderPluginAsync>;
519
+ static Append(rootUrl: string, sceneFilename?: SceneSource, scene?: Nullable<Scene>, onSuccess?: Nullable<(scene: Scene) => void>, onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>, onError?: Nullable<(scene: Scene, message: string, exception?: any) => void>, pluginExtension?: Nullable<string>, name?: string): void;
518
520
  /**
519
521
  * Append a scene
520
522
  * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)
@@ -536,9 +538,9 @@ export declare class SceneLoader {
536
538
  * @param onError a callback with the scene, a message, and possibly an exception when import fails
537
539
  * @param pluginExtension the extension used to determine the plugin
538
540
  * @param name defines the filename, if the data is binary
539
- * @returns The loaded plugin
541
+ * @deprecated Please use LoadAssetContainerAsync instead
540
542
  */
541
- static LoadAssetContainer(rootUrl: string, sceneFilename?: SceneSource, scene?: Nullable<Scene>, onSuccess?: Nullable<(assets: AssetContainer) => void>, onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>, onError?: Nullable<(scene: Scene, message: string, exception?: any) => void>, pluginExtension?: Nullable<string>, name?: string): Nullable<ISceneLoaderPlugin | ISceneLoaderPluginAsync>;
543
+ static LoadAssetContainer(rootUrl: string, sceneFilename?: SceneSource, scene?: Nullable<Scene>, onSuccess?: Nullable<(assets: AssetContainer) => void>, onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>, onError?: Nullable<(scene: Scene, message: string, exception?: any) => void>, pluginExtension?: Nullable<string>, name?: string): void;
542
544
  /**
543
545
  * Load a scene into an asset container
544
546
  * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)
@@ -563,6 +565,7 @@ export declare class SceneLoader {
563
565
  * @param onError a callback with the scene, a message, and possibly an exception when import fails
564
566
  * @param pluginExtension the extension used to determine the plugin
565
567
  * @param name defines the filename, if the data is binary
568
+ * @deprecated Please use ImportAnimationsAsync instead
566
569
  */
567
570
  static ImportAnimations(rootUrl: string, sceneFilename?: SceneSource, scene?: Nullable<Scene>, overwriteAnimations?: boolean, animationGroupLoadingMode?: SceneLoaderAnimationGroupLoadingMode, targetConverter?: Nullable<(target: any) => any>, onSuccess?: Nullable<(scene: Scene) => void>, onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>, onError?: Nullable<(scene: Scene, message: string, exception?: any) => void>, pluginExtension?: Nullable<string>, name?: string): void;
568
571
  /**
@@ -9,6 +9,7 @@ import { IsBase64DataUrl } from "../Misc/fileTools.js";
9
9
  import { RuntimeError, ErrorCodes } from "../Misc/error.js";
10
10
  import { RandomGUID } from "../Misc/guid.js";
11
11
  import { AbstractEngine } from "../Engines/abstractEngine.js";
12
+ import { _FetchAsync } from "../Misc/webRequest.fetch.js";
12
13
  /**
13
14
  * Mode that determines how to handle old animation groups before loading new ones.
14
15
  */
@@ -43,7 +44,16 @@ let showingLoadingScreen = false;
43
44
  function getDefaultPlugin() {
44
45
  return registeredPlugins[".babylon"];
45
46
  }
46
- function getPluginForExtension(extension) {
47
+ function getPluginForMimeType(mimeType) {
48
+ for (const registeredPluginKey in registeredPlugins) {
49
+ const registeredPlugin = registeredPlugins[registeredPluginKey];
50
+ if (registeredPlugin.mimeType === mimeType) {
51
+ return registeredPlugin;
52
+ }
53
+ }
54
+ return undefined;
55
+ }
56
+ function getPluginForExtension(extension, returnDefault) {
47
57
  const registeredPlugin = registeredPlugins[extension];
48
58
  if (registeredPlugin) {
49
59
  return registeredPlugin;
@@ -51,7 +61,7 @@ function getPluginForExtension(extension) {
51
61
  Logger.Warn("Unable to find a plugin to load " +
52
62
  extension +
53
63
  " files. Trying to use .babylon default plugin. To load from a specific filetype (eg. gltf) see: https://doc.babylonjs.com/features/featuresDeepDive/importers/loadingFileTypes");
54
- return getDefaultPlugin();
64
+ return returnDefault ? getDefaultPlugin() : undefined;
55
65
  }
56
66
  function isPluginForExtensionAvailable(extension) {
57
67
  return !!registeredPlugins[extension];
@@ -65,14 +75,13 @@ function getPluginForDirectLoad(data) {
65
75
  }
66
76
  return getDefaultPlugin();
67
77
  }
68
- function getPluginForFilename(sceneFilename) {
78
+ function getFilenameExtension(sceneFilename) {
69
79
  const queryStringPosition = sceneFilename.indexOf("?");
70
80
  if (queryStringPosition !== -1) {
71
81
  sceneFilename = sceneFilename.substring(0, queryStringPosition);
72
82
  }
73
83
  const dotPosition = sceneFilename.lastIndexOf(".");
74
- const extension = sceneFilename.substring(dotPosition, sceneFilename.length).toLowerCase();
75
- return getPluginForExtension(extension);
84
+ return sceneFilename.substring(dotPosition, sceneFilename.length).toLowerCase();
76
85
  }
77
86
  function getDirectLoad(sceneFilename) {
78
87
  if (sceneFilename.substring(0, 5) === "data:") {
@@ -91,13 +100,31 @@ function formatErrorMessage(fileInfo, message, exception) {
91
100
  }
92
101
  return errorMessage;
93
102
  }
94
- function loadData(fileInfo, scene, onSuccess, onProgress, onError, onDispose, pluginExtension, name, pluginOptions) {
103
+ async function loadDataAsync(fileInfo, scene, onSuccess, onProgress, onError, onDispose, pluginExtension, name, pluginOptions) {
95
104
  const directLoad = getDirectLoad(fileInfo.url);
96
105
  if (fileInfo.rawData && !pluginExtension) {
97
106
  // eslint-disable-next-line no-throw-literal
98
107
  throw "When using ArrayBufferView to load data the file extension must be provided.";
99
108
  }
100
- const registeredPlugin = pluginExtension ? getPluginForExtension(pluginExtension) : directLoad ? getPluginForDirectLoad(fileInfo.url) : getPluginForFilename(fileInfo.url);
109
+ const fileExtension = !directLoad && !pluginExtension ? getFilenameExtension(fileInfo.url) : "";
110
+ let registeredPlugin = pluginExtension
111
+ ? getPluginForExtension(pluginExtension, true)
112
+ : directLoad
113
+ ? getPluginForDirectLoad(fileInfo.url)
114
+ : getPluginForExtension(fileExtension, false);
115
+ if (!registeredPlugin && fileExtension) {
116
+ if (fileInfo.url && !fileInfo.url.startsWith("blob:")) {
117
+ // Fetching head content to get the mime type
118
+ const response = await _FetchAsync(fileInfo.url, { method: "HEAD", responseHeaders: ["Content-Type"] });
119
+ const mimeType = response.headerValues ? response.headerValues["Content-Type"] : "";
120
+ if (mimeType) {
121
+ registeredPlugin = getPluginForMimeType(mimeType);
122
+ }
123
+ }
124
+ if (!registeredPlugin) {
125
+ registeredPlugin = getDefaultPlugin();
126
+ }
127
+ }
101
128
  if (!registeredPlugin) {
102
129
  throw new Error(`No plugin or fallback for ${pluginExtension ?? fileInfo.url}`);
103
130
  }
@@ -217,7 +244,7 @@ function loadData(fileInfo, scene, onSuccess, onProgress, onError, onDispose, pl
217
244
  }
218
245
  });
219
246
  }
220
- function getFileInfo(rootUrl, sceneSource) {
247
+ function _getFileInfo(rootUrl, sceneSource) {
221
248
  let url;
222
249
  let name;
223
250
  let file = null;
@@ -281,16 +308,17 @@ export function registerSceneLoaderPlugin(plugin) {
281
308
  registeredPlugins[extension.toLowerCase()] = {
282
309
  plugin: plugin,
283
310
  isBinary: extensions[extension].isBinary,
311
+ mimeType: extensions[extension].mimeType,
284
312
  };
285
313
  });
286
314
  }
287
315
  }
288
- function importMesh(meshNames, rootUrl, sceneFilename = "", scene = EngineStore.LastCreatedScene, onSuccess = null, onProgress = null, onError = null, pluginExtension = null, name = "", pluginOptions = {}) {
316
+ async function importMeshAsync(meshNames, rootUrl, sceneFilename = "", scene = EngineStore.LastCreatedScene, onSuccess = null, onProgress = null, onError = null, pluginExtension = null, name = "", pluginOptions = {}) {
289
317
  if (!scene) {
290
318
  Logger.Error("No scene available to import mesh to");
291
319
  return null;
292
320
  }
293
- const fileInfo = getFileInfo(rootUrl, sceneFilename);
321
+ const fileInfo = _getFileInfo(rootUrl, sceneFilename);
294
322
  if (!fileInfo) {
295
323
  return null;
296
324
  }
@@ -332,7 +360,7 @@ function importMesh(meshNames, rootUrl, sceneFilename = "", scene = EngineStore.
332
360
  }
333
361
  scene.removePendingData(loadingToken);
334
362
  };
335
- return loadData(fileInfo, scene, (plugin, data, responseURL) => {
363
+ return await loadDataAsync(fileInfo, scene, (plugin, data, responseURL) => {
336
364
  if (plugin.rewriteRootURL) {
337
365
  fileInfo.rootUrl = plugin.rewriteRootURL(fileInfo.rootUrl, responseURL);
338
366
  }
@@ -363,7 +391,7 @@ function importMesh(meshNames, rootUrl, sceneFilename = "", scene = EngineStore.
363
391
  }
364
392
  function importMeshAsyncCore(meshNames, rootUrl, sceneFilename, scene, onProgress, pluginExtension, name, pluginOptions) {
365
393
  return new Promise((resolve, reject) => {
366
- importMesh(meshNames, rootUrl, sceneFilename, scene, (meshes, particleSystems, skeletons, animationGroups, transformNodes, geometries, lights, spriteManagers) => {
394
+ importMeshAsync(meshNames, rootUrl, sceneFilename, scene, (meshes, particleSystems, skeletons, animationGroups, transformNodes, geometries, lights, spriteManagers) => {
367
395
  resolve({
368
396
  meshes: meshes,
369
397
  particleSystems: particleSystems,
@@ -382,9 +410,9 @@ function importMeshAsyncCore(meshNames, rootUrl, sceneFilename, scene, onProgres
382
410
  function loadScene(rootUrl, sceneFilename = "", engine = EngineStore.LastCreatedEngine, onSuccess = null, onProgress = null, onError = null, pluginExtension = null, name = "", pluginOptions = {}) {
383
411
  if (!engine) {
384
412
  Tools.Error("No engine available");
385
- return null;
413
+ return;
386
414
  }
387
- return append(rootUrl, sceneFilename, new Scene(engine), onSuccess, onProgress, onError, pluginExtension, name, pluginOptions);
415
+ appendAsync(rootUrl, sceneFilename, new Scene(engine), onSuccess, onProgress, onError, pluginExtension, name, pluginOptions);
388
416
  }
389
417
  /**
390
418
  * Load a scene
@@ -407,12 +435,12 @@ function loadSceneAsyncCore(rootUrl, sceneFilename, engine, onProgress, pluginEx
407
435
  }, pluginExtension, name, pluginOptions);
408
436
  });
409
437
  }
410
- function append(rootUrl, sceneFilename = "", scene = EngineStore.LastCreatedScene, onSuccess = null, onProgress = null, onError = null, pluginExtension = null, name = "", pluginOptions = {}) {
438
+ async function appendAsync(rootUrl, sceneFilename = "", scene = EngineStore.LastCreatedScene, onSuccess = null, onProgress = null, onError = null, pluginExtension = null, name = "", pluginOptions = {}) {
411
439
  if (!scene) {
412
440
  Logger.Error("No scene available to append to");
413
441
  return null;
414
442
  }
415
- const fileInfo = getFileInfo(rootUrl, sceneFilename);
443
+ const fileInfo = _getFileInfo(rootUrl, sceneFilename);
416
444
  if (!fileInfo) {
417
445
  return null;
418
446
  }
@@ -461,7 +489,7 @@ function append(rootUrl, sceneFilename = "", scene = EngineStore.LastCreatedScen
461
489
  }
462
490
  scene.removePendingData(loadingToken);
463
491
  };
464
- return loadData(fileInfo, scene, (plugin, data) => {
492
+ return await loadDataAsync(fileInfo, scene, (plugin, data) => {
465
493
  if (plugin.load) {
466
494
  const syncedPlugin = plugin;
467
495
  if (!syncedPlugin.load(scene, data, fileInfo.rootUrl, errorHandler)) {
@@ -497,19 +525,19 @@ export async function appendSceneAsync(source, scene, options) {
497
525
  }
498
526
  function appendSceneAsyncCore(rootUrl, sceneFilename, scene, onProgress, pluginExtension, name, pluginOptions) {
499
527
  return new Promise((resolve, reject) => {
500
- append(rootUrl, sceneFilename, scene, (scene) => {
528
+ appendAsync(rootUrl, sceneFilename, scene, (scene) => {
501
529
  resolve(scene);
502
530
  }, onProgress, (scene, message, exception) => {
503
531
  reject(exception || new Error(message));
504
532
  }, pluginExtension, name, pluginOptions);
505
533
  });
506
534
  }
507
- function loadAssetContainer(rootUrl, sceneFilename = "", scene = EngineStore.LastCreatedScene, onSuccess = null, onProgress = null, onError = null, pluginExtension = null, name = "", pluginOptions = {}) {
535
+ async function loadAssetContainerCoreAsync(rootUrl, sceneFilename = "", scene = EngineStore.LastCreatedScene, onSuccess = null, onProgress = null, onError = null, pluginExtension = null, name = "", pluginOptions = {}) {
508
536
  if (!scene) {
509
537
  Logger.Error("No scene available to load asset container to");
510
538
  return null;
511
539
  }
512
- const fileInfo = getFileInfo(rootUrl, sceneFilename);
540
+ const fileInfo = _getFileInfo(rootUrl, sceneFilename);
513
541
  if (!fileInfo) {
514
542
  return null;
515
543
  }
@@ -550,7 +578,7 @@ function loadAssetContainer(rootUrl, sceneFilename = "", scene = EngineStore.Las
550
578
  }
551
579
  scene.removePendingData(loadingToken);
552
580
  };
553
- return loadData(fileInfo, scene, (plugin, data) => {
581
+ return await loadDataAsync(fileInfo, scene, (plugin, data) => {
554
582
  if (plugin.loadAssetContainer) {
555
583
  const syncedPlugin = plugin;
556
584
  const assetContainer = syncedPlugin.loadAssetContainer(scene, data, fileInfo.rootUrl, errorHandler);
@@ -589,11 +617,11 @@ function loadAssetContainer(rootUrl, sceneFilename = "", scene = EngineStore.Las
589
617
  */
590
618
  export function loadAssetContainerAsync(source, scene, options) {
591
619
  const { rootUrl = "", onProgress, pluginExtension, name, pluginOptions } = options ?? {};
592
- return loadAssetContainerAsyncCore(rootUrl, source, scene, onProgress, pluginExtension, name, pluginOptions);
620
+ return internalLoadAssetContainerAsync(rootUrl, source, scene, onProgress, pluginExtension, name, pluginOptions);
593
621
  }
594
- function loadAssetContainerAsyncCore(rootUrl, sceneFilename, scene, onProgress, pluginExtension, name, pluginOptions) {
622
+ function internalLoadAssetContainerAsync(rootUrl, sceneFilename, scene, onProgress, pluginExtension, name, pluginOptions) {
595
623
  return new Promise((resolve, reject) => {
596
- loadAssetContainer(rootUrl, sceneFilename, scene, (assets) => {
624
+ loadAssetContainerCoreAsync(rootUrl, sceneFilename, scene, (assets) => {
597
625
  resolve(assets);
598
626
  }, onProgress, (scene, message, exception) => {
599
627
  reject(exception || new Error(message));
@@ -656,7 +684,7 @@ function importAnimations(rootUrl, sceneFilename = "", scene = EngineStore.LastC
656
684
  onSuccess(scene);
657
685
  }
658
686
  };
659
- loadAssetContainer(rootUrl, sceneFilename, scene, onAssetContainerLoaded, onProgress, onError, pluginExtension, name, pluginOptions);
687
+ loadAssetContainerCoreAsync(rootUrl, sceneFilename, scene, onAssetContainerLoaded, onProgress, onError, pluginExtension, name, pluginOptions);
660
688
  }
661
689
  /**
662
690
  * Import animations from a file into a scene
@@ -736,7 +764,7 @@ export class SceneLoader {
736
764
  * @returns a plugin or null if none works
737
765
  */
738
766
  static GetPluginForExtension(extension) {
739
- return getPluginForExtension(extension)?.plugin;
767
+ return getPluginForExtension(extension, true)?.plugin;
740
768
  }
741
769
  /**
742
770
  * Gets a boolean indicating that the given extension can be loaded
@@ -764,10 +792,10 @@ export class SceneLoader {
764
792
  * @param onError a callback with the scene, a message, and possibly an exception when import fails
765
793
  * @param pluginExtension the extension used to determine the plugin
766
794
  * @param name defines the name of the file, if the data is binary
767
- * @returns The loaded plugin
795
+ * @deprecated Please use ImportMeshAsync instead
768
796
  */
769
797
  static ImportMesh(meshNames, rootUrl, sceneFilename, scene, onSuccess, onProgress, onError, pluginExtension, name) {
770
- return importMesh(meshNames, rootUrl, sceneFilename, scene, onSuccess, onProgress, onError, pluginExtension, name);
798
+ importMeshAsync(meshNames, rootUrl, sceneFilename, scene, onSuccess, onProgress, onError, pluginExtension, name);
771
799
  }
772
800
  /**
773
801
  * Import meshes into a scene
@@ -793,10 +821,10 @@ export class SceneLoader {
793
821
  * @param onError a callback with the scene, a message, and possibly an exception when import fails
794
822
  * @param pluginExtension the extension used to determine the plugin
795
823
  * @param name defines the filename, if the data is binary
796
- * @returns The loaded plugin
824
+ * @deprecated Please use LoadAsync instead
797
825
  */
798
826
  static Load(rootUrl, sceneFilename, engine, onSuccess, onProgress, onError, pluginExtension, name) {
799
- return loadScene(rootUrl, sceneFilename, engine, onSuccess, onProgress, onError, pluginExtension, name);
827
+ loadScene(rootUrl, sceneFilename, engine, onSuccess, onProgress, onError, pluginExtension, name);
800
828
  }
801
829
  /**
802
830
  * Load a scene
@@ -821,10 +849,10 @@ export class SceneLoader {
821
849
  * @param onError a callback with the scene, a message, and possibly an exception when import fails
822
850
  * @param pluginExtension the extension used to determine the plugin
823
851
  * @param name defines the name of the file, if the data is binary
824
- * @returns The loaded plugin
852
+ * @deprecated Please use AppendAsync instead
825
853
  */
826
854
  static Append(rootUrl, sceneFilename, scene, onSuccess, onProgress, onError, pluginExtension, name) {
827
- return append(rootUrl, sceneFilename, scene, onSuccess, onProgress, onError, pluginExtension, name);
855
+ appendAsync(rootUrl, sceneFilename, scene, onSuccess, onProgress, onError, pluginExtension, name);
828
856
  }
829
857
  /**
830
858
  * Append a scene
@@ -849,10 +877,10 @@ export class SceneLoader {
849
877
  * @param onError a callback with the scene, a message, and possibly an exception when import fails
850
878
  * @param pluginExtension the extension used to determine the plugin
851
879
  * @param name defines the filename, if the data is binary
852
- * @returns The loaded plugin
880
+ * @deprecated Please use LoadAssetContainerAsync instead
853
881
  */
854
882
  static LoadAssetContainer(rootUrl, sceneFilename, scene, onSuccess, onProgress, onError, pluginExtension, name) {
855
- return loadAssetContainer(rootUrl, sceneFilename, scene, onSuccess, onProgress, onError, pluginExtension, name);
883
+ loadAssetContainerCoreAsync(rootUrl, sceneFilename, scene, onSuccess, onProgress, onError, pluginExtension, name);
856
884
  }
857
885
  /**
858
886
  * Load a scene into an asset container
@@ -865,7 +893,7 @@ export class SceneLoader {
865
893
  * @returns The loaded asset container
866
894
  */
867
895
  static LoadAssetContainerAsync(rootUrl, sceneFilename, scene, onProgress, pluginExtension, name) {
868
- return loadAssetContainerAsyncCore(rootUrl, sceneFilename, scene, onProgress, pluginExtension, name);
896
+ return internalLoadAssetContainerAsync(rootUrl, sceneFilename, scene, onProgress, pluginExtension, name);
869
897
  }
870
898
  /**
871
899
  * Import animations from a file into a scene
@@ -880,6 +908,7 @@ export class SceneLoader {
880
908
  * @param onError a callback with the scene, a message, and possibly an exception when import fails
881
909
  * @param pluginExtension the extension used to determine the plugin
882
910
  * @param name defines the filename, if the data is binary
911
+ * @deprecated Please use ImportAnimationsAsync instead
883
912
  */
884
913
  static ImportAnimations(rootUrl, sceneFilename, scene, overwriteAnimations, animationGroupLoadingMode, targetConverter, onSuccess, onProgress, onError, pluginExtension, name) {
885
914
  importAnimations(rootUrl, sceneFilename, scene, overwriteAnimations, animationGroupLoadingMode, targetConverter, onSuccess, onProgress, onError, pluginExtension, name);