@babylonjs/core 5.8.2 → 5.9.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.js +2 -3
- package/Buffers/buffer.js.map +1 -1
- package/Culling/ray.js.map +1 -1
- package/Engines/Processors/shaderCodeNode.js +3 -4
- package/Engines/Processors/shaderCodeNode.js.map +1 -1
- package/Engines/thinEngine.js +2 -2
- package/Engines/thinEngine.js.map +1 -1
- package/Lights/shadowLight.d.ts +2 -0
- package/Lights/shadowLight.js +8 -0
- package/Lights/shadowLight.js.map +1 -1
- package/Loading/Plugins/babylonFileLoader.js +5 -2
- package/Loading/Plugins/babylonFileLoader.js.map +1 -1
- package/Loading/sceneLoader.js +1 -2
- package/Loading/sceneLoader.js.map +1 -1
- package/Materials/Node/nodeMaterialBuildState.js +2 -3
- package/Materials/Node/nodeMaterialBuildState.js.map +1 -1
- package/Materials/Textures/Loaders/basisTextureLoader.js +1 -2
- package/Materials/Textures/Loaders/basisTextureLoader.js.map +1 -1
- package/Materials/Textures/Loaders/ddsTextureLoader.js +1 -2
- package/Materials/Textures/Loaders/ddsTextureLoader.js.map +1 -1
- package/Materials/Textures/Loaders/envTextureLoader.js +1 -2
- package/Materials/Textures/Loaders/envTextureLoader.js.map +1 -1
- package/Materials/Textures/Loaders/hdrTextureLoader.js +1 -2
- package/Materials/Textures/Loaders/hdrTextureLoader.js.map +1 -1
- package/Materials/Textures/Loaders/ktxTextureLoader.js +1 -2
- package/Materials/Textures/Loaders/ktxTextureLoader.js.map +1 -1
- package/Materials/Textures/Loaders/tgaTextureLoader.js +1 -2
- package/Materials/Textures/Loaders/tgaTextureLoader.js.map +1 -1
- package/Materials/Textures/cubeTexture.d.ts +2 -1
- package/Materials/Textures/cubeTexture.js +2 -2
- package/Materials/Textures/cubeTexture.js.map +1 -1
- package/Materials/Textures/texture.d.ts +5 -2
- package/Materials/Textures/texture.js +15 -11
- package/Materials/Textures/texture.js.map +1 -1
- package/Maths/math.vector.d.ts +45 -0
- package/Maths/math.vector.js +92 -7
- package/Maths/math.vector.js.map +1 -1
- package/Meshes/abstractMesh.js +2 -3
- package/Meshes/abstractMesh.js.map +1 -1
- package/Meshes/geometry.js +1 -1
- package/Meshes/geometry.js.map +1 -1
- package/Meshes/instancedMesh.js +11 -9
- package/Meshes/instancedMesh.js.map +1 -1
- package/Meshes/linesMesh.js +3 -0
- package/Meshes/linesMesh.js.map +1 -1
- package/Meshes/mesh.js +2 -2
- package/Meshes/mesh.js.map +1 -1
- package/Misc/deepCopier.js +1 -2
- package/Misc/deepCopier.js.map +1 -1
- package/Misc/index.d.ts +0 -1
- package/Misc/index.js +0 -1
- package/Misc/index.js.map +1 -1
- package/Misc/reflector.js +1 -2
- package/Misc/reflector.js.map +1 -1
- package/Misc/sceneSerializer.js +7 -2
- package/Misc/sceneSerializer.js.map +1 -1
- package/Misc/stringTools.d.ts +2 -0
- package/Misc/stringTools.js +4 -2
- package/Misc/stringTools.js.map +1 -1
- package/Misc/tools.d.ts +0 -17
- package/Misc/tools.js +0 -25
- package/Misc/tools.js.map +1 -1
- package/Particles/solidParticleSystem.js +6 -7
- package/Particles/solidParticleSystem.js.map +1 -1
- package/Rendering/edgesRenderer.js +1 -2
- package/Rendering/edgesRenderer.js.map +1 -1
- package/abstractScene.d.ts +1 -0
- package/abstractScene.js +1 -0
- package/abstractScene.js.map +1 -1
- package/package.json +1 -1
- package/scene.d.ts +2 -0
- package/scene.js +4 -6
- package/scene.js.map +1 -1
- package/Misc/promise.d.ts +0 -11
- package/Misc/promise.js +0 -230
- package/Misc/promise.js.map +0 -1
- package/Misc/sliceTools.d.ts +0 -22
- package/Misc/sliceTools.js +0 -37
- package/Misc/sliceTools.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sceneLoader.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Loading/sceneLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE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A2B,CAAC;IAE/E;;OAEG;IACoB,4BAAgB,GAAG,SAAS,CAAC,4BAA4B,CAAC;IAiDjF,UAAU;IAEV;;OAEG;IACW,uCAA2B,GAAG,IAAI,UAAU,EAAgD,CAAC;IAE5F,8BAAkB,GAA+C,EAAE,CAAC;IAEpE,iCAAqB,GAAG,KAAK,CAAC;IAm5BjD,kBAAC;CAAA,AAh+BD,IAg+BC;SAh+BY,WAAW","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 { Engine } from \"../Engines/engine\";\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 { StartsWith } from \"../Misc/stringTools\";\r\nimport { RuntimeError, ErrorCodes } from \"../Misc/error\";\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) => 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/**\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 * @return 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 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 * @returns a file request object\r\n */\r\n loadFile?(\r\n scene: Scene,\r\n fileOrUrl: File | string,\r\n onSuccess: (data: any, responseURL?: string) => void,\r\n onProgress?: (ev: ISceneLoaderProgressEvent) => void,\r\n useArrayBuffer?: boolean,\r\n onError?: (request?: WebRequest, exception?: LoadFileError) => void\r\n ): 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): any;\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: any,\r\n scene: Scene,\r\n data: any,\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: any, 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: any, 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: any,\r\n scene: Scene,\r\n data: any,\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: any, 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: any, 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 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 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 | ISceneLoaderPluginFactory;\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/**\r\n * Class used to load scene from various file formats using registered plugins\r\n * @see https://doc.babylonjs.com/how_to/load_from_any_file_type\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/how_to/load_from_any_file_type\"\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 let errorMessage = \"Unable to load from \" + fileInfo.url;\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: any, 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 ): Nullable<ISceneLoaderPlugin | ISceneLoaderPluginAsync> {\r\n const directLoad = SceneLoader._GetDirectLoad(fileInfo.url);\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 let plugin: ISceneLoaderPlugin | ISceneLoaderPluginAsync;\r\n if ((registeredPlugin.plugin as ISceneLoaderPluginFactory).createPlugin !== undefined) {\r\n plugin = (registeredPlugin.plugin as ISceneLoaderPluginFactory).createPlugin();\r\n } else {\r\n plugin = <any>registeredPlugin.plugin;\r\n }\r\n\r\n if (!plugin) {\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.then) {\r\n result\r\n .then((data: any) => {\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: any, 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 const onDisposeObservable = (plugin as any).onDisposeObservable as Observable<ISceneLoaderPlugin | ISceneLoaderPluginAsync>;\r\n if (onDisposeObservable) {\r\n 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\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 const fileOrUrl = fileInfo.file || fileInfo.url;\r\n request = plugin.loadFile\r\n ? plugin.loadFile(scene, fileOrUrl, dataCallback, onProgress, useArrayBuffer, errorCallback)\r\n : scene._loadFile(fileOrUrl, 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): Nullable<IFileInfo> {\r\n let url: string;\r\n let name: string;\r\n let file: Nullable<File> = 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 (typeof sceneFilename === \"string\" && StartsWith(sceneFilename, \"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 };\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 * @returns The loaded plugin\r\n */\r\n public static ImportMesh(\r\n meshNames: any,\r\n rootUrl: string,\r\n sceneFilename: string | File = \"\",\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 ): 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) => {\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);\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 ((<any>plugin).importMesh) {\r\n const syncedPlugin = <ISceneLoaderPlugin>plugin;\r\n const meshes = new Array<AbstractMesh>();\r\n const particleSystems = new Array<IParticleSystem>();\r\n const skeletons = new Array<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 );\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 );\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 * @returns The loaded list of imported meshes, particle systems, skeletons, and animation groups\r\n */\r\n public static ImportMeshAsync(\r\n meshNames: any,\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<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) => {\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 });\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 * 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 * @returns The loaded plugin\r\n */\r\n public static Load(\r\n rootUrl: string,\r\n sceneFilename: string | File = \"\",\r\n engine: Nullable<Engine> = 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 ): 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);\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 * @returns The loaded scene\r\n */\r\n public static LoadAsync(\r\n rootUrl: string,\r\n sceneFilename: string | File = \"\",\r\n engine: Nullable<Engine> = EngineStore.LastCreatedEngine,\r\n onProgress: Nullable<(event: ISceneLoaderProgressEvent) => void> = null,\r\n pluginExtension: Nullable<string> = null\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 );\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 * @returns The loaded plugin\r\n */\r\n public static Append(\r\n rootUrl: string,\r\n sceneFilename: string | File = \"\",\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 ): 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 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 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 = () => {\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 ((<any>plugin).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 );\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 * @returns The given scene\r\n */\r\n public static AppendAsync(\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<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 );\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 * @returns The loaded plugin\r\n */\r\n public static LoadAssetContainer(\r\n rootUrl: string,\r\n sceneFilename: string | File = \"\",\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 ): 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 ((<any>plugin).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\r\n scene.loadingPluginName = plugin.name;\r\n successHandler(assetContainer);\r\n } else if ((<any>plugin).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 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 );\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":["../../../../../lts/core/generated/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,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,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;AAqQzD;;GAEG;AACH,MAAM,CAAN,IAAY,oCAoBX;AApBD,WAAY,oCAAoC;IAC5C;;OAEG;IACH,iGAAS,CAAA;IAET;;OAEG;IACH,+FAAQ,CAAA;IAER;;OAEG;IACH,+FAAQ,CAAA;IAER;;OAEG;IACH,mGAAU,CAAA;AACd,CAAC,EApBW,oCAAoC,KAApC,oCAAoC,QAoB/C;AAsCD;;;GAGG;AACH;IAAA;IAg+BA,CAAC;IAx8BG,sBAAkB,kDAAmC;QAHrD;;WAEG;aACH;YACI,OAAO,gBAAgB,CAAC,mCAA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,EAAE,OAAe,EAAE,SAAc;gBAC3C,MAAM,CAAC,SAAS,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;YAC5C,CAAC,EACD,eAAe,CAClB,CAAC;QACN,CAAC,CAAC,CAAC;IACP,CAAC;IA99BD;;OAEG;IACoB,sBAAU,GAAG,SAAS,CAAC,sBAAsB,CAAC;IAErE;;OAEG;IACoB,2BAAe,GAAG,SAAS,CAAC,2BAA2B,CAAC;IAE/E;;OAEG;IACoB,2BAAe,GAAG,SAAS,CAAC,2BAA2B,CAAC;IAE/E;;OAEG;IACoB,4BAAgB,GAAG,SAAS,CAAC,4BAA4B,CAAC;IAiDjF,UAAU;IAEV;;OAEG;IACW,uCAA2B,GAAG,IAAI,UAAU,EAAgD,CAAC;IAE5F,8BAAkB,GAA+C,EAAE,CAAC;IAEpE,iCAAqB,GAAG,KAAK,CAAC;IAm5BjD,kBAAC;CAAA,AAh+BD,IAg+BC;SAh+BY,WAAW","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 { Engine } from \"../Engines/engine\";\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\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) => 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/**\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 * @return 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 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 * @returns a file request object\r\n */\r\n loadFile?(\r\n scene: Scene,\r\n fileOrUrl: File | string,\r\n onSuccess: (data: any, responseURL?: string) => void,\r\n onProgress?: (ev: ISceneLoaderProgressEvent) => void,\r\n useArrayBuffer?: boolean,\r\n onError?: (request?: WebRequest, exception?: LoadFileError) => void\r\n ): 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): any;\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: any,\r\n scene: Scene,\r\n data: any,\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: any, 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: any, 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: any,\r\n scene: Scene,\r\n data: any,\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: any, 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: any, 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 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 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 | ISceneLoaderPluginFactory;\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/**\r\n * Class used to load scene from various file formats using registered plugins\r\n * @see https://doc.babylonjs.com/how_to/load_from_any_file_type\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/how_to/load_from_any_file_type\"\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 let errorMessage = \"Unable to load from \" + fileInfo.url;\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: any, 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 ): Nullable<ISceneLoaderPlugin | ISceneLoaderPluginAsync> {\r\n const directLoad = SceneLoader._GetDirectLoad(fileInfo.url);\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 let plugin: ISceneLoaderPlugin | ISceneLoaderPluginAsync;\r\n if ((registeredPlugin.plugin as ISceneLoaderPluginFactory).createPlugin !== undefined) {\r\n plugin = (registeredPlugin.plugin as ISceneLoaderPluginFactory).createPlugin();\r\n } else {\r\n plugin = <any>registeredPlugin.plugin;\r\n }\r\n\r\n if (!plugin) {\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.then) {\r\n result\r\n .then((data: any) => {\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: any, 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 const onDisposeObservable = (plugin as any).onDisposeObservable as Observable<ISceneLoaderPlugin | ISceneLoaderPluginAsync>;\r\n if (onDisposeObservable) {\r\n 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\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 const fileOrUrl = fileInfo.file || fileInfo.url;\r\n request = plugin.loadFile\r\n ? plugin.loadFile(scene, fileOrUrl, dataCallback, onProgress, useArrayBuffer, errorCallback)\r\n : scene._loadFile(fileOrUrl, 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): Nullable<IFileInfo> {\r\n let url: string;\r\n let name: string;\r\n let file: Nullable<File> = 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 (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 };\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 * @returns The loaded plugin\r\n */\r\n public static ImportMesh(\r\n meshNames: any,\r\n rootUrl: string,\r\n sceneFilename: string | File = \"\",\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 ): 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) => {\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);\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 ((<any>plugin).importMesh) {\r\n const syncedPlugin = <ISceneLoaderPlugin>plugin;\r\n const meshes = new Array<AbstractMesh>();\r\n const particleSystems = new Array<IParticleSystem>();\r\n const skeletons = new Array<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 );\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 );\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 * @returns The loaded list of imported meshes, particle systems, skeletons, and animation groups\r\n */\r\n public static ImportMeshAsync(\r\n meshNames: any,\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<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) => {\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 });\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 * 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 * @returns The loaded plugin\r\n */\r\n public static Load(\r\n rootUrl: string,\r\n sceneFilename: string | File = \"\",\r\n engine: Nullable<Engine> = 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 ): 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);\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 * @returns The loaded scene\r\n */\r\n public static LoadAsync(\r\n rootUrl: string,\r\n sceneFilename: string | File = \"\",\r\n engine: Nullable<Engine> = EngineStore.LastCreatedEngine,\r\n onProgress: Nullable<(event: ISceneLoaderProgressEvent) => void> = null,\r\n pluginExtension: Nullable<string> = null\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 );\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 * @returns The loaded plugin\r\n */\r\n public static Append(\r\n rootUrl: string,\r\n sceneFilename: string | File = \"\",\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 ): 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 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 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 = () => {\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 ((<any>plugin).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 );\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 * @returns The given scene\r\n */\r\n public static AppendAsync(\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<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 );\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 * @returns The loaded plugin\r\n */\r\n public static LoadAssetContainer(\r\n rootUrl: string,\r\n sceneFilename: string | File = \"\",\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 ): 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 ((<any>plugin).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\r\n scene.loadingPluginName = plugin.name;\r\n successHandler(assetContainer);\r\n } else if ((<any>plugin).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 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 );\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,7 +1,6 @@
|
|
|
1
1
|
import { NodeMaterialBlockConnectionPointTypes } from "./Enums/nodeMaterialBlockConnectionPointTypes.js";
|
|
2
2
|
import { NodeMaterialBlockTargets } from "./Enums/nodeMaterialBlockTargets.js";
|
|
3
3
|
import { Effect } from "../effect.js";
|
|
4
|
-
import { StartsWith } from "../../Misc/stringTools.js";
|
|
5
4
|
/**
|
|
6
5
|
* Class used to store node based material build state
|
|
7
6
|
*/
|
|
@@ -320,7 +319,7 @@ var NodeMaterialBuildState = /** @class */ (function () {
|
|
|
320
319
|
}
|
|
321
320
|
this.sharedData.varyings.push(name);
|
|
322
321
|
if (define) {
|
|
323
|
-
if (
|
|
322
|
+
if (define.startsWith("defined(")) {
|
|
324
323
|
this.sharedData.varyingDeclaration += "#if ".concat(define, "\r\n");
|
|
325
324
|
}
|
|
326
325
|
else {
|
|
@@ -348,7 +347,7 @@ var NodeMaterialBuildState = /** @class */ (function () {
|
|
|
348
347
|
}
|
|
349
348
|
this.uniforms.push(name);
|
|
350
349
|
if (define) {
|
|
351
|
-
if (
|
|
350
|
+
if (define.startsWith("defined(")) {
|
|
352
351
|
this._uniformDeclaration += "#if ".concat(define, "\r\n");
|
|
353
352
|
}
|
|
354
353
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodeMaterialBuildState.js","sourceRoot":"","sources":["../../../../../../lts/core/generated/Materials/Node/nodeMaterialBuildState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qCAAqC,EAAE,MAAM,+CAA+C,CAAC;AACtG,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAE5E,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD;;GAEG;AACH;IAAA;QACI,sFAAsF;QAC/E,0BAAqB,GAAG,KAAK,CAAC;QACrC;;WAEG;QACI,eAAU,GAAG,IAAI,KAAK,EAAU,CAAC;QACxC;;WAEG;QACI,aAAQ,GAAG,IAAI,KAAK,EAAU,CAAC;QACtC;;WAEG;QACI,cAAS,GAAG,IAAI,KAAK,EAAU,CAAC;QACvC;;WAEG;QACI,aAAQ,GAAG,IAAI,KAAK,EAAU,CAAC;QACtC;;WAEG;QACI,cAAS,GAA8B,EAAE,CAAC;QACjD;;WAEG;QACI,eAAU,GAA8B,EAAE,CAAC;QAMlD;;WAEG;QACI,aAAQ,GAA8B,EAAE,CAAC;QAUhD,cAAc;QACP,0BAAqB,GAAG,EAAE,CAAC;QAClC,cAAc;QACP,wBAAmB,GAAG,EAAE,CAAC;QAChC,cAAc;QACP,yBAAoB,GAAG,EAAE,CAAC;QACjC,cAAc;QACP,wBAAmB,GAAG,EAAE,CAAC;QAChC,cAAc;QACP,qBAAgB,GAAG,EAAE,CAAC;QAC7B,cAAc;QACP,iBAAY,GAAG,EAAE,CAAC;QAEjB,kCAA6B,GAAG,CAAC,CAAC;QAC1C,cAAc;QACP,4BAAuB,GAAG,EAAE,CAAC;QAEpC;;WAEG;QAC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CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE;YACpC,OAAO;SACV;QAED,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEzB,IAAI,MAAM,EAAE;YACR,IAAI,UAAU,CAAC,MAAM,EAAE,UAAU,CAAC,EAAE;gBAChC,IAAI,CAAC,mBAAmB,IAAI,cAAO,MAAM,SAAM,CAAC;aACnD;iBAAM;gBACH,IAAI,CAAC,mBAAmB,IAAI,UAAG,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,cAAI,MAAM,SAAM,CAAC;aACnF;SACJ;QACD,IAAI,CAAC,mBAAmB,IAAI,kBAAW,IAAI,cAAI,IAAI,UAAO,CAAC;QAC3D,IAAI,MAAM,EAAE;YACR,IAAI,CAAC,mBAAmB,IAAI,YAAY,CAAC;SAC5C;IACL,CAAC;IAED;;;OAGG;IACI,2CAAU,GAAjB,UAAkB,KAAa;QAC3B,IAAI,KAAK,CAAC,QAAQ,EAAE,KAAK,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;YACvC,OAAO,UAAG,KAAK,OAAI,CAAC;SACvB;QAED,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC;IAC5B,CAAC;IACL,6BAAC;AAAD,CAAC,AA1bD,IA0bC","sourcesContent":["import { NodeMaterialBlockConnectionPointTypes } from \"./Enums/nodeMaterialBlockConnectionPointTypes\";\r\nimport { NodeMaterialBlockTargets } from \"./Enums/nodeMaterialBlockTargets\";\r\nimport type { NodeMaterialBuildStateSharedData } from \"./nodeMaterialBuildStateSharedData\";\r\nimport { Effect } from \"../effect\";\r\nimport { StartsWith } from \"../../Misc/stringTools\";\r\n\r\n/**\r\n * Class used to store node based material build state\r\n */\r\nexport class NodeMaterialBuildState {\r\n /** Gets or sets a boolean indicating if the current state can emit uniform buffers */\r\n public supportUniformBuffers = false;\r\n /**\r\n * Gets the list of emitted attributes\r\n */\r\n public attributes = new Array<string>();\r\n /**\r\n * Gets the list of emitted uniforms\r\n */\r\n public uniforms = new Array<string>();\r\n /**\r\n * Gets the list of emitted constants\r\n */\r\n public constants = new Array<string>();\r\n /**\r\n * Gets the list of emitted samplers\r\n */\r\n public samplers = new Array<string>();\r\n /**\r\n * Gets the list of emitted functions\r\n */\r\n public functions: { [key: string]: string } = {};\r\n /**\r\n * Gets the list of emitted extensions\r\n */\r\n public extensions: { [key: string]: string } = {};\r\n\r\n /**\r\n * Gets the target of the compilation state\r\n */\r\n public target: NodeMaterialBlockTargets;\r\n /**\r\n * Gets the list of emitted counters\r\n */\r\n public counters: { [key: string]: number } = {};\r\n\r\n /**\r\n * Shared data between multiple NodeMaterialBuildState instances\r\n */\r\n public sharedData: NodeMaterialBuildStateSharedData;\r\n\r\n /** @hidden */\r\n public _vertexState: NodeMaterialBuildState;\r\n\r\n /** @hidden */\r\n public _attributeDeclaration = \"\";\r\n /** @hidden */\r\n public _uniformDeclaration = \"\";\r\n /** @hidden */\r\n public _constantDeclaration = \"\";\r\n /** @hidden */\r\n public _samplerDeclaration = \"\";\r\n /** @hidden */\r\n public _varyingTransfer = \"\";\r\n /** @hidden */\r\n public _injectAtEnd = \"\";\r\n\r\n private _repeatableContentAnchorIndex = 0;\r\n /** @hidden */\r\n public _builtCompilationString = \"\";\r\n\r\n /**\r\n * Gets the emitted compilation strings\r\n */\r\n public compilationString = \"\";\r\n\r\n /**\r\n * Finalize the compilation strings\r\n * @param state defines the current compilation state\r\n */\r\n public finalize(state: NodeMaterialBuildState) {\r\n const emitComments = state.sharedData.emitComments;\r\n const isFragmentMode = this.target === NodeMaterialBlockTargets.Fragment;\r\n\r\n this.compilationString = `\\r\\n${emitComments ? \"//Entry point\\r\\n\" : \"\"}void main(void) {\\r\\n${this.compilationString}`;\r\n\r\n if (this._constantDeclaration) {\r\n this.compilationString = `\\r\\n${emitComments ? \"//Constants\\r\\n\" : \"\"}${this._constantDeclaration}\\r\\n${this.compilationString}`;\r\n }\r\n\r\n let functionCode = \"\";\r\n for (const functionName in this.functions) {\r\n functionCode += this.functions[functionName] + `\\r\\n`;\r\n }\r\n this.compilationString = `\\r\\n${functionCode}\\r\\n${this.compilationString}`;\r\n\r\n if (!isFragmentMode && this._varyingTransfer) {\r\n this.compilationString = `${this.compilationString}\\r\\n${this._varyingTransfer}`;\r\n }\r\n\r\n if (this._injectAtEnd) {\r\n this.compilationString = `${this.compilationString}\\r\\n${this._injectAtEnd}`;\r\n }\r\n\r\n this.compilationString = `${this.compilationString}\\r\\n}`;\r\n\r\n if (this.sharedData.varyingDeclaration) {\r\n this.compilationString = `\\r\\n${emitComments ? \"//Varyings\\r\\n\" : \"\"}${this.sharedData.varyingDeclaration}\\r\\n${this.compilationString}`;\r\n }\r\n\r\n if (this._samplerDeclaration) {\r\n this.compilationString = `\\r\\n${emitComments ? \"//Samplers\\r\\n\" : \"\"}${this._samplerDeclaration}\\r\\n${this.compilationString}`;\r\n }\r\n\r\n if (this._uniformDeclaration) {\r\n this.compilationString = `\\r\\n${emitComments ? \"//Uniforms\\r\\n\" : \"\"}${this._uniformDeclaration}\\r\\n${this.compilationString}`;\r\n }\r\n\r\n if (this._attributeDeclaration && !isFragmentMode) {\r\n this.compilationString = `\\r\\n${emitComments ? \"//Attributes\\r\\n\" : \"\"}${this._attributeDeclaration}\\r\\n${this.compilationString}`;\r\n }\r\n\r\n this.compilationString = \"precision highp float;\\r\\n\" + this.compilationString;\r\n\r\n for (const extensionName in this.extensions) {\r\n const extension = this.extensions[extensionName];\r\n this.compilationString = `\\r\\n${extension}\\r\\n${this.compilationString}`;\r\n }\r\n\r\n this._builtCompilationString = this.compilationString;\r\n }\r\n\r\n /** @hidden */\r\n public get _repeatableContentAnchor(): string {\r\n return `###___ANCHOR${this._repeatableContentAnchorIndex++}___###`;\r\n }\r\n\r\n /**\r\n * @param prefix\r\n * @hidden\r\n */\r\n public _getFreeVariableName(prefix: string): string {\r\n prefix = prefix.replace(/[^a-zA-Z_]+/g, \"\");\r\n\r\n if (this.sharedData.variableNames[prefix] === undefined) {\r\n this.sharedData.variableNames[prefix] = 0;\r\n\r\n // Check reserved words\r\n if (prefix === \"output\" || prefix === \"texture\") {\r\n return prefix + this.sharedData.variableNames[prefix];\r\n }\r\n\r\n return prefix;\r\n } else {\r\n this.sharedData.variableNames[prefix]++;\r\n }\r\n\r\n return prefix + this.sharedData.variableNames[prefix];\r\n }\r\n\r\n /**\r\n * @param prefix\r\n * @hidden\r\n */\r\n public _getFreeDefineName(prefix: string): string {\r\n if (this.sharedData.defineNames[prefix] === undefined) {\r\n this.sharedData.defineNames[prefix] = 0;\r\n } else {\r\n this.sharedData.defineNames[prefix]++;\r\n }\r\n\r\n return prefix + this.sharedData.defineNames[prefix];\r\n }\r\n\r\n /**\r\n * @param name\r\n * @hidden\r\n */\r\n public _excludeVariableName(name: string) {\r\n this.sharedData.variableNames[name] = 0;\r\n }\r\n\r\n /**\r\n * @param name\r\n * @hidden\r\n */\r\n public _emit2DSampler(name: string) {\r\n if (this.samplers.indexOf(name) < 0) {\r\n this._samplerDeclaration += `uniform sampler2D ${name};\\r\\n`;\r\n this.samplers.push(name);\r\n }\r\n }\r\n\r\n /**\r\n * @param type\r\n * @hidden\r\n */\r\n public _getGLType(type: NodeMaterialBlockConnectionPointTypes): string {\r\n switch (type) {\r\n case NodeMaterialBlockConnectionPointTypes.Float:\r\n return \"float\";\r\n case NodeMaterialBlockConnectionPointTypes.Int:\r\n return \"int\";\r\n case NodeMaterialBlockConnectionPointTypes.Vector2:\r\n return \"vec2\";\r\n case NodeMaterialBlockConnectionPointTypes.Color3:\r\n case NodeMaterialBlockConnectionPointTypes.Vector3:\r\n return \"vec3\";\r\n case NodeMaterialBlockConnectionPointTypes.Color4:\r\n case NodeMaterialBlockConnectionPointTypes.Vector4:\r\n return \"vec4\";\r\n case NodeMaterialBlockConnectionPointTypes.Matrix:\r\n return \"mat4\";\r\n }\r\n\r\n return \"\";\r\n }\r\n\r\n /**\r\n * @param name\r\n * @param extension\r\n * @param define\r\n * @hidden\r\n */\r\n public _emitExtension(name: string, extension: string, define: string = \"\") {\r\n if (this.extensions[name]) {\r\n return;\r\n }\r\n\r\n if (define) {\r\n extension = `#if ${define}\\r\\n${extension}\\r\\n#endif`;\r\n }\r\n this.extensions[name] = extension;\r\n }\r\n\r\n /**\r\n * @param name\r\n * @param code\r\n * @param comments\r\n * @hidden\r\n */\r\n public _emitFunction(name: string, code: string, comments: string) {\r\n if (this.functions[name]) {\r\n return;\r\n }\r\n\r\n if (this.sharedData.emitComments) {\r\n code = comments + `\\r\\n` + code;\r\n }\r\n\r\n this.functions[name] = code;\r\n }\r\n\r\n /**\r\n * @param includeName\r\n * @param comments\r\n * @param options\r\n * @param options.replaceStrings\r\n * @param options.repeatKey\r\n * @hidden\r\n */\r\n public _emitCodeFromInclude(\r\n includeName: string,\r\n comments: string,\r\n options?: {\r\n replaceStrings?: { search: RegExp; replace: string }[];\r\n repeatKey?: string;\r\n }\r\n ) {\r\n if (options && options.repeatKey) {\r\n return `#include<${includeName}>[0..${options.repeatKey}]\\r\\n`;\r\n }\r\n\r\n let code = Effect.IncludesShadersStore[includeName] + \"\\r\\n\";\r\n\r\n if (this.sharedData.emitComments) {\r\n code = comments + `\\r\\n` + code;\r\n }\r\n\r\n if (!options) {\r\n return code;\r\n }\r\n\r\n if (options.replaceStrings) {\r\n for (let index = 0; index < options.replaceStrings.length; index++) {\r\n const replaceString = options.replaceStrings[index];\r\n code = code.replace(replaceString.search, replaceString.replace);\r\n }\r\n }\r\n\r\n return code;\r\n }\r\n\r\n /**\r\n * @param includeName\r\n * @param comments\r\n * @param options\r\n * @param options.repeatKey\r\n * @param options.removeAttributes\r\n * @param options.removeUniforms\r\n * @param options.removeVaryings\r\n * @param options.removeIfDef\r\n * @param options.replaceStrings\r\n * @param storeKey\r\n * @hidden\r\n */\r\n public _emitFunctionFromInclude(\r\n includeName: string,\r\n comments: string,\r\n options?: {\r\n repeatKey?: string;\r\n removeAttributes?: boolean;\r\n removeUniforms?: boolean;\r\n removeVaryings?: boolean;\r\n removeIfDef?: boolean;\r\n replaceStrings?: { search: RegExp; replace: string }[];\r\n },\r\n storeKey: string = \"\"\r\n ) {\r\n const key = includeName + storeKey;\r\n if (this.functions[key]) {\r\n return;\r\n }\r\n\r\n if (!options || (!options.removeAttributes && !options.removeUniforms && !options.removeVaryings && !options.removeIfDef && !options.replaceStrings)) {\r\n if (options && options.repeatKey) {\r\n this.functions[key] = `#include<${includeName}>[0..${options.repeatKey}]\\r\\n`;\r\n } else {\r\n this.functions[key] = `#include<${includeName}>\\r\\n`;\r\n }\r\n\r\n if (this.sharedData.emitComments) {\r\n this.functions[key] = comments + `\\r\\n` + this.functions[key];\r\n }\r\n\r\n return;\r\n }\r\n\r\n this.functions[key] = Effect.IncludesShadersStore[includeName];\r\n\r\n if (this.sharedData.emitComments) {\r\n this.functions[key] = comments + `\\r\\n` + this.functions[key];\r\n }\r\n\r\n if (options.removeIfDef) {\r\n this.functions[key] = this.functions[key].replace(/^\\s*?#ifdef.+$/gm, \"\");\r\n this.functions[key] = this.functions[key].replace(/^\\s*?#endif.*$/gm, \"\");\r\n this.functions[key] = this.functions[key].replace(/^\\s*?#else.*$/gm, \"\");\r\n this.functions[key] = this.functions[key].replace(/^\\s*?#elif.*$/gm, \"\");\r\n }\r\n\r\n if (options.removeAttributes) {\r\n this.functions[key] = this.functions[key].replace(/^\\s*?attribute.+$/gm, \"\");\r\n }\r\n\r\n if (options.removeUniforms) {\r\n this.functions[key] = this.functions[key].replace(/^\\s*?uniform.+$/gm, \"\");\r\n }\r\n\r\n if (options.removeVaryings) {\r\n this.functions[key] = this.functions[key].replace(/^\\s*?varying.+$/gm, \"\");\r\n }\r\n\r\n if (options.replaceStrings) {\r\n for (let index = 0; index < options.replaceStrings.length; index++) {\r\n const replaceString = options.replaceStrings[index];\r\n this.functions[key] = this.functions[key].replace(replaceString.search, replaceString.replace);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @param name\r\n * @hidden\r\n */\r\n public _registerTempVariable(name: string) {\r\n if (this.sharedData.temps.indexOf(name) !== -1) {\r\n return false;\r\n }\r\n\r\n this.sharedData.temps.push(name);\r\n return true;\r\n }\r\n\r\n /**\r\n * @param name\r\n * @param type\r\n * @param define\r\n * @param notDefine\r\n * @hidden\r\n */\r\n public _emitVaryingFromString(name: string, type: string, define: string = \"\", notDefine = false) {\r\n if (this.sharedData.varyings.indexOf(name) !== -1) {\r\n return false;\r\n }\r\n\r\n this.sharedData.varyings.push(name);\r\n\r\n if (define) {\r\n if (StartsWith(define, \"defined(\")) {\r\n this.sharedData.varyingDeclaration += `#if ${define}\\r\\n`;\r\n } else {\r\n this.sharedData.varyingDeclaration += `${notDefine ? \"#ifndef\" : \"#ifdef\"} ${define}\\r\\n`;\r\n }\r\n }\r\n this.sharedData.varyingDeclaration += `varying ${type} ${name};\\r\\n`;\r\n if (define) {\r\n this.sharedData.varyingDeclaration += `#endif\\r\\n`;\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * @param name\r\n * @param type\r\n * @param define\r\n * @param notDefine\r\n * @hidden\r\n */\r\n public _emitUniformFromString(name: string, type: string, define: string = \"\", notDefine = false) {\r\n if (this.uniforms.indexOf(name) !== -1) {\r\n return;\r\n }\r\n\r\n this.uniforms.push(name);\r\n\r\n if (define) {\r\n if (StartsWith(define, \"defined(\")) {\r\n this._uniformDeclaration += `#if ${define}\\r\\n`;\r\n } else {\r\n this._uniformDeclaration += `${notDefine ? \"#ifndef\" : \"#ifdef\"} ${define}\\r\\n`;\r\n }\r\n }\r\n this._uniformDeclaration += `uniform ${type} ${name};\\r\\n`;\r\n if (define) {\r\n this._uniformDeclaration += `#endif\\r\\n`;\r\n }\r\n }\r\n\r\n /**\r\n * @param value\r\n * @hidden\r\n */\r\n public _emitFloat(value: number) {\r\n if (value.toString() === value.toFixed(0)) {\r\n return `${value}.0`;\r\n }\r\n\r\n return value.toString();\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"nodeMaterialBuildState.js","sourceRoot":"","sources":["../../../../../../lts/core/generated/Materials/Node/nodeMaterialBuildState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qCAAqC,EAAE,MAAM,+CAA+C,CAAC;AACtG,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAE5E,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC;;GAEG;AACH;IAAA;QACI,sFAAsF;QAC/E,0BAAqB,GAAG,KAAK,CAAC;QACrC;;WAEG;QACI,eAAU,GAAG,IAAI,KAAK,EAAU,CAAC;QACxC;;WAEG;QACI,aAAQ,GAAG,IAAI,KAAK,EAAU,CAAC;QACtC;;WAEG;QACI,cAAS,GAAG,IAAI,KAAK,EAAU,CAAC;QACvC;;WAEG;QACI,aAAQ,GAAG,IAAI,KAAK,EAAU,CAAC;QACtC;;WAEG;QACI,cAAS,GAA8B,EAAE,CAAC;QACjD;;WAEG;QACI,eAAU,GAA8B,EAAE,CAAC;QAMlD;;WAEG;QACI,aAAQ,GAA8B,EAAE,CAAC;QAUhD,cAAc;QACP,0BAAqB,GAAG,EAAE,CAAC;QAClC,cAAc;QACP,wBAAmB,GAAG,EAAE,CAAC;QAChC,cAAc;QACP,yBAAoB,GAAG,EAAE,CAAC;QACjC,cAAc;QACP,wBAAmB,GAAG,EAAE,CAAC;QAChC,cAAc;QACP,qBAAgB,GAAG,EAAE,CAAC;QAC7B,cAAc;QACP,iBAAY,GAAG,EAAE,CAAC;QAEjB,kCAA6B,GAAG,CAAC,CAAC;QAC1C,cAAc;QACP,4BAAuB,GAAG,EAAE,CAAC;QAEpC;;WAEG;QACI,sBAAiB,GAAG,EAAE,CAAC;IAyXlC,CAAC;IAvXG;;;OAGG;IACI,yCAAQ,GAAf,UAAgB,KAA6B;QACzC,IAAM,YAAY,GAAG,KAAK,CAAC,UAAU,CAAC,YAAY,CAAC;QACnD,IAAM,cAAc,GAAG,IAAI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MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE;gBAC/B,IAAI,CAAC,mBAAmB,IAAI,cAAO,MAAM,SAAM,CAAC;aACnD;iBAAM;gBACH,IAAI,CAAC,mBAAmB,IAAI,UAAG,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,cAAI,MAAM,SAAM,CAAC;aACnF;SACJ;QACD,IAAI,CAAC,mBAAmB,IAAI,kBAAW,IAAI,cAAI,IAAI,UAAO,CAAC;QAC3D,IAAI,MAAM,EAAE;YACR,IAAI,CAAC,mBAAmB,IAAI,YAAY,CAAC;SAC5C;IACL,CAAC;IAED;;;OAGG;IACI,2CAAU,GAAjB,UAAkB,KAAa;QAC3B,IAAI,KAAK,CAAC,QAAQ,EAAE,KAAK,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;YACvC,OAAO,UAAG,KAAK,OAAI,CAAC;SACvB;QAED,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC;IAC5B,CAAC;IACL,6BAAC;AAAD,CAAC,AA1bD,IA0bC","sourcesContent":["import { NodeMaterialBlockConnectionPointTypes } from \"./Enums/nodeMaterialBlockConnectionPointTypes\";\r\nimport { NodeMaterialBlockTargets } from \"./Enums/nodeMaterialBlockTargets\";\r\nimport type { NodeMaterialBuildStateSharedData } from \"./nodeMaterialBuildStateSharedData\";\r\nimport { Effect } from \"../effect\";\r\n\r\n/**\r\n * Class used to store node based material build state\r\n */\r\nexport class NodeMaterialBuildState {\r\n /** Gets or sets a boolean indicating if the current state can emit uniform buffers */\r\n public supportUniformBuffers = false;\r\n /**\r\n * Gets the list of emitted attributes\r\n */\r\n public attributes = new Array<string>();\r\n /**\r\n * Gets the list of emitted uniforms\r\n */\r\n public uniforms = new Array<string>();\r\n /**\r\n * Gets the list of emitted constants\r\n */\r\n public constants = new Array<string>();\r\n /**\r\n * Gets the list of emitted samplers\r\n */\r\n public samplers = new Array<string>();\r\n /**\r\n * Gets the list of emitted functions\r\n */\r\n public functions: { [key: string]: string } = {};\r\n /**\r\n * Gets the list of emitted extensions\r\n */\r\n public extensions: { [key: string]: string } = {};\r\n\r\n /**\r\n * Gets the target of the compilation state\r\n */\r\n public target: NodeMaterialBlockTargets;\r\n /**\r\n * Gets the list of emitted counters\r\n */\r\n public counters: { [key: string]: number } = {};\r\n\r\n /**\r\n * Shared data between multiple NodeMaterialBuildState instances\r\n */\r\n public sharedData: NodeMaterialBuildStateSharedData;\r\n\r\n /** @hidden */\r\n public _vertexState: NodeMaterialBuildState;\r\n\r\n /** @hidden */\r\n public _attributeDeclaration = \"\";\r\n /** @hidden */\r\n public _uniformDeclaration = \"\";\r\n /** @hidden */\r\n public _constantDeclaration = \"\";\r\n /** @hidden */\r\n public _samplerDeclaration = \"\";\r\n /** @hidden */\r\n public _varyingTransfer = \"\";\r\n /** @hidden */\r\n public _injectAtEnd = \"\";\r\n\r\n private _repeatableContentAnchorIndex = 0;\r\n /** @hidden */\r\n public _builtCompilationString = \"\";\r\n\r\n /**\r\n * Gets the emitted compilation strings\r\n */\r\n public compilationString = \"\";\r\n\r\n /**\r\n * Finalize the compilation strings\r\n * @param state defines the current compilation state\r\n */\r\n public finalize(state: NodeMaterialBuildState) {\r\n const emitComments = state.sharedData.emitComments;\r\n const isFragmentMode = this.target === NodeMaterialBlockTargets.Fragment;\r\n\r\n this.compilationString = `\\r\\n${emitComments ? \"//Entry point\\r\\n\" : \"\"}void main(void) {\\r\\n${this.compilationString}`;\r\n\r\n if (this._constantDeclaration) {\r\n this.compilationString = `\\r\\n${emitComments ? \"//Constants\\r\\n\" : \"\"}${this._constantDeclaration}\\r\\n${this.compilationString}`;\r\n }\r\n\r\n let functionCode = \"\";\r\n for (const functionName in this.functions) {\r\n functionCode += this.functions[functionName] + `\\r\\n`;\r\n }\r\n this.compilationString = `\\r\\n${functionCode}\\r\\n${this.compilationString}`;\r\n\r\n if (!isFragmentMode && this._varyingTransfer) {\r\n this.compilationString = `${this.compilationString}\\r\\n${this._varyingTransfer}`;\r\n }\r\n\r\n if (this._injectAtEnd) {\r\n this.compilationString = `${this.compilationString}\\r\\n${this._injectAtEnd}`;\r\n }\r\n\r\n this.compilationString = `${this.compilationString}\\r\\n}`;\r\n\r\n if (this.sharedData.varyingDeclaration) {\r\n this.compilationString = `\\r\\n${emitComments ? \"//Varyings\\r\\n\" : \"\"}${this.sharedData.varyingDeclaration}\\r\\n${this.compilationString}`;\r\n }\r\n\r\n if (this._samplerDeclaration) {\r\n this.compilationString = `\\r\\n${emitComments ? \"//Samplers\\r\\n\" : \"\"}${this._samplerDeclaration}\\r\\n${this.compilationString}`;\r\n }\r\n\r\n if (this._uniformDeclaration) {\r\n this.compilationString = `\\r\\n${emitComments ? \"//Uniforms\\r\\n\" : \"\"}${this._uniformDeclaration}\\r\\n${this.compilationString}`;\r\n }\r\n\r\n if (this._attributeDeclaration && !isFragmentMode) {\r\n this.compilationString = `\\r\\n${emitComments ? \"//Attributes\\r\\n\" : \"\"}${this._attributeDeclaration}\\r\\n${this.compilationString}`;\r\n }\r\n\r\n this.compilationString = \"precision highp float;\\r\\n\" + this.compilationString;\r\n\r\n for (const extensionName in this.extensions) {\r\n const extension = this.extensions[extensionName];\r\n this.compilationString = `\\r\\n${extension}\\r\\n${this.compilationString}`;\r\n }\r\n\r\n this._builtCompilationString = this.compilationString;\r\n }\r\n\r\n /** @hidden */\r\n public get _repeatableContentAnchor(): string {\r\n return `###___ANCHOR${this._repeatableContentAnchorIndex++}___###`;\r\n }\r\n\r\n /**\r\n * @param prefix\r\n * @hidden\r\n */\r\n public _getFreeVariableName(prefix: string): string {\r\n prefix = prefix.replace(/[^a-zA-Z_]+/g, \"\");\r\n\r\n if (this.sharedData.variableNames[prefix] === undefined) {\r\n this.sharedData.variableNames[prefix] = 0;\r\n\r\n // Check reserved words\r\n if (prefix === \"output\" || prefix === \"texture\") {\r\n return prefix + this.sharedData.variableNames[prefix];\r\n }\r\n\r\n return prefix;\r\n } else {\r\n this.sharedData.variableNames[prefix]++;\r\n }\r\n\r\n return prefix + this.sharedData.variableNames[prefix];\r\n }\r\n\r\n /**\r\n * @param prefix\r\n * @hidden\r\n */\r\n public _getFreeDefineName(prefix: string): string {\r\n if (this.sharedData.defineNames[prefix] === undefined) {\r\n this.sharedData.defineNames[prefix] = 0;\r\n } else {\r\n this.sharedData.defineNames[prefix]++;\r\n }\r\n\r\n return prefix + this.sharedData.defineNames[prefix];\r\n }\r\n\r\n /**\r\n * @param name\r\n * @hidden\r\n */\r\n public _excludeVariableName(name: string) {\r\n this.sharedData.variableNames[name] = 0;\r\n }\r\n\r\n /**\r\n * @param name\r\n * @hidden\r\n */\r\n public _emit2DSampler(name: string) {\r\n if (this.samplers.indexOf(name) < 0) {\r\n this._samplerDeclaration += `uniform sampler2D ${name};\\r\\n`;\r\n this.samplers.push(name);\r\n }\r\n }\r\n\r\n /**\r\n * @param type\r\n * @hidden\r\n */\r\n public _getGLType(type: NodeMaterialBlockConnectionPointTypes): string {\r\n switch (type) {\r\n case NodeMaterialBlockConnectionPointTypes.Float:\r\n return \"float\";\r\n case NodeMaterialBlockConnectionPointTypes.Int:\r\n return \"int\";\r\n case NodeMaterialBlockConnectionPointTypes.Vector2:\r\n return \"vec2\";\r\n case NodeMaterialBlockConnectionPointTypes.Color3:\r\n case NodeMaterialBlockConnectionPointTypes.Vector3:\r\n return \"vec3\";\r\n case NodeMaterialBlockConnectionPointTypes.Color4:\r\n case NodeMaterialBlockConnectionPointTypes.Vector4:\r\n return \"vec4\";\r\n case NodeMaterialBlockConnectionPointTypes.Matrix:\r\n return \"mat4\";\r\n }\r\n\r\n return \"\";\r\n }\r\n\r\n /**\r\n * @param name\r\n * @param extension\r\n * @param define\r\n * @hidden\r\n */\r\n public _emitExtension(name: string, extension: string, define: string = \"\") {\r\n if (this.extensions[name]) {\r\n return;\r\n }\r\n\r\n if (define) {\r\n extension = `#if ${define}\\r\\n${extension}\\r\\n#endif`;\r\n }\r\n this.extensions[name] = extension;\r\n }\r\n\r\n /**\r\n * @param name\r\n * @param code\r\n * @param comments\r\n * @hidden\r\n */\r\n public _emitFunction(name: string, code: string, comments: string) {\r\n if (this.functions[name]) {\r\n return;\r\n }\r\n\r\n if (this.sharedData.emitComments) {\r\n code = comments + `\\r\\n` + code;\r\n }\r\n\r\n this.functions[name] = code;\r\n }\r\n\r\n /**\r\n * @param includeName\r\n * @param comments\r\n * @param options\r\n * @param options.replaceStrings\r\n * @param options.repeatKey\r\n * @hidden\r\n */\r\n public _emitCodeFromInclude(\r\n includeName: string,\r\n comments: string,\r\n options?: {\r\n replaceStrings?: { search: RegExp; replace: string }[];\r\n repeatKey?: string;\r\n }\r\n ) {\r\n if (options && options.repeatKey) {\r\n return `#include<${includeName}>[0..${options.repeatKey}]\\r\\n`;\r\n }\r\n\r\n let code = Effect.IncludesShadersStore[includeName] + \"\\r\\n\";\r\n\r\n if (this.sharedData.emitComments) {\r\n code = comments + `\\r\\n` + code;\r\n }\r\n\r\n if (!options) {\r\n return code;\r\n }\r\n\r\n if (options.replaceStrings) {\r\n for (let index = 0; index < options.replaceStrings.length; index++) {\r\n const replaceString = options.replaceStrings[index];\r\n code = code.replace(replaceString.search, replaceString.replace);\r\n }\r\n }\r\n\r\n return code;\r\n }\r\n\r\n /**\r\n * @param includeName\r\n * @param comments\r\n * @param options\r\n * @param options.repeatKey\r\n * @param options.removeAttributes\r\n * @param options.removeUniforms\r\n * @param options.removeVaryings\r\n * @param options.removeIfDef\r\n * @param options.replaceStrings\r\n * @param storeKey\r\n * @hidden\r\n */\r\n public _emitFunctionFromInclude(\r\n includeName: string,\r\n comments: string,\r\n options?: {\r\n repeatKey?: string;\r\n removeAttributes?: boolean;\r\n removeUniforms?: boolean;\r\n removeVaryings?: boolean;\r\n removeIfDef?: boolean;\r\n replaceStrings?: { search: RegExp; replace: string }[];\r\n },\r\n storeKey: string = \"\"\r\n ) {\r\n const key = includeName + storeKey;\r\n if (this.functions[key]) {\r\n return;\r\n }\r\n\r\n if (!options || (!options.removeAttributes && !options.removeUniforms && !options.removeVaryings && !options.removeIfDef && !options.replaceStrings)) {\r\n if (options && options.repeatKey) {\r\n this.functions[key] = `#include<${includeName}>[0..${options.repeatKey}]\\r\\n`;\r\n } else {\r\n this.functions[key] = `#include<${includeName}>\\r\\n`;\r\n }\r\n\r\n if (this.sharedData.emitComments) {\r\n this.functions[key] = comments + `\\r\\n` + this.functions[key];\r\n }\r\n\r\n return;\r\n }\r\n\r\n this.functions[key] = Effect.IncludesShadersStore[includeName];\r\n\r\n if (this.sharedData.emitComments) {\r\n this.functions[key] = comments + `\\r\\n` + this.functions[key];\r\n }\r\n\r\n if (options.removeIfDef) {\r\n this.functions[key] = this.functions[key].replace(/^\\s*?#ifdef.+$/gm, \"\");\r\n this.functions[key] = this.functions[key].replace(/^\\s*?#endif.*$/gm, \"\");\r\n this.functions[key] = this.functions[key].replace(/^\\s*?#else.*$/gm, \"\");\r\n this.functions[key] = this.functions[key].replace(/^\\s*?#elif.*$/gm, \"\");\r\n }\r\n\r\n if (options.removeAttributes) {\r\n this.functions[key] = this.functions[key].replace(/^\\s*?attribute.+$/gm, \"\");\r\n }\r\n\r\n if (options.removeUniforms) {\r\n this.functions[key] = this.functions[key].replace(/^\\s*?uniform.+$/gm, \"\");\r\n }\r\n\r\n if (options.removeVaryings) {\r\n this.functions[key] = this.functions[key].replace(/^\\s*?varying.+$/gm, \"\");\r\n }\r\n\r\n if (options.replaceStrings) {\r\n for (let index = 0; index < options.replaceStrings.length; index++) {\r\n const replaceString = options.replaceStrings[index];\r\n this.functions[key] = this.functions[key].replace(replaceString.search, replaceString.replace);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @param name\r\n * @hidden\r\n */\r\n public _registerTempVariable(name: string) {\r\n if (this.sharedData.temps.indexOf(name) !== -1) {\r\n return false;\r\n }\r\n\r\n this.sharedData.temps.push(name);\r\n return true;\r\n }\r\n\r\n /**\r\n * @param name\r\n * @param type\r\n * @param define\r\n * @param notDefine\r\n * @hidden\r\n */\r\n public _emitVaryingFromString(name: string, type: string, define: string = \"\", notDefine = false) {\r\n if (this.sharedData.varyings.indexOf(name) !== -1) {\r\n return false;\r\n }\r\n\r\n this.sharedData.varyings.push(name);\r\n\r\n if (define) {\r\n if (define.startsWith(\"defined(\")) {\r\n this.sharedData.varyingDeclaration += `#if ${define}\\r\\n`;\r\n } else {\r\n this.sharedData.varyingDeclaration += `${notDefine ? \"#ifndef\" : \"#ifdef\"} ${define}\\r\\n`;\r\n }\r\n }\r\n this.sharedData.varyingDeclaration += `varying ${type} ${name};\\r\\n`;\r\n if (define) {\r\n this.sharedData.varyingDeclaration += `#endif\\r\\n`;\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * @param name\r\n * @param type\r\n * @param define\r\n * @param notDefine\r\n * @hidden\r\n */\r\n public _emitUniformFromString(name: string, type: string, define: string = \"\", notDefine = false) {\r\n if (this.uniforms.indexOf(name) !== -1) {\r\n return;\r\n }\r\n\r\n this.uniforms.push(name);\r\n\r\n if (define) {\r\n if (define.startsWith(\"defined(\")) {\r\n this._uniformDeclaration += `#if ${define}\\r\\n`;\r\n } else {\r\n this._uniformDeclaration += `${notDefine ? \"#ifndef\" : \"#ifdef\"} ${define}\\r\\n`;\r\n }\r\n }\r\n this._uniformDeclaration += `uniform ${type} ${name};\\r\\n`;\r\n if (define) {\r\n this._uniformDeclaration += `#endif\\r\\n`;\r\n }\r\n }\r\n\r\n /**\r\n * @param value\r\n * @hidden\r\n */\r\n public _emitFloat(value: number) {\r\n if (value.toString() === value.toFixed(0)) {\r\n return `${value}.0`;\r\n }\r\n\r\n return value.toString();\r\n }\r\n}\r\n"]}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Engine } from "../../../Engines/engine.js";
|
|
2
2
|
import { LoadTextureFromTranscodeResult, TranscodeAsync } from "../../../Misc/basis.js";
|
|
3
3
|
import { Tools } from "../../../Misc/tools.js";
|
|
4
|
-
import { EndsWith } from "../../../Misc/stringTools.js";
|
|
5
4
|
/**
|
|
6
5
|
* Loader for .basis file format
|
|
7
6
|
*/
|
|
@@ -19,7 +18,7 @@ var _BasisTextureLoader = /** @class */ (function () {
|
|
|
19
18
|
* @returns true if the loader can load the specified file
|
|
20
19
|
*/
|
|
21
20
|
_BasisTextureLoader.prototype.canLoad = function (extension) {
|
|
22
|
-
return
|
|
21
|
+
return extension.endsWith(".basis");
|
|
23
22
|
};
|
|
24
23
|
/**
|
|
25
24
|
* Uploads the cube texture data to the WebGL texture. It has already been bound.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"basisTextureLoader.js","sourceRoot":"","sources":["../../../../../../../lts/core/generated/Materials/Textures/Loaders/basisTextureLoader.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAGjD,OAAO,EAAE,8BAA8B,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrF,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"basisTextureLoader.js","sourceRoot":"","sources":["../../../../../../../lts/core/generated/Materials/Textures/Loaders/basisTextureLoader.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAGjD,OAAO,EAAE,8BAA8B,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrF,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C;;GAEG;AACH,gEAAgE;AAChE;IAAA;QACI;;WAEG;QACa,oBAAe,GAAG,KAAK,CAAC;IA6F5C,CAAC;IA3FG;;;;OAIG;IACI,qCAAO,GAAd,UAAe,SAAiB;QAC5B,OAAO,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACxC,CAAC;IAED;;;;;;;OAOG;IACI,0CAAY,GAAnB,UACI,IAAyC,EACzC,OAAwB,EACxB,iBAA0B,EAC1B,MAAsC,EACtC,OAA8D;QAE9D,IAAI,K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;YACH,KAAK,CAAC,IAAI,CAAC,iFAAiF,CAAC,CAAC;YAC9F,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,cAAO,CAAC,EAAE,IAAI,CAAC,CAAC;QACjD,CAAC,CAAC,CAAC;IACX,CAAC;IACL,0BAAC;AAAD,CAAC,AAjGD,IAiGC;;AAED,uBAAuB;AACvB,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,mBAAmB,EAAE,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"../../../types\";\r\nimport { Engine } from \"../../../Engines/engine\";\r\nimport type { InternalTexture } from \"../../../Materials/Textures/internalTexture\";\r\nimport type { IInternalTextureLoader } from \"../../../Materials/Textures/internalTextureLoader\";\r\nimport { LoadTextureFromTranscodeResult, TranscodeAsync } from \"../../../Misc/basis\";\r\nimport { Tools } from \"../../../Misc/tools\";\r\n\r\n/**\r\n * Loader for .basis file format\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport class _BasisTextureLoader implements IInternalTextureLoader {\r\n /**\r\n * Defines whether the loader supports cascade loading the different faces.\r\n */\r\n public readonly supportCascades = false;\r\n\r\n /**\r\n * This returns if the loader support the current file information.\r\n * @param extension defines the file extension of the file being loaded\r\n * @returns true if the loader can load the specified file\r\n */\r\n public canLoad(extension: string): boolean {\r\n return extension.endsWith(\".basis\");\r\n }\r\n\r\n /**\r\n * Uploads the cube texture data to the WebGL texture. It has already been bound.\r\n * @param data contains the texture data\r\n * @param texture defines the BabylonJS internal texture\r\n * @param createPolynomials will be true if polynomials have been requested\r\n * @param onLoad defines the callback to trigger once the texture is ready\r\n * @param onError defines the callback to trigger in case of error\r\n */\r\n public loadCubeData(\r\n data: ArrayBufferView | ArrayBufferView[],\r\n texture: InternalTexture,\r\n createPolynomials: boolean,\r\n onLoad: Nullable<(data?: any) => void>,\r\n onError: Nullable<(message?: string, exception?: any) => void>\r\n ): void {\r\n if (Array.isArray(data)) {\r\n return;\r\n }\r\n const caps = texture.getEngine().getCaps();\r\n const transcodeConfig = {\r\n supportedCompressionFormats: {\r\n etc1: caps.etc1 ? true : false,\r\n s3tc: caps.s3tc ? true : false,\r\n pvrtc: caps.pvrtc ? true : false,\r\n etc2: caps.etc2 ? true : false,\r\n },\r\n };\r\n TranscodeAsync(data, transcodeConfig)\r\n .then((result) => {\r\n const hasMipmap = result.fileInfo.images[0].levels.length > 1 && texture.generateMipMaps;\r\n LoadTextureFromTranscodeResult(texture, result);\r\n (texture.getEngine() as Engine)._setCubeMapTextureParams(texture, hasMipmap);\r\n texture.isReady = true;\r\n texture.onLoadedObservable.notifyObservers(texture);\r\n texture.onLoadedObservable.clear();\r\n if (onLoad) {\r\n onLoad();\r\n }\r\n })\r\n .catch((err) => {\r\n const errorMessage = \"Failed to transcode Basis file, transcoding may not be supported on this device\";\r\n Tools.Warn(errorMessage);\r\n texture.isReady = true;\r\n if (onError) {\r\n onError(err);\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Uploads the 2D texture data to the WebGL texture. It has already been bound once in the callback.\r\n * @param data contains the texture data\r\n * @param texture defines the BabylonJS internal texture\r\n * @param callback defines the method to call once ready to upload\r\n */\r\n public loadData(\r\n data: ArrayBufferView,\r\n texture: InternalTexture,\r\n callback: (width: number, height: number, loadMipmap: boolean, isCompressed: boolean, done: () => void, failedLoading?: boolean) => void\r\n ): void {\r\n const caps = texture.getEngine().getCaps();\r\n const transcodeConfig = {\r\n supportedCompressionFormats: {\r\n etc1: caps.etc1 ? true : false,\r\n s3tc: caps.s3tc ? true : false,\r\n pvrtc: caps.pvrtc ? true : false,\r\n etc2: caps.etc2 ? true : false,\r\n },\r\n };\r\n TranscodeAsync(data, transcodeConfig)\r\n .then((result) => {\r\n const rootImage = result.fileInfo.images[0].levels[0];\r\n const hasMipmap = result.fileInfo.images[0].levels.length > 1 && texture.generateMipMaps;\r\n callback(rootImage.width, rootImage.height, hasMipmap, result.format !== -1, () => {\r\n LoadTextureFromTranscodeResult(texture, result);\r\n });\r\n })\r\n .catch(() => {\r\n Tools.Warn(\"Failed to transcode Basis file, transcoding may not be supported on this device\");\r\n callback(0, 0, false, false, () => {}, true);\r\n });\r\n }\r\n}\r\n\r\n// Register the loader.\r\nEngine._TextureLoaders.push(new _BasisTextureLoader());\r\n"]}
|