@babylonjs/core 7.19.1 → 7.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Buffers/buffer.nonFloatVertexBuffers.js +1 -1
- package/Buffers/buffer.nonFloatVertexBuffers.js.map +1 -1
- package/Collisions/gpuPicker.d.ts +8 -2
- package/Collisions/gpuPicker.js +41 -20
- package/Collisions/gpuPicker.js.map +1 -1
- package/Engines/Processors/shaderProcessor.d.ts +1 -0
- package/Engines/Processors/shaderProcessor.js +1 -0
- package/Engines/Processors/shaderProcessor.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.rawTexture.js +1 -0
- package/Engines/WebGPU/Extensions/engine.rawTexture.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessingContext.d.ts +1 -1
- package/Engines/WebGPU/webgpuShaderProcessingContext.js +4 -2
- package/Engines/WebGPU/webgpuShaderProcessingContext.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.d.ts +2 -1
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js +12 -5
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureManager.d.ts +1 -4
- package/Engines/WebGPU/webgpuTextureManager.js +90 -75
- package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
- package/Engines/abstractEngine.d.ts +2 -2
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/nativeEngine.d.ts +1 -1
- package/Engines/nativeEngine.js +2 -1
- package/Engines/nativeEngine.js.map +1 -1
- package/Engines/thinEngine.d.ts +1 -1
- package/Engines/thinEngine.functions.d.ts +1 -1
- package/Engines/thinEngine.functions.js +2 -1
- package/Engines/thinEngine.functions.js.map +1 -1
- package/Engines/thinEngine.js +2 -2
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/webgpuEngine.d.ts +9 -5
- package/Engines/webgpuEngine.js +35 -22
- package/Engines/webgpuEngine.js.map +1 -1
- package/Layers/effectLayer.d.ts +16 -1
- package/Layers/effectLayer.js +32 -2
- package/Layers/effectLayer.js.map +1 -1
- package/Layers/glowLayer.d.ts +1 -2
- package/Layers/glowLayer.js +16 -3
- package/Layers/glowLayer.js.map +1 -1
- package/Layers/highlightLayer.d.ts +5 -4
- package/Layers/highlightLayer.js +36 -11
- package/Layers/highlightLayer.js.map +1 -1
- package/Layers/index.d.ts +10 -0
- package/Layers/index.js +12 -0
- package/Layers/index.js.map +1 -1
- package/Lights/Shadows/index.d.ts +8 -0
- package/Lights/Shadows/index.js +9 -0
- package/Lights/Shadows/index.js.map +1 -1
- package/Lights/Shadows/shadowGenerator.d.ts +18 -5
- package/Lights/Shadows/shadowGenerator.js +44 -5
- package/Lights/Shadows/shadowGenerator.js.map +1 -1
- package/Loading/sceneLoader.d.ts +155 -16
- package/Loading/sceneLoader.js +197 -99
- package/Loading/sceneLoader.js.map +1 -1
- package/Materials/Node/nodeMaterial.js +8 -1
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/Node/nodeMaterialBuildState.js +1 -1
- package/Materials/Node/nodeMaterialBuildState.js.map +1 -1
- package/Materials/effect.functions.d.ts +1 -1
- package/Materials/effect.functions.js +6 -3
- package/Materials/effect.functions.js.map +1 -1
- package/Materials/effect.js +1 -1
- package/Materials/effect.js.map +1 -1
- package/Materials/standardMaterial.d.ts +1 -1
- package/Materials/standardMaterial.js +1 -1
- package/Materials/standardMaterial.js.map +1 -1
- package/Maths/math.constants.d.ts +1 -2
- package/Maths/math.constants.js +1 -2
- package/Maths/math.constants.js.map +1 -1
- package/Maths/math.like.d.ts +9 -0
- package/Maths/math.like.js.map +1 -1
- package/Maths/math.vector.d.ts +23 -23
- package/Maths/math.vector.js +43 -11
- package/Maths/math.vector.js.map +1 -1
- package/Misc/index.d.ts +4 -0
- package/Misc/index.js +5 -0
- package/Misc/index.js.map +1 -1
- package/Misc/rgbdTextureTools.d.ts +1 -0
- package/Misc/rgbdTextureTools.js +15 -2
- package/Misc/rgbdTextureTools.js.map +1 -1
- package/PostProcesses/blurPostProcess.d.ts +6 -0
- package/PostProcesses/blurPostProcess.js +21 -2
- package/PostProcesses/blurPostProcess.js.map +1 -1
- package/PostProcesses/index.d.ts +8 -0
- package/PostProcesses/index.js +10 -0
- package/PostProcesses/index.js.map +1 -1
- package/PostProcesses/passPostProcess.d.ts +2 -0
- package/PostProcesses/passPostProcess.js +26 -2
- package/PostProcesses/passPostProcess.js.map +1 -1
- package/PostProcesses/postProcess.d.ts +11 -2
- package/PostProcesses/postProcess.js +17 -1
- package/PostProcesses/postProcess.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/bayerDitherFunctions.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/bayerDitherFunctions.js +17 -0
- package/ShadersWGSL/ShadersInclude/bayerDitherFunctions.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/imageProcessingFunctions.js +1 -1
- package/ShadersWGSL/ShadersInclude/imageProcessingFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/kernelBlurFragment.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/kernelBlurFragment.js +20 -0
- package/ShadersWGSL/ShadersInclude/kernelBlurFragment.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/kernelBlurFragment2.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/kernelBlurFragment2.js +19 -0
- package/ShadersWGSL/ShadersInclude/kernelBlurFragment2.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/kernelBlurVaryingDeclaration.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/kernelBlurVaryingDeclaration.js +9 -0
- package/ShadersWGSL/ShadersInclude/kernelBlurVaryingDeclaration.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/kernelBlurVertex.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/kernelBlurVertex.js +9 -0
- package/ShadersWGSL/ShadersInclude/kernelBlurVertex.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/morphTargetsVertex.js +4 -4
- package/ShadersWGSL/ShadersInclude/morphTargetsVertex.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBRDFFunctions.js +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBRDFFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/shadowMapFragment.js +5 -5
- package/ShadersWGSL/ShadersInclude/shadowMapFragment.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/shadowMapFragmentExtraDeclaration.d.ts +7 -0
- package/ShadersWGSL/ShadersInclude/shadowMapFragmentExtraDeclaration.js +26 -0
- package/ShadersWGSL/ShadersInclude/shadowMapFragmentExtraDeclaration.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/shadowMapFragmentSoftTransparentShadow.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/shadowMapFragmentSoftTransparentShadow.js +12 -0
- package/ShadersWGSL/ShadersInclude/shadowMapFragmentSoftTransparentShadow.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/shadowMapVertexExtraDeclaration.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/shadowMapVertexExtraDeclaration.js +19 -0
- package/ShadersWGSL/ShadersInclude/shadowMapVertexExtraDeclaration.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/shadowMapVertexMetric.js +4 -4
- package/ShadersWGSL/ShadersInclude/shadowMapVertexMetric.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/shadowMapVertexNormalBias.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/shadowMapVertexNormalBias.js +17 -0
- package/ShadersWGSL/ShadersInclude/shadowMapVertexNormalBias.js.map +1 -0
- package/ShadersWGSL/default.fragment.js +2 -2
- package/ShadersWGSL/default.fragment.js.map +1 -1
- package/ShadersWGSL/depthBoxBlur.fragment.d.ts +5 -0
- package/ShadersWGSL/depthBoxBlur.fragment.js +14 -0
- package/ShadersWGSL/depthBoxBlur.fragment.js.map +1 -0
- package/ShadersWGSL/glowBlurPostProcess.fragment.d.ts +5 -0
- package/ShadersWGSL/glowBlurPostProcess.fragment.js +15 -0
- package/ShadersWGSL/glowBlurPostProcess.fragment.js.map +1 -0
- package/ShadersWGSL/glowMapGeneration.fragment.d.ts +8 -0
- package/ShadersWGSL/glowMapGeneration.fragment.js +74 -0
- package/ShadersWGSL/glowMapGeneration.fragment.js.map +1 -0
- package/ShadersWGSL/glowMapGeneration.vertex.d.ts +17 -0
- package/ShadersWGSL/glowMapGeneration.vertex.js +92 -0
- package/ShadersWGSL/glowMapGeneration.vertex.js.map +1 -0
- package/ShadersWGSL/glowMapMerge.fragment.d.ts +5 -0
- package/ShadersWGSL/glowMapMerge.fragment.js +32 -0
- package/ShadersWGSL/glowMapMerge.fragment.js.map +1 -0
- package/ShadersWGSL/glowMapMerge.vertex.d.ts +5 -0
- package/ShadersWGSL/glowMapMerge.vertex.js +16 -0
- package/ShadersWGSL/glowMapMerge.vertex.js.map +1 -0
- package/ShadersWGSL/kernelBlur.fragment.d.ts +9 -0
- package/ShadersWGSL/kernelBlur.fragment.js +48 -0
- package/ShadersWGSL/kernelBlur.fragment.js.map +1 -0
- package/ShadersWGSL/kernelBlur.vertex.d.ts +7 -0
- package/ShadersWGSL/kernelBlur.vertex.js +21 -0
- package/ShadersWGSL/kernelBlur.vertex.js.map +1 -0
- package/ShadersWGSL/pass.fragment.d.ts +5 -0
- package/ShadersWGSL/pass.fragment.js +12 -0
- package/ShadersWGSL/pass.fragment.js.map +1 -0
- package/ShadersWGSL/passCube.fragment.d.ts +5 -0
- package/ShadersWGSL/passCube.fragment.js +31 -0
- package/ShadersWGSL/passCube.fragment.js.map +1 -0
- package/ShadersWGSL/rgbdDecode.fragment.d.ts +6 -0
- package/ShadersWGSL/rgbdDecode.fragment.js +14 -0
- package/ShadersWGSL/rgbdDecode.fragment.js.map +1 -0
- package/ShadersWGSL/rgbdEncode.fragment.d.ts +6 -0
- package/ShadersWGSL/rgbdEncode.fragment.js +14 -0
- package/ShadersWGSL/rgbdEncode.fragment.js.map +1 -0
- package/ShadersWGSL/shadowMap.fragment.d.ts +9 -0
- package/ShadersWGSL/shadowMap.fragment.js +39 -0
- package/ShadersWGSL/shadowMap.fragment.js.map +1 -0
- package/ShadersWGSL/shadowMap.vertex.d.ts +22 -0
- package/ShadersWGSL/shadowMap.vertex.js +89 -0
- package/ShadersWGSL/shadowMap.vertex.js.map +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sceneLoader.js","sourceRoot":"","sources":["../../../../dev/core/src/Loading/sceneLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAMrD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAItD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAIpD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEzD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAgR3C;;GAEG;AACH,MAAM,CAAN,IAAkB,oCAoBjB;AApBD,WAAkB,oCAAoC;IAClD;;OAEG;IACH,iGAAS,CAAA;IAET;;OAEG;IACH,+FAAQ,CAAA;IAER;;OAEG;IACH,+FAAQ,CAAA;IAER;;OAEG;IACH,mGAAU,CAAA;AACd,CAAC,EApBiB,oCAAoC,KAApC,oCAAoC,QAoBrD;AAqDD;;;GAGG;AACH,MAAM,OAAO,WAAW;IAqBpB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yBAAyB,EACzB,eAAe,EACf,CAAC,MAAa,EAAE,EAAE;gBACd,OAAO,CAAC,MAAM,CAAC,CAAC;YACpB,CAAC,EACD,UAAU,EACV,CAAC,MAAa,EAAE,OAAe,EAAE,SAAc,EAAE,EAAE;gBAC/C,MAAM,CAAC,SAAS,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;YAC5C,CAAC,EACD,eAAe,CAClB,CAAC;QACN,CAAC,CAAC,CAAC;IACP,CAAC;;AApgCD;;GAEG;AACoB,sBAAU,GAAG,SAAS,CAAC,sBAAsB,CAAC;AAErE;;GAEG;AACoB,2BAAe,GAAG,SAAS,CAAC,2BAA2B,CAAC;AAE/E;;GAEG;AACoB,2BAAe,GAAG,SAAS,CAAC,2BAA2B,CAAC;AAE/E;;GAEG;AACoB,4BAAgB,GAAG,SAAS,CAAC,4BAA4B,CAAC;AAiDjF,UAAU;AAEV;;GAEG;AACW,uCAA2B,GAAG,IAAI,UAAU,EAAgD,CAAC;AAE5F,8BAAkB,GAA+C,EAAE,CAAC;AAEpE,iCAAqB,GAAG,KAAK,CAAC","sourcesContent":["import { Tools } from \"../Misc/tools\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport type { Nullable } from \"../types\";\r\nimport { Scene } from \"../scene\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { AnimationGroup } from \"../Animations/animationGroup\";\r\nimport type { AssetContainer } from \"../assetContainer\";\r\nimport type { IParticleSystem } from \"../Particles/IParticleSystem\";\r\nimport type { Skeleton } from \"../Bones/skeleton\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport { Constants } from \"../Engines/constants\";\r\nimport { SceneLoaderFlags } from \"./sceneLoaderFlags\";\r\nimport type { IFileRequest } from \"../Misc/fileRequest\";\r\nimport type { WebRequest } from \"../Misc/webRequest\";\r\nimport type { LoadFileError } from \"../Misc/fileTools\";\r\nimport { IsBase64DataUrl } from \"../Misc/fileTools\";\r\nimport type { TransformNode } from \"../Meshes/transformNode\";\r\nimport type { Geometry } from \"../Meshes/geometry\";\r\nimport type { Light } from \"../Lights/light\";\r\nimport { RuntimeError, ErrorCodes } from \"../Misc/error\";\r\nimport type { ISpriteManager } from \"../Sprites/spriteManager\";\r\nimport { RandomGUID } from \"../Misc/guid\";\r\nimport { Engine } from \"../Engines/engine\";\r\nimport type { AbstractEngine } from \"../Engines/abstractEngine\";\r\n\r\n/**\r\n * Type used for the success callback of ImportMesh\r\n */\r\nexport type SceneLoaderSuccessCallback = (\r\n meshes: AbstractMesh[],\r\n particleSystems: IParticleSystem[],\r\n skeletons: Skeleton[],\r\n animationGroups: AnimationGroup[],\r\n transformNodes: TransformNode[],\r\n geometries: Geometry[],\r\n lights: Light[],\r\n spriteManagers: ISpriteManager[]\r\n) => void;\r\n\r\n/**\r\n * Interface used for the result of ImportMeshAsync\r\n */\r\nexport interface ISceneLoaderAsyncResult {\r\n /**\r\n * The array of loaded meshes\r\n */\r\n readonly meshes: AbstractMesh[];\r\n\r\n /**\r\n * The array of loaded particle systems\r\n */\r\n readonly particleSystems: IParticleSystem[];\r\n\r\n /**\r\n * The array of loaded skeletons\r\n */\r\n readonly skeletons: Skeleton[];\r\n\r\n /**\r\n * The array of loaded animation groups\r\n */\r\n readonly animationGroups: AnimationGroup[];\r\n\r\n /**\r\n * The array of loaded transform nodes\r\n */\r\n readonly transformNodes: TransformNode[];\r\n\r\n /**\r\n * The array of loaded geometries\r\n */\r\n readonly geometries: Geometry[];\r\n\r\n /**\r\n * The array of loaded lights\r\n */\r\n readonly lights: Light[];\r\n\r\n /**\r\n * The array of loaded sprite managers\r\n */\r\n readonly spriteManagers: ISpriteManager[];\r\n}\r\n\r\n/**\r\n * Interface used to represent data loading progression\r\n */\r\nexport interface ISceneLoaderProgressEvent {\r\n /**\r\n * Defines if data length to load can be evaluated\r\n */\r\n readonly lengthComputable: boolean;\r\n\r\n /**\r\n * Defines the loaded data length\r\n */\r\n readonly loaded: number;\r\n\r\n /**\r\n * Defines the data length to load\r\n */\r\n readonly total: number;\r\n}\r\n\r\n/**\r\n * Interface used by SceneLoader plugins to define supported file extensions\r\n */\r\nexport interface ISceneLoaderPluginExtensions {\r\n /**\r\n * Defines the list of supported extensions\r\n */\r\n [extension: string]: {\r\n isBinary: boolean;\r\n };\r\n}\r\n\r\n/**\r\n * Interface used by SceneLoader plugin factory\r\n */\r\nexport interface ISceneLoaderPluginFactory {\r\n /**\r\n * Defines the name of the factory\r\n */\r\n name: string;\r\n\r\n /**\r\n * Function called to create a new plugin\r\n * @returns the new plugin\r\n */\r\n createPlugin(): ISceneLoaderPlugin | ISceneLoaderPluginAsync;\r\n\r\n /**\r\n * The callback that returns true if the data can be directly loaded.\r\n * @param data string containing the file data\r\n * @returns if the data can be loaded directly\r\n */\r\n canDirectLoad?(data: string): boolean;\r\n}\r\n\r\n/**\r\n * Interface used to define the base of ISceneLoaderPlugin and ISceneLoaderPluginAsync\r\n */\r\nexport interface ISceneLoaderPluginBase {\r\n /**\r\n * The friendly name of this plugin.\r\n */\r\n name: string;\r\n\r\n /**\r\n * The file extensions supported by this plugin.\r\n */\r\n extensions: string | ISceneLoaderPluginExtensions;\r\n\r\n /**\r\n * The callback called when loading from a url.\r\n * @param scene scene loading this url\r\n * @param fileOrUrl file or url to load\r\n * @param rootUrl root url to use to load assets\r\n * @param onSuccess callback called when the file successfully loads\r\n * @param onProgress callback called while file is loading (if the server supports this mode)\r\n * @param useArrayBuffer defines a boolean indicating that date must be returned as ArrayBuffer\r\n * @param onError callback called when the file fails to load\r\n * @param name defines the name of the file when loading a binary file\r\n * @returns a file request object\r\n */\r\n loadFile?(\r\n scene: Scene,\r\n fileOrUrl: File | string | ArrayBufferView,\r\n rootUrl: string,\r\n onSuccess: (data: unknown, responseURL?: string) => void,\r\n onProgress?: (ev: ISceneLoaderProgressEvent) => void,\r\n useArrayBuffer?: boolean,\r\n onError?: (request?: WebRequest, exception?: LoadFileError) => void,\r\n name?: string\r\n ): Nullable<IFileRequest>;\r\n\r\n /**\r\n * The callback that returns true if the data can be directly loaded.\r\n * @param data string containing the file data\r\n * @returns if the data can be loaded directly\r\n */\r\n canDirectLoad?(data: string): boolean;\r\n\r\n /**\r\n * The callback that returns the data to pass to the plugin if the data can be directly loaded.\r\n * @param scene scene loading this data\r\n * @param data string containing the data\r\n * @returns data to pass to the plugin\r\n */\r\n directLoad?(scene: Scene, data: string): unknown | Promise<unknown>;\r\n\r\n /**\r\n * The callback that allows custom handling of the root url based on the response url.\r\n * @param rootUrl the original root url\r\n * @param responseURL the response url if available\r\n * @returns the new root url\r\n */\r\n rewriteRootURL?(rootUrl: string, responseURL?: string): string;\r\n}\r\n\r\n/**\r\n * Interface used to define a SceneLoader plugin\r\n */\r\nexport interface ISceneLoaderPlugin extends ISceneLoaderPluginBase {\r\n /**\r\n * Import meshes into a scene.\r\n * @param meshesNames An array of mesh names, a single mesh name, or empty string for all meshes that filter what meshes are imported\r\n * @param scene The scene to import into\r\n * @param data The data to import\r\n * @param rootUrl The root url for scene and resources\r\n * @param meshes The meshes array to import into\r\n * @param particleSystems The particle systems array to import into\r\n * @param skeletons The skeletons array to import into\r\n * @param onError The callback when import fails\r\n * @returns True if successful or false otherwise\r\n */\r\n importMesh(\r\n meshesNames: string | readonly string[] | null | undefined,\r\n scene: Scene,\r\n data: unknown,\r\n rootUrl: string,\r\n meshes: AbstractMesh[],\r\n particleSystems: IParticleSystem[],\r\n skeletons: Skeleton[],\r\n onError?: (message: string, exception?: any) => void\r\n ): boolean;\r\n\r\n /**\r\n * Load into a scene.\r\n * @param scene The scene to load into\r\n * @param data The data to import\r\n * @param rootUrl The root url for scene and resources\r\n * @param onError The callback when import fails\r\n * @returns True if successful or false otherwise\r\n */\r\n load(scene: Scene, data: unknown, rootUrl: string, onError?: (message: string, exception?: any) => void): boolean;\r\n\r\n /**\r\n * Load into an asset container.\r\n * @param scene The scene to load into\r\n * @param data The data to import\r\n * @param rootUrl The root url for scene and resources\r\n * @param onError The callback when import fails\r\n * @returns The loaded asset container\r\n */\r\n loadAssetContainer(scene: Scene, data: unknown, rootUrl: string, onError?: (message: string, exception?: any) => void): AssetContainer;\r\n}\r\n\r\n/**\r\n * Interface used to define an async SceneLoader plugin\r\n */\r\nexport interface ISceneLoaderPluginAsync extends ISceneLoaderPluginBase {\r\n /**\r\n * Import meshes into a scene.\r\n * @param meshesNames An array of mesh names, a single mesh name, or empty string for all meshes that filter what meshes are imported\r\n * @param scene The scene to import into\r\n * @param data The data to import\r\n * @param rootUrl The root url for scene and resources\r\n * @param onProgress The callback when the load progresses\r\n * @param fileName Defines the name of the file to load\r\n * @returns The loaded objects (e.g. meshes, particle systems, skeletons, animation groups, etc.)\r\n */\r\n importMeshAsync(\r\n meshesNames: string | readonly string[] | null | undefined,\r\n scene: Scene,\r\n data: unknown,\r\n rootUrl: string,\r\n onProgress?: (event: ISceneLoaderProgressEvent) => void,\r\n fileName?: string\r\n ): Promise<ISceneLoaderAsyncResult>;\r\n\r\n /**\r\n * Load into a scene.\r\n * @param scene The scene to load into\r\n * @param data The data to import\r\n * @param rootUrl The root url for scene and resources\r\n * @param onProgress The callback when the load progresses\r\n * @param fileName Defines the name of the file to load\r\n * @returns Nothing\r\n */\r\n loadAsync(scene: Scene, data: unknown, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<void>;\r\n\r\n /**\r\n * Load into an asset container.\r\n * @param scene The scene to load into\r\n * @param data The data to import\r\n * @param rootUrl The root url for scene and resources\r\n * @param onProgress The callback when the load progresses\r\n * @param fileName Defines the name of the file to load\r\n * @returns The loaded asset container\r\n */\r\n loadAssetContainerAsync(scene: Scene, data: unknown, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<AssetContainer>;\r\n}\r\n\r\n/**\r\n * Mode that determines how to handle old animation groups before loading new ones.\r\n */\r\nexport const enum SceneLoaderAnimationGroupLoadingMode {\r\n /**\r\n * Reset all old animations to initial state then dispose them.\r\n */\r\n Clean = 0,\r\n\r\n /**\r\n * Stop all old animations.\r\n */\r\n Stop = 1,\r\n\r\n /**\r\n * Restart old animations from first frame.\r\n */\r\n Sync = 2,\r\n\r\n /**\r\n * Old animations remains untouched.\r\n */\r\n NoSync = 3,\r\n}\r\n\r\n/**\r\n * Defines internal only plugin members.\r\n */\r\ninterface ISceneLoaderPluginInternal {\r\n /**\r\n * An optional observable to notify when the plugin is disposed\r\n */\r\n readonly onDisposeObservable: Observable<void>;\r\n}\r\n\r\n/**\r\n * Defines a plugin registered by the SceneLoader\r\n */\r\ninterface IRegisteredPlugin {\r\n /**\r\n * Defines the plugin to use\r\n */\r\n plugin: (ISceneLoaderPlugin | ISceneLoaderPluginAsync) & Partial<ISceneLoaderPluginFactory> & Partial<ISceneLoaderPluginInternal>;\r\n /**\r\n * Defines if the plugin supports binary data\r\n */\r\n isBinary: boolean;\r\n}\r\n\r\n/**\r\n * Defines file information\r\n */\r\ninterface IFileInfo {\r\n /**\r\n * Gets the file url\r\n */\r\n url: string;\r\n /**\r\n * Gets the root url\r\n */\r\n rootUrl: string;\r\n /**\r\n * Gets filename\r\n */\r\n name: string;\r\n /**\r\n * Gets the file\r\n */\r\n file: Nullable<File>;\r\n\r\n /**\r\n * Gets raw binary data.\r\n */\r\n rawData: Nullable<ArrayBufferView>;\r\n}\r\n\r\n/**\r\n * Class used to load scene from various file formats using registered plugins\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/importers/loadingFileTypes\r\n */\r\nexport class SceneLoader {\r\n /**\r\n * No logging while loading\r\n */\r\n public static readonly NO_LOGGING = Constants.SCENELOADER_NO_LOGGING;\r\n\r\n /**\r\n * Minimal logging while loading\r\n */\r\n public static readonly MINIMAL_LOGGING = Constants.SCENELOADER_MINIMAL_LOGGING;\r\n\r\n /**\r\n * Summary logging while loading\r\n */\r\n public static readonly SUMMARY_LOGGING = Constants.SCENELOADER_SUMMARY_LOGGING;\r\n\r\n /**\r\n * Detailed logging while loading\r\n */\r\n public static readonly DETAILED_LOGGING = Constants.SCENELOADER_DETAILED_LOGGING;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if entire scene must be loaded even if scene contains incremental data\r\n */\r\n public static get ForceFullSceneLoadingForIncremental() {\r\n return SceneLoaderFlags.ForceFullSceneLoadingForIncremental;\r\n }\r\n\r\n public static set ForceFullSceneLoadingForIncremental(value: boolean) {\r\n SceneLoaderFlags.ForceFullSceneLoadingForIncremental = value;\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean indicating if loading screen must be displayed while loading a scene\r\n */\r\n public static get ShowLoadingScreen(): boolean {\r\n return SceneLoaderFlags.ShowLoadingScreen;\r\n }\r\n\r\n public static set ShowLoadingScreen(value: boolean) {\r\n SceneLoaderFlags.ShowLoadingScreen = value;\r\n }\r\n\r\n /**\r\n * Defines the current logging level (while loading the scene)\r\n * @ignorenaming\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public static get loggingLevel(): number {\r\n return SceneLoaderFlags.loggingLevel;\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public static set loggingLevel(value: number) {\r\n SceneLoaderFlags.loggingLevel = value;\r\n }\r\n\r\n /**\r\n * Gets or set a boolean indicating if matrix weights must be cleaned upon loading\r\n */\r\n public static get CleanBoneMatrixWeights(): boolean {\r\n return SceneLoaderFlags.CleanBoneMatrixWeights;\r\n }\r\n\r\n public static set CleanBoneMatrixWeights(value: boolean) {\r\n SceneLoaderFlags.CleanBoneMatrixWeights = value;\r\n }\r\n\r\n // Members\r\n\r\n /**\r\n * Event raised when a plugin is used to load a scene\r\n */\r\n public static OnPluginActivatedObservable = new Observable<ISceneLoaderPlugin | ISceneLoaderPluginAsync>();\r\n\r\n private static _RegisteredPlugins: { [extension: string]: IRegisteredPlugin } = {};\r\n\r\n private static _ShowingLoadingScreen = false;\r\n\r\n /**\r\n * Gets the default plugin (used to load Babylon files)\r\n * @returns the .babylon plugin\r\n */\r\n public static GetDefaultPlugin(): IRegisteredPlugin {\r\n return SceneLoader._RegisteredPlugins[\".babylon\"];\r\n }\r\n\r\n private static _GetPluginForExtension(extension: string): IRegisteredPlugin {\r\n const registeredPlugin = SceneLoader._RegisteredPlugins[extension];\r\n if (registeredPlugin) {\r\n return registeredPlugin;\r\n }\r\n Logger.Warn(\r\n \"Unable to find a plugin to load \" +\r\n extension +\r\n \" files. Trying to use .babylon default plugin. To load from a specific filetype (eg. gltf) see: https://doc.babylonjs.com/features/featuresDeepDive/importers/loadingFileTypes\"\r\n );\r\n return SceneLoader.GetDefaultPlugin();\r\n }\r\n\r\n private static _GetPluginForDirectLoad(data: string): IRegisteredPlugin {\r\n for (const extension in SceneLoader._RegisteredPlugins) {\r\n const plugin = SceneLoader._RegisteredPlugins[extension].plugin;\r\n\r\n if (plugin.canDirectLoad && plugin.canDirectLoad(data)) {\r\n return SceneLoader._RegisteredPlugins[extension];\r\n }\r\n }\r\n\r\n return SceneLoader.GetDefaultPlugin();\r\n }\r\n\r\n private static _GetPluginForFilename(sceneFilename: string): IRegisteredPlugin {\r\n const queryStringPosition = sceneFilename.indexOf(\"?\");\r\n\r\n if (queryStringPosition !== -1) {\r\n sceneFilename = sceneFilename.substring(0, queryStringPosition);\r\n }\r\n\r\n const dotPosition = sceneFilename.lastIndexOf(\".\");\r\n\r\n const extension = sceneFilename.substring(dotPosition, sceneFilename.length).toLowerCase();\r\n return SceneLoader._GetPluginForExtension(extension);\r\n }\r\n\r\n private static _GetDirectLoad(sceneFilename: string): Nullable<string> {\r\n if (sceneFilename.substr(0, 5) === \"data:\") {\r\n return sceneFilename.substr(5);\r\n }\r\n\r\n return null;\r\n }\r\n\r\n private static _FormatErrorMessage(fileInfo: IFileInfo, message?: string, exception?: any): string {\r\n const fromLoad = fileInfo.rawData ? \"binary data\" : fileInfo.url;\r\n let errorMessage = \"Unable to load from \" + fromLoad;\r\n\r\n if (message) {\r\n errorMessage += `: ${message}`;\r\n } else if (exception) {\r\n errorMessage += `: ${exception}`;\r\n }\r\n\r\n return errorMessage;\r\n }\r\n\r\n private static _LoadData(\r\n fileInfo: IFileInfo,\r\n scene: Scene,\r\n onSuccess: (plugin: ISceneLoaderPlugin | ISceneLoaderPluginAsync, data: unknown, responseURL?: string) => void,\r\n onProgress: ((event: ISceneLoaderProgressEvent) => void) | undefined,\r\n onError: (message?: string, exception?: any) => void,\r\n onDispose: () => void,\r\n pluginExtension: Nullable<string>,\r\n name: string\r\n ): Nullable<ISceneLoaderPlugin | ISceneLoaderPluginAsync> {\r\n const directLoad = SceneLoader._GetDirectLoad(fileInfo.url);\r\n\r\n if (fileInfo.rawData && !pluginExtension) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"When using ArrayBufferView to load data the file extension must be provided.\";\r\n }\r\n\r\n const registeredPlugin = pluginExtension\r\n ? SceneLoader._GetPluginForExtension(pluginExtension)\r\n : directLoad\r\n ? SceneLoader._GetPluginForDirectLoad(fileInfo.url)\r\n : SceneLoader._GetPluginForFilename(fileInfo.url);\r\n\r\n if (fileInfo.rawData && !registeredPlugin.isBinary) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"Loading from ArrayBufferView can not be used with plugins that don't support binary loading.\";\r\n }\r\n\r\n const plugin: IRegisteredPlugin[\"plugin\"] = registeredPlugin.plugin.createPlugin?.() ?? registeredPlugin.plugin;\r\n if (!plugin) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"The loader plugin corresponding to the file type you are trying to load has not been found. If using es6, please import the plugin you wish to use before.\";\r\n }\r\n\r\n SceneLoader.OnPluginActivatedObservable.notifyObservers(plugin);\r\n\r\n // Check if we have a direct load url. If the plugin is registered to handle\r\n // it or it's not a base64 data url, then pass it through the direct load path.\r\n if (directLoad && ((plugin.canDirectLoad && plugin.canDirectLoad(fileInfo.url)) || !IsBase64DataUrl(fileInfo.url))) {\r\n if (plugin.directLoad) {\r\n const result = plugin.directLoad(scene, directLoad);\r\n if (result instanceof Promise) {\r\n result\r\n .then((data: unknown) => {\r\n onSuccess(plugin, data);\r\n })\r\n .catch((error: any) => {\r\n onError(\"Error in directLoad of _loadData: \" + error, error);\r\n });\r\n } else {\r\n onSuccess(plugin, result);\r\n }\r\n } else {\r\n onSuccess(plugin, directLoad);\r\n }\r\n return plugin;\r\n }\r\n\r\n const useArrayBuffer = registeredPlugin.isBinary;\r\n\r\n const dataCallback = (data: unknown, responseURL?: string) => {\r\n if (scene.isDisposed) {\r\n onError(\"Scene has been disposed\");\r\n return;\r\n }\r\n\r\n onSuccess(plugin, data, responseURL);\r\n };\r\n\r\n let request: Nullable<IFileRequest> = null;\r\n let pluginDisposed = false;\r\n plugin.onDisposeObservable?.add(() => {\r\n pluginDisposed = true;\r\n\r\n if (request) {\r\n request.abort();\r\n request = null;\r\n }\r\n\r\n onDispose();\r\n });\r\n\r\n const manifestChecked = () => {\r\n if (pluginDisposed) {\r\n return;\r\n }\r\n\r\n const errorCallback = (request?: WebRequest, exception?: LoadFileError) => {\r\n onError(request?.statusText, exception);\r\n };\r\n\r\n if (!plugin.loadFile && fileInfo.rawData) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"Plugin does not support loading ArrayBufferView.\";\r\n }\r\n\r\n request = plugin.loadFile\r\n ? plugin.loadFile(scene, fileInfo.rawData || fileInfo.file || fileInfo.url, fileInfo.rootUrl, dataCallback, onProgress, useArrayBuffer, errorCallback, name)\r\n : scene._loadFile(fileInfo.file || fileInfo.url, dataCallback, onProgress, true, useArrayBuffer, errorCallback);\r\n };\r\n\r\n const engine = scene.getEngine();\r\n let canUseOfflineSupport = engine.enableOfflineSupport;\r\n if (canUseOfflineSupport) {\r\n // Also check for exceptions\r\n let exceptionFound = false;\r\n for (const regex of scene.disableOfflineSupportExceptionRules) {\r\n if (regex.test(fileInfo.url)) {\r\n exceptionFound = true;\r\n break;\r\n }\r\n }\r\n\r\n canUseOfflineSupport = !exceptionFound;\r\n }\r\n\r\n if (canUseOfflineSupport && Engine.OfflineProviderFactory) {\r\n // Checking if a manifest file has been set for this scene and if offline mode has been requested\r\n scene.offlineProvider = Engine.OfflineProviderFactory(fileInfo.url, manifestChecked, engine.disableManifestCheck);\r\n } else {\r\n manifestChecked();\r\n }\r\n\r\n return plugin;\r\n }\r\n\r\n private static _GetFileInfo(rootUrl: string, sceneFilename: string | File | ArrayBufferView): Nullable<IFileInfo> {\r\n let url: string;\r\n let name: string;\r\n let file: Nullable<File> = null;\r\n let rawData: Nullable<ArrayBufferView> = null;\r\n\r\n if (!sceneFilename) {\r\n url = rootUrl;\r\n name = Tools.GetFilename(rootUrl);\r\n rootUrl = Tools.GetFolderPath(rootUrl);\r\n } else if ((sceneFilename as File).name) {\r\n const sceneFile = sceneFilename as File;\r\n url = `file:${sceneFile.name}`;\r\n name = sceneFile.name;\r\n file = sceneFile;\r\n } else if (ArrayBuffer.isView(sceneFilename)) {\r\n url = \"\";\r\n name = RandomGUID();\r\n rawData = sceneFilename as ArrayBufferView;\r\n } else if (typeof sceneFilename === \"string\" && sceneFilename.startsWith(\"data:\")) {\r\n url = sceneFilename;\r\n name = \"\";\r\n } else {\r\n const filename = sceneFilename as string;\r\n if (filename.substr(0, 1) === \"/\") {\r\n Tools.Error(\"Wrong sceneFilename parameter\");\r\n return null;\r\n }\r\n\r\n url = rootUrl + filename;\r\n name = filename;\r\n }\r\n\r\n return {\r\n url: url,\r\n rootUrl: rootUrl,\r\n name: name,\r\n file: file,\r\n rawData,\r\n };\r\n }\r\n\r\n // Public functions\r\n\r\n /**\r\n * Gets a plugin that can load the given extension\r\n * @param extension defines the extension to load\r\n * @returns a plugin or null if none works\r\n */\r\n public static GetPluginForExtension(extension: string): ISceneLoaderPlugin | ISceneLoaderPluginAsync | ISceneLoaderPluginFactory {\r\n return SceneLoader._GetPluginForExtension(extension).plugin;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating that the given extension can be loaded\r\n * @param extension defines the extension to load\r\n * @returns true if the extension is supported\r\n */\r\n public static IsPluginForExtensionAvailable(extension: string): boolean {\r\n return !!SceneLoader._RegisteredPlugins[extension];\r\n }\r\n\r\n /**\r\n * Adds a new plugin to the list of registered plugins\r\n * @param plugin defines the plugin to add\r\n */\r\n public static RegisterPlugin(plugin: ISceneLoaderPlugin | ISceneLoaderPluginAsync): void {\r\n if (typeof plugin.extensions === \"string\") {\r\n const extension = <string>plugin.extensions;\r\n SceneLoader._RegisteredPlugins[extension.toLowerCase()] = {\r\n plugin: plugin,\r\n isBinary: false,\r\n };\r\n } else {\r\n const extensions = <ISceneLoaderPluginExtensions>plugin.extensions;\r\n Object.keys(extensions).forEach((extension) => {\r\n SceneLoader._RegisteredPlugins[extension.toLowerCase()] = {\r\n plugin: plugin,\r\n isBinary: extensions[extension].isBinary,\r\n };\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Import meshes into a scene\r\n * @param meshNames an array of mesh names, a single mesh name, or empty string for all meshes that filter what meshes are imported\r\n * @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)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param scene the instance of BABYLON.Scene to append to\r\n * @param onSuccess a callback with a list of imported meshes, particleSystems, skeletons, and animationGroups when import succeeds\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param onError a callback with the scene, a message, and possibly an exception when import fails\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @param name defines the name of the file, if the data is binary\r\n * @returns The loaded plugin\r\n */\r\n public static ImportMesh(\r\n meshNames: string | readonly string[] | null | undefined,\r\n rootUrl: string,\r\n sceneFilename: string | File | ArrayBufferView = \"\",\r\n scene: Nullable<Scene> = EngineStore.LastCreatedScene,\r\n onSuccess: Nullable<SceneLoaderSuccessCallback> = null,\r\n onProgress: Nullable<(event: ISceneLoaderProgressEvent) => void> = null,\r\n onError: Nullable<(scene: Scene, message: string, exception?: any) => void> = null,\r\n pluginExtension: Nullable<string> = null,\r\n name: string = \"\"\r\n ): Nullable<ISceneLoaderPlugin | ISceneLoaderPluginAsync> {\r\n if (!scene) {\r\n Logger.Error(\"No scene available to import mesh to\");\r\n return null;\r\n }\r\n\r\n const fileInfo = SceneLoader._GetFileInfo(rootUrl, sceneFilename);\r\n if (!fileInfo) {\r\n return null;\r\n }\r\n\r\n const loadingToken = {};\r\n scene.addPendingData(loadingToken);\r\n\r\n const disposeHandler = () => {\r\n scene.removePendingData(loadingToken);\r\n };\r\n\r\n const errorHandler = (message?: string, exception?: any) => {\r\n const errorMessage = SceneLoader._FormatErrorMessage(fileInfo, message, exception);\r\n\r\n if (onError) {\r\n onError(scene, errorMessage, new RuntimeError(errorMessage, ErrorCodes.SceneLoaderError, exception));\r\n } else {\r\n Logger.Error(errorMessage);\r\n // should the exception be thrown?\r\n }\r\n\r\n disposeHandler();\r\n };\r\n\r\n const progressHandler = onProgress\r\n ? (event: ISceneLoaderProgressEvent) => {\r\n try {\r\n onProgress(event);\r\n } catch (e) {\r\n errorHandler(\"Error in onProgress callback: \" + e, e);\r\n }\r\n }\r\n : undefined;\r\n\r\n const successHandler: SceneLoaderSuccessCallback = (meshes, particleSystems, skeletons, animationGroups, transformNodes, geometries, lights, spriteManagers) => {\r\n scene.importedMeshesFiles.push(fileInfo.url);\r\n\r\n if (onSuccess) {\r\n try {\r\n onSuccess(meshes, particleSystems, skeletons, animationGroups, transformNodes, geometries, lights, spriteManagers);\r\n } catch (e) {\r\n errorHandler(\"Error in onSuccess callback: \" + e, e);\r\n }\r\n }\r\n\r\n scene.removePendingData(loadingToken);\r\n };\r\n\r\n return SceneLoader._LoadData(\r\n fileInfo,\r\n scene,\r\n (plugin, data, responseURL) => {\r\n if (plugin.rewriteRootURL) {\r\n fileInfo.rootUrl = plugin.rewriteRootURL(fileInfo.rootUrl, responseURL);\r\n }\r\n\r\n if ((plugin as ISceneLoaderPlugin).importMesh) {\r\n const syncedPlugin = <ISceneLoaderPlugin>plugin;\r\n const meshes: AbstractMesh[] = [];\r\n const particleSystems: IParticleSystem[] = [];\r\n const skeletons: Skeleton[] = [];\r\n\r\n if (!syncedPlugin.importMesh(meshNames, scene, data, fileInfo.rootUrl, meshes, particleSystems, skeletons, errorHandler)) {\r\n return;\r\n }\r\n\r\n scene.loadingPluginName = plugin.name;\r\n successHandler(meshes, particleSystems, skeletons, [], [], [], [], []);\r\n } else {\r\n const asyncedPlugin = <ISceneLoaderPluginAsync>plugin;\r\n asyncedPlugin\r\n .importMeshAsync(meshNames, scene, data, fileInfo.rootUrl, progressHandler, fileInfo.name)\r\n .then((result) => {\r\n scene.loadingPluginName = plugin.name;\r\n successHandler(\r\n result.meshes,\r\n result.particleSystems,\r\n result.skeletons,\r\n result.animationGroups,\r\n result.transformNodes,\r\n result.geometries,\r\n result.lights,\r\n result.spriteManagers\r\n );\r\n })\r\n .catch((error) => {\r\n errorHandler(error.message, error);\r\n });\r\n }\r\n },\r\n progressHandler,\r\n errorHandler,\r\n disposeHandler,\r\n pluginExtension,\r\n name\r\n );\r\n }\r\n\r\n /**\r\n * Import meshes into a scene\r\n * @param meshNames an array of mesh names, a single mesh name, or empty string for all meshes that filter what meshes are imported\r\n * @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)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param scene the instance of BABYLON.Scene to append to\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @param name defines the name of the file\r\n * @returns The loaded list of imported meshes, particle systems, skeletons, and animation groups\r\n */\r\n public static ImportMeshAsync(\r\n meshNames: string | readonly string[] | null | undefined,\r\n rootUrl: string,\r\n sceneFilename: string | File | ArrayBufferView = \"\",\r\n scene: Nullable<Scene> = EngineStore.LastCreatedScene,\r\n onProgress: Nullable<(event: ISceneLoaderProgressEvent) => void> = null,\r\n pluginExtension: Nullable<string> = null,\r\n name: string = \"\"\r\n ): Promise<ISceneLoaderAsyncResult> {\r\n return new Promise((resolve, reject) => {\r\n SceneLoader.ImportMesh(\r\n meshNames,\r\n rootUrl,\r\n sceneFilename,\r\n scene,\r\n (meshes, particleSystems, skeletons, animationGroups, transformNodes, geometries, lights, spriteManagers) => {\r\n resolve({\r\n meshes: meshes,\r\n particleSystems: particleSystems,\r\n skeletons: skeletons,\r\n animationGroups: animationGroups,\r\n transformNodes: transformNodes,\r\n geometries: geometries,\r\n lights: lights,\r\n spriteManagers: spriteManagers,\r\n });\r\n },\r\n onProgress,\r\n (scene, message, exception) => {\r\n reject(exception || new Error(message));\r\n },\r\n pluginExtension,\r\n name\r\n );\r\n });\r\n }\r\n\r\n /**\r\n * Load a scene\r\n * @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)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param engine is the instance of BABYLON.Engine to use to create the scene\r\n * @param onSuccess a callback with the scene when import succeeds\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param onError a callback with the scene, a message, and possibly an exception when import fails\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @param name defines the filename, if the data is binary\r\n * @returns The loaded plugin\r\n */\r\n public static Load(\r\n rootUrl: string,\r\n sceneFilename: string | File | ArrayBufferView = \"\",\r\n engine: Nullable<AbstractEngine> = EngineStore.LastCreatedEngine,\r\n onSuccess: Nullable<(scene: Scene) => void> = null,\r\n onProgress: Nullable<(event: ISceneLoaderProgressEvent) => void> = null,\r\n onError: Nullable<(scene: Scene, message: string, exception?: any) => void> = null,\r\n pluginExtension: Nullable<string> = null,\r\n name: string = \"\"\r\n ): Nullable<ISceneLoaderPlugin | ISceneLoaderPluginAsync> {\r\n if (!engine) {\r\n Tools.Error(\"No engine available\");\r\n return null;\r\n }\r\n\r\n return SceneLoader.Append(rootUrl, sceneFilename, new Scene(engine), onSuccess, onProgress, onError, pluginExtension, name);\r\n }\r\n\r\n /**\r\n * Load a scene\r\n * @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)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param engine is the instance of BABYLON.Engine to use to create the scene\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @param name defines the filename, if the data is binary\r\n * @returns The loaded scene\r\n */\r\n public static LoadAsync(\r\n rootUrl: string,\r\n sceneFilename: string | File | ArrayBufferView = \"\",\r\n engine: Nullable<AbstractEngine> = EngineStore.LastCreatedEngine,\r\n onProgress: Nullable<(event: ISceneLoaderProgressEvent) => void> = null,\r\n pluginExtension: Nullable<string> = null,\r\n name: string = \"\"\r\n ): Promise<Scene> {\r\n return new Promise((resolve, reject) => {\r\n SceneLoader.Load(\r\n rootUrl,\r\n sceneFilename,\r\n engine,\r\n (scene) => {\r\n resolve(scene);\r\n },\r\n onProgress,\r\n (scene, message, exception) => {\r\n reject(exception || new Error(message));\r\n },\r\n pluginExtension,\r\n name\r\n );\r\n });\r\n }\r\n\r\n /**\r\n * Append a scene\r\n * @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)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param scene is the instance of BABYLON.Scene to append to\r\n * @param onSuccess a callback with the scene when import succeeds\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param onError a callback with the scene, a message, and possibly an exception when import fails\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @param name defines the name of the file, if the data is binary\r\n * @returns The loaded plugin\r\n */\r\n public static Append(\r\n rootUrl: string,\r\n sceneFilename: string | File | ArrayBufferView = \"\",\r\n scene: Nullable<Scene> = EngineStore.LastCreatedScene,\r\n onSuccess: Nullable<(scene: Scene) => void> = null,\r\n onProgress: Nullable<(event: ISceneLoaderProgressEvent) => void> = null,\r\n onError: Nullable<(scene: Scene, message: string, exception?: any) => void> = null,\r\n pluginExtension: Nullable<string> = null,\r\n name: string = \"\"\r\n ): Nullable<ISceneLoaderPlugin | ISceneLoaderPluginAsync> {\r\n if (!scene) {\r\n Logger.Error(\"No scene available to append to\");\r\n return null;\r\n }\r\n\r\n const fileInfo = SceneLoader._GetFileInfo(rootUrl, sceneFilename);\r\n if (!fileInfo) {\r\n return null;\r\n }\r\n\r\n const loadingToken = {};\r\n scene.addPendingData(loadingToken);\r\n\r\n const disposeHandler = () => {\r\n scene.removePendingData(loadingToken);\r\n };\r\n\r\n if (SceneLoader.ShowLoadingScreen && !this._ShowingLoadingScreen) {\r\n this._ShowingLoadingScreen = true;\r\n scene.getEngine().displayLoadingUI();\r\n scene.executeWhenReady(() => {\r\n scene.getEngine().hideLoadingUI();\r\n this._ShowingLoadingScreen = false;\r\n });\r\n }\r\n\r\n const errorHandler = (message?: string, exception?: any) => {\r\n const errorMessage = SceneLoader._FormatErrorMessage(fileInfo, message, exception);\r\n\r\n if (onError) {\r\n onError(scene, errorMessage, new RuntimeError(errorMessage, ErrorCodes.SceneLoaderError, exception));\r\n } else {\r\n Logger.Error(errorMessage);\r\n // should the exception be thrown?\r\n }\r\n\r\n disposeHandler();\r\n };\r\n\r\n const progressHandler = onProgress\r\n ? (event: ISceneLoaderProgressEvent) => {\r\n try {\r\n onProgress(event);\r\n } catch (e) {\r\n errorHandler(\"Error in onProgress callback\", e);\r\n }\r\n }\r\n : undefined;\r\n\r\n const successHandler = () => {\r\n if (onSuccess) {\r\n try {\r\n onSuccess(scene);\r\n } catch (e) {\r\n errorHandler(\"Error in onSuccess callback\", e);\r\n }\r\n }\r\n\r\n scene.removePendingData(loadingToken);\r\n };\r\n\r\n return SceneLoader._LoadData(\r\n fileInfo,\r\n scene,\r\n (plugin, data) => {\r\n if ((plugin as ISceneLoaderPlugin).load) {\r\n const syncedPlugin = <ISceneLoaderPlugin>plugin;\r\n if (!syncedPlugin.load(scene, data, fileInfo.rootUrl, errorHandler)) {\r\n return;\r\n }\r\n\r\n scene.loadingPluginName = plugin.name;\r\n successHandler();\r\n } else {\r\n const asyncedPlugin = <ISceneLoaderPluginAsync>plugin;\r\n asyncedPlugin\r\n .loadAsync(scene, data, fileInfo.rootUrl, progressHandler, fileInfo.name)\r\n .then(() => {\r\n scene.loadingPluginName = plugin.name;\r\n successHandler();\r\n })\r\n .catch((error) => {\r\n errorHandler(error.message, error);\r\n });\r\n }\r\n },\r\n progressHandler,\r\n errorHandler,\r\n disposeHandler,\r\n pluginExtension,\r\n name\r\n );\r\n }\r\n\r\n /**\r\n * Append a scene\r\n * @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)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param scene is the instance of BABYLON.Scene to append to\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @param name defines the name of the file, if the data is binary\r\n * @returns The given scene\r\n */\r\n public static AppendAsync(\r\n rootUrl: string,\r\n sceneFilename: string | File | ArrayBufferView = \"\",\r\n scene: Nullable<Scene> = EngineStore.LastCreatedScene,\r\n onProgress: Nullable<(event: ISceneLoaderProgressEvent) => void> = null,\r\n pluginExtension: Nullable<string> = null,\r\n name: string = \"\"\r\n ): Promise<Scene> {\r\n return new Promise((resolve, reject) => {\r\n SceneLoader.Append(\r\n rootUrl,\r\n sceneFilename,\r\n scene,\r\n (scene) => {\r\n resolve(scene);\r\n },\r\n onProgress,\r\n (scene, message, exception) => {\r\n reject(exception || new Error(message));\r\n },\r\n pluginExtension,\r\n name\r\n );\r\n });\r\n }\r\n\r\n /**\r\n * Load a scene into an asset container\r\n * @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)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param scene is the instance of BABYLON.Scene to append to (default: last created scene)\r\n * @param onSuccess a callback with the scene when import succeeds\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param onError a callback with the scene, a message, and possibly an exception when import fails\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @param name defines the filename, if the data is binary\r\n * @returns The loaded plugin\r\n */\r\n public static LoadAssetContainer(\r\n rootUrl: string,\r\n sceneFilename: string | File | ArrayBufferView = \"\",\r\n scene: Nullable<Scene> = EngineStore.LastCreatedScene,\r\n onSuccess: Nullable<(assets: AssetContainer) => void> = null,\r\n onProgress: Nullable<(event: ISceneLoaderProgressEvent) => void> = null,\r\n onError: Nullable<(scene: Scene, message: string, exception?: any) => void> = null,\r\n pluginExtension: Nullable<string> = null,\r\n name: string = \"\"\r\n ): Nullable<ISceneLoaderPlugin | ISceneLoaderPluginAsync> {\r\n if (!scene) {\r\n Logger.Error(\"No scene available to load asset container to\");\r\n return null;\r\n }\r\n\r\n const fileInfo = SceneLoader._GetFileInfo(rootUrl, sceneFilename);\r\n if (!fileInfo) {\r\n return null;\r\n }\r\n\r\n const loadingToken = {};\r\n scene.addPendingData(loadingToken);\r\n\r\n const disposeHandler = () => {\r\n scene.removePendingData(loadingToken);\r\n };\r\n\r\n const errorHandler = (message?: string, exception?: any) => {\r\n const errorMessage = SceneLoader._FormatErrorMessage(fileInfo, message, exception);\r\n\r\n if (onError) {\r\n onError(scene, errorMessage, new RuntimeError(errorMessage, ErrorCodes.SceneLoaderError, exception));\r\n } else {\r\n Logger.Error(errorMessage);\r\n // should the exception be thrown?\r\n }\r\n\r\n disposeHandler();\r\n };\r\n\r\n const progressHandler = onProgress\r\n ? (event: ISceneLoaderProgressEvent) => {\r\n try {\r\n onProgress(event);\r\n } catch (e) {\r\n errorHandler(\"Error in onProgress callback\", e);\r\n }\r\n }\r\n : undefined;\r\n\r\n const successHandler = (assets: AssetContainer) => {\r\n if (onSuccess) {\r\n try {\r\n onSuccess(assets);\r\n } catch (e) {\r\n errorHandler(\"Error in onSuccess callback\", e);\r\n }\r\n }\r\n\r\n scene.removePendingData(loadingToken);\r\n };\r\n\r\n return SceneLoader._LoadData(\r\n fileInfo,\r\n scene,\r\n (plugin, data) => {\r\n if ((plugin as ISceneLoaderPlugin).loadAssetContainer) {\r\n const syncedPlugin = <ISceneLoaderPlugin>plugin;\r\n const assetContainer = syncedPlugin.loadAssetContainer(scene, data, fileInfo.rootUrl, errorHandler);\r\n if (!assetContainer) {\r\n return;\r\n }\r\n assetContainer.populateRootNodes();\r\n scene.loadingPluginName = plugin.name;\r\n successHandler(assetContainer);\r\n } else if ((plugin as ISceneLoaderPluginAsync).loadAssetContainerAsync) {\r\n const asyncedPlugin = <ISceneLoaderPluginAsync>plugin;\r\n asyncedPlugin\r\n .loadAssetContainerAsync(scene, data, fileInfo.rootUrl, progressHandler, fileInfo.name)\r\n .then((assetContainer) => {\r\n assetContainer.populateRootNodes();\r\n scene.loadingPluginName = plugin.name;\r\n successHandler(assetContainer);\r\n })\r\n .catch((error) => {\r\n errorHandler(error.message, error);\r\n });\r\n } else {\r\n errorHandler(\"LoadAssetContainer is not supported by this plugin. Plugin did not provide a loadAssetContainer or loadAssetContainerAsync method.\");\r\n }\r\n },\r\n progressHandler,\r\n errorHandler,\r\n disposeHandler,\r\n pluginExtension,\r\n name\r\n );\r\n }\r\n\r\n /**\r\n * Load a scene into an asset container\r\n * @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)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene (default: empty string)\r\n * @param scene is the instance of Scene to append to\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @returns The loaded asset container\r\n */\r\n public static LoadAssetContainerAsync(\r\n rootUrl: string,\r\n sceneFilename: string | File = \"\",\r\n scene: Nullable<Scene> = EngineStore.LastCreatedScene,\r\n onProgress: Nullable<(event: ISceneLoaderProgressEvent) => void> = null,\r\n pluginExtension: Nullable<string> = null\r\n ): Promise<AssetContainer> {\r\n return new Promise((resolve, reject) => {\r\n SceneLoader.LoadAssetContainer(\r\n rootUrl,\r\n sceneFilename,\r\n scene,\r\n (assetContainer) => {\r\n resolve(assetContainer);\r\n },\r\n onProgress,\r\n (scene, message, exception) => {\r\n reject(exception || new Error(message));\r\n },\r\n pluginExtension\r\n );\r\n });\r\n }\r\n\r\n /**\r\n * Import animations from a file into a scene\r\n * @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)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param scene is the instance of BABYLON.Scene to append to (default: last created scene)\r\n * @param overwriteAnimations when true, animations are cleaned before importing new ones. Animations are appended otherwise\r\n * @param animationGroupLoadingMode defines how to handle old animations groups before importing new ones\r\n * @param targetConverter defines a function used to convert animation targets from loaded scene to current scene (default: search node by name)\r\n * @param onSuccess a callback with the scene when import succeeds\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param onError a callback with the scene, a message, and possibly an exception when import fails\r\n * @param pluginExtension the extension used to determine the plugin\r\n */\r\n public static ImportAnimations(\r\n rootUrl: string,\r\n sceneFilename: string | File = \"\",\r\n scene: Nullable<Scene> = EngineStore.LastCreatedScene,\r\n overwriteAnimations = true,\r\n animationGroupLoadingMode = SceneLoaderAnimationGroupLoadingMode.Clean,\r\n targetConverter: Nullable<(target: any) => any> = null,\r\n onSuccess: Nullable<(scene: Scene) => void> = null,\r\n onProgress: Nullable<(event: ISceneLoaderProgressEvent) => void> = null,\r\n onError: Nullable<(scene: Scene, message: string, exception?: any) => void> = null,\r\n pluginExtension: Nullable<string> = null\r\n ): void {\r\n if (!scene) {\r\n Logger.Error(\"No scene available to load animations to\");\r\n return;\r\n }\r\n\r\n if (overwriteAnimations) {\r\n // Reset, stop and dispose all animations before loading new ones\r\n for (const animatable of scene.animatables) {\r\n animatable.reset();\r\n }\r\n scene.stopAllAnimations();\r\n scene.animationGroups.slice().forEach((animationGroup) => {\r\n animationGroup.dispose();\r\n });\r\n const nodes = scene.getNodes();\r\n nodes.forEach((node) => {\r\n if (node.animations) {\r\n node.animations = [];\r\n }\r\n });\r\n } else {\r\n switch (animationGroupLoadingMode) {\r\n case SceneLoaderAnimationGroupLoadingMode.Clean:\r\n scene.animationGroups.slice().forEach((animationGroup) => {\r\n animationGroup.dispose();\r\n });\r\n break;\r\n case SceneLoaderAnimationGroupLoadingMode.Stop:\r\n scene.animationGroups.forEach((animationGroup) => {\r\n animationGroup.stop();\r\n });\r\n break;\r\n case SceneLoaderAnimationGroupLoadingMode.Sync:\r\n scene.animationGroups.forEach((animationGroup) => {\r\n animationGroup.reset();\r\n animationGroup.restart();\r\n });\r\n break;\r\n case SceneLoaderAnimationGroupLoadingMode.NoSync:\r\n // nothing to do\r\n break;\r\n default:\r\n Logger.Error(\"Unknown animation group loading mode value '\" + animationGroupLoadingMode + \"'\");\r\n return;\r\n }\r\n }\r\n\r\n const startingIndexForNewAnimatables = scene.animatables.length;\r\n\r\n const onAssetContainerLoaded = (container: AssetContainer) => {\r\n container.mergeAnimationsTo(scene, scene.animatables.slice(startingIndexForNewAnimatables), targetConverter);\r\n\r\n container.dispose();\r\n\r\n scene.onAnimationFileImportedObservable.notifyObservers(scene);\r\n\r\n if (onSuccess) {\r\n onSuccess(scene);\r\n }\r\n };\r\n\r\n this.LoadAssetContainer(rootUrl, sceneFilename, scene, onAssetContainerLoaded, onProgress, onError, pluginExtension);\r\n }\r\n\r\n /**\r\n * Import animations from a file into a scene\r\n * @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)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param scene is the instance of BABYLON.Scene to append to (default: last created scene)\r\n * @param overwriteAnimations when true, animations are cleaned before importing new ones. Animations are appended otherwise\r\n * @param animationGroupLoadingMode defines how to handle old animations groups before importing new ones\r\n * @param targetConverter defines a function used to convert animation targets from loaded scene to current scene (default: search node by name)\r\n * @param onSuccess a callback with the scene when import succeeds\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param onError a callback with the scene, a message, and possibly an exception when import fails\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @returns the updated scene with imported animations\r\n */\r\n public static ImportAnimationsAsync(\r\n rootUrl: string,\r\n sceneFilename: string | File = \"\",\r\n scene: Nullable<Scene> = EngineStore.LastCreatedScene,\r\n overwriteAnimations = true,\r\n animationGroupLoadingMode = SceneLoaderAnimationGroupLoadingMode.Clean,\r\n targetConverter: Nullable<(target: any) => any> = null,\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n onSuccess: Nullable<(scene: Scene) => void> = null,\r\n onProgress: Nullable<(event: ISceneLoaderProgressEvent) => void> = null,\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n onError: Nullable<(scene: Scene, message: string, exception?: any) => void> = null,\r\n pluginExtension: Nullable<string> = null\r\n ): Promise<Scene> {\r\n return new Promise((resolve, reject) => {\r\n SceneLoader.ImportAnimations(\r\n rootUrl,\r\n sceneFilename,\r\n scene,\r\n overwriteAnimations,\r\n animationGroupLoadingMode,\r\n targetConverter,\r\n (_scene: Scene) => {\r\n resolve(_scene);\r\n },\r\n onProgress,\r\n (_scene: Scene, message: string, exception: any) => {\r\n reject(exception || new Error(message));\r\n },\r\n pluginExtension\r\n );\r\n });\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"sceneLoader.js","sourceRoot":"","sources":["../../../../dev/core/src/Loading/sceneLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAC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AAE,IAAI,EAAE,aAAa,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;SACzJ;aAAM;YACH,+DAA+D;YAC/D,CAAC,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,eAAe,EAAE,AAAD,EAAG,UAAU,EAAE,AAAD,EAAG,eAAe,EAAE,IAAI,CAAC,GAAG,IAAI,CAAC;SAClJ;QAED,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACnC,WAAW,CAAC,iBAAiB,CACzB,OAAO,EACP,aAAa,EACb,KAAK,EACL,mBAAmB,EACnB,yBAAyB,EACzB,eAAe,EACf,CAAC,MAAa,EAAE,EAAE;gBACd,OAAO,CAAC,MAAM,CAAC,CAAC;YACpB,CAAC,EACD,UAAU,EACV,CAAC,MAAa,EAAE,OAAe,EAAE,SAAc,EAAE,EAAE;gBAC/C,MAAM,CAAC,SAAS,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;YAC5C,CAAC,EACD,eAAe,EACf,IAAI,EACJ,aAAa,CAChB,CAAC;QACN,CAAC,CAAC,CAAC;IACP,CAAC;;AAp3CD;;GAEG;AACoB,sBAAU,GAAG,SAAS,CAAC,sBAAsB,CAAC;AAErE;;GAEG;AACoB,2BAAe,GAAG,SAAS,CAAC,2BAA2B,CAAC;AAE/E;;GAEG;AACoB,2BAAe,GAAG,SAAS,CAAC,2BAA2B,CAAC;AAE/E;;GAEG;AACoB,4BAAgB,GAAG,SAAS,CAAC,4BAA4B,CAAC;AAiDjF,UAAU;AAEV;;GAEG;AACW,uCAA2B,GAAG,IAAI,UAAU,EAAgD,CAAC;AAE5F,8BAAkB,GAA+C,EAAE,CAAC;AAEpE,iCAAqB,GAAG,KAAK,CAAC","sourcesContent":["import { Tools } from \"../Misc/tools\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport type { Nullable } from \"../types\";\r\nimport { Scene } from \"../scene\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { AnimationGroup } from \"../Animations/animationGroup\";\r\nimport type { AssetContainer } from \"../assetContainer\";\r\nimport type { IParticleSystem } from \"../Particles/IParticleSystem\";\r\nimport type { Skeleton } from \"../Bones/skeleton\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport { Constants } from \"../Engines/constants\";\r\nimport { SceneLoaderFlags } from \"./sceneLoaderFlags\";\r\nimport type { IFileRequest } from \"../Misc/fileRequest\";\r\nimport type { WebRequest } from \"../Misc/webRequest\";\r\nimport type { LoadFileError } from \"../Misc/fileTools\";\r\nimport { IsBase64DataUrl } from \"../Misc/fileTools\";\r\nimport type { TransformNode } from \"../Meshes/transformNode\";\r\nimport type { Geometry } from \"../Meshes/geometry\";\r\nimport type { Light } from \"../Lights/light\";\r\nimport { RuntimeError, ErrorCodes } from \"../Misc/error\";\r\nimport type { ISpriteManager } from \"../Sprites/spriteManager\";\r\nimport { RandomGUID } from \"../Misc/guid\";\r\nimport { Engine } from \"../Engines/engine\";\r\nimport { AbstractEngine } from \"../Engines/abstractEngine\";\r\n\r\n/**\r\n * Type used for the success callback of ImportMesh\r\n */\r\nexport type SceneLoaderSuccessCallback = (\r\n meshes: AbstractMesh[],\r\n particleSystems: IParticleSystem[],\r\n skeletons: Skeleton[],\r\n animationGroups: AnimationGroup[],\r\n transformNodes: TransformNode[],\r\n geometries: Geometry[],\r\n lights: Light[],\r\n spriteManagers: ISpriteManager[]\r\n) => void;\r\n\r\n/**\r\n * Interface used for the result of ImportMeshAsync\r\n */\r\nexport interface ISceneLoaderAsyncResult {\r\n /**\r\n * The array of loaded meshes\r\n */\r\n readonly meshes: AbstractMesh[];\r\n\r\n /**\r\n * The array of loaded particle systems\r\n */\r\n readonly particleSystems: IParticleSystem[];\r\n\r\n /**\r\n * The array of loaded skeletons\r\n */\r\n readonly skeletons: Skeleton[];\r\n\r\n /**\r\n * The array of loaded animation groups\r\n */\r\n readonly animationGroups: AnimationGroup[];\r\n\r\n /**\r\n * The array of loaded transform nodes\r\n */\r\n readonly transformNodes: TransformNode[];\r\n\r\n /**\r\n * The array of loaded geometries\r\n */\r\n readonly geometries: Geometry[];\r\n\r\n /**\r\n * The array of loaded lights\r\n */\r\n readonly lights: Light[];\r\n\r\n /**\r\n * The array of loaded sprite managers\r\n */\r\n readonly spriteManagers: ISpriteManager[];\r\n}\r\n\r\n/**\r\n * Interface used to represent data loading progression\r\n */\r\nexport interface ISceneLoaderProgressEvent {\r\n /**\r\n * Defines if data length to load can be evaluated\r\n */\r\n readonly lengthComputable: boolean;\r\n\r\n /**\r\n * Defines the loaded data length\r\n */\r\n readonly loaded: number;\r\n\r\n /**\r\n * Defines the data length to load\r\n */\r\n readonly total: number;\r\n}\r\n\r\n/**\r\n * Interface used by SceneLoader plugins to define supported file extensions\r\n */\r\nexport interface ISceneLoaderPluginExtensions {\r\n /**\r\n * Defines the list of supported extensions\r\n */\r\n readonly [extension: string]: {\r\n isBinary: boolean;\r\n };\r\n}\r\n\r\n/**\r\n * Interface used by SceneLoader plugin factory\r\n */\r\nexport interface ISceneLoaderPluginFactory {\r\n /**\r\n * Defines the name of the factory\r\n */\r\n readonly name: string;\r\n\r\n /**\r\n * Function called to create a new plugin\r\n * @param options plugin options that were passed to the SceneLoader operation\r\n * @returns the new plugin\r\n */\r\n createPlugin(options: SceneLoaderPluginOptions): ISceneLoaderPlugin | ISceneLoaderPluginAsync;\r\n\r\n /**\r\n * The callback that returns true if the data can be directly loaded.\r\n * @param data string containing the file data\r\n * @returns if the data can be loaded directly\r\n */\r\n canDirectLoad?(data: string): boolean;\r\n}\r\n\r\n/**\r\n * Interface used to define the base of ISceneLoaderPlugin and ISceneLoaderPluginAsync\r\n */\r\nexport interface ISceneLoaderPluginBase {\r\n /**\r\n * The friendly name of this plugin.\r\n */\r\n readonly name: string;\r\n\r\n /**\r\n * The file extensions supported by this plugin.\r\n */\r\n readonly extensions: string | ISceneLoaderPluginExtensions;\r\n\r\n /**\r\n * The callback called when loading from a url.\r\n * @param scene scene loading this url\r\n * @param fileOrUrl file or url to load\r\n * @param rootUrl root url to use to load assets\r\n * @param onSuccess callback called when the file successfully loads\r\n * @param onProgress callback called while file is loading (if the server supports this mode)\r\n * @param useArrayBuffer defines a boolean indicating that date must be returned as ArrayBuffer\r\n * @param onError callback called when the file fails to load\r\n * @param name defines the name of the file when loading a binary file\r\n * @returns a file request object\r\n */\r\n loadFile?(\r\n scene: Scene,\r\n fileOrUrl: File | string | ArrayBufferView,\r\n rootUrl: string,\r\n onSuccess: (data: unknown, responseURL?: string) => void,\r\n onProgress?: (ev: ISceneLoaderProgressEvent) => void,\r\n useArrayBuffer?: boolean,\r\n onError?: (request?: WebRequest, exception?: LoadFileError) => void,\r\n name?: string\r\n ): Nullable<IFileRequest>;\r\n\r\n /**\r\n * The callback that returns true if the data can be directly loaded.\r\n * @param data string containing the file data\r\n * @returns if the data can be loaded directly\r\n */\r\n canDirectLoad?(data: string): boolean;\r\n\r\n /**\r\n * The callback that returns the data to pass to the plugin if the data can be directly loaded.\r\n * @param scene scene loading this data\r\n * @param data string containing the data\r\n * @returns data to pass to the plugin\r\n */\r\n directLoad?(scene: Scene, data: string): unknown | Promise<unknown>;\r\n\r\n /**\r\n * The callback that allows custom handling of the root url based on the response url.\r\n * @param rootUrl the original root url\r\n * @param responseURL the response url if available\r\n * @returns the new root url\r\n */\r\n rewriteRootURL?(rootUrl: string, responseURL?: string): string;\r\n}\r\n\r\n/**\r\n * Interface used to define a SceneLoader plugin\r\n */\r\nexport interface ISceneLoaderPlugin extends ISceneLoaderPluginBase {\r\n /**\r\n * Import meshes into a scene.\r\n * @param meshesNames An array of mesh names, a single mesh name, or empty string for all meshes that filter what meshes are imported\r\n * @param scene The scene to import into\r\n * @param data The data to import\r\n * @param rootUrl The root url for scene and resources\r\n * @param meshes The meshes array to import into\r\n * @param particleSystems The particle systems array to import into\r\n * @param skeletons The skeletons array to import into\r\n * @param onError The callback when import fails\r\n * @returns True if successful or false otherwise\r\n */\r\n importMesh(\r\n meshesNames: string | readonly string[] | null | undefined,\r\n scene: Scene,\r\n data: unknown,\r\n rootUrl: string,\r\n meshes: AbstractMesh[],\r\n particleSystems: IParticleSystem[],\r\n skeletons: Skeleton[],\r\n onError?: (message: string, exception?: any) => void\r\n ): boolean;\r\n\r\n /**\r\n * Load into a scene.\r\n * @param scene The scene to load into\r\n * @param data The data to import\r\n * @param rootUrl The root url for scene and resources\r\n * @param onError The callback when import fails\r\n * @returns True if successful or false otherwise\r\n */\r\n load(scene: Scene, data: unknown, rootUrl: string, onError?: (message: string, exception?: any) => void): boolean;\r\n\r\n /**\r\n * Load into an asset container.\r\n * @param scene The scene to load into\r\n * @param data The data to import\r\n * @param rootUrl The root url for scene and resources\r\n * @param onError The callback when import fails\r\n * @returns The loaded asset container\r\n */\r\n loadAssetContainer(scene: Scene, data: unknown, rootUrl: string, onError?: (message: string, exception?: any) => void): AssetContainer;\r\n}\r\n\r\n/**\r\n * Interface used to define an async SceneLoader plugin\r\n */\r\nexport interface ISceneLoaderPluginAsync extends ISceneLoaderPluginBase {\r\n /**\r\n * Import meshes into a scene.\r\n * @param meshesNames An array of mesh names, a single mesh name, or empty string for all meshes that filter what meshes are imported\r\n * @param scene The scene to import into\r\n * @param data The data to import\r\n * @param rootUrl The root url for scene and resources\r\n * @param onProgress The callback when the load progresses\r\n * @param fileName Defines the name of the file to load\r\n * @returns The loaded objects (e.g. meshes, particle systems, skeletons, animation groups, etc.)\r\n */\r\n importMeshAsync(\r\n meshesNames: string | readonly string[] | null | undefined,\r\n scene: Scene,\r\n data: unknown,\r\n rootUrl: string,\r\n onProgress?: (event: ISceneLoaderProgressEvent) => void,\r\n fileName?: string\r\n ): Promise<ISceneLoaderAsyncResult>;\r\n\r\n /**\r\n * Load into a scene.\r\n * @param scene The scene to load into\r\n * @param data The data to import\r\n * @param rootUrl The root url for scene and resources\r\n * @param onProgress The callback when the load progresses\r\n * @param fileName Defines the name of the file to load\r\n * @returns Nothing\r\n */\r\n loadAsync(scene: Scene, data: unknown, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<void>;\r\n\r\n /**\r\n * Load into an asset container.\r\n * @param scene The scene to load into\r\n * @param data The data to import\r\n * @param rootUrl The root url for scene and resources\r\n * @param onProgress The callback when the load progresses\r\n * @param fileName Defines the name of the file to load\r\n * @returns The loaded asset container\r\n */\r\n loadAssetContainerAsync(scene: Scene, data: unknown, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<AssetContainer>;\r\n}\r\n\r\n/**\r\n * Mode that determines how to handle old animation groups before loading new ones.\r\n */\r\nexport const enum SceneLoaderAnimationGroupLoadingMode {\r\n /**\r\n * Reset all old animations to initial state then dispose them.\r\n */\r\n Clean = 0,\r\n\r\n /**\r\n * Stop all old animations.\r\n */\r\n Stop = 1,\r\n\r\n /**\r\n * Restart old animations from first frame.\r\n */\r\n Sync = 2,\r\n\r\n /**\r\n * Old animations remains untouched.\r\n */\r\n NoSync = 3,\r\n}\r\n\r\n/**\r\n * Defines internal only plugin members.\r\n */\r\ninterface ISceneLoaderPluginInternal {\r\n /**\r\n * An optional observable to notify when the plugin is disposed\r\n */\r\n readonly onDisposeObservable: Observable<void>;\r\n}\r\n\r\n/**\r\n * Defines a plugin registered by the SceneLoader\r\n */\r\ninterface IRegisteredPlugin {\r\n /**\r\n * Defines the plugin to use\r\n */\r\n plugin: (ISceneLoaderPlugin | ISceneLoaderPluginAsync) & Partial<ISceneLoaderPluginFactory> & Partial<ISceneLoaderPluginInternal>;\r\n /**\r\n * Defines if the plugin supports binary data\r\n */\r\n isBinary: boolean;\r\n}\r\n\r\n/**\r\n * Defines file information\r\n */\r\ninterface IFileInfo {\r\n /**\r\n * Gets the file url\r\n */\r\n url: string;\r\n /**\r\n * Gets the root url\r\n */\r\n rootUrl: string;\r\n /**\r\n * Gets filename\r\n */\r\n name: string;\r\n /**\r\n * Gets the file\r\n */\r\n file: Nullable<File>;\r\n\r\n /**\r\n * Gets raw binary data.\r\n */\r\n rawData: Nullable<ArrayBufferView>;\r\n}\r\n\r\n/**\r\n * Defines options for SceneLoader plugins. This interface is extended by specific plugins.\r\n */\r\nexport interface SceneLoaderPluginOptions extends Record<string, Record<string, unknown> | undefined> {}\r\n\r\n/**\r\n * Adds default/implicit options to plugin specific options.\r\n */\r\ntype DefaultPluginOptions<BasePluginOptions> = {\r\n /**\r\n * Defines if the plugin is enabled\r\n */\r\n enabled?: boolean;\r\n} & BasePluginOptions;\r\n\r\n// This captures the type defined inline for the pluginOptions property, which is just SceneLoaderPluginOptions wrapped with DefaultPluginOptions.\r\n// We do it this way rather than explicitly defining the type here and then using it in SceneLoaderOptions because we want the full expanded type\r\n// to show up in the user's intellisense to make it easier to understand what options are available.\r\ntype PluginOptions = SceneLoaderOptions[\"pluginOptions\"];\r\n\r\ntype SceneSource = string | File | ArrayBufferView;\r\n\r\n/**\r\n * Defines common options for loading operations performed by SceneLoader.\r\n */\r\ninterface SceneLoaderOptions {\r\n /**\r\n * 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)\r\n */\r\n rootUrl?: string;\r\n\r\n /**\r\n * A callback with a progress event for each file being loaded\r\n */\r\n onProgress?: (event: ISceneLoaderProgressEvent) => void;\r\n\r\n /**\r\n * The extension used to determine the plugin\r\n */\r\n pluginExtension?: string;\r\n\r\n /**\r\n * Defines the filename, if the data is binary\r\n */\r\n name?: string;\r\n\r\n /**\r\n * Defines options for the registered plugins\r\n */\r\n pluginOptions?: {\r\n // NOTE: This type is doing two things:\r\n // 1. Adding an implicit 'enabled' property to the options for each plugin.\r\n // 2. Creating a mapped type of all the options of all the plugins to make it just look like a consolidated plain object in intellisense for the user.\r\n [Plugin in keyof SceneLoaderPluginOptions]: {\r\n [Option in keyof DefaultPluginOptions<SceneLoaderPluginOptions[Plugin]>]: DefaultPluginOptions<SceneLoaderPluginOptions[Plugin]>[Option];\r\n };\r\n };\r\n}\r\n\r\n/**\r\n * Defines options for ImportMeshAsync.\r\n */\r\nexport interface ImportMeshOptions extends SceneLoaderOptions {\r\n /**\r\n * An array of mesh names, a single mesh name, or empty string for all meshes that filter what meshes are imported\r\n */\r\n meshNames?: string | readonly string[] | null | undefined;\r\n}\r\n\r\n/**\r\n * Defines options for LoadAsync.\r\n */\r\nexport interface LoadOptions extends SceneLoaderOptions {}\r\n\r\n/**\r\n * Defines options for AppendAsync.\r\n */\r\nexport interface AppendOptions extends SceneLoaderOptions {}\r\n\r\n/**\r\n * Defines options for LoadAssetContainerAsync.\r\n */\r\nexport interface LoadAssetContainerOptions extends SceneLoaderOptions {}\r\n\r\n/**\r\n * Defines options for ImportAnimationsAsync.\r\n */\r\nexport interface ImportAnimationsOptions extends SceneLoaderOptions {\r\n /**\r\n * When true, animations are cleaned before importing new ones. Animations are appended otherwise\r\n */\r\n overwriteAnimations?: boolean;\r\n\r\n /**\r\n * Defines how to handle old animations groups before importing new ones\r\n */\r\n animationGroupLoadingMode?: SceneLoaderAnimationGroupLoadingMode;\r\n\r\n /**\r\n * defines a function used to convert animation targets from loaded scene to current scene (default: search node by name)\r\n */\r\n targetConverter?: Nullable<(target: unknown) => unknown>;\r\n}\r\n\r\nfunction isFile(value: unknown): value is File {\r\n return !!(value as File).name;\r\n}\r\n\r\n/**\r\n * Class used to load scene from various file formats using registered plugins\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/importers/loadingFileTypes\r\n */\r\nexport class SceneLoader {\r\n /**\r\n * No logging while loading\r\n */\r\n public static readonly NO_LOGGING = Constants.SCENELOADER_NO_LOGGING;\r\n\r\n /**\r\n * Minimal logging while loading\r\n */\r\n public static readonly MINIMAL_LOGGING = Constants.SCENELOADER_MINIMAL_LOGGING;\r\n\r\n /**\r\n * Summary logging while loading\r\n */\r\n public static readonly SUMMARY_LOGGING = Constants.SCENELOADER_SUMMARY_LOGGING;\r\n\r\n /**\r\n * Detailed logging while loading\r\n */\r\n public static readonly DETAILED_LOGGING = Constants.SCENELOADER_DETAILED_LOGGING;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if entire scene must be loaded even if scene contains incremental data\r\n */\r\n public static get ForceFullSceneLoadingForIncremental() {\r\n return SceneLoaderFlags.ForceFullSceneLoadingForIncremental;\r\n }\r\n\r\n public static set ForceFullSceneLoadingForIncremental(value: boolean) {\r\n SceneLoaderFlags.ForceFullSceneLoadingForIncremental = value;\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean indicating if loading screen must be displayed while loading a scene\r\n */\r\n public static get ShowLoadingScreen(): boolean {\r\n return SceneLoaderFlags.ShowLoadingScreen;\r\n }\r\n\r\n public static set ShowLoadingScreen(value: boolean) {\r\n SceneLoaderFlags.ShowLoadingScreen = value;\r\n }\r\n\r\n /**\r\n * Defines the current logging level (while loading the scene)\r\n * @ignorenaming\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public static get loggingLevel(): number {\r\n return SceneLoaderFlags.loggingLevel;\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public static set loggingLevel(value: number) {\r\n SceneLoaderFlags.loggingLevel = value;\r\n }\r\n\r\n /**\r\n * Gets or set a boolean indicating if matrix weights must be cleaned upon loading\r\n */\r\n public static get CleanBoneMatrixWeights(): boolean {\r\n return SceneLoaderFlags.CleanBoneMatrixWeights;\r\n }\r\n\r\n public static set CleanBoneMatrixWeights(value: boolean) {\r\n SceneLoaderFlags.CleanBoneMatrixWeights = value;\r\n }\r\n\r\n // Members\r\n\r\n /**\r\n * Event raised when a plugin is used to load a scene\r\n */\r\n public static OnPluginActivatedObservable = new Observable<ISceneLoaderPlugin | ISceneLoaderPluginAsync>();\r\n\r\n private static _RegisteredPlugins: { [extension: string]: IRegisteredPlugin } = {};\r\n\r\n private static _ShowingLoadingScreen = false;\r\n\r\n /**\r\n * Gets the default plugin (used to load Babylon files)\r\n * @returns the .babylon plugin\r\n */\r\n public static GetDefaultPlugin(): IRegisteredPlugin {\r\n return SceneLoader._RegisteredPlugins[\".babylon\"];\r\n }\r\n\r\n private static _GetPluginForExtension(extension: string): IRegisteredPlugin {\r\n const registeredPlugin = SceneLoader._RegisteredPlugins[extension];\r\n if (registeredPlugin) {\r\n return registeredPlugin;\r\n }\r\n Logger.Warn(\r\n \"Unable to find a plugin to load \" +\r\n extension +\r\n \" files. Trying to use .babylon default plugin. To load from a specific filetype (eg. gltf) see: https://doc.babylonjs.com/features/featuresDeepDive/importers/loadingFileTypes\"\r\n );\r\n return SceneLoader.GetDefaultPlugin();\r\n }\r\n\r\n private static _GetPluginForDirectLoad(data: string): IRegisteredPlugin {\r\n for (const extension in SceneLoader._RegisteredPlugins) {\r\n const plugin = SceneLoader._RegisteredPlugins[extension].plugin;\r\n\r\n if (plugin.canDirectLoad && plugin.canDirectLoad(data)) {\r\n return SceneLoader._RegisteredPlugins[extension];\r\n }\r\n }\r\n\r\n return SceneLoader.GetDefaultPlugin();\r\n }\r\n\r\n private static _GetPluginForFilename(sceneFilename: string): IRegisteredPlugin {\r\n const queryStringPosition = sceneFilename.indexOf(\"?\");\r\n\r\n if (queryStringPosition !== -1) {\r\n sceneFilename = sceneFilename.substring(0, queryStringPosition);\r\n }\r\n\r\n const dotPosition = sceneFilename.lastIndexOf(\".\");\r\n\r\n const extension = sceneFilename.substring(dotPosition, sceneFilename.length).toLowerCase();\r\n return SceneLoader._GetPluginForExtension(extension);\r\n }\r\n\r\n private static _GetDirectLoad(sceneFilename: string): Nullable<string> {\r\n if (sceneFilename.substr(0, 5) === \"data:\") {\r\n return sceneFilename.substr(5);\r\n }\r\n\r\n return null;\r\n }\r\n\r\n private static _FormatErrorMessage(fileInfo: IFileInfo, message?: string, exception?: any): string {\r\n const fromLoad = fileInfo.rawData ? \"binary data\" : fileInfo.url;\r\n let errorMessage = \"Unable to load from \" + fromLoad;\r\n\r\n if (message) {\r\n errorMessage += `: ${message}`;\r\n } else if (exception) {\r\n errorMessage += `: ${exception}`;\r\n }\r\n\r\n return errorMessage;\r\n }\r\n\r\n private static _LoadData(\r\n fileInfo: IFileInfo,\r\n scene: Scene,\r\n onSuccess: (plugin: ISceneLoaderPlugin | ISceneLoaderPluginAsync, data: unknown, responseURL?: string) => void,\r\n onProgress: ((event: ISceneLoaderProgressEvent) => void) | undefined,\r\n onError: (message?: string, exception?: any) => void,\r\n onDispose: () => void,\r\n pluginExtension: Nullable<string>,\r\n name: string,\r\n pluginOptions: PluginOptions\r\n ): Nullable<ISceneLoaderPlugin | ISceneLoaderPluginAsync> {\r\n const directLoad = SceneLoader._GetDirectLoad(fileInfo.url);\r\n\r\n if (fileInfo.rawData && !pluginExtension) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"When using ArrayBufferView to load data the file extension must be provided.\";\r\n }\r\n\r\n const registeredPlugin = pluginExtension\r\n ? SceneLoader._GetPluginForExtension(pluginExtension)\r\n : directLoad\r\n ? SceneLoader._GetPluginForDirectLoad(fileInfo.url)\r\n : SceneLoader._GetPluginForFilename(fileInfo.url);\r\n\r\n if (pluginOptions?.[registeredPlugin.plugin.name]?.enabled === false) {\r\n throw new Error(`The '${registeredPlugin.plugin.name}' plugin is disabled via the loader options passed to the loading operation.`);\r\n }\r\n\r\n if (fileInfo.rawData && !registeredPlugin.isBinary) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"Loading from ArrayBufferView can not be used with plugins that don't support binary loading.\";\r\n }\r\n\r\n // For plugin factories, the plugin is instantiated on each SceneLoader operation. This makes options handling\r\n // much simpler as we can just pass the options to the factory, rather than passing options through to every possible\r\n // plugin call. Given this, options are only supported for plugins that provide a factory function.\r\n const plugin: IRegisteredPlugin[\"plugin\"] = registeredPlugin.plugin.createPlugin?.(pluginOptions ?? {}) ?? registeredPlugin.plugin;\r\n if (!plugin) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw `The loader plugin corresponding to the '${pluginExtension}' file type has not been found. If using es6, please import the plugin you wish to use before.`;\r\n }\r\n\r\n SceneLoader.OnPluginActivatedObservable.notifyObservers(plugin);\r\n\r\n // Check if we have a direct load url. If the plugin is registered to handle\r\n // it or it's not a base64 data url, then pass it through the direct load path.\r\n if (directLoad && ((plugin.canDirectLoad && plugin.canDirectLoad(fileInfo.url)) || !IsBase64DataUrl(fileInfo.url))) {\r\n if (plugin.directLoad) {\r\n const result = plugin.directLoad(scene, directLoad);\r\n if (result instanceof Promise) {\r\n result\r\n .then((data: unknown) => {\r\n onSuccess(plugin, data);\r\n })\r\n .catch((error: any) => {\r\n onError(\"Error in directLoad of _loadData: \" + error, error);\r\n });\r\n } else {\r\n onSuccess(plugin, result);\r\n }\r\n } else {\r\n onSuccess(plugin, directLoad);\r\n }\r\n return plugin;\r\n }\r\n\r\n const useArrayBuffer = registeredPlugin.isBinary;\r\n\r\n const dataCallback = (data: unknown, responseURL?: string) => {\r\n if (scene.isDisposed) {\r\n onError(\"Scene has been disposed\");\r\n return;\r\n }\r\n\r\n onSuccess(plugin, data, responseURL);\r\n };\r\n\r\n let request: Nullable<IFileRequest> = null;\r\n let pluginDisposed = false;\r\n plugin.onDisposeObservable?.add(() => {\r\n pluginDisposed = true;\r\n\r\n if (request) {\r\n request.abort();\r\n request = null;\r\n }\r\n\r\n onDispose();\r\n });\r\n\r\n const manifestChecked = () => {\r\n if (pluginDisposed) {\r\n return;\r\n }\r\n\r\n const errorCallback = (request?: WebRequest, exception?: LoadFileError) => {\r\n onError(request?.statusText, exception);\r\n };\r\n\r\n if (!plugin.loadFile && fileInfo.rawData) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"Plugin does not support loading ArrayBufferView.\";\r\n }\r\n\r\n request = plugin.loadFile\r\n ? plugin.loadFile(scene, fileInfo.rawData || fileInfo.file || fileInfo.url, fileInfo.rootUrl, dataCallback, onProgress, useArrayBuffer, errorCallback, name)\r\n : scene._loadFile(fileInfo.file || fileInfo.url, dataCallback, onProgress, true, useArrayBuffer, errorCallback);\r\n };\r\n\r\n const engine = scene.getEngine();\r\n let canUseOfflineSupport = engine.enableOfflineSupport;\r\n if (canUseOfflineSupport) {\r\n // Also check for exceptions\r\n let exceptionFound = false;\r\n for (const regex of scene.disableOfflineSupportExceptionRules) {\r\n if (regex.test(fileInfo.url)) {\r\n exceptionFound = true;\r\n break;\r\n }\r\n }\r\n\r\n canUseOfflineSupport = !exceptionFound;\r\n }\r\n\r\n if (canUseOfflineSupport && Engine.OfflineProviderFactory) {\r\n // Checking if a manifest file has been set for this scene and if offline mode has been requested\r\n scene.offlineProvider = Engine.OfflineProviderFactory(fileInfo.url, manifestChecked, engine.disableManifestCheck);\r\n } else {\r\n manifestChecked();\r\n }\r\n\r\n return plugin;\r\n }\r\n\r\n private static _GetFileInfo(rootUrl: string, sceneSource: SceneSource): Nullable<IFileInfo> {\r\n let url: string;\r\n let name: string;\r\n let file: Nullable<File> = null;\r\n let rawData: Nullable<ArrayBufferView> = null;\r\n\r\n if (!sceneSource) {\r\n url = rootUrl;\r\n name = Tools.GetFilename(rootUrl);\r\n rootUrl = Tools.GetFolderPath(rootUrl);\r\n } else if (isFile(sceneSource)) {\r\n url = `file:${sceneSource.name}`;\r\n name = sceneSource.name;\r\n file = sceneSource;\r\n } else if (ArrayBuffer.isView(sceneSource)) {\r\n url = \"\";\r\n name = RandomGUID();\r\n rawData = sceneSource;\r\n } else if (sceneSource.startsWith(\"data:\")) {\r\n url = sceneSource;\r\n name = \"\";\r\n } else if (rootUrl) {\r\n const filename = sceneSource;\r\n if (filename.substr(0, 1) === \"/\") {\r\n Tools.Error(\"Wrong sceneFilename parameter\");\r\n return null;\r\n }\r\n\r\n url = rootUrl + filename;\r\n name = filename;\r\n } else {\r\n url = sceneSource;\r\n name = Tools.GetFilename(sceneSource);\r\n rootUrl = Tools.GetFolderPath(sceneSource);\r\n }\r\n\r\n return {\r\n url: url,\r\n rootUrl: rootUrl,\r\n name: name,\r\n file: file,\r\n rawData,\r\n };\r\n }\r\n\r\n // Public functions\r\n\r\n /**\r\n * Gets a plugin that can load the given extension\r\n * @param extension defines the extension to load\r\n * @returns a plugin or null if none works\r\n */\r\n public static GetPluginForExtension(extension: string): ISceneLoaderPlugin | ISceneLoaderPluginAsync | ISceneLoaderPluginFactory {\r\n return SceneLoader._GetPluginForExtension(extension).plugin;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating that the given extension can be loaded\r\n * @param extension defines the extension to load\r\n * @returns true if the extension is supported\r\n */\r\n public static IsPluginForExtensionAvailable(extension: string): boolean {\r\n return !!SceneLoader._RegisteredPlugins[extension];\r\n }\r\n\r\n /**\r\n * Adds a new plugin to the list of registered plugins\r\n * @param plugin defines the plugin to add\r\n */\r\n public static RegisterPlugin(plugin: ISceneLoaderPlugin | ISceneLoaderPluginAsync): void {\r\n if (typeof plugin.extensions === \"string\") {\r\n const extension = plugin.extensions;\r\n SceneLoader._RegisteredPlugins[extension.toLowerCase()] = {\r\n plugin: plugin,\r\n isBinary: false,\r\n };\r\n } else {\r\n const extensions = plugin.extensions;\r\n Object.keys(extensions).forEach((extension) => {\r\n SceneLoader._RegisteredPlugins[extension.toLowerCase()] = {\r\n plugin: plugin,\r\n isBinary: extensions[extension].isBinary,\r\n };\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Import meshes into a scene\r\n * @param meshNames an array of mesh names, a single mesh name, or empty string for all meshes that filter what meshes are imported\r\n * @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)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param scene the instance of BABYLON.Scene to append to\r\n * @param onSuccess a callback with a list of imported meshes, particleSystems, skeletons, and animationGroups when import succeeds\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param onError a callback with the scene, a message, and possibly an exception when import fails\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @param name defines the name of the file, if the data is binary\r\n * @returns The loaded plugin\r\n */\r\n public static ImportMesh(\r\n meshNames: string | readonly string[] | null | undefined,\r\n rootUrl: string,\r\n sceneFilename?: SceneSource,\r\n scene?: Nullable<Scene>,\r\n onSuccess?: Nullable<SceneLoaderSuccessCallback>,\r\n onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>,\r\n onError?: Nullable<(scene: Scene, message: string, exception?: any) => void>,\r\n pluginExtension?: Nullable<string>,\r\n name?: string\r\n ): Nullable<ISceneLoaderPlugin | ISceneLoaderPluginAsync> {\r\n return SceneLoader._ImportMesh(meshNames, rootUrl, sceneFilename, scene, onSuccess, onProgress, onError, pluginExtension, name);\r\n }\r\n\r\n private static _ImportMesh(\r\n meshNames: string | readonly string[] | null | undefined,\r\n rootUrl: string,\r\n sceneFilename: SceneSource = \"\",\r\n scene: Nullable<Scene> = EngineStore.LastCreatedScene,\r\n onSuccess: Nullable<SceneLoaderSuccessCallback> = null,\r\n onProgress: Nullable<(event: ISceneLoaderProgressEvent) => void> = null,\r\n onError: Nullable<(scene: Scene, message: string, exception?: any) => void> = null,\r\n pluginExtension: Nullable<string> = null,\r\n name = \"\",\r\n pluginOptions: PluginOptions = {}\r\n ): Nullable<ISceneLoaderPlugin | ISceneLoaderPluginAsync> {\r\n if (!scene) {\r\n Logger.Error(\"No scene available to import mesh to\");\r\n return null;\r\n }\r\n\r\n const fileInfo = SceneLoader._GetFileInfo(rootUrl, sceneFilename);\r\n if (!fileInfo) {\r\n return null;\r\n }\r\n\r\n const loadingToken = {};\r\n scene.addPendingData(loadingToken);\r\n\r\n const disposeHandler = () => {\r\n scene.removePendingData(loadingToken);\r\n };\r\n\r\n const errorHandler = (message?: string, exception?: any) => {\r\n const errorMessage = SceneLoader._FormatErrorMessage(fileInfo, message, exception);\r\n\r\n if (onError) {\r\n onError(scene, errorMessage, new RuntimeError(errorMessage, ErrorCodes.SceneLoaderError, exception));\r\n } else {\r\n Logger.Error(errorMessage);\r\n // should the exception be thrown?\r\n }\r\n\r\n disposeHandler();\r\n };\r\n\r\n const progressHandler = onProgress\r\n ? (event: ISceneLoaderProgressEvent) => {\r\n try {\r\n onProgress(event);\r\n } catch (e) {\r\n errorHandler(\"Error in onProgress callback: \" + e, e);\r\n }\r\n }\r\n : undefined;\r\n\r\n const successHandler: SceneLoaderSuccessCallback = (meshes, particleSystems, skeletons, animationGroups, transformNodes, geometries, lights, spriteManagers) => {\r\n scene.importedMeshesFiles.push(fileInfo.url);\r\n\r\n if (onSuccess) {\r\n try {\r\n onSuccess(meshes, particleSystems, skeletons, animationGroups, transformNodes, geometries, lights, spriteManagers);\r\n } catch (e) {\r\n errorHandler(\"Error in onSuccess callback: \" + e, e);\r\n }\r\n }\r\n\r\n scene.removePendingData(loadingToken);\r\n };\r\n\r\n return SceneLoader._LoadData(\r\n fileInfo,\r\n scene,\r\n (plugin, data, responseURL) => {\r\n if (plugin.rewriteRootURL) {\r\n fileInfo.rootUrl = plugin.rewriteRootURL(fileInfo.rootUrl, responseURL);\r\n }\r\n\r\n if ((plugin as ISceneLoaderPlugin).importMesh) {\r\n const syncedPlugin = <ISceneLoaderPlugin>plugin;\r\n const meshes: AbstractMesh[] = [];\r\n const particleSystems: IParticleSystem[] = [];\r\n const skeletons: Skeleton[] = [];\r\n\r\n if (!syncedPlugin.importMesh(meshNames, scene, data, fileInfo.rootUrl, meshes, particleSystems, skeletons, errorHandler)) {\r\n return;\r\n }\r\n\r\n scene.loadingPluginName = plugin.name;\r\n successHandler(meshes, particleSystems, skeletons, [], [], [], [], []);\r\n } else {\r\n const asyncedPlugin = <ISceneLoaderPluginAsync>plugin;\r\n asyncedPlugin\r\n .importMeshAsync(meshNames, scene, data, fileInfo.rootUrl, progressHandler, fileInfo.name)\r\n .then((result) => {\r\n scene.loadingPluginName = plugin.name;\r\n successHandler(\r\n result.meshes,\r\n result.particleSystems,\r\n result.skeletons,\r\n result.animationGroups,\r\n result.transformNodes,\r\n result.geometries,\r\n result.lights,\r\n result.spriteManagers\r\n );\r\n })\r\n .catch((error) => {\r\n errorHandler(error.message, error);\r\n });\r\n }\r\n },\r\n progressHandler,\r\n errorHandler,\r\n disposeHandler,\r\n pluginExtension,\r\n name,\r\n pluginOptions\r\n );\r\n }\r\n\r\n /**\r\n * Import meshes into a scene\r\n * @experimental\r\n * @param source a string that defines the name of the scene file, or starts with \"data:\" following by the stringified version of the scene, or a File object, or an ArrayBufferView\r\n * @param scene the instance of BABYLON.Scene to append to\r\n * @param options an object that configures aspects of how the scene is loaded\r\n * @returns The loaded list of imported meshes, particle systems, skeletons, and animation groups\r\n */\r\n public static ImportMeshAsync(source: SceneSource, scene: Scene, options?: ImportMeshOptions): Promise<ISceneLoaderAsyncResult>;\r\n\r\n /**\r\n * Import meshes into a scene\r\n * @param meshNames an array of mesh names, a single mesh name, or empty string for all meshes that filter what meshes are imported\r\n * @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)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param scene the instance of BABYLON.Scene to append to\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @param name defines the name of the file\r\n * @returns The loaded list of imported meshes, particle systems, skeletons, and animation groups\r\n */\r\n public static ImportMeshAsync(\r\n meshNames: string | readonly string[] | null | undefined,\r\n rootUrl: string,\r\n sceneFilename?: SceneSource,\r\n scene?: Nullable<Scene>,\r\n onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>,\r\n pluginExtension?: Nullable<string>,\r\n name?: string\r\n ): Promise<ISceneLoaderAsyncResult>;\r\n\r\n public static ImportMeshAsync(\r\n ...args:\r\n | [\r\n meshNames: string | readonly string[] | null | undefined,\r\n rootUrl: string,\r\n sceneFilename?: SceneSource,\r\n scene?: Nullable<Scene>,\r\n onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>,\r\n pluginExtension?: Nullable<string>,\r\n name?: string,\r\n ]\r\n | [source: SceneSource, scene: Scene, options?: ImportMeshOptions]\r\n ): Promise<ISceneLoaderAsyncResult> {\r\n let meshNames: string | readonly string[] | null | undefined;\r\n let rootUrl: string;\r\n let sceneFilename: SceneSource | undefined;\r\n let scene: Nullable<Scene> | undefined;\r\n let onProgress: Nullable<(event: ISceneLoaderProgressEvent) => void> | undefined;\r\n let pluginExtension: Nullable<string> | undefined;\r\n let name: string | undefined;\r\n let pluginOptions: PluginOptions;\r\n\r\n // This is a user-defined type guard: https://www.typescriptlang.org/docs/handbook/advanced-types.html#user-defined-type-guards\r\n // This is the most type safe way to distinguish between the two possible argument arrays.\r\n const isOptionsArgs = (maybeOptionsArgs: typeof args): maybeOptionsArgs is [SceneSource, Scene, ImportMeshOptions?] => {\r\n // If the second argument is an object, then it must be the options overload.\r\n return typeof maybeOptionsArgs[1] === \"object\";\r\n };\r\n\r\n if (isOptionsArgs(args)) {\r\n // Source is mapped to sceneFileName\r\n sceneFilename = args[0];\r\n scene = args[1];\r\n // Options determine the rest of the arguments\r\n ({ meshNames, rootUrl = \"\", onProgress, pluginExtension, name, pluginOptions } = args[2] ?? {});\r\n } else {\r\n // For the legacy signature, we just directly map each argument\r\n [meshNames, rootUrl, sceneFilename, scene, onProgress, pluginExtension, name] = args;\r\n }\r\n\r\n return new Promise((resolve, reject) => {\r\n SceneLoader._ImportMesh(\r\n meshNames,\r\n rootUrl,\r\n sceneFilename,\r\n scene,\r\n (meshes, particleSystems, skeletons, animationGroups, transformNodes, geometries, lights, spriteManagers) => {\r\n resolve({\r\n meshes: meshes,\r\n particleSystems: particleSystems,\r\n skeletons: skeletons,\r\n animationGroups: animationGroups,\r\n transformNodes: transformNodes,\r\n geometries: geometries,\r\n lights: lights,\r\n spriteManagers: spriteManagers,\r\n });\r\n },\r\n onProgress,\r\n (scene, message, exception) => {\r\n reject(exception || new Error(message));\r\n },\r\n pluginExtension,\r\n name,\r\n pluginOptions\r\n );\r\n });\r\n }\r\n\r\n /**\r\n * Load a scene\r\n * @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)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param engine is the instance of BABYLON.Engine to use to create the scene\r\n * @param onSuccess a callback with the scene when import succeeds\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param onError a callback with the scene, a message, and possibly an exception when import fails\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @param name defines the filename, if the data is binary\r\n * @returns The loaded plugin\r\n */\r\n public static Load(\r\n rootUrl: string,\r\n sceneFilename?: SceneSource,\r\n engine?: Nullable<AbstractEngine>,\r\n onSuccess?: Nullable<(scene: Scene) => void>,\r\n onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>,\r\n onError?: Nullable<(scene: Scene, message: string, exception?: any) => void>,\r\n pluginExtension?: Nullable<string>,\r\n name?: string\r\n ): Nullable<ISceneLoaderPlugin | ISceneLoaderPluginAsync> {\r\n return SceneLoader._Load(rootUrl, sceneFilename, engine, onSuccess, onProgress, onError, pluginExtension, name);\r\n }\r\n\r\n private static _Load(\r\n rootUrl: string,\r\n sceneFilename: SceneSource = \"\",\r\n engine: Nullable<AbstractEngine> = EngineStore.LastCreatedEngine,\r\n onSuccess: Nullable<(scene: Scene) => void> = null,\r\n onProgress: Nullable<(event: ISceneLoaderProgressEvent) => void> = null,\r\n onError: Nullable<(scene: Scene, message: string, exception?: any) => void> = null,\r\n pluginExtension: Nullable<string> = null,\r\n name = \"\",\r\n pluginOptions: PluginOptions = {}\r\n ): Nullable<ISceneLoaderPlugin | ISceneLoaderPluginAsync> {\r\n if (!engine) {\r\n Tools.Error(\"No engine available\");\r\n return null;\r\n }\r\n\r\n return SceneLoader._Append(rootUrl, sceneFilename, new Scene(engine), onSuccess, onProgress, onError, pluginExtension, name, pluginOptions);\r\n }\r\n\r\n /**\r\n * Load a scene\r\n * @experimental\r\n * @param source a string that defines the name of the scene file, or starts with \"data:\" following by the stringified version of the scene, or a File object, or an ArrayBufferView\r\n * @param engine is the instance of BABYLON.Engine to use to create the scene\r\n * @param options an object that configures aspects of how the scene is loaded\r\n * @returns The loaded scene\r\n */\r\n public static LoadAsync(source: SceneSource, engine: AbstractEngine, options?: LoadOptions): Promise<Scene>;\r\n\r\n /**\r\n * Load a scene\r\n * @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)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param engine is the instance of BABYLON.Engine to use to create the scene\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @param name defines the filename, if the data is binary\r\n * @returns The loaded scene\r\n */\r\n public static LoadAsync(\r\n rootUrl: string,\r\n sceneFilename?: SceneSource,\r\n engine?: Nullable<AbstractEngine>,\r\n onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>,\r\n pluginExtension?: Nullable<string>,\r\n name?: string\r\n ): Promise<Scene>;\r\n\r\n public static LoadAsync(\r\n ...args:\r\n | [\r\n rootUrl: string,\r\n sceneFilename?: SceneSource,\r\n engine?: Nullable<AbstractEngine>,\r\n onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>,\r\n pluginExtension?: Nullable<string>,\r\n name?: string,\r\n ]\r\n | [source: SceneSource, engine: AbstractEngine, options?: LoadOptions]\r\n ): Promise<Scene> {\r\n let rootUrl: string;\r\n let sceneFilename: SceneSource | undefined;\r\n let engine: Nullable<AbstractEngine> | undefined;\r\n let onProgress: Nullable<(event: ISceneLoaderProgressEvent) => void> | undefined;\r\n let pluginExtension: Nullable<string> | undefined;\r\n let name: string | undefined;\r\n let pluginOptions: PluginOptions;\r\n\r\n // This is a user-defined type guard: https://www.typescriptlang.org/docs/handbook/advanced-types.html#user-defined-type-guards\r\n // This is the most type safe way to distinguish between the two possible argument arrays.\r\n const isOptionsArgs = (maybeOptionsArgs: typeof args): maybeOptionsArgs is [SceneSource, AbstractEngine, LoadOptions?] => {\r\n // If the second argument is an engine, then it must be the options overload.\r\n return maybeOptionsArgs[1] instanceof AbstractEngine;\r\n };\r\n\r\n if (isOptionsArgs(args)) {\r\n // Source is mapped to sceneFileName\r\n sceneFilename = args[0];\r\n engine = args[1];\r\n // Options determine the rest of the arguments\r\n ({ rootUrl = \"\", onProgress, pluginExtension, name, pluginOptions } = args[2] ?? {});\r\n } else {\r\n // For the legacy signature, we just directly map each argument\r\n [rootUrl, sceneFilename, engine, onProgress, pluginExtension, name] = args;\r\n }\r\n\r\n return new Promise((resolve, reject) => {\r\n SceneLoader._Load(\r\n rootUrl,\r\n sceneFilename,\r\n engine,\r\n (scene) => {\r\n resolve(scene);\r\n },\r\n onProgress,\r\n (scene, message, exception) => {\r\n reject(exception || new Error(message));\r\n },\r\n pluginExtension,\r\n name,\r\n pluginOptions\r\n );\r\n });\r\n }\r\n\r\n /**\r\n * Append a scene\r\n * @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)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param scene is the instance of BABYLON.Scene to append to\r\n * @param onSuccess a callback with the scene when import succeeds\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param onError a callback with the scene, a message, and possibly an exception when import fails\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @param name defines the name of the file, if the data is binary\r\n * @returns The loaded plugin\r\n */\r\n public static Append(\r\n rootUrl: string,\r\n sceneFilename?: SceneSource,\r\n scene?: Nullable<Scene>,\r\n onSuccess?: Nullable<(scene: Scene) => void>,\r\n onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>,\r\n onError?: Nullable<(scene: Scene, message: string, exception?: any) => void>,\r\n pluginExtension?: Nullable<string>,\r\n name?: string\r\n ): Nullable<ISceneLoaderPlugin | ISceneLoaderPluginAsync> {\r\n return SceneLoader._Append(rootUrl, sceneFilename, scene, onSuccess, onProgress, onError, pluginExtension, name);\r\n }\r\n\r\n private static _Append(\r\n rootUrl: string,\r\n sceneFilename: SceneSource = \"\",\r\n scene: Nullable<Scene> = EngineStore.LastCreatedScene,\r\n onSuccess: Nullable<(scene: Scene) => void> = null,\r\n onProgress: Nullable<(event: ISceneLoaderProgressEvent) => void> = null,\r\n onError: Nullable<(scene: Scene, message: string, exception?: any) => void> = null,\r\n pluginExtension: Nullable<string> = null,\r\n name = \"\",\r\n pluginOptions: PluginOptions = {}\r\n ): Nullable<ISceneLoaderPlugin | ISceneLoaderPluginAsync> {\r\n if (!scene) {\r\n Logger.Error(\"No scene available to append to\");\r\n return null;\r\n }\r\n\r\n const fileInfo = SceneLoader._GetFileInfo(rootUrl, sceneFilename);\r\n if (!fileInfo) {\r\n return null;\r\n }\r\n\r\n const loadingToken = {};\r\n scene.addPendingData(loadingToken);\r\n\r\n const disposeHandler = () => {\r\n scene.removePendingData(loadingToken);\r\n };\r\n\r\n if (SceneLoader.ShowLoadingScreen && !this._ShowingLoadingScreen) {\r\n this._ShowingLoadingScreen = true;\r\n scene.getEngine().displayLoadingUI();\r\n scene.executeWhenReady(() => {\r\n scene.getEngine().hideLoadingUI();\r\n this._ShowingLoadingScreen = false;\r\n });\r\n }\r\n\r\n const errorHandler = (message?: string, exception?: any) => {\r\n const errorMessage = SceneLoader._FormatErrorMessage(fileInfo, message, exception);\r\n\r\n if (onError) {\r\n onError(scene, errorMessage, new RuntimeError(errorMessage, ErrorCodes.SceneLoaderError, exception));\r\n } else {\r\n Logger.Error(errorMessage);\r\n // should the exception be thrown?\r\n }\r\n\r\n disposeHandler();\r\n };\r\n\r\n const progressHandler = onProgress\r\n ? (event: ISceneLoaderProgressEvent) => {\r\n try {\r\n onProgress(event);\r\n } catch (e) {\r\n errorHandler(\"Error in onProgress callback\", e);\r\n }\r\n }\r\n : undefined;\r\n\r\n const successHandler = () => {\r\n if (onSuccess) {\r\n try {\r\n onSuccess(scene);\r\n } catch (e) {\r\n errorHandler(\"Error in onSuccess callback\", e);\r\n }\r\n }\r\n\r\n scene.removePendingData(loadingToken);\r\n };\r\n\r\n return SceneLoader._LoadData(\r\n fileInfo,\r\n scene,\r\n (plugin, data) => {\r\n if ((plugin as ISceneLoaderPlugin).load) {\r\n const syncedPlugin = <ISceneLoaderPlugin>plugin;\r\n if (!syncedPlugin.load(scene, data, fileInfo.rootUrl, errorHandler)) {\r\n return;\r\n }\r\n\r\n scene.loadingPluginName = plugin.name;\r\n successHandler();\r\n } else {\r\n const asyncedPlugin = <ISceneLoaderPluginAsync>plugin;\r\n asyncedPlugin\r\n .loadAsync(scene, data, fileInfo.rootUrl, progressHandler, fileInfo.name)\r\n .then(() => {\r\n scene.loadingPluginName = plugin.name;\r\n successHandler();\r\n })\r\n .catch((error) => {\r\n errorHandler(error.message, error);\r\n });\r\n }\r\n },\r\n progressHandler,\r\n errorHandler,\r\n disposeHandler,\r\n pluginExtension,\r\n name,\r\n pluginOptions\r\n );\r\n }\r\n\r\n /**\r\n * Append a scene\r\n * @experimental\r\n * @param source a string that defines the name of the scene file, or starts with \"data:\" following by the stringified version of the scene, or a File object, or an ArrayBufferView\r\n * @param scene is the instance of BABYLON.Scene to append to\r\n * @param options an object that configures aspects of how the scene is loaded\r\n * @returns The given scene\r\n */\r\n public static AppendAsync(source: SceneSource, scene: Scene, options?: LoadAssetContainerOptions): Promise<Scene>;\r\n\r\n /**\r\n * Append a scene\r\n * @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)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param scene is the instance of BABYLON.Scene to append to\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @param name defines the name of the file, if the data is binary\r\n * @returns The given scene\r\n */\r\n public static AppendAsync(\r\n rootUrl: string,\r\n sceneFilename?: SceneSource,\r\n scene?: Nullable<Scene>,\r\n onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>,\r\n pluginExtension?: Nullable<string>,\r\n name?: string\r\n ): Promise<Scene>;\r\n\r\n public static AppendAsync(\r\n ...args:\r\n | [\r\n rootUrl: string,\r\n sceneFilename?: SceneSource,\r\n scene?: Nullable<Scene>,\r\n onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>,\r\n pluginExtension?: Nullable<string>,\r\n name?: string,\r\n ]\r\n | [source: SceneSource, scene: Scene, options?: AppendOptions]\r\n ): Promise<Scene> {\r\n let rootUrl: string;\r\n let sceneFilename: SceneSource | undefined;\r\n let scene: Nullable<Scene> | undefined;\r\n let onProgress: Nullable<(event: ISceneLoaderProgressEvent) => void> | undefined;\r\n let pluginExtension: Nullable<string> | undefined;\r\n let name: string | undefined;\r\n let pluginOptions: PluginOptions;\r\n\r\n // This is a user-defined type guard: https://www.typescriptlang.org/docs/handbook/advanced-types.html#user-defined-type-guards\r\n // This is the most type safe way to distinguish between the two possible argument arrays.\r\n const isOptionsArgs = (maybeOptionsArgs: typeof args): maybeOptionsArgs is [SceneSource, Scene, AppendOptions?] => {\r\n // If the second argument is a Scene, then it must be the options overload.\r\n return maybeOptionsArgs[1] instanceof Scene;\r\n };\r\n\r\n if (isOptionsArgs(args)) {\r\n // Source is mapped to sceneFileName\r\n sceneFilename = args[0];\r\n scene = args[1];\r\n // Options determine the rest of the arguments\r\n ({ rootUrl = \"\", onProgress, pluginExtension, name, pluginOptions } = args[2] ?? {});\r\n } else {\r\n // For the legacy signature, we just directly map each argument\r\n [rootUrl, sceneFilename, scene, onProgress, pluginExtension, name] = args;\r\n }\r\n\r\n return new Promise((resolve, reject) => {\r\n SceneLoader._Append(\r\n rootUrl,\r\n sceneFilename,\r\n scene,\r\n (scene) => {\r\n resolve(scene);\r\n },\r\n onProgress,\r\n (scene, message, exception) => {\r\n reject(exception || new Error(message));\r\n },\r\n pluginExtension,\r\n name,\r\n pluginOptions\r\n );\r\n });\r\n }\r\n\r\n /**\r\n * Load a scene into an asset container\r\n * @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)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param scene is the instance of BABYLON.Scene to append to (default: last created scene)\r\n * @param onSuccess a callback with the scene when import succeeds\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param onError a callback with the scene, a message, and possibly an exception when import fails\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @param name defines the filename, if the data is binary\r\n * @returns The loaded plugin\r\n */\r\n public static LoadAssetContainer(\r\n rootUrl: string,\r\n sceneFilename?: SceneSource,\r\n scene?: Nullable<Scene>,\r\n onSuccess?: Nullable<(assets: AssetContainer) => void>,\r\n onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>,\r\n onError?: Nullable<(scene: Scene, message: string, exception?: any) => void>,\r\n pluginExtension?: Nullable<string>,\r\n name?: string\r\n ): Nullable<ISceneLoaderPlugin | ISceneLoaderPluginAsync> {\r\n return SceneLoader._LoadAssetContainer(rootUrl, sceneFilename, scene, onSuccess, onProgress, onError, pluginExtension, name);\r\n }\r\n\r\n private static _LoadAssetContainer(\r\n rootUrl: string,\r\n sceneFilename: SceneSource = \"\",\r\n scene: Nullable<Scene> = EngineStore.LastCreatedScene,\r\n onSuccess: Nullable<(assets: AssetContainer) => void> = null,\r\n onProgress: Nullable<(event: ISceneLoaderProgressEvent) => void> = null,\r\n onError: Nullable<(scene: Scene, message: string, exception?: any) => void> = null,\r\n pluginExtension: Nullable<string> = null,\r\n name = \"\",\r\n pluginOptions: PluginOptions = {}\r\n ): Nullable<ISceneLoaderPlugin | ISceneLoaderPluginAsync> {\r\n if (!scene) {\r\n Logger.Error(\"No scene available to load asset container to\");\r\n return null;\r\n }\r\n\r\n const fileInfo = SceneLoader._GetFileInfo(rootUrl, sceneFilename);\r\n if (!fileInfo) {\r\n return null;\r\n }\r\n\r\n const loadingToken = {};\r\n scene.addPendingData(loadingToken);\r\n\r\n const disposeHandler = () => {\r\n scene.removePendingData(loadingToken);\r\n };\r\n\r\n const errorHandler = (message?: string, exception?: any) => {\r\n const errorMessage = SceneLoader._FormatErrorMessage(fileInfo, message, exception);\r\n\r\n if (onError) {\r\n onError(scene, errorMessage, new RuntimeError(errorMessage, ErrorCodes.SceneLoaderError, exception));\r\n } else {\r\n Logger.Error(errorMessage);\r\n // should the exception be thrown?\r\n }\r\n\r\n disposeHandler();\r\n };\r\n\r\n const progressHandler = onProgress\r\n ? (event: ISceneLoaderProgressEvent) => {\r\n try {\r\n onProgress(event);\r\n } catch (e) {\r\n errorHandler(\"Error in onProgress callback\", e);\r\n }\r\n }\r\n : undefined;\r\n\r\n const successHandler = (assets: AssetContainer) => {\r\n if (onSuccess) {\r\n try {\r\n onSuccess(assets);\r\n } catch (e) {\r\n errorHandler(\"Error in onSuccess callback\", e);\r\n }\r\n }\r\n\r\n scene.removePendingData(loadingToken);\r\n };\r\n\r\n return SceneLoader._LoadData(\r\n fileInfo,\r\n scene,\r\n (plugin, data) => {\r\n if ((plugin as ISceneLoaderPlugin).loadAssetContainer) {\r\n const syncedPlugin = <ISceneLoaderPlugin>plugin;\r\n const assetContainer = syncedPlugin.loadAssetContainer(scene, data, fileInfo.rootUrl, errorHandler);\r\n if (!assetContainer) {\r\n return;\r\n }\r\n assetContainer.populateRootNodes();\r\n scene.loadingPluginName = plugin.name;\r\n successHandler(assetContainer);\r\n } else if ((plugin as ISceneLoaderPluginAsync).loadAssetContainerAsync) {\r\n const asyncedPlugin = <ISceneLoaderPluginAsync>plugin;\r\n asyncedPlugin\r\n .loadAssetContainerAsync(scene, data, fileInfo.rootUrl, progressHandler, fileInfo.name)\r\n .then((assetContainer) => {\r\n assetContainer.populateRootNodes();\r\n scene.loadingPluginName = plugin.name;\r\n successHandler(assetContainer);\r\n })\r\n .catch((error) => {\r\n errorHandler(error.message, error);\r\n });\r\n } else {\r\n errorHandler(\"LoadAssetContainer is not supported by this plugin. Plugin did not provide a loadAssetContainer or loadAssetContainerAsync method.\");\r\n }\r\n },\r\n progressHandler,\r\n errorHandler,\r\n disposeHandler,\r\n pluginExtension,\r\n name,\r\n pluginOptions\r\n );\r\n }\r\n\r\n /**\r\n * Load a scene into an asset container\r\n * @experimental\r\n * @param source a string that defines the name of the scene file, or starts with \"data:\" following by the stringified version of the scene, or a File object, or an ArrayBufferView\r\n * @param scene is the instance of Scene to append to\r\n * @param options an object that configures aspects of how the scene is loaded\r\n * @returns The loaded asset container\r\n */\r\n public static LoadAssetContainerAsync(source: SceneSource, scene: Scene, options?: LoadAssetContainerOptions): Promise<AssetContainer>;\r\n\r\n /**\r\n * Load a scene into an asset container\r\n * @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)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene (default: empty string)\r\n * @param scene is the instance of Scene to append to\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @param name defines the filename, if the data is binary\r\n * @returns The loaded asset container\r\n */\r\n public static LoadAssetContainerAsync(\r\n rootUrl: string,\r\n sceneFilename?: SceneSource,\r\n scene?: Nullable<Scene>,\r\n onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>,\r\n pluginExtension?: Nullable<string>,\r\n name?: string\r\n ): Promise<AssetContainer>;\r\n\r\n // This is the single implementation that handles both the legacy many-parameters overload and the\r\n // new source + config overload. Using a parameters array union is the most type safe way to handle this.\r\n public static LoadAssetContainerAsync(\r\n ...args:\r\n | [\r\n rootUrl: string,\r\n sceneFilename?: SceneSource,\r\n scene?: Nullable<Scene>,\r\n onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>,\r\n pluginExtension?: Nullable<string>,\r\n name?: string,\r\n ]\r\n | [source: SceneSource, scene: Scene, options?: LoadAssetContainerOptions]\r\n ): Promise<AssetContainer> {\r\n let rootUrl: string;\r\n let sceneFilename: SceneSource | undefined;\r\n let scene: Nullable<Scene> | undefined;\r\n let onProgress: Nullable<(event: ISceneLoaderProgressEvent) => void> | undefined;\r\n let pluginExtension: Nullable<string> | undefined;\r\n let name: string | undefined;\r\n let pluginOptions: PluginOptions;\r\n\r\n // This is a user-defined type guard: https://www.typescriptlang.org/docs/handbook/advanced-types.html#user-defined-type-guards\r\n // This is the most type safe way to distinguish between the two possible argument arrays.\r\n const isOptionsArgs = (maybeOptionsArgs: typeof args): maybeOptionsArgs is [SceneSource, Scene, LoadAssetContainerOptions?] => {\r\n // If the second argument is a Scene, then it must be the options overload.\r\n return maybeOptionsArgs[1] instanceof Scene;\r\n };\r\n\r\n if (isOptionsArgs(args)) {\r\n // Source is mapped to sceneFileName\r\n sceneFilename = args[0];\r\n scene = args[1];\r\n // Options determine the rest of the arguments\r\n ({ rootUrl = \"\", onProgress, pluginExtension, name, pluginOptions } = args[2] ?? {});\r\n } else {\r\n // For the legacy signature, we just directly map each argument\r\n [rootUrl, sceneFilename, scene, onProgress, pluginExtension, name] = args;\r\n }\r\n\r\n return new Promise((resolve, reject) => {\r\n SceneLoader._LoadAssetContainer(\r\n rootUrl,\r\n sceneFilename,\r\n scene,\r\n (assetContainer) => {\r\n resolve(assetContainer);\r\n },\r\n onProgress,\r\n (scene, message, exception) => {\r\n reject(exception || new Error(message));\r\n },\r\n pluginExtension,\r\n name,\r\n pluginOptions\r\n );\r\n });\r\n }\r\n\r\n /**\r\n * Import animations from a file into a scene\r\n * @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)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param scene is the instance of BABYLON.Scene to append to (default: last created scene)\r\n * @param overwriteAnimations when true, animations are cleaned before importing new ones. Animations are appended otherwise\r\n * @param animationGroupLoadingMode defines how to handle old animations groups before importing new ones\r\n * @param targetConverter defines a function used to convert animation targets from loaded scene to current scene (default: search node by name)\r\n * @param onSuccess a callback with the scene when import succeeds\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param onError a callback with the scene, a message, and possibly an exception when import fails\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @param name defines the filename, if the data is binary\r\n */\r\n public static ImportAnimations(\r\n rootUrl: string,\r\n sceneFilename?: SceneSource,\r\n scene?: Nullable<Scene>,\r\n overwriteAnimations?: boolean,\r\n animationGroupLoadingMode?: SceneLoaderAnimationGroupLoadingMode,\r\n targetConverter?: Nullable<(target: any) => any>,\r\n onSuccess?: Nullable<(scene: Scene) => void>,\r\n onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>,\r\n onError?: Nullable<(scene: Scene, message: string, exception?: any) => void>,\r\n pluginExtension?: Nullable<string>,\r\n name?: string\r\n ): void {\r\n SceneLoader._ImportAnimations(\r\n rootUrl,\r\n sceneFilename,\r\n scene,\r\n overwriteAnimations,\r\n animationGroupLoadingMode,\r\n targetConverter,\r\n onSuccess,\r\n onProgress,\r\n onError,\r\n pluginExtension,\r\n name\r\n );\r\n }\r\n\r\n private static _ImportAnimations(\r\n rootUrl: string,\r\n sceneFilename: SceneSource = \"\",\r\n scene: Nullable<Scene> = EngineStore.LastCreatedScene,\r\n overwriteAnimations = true,\r\n animationGroupLoadingMode = SceneLoaderAnimationGroupLoadingMode.Clean,\r\n targetConverter: Nullable<(target: any) => any> = null,\r\n onSuccess: Nullable<(scene: Scene) => void> = null,\r\n onProgress: Nullable<(event: ISceneLoaderProgressEvent) => void> = null,\r\n onError: Nullable<(scene: Scene, message: string, exception?: any) => void> = null,\r\n pluginExtension: Nullable<string> = null,\r\n name = \"\",\r\n pluginOptions: PluginOptions = {}\r\n ): void {\r\n if (!scene) {\r\n Logger.Error(\"No scene available to load animations to\");\r\n return;\r\n }\r\n\r\n if (overwriteAnimations) {\r\n // Reset, stop and dispose all animations before loading new ones\r\n for (const animatable of scene.animatables) {\r\n animatable.reset();\r\n }\r\n scene.stopAllAnimations();\r\n scene.animationGroups.slice().forEach((animationGroup) => {\r\n animationGroup.dispose();\r\n });\r\n const nodes = scene.getNodes();\r\n nodes.forEach((node) => {\r\n if (node.animations) {\r\n node.animations = [];\r\n }\r\n });\r\n } else {\r\n switch (animationGroupLoadingMode) {\r\n case SceneLoaderAnimationGroupLoadingMode.Clean:\r\n scene.animationGroups.slice().forEach((animationGroup) => {\r\n animationGroup.dispose();\r\n });\r\n break;\r\n case SceneLoaderAnimationGroupLoadingMode.Stop:\r\n scene.animationGroups.forEach((animationGroup) => {\r\n animationGroup.stop();\r\n });\r\n break;\r\n case SceneLoaderAnimationGroupLoadingMode.Sync:\r\n scene.animationGroups.forEach((animationGroup) => {\r\n animationGroup.reset();\r\n animationGroup.restart();\r\n });\r\n break;\r\n case SceneLoaderAnimationGroupLoadingMode.NoSync:\r\n // nothing to do\r\n break;\r\n default:\r\n Logger.Error(\"Unknown animation group loading mode value '\" + animationGroupLoadingMode + \"'\");\r\n return;\r\n }\r\n }\r\n\r\n const startingIndexForNewAnimatables = scene.animatables.length;\r\n\r\n const onAssetContainerLoaded = (container: AssetContainer) => {\r\n container.mergeAnimationsTo(scene, scene.animatables.slice(startingIndexForNewAnimatables), targetConverter);\r\n\r\n container.dispose();\r\n\r\n scene.onAnimationFileImportedObservable.notifyObservers(scene);\r\n\r\n if (onSuccess) {\r\n onSuccess(scene);\r\n }\r\n };\r\n\r\n this._LoadAssetContainer(rootUrl, sceneFilename, scene, onAssetContainerLoaded, onProgress, onError, pluginExtension, name, pluginOptions);\r\n }\r\n\r\n /**\r\n * Import animations from a file into a scene\r\n * @experimental\r\n * @param source a string that defines the name of the scene file, or starts with \"data:\" following by the stringified version of the scene, or a File object, or an ArrayBufferView\r\n * @param scene is the instance of BABYLON.Scene to append to (default: last created scene)\r\n * @param options an object that configures aspects of how the scene is loaded\r\n * @returns The loaded asset container\r\n */\r\n public static ImportAnimationsAsync(source: SceneSource, scene: Scene, options?: ImportAnimationsOptions): Promise<Scene>;\r\n\r\n /**\r\n * Import animations from a file into a scene\r\n * @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)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param scene is the instance of BABYLON.Scene to append to (default: last created scene)\r\n * @param overwriteAnimations when true, animations are cleaned before importing new ones. Animations are appended otherwise\r\n * @param animationGroupLoadingMode defines how to handle old animations groups before importing new ones\r\n * @param targetConverter defines a function used to convert animation targets from loaded scene to current scene (default: search node by name)\r\n * @param onSuccess a callback with the scene when import succeeds\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param onError a callback with the scene, a message, and possibly an exception when import fails\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @param name defines the filename, if the data is binary\r\n * @returns the updated scene with imported animations\r\n */\r\n public static ImportAnimationsAsync(\r\n rootUrl: string,\r\n sceneFilename?: SceneSource,\r\n scene?: Nullable<Scene>,\r\n overwriteAnimations?: boolean,\r\n animationGroupLoadingMode?: SceneLoaderAnimationGroupLoadingMode,\r\n targetConverter?: Nullable<(target: any) => any>,\r\n onSuccess?: Nullable<(scene: Scene) => void>,\r\n onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>,\r\n onError?: Nullable<(scene: Scene, message: string, exception?: any) => void>,\r\n pluginExtension?: Nullable<string>,\r\n name?: string\r\n ): Promise<Scene>;\r\n\r\n public static ImportAnimationsAsync(\r\n ...args:\r\n | [\r\n rootUrl: string,\r\n sceneFilename?: SceneSource,\r\n scene?: Nullable<Scene>,\r\n overwriteAnimations?: boolean,\r\n animationGroupLoadingMode?: SceneLoaderAnimationGroupLoadingMode,\r\n targetConverter?: Nullable<(target: any) => any>,\r\n onSuccess?: Nullable<(scene: Scene) => void>,\r\n onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>,\r\n onError?: Nullable<(scene: Scene, message: string, exception?: any) => void>,\r\n pluginExtension?: Nullable<string>,\r\n name?: string,\r\n ]\r\n | [source: SceneSource, scene: Scene, options?: ImportAnimationsOptions]\r\n ): Promise<Scene> {\r\n let rootUrl: string;\r\n let sceneFilename: SceneSource | undefined;\r\n let scene: Nullable<Scene> | undefined;\r\n let overwriteAnimations: boolean | undefined;\r\n let animationGroupLoadingMode: SceneLoaderAnimationGroupLoadingMode | undefined;\r\n let targetConverter: Nullable<(target: any) => any> | undefined;\r\n let onProgress: Nullable<(event: ISceneLoaderProgressEvent) => void> | undefined;\r\n let pluginExtension: Nullable<string> | undefined;\r\n let name: string | undefined;\r\n let pluginOptions: PluginOptions;\r\n\r\n // This is a user-defined type guard: https://www.typescriptlang.org/docs/handbook/advanced-types.html#user-defined-type-guards\r\n // This is the most type safe way to distinguish between the two possible argument arrays.\r\n const isOptionsArgs = (maybeOptionsArgs: typeof args): maybeOptionsArgs is [SceneSource, Scene, ImportAnimationsOptions?] => {\r\n // If the second argument is a Scene, then it must be the options overload.\r\n return maybeOptionsArgs[1] instanceof Scene;\r\n };\r\n\r\n if (isOptionsArgs(args)) {\r\n // Source is mapped to sceneFileName\r\n sceneFilename = args[0];\r\n scene = args[1];\r\n // Options determine the rest of the arguments\r\n ({ rootUrl = \"\", overwriteAnimations, animationGroupLoadingMode, targetConverter, onProgress, pluginExtension, name, pluginOptions } = args[2] ?? {});\r\n } else {\r\n // For the legacy signature, we just directly map each argument\r\n [rootUrl, sceneFilename, scene, overwriteAnimations, animationGroupLoadingMode, targetConverter, , onProgress, , pluginExtension, name] = args;\r\n }\r\n\r\n return new Promise((resolve, reject) => {\r\n SceneLoader._ImportAnimations(\r\n rootUrl,\r\n sceneFilename,\r\n scene,\r\n overwriteAnimations,\r\n animationGroupLoadingMode,\r\n targetConverter,\r\n (_scene: Scene) => {\r\n resolve(_scene);\r\n },\r\n onProgress,\r\n (_scene: Scene, message: string, exception: any) => {\r\n reject(exception || new Error(message));\r\n },\r\n pluginExtension,\r\n name,\r\n pluginOptions\r\n );\r\n });\r\n }\r\n}\r\n"]}
|
|
@@ -911,7 +911,7 @@ export class NodeMaterial extends PushMaterial {
|
|
|
911
911
|
proceduralTexture.nodeMaterialSource = this;
|
|
912
912
|
proceduralTexture._setEffect(effect);
|
|
913
913
|
let buildId = this._buildId;
|
|
914
|
-
|
|
914
|
+
const refreshEffect = () => {
|
|
915
915
|
if (buildId !== this._buildId) {
|
|
916
916
|
delete Effect.ShadersStore[tempName + "VertexShader"];
|
|
917
917
|
delete Effect.ShadersStore[tempName + "PixelShader"];
|
|
@@ -931,6 +931,13 @@ export class NodeMaterial extends PushMaterial {
|
|
|
931
931
|
});
|
|
932
932
|
}
|
|
933
933
|
this._checkInternals(effect);
|
|
934
|
+
};
|
|
935
|
+
proceduralTexture.onBeforeGenerationObservable.add(() => {
|
|
936
|
+
refreshEffect();
|
|
937
|
+
});
|
|
938
|
+
// This is needed if the procedural texture is not set to refresh automatically
|
|
939
|
+
this.onBuildObservable.add(() => {
|
|
940
|
+
refreshEffect();
|
|
934
941
|
});
|
|
935
942
|
return proceduralTexture;
|
|
936
943
|
}
|