@babylonjs/core 8.6.0 → 8.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/Collisions/gpuPicker.d.ts +1 -0
  2. package/Collisions/gpuPicker.js +14 -9
  3. package/Collisions/gpuPicker.js.map +1 -1
  4. package/Engines/abstractEngine.js +2 -2
  5. package/Engines/abstractEngine.js.map +1 -1
  6. package/Engines/constants.d.ts +12 -0
  7. package/Engines/constants.js +12 -0
  8. package/Engines/constants.js.map +1 -1
  9. package/Engines/webgpuEngine.js +5 -0
  10. package/Engines/webgpuEngine.js.map +1 -1
  11. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.d.ts +6 -0
  12. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.js +4 -1
  13. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.js.map +1 -1
  14. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.d.ts +5 -0
  15. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +23 -0
  16. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
  17. package/Materials/Node/Blocks/PBR/reflectionBlock.js +6 -0
  18. package/Materials/Node/Blocks/PBR/reflectionBlock.js.map +1 -1
  19. package/Materials/PBR/pbrBaseMaterial.d.ts +24 -4
  20. package/Materials/PBR/pbrBaseMaterial.js +83 -8
  21. package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
  22. package/Materials/PBR/pbrMaterial.d.ts +17 -1
  23. package/Materials/PBR/pbrMaterial.js +21 -0
  24. package/Materials/PBR/pbrMaterial.js.map +1 -1
  25. package/Materials/Textures/Filtering/hdrIrradianceFiltering.js +5 -0
  26. package/Materials/Textures/Filtering/hdrIrradianceFiltering.js.map +1 -1
  27. package/Materials/Textures/baseTexture.d.ts +8 -0
  28. package/Materials/Textures/baseTexture.js +7 -0
  29. package/Materials/Textures/baseTexture.js.map +1 -1
  30. package/Materials/materialFlags.d.ts +6 -0
  31. package/Materials/materialFlags.js +14 -0
  32. package/Materials/materialFlags.js.map +1 -1
  33. package/Misc/assetsManager.js +13 -23
  34. package/Misc/assetsManager.js.map +1 -1
  35. package/Misc/minMaxReducer.d.ts +1 -0
  36. package/Misc/minMaxReducer.js +3 -2
  37. package/Misc/minMaxReducer.js.map +1 -1
  38. package/Offline/database.js +25 -6
  39. package/Offline/database.js.map +1 -1
  40. package/Rendering/IBLShadows/iblShadowsAccumulationPass.js +1 -1
  41. package/Rendering/IBLShadows/iblShadowsAccumulationPass.js.map +1 -1
  42. package/Rendering/iblCdfGenerator.d.ts +12 -0
  43. package/Rendering/iblCdfGenerator.js +67 -3
  44. package/Rendering/iblCdfGenerator.js.map +1 -1
  45. package/Rendering/iblCdfGeneratorSceneComponent.js +4 -0
  46. package/Rendering/iblCdfGeneratorSceneComponent.js.map +1 -1
  47. package/Rendering/index.d.ts +2 -0
  48. package/Rendering/index.js +2 -0
  49. package/Rendering/index.js.map +1 -1
  50. package/Shaders/ShadersInclude/hdrFilteringFunctions.js +29 -9
  51. package/Shaders/ShadersInclude/hdrFilteringFunctions.js.map +1 -1
  52. package/Shaders/ShadersInclude/lightFragment.js +4 -3
  53. package/Shaders/ShadersInclude/lightFragment.js.map +1 -1
  54. package/Shaders/ShadersInclude/pbrBRDFFunctions.js +21 -0
  55. package/Shaders/ShadersInclude/pbrBRDFFunctions.js.map +1 -1
  56. package/Shaders/ShadersInclude/pbrBlockAlbedoOpacity.js +2 -2
  57. package/Shaders/ShadersInclude/pbrBlockAlbedoOpacity.js.map +1 -1
  58. package/Shaders/ShadersInclude/pbrBlockReflection.js +22 -1
  59. package/Shaders/ShadersInclude/pbrBlockReflection.js.map +1 -1
  60. package/Shaders/ShadersInclude/pbrBlockReflectivity.js +11 -2
  61. package/Shaders/ShadersInclude/pbrBlockReflectivity.js.map +1 -1
  62. package/Shaders/ShadersInclude/pbrBlockSubSurface.js +1 -1
  63. package/Shaders/ShadersInclude/pbrBlockSubSurface.js.map +1 -1
  64. package/Shaders/ShadersInclude/pbrDirectLightingFunctions.js +16 -3
  65. package/Shaders/ShadersInclude/pbrDirectLightingFunctions.js.map +1 -1
  66. package/Shaders/ShadersInclude/pbrDirectLightingSetupFunctions.js +4 -4
  67. package/Shaders/ShadersInclude/pbrDirectLightingSetupFunctions.js.map +1 -1
  68. package/Shaders/ShadersInclude/pbrFragmentDeclaration.js +8 -2
  69. package/Shaders/ShadersInclude/pbrFragmentDeclaration.js.map +1 -1
  70. package/Shaders/ShadersInclude/pbrFragmentSamplersDeclaration.js +2 -1
  71. package/Shaders/ShadersInclude/pbrFragmentSamplersDeclaration.js.map +1 -1
  72. package/Shaders/ShadersInclude/pbrUboDeclaration.js +1 -1
  73. package/Shaders/ShadersInclude/pbrUboDeclaration.js.map +1 -1
  74. package/Shaders/ShadersInclude/pbrVertexDeclaration.js +6 -2
  75. package/Shaders/ShadersInclude/pbrVertexDeclaration.js.map +1 -1
  76. package/Shaders/hdrIrradianceFiltering.fragment.js +1 -1
  77. package/Shaders/hdrIrradianceFiltering.fragment.js.map +1 -1
  78. package/Shaders/iblDominantDirection.fragment.d.ts +9 -0
  79. package/Shaders/iblDominantDirection.fragment.js +22 -0
  80. package/Shaders/iblDominantDirection.fragment.js.map +1 -0
  81. package/Shaders/pbr.fragment.js +17 -3
  82. package/Shaders/pbr.fragment.js.map +1 -1
  83. package/Shaders/pbr.vertex.js +8 -2
  84. package/Shaders/pbr.vertex.js.map +1 -1
  85. package/ShadersWGSL/ShadersInclude/hdrFilteringFunctions.js +28 -8
  86. package/ShadersWGSL/ShadersInclude/hdrFilteringFunctions.js.map +1 -1
  87. package/ShadersWGSL/ShadersInclude/lightFragment.js +6 -5
  88. package/ShadersWGSL/ShadersInclude/lightFragment.js.map +1 -1
  89. package/ShadersWGSL/ShadersInclude/pbrBRDFFunctions.js +21 -0
  90. package/ShadersWGSL/ShadersInclude/pbrBRDFFunctions.js.map +1 -1
  91. package/ShadersWGSL/ShadersInclude/pbrBlockAlbedoOpacity.js +2 -2
  92. package/ShadersWGSL/ShadersInclude/pbrBlockAlbedoOpacity.js.map +1 -1
  93. package/ShadersWGSL/ShadersInclude/pbrBlockReflection.js +23 -1
  94. package/ShadersWGSL/ShadersInclude/pbrBlockReflection.js.map +1 -1
  95. package/ShadersWGSL/ShadersInclude/pbrBlockReflectivity.js +11 -1
  96. package/ShadersWGSL/ShadersInclude/pbrBlockReflectivity.js.map +1 -1
  97. package/ShadersWGSL/ShadersInclude/pbrBlockSubSurface.js +1 -1
  98. package/ShadersWGSL/ShadersInclude/pbrBlockSubSurface.js.map +1 -1
  99. package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js +19 -3
  100. package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js.map +1 -1
  101. package/ShadersWGSL/ShadersInclude/pbrDirectLightingSetupFunctions.js +4 -1
  102. package/ShadersWGSL/ShadersInclude/pbrDirectLightingSetupFunctions.js.map +1 -1
  103. package/ShadersWGSL/ShadersInclude/pbrFragmentSamplersDeclaration.js +2 -1
  104. package/ShadersWGSL/ShadersInclude/pbrFragmentSamplersDeclaration.js.map +1 -1
  105. package/ShadersWGSL/ShadersInclude/pbrUboDeclaration.js +1 -1
  106. package/ShadersWGSL/ShadersInclude/pbrUboDeclaration.js.map +1 -1
  107. package/ShadersWGSL/hdrIrradianceFiltering.fragment.js +1 -1
  108. package/ShadersWGSL/hdrIrradianceFiltering.fragment.js.map +1 -1
  109. package/ShadersWGSL/iblDominantDirection.fragment.d.ts +9 -0
  110. package/ShadersWGSL/iblDominantDirection.fragment.js +22 -0
  111. package/ShadersWGSL/iblDominantDirection.fragment.js.map +1 -0
  112. package/ShadersWGSL/minmaxRedux.fragment.d.ts +5 -0
  113. package/ShadersWGSL/minmaxRedux.fragment.js +32 -0
  114. package/ShadersWGSL/minmaxRedux.fragment.js.map +1 -0
  115. package/ShadersWGSL/pbr.fragment.js +19 -5
  116. package/ShadersWGSL/pbr.fragment.js.map +1 -1
  117. package/ShadersWGSL/pbr.vertex.js +8 -2
  118. package/ShadersWGSL/pbr.vertex.js.map +1 -1
  119. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"assetsManager.js","sourceRoot":"","sources":["../../../../dev/core/src/Misc/assetsManager.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,uBAAuB,EAAwC,MAAM,wBAAwB,CAAC;AAC/I,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AACtE,OAAO,EAAE,0BAA0B,EAAE,MAAM,kDAAkD,CAAC;AAC9F,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAIxC,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAGrD;;GAEG;AACH,MAAM,CAAN,IAAkB,cAiBjB;AAjBD,WAAkB,cAAc;IAC5B;;OAEG;IACH,mDAAI,CAAA;IACJ;;OAEG;IACH,yDAAO,CAAA;IACP;;OAEG;IACH,mDAAI,CAAA;IACJ;;OAEG;IACH,qDAAK,CAAA;AACT,CAAC,EAjBiB,cAAc,KAAd,cAAc,QAiB/B;AAED;;GAEG;AACH,MAAM,OAAgB,iBAAiB;IAWnC;;;OAGG;IACH;IACI;;OAEG,CAAQ,IAAY;QAAZ,SAAI,GAAJ,IAAI,CAAQ;QAGnB,iBAAY,GAAG,KAAK,CAAC;QACrB,eAAU,+BAAuB;IAHtC,CAAC;IAMJ;;OAEG;IACH,IAAW,WAAW;QAClB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC7B,CAAC;IAED;;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gBAClD,IAAI,cAAc,IAAI,cAAc,CAAC,MAAM,EAAE,CAAC;oBAC1C,MAAM,CAAC,cAAc,CAAC,CAAC;gBAC3B,CAAC;qBAAM,CAAC;oBACJ,OAAO,EAAE,CAAC;gBACd,CAAC;YACL,CAAC,CAAC,CAAC;YAEH,IAAI,CAAC,IAAI,EAAE,CAAC;QAChB,CAAC,CAAC,CAAC;IACP,CAAC;CACJ","sourcesContent":["import type { Scene } from \"../scene\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { TransformNode } from \"../Meshes/transformNode\";\r\nimport type { IParticleSystem } from \"../Particles/IParticleSystem\";\r\nimport type { Skeleton } from \"../Bones/skeleton\";\r\nimport { ImportAnimationsAsync, ImportMeshAsync, LoadAssetContainerAsync, SceneLoaderAnimationGroupLoadingMode } from \"../Loading/sceneLoader\";\r\nimport { Tools } from \"./tools\";\r\nimport { Observable } from \"./observable\";\r\nimport type { BaseTexture } from \"../Materials/Textures/baseTexture\";\r\nimport { Texture } from \"../Materials/Textures/texture\";\r\nimport { CubeTexture } from \"../Materials/Textures/cubeTexture\";\r\nimport { HDRCubeTexture } from \"../Materials/Textures/hdrCubeTexture\";\r\nimport { EquiRectangularCubeTexture } from \"../Materials/Textures/equiRectangularCubeTexture\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport type { Animatable } from \"../Animations/animatable.core\";\r\nimport type { AnimationGroup } from \"../Animations/animationGroup\";\r\nimport type { AssetContainer } from \"../assetContainer\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport type { Nullable } from \"../types\";\r\n\r\n/**\r\n * Defines the list of states available for a task inside a AssetsManager\r\n */\r\nexport const enum AssetTaskState {\r\n /**\r\n * Initialization\r\n */\r\n INIT,\r\n /**\r\n * Running\r\n */\r\n RUNNING,\r\n /**\r\n * Done\r\n */\r\n DONE,\r\n /**\r\n * Error\r\n */\r\n ERROR,\r\n}\r\n\r\n/**\r\n * Define an abstract asset task used with a AssetsManager class to load assets into a scene\r\n */\r\nexport abstract class AbstractAssetTask {\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public onSuccess: (task: any) => void;\r\n\r\n /**\r\n * Callback called when the task is not successful\r\n */\r\n public onError: (task: any, message?: string, exception?: any) => void;\r\n\r\n /**\r\n * Creates a new AssetsManager\r\n * @param name defines the name of the task\r\n */\r\n constructor(\r\n /**\r\n * Task name\r\n */ public name: string\r\n ) {}\r\n\r\n private _isCompleted = false;\r\n private _taskState = AssetTaskState.INIT;\r\n private _errorObject: { message?: string; exception?: any };\r\n\r\n /**\r\n * Get if the task is completed\r\n */\r\n public get isCompleted(): boolean {\r\n return this._isCompleted;\r\n }\r\n\r\n /**\r\n * Gets the current state of the task\r\n */\r\n public get taskState(): AssetTaskState {\r\n return this._taskState;\r\n }\r\n\r\n /**\r\n * Gets the current error object (if task is in error)\r\n */\r\n public get errorObject(): { message?: string; exception?: any } {\r\n return this._errorObject;\r\n }\r\n\r\n /**\r\n * Internal only\r\n * @internal\r\n */\r\n public _setErrorObject(message?: string, exception?: any) {\r\n if (this._errorObject) {\r\n return;\r\n }\r\n\r\n this._errorObject = {\r\n message: message,\r\n exception: exception,\r\n };\r\n }\r\n\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n public run(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void) {\r\n this._taskState = AssetTaskState.RUNNING;\r\n this.runTask(\r\n scene,\r\n () => {\r\n this._onDoneCallback(onSuccess, onError);\r\n },\r\n (msg, exception) => {\r\n this._onErrorCallback(onError, msg, exception);\r\n }\r\n );\r\n }\r\n\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n public runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void) {\r\n throw new Error(\"runTask is not implemented\");\r\n }\r\n\r\n /**\r\n * Reset will set the task state back to INIT, so the next load call of the assets manager will execute this task again.\r\n * This can be used with failed tasks that have the reason for failure fixed.\r\n */\r\n public reset() {\r\n this._taskState = AssetTaskState.INIT;\r\n }\r\n\r\n private _onErrorCallback(onError: (message?: string, exception?: any) => void, message?: string, exception?: any) {\r\n this._taskState = AssetTaskState.ERROR;\r\n\r\n this._errorObject = {\r\n message: message,\r\n exception: exception,\r\n };\r\n\r\n if (this.onError) {\r\n this.onError(this, message, exception);\r\n }\r\n\r\n onError();\r\n }\r\n\r\n private _onDoneCallback(onSuccess: () => void, onError: (message?: string, exception?: any) => void) {\r\n try {\r\n this._taskState = AssetTaskState.DONE;\r\n this._isCompleted = true;\r\n\r\n if (this.onSuccess) {\r\n this.onSuccess(this);\r\n }\r\n\r\n onSuccess();\r\n } catch (e) {\r\n this._onErrorCallback(onError, \"Task is done, error executing success callback(s)\", e);\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Define the interface used by progress events raised during assets loading\r\n */\r\nexport interface IAssetsProgressEvent {\r\n /**\r\n * Defines the number of remaining tasks to process\r\n */\r\n remainingCount: number;\r\n /**\r\n * Defines the total number of tasks\r\n */\r\n totalCount: number;\r\n /**\r\n * Defines the task that was just processed\r\n */\r\n task: AbstractAssetTask;\r\n}\r\n\r\n/**\r\n * Class used to share progress information about assets loading\r\n */\r\nexport class AssetsProgressEvent implements IAssetsProgressEvent {\r\n /**\r\n * Defines the number of remaining tasks to process\r\n */\r\n public remainingCount: number;\r\n /**\r\n * Defines the total number of tasks\r\n */\r\n public totalCount: number;\r\n /**\r\n * Defines the task that was just processed\r\n */\r\n public task: AbstractAssetTask;\r\n\r\n /**\r\n * Creates a AssetsProgressEvent\r\n * @param remainingCount defines the number of remaining tasks to process\r\n * @param totalCount defines the total number of tasks\r\n * @param task defines the task that was just processed\r\n */\r\n constructor(remainingCount: number, totalCount: number, task: AbstractAssetTask) {\r\n this.remainingCount = remainingCount;\r\n this.totalCount = totalCount;\r\n this.task = task;\r\n }\r\n}\r\n\r\n/**\r\n * Define a task used by AssetsManager to load assets into a container\r\n */\r\nexport class ContainerAssetTask extends AbstractAssetTask {\r\n /**\r\n * Get the loaded asset container\r\n */\r\n public loadedContainer: AssetContainer;\r\n /**\r\n * Gets the list of loaded transforms\r\n */\r\n public loadedTransformNodes: Array<TransformNode>;\r\n /**\r\n * Gets the list of loaded meshes\r\n */\r\n public loadedMeshes: Array<AbstractMesh>;\r\n /**\r\n * Gets the list of loaded particle systems\r\n */\r\n public loadedParticleSystems: Array<IParticleSystem>;\r\n /**\r\n * Gets the list of loaded skeletons\r\n */\r\n public loadedSkeletons: Array<Skeleton>;\r\n /**\r\n * Gets the list of loaded animation groups\r\n */\r\n public loadedAnimationGroups: Array<AnimationGroup>;\r\n\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public override onSuccess: (task: ContainerAssetTask) => void;\r\n\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public override onError: (task: ContainerAssetTask, message?: string, exception?: any) => void;\r\n\r\n /**\r\n * Creates a new ContainerAssetTask\r\n * @param name defines the name of the task\r\n * @param meshesNames defines the list of mesh's names you want to load\r\n * @param rootUrl defines the root url to use as a base to load your meshes and associated resources\r\n * @param sceneFilename defines the filename or File of the scene to load from\r\n * @param extension defines the extension to use to load the scene (if not defined, \".babylon\" will be used)\r\n */\r\n constructor(\r\n /**\r\n * Defines the name of the task\r\n */\r\n public override name: string,\r\n /**\r\n * Defines the list of mesh's names you want to load\r\n */\r\n public meshesNames: any,\r\n /**\r\n * Defines the root url to use as a base to load your meshes and associated resources\r\n */\r\n public rootUrl: string,\r\n /**\r\n * Defines the filename or File of the scene to load from\r\n */\r\n public sceneFilename: string | File,\r\n /**\r\n * Defines the extension to use to load the scene (if not defined, \".babylon\" will be used)\r\n */\r\n public extension?: string\r\n ) {\r\n super(name);\r\n }\r\n\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n public override runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void) {\r\n LoadAssetContainerAsync(this.rootUrl + \"/\" + (this.sceneFilename as string).toString(), scene, {\r\n pluginExtension: this.extension,\r\n }).then(\r\n (container: AssetContainer) => {\r\n this.loadedContainer = container;\r\n this.loadedMeshes = container.meshes;\r\n this.loadedTransformNodes = container.transformNodes;\r\n this.loadedParticleSystems = container.particleSystems;\r\n this.loadedSkeletons = container.skeletons;\r\n this.loadedAnimationGroups = container.animationGroups;\r\n onSuccess();\r\n },\r\n (error) => {\r\n onError(error.message, error);\r\n }\r\n );\r\n }\r\n}\r\n\r\n/**\r\n * Define a task used by AssetsManager to load meshes\r\n */\r\nexport class MeshAssetTask extends AbstractAssetTask {\r\n /**\r\n * Gets the list of loaded transforms\r\n */\r\n public loadedTransformNodes: Array<TransformNode>;\r\n /**\r\n * Gets the list of loaded meshes\r\n */\r\n public loadedMeshes: Array<AbstractMesh>;\r\n /**\r\n * Gets the list of loaded particle systems\r\n */\r\n public loadedParticleSystems: Array<IParticleSystem>;\r\n /**\r\n * Gets the list of loaded skeletons\r\n */\r\n public loadedSkeletons: Array<Skeleton>;\r\n /**\r\n * Gets the list of loaded animation groups\r\n */\r\n public loadedAnimationGroups: Array<AnimationGroup>;\r\n\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public override onSuccess: (task: MeshAssetTask) => void;\r\n\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public override onError: (task: MeshAssetTask, message?: string, exception?: any) => void;\r\n\r\n /**\r\n * Creates a new MeshAssetTask\r\n * @param name defines the name of the task\r\n * @param meshesNames defines the list of mesh's names you want to load\r\n * @param rootUrl defines the root url to use as a base to load your meshes and associated resources\r\n * @param sceneFilename defines the filename or File of the scene to load from\r\n * @param extension defines the extension to use to load the scene (if not defined, \".babylon\" will be used)\r\n */\r\n constructor(\r\n /**\r\n * Defines the name of the task\r\n */\r\n public override name: string,\r\n /**\r\n * Defines the list of mesh's names you want to load\r\n */\r\n public meshesNames: any,\r\n /**\r\n * Defines the root url to use as a base to load your meshes and associated resources\r\n */\r\n public rootUrl: string,\r\n /**\r\n * Defines the filename or File of the scene to load from\r\n */\r\n public sceneFilename: string | File,\r\n /**\r\n * Defines the extension to use to load the scene (if not defined, \".babylon\" will be used)\r\n */\r\n public extension?: string\r\n ) {\r\n super(name);\r\n }\r\n\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n public override runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void) {\r\n ImportMeshAsync(this.rootUrl + \"/\" + (this.sceneFilename as string), scene, {\r\n meshNames: this.meshesNames,\r\n pluginExtension: this.extension,\r\n }).then(\r\n ({ meshes, particleSystems, skeletons, animationGroups, transformNodes }) => {\r\n this.loadedMeshes = meshes;\r\n this.loadedTransformNodes = transformNodes;\r\n this.loadedParticleSystems = particleSystems;\r\n this.loadedSkeletons = skeletons;\r\n this.loadedAnimationGroups = animationGroups;\r\n onSuccess();\r\n },\r\n (error) => {\r\n onError(error.message, error);\r\n }\r\n );\r\n }\r\n}\r\n\r\n/**\r\n * Define a task used by AssetsManager to load animations\r\n */\r\nexport class AnimationAssetTask extends AbstractAssetTask {\r\n /**\r\n * Gets the list of loaded animation groups\r\n */\r\n public loadedAnimationGroups: Array<AnimationGroup>;\r\n /**\r\n * Gets the list of loaded animatables\r\n */\r\n public loadedAnimatables: Array<Animatable>;\r\n\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public override onSuccess: (task: AnimationAssetTask) => void;\r\n\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public override onError: (task: AnimationAssetTask, message?: string, exception?: any) => void;\r\n\r\n /**\r\n * Creates a new AnimationAssetTask\r\n * @param name defines the name of the task\r\n * @param rootUrl defines the root url to use as a base to load your meshes and associated resources\r\n * @param filename defines the filename or File of the scene to load from\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 extension defines the extension to use to load the scene (if not defined, \".babylon\" will be used)\r\n */\r\n constructor(\r\n /**\r\n * Defines the name of the task\r\n */\r\n public override name: string,\r\n /**\r\n * Defines the root url to use as a base to load your meshes and associated resources\r\n */\r\n public rootUrl: string,\r\n /**\r\n * Defines the filename to load from\r\n */\r\n public filename: string | File,\r\n /**\r\n * Defines a function used to convert animation targets from loaded scene to current scene (default: search node by name)\r\n */\r\n public targetConverter?: Nullable<(target: any) => any>,\r\n /**\r\n * Defines the extension to use to load the scene (if not defined, \".babylon\" will be used)\r\n */\r\n public extension?: string\r\n ) {\r\n super(name);\r\n }\r\n\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n public override runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void) {\r\n const startingIndexForNewAnimatables = scene.animatables.length;\r\n const startingIndexForNewAnimationGroups = scene.animationGroups.length;\r\n this.loadedAnimatables = [];\r\n this.loadedAnimationGroups = [];\r\n ImportAnimationsAsync(this.rootUrl + \"/\" + (this.filename as string), scene, {\r\n pluginExtension: this.extension,\r\n targetConverter: this.targetConverter,\r\n overwriteAnimations: false,\r\n animationGroupLoadingMode: SceneLoaderAnimationGroupLoadingMode.NoSync,\r\n }).then(\r\n () => {\r\n this.loadedAnimatables = scene.animatables.slice(startingIndexForNewAnimatables);\r\n this.loadedAnimationGroups = scene.animationGroups.slice(startingIndexForNewAnimationGroups);\r\n\r\n onSuccess();\r\n },\r\n (exception) => {\r\n onError(exception.message, exception);\r\n }\r\n );\r\n }\r\n}\r\n\r\n/**\r\n * Define a task used by AssetsManager to load text content\r\n */\r\nexport class TextFileAssetTask extends AbstractAssetTask {\r\n /**\r\n * Gets the loaded text string\r\n */\r\n public text: string;\r\n\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public override onSuccess: (task: TextFileAssetTask) => void;\r\n\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public override onError: (task: TextFileAssetTask, message?: string, exception?: any) => void;\r\n\r\n /**\r\n * Creates a new TextFileAssetTask object\r\n * @param name defines the name of the task\r\n * @param url defines the location of the file to load\r\n */\r\n constructor(\r\n /**\r\n * Defines the name of the task\r\n */\r\n public override name: string,\r\n /**\r\n * Defines the location of the file to load\r\n */\r\n public url: string\r\n ) {\r\n super(name);\r\n }\r\n\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n public override runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void) {\r\n scene._loadFile(\r\n this.url,\r\n (data) => {\r\n this.text = data as string;\r\n onSuccess();\r\n },\r\n undefined,\r\n false,\r\n false,\r\n (request, exception) => {\r\n if (request) {\r\n onError(request.status + \" \" + request.statusText, exception);\r\n }\r\n }\r\n );\r\n }\r\n}\r\n\r\n/**\r\n * Define a task used by AssetsManager to load binary data\r\n */\r\nexport class BinaryFileAssetTask extends AbstractAssetTask {\r\n /**\r\n * Gets the loaded data (as an array buffer)\r\n */\r\n public data: ArrayBuffer;\r\n\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public override onSuccess: (task: BinaryFileAssetTask) => void;\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public override onError: (task: BinaryFileAssetTask, message?: string, exception?: any) => void;\r\n\r\n /**\r\n * Creates a new BinaryFileAssetTask object\r\n * @param name defines the name of the new task\r\n * @param url defines the location of the file to load\r\n */\r\n constructor(\r\n /**\r\n * Defines the name of the task\r\n */\r\n public override name: string,\r\n /**\r\n * Defines the location of the file to load\r\n */\r\n public url: string\r\n ) {\r\n super(name);\r\n }\r\n\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n public override runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void) {\r\n scene._loadFile(\r\n this.url,\r\n (data) => {\r\n this.data = data as ArrayBuffer;\r\n onSuccess();\r\n },\r\n undefined,\r\n true,\r\n true,\r\n (request, exception) => {\r\n if (request) {\r\n onError(request.status + \" \" + request.statusText, exception);\r\n }\r\n }\r\n );\r\n }\r\n}\r\n\r\n/**\r\n * Define a task used by AssetsManager to load images\r\n */\r\nexport class ImageAssetTask extends AbstractAssetTask {\r\n /**\r\n * Gets the loaded images\r\n */\r\n public image: HTMLImageElement;\r\n\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public override onSuccess: (task: ImageAssetTask) => void;\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public override onError: (task: ImageAssetTask, message?: string, exception?: any) => void;\r\n\r\n /**\r\n * Creates a new ImageAssetTask\r\n * @param name defines the name of the task\r\n * @param url defines the location of the image to load\r\n */\r\n constructor(\r\n /**\r\n * Defines the name of the task\r\n */\r\n public override name: string,\r\n /**\r\n * Defines the location of the image to load\r\n */\r\n public url: string\r\n ) {\r\n super(name);\r\n }\r\n\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n public override runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void) {\r\n const img = new Image();\r\n\r\n Tools.SetCorsBehavior(this.url, img);\r\n\r\n img.onload = () => {\r\n this.image = img;\r\n onSuccess();\r\n };\r\n\r\n img.onerror = (err: string | Event): any => {\r\n onError(\"Error loading image\", err);\r\n };\r\n\r\n img.src = this.url;\r\n }\r\n}\r\n\r\n/**\r\n * Defines the interface used by texture loading tasks\r\n */\r\nexport interface ITextureAssetTask<Tex extends BaseTexture> {\r\n /**\r\n * Gets the loaded texture\r\n */\r\n texture: Tex;\r\n}\r\n\r\n/**\r\n * Define a task used by AssetsManager to load 2D textures\r\n */\r\nexport class TextureAssetTask extends AbstractAssetTask implements ITextureAssetTask<Texture> {\r\n /**\r\n * Gets the loaded texture\r\n */\r\n public texture: Texture;\r\n\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public override onSuccess: (task: TextureAssetTask) => void;\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public override onError: (task: TextureAssetTask, message?: string, exception?: any) => void;\r\n\r\n /**\r\n * Creates a new TextureAssetTask object\r\n * @param name defines the name of the task\r\n * @param url defines the location of the file to load\r\n * @param noMipmap defines if mipmap should not be generated (default is false)\r\n * @param invertY defines if texture must be inverted on Y axis (default is true)\r\n * @param samplingMode defines the sampling mode to use (default is Texture.TRILINEAR_SAMPLINGMODE)\r\n */\r\n constructor(\r\n /**\r\n * Defines the name of the task\r\n */\r\n public override name: string,\r\n /**\r\n * Defines the location of the file to load\r\n */\r\n public url: string,\r\n /**\r\n * Defines if mipmap should not be generated (default is false)\r\n */\r\n public noMipmap?: boolean,\r\n /**\r\n * [true] Defines if texture must be inverted on Y axis (default is true)\r\n */\r\n public invertY: boolean = true,\r\n /**\r\n * [3] Defines the sampling mode to use (default is Texture.TRILINEAR_SAMPLINGMODE)\r\n */\r\n public samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE\r\n ) {\r\n super(name);\r\n }\r\n\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n public override runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void) {\r\n const onload = () => {\r\n onSuccess();\r\n };\r\n\r\n const onerror = (message?: string, exception?: any) => {\r\n onError(message, exception);\r\n };\r\n\r\n this.texture = new Texture(this.url, scene, this.noMipmap, this.invertY, this.samplingMode, onload, onerror);\r\n }\r\n}\r\n\r\n/**\r\n * Define a task used by AssetsManager to load cube textures\r\n */\r\nexport class CubeTextureAssetTask extends AbstractAssetTask implements ITextureAssetTask<CubeTexture> {\r\n /**\r\n * Gets the loaded texture\r\n */\r\n public texture: CubeTexture;\r\n\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public override onSuccess: (task: CubeTextureAssetTask) => void;\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public override onError: (task: CubeTextureAssetTask, message?: string, exception?: any) => void;\r\n\r\n /**\r\n * Creates a new CubeTextureAssetTask\r\n * @param name defines the name of the task\r\n * @param url defines the location of the files to load (You have to specify the folder where the files are + filename with no extension)\r\n * @param extensions defines the extensions to use to load files ([\"_px\", \"_py\", \"_pz\", \"_nx\", \"_ny\", \"_nz\"] by default)\r\n * @param noMipmap defines if mipmaps should not be generated (default is false)\r\n * @param files defines the explicit list of files (undefined by default)\r\n * @param prefiltered\r\n */\r\n constructor(\r\n /**\r\n * Defines the name of the task\r\n */\r\n public override name: string,\r\n /**\r\n * Defines the location of the files to load (You have to specify the folder where the files are + filename with no extension)\r\n */\r\n public url: string,\r\n /**\r\n * Defines the extensions to use to load files ([\"_px\", \"_py\", \"_pz\", \"_nx\", \"_ny\", \"_nz\"] by default)\r\n */\r\n public extensions?: string[],\r\n /**\r\n * Defines if mipmaps should not be generated (default is false)\r\n */\r\n public noMipmap?: boolean,\r\n /**\r\n * Defines the explicit list of files (undefined by default)\r\n */\r\n public files?: string[],\r\n /**\r\n * Defines the prefiltered texture option (default is false)\r\n */\r\n public prefiltered?: boolean\r\n ) {\r\n super(name);\r\n }\r\n\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n public override runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void) {\r\n const onload = () => {\r\n onSuccess();\r\n };\r\n\r\n const onerror = (message?: string, exception?: any) => {\r\n onError(message, exception);\r\n };\r\n\r\n this.texture = new CubeTexture(this.url, scene, this.extensions, this.noMipmap, this.files, onload, onerror, undefined, this.prefiltered);\r\n }\r\n}\r\n\r\n/**\r\n * Define a task used by AssetsManager to load HDR cube textures\r\n */\r\nexport class HDRCubeTextureAssetTask extends AbstractAssetTask implements ITextureAssetTask<HDRCubeTexture> {\r\n /**\r\n * Gets the loaded texture\r\n */\r\n public texture: HDRCubeTexture;\r\n\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public override onSuccess: (task: HDRCubeTextureAssetTask) => void;\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public override onError: (task: HDRCubeTextureAssetTask, message?: string, exception?: any) => void;\r\n\r\n /**\r\n * Creates a new HDRCubeTextureAssetTask object\r\n * @param name defines the name of the task\r\n * @param url defines the location of the file to load\r\n * @param size defines the desired size (the more it increases the longer the generation will be) If the size is omitted this implies you are using a preprocessed cubemap.\r\n * @param noMipmap defines if mipmaps should not be generated (default is false)\r\n * @param generateHarmonics specifies whether you want to extract the polynomial harmonics during the generation process (default is true)\r\n * @param gammaSpace specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space) (default is false)\r\n * @param reserved Internal use only\r\n */\r\n constructor(\r\n /**\r\n * Defines the name of the task\r\n */\r\n public override name: string,\r\n /**\r\n * Defines the location of the file to load\r\n */\r\n public url: string,\r\n /**\r\n * Defines the desired size (the more it increases the longer the generation will be)\r\n */\r\n public size: number,\r\n /**\r\n * [false] Defines if mipmaps should not be generated (default is false)\r\n */\r\n public noMipmap = false,\r\n /**\r\n * [true] Specifies whether you want to extract the polynomial harmonics during the generation process (default is true)\r\n */\r\n public generateHarmonics = true,\r\n /**\r\n * [false] Specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space) (default is false)\r\n */\r\n public gammaSpace = false,\r\n /**\r\n * [false] Internal Use Only\r\n */\r\n public reserved = false\r\n ) {\r\n super(name);\r\n }\r\n\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n public override runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void) {\r\n const onload = () => {\r\n onSuccess();\r\n };\r\n\r\n const onerror = (message?: string, exception?: any) => {\r\n onError(message, exception);\r\n };\r\n\r\n this.texture = new HDRCubeTexture(this.url, scene, this.size, this.noMipmap, this.generateHarmonics, this.gammaSpace, this.reserved, onload, onerror);\r\n }\r\n}\r\n\r\n/**\r\n * Define a task used by AssetsManager to load Equirectangular cube textures\r\n */\r\nexport class EquiRectangularCubeTextureAssetTask extends AbstractAssetTask implements ITextureAssetTask<EquiRectangularCubeTexture> {\r\n /**\r\n * Gets the loaded texture\r\n */\r\n public texture: EquiRectangularCubeTexture;\r\n\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public override onSuccess: (task: EquiRectangularCubeTextureAssetTask) => void;\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public override onError: (task: EquiRectangularCubeTextureAssetTask, message?: string, exception?: any) => void;\r\n\r\n /**\r\n * Creates a new EquiRectangularCubeTextureAssetTask object\r\n * @param name defines the name of the task\r\n * @param url defines the location of the file to load\r\n * @param size defines the desired size (the more it increases the longer the generation will be)\r\n * If the size is omitted this implies you are using a preprocessed cubemap.\r\n * @param noMipmap defines if mipmaps should not be generated (default is false)\r\n * @param gammaSpace specifies if the texture will be used in gamma or linear space\r\n * (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space)\r\n * (default is true)\r\n */\r\n constructor(\r\n /**\r\n * Defines the name of the task\r\n */\r\n public override name: string,\r\n /**\r\n * Defines the location of the file to load\r\n */\r\n public url: string,\r\n /**\r\n * Defines the desired size (the more it increases the longer the generation will be)\r\n */\r\n public size: number,\r\n /**\r\n * [false] Defines if mipmaps should not be generated (default is false)\r\n */\r\n public noMipmap: boolean = false,\r\n /**\r\n * [true] Specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space,\r\n * but the standard material would require them in Gamma space) (default is true)\r\n */\r\n public gammaSpace: boolean = true\r\n ) {\r\n super(name);\r\n }\r\n\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n public override runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void): void {\r\n const onload = () => {\r\n onSuccess();\r\n };\r\n\r\n const onerror = (message?: string, exception?: any) => {\r\n onError(message, exception);\r\n };\r\n\r\n this.texture = new EquiRectangularCubeTexture(this.url, scene, this.size, this.noMipmap, this.gammaSpace, onload, onerror);\r\n }\r\n}\r\n\r\n/**\r\n * This class can be used to easily import assets into a scene\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/importers/assetManager\r\n */\r\nexport class AssetsManager {\r\n private _scene: Scene;\r\n private _isLoading = false;\r\n\r\n protected _tasks = new Array<AbstractAssetTask>();\r\n protected _waitingTasksCount = 0;\r\n protected _totalTasksCount = 0;\r\n\r\n /**\r\n * Callback called when all tasks are processed\r\n */\r\n public onFinish: (tasks: AbstractAssetTask[]) => void;\r\n\r\n /**\r\n * Callback called when a task is successful\r\n */\r\n public onTaskSuccess: (task: AbstractAssetTask) => void;\r\n\r\n /**\r\n * Callback called when a task had an error\r\n */\r\n public onTaskError: (task: AbstractAssetTask) => void;\r\n\r\n /**\r\n * Callback called when a task is done (whatever the result is)\r\n */\r\n public onProgress: (remainingCount: number, totalCount: number, task: AbstractAssetTask) => void;\r\n\r\n /**\r\n * Observable called when all tasks are processed\r\n */\r\n public onTaskSuccessObservable = new Observable<AbstractAssetTask>();\r\n\r\n /**\r\n * Observable called when a task had an error\r\n */\r\n public onTaskErrorObservable = new Observable<AbstractAssetTask>();\r\n\r\n /**\r\n * Observable called when all tasks were executed\r\n */\r\n public onTasksDoneObservable = new Observable<AbstractAssetTask[]>();\r\n\r\n /**\r\n * Observable called when a task is done (whatever the result is)\r\n */\r\n public onProgressObservable = new Observable<IAssetsProgressEvent>();\r\n\r\n /**\r\n * Gets or sets a boolean defining if the AssetsManager should use the default loading screen\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/customLoadingScreen\r\n */\r\n public useDefaultLoadingScreen = true;\r\n\r\n /**\r\n * Gets or sets a boolean defining if the AssetsManager should automatically hide the loading screen\r\n * when all assets have been downloaded.\r\n * If set to false, you need to manually call in hideLoadingUI() once your scene is ready.\r\n */\r\n public autoHideLoadingUI = true;\r\n\r\n /**\r\n * Creates a new AssetsManager\r\n * @param scene defines the scene to work on\r\n */\r\n constructor(scene?: Scene) {\r\n this._scene = scene || <Scene>EngineStore.LastCreatedScene;\r\n }\r\n\r\n /**\r\n * Add a ContainerAssetTask to the list of active tasks\r\n * @param taskName defines the name of the new task\r\n * @param meshesNames defines the name of meshes to load\r\n * @param rootUrl defines the root url to use to locate files\r\n * @param sceneFilename defines the filename of the scene file or the File itself\r\n * @param extension defines the extension to use to load the file\r\n * @returns a new ContainerAssetTask object\r\n */\r\n public addContainerTask(taskName: string, meshesNames: any, rootUrl: string, sceneFilename: string | File, extension?: string): ContainerAssetTask {\r\n const task = new ContainerAssetTask(taskName, meshesNames, rootUrl, sceneFilename, extension);\r\n this._tasks.push(task);\r\n\r\n return task;\r\n }\r\n\r\n /**\r\n * Add a MeshAssetTask to the list of active tasks\r\n * @param taskName defines the name of the new task\r\n * @param meshesNames defines the name of meshes to load\r\n * @param rootUrl defines the root url to use to locate files\r\n * @param sceneFilename defines the filename of the scene file or the File itself\r\n * @param extension defines the extension to use to load the file\r\n * @returns a new MeshAssetTask object\r\n */\r\n public addMeshTask(taskName: string, meshesNames: any, rootUrl: string, sceneFilename: string | File, extension?: string): MeshAssetTask {\r\n const task = new MeshAssetTask(taskName, meshesNames, rootUrl, sceneFilename, extension);\r\n this._tasks.push(task);\r\n\r\n return task;\r\n }\r\n\r\n /**\r\n * Add a TextFileAssetTask to the list of active tasks\r\n * @param taskName defines the name of the new task\r\n * @param url defines the url of the file to load\r\n * @returns a new TextFileAssetTask object\r\n */\r\n public addTextFileTask(taskName: string, url: string): TextFileAssetTask {\r\n const task = new TextFileAssetTask(taskName, url);\r\n this._tasks.push(task);\r\n\r\n return task;\r\n }\r\n\r\n /**\r\n * Add a BinaryFileAssetTask to the list of active tasks\r\n * @param taskName defines the name of the new task\r\n * @param url defines the url of the file to load\r\n * @returns a new BinaryFileAssetTask object\r\n */\r\n public addBinaryFileTask(taskName: string, url: string): BinaryFileAssetTask {\r\n const task = new BinaryFileAssetTask(taskName, url);\r\n this._tasks.push(task);\r\n\r\n return task;\r\n }\r\n\r\n /**\r\n * Add a ImageAssetTask to the list of active tasks\r\n * @param taskName defines the name of the new task\r\n * @param url defines the url of the file to load\r\n * @returns a new ImageAssetTask object\r\n */\r\n public addImageTask(taskName: string, url: string): ImageAssetTask {\r\n const task = new ImageAssetTask(taskName, url);\r\n this._tasks.push(task);\r\n\r\n return task;\r\n }\r\n\r\n /**\r\n * Add a TextureAssetTask to the list of active tasks\r\n * @param taskName defines the name of the new task\r\n * @param url defines the url of the file to load\r\n * @param noMipmap defines if the texture must not receive mipmaps (false by default)\r\n * @param invertY defines if you want to invert Y axis of the loaded texture (true by default)\r\n * @param samplingMode defines the sampling mode to use (Texture.TRILINEAR_SAMPLINGMODE by default)\r\n * @returns a new TextureAssetTask object\r\n */\r\n public addTextureTask(taskName: string, url: string, noMipmap?: boolean, invertY?: boolean, samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE): TextureAssetTask {\r\n const task = new TextureAssetTask(taskName, url, noMipmap, invertY, samplingMode);\r\n this._tasks.push(task);\r\n\r\n return task;\r\n }\r\n\r\n /**\r\n * Add a CubeTextureAssetTask to the list of active tasks\r\n * @param taskName defines the name of the new task\r\n * @param url defines the url of the file to load\r\n * @param extensions defines the extension to use to load the cube map (can be null)\r\n * @param noMipmap defines if the texture must not receive mipmaps (false by default)\r\n * @param files defines the list of files to load (can be null)\r\n * @param prefiltered defines the prefiltered texture option (default is false)\r\n * @returns a new CubeTextureAssetTask object\r\n */\r\n public addCubeTextureTask(taskName: string, url: string, extensions?: string[], noMipmap?: boolean, files?: string[], prefiltered?: boolean): CubeTextureAssetTask {\r\n const task = new CubeTextureAssetTask(taskName, url, extensions, noMipmap, files, prefiltered);\r\n this._tasks.push(task);\r\n\r\n return task;\r\n }\r\n\r\n /**\r\n *\r\n * Add a HDRCubeTextureAssetTask to the list of active tasks\r\n * @param taskName defines the name of the new task\r\n * @param url defines the url of the file to load\r\n * @param size defines the size you want for the cubemap (can be null)\r\n * @param noMipmap defines if the texture must not receive mipmaps (false by default)\r\n * @param generateHarmonics defines if you want to automatically generate (true by default)\r\n * @param gammaSpace specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space) (default is false)\r\n * @param reserved Internal use only\r\n * @returns a new HDRCubeTextureAssetTask object\r\n */\r\n public addHDRCubeTextureTask(\r\n taskName: string,\r\n url: string,\r\n size: number,\r\n noMipmap = false,\r\n generateHarmonics = true,\r\n gammaSpace = false,\r\n reserved = false\r\n ): HDRCubeTextureAssetTask {\r\n const task = new HDRCubeTextureAssetTask(taskName, url, size, noMipmap, generateHarmonics, gammaSpace, reserved);\r\n this._tasks.push(task);\r\n\r\n return task;\r\n }\r\n\r\n /**\r\n *\r\n * Add a EquiRectangularCubeTextureAssetTask to the list of active tasks\r\n * @param taskName defines the name of the new task\r\n * @param url defines the url of the file to load\r\n * @param size defines the size you want for the cubemap (can be null)\r\n * @param noMipmap defines if the texture must not receive mipmaps (false by default)\r\n * @param gammaSpace Specifies if the texture will be used in gamma or linear space\r\n * (the PBR material requires those textures in linear space, but the standard material would require them in Gamma space)\r\n * @returns a new EquiRectangularCubeTextureAssetTask object\r\n */\r\n public addEquiRectangularCubeTextureAssetTask(taskName: string, url: string, size: number, noMipmap = false, gammaSpace = true): EquiRectangularCubeTextureAssetTask {\r\n const task = new EquiRectangularCubeTextureAssetTask(taskName, url, size, noMipmap, gammaSpace);\r\n this._tasks.push(task);\r\n\r\n return task;\r\n }\r\n\r\n /**\r\n * Remove a task from the assets manager.\r\n * @param task the task to remove\r\n */\r\n public removeTask(task: AbstractAssetTask) {\r\n const index = this._tasks.indexOf(task);\r\n\r\n if (index > -1) {\r\n this._tasks.splice(index, 1);\r\n }\r\n }\r\n\r\n private _decreaseWaitingTasksCount(task: AbstractAssetTask): void {\r\n this._waitingTasksCount--;\r\n\r\n try {\r\n if (this.onProgress) {\r\n this.onProgress(this._waitingTasksCount, this._totalTasksCount, task);\r\n }\r\n\r\n this.onProgressObservable.notifyObservers(new AssetsProgressEvent(this._waitingTasksCount, this._totalTasksCount, task));\r\n } catch (e) {\r\n Logger.Error(\"Error running progress callbacks.\");\r\n Logger.Log(e);\r\n }\r\n\r\n if (this._waitingTasksCount === 0) {\r\n try {\r\n const currentTasks = this._tasks.slice();\r\n\r\n if (this.onFinish) {\r\n // Calling onFinish with immutable array of tasks\r\n this.onFinish(currentTasks);\r\n }\r\n\r\n // Let's remove successful tasks\r\n for (const task of currentTasks) {\r\n if (task.taskState === AssetTaskState.DONE) {\r\n const index = this._tasks.indexOf(task);\r\n\r\n if (index > -1) {\r\n this._tasks.splice(index, 1);\r\n }\r\n }\r\n }\r\n\r\n this.onTasksDoneObservable.notifyObservers(this._tasks);\r\n } catch (e) {\r\n Logger.Error(\"Error running tasks-done callbacks.\");\r\n Logger.Log(e);\r\n }\r\n this._isLoading = false;\r\n if (this.autoHideLoadingUI) {\r\n this._scene.getEngine().hideLoadingUI();\r\n }\r\n }\r\n }\r\n\r\n private _runTask(task: AbstractAssetTask): void {\r\n const done = () => {\r\n try {\r\n if (this.onTaskSuccess) {\r\n this.onTaskSuccess(task);\r\n }\r\n this.onTaskSuccessObservable.notifyObservers(task);\r\n this._decreaseWaitingTasksCount(task);\r\n } catch (e) {\r\n error(\"Error executing task success callbacks\", e);\r\n }\r\n };\r\n\r\n const error = (message?: string, exception?: any) => {\r\n task._setErrorObject(message, exception);\r\n\r\n if (this.onTaskError) {\r\n this.onTaskError(task);\r\n } else if (!task.onError) {\r\n Logger.Error(this._formatTaskErrorMessage(task));\r\n }\r\n this.onTaskErrorObservable.notifyObservers(task);\r\n this._decreaseWaitingTasksCount(task);\r\n };\r\n\r\n task.run(this._scene, done, error);\r\n }\r\n\r\n private _formatTaskErrorMessage(task: AbstractAssetTask) {\r\n let errorMessage = \"Unable to complete task \" + task.name;\r\n\r\n if (task.errorObject.message) {\r\n errorMessage += `: ${task.errorObject.message}`;\r\n }\r\n if (task.errorObject.exception) {\r\n errorMessage += `: ${task.errorObject.exception}`;\r\n }\r\n\r\n return errorMessage;\r\n }\r\n\r\n /**\r\n * Reset the AssetsManager and remove all tasks\r\n * @returns the current instance of the AssetsManager\r\n */\r\n public reset(): AssetsManager {\r\n this._isLoading = false;\r\n this._tasks = new Array<AbstractAssetTask>();\r\n return this;\r\n }\r\n\r\n /**\r\n * Start the loading process\r\n * @returns the current instance of the AssetsManager\r\n */\r\n public load(): AssetsManager {\r\n if (this._isLoading) {\r\n return this;\r\n }\r\n this._isLoading = true;\r\n this._waitingTasksCount = this._tasks.length;\r\n this._totalTasksCount = this._tasks.length;\r\n\r\n if (this._waitingTasksCount === 0) {\r\n this._isLoading = false;\r\n if (this.onFinish) {\r\n this.onFinish(this._tasks);\r\n }\r\n this.onTasksDoneObservable.notifyObservers(this._tasks);\r\n return this;\r\n }\r\n\r\n if (this.useDefaultLoadingScreen) {\r\n this._scene.getEngine().displayLoadingUI();\r\n }\r\n\r\n for (let index = 0; index < this._tasks.length; index++) {\r\n const task = this._tasks[index];\r\n if (task.taskState === AssetTaskState.INIT) {\r\n this._runTask(task);\r\n }\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Start the loading process as an async operation\r\n * @returns a promise returning the list of failed tasks\r\n */\r\n public async loadAsync(): Promise<void> {\r\n return new Promise((resolve, reject) => {\r\n if (this._isLoading) {\r\n resolve();\r\n return;\r\n }\r\n this.onTasksDoneObservable.addOnce((remainingTasks) => {\r\n if (remainingTasks && remainingTasks.length) {\r\n reject(remainingTasks);\r\n } else {\r\n resolve();\r\n }\r\n });\r\n\r\n this.load();\r\n });\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"assetsManager.js","sourceRoot":"","sources":["../../../../dev/core/src/Misc/assetsManager.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAwC,MAAM,wBAAwB,CAAC;AAC3F,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AACtE,OAAO,EAAE,0BAA0B,EAAE,MAAM,kDAAkD,CAAC;AAC9F,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAIxC,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAGrD;;GAEG;AACH,MAAM,CAAN,IAAkB,cAiBjB;AAjBD,WAAkB,cAAc;IAC5B;;OAEG;IACH,mDAAI,CAAA;IACJ;;OAEG;IACH,yDAAO,CAAA;IACP;;OAEG;IACH,mDAAI,CAAA;IACJ;;OAEG;IACH,qDAAK,CAAA;AACT,CAAC,EAjBiB,cAAc,KAAd,cAAc,QAiB/B;AAED;;GAEG;AACH,MAAM,OAAgB,iBAAiB;IAWnC;;;OAGG;IACH;IACI;;OAEG,CAAQ,IAAY;QAAZ,SAAI,GAAJ,IAAI,CAAQ;QAGnB,iBAAY,GAAG,KAAK,CAAC;QACrB,eAAU,+BAAuB;IAHtC,CAAC;IAMJ;;OAEG;IACH,IAAW,WAAW;QAClB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC7B,CAAC;IAED;;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AC;gBACd,CAAC;YACL,CAAC,CAAC,CAAC;YAEH,IAAI,CAAC,IAAI,EAAE,CAAC;QAChB,CAAC,CAAC,CAAC;IACP,CAAC;CACJ","sourcesContent":["import type { Scene } from \"../scene\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { TransformNode } from \"../Meshes/transformNode\";\r\nimport type { IParticleSystem } from \"../Particles/IParticleSystem\";\r\nimport type { Skeleton } from \"../Bones/skeleton\";\r\nimport { SceneLoader, SceneLoaderAnimationGroupLoadingMode } from \"../Loading/sceneLoader\";\r\nimport { Tools } from \"./tools\";\r\nimport { Observable } from \"./observable\";\r\nimport type { BaseTexture } from \"../Materials/Textures/baseTexture\";\r\nimport { Texture } from \"../Materials/Textures/texture\";\r\nimport { CubeTexture } from \"../Materials/Textures/cubeTexture\";\r\nimport { HDRCubeTexture } from \"../Materials/Textures/hdrCubeTexture\";\r\nimport { EquiRectangularCubeTexture } from \"../Materials/Textures/equiRectangularCubeTexture\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport type { Animatable } from \"../Animations/animatable.core\";\r\nimport type { AnimationGroup } from \"../Animations/animationGroup\";\r\nimport type { AssetContainer } from \"../assetContainer\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport type { Nullable } from \"../types\";\r\n\r\n/**\r\n * Defines the list of states available for a task inside a AssetsManager\r\n */\r\nexport const enum AssetTaskState {\r\n /**\r\n * Initialization\r\n */\r\n INIT,\r\n /**\r\n * Running\r\n */\r\n RUNNING,\r\n /**\r\n * Done\r\n */\r\n DONE,\r\n /**\r\n * Error\r\n */\r\n ERROR,\r\n}\r\n\r\n/**\r\n * Define an abstract asset task used with a AssetsManager class to load assets into a scene\r\n */\r\nexport abstract class AbstractAssetTask {\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public onSuccess: (task: any) => void;\r\n\r\n /**\r\n * Callback called when the task is not successful\r\n */\r\n public onError: (task: any, message?: string, exception?: any) => void;\r\n\r\n /**\r\n * Creates a new AssetsManager\r\n * @param name defines the name of the task\r\n */\r\n constructor(\r\n /**\r\n * Task name\r\n */ public name: string\r\n ) {}\r\n\r\n private _isCompleted = false;\r\n private _taskState = AssetTaskState.INIT;\r\n private _errorObject: { message?: string; exception?: any };\r\n\r\n /**\r\n * Get if the task is completed\r\n */\r\n public get isCompleted(): boolean {\r\n return this._isCompleted;\r\n }\r\n\r\n /**\r\n * Gets the current state of the task\r\n */\r\n public get taskState(): AssetTaskState {\r\n return this._taskState;\r\n }\r\n\r\n /**\r\n * Gets the current error object (if task is in error)\r\n */\r\n public get errorObject(): { message?: string; exception?: any } {\r\n return this._errorObject;\r\n }\r\n\r\n /**\r\n * Internal only\r\n * @internal\r\n */\r\n public _setErrorObject(message?: string, exception?: any) {\r\n if (this._errorObject) {\r\n return;\r\n }\r\n\r\n this._errorObject = {\r\n message: message,\r\n exception: exception,\r\n };\r\n }\r\n\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n public run(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void) {\r\n this._taskState = AssetTaskState.RUNNING;\r\n this.runTask(\r\n scene,\r\n () => {\r\n this._onDoneCallback(onSuccess, onError);\r\n },\r\n (msg, exception) => {\r\n this._onErrorCallback(onError, msg, exception);\r\n }\r\n );\r\n }\r\n\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n public runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void) {\r\n throw new Error(\"runTask is not implemented\");\r\n }\r\n\r\n /**\r\n * Reset will set the task state back to INIT, so the next load call of the assets manager will execute this task again.\r\n * This can be used with failed tasks that have the reason for failure fixed.\r\n */\r\n public reset() {\r\n this._taskState = AssetTaskState.INIT;\r\n }\r\n\r\n private _onErrorCallback(onError: (message?: string, exception?: any) => void, message?: string, exception?: any) {\r\n this._taskState = AssetTaskState.ERROR;\r\n\r\n this._errorObject = {\r\n message: message,\r\n exception: exception,\r\n };\r\n\r\n if (this.onError) {\r\n this.onError(this, message, exception);\r\n }\r\n\r\n onError();\r\n }\r\n\r\n private _onDoneCallback(onSuccess: () => void, onError: (message?: string, exception?: any) => void) {\r\n try {\r\n this._taskState = AssetTaskState.DONE;\r\n this._isCompleted = true;\r\n\r\n if (this.onSuccess) {\r\n this.onSuccess(this);\r\n }\r\n\r\n onSuccess();\r\n } catch (e) {\r\n this._onErrorCallback(onError, \"Task is done, error executing success callback(s)\", e);\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Define the interface used by progress events raised during assets loading\r\n */\r\nexport interface IAssetsProgressEvent {\r\n /**\r\n * Defines the number of remaining tasks to process\r\n */\r\n remainingCount: number;\r\n /**\r\n * Defines the total number of tasks\r\n */\r\n totalCount: number;\r\n /**\r\n * Defines the task that was just processed\r\n */\r\n task: AbstractAssetTask;\r\n}\r\n\r\n/**\r\n * Class used to share progress information about assets loading\r\n */\r\nexport class AssetsProgressEvent implements IAssetsProgressEvent {\r\n /**\r\n * Defines the number of remaining tasks to process\r\n */\r\n public remainingCount: number;\r\n /**\r\n * Defines the total number of tasks\r\n */\r\n public totalCount: number;\r\n /**\r\n * Defines the task that was just processed\r\n */\r\n public task: AbstractAssetTask;\r\n\r\n /**\r\n * Creates a AssetsProgressEvent\r\n * @param remainingCount defines the number of remaining tasks to process\r\n * @param totalCount defines the total number of tasks\r\n * @param task defines the task that was just processed\r\n */\r\n constructor(remainingCount: number, totalCount: number, task: AbstractAssetTask) {\r\n this.remainingCount = remainingCount;\r\n this.totalCount = totalCount;\r\n this.task = task;\r\n }\r\n}\r\n\r\n/**\r\n * Define a task used by AssetsManager to load assets into a container\r\n */\r\nexport class ContainerAssetTask extends AbstractAssetTask {\r\n /**\r\n * Get the loaded asset container\r\n */\r\n public loadedContainer: AssetContainer;\r\n /**\r\n * Gets the list of loaded transforms\r\n */\r\n public loadedTransformNodes: Array<TransformNode>;\r\n /**\r\n * Gets the list of loaded meshes\r\n */\r\n public loadedMeshes: Array<AbstractMesh>;\r\n /**\r\n * Gets the list of loaded particle systems\r\n */\r\n public loadedParticleSystems: Array<IParticleSystem>;\r\n /**\r\n * Gets the list of loaded skeletons\r\n */\r\n public loadedSkeletons: Array<Skeleton>;\r\n /**\r\n * Gets the list of loaded animation groups\r\n */\r\n public loadedAnimationGroups: Array<AnimationGroup>;\r\n\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public override onSuccess: (task: ContainerAssetTask) => void;\r\n\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public override onError: (task: ContainerAssetTask, message?: string, exception?: any) => void;\r\n\r\n /**\r\n * Creates a new ContainerAssetTask\r\n * @param name defines the name of the task\r\n * @param meshesNames defines the list of mesh's names you want to load\r\n * @param rootUrl defines the root url to use as a base to load your meshes and associated resources\r\n * @param sceneFilename defines the filename or File of the scene to load from\r\n * @param extension defines the extension to use to load the scene (if not defined, \".babylon\" will be used)\r\n */\r\n constructor(\r\n /**\r\n * Defines the name of the task\r\n */\r\n public override name: string,\r\n /**\r\n * Defines the list of mesh's names you want to load\r\n */\r\n public meshesNames: any,\r\n /**\r\n * Defines the root url to use as a base to load your meshes and associated resources\r\n */\r\n public rootUrl: string,\r\n /**\r\n * Defines the filename or File of the scene to load from\r\n */\r\n public sceneFilename: string | File,\r\n /**\r\n * Defines the extension to use to load the scene (if not defined, \".babylon\" will be used)\r\n */\r\n public extension?: string\r\n ) {\r\n super(name);\r\n }\r\n\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n public override runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void) {\r\n SceneLoader.LoadAssetContainer(\r\n this.rootUrl,\r\n this.sceneFilename,\r\n scene,\r\n (container: AssetContainer) => {\r\n this.loadedContainer = container;\r\n this.loadedMeshes = container.meshes;\r\n this.loadedTransformNodes = container.transformNodes;\r\n this.loadedParticleSystems = container.particleSystems;\r\n this.loadedSkeletons = container.skeletons;\r\n this.loadedAnimationGroups = container.animationGroups;\r\n onSuccess();\r\n },\r\n null,\r\n (scene, message, exception) => {\r\n onError(message, exception);\r\n },\r\n this.extension\r\n );\r\n }\r\n}\r\n\r\n/**\r\n * Define a task used by AssetsManager to load meshes\r\n */\r\nexport class MeshAssetTask extends AbstractAssetTask {\r\n /**\r\n * Gets the list of loaded transforms\r\n */\r\n public loadedTransformNodes: Array<TransformNode>;\r\n /**\r\n * Gets the list of loaded meshes\r\n */\r\n public loadedMeshes: Array<AbstractMesh>;\r\n /**\r\n * Gets the list of loaded particle systems\r\n */\r\n public loadedParticleSystems: Array<IParticleSystem>;\r\n /**\r\n * Gets the list of loaded skeletons\r\n */\r\n public loadedSkeletons: Array<Skeleton>;\r\n /**\r\n * Gets the list of loaded animation groups\r\n */\r\n public loadedAnimationGroups: Array<AnimationGroup>;\r\n\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public override onSuccess: (task: MeshAssetTask) => void;\r\n\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public override onError: (task: MeshAssetTask, message?: string, exception?: any) => void;\r\n\r\n /**\r\n * Creates a new MeshAssetTask\r\n * @param name defines the name of the task\r\n * @param meshesNames defines the list of mesh's names you want to load\r\n * @param rootUrl defines the root url to use as a base to load your meshes and associated resources\r\n * @param sceneFilename defines the filename or File of the scene to load from\r\n * @param extension defines the extension to use to load the scene (if not defined, \".babylon\" will be used)\r\n */\r\n constructor(\r\n /**\r\n * Defines the name of the task\r\n */\r\n public override name: string,\r\n /**\r\n * Defines the list of mesh's names you want to load\r\n */\r\n public meshesNames: any,\r\n /**\r\n * Defines the root url to use as a base to load your meshes and associated resources\r\n */\r\n public rootUrl: string,\r\n /**\r\n * Defines the filename or File of the scene to load from\r\n */\r\n public sceneFilename: string | File,\r\n /**\r\n * Defines the extension to use to load the scene (if not defined, \".babylon\" will be used)\r\n */\r\n public extension?: string\r\n ) {\r\n super(name);\r\n }\r\n\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n public override runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void) {\r\n SceneLoader.ImportMesh(\r\n this.meshesNames,\r\n this.rootUrl,\r\n this.sceneFilename,\r\n scene,\r\n (meshes: AbstractMesh[], particleSystems: IParticleSystem[], skeletons: Skeleton[], animationGroups: AnimationGroup[], transformNodes: TransformNode[]) => {\r\n this.loadedMeshes = meshes;\r\n this.loadedTransformNodes = transformNodes;\r\n this.loadedParticleSystems = particleSystems;\r\n this.loadedSkeletons = skeletons;\r\n this.loadedAnimationGroups = animationGroups;\r\n onSuccess();\r\n },\r\n null,\r\n (scene, message, exception) => {\r\n onError(message, exception);\r\n },\r\n this.extension\r\n );\r\n }\r\n}\r\n\r\n/**\r\n * Define a task used by AssetsManager to load animations\r\n */\r\nexport class AnimationAssetTask extends AbstractAssetTask {\r\n /**\r\n * Gets the list of loaded animation groups\r\n */\r\n public loadedAnimationGroups: Array<AnimationGroup>;\r\n /**\r\n * Gets the list of loaded animatables\r\n */\r\n public loadedAnimatables: Array<Animatable>;\r\n\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public override onSuccess: (task: AnimationAssetTask) => void;\r\n\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public override onError: (task: AnimationAssetTask, message?: string, exception?: any) => void;\r\n\r\n /**\r\n * Creates a new AnimationAssetTask\r\n * @param name defines the name of the task\r\n * @param rootUrl defines the root url to use as a base to load your meshes and associated resources\r\n * @param filename defines the filename or File of the scene to load from\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 extension defines the extension to use to load the scene (if not defined, \".babylon\" will be used)\r\n */\r\n constructor(\r\n /**\r\n * Defines the name of the task\r\n */\r\n public override name: string,\r\n /**\r\n * Defines the root url to use as a base to load your meshes and associated resources\r\n */\r\n public rootUrl: string,\r\n /**\r\n * Defines the filename to load from\r\n */\r\n public filename: string | File,\r\n /**\r\n * Defines a function used to convert animation targets from loaded scene to current scene (default: search node by name)\r\n */\r\n public targetConverter?: Nullable<(target: any) => any>,\r\n /**\r\n * Defines the extension to use to load the scene (if not defined, \".babylon\" will be used)\r\n */\r\n public extension?: string\r\n ) {\r\n super(name);\r\n }\r\n\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n public override runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void) {\r\n const startingIndexForNewAnimatables = scene.animatables.length;\r\n const startingIndexForNewAnimationGroups = scene.animationGroups.length;\r\n this.loadedAnimatables = [];\r\n this.loadedAnimationGroups = [];\r\n SceneLoader.ImportAnimations(\r\n this.rootUrl,\r\n this.filename,\r\n scene,\r\n false,\r\n SceneLoaderAnimationGroupLoadingMode.NoSync,\r\n this.targetConverter,\r\n () => {\r\n this.loadedAnimatables = scene.animatables.slice(startingIndexForNewAnimatables);\r\n this.loadedAnimationGroups = scene.animationGroups.slice(startingIndexForNewAnimationGroups);\r\n\r\n onSuccess();\r\n },\r\n null,\r\n (scene, message, exception) => {\r\n onError(message, exception);\r\n },\r\n this.extension\r\n );\r\n }\r\n}\r\n\r\n/**\r\n * Define a task used by AssetsManager to load text content\r\n */\r\nexport class TextFileAssetTask extends AbstractAssetTask {\r\n /**\r\n * Gets the loaded text string\r\n */\r\n public text: string;\r\n\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public override onSuccess: (task: TextFileAssetTask) => void;\r\n\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public override onError: (task: TextFileAssetTask, message?: string, exception?: any) => void;\r\n\r\n /**\r\n * Creates a new TextFileAssetTask object\r\n * @param name defines the name of the task\r\n * @param url defines the location of the file to load\r\n */\r\n constructor(\r\n /**\r\n * Defines the name of the task\r\n */\r\n public override name: string,\r\n /**\r\n * Defines the location of the file to load\r\n */\r\n public url: string\r\n ) {\r\n super(name);\r\n }\r\n\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n public override runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void) {\r\n scene._loadFile(\r\n this.url,\r\n (data) => {\r\n this.text = data as string;\r\n onSuccess();\r\n },\r\n undefined,\r\n false,\r\n false,\r\n (request, exception) => {\r\n if (request) {\r\n onError(request.status + \" \" + request.statusText, exception);\r\n }\r\n }\r\n );\r\n }\r\n}\r\n\r\n/**\r\n * Define a task used by AssetsManager to load binary data\r\n */\r\nexport class BinaryFileAssetTask extends AbstractAssetTask {\r\n /**\r\n * Gets the loaded data (as an array buffer)\r\n */\r\n public data: ArrayBuffer;\r\n\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public override onSuccess: (task: BinaryFileAssetTask) => void;\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public override onError: (task: BinaryFileAssetTask, message?: string, exception?: any) => void;\r\n\r\n /**\r\n * Creates a new BinaryFileAssetTask object\r\n * @param name defines the name of the new task\r\n * @param url defines the location of the file to load\r\n */\r\n constructor(\r\n /**\r\n * Defines the name of the task\r\n */\r\n public override name: string,\r\n /**\r\n * Defines the location of the file to load\r\n */\r\n public url: string\r\n ) {\r\n super(name);\r\n }\r\n\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n public override runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void) {\r\n scene._loadFile(\r\n this.url,\r\n (data) => {\r\n this.data = data as ArrayBuffer;\r\n onSuccess();\r\n },\r\n undefined,\r\n true,\r\n true,\r\n (request, exception) => {\r\n if (request) {\r\n onError(request.status + \" \" + request.statusText, exception);\r\n }\r\n }\r\n );\r\n }\r\n}\r\n\r\n/**\r\n * Define a task used by AssetsManager to load images\r\n */\r\nexport class ImageAssetTask extends AbstractAssetTask {\r\n /**\r\n * Gets the loaded images\r\n */\r\n public image: HTMLImageElement;\r\n\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public override onSuccess: (task: ImageAssetTask) => void;\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public override onError: (task: ImageAssetTask, message?: string, exception?: any) => void;\r\n\r\n /**\r\n * Creates a new ImageAssetTask\r\n * @param name defines the name of the task\r\n * @param url defines the location of the image to load\r\n */\r\n constructor(\r\n /**\r\n * Defines the name of the task\r\n */\r\n public override name: string,\r\n /**\r\n * Defines the location of the image to load\r\n */\r\n public url: string\r\n ) {\r\n super(name);\r\n }\r\n\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n public override runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void) {\r\n const img = new Image();\r\n\r\n Tools.SetCorsBehavior(this.url, img);\r\n\r\n img.onload = () => {\r\n this.image = img;\r\n onSuccess();\r\n };\r\n\r\n img.onerror = (err: string | Event): any => {\r\n onError(\"Error loading image\", err);\r\n };\r\n\r\n img.src = this.url;\r\n }\r\n}\r\n\r\n/**\r\n * Defines the interface used by texture loading tasks\r\n */\r\nexport interface ITextureAssetTask<Tex extends BaseTexture> {\r\n /**\r\n * Gets the loaded texture\r\n */\r\n texture: Tex;\r\n}\r\n\r\n/**\r\n * Define a task used by AssetsManager to load 2D textures\r\n */\r\nexport class TextureAssetTask extends AbstractAssetTask implements ITextureAssetTask<Texture> {\r\n /**\r\n * Gets the loaded texture\r\n */\r\n public texture: Texture;\r\n\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public override onSuccess: (task: TextureAssetTask) => void;\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public override onError: (task: TextureAssetTask, message?: string, exception?: any) => void;\r\n\r\n /**\r\n * Creates a new TextureAssetTask object\r\n * @param name defines the name of the task\r\n * @param url defines the location of the file to load\r\n * @param noMipmap defines if mipmap should not be generated (default is false)\r\n * @param invertY defines if texture must be inverted on Y axis (default is true)\r\n * @param samplingMode defines the sampling mode to use (default is Texture.TRILINEAR_SAMPLINGMODE)\r\n */\r\n constructor(\r\n /**\r\n * Defines the name of the task\r\n */\r\n public override name: string,\r\n /**\r\n * Defines the location of the file to load\r\n */\r\n public url: string,\r\n /**\r\n * Defines if mipmap should not be generated (default is false)\r\n */\r\n public noMipmap?: boolean,\r\n /**\r\n * [true] Defines if texture must be inverted on Y axis (default is true)\r\n */\r\n public invertY: boolean = true,\r\n /**\r\n * [3] Defines the sampling mode to use (default is Texture.TRILINEAR_SAMPLINGMODE)\r\n */\r\n public samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE\r\n ) {\r\n super(name);\r\n }\r\n\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n public override runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void) {\r\n const onload = () => {\r\n onSuccess();\r\n };\r\n\r\n const onerror = (message?: string, exception?: any) => {\r\n onError(message, exception);\r\n };\r\n\r\n this.texture = new Texture(this.url, scene, this.noMipmap, this.invertY, this.samplingMode, onload, onerror);\r\n }\r\n}\r\n\r\n/**\r\n * Define a task used by AssetsManager to load cube textures\r\n */\r\nexport class CubeTextureAssetTask extends AbstractAssetTask implements ITextureAssetTask<CubeTexture> {\r\n /**\r\n * Gets the loaded texture\r\n */\r\n public texture: CubeTexture;\r\n\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public override onSuccess: (task: CubeTextureAssetTask) => void;\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public override onError: (task: CubeTextureAssetTask, message?: string, exception?: any) => void;\r\n\r\n /**\r\n * Creates a new CubeTextureAssetTask\r\n * @param name defines the name of the task\r\n * @param url defines the location of the files to load (You have to specify the folder where the files are + filename with no extension)\r\n * @param extensions defines the extensions to use to load files ([\"_px\", \"_py\", \"_pz\", \"_nx\", \"_ny\", \"_nz\"] by default)\r\n * @param noMipmap defines if mipmaps should not be generated (default is false)\r\n * @param files defines the explicit list of files (undefined by default)\r\n * @param prefiltered\r\n */\r\n constructor(\r\n /**\r\n * Defines the name of the task\r\n */\r\n public override name: string,\r\n /**\r\n * Defines the location of the files to load (You have to specify the folder where the files are + filename with no extension)\r\n */\r\n public url: string,\r\n /**\r\n * Defines the extensions to use to load files ([\"_px\", \"_py\", \"_pz\", \"_nx\", \"_ny\", \"_nz\"] by default)\r\n */\r\n public extensions?: string[],\r\n /**\r\n * Defines if mipmaps should not be generated (default is false)\r\n */\r\n public noMipmap?: boolean,\r\n /**\r\n * Defines the explicit list of files (undefined by default)\r\n */\r\n public files?: string[],\r\n /**\r\n * Defines the prefiltered texture option (default is false)\r\n */\r\n public prefiltered?: boolean\r\n ) {\r\n super(name);\r\n }\r\n\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n public override runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void) {\r\n const onload = () => {\r\n onSuccess();\r\n };\r\n\r\n const onerror = (message?: string, exception?: any) => {\r\n onError(message, exception);\r\n };\r\n\r\n this.texture = new CubeTexture(this.url, scene, this.extensions, this.noMipmap, this.files, onload, onerror, undefined, this.prefiltered);\r\n }\r\n}\r\n\r\n/**\r\n * Define a task used by AssetsManager to load HDR cube textures\r\n */\r\nexport class HDRCubeTextureAssetTask extends AbstractAssetTask implements ITextureAssetTask<HDRCubeTexture> {\r\n /**\r\n * Gets the loaded texture\r\n */\r\n public texture: HDRCubeTexture;\r\n\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public override onSuccess: (task: HDRCubeTextureAssetTask) => void;\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public override onError: (task: HDRCubeTextureAssetTask, message?: string, exception?: any) => void;\r\n\r\n /**\r\n * Creates a new HDRCubeTextureAssetTask object\r\n * @param name defines the name of the task\r\n * @param url defines the location of the file to load\r\n * @param size defines the desired size (the more it increases the longer the generation will be) If the size is omitted this implies you are using a preprocessed cubemap.\r\n * @param noMipmap defines if mipmaps should not be generated (default is false)\r\n * @param generateHarmonics specifies whether you want to extract the polynomial harmonics during the generation process (default is true)\r\n * @param gammaSpace specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space) (default is false)\r\n * @param reserved Internal use only\r\n */\r\n constructor(\r\n /**\r\n * Defines the name of the task\r\n */\r\n public override name: string,\r\n /**\r\n * Defines the location of the file to load\r\n */\r\n public url: string,\r\n /**\r\n * Defines the desired size (the more it increases the longer the generation will be)\r\n */\r\n public size: number,\r\n /**\r\n * [false] Defines if mipmaps should not be generated (default is false)\r\n */\r\n public noMipmap = false,\r\n /**\r\n * [true] Specifies whether you want to extract the polynomial harmonics during the generation process (default is true)\r\n */\r\n public generateHarmonics = true,\r\n /**\r\n * [false] Specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space) (default is false)\r\n */\r\n public gammaSpace = false,\r\n /**\r\n * [false] Internal Use Only\r\n */\r\n public reserved = false\r\n ) {\r\n super(name);\r\n }\r\n\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n public override runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void) {\r\n const onload = () => {\r\n onSuccess();\r\n };\r\n\r\n const onerror = (message?: string, exception?: any) => {\r\n onError(message, exception);\r\n };\r\n\r\n this.texture = new HDRCubeTexture(this.url, scene, this.size, this.noMipmap, this.generateHarmonics, this.gammaSpace, this.reserved, onload, onerror);\r\n }\r\n}\r\n\r\n/**\r\n * Define a task used by AssetsManager to load Equirectangular cube textures\r\n */\r\nexport class EquiRectangularCubeTextureAssetTask extends AbstractAssetTask implements ITextureAssetTask<EquiRectangularCubeTexture> {\r\n /**\r\n * Gets the loaded texture\r\n */\r\n public texture: EquiRectangularCubeTexture;\r\n\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public override onSuccess: (task: EquiRectangularCubeTextureAssetTask) => void;\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public override onError: (task: EquiRectangularCubeTextureAssetTask, message?: string, exception?: any) => void;\r\n\r\n /**\r\n * Creates a new EquiRectangularCubeTextureAssetTask object\r\n * @param name defines the name of the task\r\n * @param url defines the location of the file to load\r\n * @param size defines the desired size (the more it increases the longer the generation will be)\r\n * If the size is omitted this implies you are using a preprocessed cubemap.\r\n * @param noMipmap defines if mipmaps should not be generated (default is false)\r\n * @param gammaSpace specifies if the texture will be used in gamma or linear space\r\n * (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space)\r\n * (default is true)\r\n */\r\n constructor(\r\n /**\r\n * Defines the name of the task\r\n */\r\n public override name: string,\r\n /**\r\n * Defines the location of the file to load\r\n */\r\n public url: string,\r\n /**\r\n * Defines the desired size (the more it increases the longer the generation will be)\r\n */\r\n public size: number,\r\n /**\r\n * [false] Defines if mipmaps should not be generated (default is false)\r\n */\r\n public noMipmap: boolean = false,\r\n /**\r\n * [true] Specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space,\r\n * but the standard material would require them in Gamma space) (default is true)\r\n */\r\n public gammaSpace: boolean = true\r\n ) {\r\n super(name);\r\n }\r\n\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n public override runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void): void {\r\n const onload = () => {\r\n onSuccess();\r\n };\r\n\r\n const onerror = (message?: string, exception?: any) => {\r\n onError(message, exception);\r\n };\r\n\r\n this.texture = new EquiRectangularCubeTexture(this.url, scene, this.size, this.noMipmap, this.gammaSpace, onload, onerror);\r\n }\r\n}\r\n\r\n/**\r\n * This class can be used to easily import assets into a scene\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/importers/assetManager\r\n */\r\nexport class AssetsManager {\r\n private _scene: Scene;\r\n private _isLoading = false;\r\n\r\n protected _tasks = new Array<AbstractAssetTask>();\r\n protected _waitingTasksCount = 0;\r\n protected _totalTasksCount = 0;\r\n\r\n /**\r\n * Callback called when all tasks are processed\r\n */\r\n public onFinish: (tasks: AbstractAssetTask[]) => void;\r\n\r\n /**\r\n * Callback called when a task is successful\r\n */\r\n public onTaskSuccess: (task: AbstractAssetTask) => void;\r\n\r\n /**\r\n * Callback called when a task had an error\r\n */\r\n public onTaskError: (task: AbstractAssetTask) => void;\r\n\r\n /**\r\n * Callback called when a task is done (whatever the result is)\r\n */\r\n public onProgress: (remainingCount: number, totalCount: number, task: AbstractAssetTask) => void;\r\n\r\n /**\r\n * Observable called when all tasks are processed\r\n */\r\n public onTaskSuccessObservable = new Observable<AbstractAssetTask>();\r\n\r\n /**\r\n * Observable called when a task had an error\r\n */\r\n public onTaskErrorObservable = new Observable<AbstractAssetTask>();\r\n\r\n /**\r\n * Observable called when all tasks were executed\r\n */\r\n public onTasksDoneObservable = new Observable<AbstractAssetTask[]>();\r\n\r\n /**\r\n * Observable called when a task is done (whatever the result is)\r\n */\r\n public onProgressObservable = new Observable<IAssetsProgressEvent>();\r\n\r\n /**\r\n * Gets or sets a boolean defining if the AssetsManager should use the default loading screen\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/customLoadingScreen\r\n */\r\n public useDefaultLoadingScreen = true;\r\n\r\n /**\r\n * Gets or sets a boolean defining if the AssetsManager should automatically hide the loading screen\r\n * when all assets have been downloaded.\r\n * If set to false, you need to manually call in hideLoadingUI() once your scene is ready.\r\n */\r\n public autoHideLoadingUI = true;\r\n\r\n /**\r\n * Creates a new AssetsManager\r\n * @param scene defines the scene to work on\r\n */\r\n constructor(scene?: Scene) {\r\n this._scene = scene || <Scene>EngineStore.LastCreatedScene;\r\n }\r\n\r\n /**\r\n * Add a ContainerAssetTask to the list of active tasks\r\n * @param taskName defines the name of the new task\r\n * @param meshesNames defines the name of meshes to load\r\n * @param rootUrl defines the root url to use to locate files\r\n * @param sceneFilename defines the filename of the scene file or the File itself\r\n * @param extension defines the extension to use to load the file\r\n * @returns a new ContainerAssetTask object\r\n */\r\n public addContainerTask(taskName: string, meshesNames: any, rootUrl: string, sceneFilename: string | File, extension?: string): ContainerAssetTask {\r\n const task = new ContainerAssetTask(taskName, meshesNames, rootUrl, sceneFilename, extension);\r\n this._tasks.push(task);\r\n\r\n return task;\r\n }\r\n\r\n /**\r\n * Add a MeshAssetTask to the list of active tasks\r\n * @param taskName defines the name of the new task\r\n * @param meshesNames defines the name of meshes to load\r\n * @param rootUrl defines the root url to use to locate files\r\n * @param sceneFilename defines the filename of the scene file or the File itself\r\n * @param extension defines the extension to use to load the file\r\n * @returns a new MeshAssetTask object\r\n */\r\n public addMeshTask(taskName: string, meshesNames: any, rootUrl: string, sceneFilename: string | File, extension?: string): MeshAssetTask {\r\n const task = new MeshAssetTask(taskName, meshesNames, rootUrl, sceneFilename, extension);\r\n this._tasks.push(task);\r\n\r\n return task;\r\n }\r\n\r\n /**\r\n * Add a TextFileAssetTask to the list of active tasks\r\n * @param taskName defines the name of the new task\r\n * @param url defines the url of the file to load\r\n * @returns a new TextFileAssetTask object\r\n */\r\n public addTextFileTask(taskName: string, url: string): TextFileAssetTask {\r\n const task = new TextFileAssetTask(taskName, url);\r\n this._tasks.push(task);\r\n\r\n return task;\r\n }\r\n\r\n /**\r\n * Add a BinaryFileAssetTask to the list of active tasks\r\n * @param taskName defines the name of the new task\r\n * @param url defines the url of the file to load\r\n * @returns a new BinaryFileAssetTask object\r\n */\r\n public addBinaryFileTask(taskName: string, url: string): BinaryFileAssetTask {\r\n const task = new BinaryFileAssetTask(taskName, url);\r\n this._tasks.push(task);\r\n\r\n return task;\r\n }\r\n\r\n /**\r\n * Add a ImageAssetTask to the list of active tasks\r\n * @param taskName defines the name of the new task\r\n * @param url defines the url of the file to load\r\n * @returns a new ImageAssetTask object\r\n */\r\n public addImageTask(taskName: string, url: string): ImageAssetTask {\r\n const task = new ImageAssetTask(taskName, url);\r\n this._tasks.push(task);\r\n\r\n return task;\r\n }\r\n\r\n /**\r\n * Add a TextureAssetTask to the list of active tasks\r\n * @param taskName defines the name of the new task\r\n * @param url defines the url of the file to load\r\n * @param noMipmap defines if the texture must not receive mipmaps (false by default)\r\n * @param invertY defines if you want to invert Y axis of the loaded texture (true by default)\r\n * @param samplingMode defines the sampling mode to use (Texture.TRILINEAR_SAMPLINGMODE by default)\r\n * @returns a new TextureAssetTask object\r\n */\r\n public addTextureTask(taskName: string, url: string, noMipmap?: boolean, invertY?: boolean, samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE): TextureAssetTask {\r\n const task = new TextureAssetTask(taskName, url, noMipmap, invertY, samplingMode);\r\n this._tasks.push(task);\r\n\r\n return task;\r\n }\r\n\r\n /**\r\n * Add a CubeTextureAssetTask to the list of active tasks\r\n * @param taskName defines the name of the new task\r\n * @param url defines the url of the file to load\r\n * @param extensions defines the extension to use to load the cube map (can be null)\r\n * @param noMipmap defines if the texture must not receive mipmaps (false by default)\r\n * @param files defines the list of files to load (can be null)\r\n * @param prefiltered defines the prefiltered texture option (default is false)\r\n * @returns a new CubeTextureAssetTask object\r\n */\r\n public addCubeTextureTask(taskName: string, url: string, extensions?: string[], noMipmap?: boolean, files?: string[], prefiltered?: boolean): CubeTextureAssetTask {\r\n const task = new CubeTextureAssetTask(taskName, url, extensions, noMipmap, files, prefiltered);\r\n this._tasks.push(task);\r\n\r\n return task;\r\n }\r\n\r\n /**\r\n *\r\n * Add a HDRCubeTextureAssetTask to the list of active tasks\r\n * @param taskName defines the name of the new task\r\n * @param url defines the url of the file to load\r\n * @param size defines the size you want for the cubemap (can be null)\r\n * @param noMipmap defines if the texture must not receive mipmaps (false by default)\r\n * @param generateHarmonics defines if you want to automatically generate (true by default)\r\n * @param gammaSpace specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space) (default is false)\r\n * @param reserved Internal use only\r\n * @returns a new HDRCubeTextureAssetTask object\r\n */\r\n public addHDRCubeTextureTask(\r\n taskName: string,\r\n url: string,\r\n size: number,\r\n noMipmap = false,\r\n generateHarmonics = true,\r\n gammaSpace = false,\r\n reserved = false\r\n ): HDRCubeTextureAssetTask {\r\n const task = new HDRCubeTextureAssetTask(taskName, url, size, noMipmap, generateHarmonics, gammaSpace, reserved);\r\n this._tasks.push(task);\r\n\r\n return task;\r\n }\r\n\r\n /**\r\n *\r\n * Add a EquiRectangularCubeTextureAssetTask to the list of active tasks\r\n * @param taskName defines the name of the new task\r\n * @param url defines the url of the file to load\r\n * @param size defines the size you want for the cubemap (can be null)\r\n * @param noMipmap defines if the texture must not receive mipmaps (false by default)\r\n * @param gammaSpace Specifies if the texture will be used in gamma or linear space\r\n * (the PBR material requires those textures in linear space, but the standard material would require them in Gamma space)\r\n * @returns a new EquiRectangularCubeTextureAssetTask object\r\n */\r\n public addEquiRectangularCubeTextureAssetTask(taskName: string, url: string, size: number, noMipmap = false, gammaSpace = true): EquiRectangularCubeTextureAssetTask {\r\n const task = new EquiRectangularCubeTextureAssetTask(taskName, url, size, noMipmap, gammaSpace);\r\n this._tasks.push(task);\r\n\r\n return task;\r\n }\r\n\r\n /**\r\n * Remove a task from the assets manager.\r\n * @param task the task to remove\r\n */\r\n public removeTask(task: AbstractAssetTask) {\r\n const index = this._tasks.indexOf(task);\r\n\r\n if (index > -1) {\r\n this._tasks.splice(index, 1);\r\n }\r\n }\r\n\r\n private _decreaseWaitingTasksCount(task: AbstractAssetTask): void {\r\n this._waitingTasksCount--;\r\n\r\n try {\r\n if (this.onProgress) {\r\n this.onProgress(this._waitingTasksCount, this._totalTasksCount, task);\r\n }\r\n\r\n this.onProgressObservable.notifyObservers(new AssetsProgressEvent(this._waitingTasksCount, this._totalTasksCount, task));\r\n } catch (e) {\r\n Logger.Error(\"Error running progress callbacks.\");\r\n Logger.Log(e);\r\n }\r\n\r\n if (this._waitingTasksCount === 0) {\r\n try {\r\n const currentTasks = this._tasks.slice();\r\n\r\n if (this.onFinish) {\r\n // Calling onFinish with immutable array of tasks\r\n this.onFinish(currentTasks);\r\n }\r\n\r\n // Let's remove successful tasks\r\n for (const task of currentTasks) {\r\n if (task.taskState === AssetTaskState.DONE) {\r\n const index = this._tasks.indexOf(task);\r\n\r\n if (index > -1) {\r\n this._tasks.splice(index, 1);\r\n }\r\n }\r\n }\r\n\r\n this.onTasksDoneObservable.notifyObservers(this._tasks);\r\n } catch (e) {\r\n Logger.Error(\"Error running tasks-done callbacks.\");\r\n Logger.Log(e);\r\n }\r\n this._isLoading = false;\r\n if (this.autoHideLoadingUI) {\r\n this._scene.getEngine().hideLoadingUI();\r\n }\r\n }\r\n }\r\n\r\n private _runTask(task: AbstractAssetTask): void {\r\n const done = () => {\r\n try {\r\n if (this.onTaskSuccess) {\r\n this.onTaskSuccess(task);\r\n }\r\n this.onTaskSuccessObservable.notifyObservers(task);\r\n this._decreaseWaitingTasksCount(task);\r\n } catch (e) {\r\n error(\"Error executing task success callbacks\", e);\r\n }\r\n };\r\n\r\n const error = (message?: string, exception?: any) => {\r\n task._setErrorObject(message, exception);\r\n\r\n if (this.onTaskError) {\r\n this.onTaskError(task);\r\n } else if (!task.onError) {\r\n Logger.Error(this._formatTaskErrorMessage(task));\r\n }\r\n this.onTaskErrorObservable.notifyObservers(task);\r\n this._decreaseWaitingTasksCount(task);\r\n };\r\n\r\n task.run(this._scene, done, error);\r\n }\r\n\r\n private _formatTaskErrorMessage(task: AbstractAssetTask) {\r\n let errorMessage = \"Unable to complete task \" + task.name;\r\n\r\n if (task.errorObject.message) {\r\n errorMessage += `: ${task.errorObject.message}`;\r\n }\r\n if (task.errorObject.exception) {\r\n errorMessage += `: ${task.errorObject.exception}`;\r\n }\r\n\r\n return errorMessage;\r\n }\r\n\r\n /**\r\n * Reset the AssetsManager and remove all tasks\r\n * @returns the current instance of the AssetsManager\r\n */\r\n public reset(): AssetsManager {\r\n this._isLoading = false;\r\n this._tasks = new Array<AbstractAssetTask>();\r\n return this;\r\n }\r\n\r\n /**\r\n * Start the loading process\r\n * @returns the current instance of the AssetsManager\r\n */\r\n public load(): AssetsManager {\r\n if (this._isLoading) {\r\n return this;\r\n }\r\n this._isLoading = true;\r\n this._waitingTasksCount = this._tasks.length;\r\n this._totalTasksCount = this._tasks.length;\r\n\r\n if (this._waitingTasksCount === 0) {\r\n this._isLoading = false;\r\n if (this.onFinish) {\r\n this.onFinish(this._tasks);\r\n }\r\n this.onTasksDoneObservable.notifyObservers(this._tasks);\r\n return this;\r\n }\r\n\r\n if (this.useDefaultLoadingScreen) {\r\n this._scene.getEngine().displayLoadingUI();\r\n }\r\n\r\n for (let index = 0; index < this._tasks.length; index++) {\r\n const task = this._tasks[index];\r\n if (task.taskState === AssetTaskState.INIT) {\r\n this._runTask(task);\r\n }\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Start the loading process as an async operation\r\n * @returns a promise returning the list of failed tasks\r\n */\r\n public async loadAsync(): Promise<void> {\r\n return new Promise((resolve, reject) => {\r\n if (this._isLoading) {\r\n resolve();\r\n return;\r\n }\r\n this.onTasksDoneObservable.addOnce((remainingTasks) => {\r\n if (remainingTasks && remainingTasks.length) {\r\n reject(remainingTasks);\r\n } else {\r\n resolve();\r\n }\r\n });\r\n\r\n this.load();\r\n });\r\n }\r\n}\r\n"]}
@@ -7,6 +7,7 @@ import { PostProcess } from "../PostProcesses/postProcess.js";
7
7
  import { PostProcessManager } from "../PostProcesses/postProcessManager.js";
8
8
  import type { AbstractEngine } from "../Engines/abstractEngine.js";
9
9
  import "../Shaders/minmaxRedux.fragment.js";
10
+ import "../ShadersWGSL/minmaxRedux.fragment.js";
10
11
  /**
11
12
  * This class computes a min/max reduction from a texture: it means it computes the minimum
12
13
  * and maximum values from all values of the texture.
@@ -3,6 +3,7 @@ import { Observable } from "./observable.js";
3
3
  import { PostProcess } from "../PostProcesses/postProcess.js";
4
4
  import { PostProcessManager } from "../PostProcesses/postProcessManager.js";
5
5
  import "../Shaders/minmaxRedux.fragment.js";
6
+ import "../ShadersWGSL/minmaxRedux.fragment.js";
6
7
  /**
7
8
  * This class computes a min/max reduction from a texture: it means it computes the minimum
8
9
  * and maximum values from all values of the texture.
@@ -62,7 +63,7 @@ export class MinMaxReducer {
62
63
  scene.getEngine(), // engine
63
64
  false, // reusable
64
65
  "#define INITIAL" + (depthRedux ? "\n#define DEPTH_REDUX" : ""), // defines
65
- type, undefined, undefined, undefined, 7);
66
+ type, undefined, undefined, undefined, 7, scene.getEngine().isWebGPU ? 1 /* ShaderLanguage.WGSL */ : 0 /* ShaderLanguage.GLSL */);
66
67
  reductionInitial.autoClear = false;
67
68
  reductionInitial.forceFullscreenViewport = forceFullscreenViewport;
68
69
  let w = this._sourceTexture.getRenderWidth(), h = this._sourceTexture.getRenderHeight();
@@ -85,7 +86,7 @@ export class MinMaxReducer {
85
86
  scene.getEngine(), // engine
86
87
  false, // reusable
87
88
  "#define " + (w == 1 && h == 1 ? "LAST" : w == 1 || h == 1 ? "ONEBEFORELAST" : "MAIN"), // defines
88
- type, undefined, undefined, undefined, 7);
89
+ type, undefined, undefined, undefined, 7, scene.getEngine().isWebGPU ? 1 /* ShaderLanguage.WGSL */ : 0 /* ShaderLanguage.GLSL */);
89
90
  reduction.autoClear = false;
90
91
  reduction.forceFullscreenViewport = forceFullscreenViewport;
91
92
  reduction.onApply = ((w, h) => {
@@ -1 +1 @@
1
- {"version":3,"file":"minMaxReducer.js","sourceRoot":"","sources":["../../../../dev/core/src/Misc/minMaxReducer.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAIzE,OAAO,iCAAiC,CAAC;AAEzC;;;;;GAKG;AACH,MAAM,OAAO,aAAa;IActB;;;OAGG;IACH,YAAY,MAAc;QAjB1B;;WAEG;QACI,8BAAyB,GAAG,IAAI,UAAU,EAAgC,CAAC;QAOxE,6BAAwB,GAAG,IAAI,CAAC;QAyJhC,eAAU,GAAG,KAAK,CAAC;QAjJzB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,mBAAmB,GAAG,IAAI,kBAAkB,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;QAErE,IAAI,CAAC,0BAA0B,GAAG,MAAM,CAAC,SAAS,EAAE,CAAC,2BAA2B,CAAC,GAAG,CAAC,GAAG,EAAE;YACtF,IAAI,CAAC,mBAAmB,CAAC,QAAQ,EAAE,CAAC;QACxC,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;OAEG;IACH,IAAW,aAAa;QACpB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC/B,CAAC;IAED;;;;;;;;;;OAUG;IACI,gBAAgB,CAAC,aAAkC,EAAE,UAAmB,EAAE,OAAe,SAAS,CAAC,sBAAsB,EAAE,uBAAuB,GAAG,IAAI;QAC5J,IAAI,aAAa,KAAK,IAAI,CAAC,cAAc,EAAE,CAAC;YACxC,OAAO;QACX,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAEpB,IAAI,CAAC,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\"../types\";\r\nimport type { RenderTargetTexture } from \"../Materials/Textures/renderTargetTexture\";\r\nimport type { Camera } from \"../Cameras/camera\";\r\nimport { Constants } from \"../Engines/constants\";\r\nimport type { Observer } from \"./observable\";\r\nimport { Observable } from \"./observable\";\r\nimport type { Effect } from \"../Materials/effect\";\r\nimport { PostProcess } from \"../PostProcesses/postProcess\";\r\nimport { PostProcessManager } from \"../PostProcesses/postProcessManager\";\r\n\r\nimport type { AbstractEngine } from \"../Engines/abstractEngine\";\r\n\r\nimport \"../Shaders/minmaxRedux.fragment\";\r\n\r\n/**\r\n * This class computes a min/max reduction from a texture: it means it computes the minimum\r\n * and maximum values from all values of the texture.\r\n * It is performed on the GPU for better performances, thanks to a succession of post processes.\r\n * The source values are read from the red channel of the texture.\r\n */\r\nexport class MinMaxReducer {\r\n /**\r\n * Observable triggered when the computation has been performed\r\n */\r\n public onAfterReductionPerformed = new Observable<{ min: number; max: number }>();\r\n\r\n protected _camera: Camera;\r\n protected _sourceTexture: Nullable<RenderTargetTexture>;\r\n protected _reductionSteps: Nullable<Array<PostProcess>>;\r\n protected _postProcessManager: PostProcessManager;\r\n protected _onAfterUnbindObserver: Nullable<Observer<RenderTargetTexture>>;\r\n protected _forceFullscreenViewport = true;\r\n protected _onContextRestoredObserver: Nullable<Observer<AbstractEngine>>;\r\n\r\n /**\r\n * Creates a min/max reducer\r\n * @param camera The camera to use for the post processes\r\n */\r\n constructor(camera: Camera) {\r\n this._camera = camera;\r\n this._postProcessManager = new PostProcessManager(camera.getScene());\r\n\r\n this._onContextRestoredObserver = camera.getEngine().onContextRestoredObservable.add(() => {\r\n this._postProcessManager._rebuild();\r\n });\r\n }\r\n\r\n /**\r\n * Gets the texture used to read the values from.\r\n */\r\n public get sourceTexture(): Nullable<RenderTargetTexture> {\r\n return this._sourceTexture;\r\n }\r\n\r\n /**\r\n * Sets the source texture to read the values from.\r\n * One must indicate if the texture is a depth texture or not through the depthRedux parameter\r\n * because in such textures '1' value must not be taken into account to compute the maximum\r\n * as this value is used to clear the texture.\r\n * Note that the computation is not activated by calling this function, you must call activate() for that!\r\n * @param sourceTexture The texture to read the values from. The values should be in the red channel.\r\n * @param depthRedux Indicates if the texture is a depth texture or not\r\n * @param type The type of the textures created for the reduction (defaults to TEXTURETYPE_HALF_FLOAT)\r\n * @param forceFullscreenViewport Forces the post processes used for the reduction to be applied without taking into account viewport (defaults to true)\r\n */\r\n public setSourceTexture(sourceTexture: RenderTargetTexture, depthRedux: boolean, type: number = Constants.TEXTURETYPE_HALF_FLOAT, forceFullscreenViewport = true): void {\r\n if (sourceTexture === this._sourceTexture) {\r\n return;\r\n }\r\n\r\n this.dispose(false);\r\n\r\n this._sourceTexture = sourceTexture;\r\n this._reductionSteps = [];\r\n this._forceFullscreenViewport = forceFullscreenViewport;\r\n\r\n const scene = this._camera.getScene();\r\n\r\n // create the first step\r\n const reductionInitial = new PostProcess(\r\n \"Initial reduction phase\",\r\n \"minmaxRedux\", // shader\r\n [\"texSize\"],\r\n [\"sourceTexture\"], // textures\r\n 1.0, // options\r\n null, // camera\r\n Constants.TEXTURE_NEAREST_NEAREST, // sampling\r\n scene.getEngine(), // engine\r\n false, // reusable\r\n \"#define INITIAL\" + (depthRedux ? \"\\n#define DEPTH_REDUX\" : \"\"), // defines\r\n type,\r\n undefined,\r\n undefined,\r\n undefined,\r\n Constants.TEXTUREFORMAT_RG\r\n );\r\n\r\n reductionInitial.autoClear = false;\r\n reductionInitial.forceFullscreenViewport = forceFullscreenViewport;\r\n\r\n let w = this._sourceTexture.getRenderWidth(),\r\n h = this._sourceTexture.getRenderHeight();\r\n\r\n reductionInitial.onApply = ((w: number, h: number) => {\r\n return (effect: Effect) => {\r\n effect.setTexture(\"sourceTexture\", this._sourceTexture);\r\n effect.setFloat2(\"texSize\", w, h);\r\n };\r\n })(w, h);\r\n\r\n this._reductionSteps.push(reductionInitial);\r\n\r\n let index = 1;\r\n\r\n // create the additional steps\r\n while (w > 1 || h > 1) {\r\n w = Math.max(Math.round(w / 2), 1);\r\n h = Math.max(Math.round(h / 2), 1);\r\n\r\n const reduction = new PostProcess(\r\n \"Reduction phase \" + index,\r\n \"minmaxRedux\", // shader\r\n [\"texSize\"],\r\n null,\r\n { width: w, height: h }, // options\r\n null, // camera\r\n Constants.TEXTURE_NEAREST_NEAREST, // sampling\r\n scene.getEngine(), // engine\r\n false, // reusable\r\n \"#define \" + (w == 1 && h == 1 ? \"LAST\" : w == 1 || h == 1 ? \"ONEBEFORELAST\" : \"MAIN\"), // defines\r\n type,\r\n undefined,\r\n undefined,\r\n undefined,\r\n Constants.TEXTUREFORMAT_RG\r\n );\r\n\r\n reduction.autoClear = false;\r\n reduction.forceFullscreenViewport = forceFullscreenViewport;\r\n\r\n reduction.onApply = ((w: number, h: number) => {\r\n return (effect: Effect) => {\r\n if (w == 1 || h == 1) {\r\n effect.setInt2(\"texSize\", w, h);\r\n } else {\r\n effect.setFloat2(\"texSize\", w, h);\r\n }\r\n };\r\n })(w, h);\r\n\r\n this._reductionSteps.push(reduction);\r\n\r\n index++;\r\n\r\n if (w == 1 && h == 1) {\r\n const func = (w: number, h: number, reduction: PostProcess) => {\r\n const buffer = new Float32Array(4 * w * h),\r\n minmax = { min: 0, max: 0 };\r\n return () => {\r\n scene.getEngine()._readTexturePixels(reduction.inputTexture.texture!, w, h, -1, 0, buffer, false);\r\n minmax.min = buffer[0];\r\n minmax.max = buffer[1];\r\n this.onAfterReductionPerformed.notifyObservers(minmax);\r\n };\r\n };\r\n reduction.onAfterRenderObservable.add(func(w, h, reduction));\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Defines the refresh rate of the computation.\r\n * Use 0 to compute just once, 1 to compute on every frame, 2 to compute every two frames and so on...\r\n */\r\n public get refreshRate(): number {\r\n return this._sourceTexture ? this._sourceTexture.refreshRate : -1;\r\n }\r\n\r\n public set refreshRate(value: number) {\r\n if (this._sourceTexture) {\r\n this._sourceTexture.refreshRate = value;\r\n }\r\n }\r\n\r\n protected _activated = false;\r\n\r\n /**\r\n * Gets the activation status of the reducer\r\n */\r\n public get activated(): boolean {\r\n return this._activated;\r\n }\r\n\r\n /**\r\n * Activates the reduction computation.\r\n * When activated, the observers registered in onAfterReductionPerformed are\r\n * called after the computation is performed\r\n */\r\n public activate(): void {\r\n if (this._onAfterUnbindObserver || !this._sourceTexture) {\r\n return;\r\n }\r\n\r\n this._onAfterUnbindObserver = this._sourceTexture.onAfterUnbindObservable.add(() => {\r\n const engine = this._camera.getScene().getEngine();\r\n engine._debugPushGroup?.(`min max reduction`, 1);\r\n this._reductionSteps![0].activate(this._camera);\r\n this._postProcessManager.directRender(this._reductionSteps!, this._reductionSteps![0].inputTexture, this._forceFullscreenViewport);\r\n engine.unBindFramebuffer(this._reductionSteps![0].inputTexture, false);\r\n engine._debugPopGroup?.(1);\r\n });\r\n\r\n this._activated = true;\r\n }\r\n\r\n /**\r\n * Deactivates the reduction computation.\r\n */\r\n public deactivate(): void {\r\n if (!this._onAfterUnbindObserver || !this._sourceTexture) {\r\n return;\r\n }\r\n\r\n this._sourceTexture.onAfterUnbindObservable.remove(this._onAfterUnbindObserver);\r\n this._onAfterUnbindObserver = null;\r\n this._activated = false;\r\n }\r\n\r\n /**\r\n * Disposes the min/max reducer\r\n * @param disposeAll true to dispose all the resources. You should always call this function with true as the parameter (or without any parameter as it is the default one). This flag is meant to be used internally.\r\n */\r\n public dispose(disposeAll = true): void {\r\n if (disposeAll) {\r\n this.onAfterReductionPerformed.clear();\r\n\r\n if (this._onContextRestoredObserver) {\r\n this._camera.getEngine().onContextRestoredObservable.remove(this._onContextRestoredObserver);\r\n this._onContextRestoredObserver = null;\r\n }\r\n }\r\n\r\n this.deactivate();\r\n\r\n if (this._reductionSteps) {\r\n for (let i = 0; i < this._reductionSteps.length; ++i) {\r\n this._reductionSteps[i].dispose();\r\n }\r\n this._reductionSteps = null;\r\n }\r\n\r\n if (this._postProcessManager && disposeAll) {\r\n this._postProcessManager.dispose();\r\n }\r\n\r\n this._sourceTexture = null;\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U,EAAE,CAAC;YACzC,IAAI,CAAC,mBAAmB,CAAC,OAAO,EAAE,CAAC;QACvC,CAAC;QAED,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;IAC/B,CAAC;CACJ","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport type { RenderTargetTexture } from \"../Materials/Textures/renderTargetTexture\";\r\nimport type { Camera } from \"../Cameras/camera\";\r\nimport { Constants } from \"../Engines/constants\";\r\nimport type { Observer } from \"./observable\";\r\nimport { Observable } from \"./observable\";\r\nimport type { Effect } from \"../Materials/effect\";\r\nimport { PostProcess } from \"../PostProcesses/postProcess\";\r\nimport { PostProcessManager } from \"../PostProcesses/postProcessManager\";\r\nimport { ShaderLanguage } from \"core/Materials/shaderLanguage\";\r\n\r\nimport type { AbstractEngine } from \"../Engines/abstractEngine\";\r\n\r\nimport \"../Shaders/minmaxRedux.fragment\";\r\nimport \"../ShadersWGSL/minmaxRedux.fragment\";\r\n\r\n/**\r\n * This class computes a min/max reduction from a texture: it means it computes the minimum\r\n * and maximum values from all values of the texture.\r\n * It is performed on the GPU for better performances, thanks to a succession of post processes.\r\n * The source values are read from the red channel of the texture.\r\n */\r\nexport class MinMaxReducer {\r\n /**\r\n * Observable triggered when the computation has been performed\r\n */\r\n public onAfterReductionPerformed = new Observable<{ min: number; max: number }>();\r\n\r\n protected _camera: Camera;\r\n protected _sourceTexture: Nullable<RenderTargetTexture>;\r\n protected _reductionSteps: Nullable<Array<PostProcess>>;\r\n protected _postProcessManager: PostProcessManager;\r\n protected _onAfterUnbindObserver: Nullable<Observer<RenderTargetTexture>>;\r\n protected _forceFullscreenViewport = true;\r\n protected _onContextRestoredObserver: Nullable<Observer<AbstractEngine>>;\r\n\r\n /**\r\n * Creates a min/max reducer\r\n * @param camera The camera to use for the post processes\r\n */\r\n constructor(camera: Camera) {\r\n this._camera = camera;\r\n this._postProcessManager = new PostProcessManager(camera.getScene());\r\n\r\n this._onContextRestoredObserver = camera.getEngine().onContextRestoredObservable.add(() => {\r\n this._postProcessManager._rebuild();\r\n });\r\n }\r\n\r\n /**\r\n * Gets the texture used to read the values from.\r\n */\r\n public get sourceTexture(): Nullable<RenderTargetTexture> {\r\n return this._sourceTexture;\r\n }\r\n\r\n /**\r\n * Sets the source texture to read the values from.\r\n * One must indicate if the texture is a depth texture or not through the depthRedux parameter\r\n * because in such textures '1' value must not be taken into account to compute the maximum\r\n * as this value is used to clear the texture.\r\n * Note that the computation is not activated by calling this function, you must call activate() for that!\r\n * @param sourceTexture The texture to read the values from. The values should be in the red channel.\r\n * @param depthRedux Indicates if the texture is a depth texture or not\r\n * @param type The type of the textures created for the reduction (defaults to TEXTURETYPE_HALF_FLOAT)\r\n * @param forceFullscreenViewport Forces the post processes used for the reduction to be applied without taking into account viewport (defaults to true)\r\n */\r\n public setSourceTexture(sourceTexture: RenderTargetTexture, depthRedux: boolean, type: number = Constants.TEXTURETYPE_HALF_FLOAT, forceFullscreenViewport = true): void {\r\n if (sourceTexture === this._sourceTexture) {\r\n return;\r\n }\r\n\r\n this.dispose(false);\r\n\r\n this._sourceTexture = sourceTexture;\r\n this._reductionSteps = [];\r\n this._forceFullscreenViewport = forceFullscreenViewport;\r\n\r\n const scene = this._camera.getScene();\r\n\r\n // create the first step\r\n const reductionInitial = new PostProcess(\r\n \"Initial reduction phase\",\r\n \"minmaxRedux\", // shader\r\n [\"texSize\"],\r\n [\"sourceTexture\"], // textures\r\n 1.0, // options\r\n null, // camera\r\n Constants.TEXTURE_NEAREST_NEAREST, // sampling\r\n scene.getEngine(), // engine\r\n false, // reusable\r\n \"#define INITIAL\" + (depthRedux ? \"\\n#define DEPTH_REDUX\" : \"\"), // defines\r\n type,\r\n undefined,\r\n undefined,\r\n undefined,\r\n Constants.TEXTUREFORMAT_RG,\r\n scene.getEngine().isWebGPU ? ShaderLanguage.WGSL : ShaderLanguage.GLSL\r\n );\r\n\r\n reductionInitial.autoClear = false;\r\n reductionInitial.forceFullscreenViewport = forceFullscreenViewport;\r\n\r\n let w = this._sourceTexture.getRenderWidth(),\r\n h = this._sourceTexture.getRenderHeight();\r\n\r\n reductionInitial.onApply = ((w: number, h: number) => {\r\n return (effect: Effect) => {\r\n effect.setTexture(\"sourceTexture\", this._sourceTexture);\r\n effect.setFloat2(\"texSize\", w, h);\r\n };\r\n })(w, h);\r\n\r\n this._reductionSteps.push(reductionInitial);\r\n\r\n let index = 1;\r\n\r\n // create the additional steps\r\n while (w > 1 || h > 1) {\r\n w = Math.max(Math.round(w / 2), 1);\r\n h = Math.max(Math.round(h / 2), 1);\r\n\r\n const reduction = new PostProcess(\r\n \"Reduction phase \" + index,\r\n \"minmaxRedux\", // shader\r\n [\"texSize\"],\r\n null,\r\n { width: w, height: h }, // options\r\n null, // camera\r\n Constants.TEXTURE_NEAREST_NEAREST, // sampling\r\n scene.getEngine(), // engine\r\n false, // reusable\r\n \"#define \" + (w == 1 && h == 1 ? \"LAST\" : w == 1 || h == 1 ? \"ONEBEFORELAST\" : \"MAIN\"), // defines\r\n type,\r\n undefined,\r\n undefined,\r\n undefined,\r\n Constants.TEXTUREFORMAT_RG,\r\n scene.getEngine().isWebGPU ? ShaderLanguage.WGSL : ShaderLanguage.GLSL\r\n );\r\n\r\n reduction.autoClear = false;\r\n reduction.forceFullscreenViewport = forceFullscreenViewport;\r\n\r\n reduction.onApply = ((w: number, h: number) => {\r\n return (effect: Effect) => {\r\n if (w == 1 || h == 1) {\r\n effect.setInt2(\"texSize\", w, h);\r\n } else {\r\n effect.setFloat2(\"texSize\", w, h);\r\n }\r\n };\r\n })(w, h);\r\n\r\n this._reductionSteps.push(reduction);\r\n\r\n index++;\r\n\r\n if (w == 1 && h == 1) {\r\n const func = (w: number, h: number, reduction: PostProcess) => {\r\n const buffer = new Float32Array(4 * w * h),\r\n minmax = { min: 0, max: 0 };\r\n return () => {\r\n scene.getEngine()._readTexturePixels(reduction.inputTexture.texture!, w, h, -1, 0, buffer, false);\r\n minmax.min = buffer[0];\r\n minmax.max = buffer[1];\r\n this.onAfterReductionPerformed.notifyObservers(minmax);\r\n };\r\n };\r\n reduction.onAfterRenderObservable.add(func(w, h, reduction));\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Defines the refresh rate of the computation.\r\n * Use 0 to compute just once, 1 to compute on every frame, 2 to compute every two frames and so on...\r\n */\r\n public get refreshRate(): number {\r\n return this._sourceTexture ? this._sourceTexture.refreshRate : -1;\r\n }\r\n\r\n public set refreshRate(value: number) {\r\n if (this._sourceTexture) {\r\n this._sourceTexture.refreshRate = value;\r\n }\r\n }\r\n\r\n protected _activated = false;\r\n\r\n /**\r\n * Gets the activation status of the reducer\r\n */\r\n public get activated(): boolean {\r\n return this._activated;\r\n }\r\n\r\n /**\r\n * Activates the reduction computation.\r\n * When activated, the observers registered in onAfterReductionPerformed are\r\n * called after the computation is performed\r\n */\r\n public activate(): void {\r\n if (this._onAfterUnbindObserver || !this._sourceTexture) {\r\n return;\r\n }\r\n\r\n this._onAfterUnbindObserver = this._sourceTexture.onAfterUnbindObservable.add(() => {\r\n const engine = this._camera.getScene().getEngine();\r\n engine._debugPushGroup?.(`min max reduction`, 1);\r\n this._reductionSteps![0].activate(this._camera);\r\n this._postProcessManager.directRender(this._reductionSteps!, this._reductionSteps![0].inputTexture, this._forceFullscreenViewport);\r\n engine.unBindFramebuffer(this._reductionSteps![0].inputTexture, false);\r\n engine._debugPopGroup?.(1);\r\n });\r\n\r\n this._activated = true;\r\n }\r\n\r\n /**\r\n * Deactivates the reduction computation.\r\n */\r\n public deactivate(): void {\r\n if (!this._onAfterUnbindObserver || !this._sourceTexture) {\r\n return;\r\n }\r\n\r\n this._sourceTexture.onAfterUnbindObservable.remove(this._onAfterUnbindObserver);\r\n this._onAfterUnbindObserver = null;\r\n this._activated = false;\r\n }\r\n\r\n /**\r\n * Disposes the min/max reducer\r\n * @param disposeAll true to dispose all the resources. You should always call this function with true as the parameter (or without any parameter as it is the default one). This flag is meant to be used internally.\r\n */\r\n public dispose(disposeAll = true): void {\r\n if (disposeAll) {\r\n this.onAfterReductionPerformed.clear();\r\n\r\n if (this._onContextRestoredObserver) {\r\n this._camera.getEngine().onContextRestoredObservable.remove(this._onContextRestoredObserver);\r\n this._onContextRestoredObserver = null;\r\n }\r\n }\r\n\r\n this.deactivate();\r\n\r\n if (this._reductionSteps) {\r\n for (let i = 0; i < this._reductionSteps.length; ++i) {\r\n this._reductionSteps[i].dispose();\r\n }\r\n this._reductionSteps = null;\r\n }\r\n\r\n if (this._postProcessManager && disposeAll) {\r\n this._postProcessManager.dispose();\r\n }\r\n\r\n this._sourceTexture = null;\r\n }\r\n}\r\n"]}
@@ -226,7 +226,13 @@ export class Database {
226
226
  transaction.oncomplete = () => {
227
227
  let blobTextureURL;
228
228
  if (texture && typeof URL === "function") {
229
- blobTextureURL = URL.createObjectURL(texture.data);
229
+ // check if data is an array buffer and create a Blob if it is
230
+ let data = texture.data;
231
+ if (texture.data instanceof ArrayBuffer) {
232
+ const blob = new Blob([texture.data], { type: "image/png" });
233
+ data = blob;
234
+ }
235
+ blobTextureURL = URL.createObjectURL(data);
230
236
  image.onerror = () => {
231
237
  Logger.Error("Error loading image from blob URL: " + blobTextureURL + " switching back to web url: " + url);
232
238
  image.src = url;
@@ -454,7 +460,7 @@ export class Database {
454
460
  _loadFile(url, callback, notInDBCallback, progressCallBack) {
455
461
  if (this._isSupported && this._db) {
456
462
  let targetStore;
457
- if (url.indexOf(".babylon") !== -1) {
463
+ if (url.split("?")[0].endsWith(".babylon")) {
458
464
  targetStore = "scenes";
459
465
  }
460
466
  else {
@@ -463,16 +469,29 @@ export class Database {
463
469
  let file;
464
470
  const transaction = this._db.transaction([targetStore]);
465
471
  transaction.oncomplete = () => {
466
- if (file) {
472
+ function loadArrayBuffer(arrayBuffer) {
467
473
  if (progressCallBack) {
468
- const numberToLoad = file.data?.byteLength || 0;
474
+ const numberToLoad = arrayBuffer.byteLength || 0;
469
475
  progressCallBack({
470
476
  total: numberToLoad,
471
477
  loaded: numberToLoad,
472
478
  lengthComputable: true,
473
479
  });
474
480
  }
475
- callback(file.data);
481
+ callback(arrayBuffer);
482
+ }
483
+ if (file) {
484
+ // check if data is a Blob, and get the array Data from the blob if it is
485
+ if (file.data instanceof Blob) {
486
+ const reader = new FileReader();
487
+ reader.onload = (ev) => {
488
+ loadArrayBuffer(ev.target?.result);
489
+ };
490
+ reader.readAsArrayBuffer(file.data);
491
+ }
492
+ else {
493
+ loadArrayBuffer(file.data);
494
+ }
476
495
  }
477
496
  // file was not found in DB
478
497
  else {
@@ -499,7 +518,7 @@ export class Database {
499
518
  _saveFile(url, callback, progressCallback, useArrayBuffer, errorCallback) {
500
519
  if (this._isSupported) {
501
520
  let targetStore;
502
- if (url.indexOf(".babylon") !== -1) {
521
+ if (url.split("?")[0].endsWith(".babylon")) {
503
522
  targetStore = "scenes";
504
523
  }
505
524
  else {