@babylonjs/core 9.13.0 → 9.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (237) hide show
  1. package/Animations/animationGroup.d.ts +0 -1
  2. package/Animations/animationGroup.js +0 -1
  3. package/Animations/animationGroup.js.map +1 -1
  4. package/Animations/animationGroup.pure.js +2 -0
  5. package/Animations/animationGroup.pure.js.map +1 -1
  6. package/Animations/runtimeAnimation.js +11 -0
  7. package/Animations/runtimeAnimation.js.map +1 -1
  8. package/AudioV2/abstractAudio/abstractSound.d.ts +2 -1
  9. package/AudioV2/abstractAudio/abstractSound.js +3 -2
  10. package/AudioV2/abstractAudio/abstractSound.js.map +1 -1
  11. package/AudioV2/abstractAudio/abstractSoundInstance.d.ts +1 -1
  12. package/AudioV2/abstractAudio/abstractSoundInstance.js.map +1 -1
  13. package/AudioV2/abstractAudio/staticSound.d.ts +6 -0
  14. package/AudioV2/abstractAudio/staticSound.js +9 -1
  15. package/AudioV2/abstractAudio/staticSound.js.map +1 -1
  16. package/AudioV2/abstractAudio/streamingSound.d.ts +6 -0
  17. package/AudioV2/abstractAudio/streamingSound.js +9 -1
  18. package/AudioV2/abstractAudio/streamingSound.js.map +1 -1
  19. package/AudioV2/webAudio/webAudioStaticSound.d.ts +1 -1
  20. package/AudioV2/webAudio/webAudioStaticSound.js +6 -3
  21. package/AudioV2/webAudio/webAudioStaticSound.js.map +1 -1
  22. package/AudioV2/webAudio/webAudioStreamingSound.d.ts +1 -1
  23. package/AudioV2/webAudio/webAudioStreamingSound.js +7 -4
  24. package/AudioV2/webAudio/webAudioStreamingSound.js.map +1 -1
  25. package/Cameras/Inputs/BaseCameraPointersInput.d.ts +2 -1
  26. package/Cameras/Inputs/BaseCameraPointersInput.js +3 -2
  27. package/Cameras/Inputs/BaseCameraPointersInput.js.map +1 -1
  28. package/Cameras/Inputs/arcRotateCameraKeyboardMoveInput.d.ts +3 -0
  29. package/Cameras/Inputs/arcRotateCameraKeyboardMoveInput.js +37 -10
  30. package/Cameras/Inputs/arcRotateCameraKeyboardMoveInput.js.map +1 -1
  31. package/Cameras/Inputs/flyCameraKeyboardInput.js +19 -9
  32. package/Cameras/Inputs/flyCameraKeyboardInput.js.map +1 -1
  33. package/Cameras/Inputs/freeCameraKeyboardMoveInput.js +21 -18
  34. package/Cameras/Inputs/freeCameraKeyboardMoveInput.js.map +1 -1
  35. package/Cameras/Inputs/geospatialCameraKeyboardInput.d.ts +2 -0
  36. package/Cameras/Inputs/geospatialCameraKeyboardInput.js +31 -12
  37. package/Cameras/Inputs/geospatialCameraKeyboardInput.js.map +1 -1
  38. package/Cameras/Inputs/geospatialCameraPointersInput.d.ts +11 -1
  39. package/Cameras/Inputs/geospatialCameraPointersInput.js +18 -2
  40. package/Cameras/Inputs/geospatialCameraPointersInput.js.map +1 -1
  41. package/Cameras/VR/vrExperienceHelper.d.ts +0 -2
  42. package/Cameras/VR/vrExperienceHelper.js +0 -2
  43. package/Cameras/VR/vrExperienceHelper.js.map +1 -1
  44. package/Cameras/VR/vrExperienceHelper.pure.js +5 -0
  45. package/Cameras/VR/vrExperienceHelper.pure.js.map +1 -1
  46. package/Cameras/arcRotateCamera.pure.js +9 -3
  47. package/Cameras/arcRotateCamera.pure.js.map +1 -1
  48. package/Cameras/targetCamera.pure.js +18 -18
  49. package/Cameras/targetCamera.pure.js.map +1 -1
  50. package/Collisions/gpuPicker.js +23 -13
  51. package/Collisions/gpuPicker.js.map +1 -1
  52. package/Engines/Native/nativeInterfaces.d.ts +3 -2
  53. package/Engines/Native/nativeInterfaces.js.map +1 -1
  54. package/Engines/Native/nativeRenderTargetWrapper.d.ts +3 -0
  55. package/Engines/Native/nativeRenderTargetWrapper.js +24 -1
  56. package/Engines/Native/nativeRenderTargetWrapper.js.map +1 -1
  57. package/Engines/WebGPU/Extensions/engine.videoTexture.pure.js +16 -3
  58. package/Engines/WebGPU/Extensions/engine.videoTexture.pure.js.map +1 -1
  59. package/Engines/WebGPU/webgpuClearQuad.pure.js +7 -1
  60. package/Engines/WebGPU/webgpuClearQuad.pure.js.map +1 -1
  61. package/Engines/abstractEngine.pure.d.ts +8 -1
  62. package/Engines/abstractEngine.pure.js +4 -3
  63. package/Engines/abstractEngine.pure.js.map +1 -1
  64. package/Engines/engine.d.ts +113 -0
  65. package/Engines/thinNativeEngine.pure.d.ts +2 -0
  66. package/Engines/thinNativeEngine.pure.js +115 -9
  67. package/Engines/thinNativeEngine.pure.js.map +1 -1
  68. package/FlowGraph/flowGraph.js +9 -0
  69. package/FlowGraph/flowGraph.js.map +1 -1
  70. package/FlowGraph/flowGraphDataConnection.pure.d.ts +14 -0
  71. package/FlowGraph/flowGraphDataConnection.pure.js +38 -1
  72. package/FlowGraph/flowGraphDataConnection.pure.js.map +1 -1
  73. package/FlowGraph/serialization.d.ts +11 -0
  74. package/FlowGraph/serialization.js +11 -1
  75. package/FlowGraph/serialization.js.map +1 -1
  76. package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsAccumulationTask.d.ts +2 -2
  77. package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsAccumulationTask.js +43 -51
  78. package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsAccumulationTask.js.map +1 -1
  79. package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.d.ts +0 -1
  80. package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.js +0 -1
  81. package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.js.map +1 -1
  82. package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.pure.d.ts +0 -1
  83. package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.pure.js +66 -35
  84. package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.pure.js.map +1 -1
  85. package/Helpers/environmentHelper.js +2 -2
  86. package/Helpers/environmentHelper.js.map +1 -1
  87. package/Lights/Clustered/clusteredLightContainer.pure.d.ts +1 -1
  88. package/Lights/Clustered/clusteredLightContainer.pure.js +15 -2
  89. package/Lights/Clustered/clusteredLightContainer.pure.js.map +1 -1
  90. package/Lights/areaLight.pure.js +5 -0
  91. package/Lights/areaLight.pure.js.map +1 -1
  92. package/Lights/light.d.ts +4 -2
  93. package/Lights/light.js +10 -4
  94. package/Lights/light.js.map +1 -1
  95. package/Lights/rectAreaLight.pure.d.ts +17 -0
  96. package/Lights/rectAreaLight.pure.js +67 -0
  97. package/Lights/rectAreaLight.pure.js.map +1 -1
  98. package/Loading/Plugins/babylonFileLoader.pure.js +4 -4
  99. package/Loading/Plugins/babylonFileLoader.pure.js.map +1 -1
  100. package/Materials/Background/backgroundMaterial.pure.js +3 -1
  101. package/Materials/Background/backgroundMaterial.pure.js.map +1 -1
  102. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.pure.js +2 -2
  103. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.pure.js.map +1 -1
  104. package/Materials/Node/Blocks/PBR/refractionBlock.pure.js +2 -2
  105. package/Materials/Node/Blocks/PBR/refractionBlock.pure.js.map +1 -1
  106. package/Materials/Node/nodeMaterial.pure.js +3 -0
  107. package/Materials/Node/nodeMaterial.pure.js.map +1 -1
  108. package/Materials/Node/nodeMaterialBuildState.d.ts +3 -3
  109. package/Materials/PBR/openpbrMaterial.pure.js +3 -1
  110. package/Materials/PBR/openpbrMaterial.pure.js.map +1 -1
  111. package/Materials/PBR/pbrMaterial.pure.js +3 -0
  112. package/Materials/PBR/pbrMaterial.pure.js.map +1 -1
  113. package/Materials/PBR/pbrMetallicRoughnessMaterial.pure.js +3 -0
  114. package/Materials/PBR/pbrMetallicRoughnessMaterial.pure.js.map +1 -1
  115. package/Materials/PBR/pbrSpecularGlossinessMaterial.pure.js +3 -0
  116. package/Materials/PBR/pbrSpecularGlossinessMaterial.pure.js.map +1 -1
  117. package/Materials/Textures/HTML/htmlInCanvasPolyfill.d.ts +43 -0
  118. package/Materials/Textures/HTML/htmlInCanvasPolyfill.js +64 -0
  119. package/Materials/Textures/HTML/htmlInCanvasPolyfill.js.map +1 -0
  120. package/Materials/Textures/HTML/htmlInteractionManager.d.ts +69 -0
  121. package/Materials/Textures/HTML/htmlInteractionManager.js +130 -0
  122. package/Materials/Textures/HTML/htmlInteractionManager.js.map +1 -0
  123. package/Materials/Textures/HTML/htmlRaycastInteractionManager.d.ts +84 -0
  124. package/Materials/Textures/HTML/htmlRaycastInteractionManager.js +246 -0
  125. package/Materials/Textures/HTML/htmlRaycastInteractionManager.js.map +1 -0
  126. package/Materials/Textures/HTML/htmlTexture.d.ts +148 -0
  127. package/Materials/Textures/HTML/htmlTexture.js +455 -0
  128. package/Materials/Textures/HTML/htmlTexture.js.map +1 -0
  129. package/Materials/Textures/HTML/index.d.ts +4 -0
  130. package/Materials/Textures/HTML/index.js +5 -0
  131. package/Materials/Textures/HTML/index.js.map +1 -0
  132. package/Materials/Textures/HTML/pure.d.ts +5 -0
  133. package/Materials/Textures/HTML/pure.js +6 -0
  134. package/Materials/Textures/HTML/pure.js.map +1 -0
  135. package/Materials/Textures/cubeTexture.d.ts +0 -1
  136. package/Materials/Textures/cubeTexture.js +0 -1
  137. package/Materials/Textures/cubeTexture.js.map +1 -1
  138. package/Materials/Textures/cubeTexture.pure.js +2 -0
  139. package/Materials/Textures/cubeTexture.pure.js.map +1 -1
  140. package/Materials/Textures/dynamicTexture.d.ts +0 -1
  141. package/Materials/Textures/dynamicTexture.js +0 -1
  142. package/Materials/Textures/dynamicTexture.js.map +1 -1
  143. package/Materials/Textures/dynamicTexture.pure.js +2 -0
  144. package/Materials/Textures/dynamicTexture.pure.js.map +1 -1
  145. package/Materials/Textures/htmlElementTexture.d.ts +0 -2
  146. package/Materials/Textures/htmlElementTexture.js +0 -2
  147. package/Materials/Textures/htmlElementTexture.js.map +1 -1
  148. package/Materials/Textures/htmlElementTexture.pure.js +4 -0
  149. package/Materials/Textures/htmlElementTexture.pure.js.map +1 -1
  150. package/Materials/Textures/index.d.ts +1 -0
  151. package/Materials/Textures/index.js +1 -1
  152. package/Materials/Textures/index.js.map +1 -1
  153. package/Materials/Textures/multiRenderTarget.d.ts +0 -1
  154. package/Materials/Textures/multiRenderTarget.js +0 -1
  155. package/Materials/Textures/multiRenderTarget.js.map +1 -1
  156. package/Materials/Textures/multiRenderTarget.pure.js +2 -0
  157. package/Materials/Textures/multiRenderTarget.pure.js.map +1 -1
  158. package/Materials/Textures/pure.d.ts +1 -0
  159. package/Materials/Textures/pure.js +1 -0
  160. package/Materials/Textures/pure.js.map +1 -1
  161. package/Materials/Textures/videoTexture.pure.d.ts +3 -0
  162. package/Materials/Textures/videoTexture.pure.js +30 -0
  163. package/Materials/Textures/videoTexture.pure.js.map +1 -1
  164. package/Materials/standardMaterial.pure.js +3 -1
  165. package/Materials/standardMaterial.pure.js.map +1 -1
  166. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.d.ts +9 -0
  167. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js +12 -0
  168. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js.map +1 -1
  169. package/Meshes/GaussianSplatting/gaussianSplattingSortWorker.d.ts +1 -1
  170. package/Meshes/GaussianSplatting/gaussianSplattingSortWorker.js +20 -6
  171. package/Meshes/GaussianSplatting/gaussianSplattingSortWorker.js.map +1 -1
  172. package/Misc/decorators.functions.d.ts +7 -0
  173. package/Misc/decorators.functions.js +86 -35
  174. package/Misc/decorators.functions.js.map +1 -1
  175. package/Misc/snapshotRenderingHelper.d.ts +4 -1
  176. package/Misc/snapshotRenderingHelper.js.map +1 -1
  177. package/Misc/symbolMetadataPolyfill.d.ts +11 -0
  178. package/Misc/symbolMetadataPolyfill.js +22 -0
  179. package/Misc/symbolMetadataPolyfill.js.map +1 -0
  180. package/Misc/tools.pure.js +1 -1
  181. package/Misc/tools.pure.js.map +1 -1
  182. package/Particles/gpuParticleSystem.d.ts +0 -1
  183. package/Particles/gpuParticleSystem.js +0 -1
  184. package/Particles/gpuParticleSystem.js.map +1 -1
  185. package/Particles/thinParticleSystem.d.ts +0 -1
  186. package/Particles/thinParticleSystem.js +0 -1
  187. package/Particles/thinParticleSystem.js.map +1 -1
  188. package/Particles/thinParticleSystem.pure.js +2 -0
  189. package/Particles/thinParticleSystem.pure.js.map +1 -1
  190. package/Particles/webgl2ParticleSystem.pure.js +2 -0
  191. package/Particles/webgl2ParticleSystem.pure.js.map +1 -1
  192. package/PostProcesses/RenderPipeline/Pipelines/lensRenderingPipeline.d.ts +0 -1
  193. package/PostProcesses/RenderPipeline/Pipelines/lensRenderingPipeline.js +0 -1
  194. package/PostProcesses/RenderPipeline/Pipelines/lensRenderingPipeline.js.map +1 -1
  195. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.pure.js +7 -0
  196. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.pure.js.map +1 -1
  197. package/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.d.ts +0 -1
  198. package/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.js +0 -1
  199. package/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.js.map +1 -1
  200. package/PostProcesses/postProcess.pure.js +5 -0
  201. package/PostProcesses/postProcess.pure.js.map +1 -1
  202. package/PostProcesses/vrMultiviewToSingleviewPostProcess.d.ts +0 -1
  203. package/PostProcesses/vrMultiviewToSingleviewPostProcess.js +0 -1
  204. package/PostProcesses/vrMultiviewToSingleviewPostProcess.js.map +1 -1
  205. package/PostProcesses/vrMultiviewToSingleviewPostProcess.pure.js +2 -0
  206. package/PostProcesses/vrMultiviewToSingleviewPostProcess.pure.js.map +1 -1
  207. package/Rendering/IBLShadows/iblShadowsRenderPipeline.d.ts +0 -2
  208. package/Rendering/IBLShadows/iblShadowsRenderPipeline.js +0 -2
  209. package/Rendering/IBLShadows/iblShadowsRenderPipeline.js.map +1 -1
  210. package/Rendering/IBLShadows/iblShadowsRenderPipeline.pure.js +5 -0
  211. package/Rendering/IBLShadows/iblShadowsRenderPipeline.pure.js.map +1 -1
  212. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.d.ts +0 -1
  213. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js +0 -1
  214. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js.map +1 -1
  215. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.pure.d.ts +1 -0
  216. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.pure.js +34 -0
  217. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.pure.js.map +1 -1
  218. package/Rendering/prePassRenderer.d.ts +0 -2
  219. package/Rendering/prePassRenderer.js +0 -2
  220. package/Rendering/prePassRenderer.js.map +1 -1
  221. package/Rendering/prePassRenderer.pure.js +2 -0
  222. package/Rendering/prePassRenderer.pure.js.map +1 -1
  223. package/Rendering/thinDepthPeelingRenderer.d.ts +0 -1
  224. package/Rendering/thinDepthPeelingRenderer.js +0 -1
  225. package/Rendering/thinDepthPeelingRenderer.js.map +1 -1
  226. package/Shaders/ShadersInclude/openpbrEnvironmentLighting.js +35 -5
  227. package/Shaders/ShadersInclude/openpbrEnvironmentLighting.js.map +1 -1
  228. package/ShadersWGSL/ShadersInclude/helperFunctions.js +2 -2
  229. package/ShadersWGSL/ShadersInclude/helperFunctions.js.map +1 -1
  230. package/ShadersWGSL/ShadersInclude/openpbrEnvironmentLighting.js +39 -7
  231. package/ShadersWGSL/ShadersInclude/openpbrEnvironmentLighting.js.map +1 -1
  232. package/ShadersWGSL/ShadersInclude/openpbrIblFunctions.js +4 -3
  233. package/ShadersWGSL/ShadersInclude/openpbrIblFunctions.js.map +1 -1
  234. package/index.d.ts +1 -0
  235. package/index.js +1 -0
  236. package/index.js.map +1 -1
  237. package/package.json +3 -11
@@ -0,0 +1 @@
1
+ {"version":3,"file":"htmlTexture.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Materials/Textures/HTML/htmlTexture.ts"],"names":[],"mappings":"AAAA,8HAA8H;AAG9H,OAAO,EAAE,WAAW,EAAE,MAAM,qBAA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,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;YAC7B,CAAC;YACD,gGAAgG;YAChG,uDAAuD;YACvD,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;gBACvB,MAAM,SAAS,GAAG,IAAI,CAAC,oBAAoB,IAAI,IAAI,CAAC,oBAAoB,CAAC,UAAU,KAAK,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC,CAAC,IAAI,CAAC;gBAChJ,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;YAC/D,CAAC;iBAAM,CAAC;gBACJ,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;YAC1B,CAAC;YACD,oFAAoF;YACpF,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;gBACjB,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACvB,CAAC;QACL,CAAC;QAED,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAC;QAC9B,KAAK,CAAC,OAAO,EAAE,CAAC;IACpB,CAAC;;AAnSuB,2BAAe,GAAyH;IAC5J,eAAe,EAAE,KAAK;IACtB,YAAY,EAAE,SAAS,CAAC,6BAA6B;IACrD,MAAM,EAAE,SAAS,CAAC,kBAAkB;IACpC,UAAU,EAAE,IAAI;IAChB,cAAc,EAAE,IAAI;CACvB,AANsC,CAMrC","sourcesContent":["/** This module has no top-level side effects: the engine extension it depends on is registered lazily from the constructor */\n\nimport { type Nullable } from \"../../../types\";\nimport { BaseTexture } from \"../baseTexture.pure\";\nimport { Constants } from \"../../../Engines/constants\";\nimport { Matrix } from \"../../../Maths/math.vector.pure\";\nimport { Observable } from \"../../../Misc/observable.pure\";\nimport { Logger } from \"../../../Misc/logger\";\nimport { IsWindowObjectExist } from \"../../../Misc/domManagement\";\nimport { RegisterEnginesExtensionsEngineDynamicTexture } from \"../../../Engines/Extensions/engine.dynamicTexture.pure\";\n\nimport { type AbstractEngine } from \"../../../Engines/abstractEngine.pure\";\nimport { type ThinEngine } from \"../../../Engines/thinEngine.pure\";\nimport { type WebGPUEngine } from \"../../../Engines/webgpuEngine.pure\";\nimport { type WebGPUHardwareTexture } from \"../../../Engines/WebGPU/webgpuHardwareTexture\";\nimport { type InternalTexture } from \"../internalTexture\";\nimport { type Scene } from \"../../../scene.pure\";\n\nlet _HasWarnedAboutMissingApi = false;\n\nfunction _WarnMissingApi(apiName: string): void {\n if (_HasWarnedAboutMissingApi) {\n return;\n }\n _HasWarnedAboutMissingApi = true;\n Logger.Warn(\n `HTML-in-Canvas: ${apiName} is not available. Enable chrome://flags/#canvas-draw-element, the built-in SVG fallback, or the three-html-render polyfill to use HtmlTexture.`\n );\n}\n\nlet _HasWarnedAboutSvgFallback = false;\n\nfunction _WarnSvgFallback(): void {\n if (_HasWarnedAboutSvgFallback) {\n return;\n }\n _HasWarnedAboutSvgFallback = true;\n Logger.Warn(\"HTML-in-Canvas: the SVG fallback could not rasterize the element. This usually means it references cross-origin or external resources, which taint the snapshot.\");\n}\n\nlet _HasWarnedAboutUploadFailure = false;\n\nfunction _WarnUploadFailure(error: unknown): void {\n if (_HasWarnedAboutUploadFailure) {\n return;\n }\n _HasWarnedAboutUploadFailure = true;\n const message = error instanceof Error ? error.message : String(error);\n Logger.Warn(\n `HTML-in-Canvas: the native upload failed (${message}). The element must be a direct child of the engine's rendering canvas, which must carry the \\`layoutsubtree\\` attribute, and the upload must run during a paint event.`\n );\n}\n\n/**\n * Detects whether the engine can upload an HTML element through the native (or polyfilled) WICG\n * HTML-in-Canvas API, without emitting any warning. Used to decide whether the SVG fallback is needed.\n * @param engine defines the engine to test\n * @returns true when the WICG upload API is available for this engine\n */\nexport function IsHtmlInCanvasUploadSupported(engine: AbstractEngine): boolean {\n if (engine.isWebGPU) {\n const queue = (engine as WebGPUEngine)._device?.queue;\n return !!queue && typeof queue.copyElementImageToTexture === \"function\";\n }\n\n const gl = (engine as ThinEngine)._gl as Nullable<WebGL2RenderingContext>;\n return !!gl && typeof gl.texElementImage2D === \"function\";\n}\n\n/**\n * Uploads a live HTML element (or a captured ElementImage) into an existing 2D texture using the WICG\n * HTML-in-Canvas API (https://github.com/WICG/html-in-canvas).\n *\n * This is a side-effect-free helper - it is only reachable when {@link HtmlTexture} (or a direct caller)\n * is imported, so it adds nothing to bundles that do not use it. It relies on\n * `WebGLRenderingContext.texElementImage2D` (WebGL) or `GPUQueue.copyElementImageToTexture` (WebGPU),\n * available either natively (behind chrome://flags/#canvas-draw-element) or through the\n * three-html-render polyfill.\n * @param engine defines the engine that owns the texture\n * @param texture defines the internal texture to update\n * @param element defines the source HTML element (or captured ElementImage) to upload\n * @param invertY defines if data must be stored with Y axis inverted (true by default)\n * @param config defines an optional source rectangle and sizing configuration\n * @returns true if the upload succeeded, false otherwise (e.g. the API is unavailable)\n */\nexport function UploadHtmlElementToTexture(\n engine: AbstractEngine,\n texture: Nullable<InternalTexture>,\n element: Element | ElementImage,\n invertY: boolean = true,\n config?: WebGLCopyElementImageConfig\n): boolean {\n if (!texture || texture._isDisabled) {\n return false;\n }\n\n if (engine.isWebGPU) {\n return _UploadHtmlElementToWebGPUTexture(engine as WebGPUEngine, texture, element, invertY, config);\n }\n\n return _UploadHtmlElementToWebGLTexture(engine as ThinEngine, texture, element, invertY, config);\n}\n\n// The texElementImage2D signature was changed mid-flight in the WICG proposal (see\n// https://github.com/WICG/html-in-canvas#idl-changes): the current spec form is\n// texElementImage2D(target, internalformat, element, config?), but older Chrome Canary builds (and the\n// three-html-render polyfill) still ship the legacy texImage2D-shaped overload\n// texElementImage2D(target, level, internalformat, format, type, element). We prefer the new form and\n// fall back to the legacy one when the implementation rejects it for the wrong number of arguments. The\n// detected shape is cached so we only pay the failed call once.\nlet _UseLegacyTexElementImage2D = false;\n\nfunction _CallTexElementImage2D(gl: WebGL2RenderingContext, internalFormat: number, element: Element | ElementImage, config?: WebGLCopyElementImageConfig): void {\n if (!_UseLegacyTexElementImage2D) {\n try {\n gl.texElementImage2D(gl.TEXTURE_2D, internalFormat, element, config);\n return;\n } catch (error) {\n // Only a wrong-arity TypeError means we are talking to the legacy signature; anything else\n // (e.g. the element is not a canvas child) is a genuine upload failure and must propagate.\n // Native rejects the new form with \"N arguments required, but only M present\"; the\n // three-html-render polyfill rejects it with \"unexpected argument count N\".\n if (!(error instanceof TypeError) || !/arguments required|argument count/.test((error as Error).message)) {\n throw error;\n }\n _UseLegacyTexElementImage2D = true;\n }\n }\n\n // Legacy overload: texElementImage2D(target, level, internalformat, format, type, element).\n gl.texElementImage2D(gl.TEXTURE_2D, 0, internalFormat, gl.RGBA, gl.UNSIGNED_BYTE, element);\n}\n\nfunction _UploadHtmlElementToWebGLTexture(\n engine: ThinEngine,\n texture: InternalTexture,\n element: Element | ElementImage,\n invertY: boolean,\n config?: WebGLCopyElementImageConfig\n): boolean {\n // texElementImage2D is provided either natively (behind a flag) or by the three-html-render polyfill.\n // Engines without a WebGL context (e.g. NullEngine) have no _gl and are handled by this guard.\n const gl = engine._gl as Nullable<WebGL2RenderingContext>;\n if (!gl || typeof gl.texElementImage2D !== \"function\") {\n _WarnMissingApi(\"texElementImage2D\");\n return false;\n }\n\n // texElementImage2D requires a *sized* internal format (RGBA8, SRGB8_ALPHA8, RGBA16F or RGBA32F);\n // the unsized gl.RGBA returned by _getInternalFormat is rejected.\n const internalFormat = engine._getRGBABufferInternalSizedFormat(texture.type, texture.format, texture._useSRGBBuffer);\n const wasPreviouslyBound = engine._bindTextureDirectly(gl.TEXTURE_2D, texture, true);\n engine._unpackFlipY(invertY);\n\n try {\n _CallTexElementImage2D(gl, internalFormat, element, config);\n\n if (texture.generateMipMaps) {\n gl.generateMipmap(gl.TEXTURE_2D);\n }\n\n if (!wasPreviouslyBound) {\n engine._bindTextureDirectly(gl.TEXTURE_2D, null);\n }\n\n texture.invertY = invertY;\n texture.isReady = true;\n return true;\n } catch (error) {\n // Reaching here means the snapshot upload failed - usually a real misconfiguration (the element is\n // not a child of the rendering canvas, or `layoutsubtree` is missing), though a stray call before\n // the first paint snapshot can also throw. Either way we must NOT disable the texture, so a later\n // paint-driven update can still succeed; we surface a one-time diagnostic to help debugging.\n _WarnUploadFailure(error);\n return false;\n }\n}\n\nfunction _UploadHtmlElementToWebGPUTexture(\n engine: WebGPUEngine,\n texture: InternalTexture,\n element: Element | ElementImage,\n invertY: boolean,\n config?: WebGLCopyElementImageConfig\n): boolean {\n // copyElementImageToTexture is provided either natively (behind a flag) or by the three-html-render polyfill.\n const device = engine._device;\n const queue = device && device.queue;\n if (!device || !queue || typeof queue.copyElementImageToTexture !== \"function\") {\n _WarnMissingApi(\"GPUQueue.copyElementImageToTexture\");\n return false;\n }\n\n const gpuTexture = (texture._hardwareTexture as Nullable<WebGPUHardwareTexture>)?.underlyingResource;\n if (!gpuTexture) {\n return false;\n }\n\n try {\n const source: GPUCopyElementImageSource = { source: element };\n if (config) {\n source.sx = config.sx;\n source.sy = config.sy;\n source.swidth = config.swidth;\n source.sheight = config.sheight;\n }\n\n queue.copyElementImageToTexture(source, {\n destination: { texture: gpuTexture },\n width: config?.width ?? texture.width,\n height: config?.height ?? texture.height,\n });\n\n if (texture.generateMipMaps) {\n engine._generateMipmaps(texture);\n }\n\n // The WICG copyElementImageToTexture API has no flipY option; the destination orientation is\n // determined by the source. We record the requested value for downstream sampling conventions.\n texture.invertY = invertY;\n texture.isReady = true;\n return true;\n } catch (error) {\n // Reaching here means the snapshot upload failed - usually a real misconfiguration (the element is\n // not a child of the rendering canvas, or `layoutsubtree` is missing), though a stray call before\n // the first paint snapshot can also throw. Either way we must NOT disable the texture, so a later\n // paint-driven update can still succeed; we surface a one-time diagnostic to help debugging.\n _WarnUploadFailure(error);\n return false;\n }\n}\n\n/**\n * Defines the options used to create an {@link HtmlTexture}.\n */\nexport interface IHtmlTextureOptions {\n /** Defines the width of the texture in pixels (defaults to the element's offset width, then 256). */\n width?: number;\n /** Defines the height of the texture in pixels (defaults to the element's offset height, then 256). */\n height?: number;\n /** Defines whether mip maps should be created or not (default: false). */\n generateMipMaps?: boolean;\n /** Defines the sampling mode of the texture (default: TEXTURE_BILINEAR_SAMPLINGMODE). */\n samplingMode?: number;\n /** Defines the associated texture format (default: TEXTUREFORMAT_RGBA). */\n format?: number;\n /** Defines whether the texture is automatically updated when the host canvas emits a paint event (default: true). */\n autoUpdate?: boolean;\n /**\n * Defines whether to fall back to an SVG `<foreignObject>` rasterization when the native WICG\n * HTML-in-Canvas API is unavailable (default: true). The fallback works in any browser but only\n * captures same-origin, inline-styled content as a static snapshot (see the documentation for caveats).\n */\n useSvgFallback?: boolean;\n /** Defines the engine instance to use the texture with. Not mandatory if a scene is provided. */\n engine?: Nullable<AbstractEngine>;\n /** Defines the scene the texture belongs to. Not mandatory if an engine is provided. */\n scene?: Nullable<Scene>;\n}\n\n/**\n * A texture whose content is rendered from a live HTML element using the WICG HTML-in-Canvas API\n * (https://github.com/WICG/html-in-canvas).\n *\n * The element is hosted as a child of the engine's rendering canvas (which is marked `layoutsubtree`) so\n * the browser can lay it out and snapshot it; the WICG API requires the source element to be a direct\n * child of the canvas whose context performs the upload. Content is uploaded through\n * `WebGLRenderingContext.texElementImage2D` (WebGL) or `GPUQueue.copyElementImageToTexture` (WebGPU),\n * available either natively (behind chrome://flags/#canvas-draw-element) or via the three-html-render\n * polyfill (https://github.com/repalash/three-html-render). When neither is present, a built-in SVG\n * `<foreignObject>` fallback is used instead (see `useSvgFallback`).\n *\n * As with {@link HtmlElementTexture}, updates are not automatic unless `autoUpdate` is enabled; in\n * that case the texture refreshes whenever the host canvas reports a paint change.\n */\nexport class HtmlTexture extends BaseTexture {\n /**\n * The HTML element rendered into the texture.\n */\n public readonly element: HTMLElement;\n\n /**\n * The element that hosts {@link element} in the document. This is the engine's rendering canvas when one\n * is available (required by the WICG API, which can only capture the element from that canvas), or a\n * hidden helper `<div>` otherwise - in which case only the SVG fallback can render.\n */\n public readonly host: Nullable<HTMLElement>;\n\n /**\n * Observable triggered once the texture has been rendered for the first time.\n */\n public onLoadObservable: Observable<HtmlTexture> = new Observable<HtmlTexture>();\n\n private static readonly _DefaultOptions: Required<Pick<IHtmlTextureOptions, \"generateMipMaps\" | \"samplingMode\" | \"format\" | \"autoUpdate\" | \"useSvgFallback\">> = {\n generateMipMaps: false,\n samplingMode: Constants.TEXTURE_BILINEAR_SAMPLINGMODE,\n format: Constants.TEXTUREFORMAT_RGBA,\n autoUpdate: true,\n useSvgFallback: true,\n };\n\n private readonly _format: number;\n private readonly _generateMipMaps: boolean;\n private readonly _samplingMode: number;\n private readonly _useSvgFallback: boolean;\n private readonly _textureMatrix: Matrix;\n private _paintHandler: Nullable<(event: PaintEvent) => void> = null;\n private _ownsHost: boolean = false;\n private _originalParent: Nullable<Node & ParentNode> = null;\n private _originalNextSibling: Nullable<ChildNode> = null;\n private _addedInert: boolean = false;\n private _width: number;\n private _height: number;\n\n /**\n * Instantiates an HtmlTexture from an HTML element.\n * @param name Defines the name of the texture\n * @param element Defines the HTML element to render into the texture\n * @param options Defines the texture creation options\n */\n constructor(name: string, element: HTMLElement, options: IHtmlTextureOptions) {\n super(options.scene || options.engine);\n\n this.element = element;\n this._textureMatrix = Matrix.Identity();\n\n if (!element || (!options.engine && !options.scene)) {\n this.host = null;\n this._width = 0;\n this._height = 0;\n this._format = HtmlTexture._DefaultOptions.format;\n this._generateMipMaps = HtmlTexture._DefaultOptions.generateMipMaps;\n this._samplingMode = HtmlTexture._DefaultOptions.samplingMode;\n this._useSvgFallback = HtmlTexture._DefaultOptions.useSvgFallback;\n return;\n }\n\n this._generateMipMaps = options.generateMipMaps ?? HtmlTexture._DefaultOptions.generateMipMaps;\n this._samplingMode = options.samplingMode ?? HtmlTexture._DefaultOptions.samplingMode;\n this._format = options.format ?? HtmlTexture._DefaultOptions.format;\n this._useSvgFallback = options.useSvgFallback ?? HtmlTexture._DefaultOptions.useSvgFallback;\n const autoUpdate = options.autoUpdate ?? HtmlTexture._DefaultOptions.autoUpdate;\n\n this._width = options.width || element.offsetWidth || 256;\n this._height = options.height || element.offsetHeight || 256;\n\n this.name = name;\n this.wrapU = Constants.TEXTURE_CLAMP_ADDRESSMODE;\n this.wrapV = Constants.TEXTURE_CLAMP_ADDRESSMODE;\n this.anisotropicFilteringLevel = 1;\n\n this.host = this._createHost();\n\n // The native WICG API has no content until the first paint snapshot is recorded, so the initial\n // upload must happen from a paint event. The rendering canvas emits `paint`; listen for at least the\n // first one and, when auto-update is disabled, detach after that first refresh. A non-canvas helper\n // host never emits `paint`, so this listener is simply never invoked there.\n if (this.host) {\n this._paintHandler = (event: PaintEvent) => {\n // A single `paint` event covers every changed child of the shared rendering canvas. When the\n // browser reports which elements changed, skip the upload unless ours is among them, so that\n // multiple HTML textures hosted on the same canvas don't all re-upload on every unrelated change.\n if (event.changedElements && !event.changedElements.some((changed) => this.element === changed || this.element.contains(changed))) {\n return;\n }\n this.update();\n if (!autoUpdate && this._paintHandler && this.host) {\n this.host.removeEventListener(\"paint\", this._paintHandler as EventListener);\n this._paintHandler = null;\n }\n };\n this.host.addEventListener(\"paint\", this._paintHandler as EventListener);\n }\n\n this._createInternalTexture();\n }\n\n private _createHost(): Nullable<HTMLElement> {\n if (!IsWindowObjectExist() || typeof document === \"undefined\") {\n return null;\n }\n\n // Remember where the caller had the element so dispose() can put it back: we are about to re-parent it\n // into the host (the element must be a direct child of the host to be captured and laid out).\n this._originalParent = this.element.parentNode;\n this._originalNextSibling = this.element.nextSibling;\n\n // Per the WICG spec, the source element must be a *direct child* of the same canvas whose WebGL/WebGPU\n // context performs the upload, and that canvas must opt its subtree into layout via `layoutsubtree`.\n // The engine already owns our texture through its rendering canvas, so the element has to live inside\n // that canvas: it is the only one whose context can snapshot the element via texElementImage2D /\n // copyElementImageToTexture. A separate canvas would lay the element out but could never be captured\n // into the engine's texture (this is why nothing rendered on the native path before).\n const renderingCanvas = this._getEngine()?.getRenderingCanvas() ?? null;\n if (renderingCanvas) {\n renderingCanvas.layoutSubtree = true;\n // `layoutsubtree` opts children into hit testing; mark ours inert so it never steals pointer events\n // from the canvas (e.g. camera controls). Synthetic event dispatch still reaches inert elements, so\n // HtmlRaycastInteractionManager keeps working; HtmlInteractionManager clears it to enable native input.\n this._addedInert = !this.element.hasAttribute(\"inert\");\n this.element.setAttribute(\"inert\", \"\");\n renderingCanvas.appendChild(this.element);\n this._ownsHost = false;\n return renderingCanvas;\n }\n\n // No rendering canvas (e.g. NullEngine / offscreen): the native upload paths cannot run, because they\n // capture from the engine's canvas and there is none. Only the SVG fallback renders here, and it builds\n // from the element's serialized markup rather than from a canvas - so a host *canvas* would buy nothing.\n // Host the element in a hidden, off-screen <div> purely so it is laid out in the document (giving\n // correct measured sizes); there is no canvas to capture into on this path.\n const host = document.createElement(\"div\");\n host.style.position = \"absolute\";\n host.style.left = \"-99999px\";\n host.style.top = \"0px\";\n host.style.pointerEvents = \"none\";\n host.setAttribute(\"aria-hidden\", \"true\");\n\n host.appendChild(this.element);\n document.body.appendChild(host);\n this._ownsHost = true;\n\n return host;\n }\n\n private _createInternalTexture(): void {\n const engine = this._getEngine();\n if (engine) {\n // createDynamicTexture is an engine extension; register it lazily (idempotent) so this module stays free of top-level side effects.\n RegisterEnginesExtensionsEngineDynamicTexture();\n this._texture = engine.createDynamicTexture(this._width, this._height, this._generateMipMaps, this._samplingMode);\n this._texture.format = this._format;\n }\n\n // Trigger the initial render. On the native path this requests a paint so the first upload happens\n // once a snapshot exists (calling the WICG API before the first snapshot throws); otherwise the\n // SVG fallback (or a direct update) renders immediately.\n this.requestUpdate();\n }\n\n /**\n * @returns the texture matrix used in most of the material.\n */\n public override getTextureMatrix(): Matrix {\n return this._textureMatrix;\n }\n\n /**\n * Requests the host canvas to emit a paint event on the next rendering update. When auto-update is\n * enabled, this triggers a texture refresh in sync with the DOM. Falls back to an immediate update\n * when the WICG API is not available.\n */\n public requestUpdate(): void {\n // `requestPaint` only exists on a WICG-capable rendering canvas; the helper <div> host has no such\n // method, so fall back to an immediate update there.\n const canvasHost = this.host as Nullable<HTMLCanvasElement>;\n if (canvasHost && typeof canvasHost.requestPaint === \"function\") {\n canvasHost.requestPaint();\n } else {\n this.update();\n }\n }\n\n /**\n * Updates the content of the texture from the current state of the HTML element.\n * @param invertY Defines whether the texture should be inverted on Y (true by default)\n */\n public update(invertY: boolean = true): void {\n const engine = this._getEngine();\n if (this._texture == null || engine == null) {\n return;\n }\n\n // When the native WICG upload API is unavailable, render through the SVG <foreignObject> fallback\n // (unless it was explicitly disabled, in which case the upload helper emits a one-time warning).\n if (this._useSvgFallback && !IsHtmlInCanvasUploadSupported(engine)) {\n this._updateFromSvgFallback(engine, invertY);\n return;\n }\n\n const wasReady = this.isReady();\n\n UploadHtmlElementToTexture(engine, this._texture, this.element, invertY);\n\n if (!wasReady && this.isReady()) {\n this.onLoadObservable.notifyObservers(this);\n }\n }\n\n /**\n * Renders the element through an SVG `<foreignObject>` snapshot and uploads it to the texture. This\n * fallback works in any browser but only captures same-origin, inline-styled content as a static image.\n * @param engine defines the engine that owns the texture\n * @param invertY defines whether the texture should be inverted on Y\n */\n private _updateFromSvgFallback(engine: AbstractEngine, invertY: boolean): void {\n if (typeof document === \"undefined\" || typeof Image === \"undefined\" || typeof XMLSerializer === \"undefined\") {\n return;\n }\n\n const svgUrl = this._buildSvgDataUrl();\n if (!svgUrl) {\n return;\n }\n\n const image = new Image();\n image.onload = () => {\n if (this._texture == null) {\n return;\n }\n const wasReady = this.isReady();\n try {\n engine.updateDynamicTexture(this._texture, image, invertY, false, this._format);\n } catch {\n _WarnSvgFallback();\n return;\n }\n if (!wasReady && this.isReady()) {\n this.onLoadObservable.notifyObservers(this);\n }\n };\n image.onerror = () => {\n _WarnSvgFallback();\n };\n image.src = svgUrl;\n }\n\n /**\n * Serializes the element into an SVG `<foreignObject>` data URL sized to the texture.\n * @returns a data URL, or null if serialization failed\n */\n private _buildSvgDataUrl(): Nullable<string> {\n try {\n const clone = this.element.cloneNode(true) as HTMLElement;\n clone.setAttribute(\"xmlns\", \"http://www.w3.org/1999/xhtml\");\n const serialized = new XMLSerializer().serializeToString(clone);\n const svg =\n `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"${this._width}\" height=\"${this._height}\">` +\n `<foreignObject x=\"0\" y=\"0\" width=\"100%\" height=\"100%\">${serialized}</foreignObject>` +\n `</svg>`;\n return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svg)}`;\n } catch {\n return null;\n }\n }\n\n /**\n * Gets the current class name of the texture useful for serialization or dynamic coding.\n * @returns \"HtmlTexture\"\n */\n public override getClassName(): string {\n return \"HtmlTexture\";\n }\n\n /**\n * Dispose the texture and release its associated resources.\n */\n public override dispose(): void {\n if (this.host) {\n if (this._paintHandler) {\n this.host.removeEventListener(\"paint\", this._paintHandler as EventListener);\n this._paintHandler = null;\n }\n // Remove the `inert` attribute we added so the caller gets the element back as they passed it.\n if (this._addedInert) {\n this.element.removeAttribute(\"inert\");\n this._addedInert = false;\n }\n // Restore the element to where the caller had it before we re-parented it into the host, rather\n // than silently deleting their node from the document.\n if (this._originalParent) {\n const reference = this._originalNextSibling && this._originalNextSibling.parentNode === this._originalParent ? this._originalNextSibling : null;\n this._originalParent.insertBefore(this.element, reference);\n } else {\n this.element.remove();\n }\n // Remove the helper host we created (never the engine's borrowed rendering canvas).\n if (this._ownsHost) {\n this.host.remove();\n }\n }\n\n this.onLoadObservable.clear();\n super.dispose();\n }\n}\n"]}
@@ -0,0 +1,4 @@
1
+ export * from "./htmlTexture.js";
2
+ export * from "./htmlInteractionManager.js";
3
+ export * from "./htmlRaycastInteractionManager.js";
4
+ export * from "./htmlInCanvasPolyfill.js";
@@ -0,0 +1,5 @@
1
+ export * from "./htmlTexture.js";
2
+ export * from "./htmlInteractionManager.js";
3
+ export * from "./htmlRaycastInteractionManager.js";
4
+ export * from "./htmlInCanvasPolyfill.js";
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Materials/Textures/HTML/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,0BAA0B,CAAC;AACzC,cAAc,iCAAiC,CAAC;AAChD,cAAc,wBAAwB,CAAC","sourcesContent":["export * from \"./htmlTexture\";\nexport * from \"./htmlInteractionManager\";\nexport * from \"./htmlRaycastInteractionManager\";\nexport * from \"./htmlInCanvasPolyfill\";\n"]}
@@ -0,0 +1,5 @@
1
+ /** Pure barrel — re-exports only side-effect-free modules */
2
+ export * from "./htmlTexture.js";
3
+ export * from "./htmlInteractionManager.js";
4
+ export * from "./htmlRaycastInteractionManager.js";
5
+ export * from "./htmlInCanvasPolyfill.js";
@@ -0,0 +1,6 @@
1
+ /** Pure barrel — re-exports only side-effect-free modules */
2
+ export * from "./htmlTexture.js";
3
+ export * from "./htmlInteractionManager.js";
4
+ export * from "./htmlRaycastInteractionManager.js";
5
+ export * from "./htmlInCanvasPolyfill.js";
6
+ //# sourceMappingURL=pure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pure.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Materials/Textures/HTML/pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,cAAc,eAAe,CAAC;AAC9B,cAAc,0BAA0B,CAAC;AACzC,cAAc,iCAAiC,CAAC;AAChD,cAAc,wBAAwB,CAAC","sourcesContent":["/** Pure barrel — re-exports only side-effect-free modules */\nexport * from \"./htmlTexture\";\nexport * from \"./htmlInteractionManager\";\nexport * from \"./htmlRaycastInteractionManager\";\nexport * from \"./htmlInCanvasPolyfill\";\n"]}
@@ -2,6 +2,5 @@
2
2
  * Re-exports pure implementation and applies runtime side effects.
3
3
  * Import cubeTexture.pure for tree-shakeable, side-effect-free usage.
4
4
  */
5
- import "../../Engines/AbstractEngine/abstractEngine.cubeTexture.js";
6
5
  export * from "./cubeTexture.pure.js";
7
6
  export * from "./cubeTexture.types.js";
@@ -2,7 +2,6 @@
2
2
  * Re-exports pure implementation and applies runtime side effects.
3
3
  * Import cubeTexture.pure for tree-shakeable, side-effect-free usage.
4
4
  */
5
- import "../../Engines/AbstractEngine/abstractEngine.cubeTexture.js";
6
5
  export * from "./cubeTexture.pure.js";
7
6
  export * from "./cubeTexture.types.js";
8
7
  import { RegisterCubeTexture } from "./cubeTexture.pure.js";
@@ -1 +1 @@
1
- {"version":3,"file":"cubeTexture.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/cubeTexture.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,yDAAyD,CAAC;AACjE,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AAEpC,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,mBAAmB,EAAE,CAAC","sourcesContent":["/**\n * Re-exports pure implementation and applies runtime side effects.\n * Import cubeTexture.pure for tree-shakeable, side-effect-free usage.\n */\nimport \"../../Engines/AbstractEngine/abstractEngine.cubeTexture\";\nexport * from \"./cubeTexture.pure\";\nexport * from \"./cubeTexture.types\";\n\nimport { RegisterCubeTexture } from \"./cubeTexture.pure\";\nRegisterCubeTexture();\n"]}
1
+ {"version":3,"file":"cubeTexture.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/cubeTexture.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AAEpC,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,mBAAmB,EAAE,CAAC","sourcesContent":["/**\n * Re-exports pure implementation and applies runtime side effects.\n * Import cubeTexture.pure for tree-shakeable, side-effect-free usage.\n */\nexport * from \"./cubeTexture.pure\";\nexport * from \"./cubeTexture.types\";\n\nimport { RegisterCubeTexture } from \"./cubeTexture.pure\";\nRegisterCubeTexture();\n"]}
@@ -9,6 +9,7 @@ import { Texture } from "../../Materials/Textures/texture.pure.js";
9
9
  import { GetClass, RegisterClass } from "../../Misc/typeStore.js";
10
10
  import { Observable } from "../../Misc/observable.pure.js";
11
11
  import { SerializationHelper } from "../../Misc/decorators.serialization.js";
12
+ import { RegisterAbstractEngineCubeTexture } from "../../Engines/AbstractEngine/abstractEngine.cubeTexture.pure.js";
12
13
  // The default scale applied to environment texture. This manages the range of LOD level used for IBL according to the roughness
13
14
  const DefaultLodScale = 0.8;
14
15
  /**
@@ -102,6 +103,7 @@ export class CubeTexture extends BaseTexture {
102
103
  this._extensions = null;
103
104
  this._textureMatrixRefraction = new Matrix();
104
105
  this._buffer = null;
106
+ RegisterAbstractEngineCubeTexture();
105
107
  this.name = rootUrl;
106
108
  this.url = rootUrl;
107
109
  this._noMipmap = noMipmap;
@@ -1 +1 @@
1
- {"version":3,"file":"cubeTexture.pure.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/cubeTexture.pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;;AAE7D,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AACzF,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAGrD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,uCAAuC,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE/D,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAoD1E,gIAAgI;AAChI,MAAM,eAAe,GAAG,GAAG,CAAC;AAE5B;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,WAAW;IA2BxC;;;;;OAKG;IACH,IAAW,eAAe,CAAC,KAAc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C;IAEnB,WAAW,CAAC,gBAAgB,GAAG,2BAA2B,CAAC;IAC3D,WAAW,CAAC,yBAAyB,GAAG,oCAAoC,CAAC;IAC7E,WAAW,CAAC,KAAK,GAAG,gBAAgB,CAAC;IAErC,OAAO,CAAC,kBAAkB,GAAG,gBAAgB,CAAC;IAE9C,6CAA6C;IAC7C,aAAa,CAAC,qBAAqB,EAAE,WAAW,CAAC,CAAC;AACtD,CAAC","sourcesContent":["/** This file must only contain pure code and pure imports */\n\nimport { serialize, serializeAsMatrix, serializeAsVector3 } from \"../../Misc/decorators\";\nimport { TimingTools } from \"../../Misc/timingTools\";\nimport { type Nullable } from \"../../types\";\nimport { type Scene } from \"../../scene.pure\";\nimport { Matrix, TmpVectors, Vector3 } from \"../../Maths/math.vector.pure\";\nimport { BaseTexture } from \"../../Materials/Textures/baseTexture.pure\";\nimport { Texture } from \"../../Materials/Textures/texture.pure\";\nimport { Constants } from \"../../Engines/constants\";\nimport { GetClass, RegisterClass } from \"../../Misc/typeStore\";\nimport { type AbstractEngine } from \"../../Engines/abstractEngine.pure\";\nimport { Observable } from \"../../Misc/observable.pure\";\nimport { SerializationHelper } from \"../../Misc/decorators.serialization\";\n\n/**\n * Defines the available options when creating a cube texture\n */\nexport interface ICubeTextureCreationOptions {\n /** Defines the suffixes add to the picture name in case six images are in use like _px.jpg */\n extensions?: string[];\n\n /** noMipmap defines if mipmaps should be created or not */\n noMipmap?: boolean;\n\n /** files defines the six files to load for the different faces in that order: px, py, pz, nx, ny, nz */\n files?: string[];\n\n /** buffer to load instead of loading the data from the url */\n buffer?: ArrayBufferView;\n\n /** onLoad defines a callback triggered at the end of the file load if no errors occurred */\n onLoad?: () => void;\n\n /** onError defines a callback triggered in case of error during load */\n onError?: (message?: string, exception?: any) => void;\n\n /** format defines the internal format to use for the texture once loaded */\n format?: number;\n\n /** prefiltered defines whether or not the texture is created from prefiltered data */\n prefiltered?: boolean;\n\n /** forcedExtension defines the extensions to use (force a special type of file to load) in case it is different from the file name */\n forcedExtension?: any;\n\n /** createPolynomials defines whether or not to create polynomial harmonics from the texture data if necessary */\n createPolynomials?: boolean;\n\n /** lodScale defines the scale applied to environment texture. This manages the range of LOD level used for IBL according to the roughness */\n lodScale?: number;\n\n /** lodOffset defines the offset applied to environment texture. This manages first LOD level used for IBL according to the roughness */\n lodOffset?: number;\n\n /** loaderOptions options to be passed to the loader */\n loaderOptions?: any;\n\n /** useSRGBBuffer Defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU) (default: false) */\n useSRGBBuffer?: boolean;\n\n /** Target face size for spherical polynomial computation. 0 = full resolution (default). */\n sphericalPolynomialTargetSize?: number;\n}\n\n// The default scale applied to environment texture. This manages the range of LOD level used for IBL according to the roughness\nconst DefaultLodScale = 0.8;\n\n/**\n * Class for creating a cube texture\n */\nexport class CubeTexture extends BaseTexture {\n private _delayedOnLoad: Nullable<() => void>;\n private _delayedOnError: Nullable<(message?: string, exception?: any) => void>;\n private _lodScale: number;\n private _lodOffset: number;\n\n /**\n * Observable triggered once the texture has been loaded.\n */\n public onLoadObservable: Observable<CubeTexture> = new Observable<CubeTexture>();\n\n /**\n * The url of the texture\n */\n @serialize()\n public url: string;\n\n /**\n * Gets or sets the center of the bounding box associated with the cube texture.\n * It must define where the camera used to render the texture was set\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/reflectionTexture#using-local-cubemap-mode\n */\n @serializeAsVector3()\n public boundingBoxPosition = Vector3.Zero();\n\n private _boundingBoxSize: Vector3;\n\n /**\n * Gets or sets the size of the bounding box associated with the cube texture\n * When defined, the cubemap will switch to local mode\n * @see https://community.arm.com/graphics/b/blog/posts/reflections-based-on-local-cubemaps-in-unity\n * @example https://www.babylonjs-playground.com/#RNASML\n */\n public set boundingBoxSize(value: Vector3) {\n if (this._boundingBoxSize && this._boundingBoxSize.equals(value)) {\n return;\n }\n this._boundingBoxSize = value;\n const scene = this.getScene();\n if (scene) {\n scene.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag);\n }\n }\n /**\n * Returns the bounding box size\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/reflectionTexture#using-local-cubemap-mode\n */\n @serializeAsVector3()\n public get boundingBoxSize(): Vector3 {\n return this._boundingBoxSize;\n }\n\n protected _rotationY: number = 0;\n\n /**\n * Sets texture matrix rotation angle around Y axis in radians.\n */\n @serialize(\"rotationY\")\n public set rotationY(value: number) {\n this._rotationY = value;\n this.setReflectionTextureMatrix(Matrix.RotationY(this._rotationY));\n }\n /**\n * Gets texture matrix rotation angle around Y axis radians.\n */\n public get rotationY(): number {\n return this._rotationY;\n }\n\n /**\n * Are mip maps generated for this texture or not.\n */\n public override get noMipmap(): boolean {\n return this._noMipmap;\n }\n\n private _noMipmap: boolean;\n\n /** @internal */\n @serialize(\"files\")\n public _files: Nullable<string[]> = null;\n\n @serialize(\"forcedExtension\")\n protected _forcedExtension: Nullable<string> = null;\n\n /**\n * Gets the forced extension (if any)\n */\n public get forcedExtension(): Nullable<string> {\n return this._forcedExtension;\n }\n\n @serialize(\"extensions\")\n private _extensions: Nullable<string[]> = null;\n\n @serializeAsMatrix(\"textureMatrix\")\n private _textureMatrix: Matrix;\n\n @serializeAsMatrix(\"textureMatrixRefraction\")\n private _textureMatrixRefraction: Matrix = new Matrix();\n\n private _format: number;\n private _createPolynomials: boolean;\n private _loaderOptions: any;\n private _useSRGBBuffer?: boolean;\n private _buffer: Nullable<ArrayBufferView> = null;\n\n /**\n * Creates a cube texture to use with reflection for instance. It can be based upon dds or six images as well\n * as prefiltered data.\n * @param rootUrl defines the url of the texture or the root name of the six images\n * @param sceneOrEngine defines the scene or engine the texture is attached to\n * @param extensionsOrOptions defines the suffixes add to the picture name in case six images are in use like _px.jpg or set of all options to create the cube texture\n * @param noMipmap defines if mipmaps should be created or not\n * @param files defines the six files to load for the different faces in that order: px, py, pz, nx, ny, nz\n * @param onLoad defines a callback triggered at the end of the file load if no errors occurred\n * @param onError defines a callback triggered in case of error during load\n * @param format defines the internal format to use for the texture once loaded\n * @param prefiltered defines whether or not the texture is created from prefiltered data\n * @param forcedExtension defines the extensions to use (force a special type of file to load) in case it is different from the file name\n * @param createPolynomials defines whether or not to create polynomial harmonics from the texture data if necessary\n * @param lodScale defines the scale applied to environment texture. This manages the range of LOD level used for IBL according to the roughness\n * @param lodOffset defines the offset applied to environment texture. This manages first LOD level used for IBL according to the roughness\n * @param loaderOptions options to be passed to the loader\n * @param useSRGBBuffer Defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU) (default: false)\n * @returns the cube texture\n */\n constructor(\n rootUrl: string,\n sceneOrEngine: Scene | AbstractEngine,\n extensionsOrOptions: Nullable<string[] | ICubeTextureCreationOptions> = null,\n noMipmap: boolean = false,\n files: Nullable<string[]> = null,\n onLoad: Nullable<() => void> = null,\n onError: Nullable<(message?: string, exception?: any) => void> = null,\n format: number = Constants.TEXTUREFORMAT_RGBA,\n prefiltered = false,\n forcedExtension: any = null,\n createPolynomials: boolean = false,\n lodScale: number = DefaultLodScale,\n lodOffset: number = 0,\n loaderOptions?: any,\n useSRGBBuffer?: boolean\n ) {\n super(sceneOrEngine);\n\n this.name = rootUrl;\n this.url = rootUrl;\n this._noMipmap = noMipmap;\n this.hasAlpha = false;\n this.isCube = true;\n this._textureMatrix = Matrix.Identity();\n this.coordinatesMode = Texture.CUBIC_MODE;\n\n let extensions: Nullable<string[]>;\n let buffer: Nullable<ArrayBufferView> = null;\n\n if (extensionsOrOptions !== null && !Array.isArray(extensionsOrOptions)) {\n extensions = extensionsOrOptions.extensions ?? null;\n this._noMipmap = extensionsOrOptions.noMipmap ?? false;\n files = extensionsOrOptions.files ?? null;\n buffer = extensionsOrOptions.buffer ?? null;\n this._format = extensionsOrOptions.format ?? Constants.TEXTUREFORMAT_RGBA;\n prefiltered = extensionsOrOptions.prefiltered ?? false;\n forcedExtension = extensionsOrOptions.forcedExtension ?? null;\n this._createPolynomials = extensionsOrOptions.createPolynomials ?? false;\n this._lodScale = extensionsOrOptions.lodScale ?? DefaultLodScale;\n this._lodOffset = extensionsOrOptions.lodOffset ?? 0;\n this._loaderOptions = extensionsOrOptions.loaderOptions;\n this._useSRGBBuffer = extensionsOrOptions.useSRGBBuffer;\n this._sphericalPolynomialTargetSize = extensionsOrOptions.sphericalPolynomialTargetSize ?? 0;\n onLoad = extensionsOrOptions.onLoad ?? null;\n onError = extensionsOrOptions.onError ?? null;\n } else {\n this._noMipmap = noMipmap;\n this._format = format;\n this._createPolynomials = createPolynomials;\n extensions = extensionsOrOptions;\n this._loaderOptions = loaderOptions;\n this._useSRGBBuffer = useSRGBBuffer;\n this._lodScale = lodScale;\n this._lodOffset = lodOffset;\n }\n\n if (!rootUrl && !files) {\n return;\n }\n\n this.updateURL(rootUrl, forcedExtension, onLoad, prefiltered, onError, extensions, this.getScene()?.useDelayedTextureLoading, files, buffer);\n }\n\n /**\n * Get the current class name of the texture useful for serialization or dynamic coding.\n * @returns \"CubeTexture\"\n */\n public override getClassName(): string {\n return \"CubeTexture\";\n }\n\n /**\n * Update the url (and optional buffer) of this texture if url was null during construction.\n * @param url the url of the texture\n * @param forcedExtension defines the extension to use\n * @param onLoad callback called when the texture is loaded (defaults to null)\n * @param prefiltered Defines whether the updated texture is prefiltered or not\n * @param onError callback called if there was an error during the loading process (defaults to null)\n * @param extensions defines the suffixes add to the picture name in case six images are in use like _px.jpg...\n * @param delayLoad defines if the texture should be loaded now (false by default)\n * @param files defines the six files to load for the different faces in that order: px, py, pz, nx, ny, nz\n * @param buffer the buffer to use instead of loading from the url\n */\n public updateURL(\n url: string,\n forcedExtension: Nullable<string> = null,\n onLoad: Nullable<() => void> = null,\n prefiltered: boolean = false,\n onError: Nullable<(message?: string, exception?: any) => void> = null,\n extensions: Nullable<string[]> = null,\n delayLoad = false,\n files: Nullable<string[]> = null,\n buffer: Nullable<ArrayBufferView> = null\n ): void {\n if (!this.name || this.name.startsWith(\"data:\")) {\n this.name = url;\n }\n this.url = url;\n\n if (forcedExtension) {\n this._forcedExtension = forcedExtension;\n }\n\n const lastDot = url.lastIndexOf(\".\");\n const extension = forcedExtension ? forcedExtension : lastDot > -1 ? url.substring(lastDot).toLowerCase() : \"\";\n const isDDS = extension.indexOf(\".dds\") === 0;\n const isEnv = extension.indexOf(\".env\") === 0;\n const isBasis = extension.indexOf(\".basis\") === 0;\n\n if (isEnv) {\n this.gammaSpace = false;\n this._prefiltered = false;\n this.anisotropicFilteringLevel = 1;\n } else {\n this._prefiltered = prefiltered;\n\n if (prefiltered) {\n this.gammaSpace = false;\n this.anisotropicFilteringLevel = 1;\n }\n }\n\n if (files) {\n this._files = files;\n } else {\n if (!isBasis && !isEnv && !isDDS && !extensions) {\n extensions = [\"_px.jpg\", \"_py.jpg\", \"_pz.jpg\", \"_nx.jpg\", \"_ny.jpg\", \"_nz.jpg\"];\n }\n\n this._files = this._files || [];\n this._files.length = 0;\n\n if (extensions) {\n for (let index = 0; index < extensions.length; index++) {\n this._files.push(url + extensions[index]);\n }\n this._extensions = extensions;\n }\n }\n\n this._buffer = buffer;\n\n if (delayLoad) {\n this.delayLoadState = Constants.DELAYLOADSTATE_NOTLOADED;\n this._delayedOnLoad = onLoad;\n this._delayedOnError = onError;\n } else {\n this._loadTexture(onLoad, onError);\n }\n }\n\n /**\n * Delays loading of the cube texture\n * @param forcedExtension defines the extension to use\n */\n public override delayLoad(forcedExtension?: string): void {\n if (this.delayLoadState !== Constants.DELAYLOADSTATE_NOTLOADED) {\n return;\n }\n if (forcedExtension) {\n this._forcedExtension = forcedExtension;\n }\n\n this.delayLoadState = Constants.DELAYLOADSTATE_LOADED;\n this._loadTexture(this._delayedOnLoad, this._delayedOnError);\n }\n\n /**\n * Returns the reflection texture matrix\n * @returns the reflection texture matrix\n */\n public override getReflectionTextureMatrix(): Matrix {\n return this._textureMatrix;\n }\n\n /**\n * Sets the reflection texture matrix\n * @param value Reflection texture matrix\n */\n public setReflectionTextureMatrix(value: Matrix): void {\n if (value.updateFlag === this._textureMatrix.updateFlag) {\n return;\n }\n\n if (value.isIdentity() !== this._textureMatrix.isIdentity()) {\n this.getScene()?.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag, (mat) => mat.getActiveTextures().indexOf(this) !== -1);\n }\n\n this._textureMatrix = value;\n\n if (!this.getScene()?.useRightHandedSystem) {\n return;\n }\n\n const scale = TmpVectors.Vector3[0];\n const quat = TmpVectors.Quaternion[0];\n const trans = TmpVectors.Vector3[1];\n\n this._textureMatrix.decompose(scale, quat, trans);\n\n quat.z *= -1; // these two operations correspond to negating the x and y euler angles\n quat.w *= -1;\n\n Matrix.ComposeToRef(scale, quat, trans, this._textureMatrixRefraction);\n }\n\n /**\n * Gets a suitable rotate/transform matrix when the texture is used for refraction.\n * There's a separate function from getReflectionTextureMatrix because refraction requires a special configuration of the matrix in right-handed mode.\n * @returns The refraction matrix\n */\n public override getRefractionTextureMatrix(): Matrix {\n return this.getScene()?.useRightHandedSystem ? this._textureMatrixRefraction : this._textureMatrix;\n }\n\n private _loadTexture(onLoad: Nullable<() => void> = null, onError: Nullable<(message?: string, exception?: any) => void> = null) {\n const scene = this.getScene();\n const oldTexture = this._texture;\n this._texture = this._getFromCache(this.url, this._noMipmap, undefined, undefined, this._useSRGBBuffer, this.isCube);\n\n const onLoadProcessing = () => {\n this.onLoadObservable.notifyObservers(this);\n if (oldTexture) {\n oldTexture.dispose();\n this.getScene()?.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag);\n }\n if (onLoad) {\n onLoad();\n }\n };\n\n const errorHandler = (message?: string, exception?: any) => {\n this._loadingError = true;\n this._errorObject = { message, exception };\n if (onError) {\n onError(message, exception);\n }\n Texture.OnTextureLoadErrorObservable.notifyObservers(this);\n };\n\n if (!this._texture) {\n if (this._prefiltered) {\n this._texture = this._getEngine()!.createPrefilteredCubeTexture(\n this.url,\n scene,\n this._lodScale,\n this._lodOffset,\n onLoad,\n errorHandler,\n this._format,\n this._forcedExtension,\n this._createPolynomials\n );\n } else {\n this._texture = this._getEngine()!.createCubeTexture(\n this.url,\n scene,\n this._files,\n this._noMipmap,\n onLoad,\n errorHandler,\n this._format,\n this._forcedExtension,\n false,\n this._lodScale,\n this._lodOffset,\n null,\n this._loaderOptions,\n !!this._useSRGBBuffer,\n this._buffer\n );\n }\n\n this._texture?.onLoadedObservable.add(() => this.onLoadObservable.notifyObservers(this));\n } else {\n if (this._texture.isReady) {\n TimingTools.SetImmediate(() => onLoadProcessing());\n } else {\n this._texture.onLoadedObservable.add(() => onLoadProcessing());\n }\n }\n }\n\n /**\n * Makes a clone, or deep copy, of the cube texture\n * @returns a new cube texture\n */\n public override clone(): CubeTexture {\n let uniqueId = 0;\n\n // Save the irradianceTexture before cloning. The irradianceTexture is\n // stored on the InternalTexture (_texture._irradianceTexture), which may\n // be shared between the source and clone when loaded from cache.\n // BaseTexture.clone() returns null, so CopySource sets the shared\n // irradianceTexture to null, losing it on both the original and the clone.\n const savedIrradianceTexture = this.irradianceTexture;\n\n const newCubeTexture = SerializationHelper.Clone(() => {\n const cubeTexture = new CubeTexture(this.url, this.getScene() || this._getEngine()!, this._extensions, this._noMipmap, this._files);\n uniqueId = cubeTexture.uniqueId;\n\n return cubeTexture;\n }, this);\n\n newCubeTexture.uniqueId = uniqueId;\n\n // Restore the irradianceTexture if it was cleared during cloning.\n if (savedIrradianceTexture && !this.irradianceTexture) {\n this.irradianceTexture = savedIrradianceTexture;\n }\n\n return newCubeTexture;\n }\n}\n\nlet _Registered = false;\n\n/**\n * Creates a cube texture from an array of image urls\n * @param files defines an array of image urls\n * @param scene defines the hosting scene\n * @param noMipmap specifies if mip maps are not used\n * @returns a cube texture\n */\nexport function CubeTextureCreateFromImages(files: string[], scene: Scene, noMipmap?: boolean): CubeTexture {\n let rootUrlKey = \"\";\n\n for (const url of files) {\n rootUrlKey += url;\n }\n\n return new CubeTexture(rootUrlKey, scene, null, noMipmap, files);\n}\n\n/**\n * Creates and return a texture created from prefilterd data by tools like IBL Baker or Lys.\n * @param url defines the url of the prefiltered texture\n * @param scene defines the scene the texture is attached to\n * @param forcedExtension defines the extension of the file if different from the url\n * @param createPolynomials defines whether or not to create polynomial harmonics from the texture data if necessary\n * @returns the prefiltered texture\n */\nexport function CubeTextureCreateFromPrefilteredData(url: string, scene: Scene, forcedExtension: any = null, createPolynomials: boolean = true): CubeTexture {\n const oldValue = scene.useDelayedTextureLoading;\n scene.useDelayedTextureLoading = false;\n\n const result = new CubeTexture(url, scene, null, false, null, null, null, undefined, true, forcedExtension, createPolynomials);\n\n scene.useDelayedTextureLoading = oldValue;\n\n return result;\n}\n\n/**\n * Parses text to create a cube texture\n * @param parsedTexture define the serialized text to read from\n * @param scene defines the hosting scene\n * @param rootUrl defines the root url of the cube texture\n * @returns a cube texture\n */\nexport function CubeTextureParse(parsedTexture: any, scene: Scene, rootUrl: string): CubeTexture {\n const texture = SerializationHelper.Parse(\n () => {\n let prefiltered: boolean = false;\n if (parsedTexture.prefiltered) {\n prefiltered = parsedTexture.prefiltered;\n }\n return new CubeTexture(\n rootUrl + (parsedTexture.url ?? parsedTexture.name),\n scene,\n parsedTexture.extensions,\n false,\n parsedTexture.files || null,\n null,\n null,\n undefined,\n prefiltered,\n parsedTexture.forcedExtension\n );\n },\n parsedTexture,\n scene\n );\n\n // Local Cubemaps\n if (parsedTexture.boundingBoxPosition) {\n texture.boundingBoxPosition = Vector3.FromArray(parsedTexture.boundingBoxPosition);\n }\n if (parsedTexture.boundingBoxSize) {\n texture.boundingBoxSize = Vector3.FromArray(parsedTexture.boundingBoxSize);\n }\n\n // Animations\n if (parsedTexture.animations) {\n for (let animationIndex = 0; animationIndex < parsedTexture.animations.length; animationIndex++) {\n const parsedAnimation = parsedTexture.animations[animationIndex];\n const internalClass = GetClass(\"BABYLON.Animation\");\n if (internalClass) {\n texture.animations.push(internalClass.Parse(parsedAnimation));\n }\n }\n }\n\n return texture;\n}\n\n/**\n * Register side effects for cubeTexture.\n * Safe to call multiple times; only the first call has an effect.\n */\nexport function RegisterCubeTexture(): void {\n if (_Registered) {\n return;\n }\n _Registered = true;\n\n CubeTexture.CreateFromImages = CubeTextureCreateFromImages;\n CubeTexture.CreateFromPrefilteredData = CubeTextureCreateFromPrefilteredData;\n CubeTexture.Parse = CubeTextureParse;\n\n Texture._CubeTextureParser = CubeTextureParse;\n\n // Some exporters relies on Tools.Instantiate\n RegisterClass(\"BABYLON.CubeTexture\", CubeTexture);\n}\n"]}
1
+ {"version":3,"file":"cubeTexture.pure.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/cubeTexture.pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;;AAE7D,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AACzF,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAGrD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,uCAAuC,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE/D,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,iCAAiC,EAAE,MAAM,8DAA8D,CAAC;AAoDjH,gIAAgI;AAChI,MAAM,eAAe,GAAG,GAAG,CAAC;AAE5B;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,WAAW;IA2BxC;;;;;OAKG;IACH,IAAW,eAAe,CAAC,KAAc;QACrC,IAAI,IAAI,CAAC,gBAAgB,IAAI,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;YAC/D,OAAO;QACX,CAAC;QACD,IAAI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AW,CAAC,KAAK,GAAG,gBAAgB,CAAC;IAErC,OAAO,CAAC,kBAAkB,GAAG,gBAAgB,CAAC;IAE9C,6CAA6C;IAC7C,aAAa,CAAC,qBAAqB,EAAE,WAAW,CAAC,CAAC;AACtD,CAAC","sourcesContent":["/** This file must only contain pure code and pure imports */\n\nimport { serialize, serializeAsMatrix, serializeAsVector3 } from \"../../Misc/decorators\";\nimport { TimingTools } from \"../../Misc/timingTools\";\nimport { type Nullable } from \"../../types\";\nimport { type Scene } from \"../../scene.pure\";\nimport { Matrix, TmpVectors, Vector3 } from \"../../Maths/math.vector.pure\";\nimport { BaseTexture } from \"../../Materials/Textures/baseTexture.pure\";\nimport { Texture } from \"../../Materials/Textures/texture.pure\";\nimport { Constants } from \"../../Engines/constants\";\nimport { GetClass, RegisterClass } from \"../../Misc/typeStore\";\nimport { type AbstractEngine } from \"../../Engines/abstractEngine.pure\";\nimport { Observable } from \"../../Misc/observable.pure\";\nimport { SerializationHelper } from \"../../Misc/decorators.serialization\";\nimport { RegisterAbstractEngineCubeTexture } from \"../../Engines/AbstractEngine/abstractEngine.cubeTexture.pure\";\n\n/**\n * Defines the available options when creating a cube texture\n */\nexport interface ICubeTextureCreationOptions {\n /** Defines the suffixes add to the picture name in case six images are in use like _px.jpg */\n extensions?: string[];\n\n /** noMipmap defines if mipmaps should be created or not */\n noMipmap?: boolean;\n\n /** files defines the six files to load for the different faces in that order: px, py, pz, nx, ny, nz */\n files?: string[];\n\n /** buffer to load instead of loading the data from the url */\n buffer?: ArrayBufferView;\n\n /** onLoad defines a callback triggered at the end of the file load if no errors occurred */\n onLoad?: () => void;\n\n /** onError defines a callback triggered in case of error during load */\n onError?: (message?: string, exception?: any) => void;\n\n /** format defines the internal format to use for the texture once loaded */\n format?: number;\n\n /** prefiltered defines whether or not the texture is created from prefiltered data */\n prefiltered?: boolean;\n\n /** forcedExtension defines the extensions to use (force a special type of file to load) in case it is different from the file name */\n forcedExtension?: any;\n\n /** createPolynomials defines whether or not to create polynomial harmonics from the texture data if necessary */\n createPolynomials?: boolean;\n\n /** lodScale defines the scale applied to environment texture. This manages the range of LOD level used for IBL according to the roughness */\n lodScale?: number;\n\n /** lodOffset defines the offset applied to environment texture. This manages first LOD level used for IBL according to the roughness */\n lodOffset?: number;\n\n /** loaderOptions options to be passed to the loader */\n loaderOptions?: any;\n\n /** useSRGBBuffer Defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU) (default: false) */\n useSRGBBuffer?: boolean;\n\n /** Target face size for spherical polynomial computation. 0 = full resolution (default). */\n sphericalPolynomialTargetSize?: number;\n}\n\n// The default scale applied to environment texture. This manages the range of LOD level used for IBL according to the roughness\nconst DefaultLodScale = 0.8;\n\n/**\n * Class for creating a cube texture\n */\nexport class CubeTexture extends BaseTexture {\n private _delayedOnLoad: Nullable<() => void>;\n private _delayedOnError: Nullable<(message?: string, exception?: any) => void>;\n private _lodScale: number;\n private _lodOffset: number;\n\n /**\n * Observable triggered once the texture has been loaded.\n */\n public onLoadObservable: Observable<CubeTexture> = new Observable<CubeTexture>();\n\n /**\n * The url of the texture\n */\n @serialize()\n public url: string;\n\n /**\n * Gets or sets the center of the bounding box associated with the cube texture.\n * It must define where the camera used to render the texture was set\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/reflectionTexture#using-local-cubemap-mode\n */\n @serializeAsVector3()\n public boundingBoxPosition = Vector3.Zero();\n\n private _boundingBoxSize: Vector3;\n\n /**\n * Gets or sets the size of the bounding box associated with the cube texture\n * When defined, the cubemap will switch to local mode\n * @see https://community.arm.com/graphics/b/blog/posts/reflections-based-on-local-cubemaps-in-unity\n * @example https://www.babylonjs-playground.com/#RNASML\n */\n public set boundingBoxSize(value: Vector3) {\n if (this._boundingBoxSize && this._boundingBoxSize.equals(value)) {\n return;\n }\n this._boundingBoxSize = value;\n const scene = this.getScene();\n if (scene) {\n scene.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag);\n }\n }\n /**\n * Returns the bounding box size\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/reflectionTexture#using-local-cubemap-mode\n */\n @serializeAsVector3()\n public get boundingBoxSize(): Vector3 {\n return this._boundingBoxSize;\n }\n\n protected _rotationY: number = 0;\n\n /**\n * Sets texture matrix rotation angle around Y axis in radians.\n */\n @serialize(\"rotationY\")\n public set rotationY(value: number) {\n this._rotationY = value;\n this.setReflectionTextureMatrix(Matrix.RotationY(this._rotationY));\n }\n /**\n * Gets texture matrix rotation angle around Y axis radians.\n */\n public get rotationY(): number {\n return this._rotationY;\n }\n\n /**\n * Are mip maps generated for this texture or not.\n */\n public override get noMipmap(): boolean {\n return this._noMipmap;\n }\n\n private _noMipmap: boolean;\n\n /** @internal */\n @serialize(\"files\")\n public _files: Nullable<string[]> = null;\n\n @serialize(\"forcedExtension\")\n protected _forcedExtension: Nullable<string> = null;\n\n /**\n * Gets the forced extension (if any)\n */\n public get forcedExtension(): Nullable<string> {\n return this._forcedExtension;\n }\n\n @serialize(\"extensions\")\n private _extensions: Nullable<string[]> = null;\n\n @serializeAsMatrix(\"textureMatrix\")\n private _textureMatrix: Matrix;\n\n @serializeAsMatrix(\"textureMatrixRefraction\")\n private _textureMatrixRefraction: Matrix = new Matrix();\n\n private _format: number;\n private _createPolynomials: boolean;\n private _loaderOptions: any;\n private _useSRGBBuffer?: boolean;\n private _buffer: Nullable<ArrayBufferView> = null;\n\n /**\n * Creates a cube texture to use with reflection for instance. It can be based upon dds or six images as well\n * as prefiltered data.\n * @param rootUrl defines the url of the texture or the root name of the six images\n * @param sceneOrEngine defines the scene or engine the texture is attached to\n * @param extensionsOrOptions defines the suffixes add to the picture name in case six images are in use like _px.jpg or set of all options to create the cube texture\n * @param noMipmap defines if mipmaps should be created or not\n * @param files defines the six files to load for the different faces in that order: px, py, pz, nx, ny, nz\n * @param onLoad defines a callback triggered at the end of the file load if no errors occurred\n * @param onError defines a callback triggered in case of error during load\n * @param format defines the internal format to use for the texture once loaded\n * @param prefiltered defines whether or not the texture is created from prefiltered data\n * @param forcedExtension defines the extensions to use (force a special type of file to load) in case it is different from the file name\n * @param createPolynomials defines whether or not to create polynomial harmonics from the texture data if necessary\n * @param lodScale defines the scale applied to environment texture. This manages the range of LOD level used for IBL according to the roughness\n * @param lodOffset defines the offset applied to environment texture. This manages first LOD level used for IBL according to the roughness\n * @param loaderOptions options to be passed to the loader\n * @param useSRGBBuffer Defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU) (default: false)\n * @returns the cube texture\n */\n constructor(\n rootUrl: string,\n sceneOrEngine: Scene | AbstractEngine,\n extensionsOrOptions: Nullable<string[] | ICubeTextureCreationOptions> = null,\n noMipmap: boolean = false,\n files: Nullable<string[]> = null,\n onLoad: Nullable<() => void> = null,\n onError: Nullable<(message?: string, exception?: any) => void> = null,\n format: number = Constants.TEXTUREFORMAT_RGBA,\n prefiltered = false,\n forcedExtension: any = null,\n createPolynomials: boolean = false,\n lodScale: number = DefaultLodScale,\n lodOffset: number = 0,\n loaderOptions?: any,\n useSRGBBuffer?: boolean\n ) {\n super(sceneOrEngine);\n\n RegisterAbstractEngineCubeTexture();\n\n this.name = rootUrl;\n this.url = rootUrl;\n this._noMipmap = noMipmap;\n this.hasAlpha = false;\n this.isCube = true;\n this._textureMatrix = Matrix.Identity();\n this.coordinatesMode = Texture.CUBIC_MODE;\n\n let extensions: Nullable<string[]>;\n let buffer: Nullable<ArrayBufferView> = null;\n\n if (extensionsOrOptions !== null && !Array.isArray(extensionsOrOptions)) {\n extensions = extensionsOrOptions.extensions ?? null;\n this._noMipmap = extensionsOrOptions.noMipmap ?? false;\n files = extensionsOrOptions.files ?? null;\n buffer = extensionsOrOptions.buffer ?? null;\n this._format = extensionsOrOptions.format ?? Constants.TEXTUREFORMAT_RGBA;\n prefiltered = extensionsOrOptions.prefiltered ?? false;\n forcedExtension = extensionsOrOptions.forcedExtension ?? null;\n this._createPolynomials = extensionsOrOptions.createPolynomials ?? false;\n this._lodScale = extensionsOrOptions.lodScale ?? DefaultLodScale;\n this._lodOffset = extensionsOrOptions.lodOffset ?? 0;\n this._loaderOptions = extensionsOrOptions.loaderOptions;\n this._useSRGBBuffer = extensionsOrOptions.useSRGBBuffer;\n this._sphericalPolynomialTargetSize = extensionsOrOptions.sphericalPolynomialTargetSize ?? 0;\n onLoad = extensionsOrOptions.onLoad ?? null;\n onError = extensionsOrOptions.onError ?? null;\n } else {\n this._noMipmap = noMipmap;\n this._format = format;\n this._createPolynomials = createPolynomials;\n extensions = extensionsOrOptions;\n this._loaderOptions = loaderOptions;\n this._useSRGBBuffer = useSRGBBuffer;\n this._lodScale = lodScale;\n this._lodOffset = lodOffset;\n }\n\n if (!rootUrl && !files) {\n return;\n }\n\n this.updateURL(rootUrl, forcedExtension, onLoad, prefiltered, onError, extensions, this.getScene()?.useDelayedTextureLoading, files, buffer);\n }\n\n /**\n * Get the current class name of the texture useful for serialization or dynamic coding.\n * @returns \"CubeTexture\"\n */\n public override getClassName(): string {\n return \"CubeTexture\";\n }\n\n /**\n * Update the url (and optional buffer) of this texture if url was null during construction.\n * @param url the url of the texture\n * @param forcedExtension defines the extension to use\n * @param onLoad callback called when the texture is loaded (defaults to null)\n * @param prefiltered Defines whether the updated texture is prefiltered or not\n * @param onError callback called if there was an error during the loading process (defaults to null)\n * @param extensions defines the suffixes add to the picture name in case six images are in use like _px.jpg...\n * @param delayLoad defines if the texture should be loaded now (false by default)\n * @param files defines the six files to load for the different faces in that order: px, py, pz, nx, ny, nz\n * @param buffer the buffer to use instead of loading from the url\n */\n public updateURL(\n url: string,\n forcedExtension: Nullable<string> = null,\n onLoad: Nullable<() => void> = null,\n prefiltered: boolean = false,\n onError: Nullable<(message?: string, exception?: any) => void> = null,\n extensions: Nullable<string[]> = null,\n delayLoad = false,\n files: Nullable<string[]> = null,\n buffer: Nullable<ArrayBufferView> = null\n ): void {\n if (!this.name || this.name.startsWith(\"data:\")) {\n this.name = url;\n }\n this.url = url;\n\n if (forcedExtension) {\n this._forcedExtension = forcedExtension;\n }\n\n const lastDot = url.lastIndexOf(\".\");\n const extension = forcedExtension ? forcedExtension : lastDot > -1 ? url.substring(lastDot).toLowerCase() : \"\";\n const isDDS = extension.indexOf(\".dds\") === 0;\n const isEnv = extension.indexOf(\".env\") === 0;\n const isBasis = extension.indexOf(\".basis\") === 0;\n\n if (isEnv) {\n this.gammaSpace = false;\n this._prefiltered = false;\n this.anisotropicFilteringLevel = 1;\n } else {\n this._prefiltered = prefiltered;\n\n if (prefiltered) {\n this.gammaSpace = false;\n this.anisotropicFilteringLevel = 1;\n }\n }\n\n if (files) {\n this._files = files;\n } else {\n if (!isBasis && !isEnv && !isDDS && !extensions) {\n extensions = [\"_px.jpg\", \"_py.jpg\", \"_pz.jpg\", \"_nx.jpg\", \"_ny.jpg\", \"_nz.jpg\"];\n }\n\n this._files = this._files || [];\n this._files.length = 0;\n\n if (extensions) {\n for (let index = 0; index < extensions.length; index++) {\n this._files.push(url + extensions[index]);\n }\n this._extensions = extensions;\n }\n }\n\n this._buffer = buffer;\n\n if (delayLoad) {\n this.delayLoadState = Constants.DELAYLOADSTATE_NOTLOADED;\n this._delayedOnLoad = onLoad;\n this._delayedOnError = onError;\n } else {\n this._loadTexture(onLoad, onError);\n }\n }\n\n /**\n * Delays loading of the cube texture\n * @param forcedExtension defines the extension to use\n */\n public override delayLoad(forcedExtension?: string): void {\n if (this.delayLoadState !== Constants.DELAYLOADSTATE_NOTLOADED) {\n return;\n }\n if (forcedExtension) {\n this._forcedExtension = forcedExtension;\n }\n\n this.delayLoadState = Constants.DELAYLOADSTATE_LOADED;\n this._loadTexture(this._delayedOnLoad, this._delayedOnError);\n }\n\n /**\n * Returns the reflection texture matrix\n * @returns the reflection texture matrix\n */\n public override getReflectionTextureMatrix(): Matrix {\n return this._textureMatrix;\n }\n\n /**\n * Sets the reflection texture matrix\n * @param value Reflection texture matrix\n */\n public setReflectionTextureMatrix(value: Matrix): void {\n if (value.updateFlag === this._textureMatrix.updateFlag) {\n return;\n }\n\n if (value.isIdentity() !== this._textureMatrix.isIdentity()) {\n this.getScene()?.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag, (mat) => mat.getActiveTextures().indexOf(this) !== -1);\n }\n\n this._textureMatrix = value;\n\n if (!this.getScene()?.useRightHandedSystem) {\n return;\n }\n\n const scale = TmpVectors.Vector3[0];\n const quat = TmpVectors.Quaternion[0];\n const trans = TmpVectors.Vector3[1];\n\n this._textureMatrix.decompose(scale, quat, trans);\n\n quat.z *= -1; // these two operations correspond to negating the x and y euler angles\n quat.w *= -1;\n\n Matrix.ComposeToRef(scale, quat, trans, this._textureMatrixRefraction);\n }\n\n /**\n * Gets a suitable rotate/transform matrix when the texture is used for refraction.\n * There's a separate function from getReflectionTextureMatrix because refraction requires a special configuration of the matrix in right-handed mode.\n * @returns The refraction matrix\n */\n public override getRefractionTextureMatrix(): Matrix {\n return this.getScene()?.useRightHandedSystem ? this._textureMatrixRefraction : this._textureMatrix;\n }\n\n private _loadTexture(onLoad: Nullable<() => void> = null, onError: Nullable<(message?: string, exception?: any) => void> = null) {\n const scene = this.getScene();\n const oldTexture = this._texture;\n this._texture = this._getFromCache(this.url, this._noMipmap, undefined, undefined, this._useSRGBBuffer, this.isCube);\n\n const onLoadProcessing = () => {\n this.onLoadObservable.notifyObservers(this);\n if (oldTexture) {\n oldTexture.dispose();\n this.getScene()?.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag);\n }\n if (onLoad) {\n onLoad();\n }\n };\n\n const errorHandler = (message?: string, exception?: any) => {\n this._loadingError = true;\n this._errorObject = { message, exception };\n if (onError) {\n onError(message, exception);\n }\n Texture.OnTextureLoadErrorObservable.notifyObservers(this);\n };\n\n if (!this._texture) {\n if (this._prefiltered) {\n this._texture = this._getEngine()!.createPrefilteredCubeTexture(\n this.url,\n scene,\n this._lodScale,\n this._lodOffset,\n onLoad,\n errorHandler,\n this._format,\n this._forcedExtension,\n this._createPolynomials\n );\n } else {\n this._texture = this._getEngine()!.createCubeTexture(\n this.url,\n scene,\n this._files,\n this._noMipmap,\n onLoad,\n errorHandler,\n this._format,\n this._forcedExtension,\n false,\n this._lodScale,\n this._lodOffset,\n null,\n this._loaderOptions,\n !!this._useSRGBBuffer,\n this._buffer\n );\n }\n\n this._texture?.onLoadedObservable.add(() => this.onLoadObservable.notifyObservers(this));\n } else {\n if (this._texture.isReady) {\n TimingTools.SetImmediate(() => onLoadProcessing());\n } else {\n this._texture.onLoadedObservable.add(() => onLoadProcessing());\n }\n }\n }\n\n /**\n * Makes a clone, or deep copy, of the cube texture\n * @returns a new cube texture\n */\n public override clone(): CubeTexture {\n let uniqueId = 0;\n\n // Save the irradianceTexture before cloning. The irradianceTexture is\n // stored on the InternalTexture (_texture._irradianceTexture), which may\n // be shared between the source and clone when loaded from cache.\n // BaseTexture.clone() returns null, so CopySource sets the shared\n // irradianceTexture to null, losing it on both the original and the clone.\n const savedIrradianceTexture = this.irradianceTexture;\n\n const newCubeTexture = SerializationHelper.Clone(() => {\n const cubeTexture = new CubeTexture(this.url, this.getScene() || this._getEngine()!, this._extensions, this._noMipmap, this._files);\n uniqueId = cubeTexture.uniqueId;\n\n return cubeTexture;\n }, this);\n\n newCubeTexture.uniqueId = uniqueId;\n\n // Restore the irradianceTexture if it was cleared during cloning.\n if (savedIrradianceTexture && !this.irradianceTexture) {\n this.irradianceTexture = savedIrradianceTexture;\n }\n\n return newCubeTexture;\n }\n}\n\nlet _Registered = false;\n\n/**\n * Creates a cube texture from an array of image urls\n * @param files defines an array of image urls\n * @param scene defines the hosting scene\n * @param noMipmap specifies if mip maps are not used\n * @returns a cube texture\n */\nexport function CubeTextureCreateFromImages(files: string[], scene: Scene, noMipmap?: boolean): CubeTexture {\n let rootUrlKey = \"\";\n\n for (const url of files) {\n rootUrlKey += url;\n }\n\n return new CubeTexture(rootUrlKey, scene, null, noMipmap, files);\n}\n\n/**\n * Creates and return a texture created from prefilterd data by tools like IBL Baker or Lys.\n * @param url defines the url of the prefiltered texture\n * @param scene defines the scene the texture is attached to\n * @param forcedExtension defines the extension of the file if different from the url\n * @param createPolynomials defines whether or not to create polynomial harmonics from the texture data if necessary\n * @returns the prefiltered texture\n */\nexport function CubeTextureCreateFromPrefilteredData(url: string, scene: Scene, forcedExtension: any = null, createPolynomials: boolean = true): CubeTexture {\n const oldValue = scene.useDelayedTextureLoading;\n scene.useDelayedTextureLoading = false;\n\n const result = new CubeTexture(url, scene, null, false, null, null, null, undefined, true, forcedExtension, createPolynomials);\n\n scene.useDelayedTextureLoading = oldValue;\n\n return result;\n}\n\n/**\n * Parses text to create a cube texture\n * @param parsedTexture define the serialized text to read from\n * @param scene defines the hosting scene\n * @param rootUrl defines the root url of the cube texture\n * @returns a cube texture\n */\nexport function CubeTextureParse(parsedTexture: any, scene: Scene, rootUrl: string): CubeTexture {\n const texture = SerializationHelper.Parse(\n () => {\n let prefiltered: boolean = false;\n if (parsedTexture.prefiltered) {\n prefiltered = parsedTexture.prefiltered;\n }\n return new CubeTexture(\n rootUrl + (parsedTexture.url ?? parsedTexture.name),\n scene,\n parsedTexture.extensions,\n false,\n parsedTexture.files || null,\n null,\n null,\n undefined,\n prefiltered,\n parsedTexture.forcedExtension\n );\n },\n parsedTexture,\n scene\n );\n\n // Local Cubemaps\n if (parsedTexture.boundingBoxPosition) {\n texture.boundingBoxPosition = Vector3.FromArray(parsedTexture.boundingBoxPosition);\n }\n if (parsedTexture.boundingBoxSize) {\n texture.boundingBoxSize = Vector3.FromArray(parsedTexture.boundingBoxSize);\n }\n\n // Animations\n if (parsedTexture.animations) {\n for (let animationIndex = 0; animationIndex < parsedTexture.animations.length; animationIndex++) {\n const parsedAnimation = parsedTexture.animations[animationIndex];\n const internalClass = GetClass(\"BABYLON.Animation\");\n if (internalClass) {\n texture.animations.push(internalClass.Parse(parsedAnimation));\n }\n }\n }\n\n return texture;\n}\n\n/**\n * Register side effects for cubeTexture.\n * Safe to call multiple times; only the first call has an effect.\n */\nexport function RegisterCubeTexture(): void {\n if (_Registered) {\n return;\n }\n _Registered = true;\n\n CubeTexture.CreateFromImages = CubeTextureCreateFromImages;\n CubeTexture.CreateFromPrefilteredData = CubeTextureCreateFromPrefilteredData;\n CubeTexture.Parse = CubeTextureParse;\n\n Texture._CubeTextureParser = CubeTextureParse;\n\n // Some exporters relies on Tools.Instantiate\n RegisterClass(\"BABYLON.CubeTexture\", CubeTexture);\n}\n"]}
@@ -1,2 +1 @@
1
1
  export * from "./dynamicTexture.pure.js";
2
- import "../../Engines/Extensions/engine.dynamicTexture.js";
@@ -1,3 +1,2 @@
1
1
  export * from "./dynamicTexture.pure.js";
2
- import "../../Engines/Extensions/engine.dynamicTexture.js";
3
2
  //# sourceMappingURL=dynamicTexture.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dynamicTexture.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/dynamicTexture.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AAEtC,OAAO,gDAAgD,CAAC","sourcesContent":["export * from \"./dynamicTexture.pure\";\n\nimport \"../../Engines/Extensions/engine.dynamicTexture\";\n"]}
1
+ {"version":3,"file":"dynamicTexture.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/dynamicTexture.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC","sourcesContent":["export * from \"./dynamicTexture.pure\";\n"]}
@@ -2,6 +2,7 @@
2
2
  import { Logger } from "../../Misc/logger.js";
3
3
  import { Texture } from "../../Materials/Textures/texture.pure.js";
4
4
 
5
+ import { RegisterEnginesExtensionsEngineDynamicTexture } from "../../Engines/Extensions/engine.dynamicTexture.pure.js";
5
6
  /**
6
7
  * A class extending Texture allowing drawing on a texture
7
8
  * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/dynamicTexture
@@ -13,6 +14,7 @@ export class DynamicTexture extends Texture {
13
14
  const scene = isScene ? sceneOrOptions : sceneOrOptions?.scene;
14
15
  const noMipmap = isScene ? !generateMipMaps : sceneOrOptions;
15
16
  super(null, scene, noMipmap, invertY, samplingMode, undefined, undefined, undefined, undefined, format);
17
+ RegisterEnginesExtensionsEngineDynamicTexture();
16
18
  this.name = name;
17
19
  this.wrapU = Texture.CLAMP_ADDRESSMODE;
18
20
  this.wrapV = Texture.CLAMP_ADDRESSMODE;
@@ -1 +1 @@
1
- {"version":3,"file":"dynamicTexture.pure.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/dynamicTexture.pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAE7D,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAI3C,OAAO,EAAgC,OAAO,EAAE,MAAM,uCAAuC,CAAC;AAC9F,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAepD;;;GAGG;AACH,MAAM,OAAO,cAAe,SAAQ,OAAO;IA6CvC,gBAAgB;IAChB,YACI,IAAY,EACZ,YAAkE,EAClE,cAAyD,EACzD,kBAA2B,KAAK,EAChC,eAAuB,SAAS,CAAC,8BAA8B,EAC/D,SAAiB,SAAS,CAAC,kBAAkB,EAC7C,OAAiB;QAEjB,MAAM,OAAO,GAAG,CAAC,cAAc,IAAK,cAAwB,CAAC,QAAQ,CAAC;QACtE,MAAM,KAAK,GAAG,OAAO,CAAC,CAAC,CAAE,cAAwB,CAAC,CAAC,CAAE,cAAyC,EAAE,KAAK,CAAC;QACtG,MAAM,QAAQ,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAE,cAAyC,CAAC;QAEzF,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;QAExG,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,iBAAiB,CAAC;QACvC,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,iBAAiB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ACA,QAAQ;QACpB,IAAI,CAAC,MAAM,EAAE,CAAC;IAClB,CAAC;CACJ","sourcesContent":["/** This file must only contain pure code and pure imports */\r\n\r\nimport { Logger } from \"../../Misc/logger\";\r\nimport { type Nullable } from \"../../types\";\r\nimport { type Scene } from \"../../scene.pure\";\r\nimport { type ISize } from \"../../Maths/math.size\";\r\nimport { type ITextureCreationOptions, Texture } from \"../../Materials/Textures/texture.pure\";\r\nimport { Constants } from \"../../Engines/constants\";\r\nimport { type ICanvas, type ICanvasRenderingContext } from \"../../Engines/ICanvas\";\r\n\r\n/**\r\n * Interface defining options used to create a dynamic texture\r\n */\r\nexport interface IDynamicTextureOptions extends ITextureCreationOptions {\r\n /** defines the width of the texture (default: 0) */\r\n width?: number;\r\n /** defines the height of the texture (default: 0) */\r\n height?: number;\r\n /** defines the hosting scene (default: null) */\r\n scene?: Nullable<Scene>;\r\n}\r\n\r\n/**\r\n * A class extending Texture allowing drawing on a texture\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/dynamicTexture\r\n */\r\nexport class DynamicTexture extends Texture {\r\n private _generateMipMaps: boolean;\r\n private _canvas: ICanvas;\r\n private _ownCanvas: boolean;\r\n private _context: ICanvasRenderingContext;\r\n\r\n /**\r\n * Creates a DynamicTexture\r\n * @param name defines the name of the texture\r\n * @param canvasOrSize provides 3 alternatives for width and height of texture, a canvas, object with width and height properties, number for both width and height\r\n * @param options The options to be used when constructing the dynamic texture\r\n */\r\n constructor(name: string, canvasOrSize: ICanvas | { width: number; height: number } | number, options?: IDynamicTextureOptions);\r\n\r\n /**\r\n * Creates a DynamicTexture\r\n * @param name defines the name of the texture\r\n * @param options provides 3 alternatives for width and height of texture, a canvas, object with width and height properties, number for both width and height\r\n * @param scene defines the scene where you want the texture\r\n * @param generateMipMaps defines the use of MipMaps or not (default is false)\r\n * @param samplingMode defines the sampling mode to use (default is Texture.TRILINEAR_SAMPLINGMODE)\r\n * @param format defines the texture format to use (default is Engine.TEXTUREFORMAT_RGBA)\r\n * @param invertY defines if the texture needs to be inverted on the y axis during loading\r\n */\r\n constructor(\r\n name: string,\r\n options: ICanvas | { width: number; height: number } | number,\r\n scene?: Nullable<Scene>,\r\n generateMipMaps?: boolean,\r\n samplingMode?: number,\r\n format?: number,\r\n invertY?: boolean\r\n );\r\n\r\n /** @internal */\r\n constructor(\r\n name: string,\r\n canvasOrSize: ICanvas | { width: number; height: number } | number,\r\n sceneOrOptions?: Nullable<Scene> | IDynamicTextureOptions,\r\n generateMipMaps?: boolean,\r\n samplingMode?: number,\r\n format?: number,\r\n invertY?: boolean\r\n );\r\n\r\n /** @internal */\r\n constructor(\r\n name: string,\r\n canvasOrSize: ICanvas | { width: number; height: number } | number,\r\n sceneOrOptions?: Nullable<Scene> | IDynamicTextureOptions,\r\n generateMipMaps: boolean = false,\r\n samplingMode: number = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE,\r\n format: number = Constants.TEXTUREFORMAT_RGBA,\r\n invertY?: boolean\r\n ) {\r\n const isScene = !sceneOrOptions || (sceneOrOptions as Scene)._isScene;\r\n const scene = isScene ? (sceneOrOptions as Scene) : (sceneOrOptions as IDynamicTextureOptions)?.scene;\r\n const noMipmap = isScene ? !generateMipMaps : (sceneOrOptions as IDynamicTextureOptions);\r\n\r\n super(null, scene, noMipmap, invertY, samplingMode, undefined, undefined, undefined, undefined, format);\r\n\r\n this.name = name;\r\n this.wrapU = Texture.CLAMP_ADDRESSMODE;\r\n this.wrapV = Texture.CLAMP_ADDRESSMODE;\r\n\r\n this._generateMipMaps = generateMipMaps;\r\n\r\n const engine = this._getEngine();\r\n if (!engine) {\r\n return;\r\n }\r\n\r\n if ((canvasOrSize as ICanvas).getContext) {\r\n this._canvas = canvasOrSize as ICanvas;\r\n this._ownCanvas = false;\r\n this._texture = engine.createDynamicTexture(this._canvas.width, this._canvas.height, generateMipMaps, samplingMode);\r\n } else {\r\n this._canvas = engine.createCanvas(1, 1);\r\n this._ownCanvas = true;\r\n\r\n const optionsAsSize = canvasOrSize as ISize;\r\n if (optionsAsSize.width || optionsAsSize.width === 0) {\r\n this._texture = engine.createDynamicTexture(optionsAsSize.width, optionsAsSize.height, generateMipMaps, samplingMode);\r\n } else {\r\n this._texture = engine.createDynamicTexture(canvasOrSize as number, canvasOrSize as number, generateMipMaps, samplingMode);\r\n }\r\n }\r\n\r\n const textureSize = this.getSize();\r\n\r\n if (this._canvas.width !== textureSize.width) {\r\n this._canvas.width = textureSize.width;\r\n }\r\n if (this._canvas.height !== textureSize.height) {\r\n this._canvas.height = textureSize.height;\r\n }\r\n this._context = this._canvas.getContext(\"2d\");\r\n }\r\n\r\n /**\r\n * Get the current class name of the texture useful for serialization or dynamic coding.\r\n * @returns \"DynamicTexture\"\r\n */\r\n public override getClassName(): string {\r\n return \"DynamicTexture\";\r\n }\r\n\r\n /**\r\n * Gets the current state of canRescale\r\n */\r\n public override get canRescale(): boolean {\r\n return true;\r\n }\r\n\r\n private _recreate(textureSize: ISize): void {\r\n this._canvas.width = textureSize.width;\r\n this._canvas.height = textureSize.height;\r\n\r\n this.releaseInternalTexture();\r\n\r\n this._texture = this._getEngine()!.createDynamicTexture(textureSize.width, textureSize.height, this._generateMipMaps, this.samplingMode);\r\n }\r\n\r\n /**\r\n * Scales the texture\r\n * @param ratio the scale factor to apply to both width and height\r\n */\r\n public override scale(ratio: number): void {\r\n const textureSize = this.getSize();\r\n\r\n textureSize.width *= ratio;\r\n textureSize.height *= ratio;\r\n\r\n this._recreate(textureSize);\r\n }\r\n\r\n /**\r\n * Resizes the texture\r\n * @param width the new width\r\n * @param height the new height\r\n */\r\n public scaleTo(width: number, height: number): void {\r\n const textureSize = this.getSize();\r\n\r\n textureSize.width = width;\r\n textureSize.height = height;\r\n\r\n this._recreate(textureSize);\r\n }\r\n\r\n /**\r\n * Gets the context of the canvas used by the texture\r\n * @returns the canvas context of the dynamic texture\r\n */\r\n public getContext(): ICanvasRenderingContext {\r\n return this._context;\r\n }\r\n\r\n /**\r\n * Clears the texture\r\n * @param clearColor Defines the clear color to use\r\n */\r\n public clear(clearColor?: string): void {\r\n const size = this.getSize();\r\n if (clearColor) {\r\n this._context.fillStyle = clearColor;\r\n }\r\n this._context.clearRect(0, 0, size.width, size.height);\r\n }\r\n\r\n /**\r\n * Updates the texture\r\n * @param invertY defines the direction for the Y axis (default is true - y increases downwards)\r\n * @param premulAlpha defines if alpha is stored as premultiplied (default is false)\r\n * @param allowGPUOptimization true to allow some specific GPU optimizations (subject to engine feature \"allowGPUOptimizationsForGUI\" being true)\r\n */\r\n public update(invertY?: boolean, premulAlpha = false, allowGPUOptimization = false): void {\r\n // When disposed, this._texture will be null.\r\n if (!this._texture) {\r\n return;\r\n }\r\n\r\n this._getEngine()!.updateDynamicTexture(\r\n this._texture,\r\n this._canvas,\r\n invertY === undefined ? true : invertY,\r\n premulAlpha,\r\n this._format || undefined,\r\n undefined,\r\n allowGPUOptimization\r\n );\r\n }\r\n\r\n /**\r\n * Draws text onto the texture\r\n * @param text defines the text to be drawn\r\n * @param x defines the placement of the text from the left\r\n * @param y defines the placement of the text from the top when invertY is true and from the bottom when false\r\n * @param font defines the font to be used with font-style, font-size, font-name\r\n * @param color defines the color used for the text\r\n * @param fillColor defines the color for the canvas, use null to not overwrite canvas (this blends with the background to replace, use the clear function)\r\n * @param invertY defines the direction for the Y axis (default is true - y increases downwards)\r\n * @param update defines whether texture is immediately update (default is true)\r\n */\r\n public drawText(\r\n text: string,\r\n x: number | null | undefined,\r\n y: number | null | undefined,\r\n font: string,\r\n color: string | null,\r\n fillColor: string | null,\r\n invertY?: boolean,\r\n update = true\r\n ) {\r\n const size = this.getSize();\r\n if (fillColor) {\r\n this._context.fillStyle = fillColor;\r\n this._context.fillRect(0, 0, size.width, size.height);\r\n }\r\n\r\n this._context.font = font;\r\n if (x === null || x === undefined) {\r\n const textSize = this._context.measureText(text);\r\n x = (size.width - textSize.width) / 2;\r\n }\r\n if (y === null || y === undefined) {\r\n const fontSize = parseInt(font.replace(/\\D/g, \"\"));\r\n y = size.height / 2 + fontSize / 3.65;\r\n }\r\n\r\n this._context.fillStyle = color || \"\";\r\n this._context.fillText(text, x, y);\r\n\r\n if (update) {\r\n this.update(invertY);\r\n }\r\n }\r\n\r\n /**\r\n * Disposes the dynamic texture.\r\n */\r\n public override dispose(): void {\r\n super.dispose();\r\n\r\n if (this._ownCanvas) {\r\n this._canvas?.remove?.();\r\n }\r\n (this._canvas as any) = null;\r\n (this._context as any) = null;\r\n }\r\n\r\n /**\r\n * Clones the texture\r\n * @returns the clone of the texture.\r\n */\r\n public override clone(): DynamicTexture {\r\n const scene = this.getScene();\r\n\r\n if (!scene) {\r\n return this;\r\n }\r\n\r\n const textureSize = this.getSize();\r\n const newTexture = new DynamicTexture(this.name, textureSize, scene, this._generateMipMaps);\r\n\r\n // Base texture\r\n newTexture.hasAlpha = this.hasAlpha;\r\n newTexture.level = this.level;\r\n\r\n // Dynamic Texture\r\n newTexture.wrapU = this.wrapU;\r\n newTexture.wrapV = this.wrapV;\r\n\r\n return newTexture;\r\n }\r\n\r\n /**\r\n * Serializes the dynamic texture. The scene should be ready before the dynamic texture is serialized\r\n * @returns a serialized dynamic texture object\r\n */\r\n public override serialize(): any {\r\n const scene = this.getScene();\r\n if (scene && !scene.isReady()) {\r\n Logger.Warn(\"The scene must be ready before serializing the dynamic texture\");\r\n }\r\n\r\n const serializationObject = super.serialize();\r\n if (DynamicTexture._IsCanvasElement(this._canvas)) {\r\n serializationObject.base64String = this._canvas.toDataURL();\r\n }\r\n\r\n serializationObject.invertY = this._invertY;\r\n serializationObject.samplingMode = this.samplingMode;\r\n\r\n return serializationObject;\r\n }\r\n\r\n private static _IsCanvasElement(canvas: HTMLCanvasElement | OffscreenCanvas | ICanvas): canvas is HTMLCanvasElement {\r\n return (canvas as HTMLCanvasElement).toDataURL !== undefined;\r\n }\r\n\r\n /** @internal */\r\n public override _rebuild(): void {\r\n this.update();\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"dynamicTexture.pure.js","sour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nullable } from \"../../types\";\r\nimport { type Scene } from \"../../scene.pure\";\r\nimport { type ISize } from \"../../Maths/math.size\";\r\nimport { type ITextureCreationOptions, Texture } from \"../../Materials/Textures/texture.pure\";\r\nimport { Constants } from \"../../Engines/constants\";\r\nimport { type ICanvas, type ICanvasRenderingContext } from \"../../Engines/ICanvas\";\r\nimport { RegisterEnginesExtensionsEngineDynamicTexture } from \"../../Engines/Extensions/engine.dynamicTexture.pure\";\r\n\r\n/**\r\n * Interface defining options used to create a dynamic texture\r\n */\r\nexport interface IDynamicTextureOptions extends ITextureCreationOptions {\r\n /** defines the width of the texture (default: 0) */\r\n width?: number;\r\n /** defines the height of the texture (default: 0) */\r\n height?: number;\r\n /** defines the hosting scene (default: null) */\r\n scene?: Nullable<Scene>;\r\n}\r\n\r\n/**\r\n * A class extending Texture allowing drawing on a texture\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/dynamicTexture\r\n */\r\nexport class DynamicTexture extends Texture {\r\n private _generateMipMaps: boolean;\r\n private _canvas: ICanvas;\r\n private _ownCanvas: boolean;\r\n private _context: ICanvasRenderingContext;\r\n\r\n /**\r\n * Creates a DynamicTexture\r\n * @param name defines the name of the texture\r\n * @param canvasOrSize provides 3 alternatives for width and height of texture, a canvas, object with width and height properties, number for both width and height\r\n * @param options The options to be used when constructing the dynamic texture\r\n */\r\n constructor(name: string, canvasOrSize: ICanvas | { width: number; height: number } | number, options?: IDynamicTextureOptions);\r\n\r\n /**\r\n * Creates a DynamicTexture\r\n * @param name defines the name of the texture\r\n * @param options provides 3 alternatives for width and height of texture, a canvas, object with width and height properties, number for both width and height\r\n * @param scene defines the scene where you want the texture\r\n * @param generateMipMaps defines the use of MipMaps or not (default is false)\r\n * @param samplingMode defines the sampling mode to use (default is Texture.TRILINEAR_SAMPLINGMODE)\r\n * @param format defines the texture format to use (default is Engine.TEXTUREFORMAT_RGBA)\r\n * @param invertY defines if the texture needs to be inverted on the y axis during loading\r\n */\r\n constructor(\r\n name: string,\r\n options: ICanvas | { width: number; height: number } | number,\r\n scene?: Nullable<Scene>,\r\n generateMipMaps?: boolean,\r\n samplingMode?: number,\r\n format?: number,\r\n invertY?: boolean\r\n );\r\n\r\n /** @internal */\r\n constructor(\r\n name: string,\r\n canvasOrSize: ICanvas | { width: number; height: number } | number,\r\n sceneOrOptions?: Nullable<Scene> | IDynamicTextureOptions,\r\n generateMipMaps?: boolean,\r\n samplingMode?: number,\r\n format?: number,\r\n invertY?: boolean\r\n );\r\n\r\n /** @internal */\r\n constructor(\r\n name: string,\r\n canvasOrSize: ICanvas | { width: number; height: number } | number,\r\n sceneOrOptions?: Nullable<Scene> | IDynamicTextureOptions,\r\n generateMipMaps: boolean = false,\r\n samplingMode: number = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE,\r\n format: number = Constants.TEXTUREFORMAT_RGBA,\r\n invertY?: boolean\r\n ) {\r\n const isScene = !sceneOrOptions || (sceneOrOptions as Scene)._isScene;\r\n const scene = isScene ? (sceneOrOptions as Scene) : (sceneOrOptions as IDynamicTextureOptions)?.scene;\r\n const noMipmap = isScene ? !generateMipMaps : (sceneOrOptions as IDynamicTextureOptions);\r\n\r\n super(null, scene, noMipmap, invertY, samplingMode, undefined, undefined, undefined, undefined, format);\r\n\r\n RegisterEnginesExtensionsEngineDynamicTexture();\r\n\r\n this.name = name;\r\n this.wrapU = Texture.CLAMP_ADDRESSMODE;\r\n this.wrapV = Texture.CLAMP_ADDRESSMODE;\r\n\r\n this._generateMipMaps = generateMipMaps;\r\n\r\n const engine = this._getEngine();\r\n if (!engine) {\r\n return;\r\n }\r\n\r\n if ((canvasOrSize as ICanvas).getContext) {\r\n this._canvas = canvasOrSize as ICanvas;\r\n this._ownCanvas = false;\r\n this._texture = engine.createDynamicTexture(this._canvas.width, this._canvas.height, generateMipMaps, samplingMode);\r\n } else {\r\n this._canvas = engine.createCanvas(1, 1);\r\n this._ownCanvas = true;\r\n\r\n const optionsAsSize = canvasOrSize as ISize;\r\n if (optionsAsSize.width || optionsAsSize.width === 0) {\r\n this._texture = engine.createDynamicTexture(optionsAsSize.width, optionsAsSize.height, generateMipMaps, samplingMode);\r\n } else {\r\n this._texture = engine.createDynamicTexture(canvasOrSize as number, canvasOrSize as number, generateMipMaps, samplingMode);\r\n }\r\n }\r\n\r\n const textureSize = this.getSize();\r\n\r\n if (this._canvas.width !== textureSize.width) {\r\n this._canvas.width = textureSize.width;\r\n }\r\n if (this._canvas.height !== textureSize.height) {\r\n this._canvas.height = textureSize.height;\r\n }\r\n this._context = this._canvas.getContext(\"2d\");\r\n }\r\n\r\n /**\r\n * Get the current class name of the texture useful for serialization or dynamic coding.\r\n * @returns \"DynamicTexture\"\r\n */\r\n public override getClassName(): string {\r\n return \"DynamicTexture\";\r\n }\r\n\r\n /**\r\n * Gets the current state of canRescale\r\n */\r\n public override get canRescale(): boolean {\r\n return true;\r\n }\r\n\r\n private _recreate(textureSize: ISize): void {\r\n this._canvas.width = textureSize.width;\r\n this._canvas.height = textureSize.height;\r\n\r\n this.releaseInternalTexture();\r\n\r\n this._texture = this._getEngine()!.createDynamicTexture(textureSize.width, textureSize.height, this._generateMipMaps, this.samplingMode);\r\n }\r\n\r\n /**\r\n * Scales the texture\r\n * @param ratio the scale factor to apply to both width and height\r\n */\r\n public override scale(ratio: number): void {\r\n const textureSize = this.getSize();\r\n\r\n textureSize.width *= ratio;\r\n textureSize.height *= ratio;\r\n\r\n this._recreate(textureSize);\r\n }\r\n\r\n /**\r\n * Resizes the texture\r\n * @param width the new width\r\n * @param height the new height\r\n */\r\n public scaleTo(width: number, height: number): void {\r\n const textureSize = this.getSize();\r\n\r\n textureSize.width = width;\r\n textureSize.height = height;\r\n\r\n this._recreate(textureSize);\r\n }\r\n\r\n /**\r\n * Gets the context of the canvas used by the texture\r\n * @returns the canvas context of the dynamic texture\r\n */\r\n public getContext(): ICanvasRenderingContext {\r\n return this._context;\r\n }\r\n\r\n /**\r\n * Clears the texture\r\n * @param clearColor Defines the clear color to use\r\n */\r\n public clear(clearColor?: string): void {\r\n const size = this.getSize();\r\n if (clearColor) {\r\n this._context.fillStyle = clearColor;\r\n }\r\n this._context.clearRect(0, 0, size.width, size.height);\r\n }\r\n\r\n /**\r\n * Updates the texture\r\n * @param invertY defines the direction for the Y axis (default is true - y increases downwards)\r\n * @param premulAlpha defines if alpha is stored as premultiplied (default is false)\r\n * @param allowGPUOptimization true to allow some specific GPU optimizations (subject to engine feature \"allowGPUOptimizationsForGUI\" being true)\r\n */\r\n public update(invertY?: boolean, premulAlpha = false, allowGPUOptimization = false): void {\r\n // When disposed, this._texture will be null.\r\n if (!this._texture) {\r\n return;\r\n }\r\n\r\n this._getEngine()!.updateDynamicTexture(\r\n this._texture,\r\n this._canvas,\r\n invertY === undefined ? true : invertY,\r\n premulAlpha,\r\n this._format || undefined,\r\n undefined,\r\n allowGPUOptimization\r\n );\r\n }\r\n\r\n /**\r\n * Draws text onto the texture\r\n * @param text defines the text to be drawn\r\n * @param x defines the placement of the text from the left\r\n * @param y defines the placement of the text from the top when invertY is true and from the bottom when false\r\n * @param font defines the font to be used with font-style, font-size, font-name\r\n * @param color defines the color used for the text\r\n * @param fillColor defines the color for the canvas, use null to not overwrite canvas (this blends with the background to replace, use the clear function)\r\n * @param invertY defines the direction for the Y axis (default is true - y increases downwards)\r\n * @param update defines whether texture is immediately update (default is true)\r\n */\r\n public drawText(\r\n text: string,\r\n x: number | null | undefined,\r\n y: number | null | undefined,\r\n font: string,\r\n color: string | null,\r\n fillColor: string | null,\r\n invertY?: boolean,\r\n update = true\r\n ) {\r\n const size = this.getSize();\r\n if (fillColor) {\r\n this._context.fillStyle = fillColor;\r\n this._context.fillRect(0, 0, size.width, size.height);\r\n }\r\n\r\n this._context.font = font;\r\n if (x === null || x === undefined) {\r\n const textSize = this._context.measureText(text);\r\n x = (size.width - textSize.width) / 2;\r\n }\r\n if (y === null || y === undefined) {\r\n const fontSize = parseInt(font.replace(/\\D/g, \"\"));\r\n y = size.height / 2 + fontSize / 3.65;\r\n }\r\n\r\n this._context.fillStyle = color || \"\";\r\n this._context.fillText(text, x, y);\r\n\r\n if (update) {\r\n this.update(invertY);\r\n }\r\n }\r\n\r\n /**\r\n * Disposes the dynamic texture.\r\n */\r\n public override dispose(): void {\r\n super.dispose();\r\n\r\n if (this._ownCanvas) {\r\n this._canvas?.remove?.();\r\n }\r\n (this._canvas as any) = null;\r\n (this._context as any) = null;\r\n }\r\n\r\n /**\r\n * Clones the texture\r\n * @returns the clone of the texture.\r\n */\r\n public override clone(): DynamicTexture {\r\n const scene = this.getScene();\r\n\r\n if (!scene) {\r\n return this;\r\n }\r\n\r\n const textureSize = this.getSize();\r\n const newTexture = new DynamicTexture(this.name, textureSize, scene, this._generateMipMaps);\r\n\r\n // Base texture\r\n newTexture.hasAlpha = this.hasAlpha;\r\n newTexture.level = this.level;\r\n\r\n // Dynamic Texture\r\n newTexture.wrapU = this.wrapU;\r\n newTexture.wrapV = this.wrapV;\r\n\r\n return newTexture;\r\n }\r\n\r\n /**\r\n * Serializes the dynamic texture. The scene should be ready before the dynamic texture is serialized\r\n * @returns a serialized dynamic texture object\r\n */\r\n public override serialize(): any {\r\n const scene = this.getScene();\r\n if (scene && !scene.isReady()) {\r\n Logger.Warn(\"The scene must be ready before serializing the dynamic texture\");\r\n }\r\n\r\n const serializationObject = super.serialize();\r\n if (DynamicTexture._IsCanvasElement(this._canvas)) {\r\n serializationObject.base64String = this._canvas.toDataURL();\r\n }\r\n\r\n serializationObject.invertY = this._invertY;\r\n serializationObject.samplingMode = this.samplingMode;\r\n\r\n return serializationObject;\r\n }\r\n\r\n private static _IsCanvasElement(canvas: HTMLCanvasElement | OffscreenCanvas | ICanvas): canvas is HTMLCanvasElement {\r\n return (canvas as HTMLCanvasElement).toDataURL !== undefined;\r\n }\r\n\r\n /** @internal */\r\n public override _rebuild(): void {\r\n this.update();\r\n }\r\n}\r\n"]}
@@ -1,3 +1 @@
1
1
  export * from "./htmlElementTexture.pure.js";
2
- import "../../Engines/Extensions/engine.dynamicTexture.js";
3
- import "../../Engines/Extensions/engine.videoTexture.js";
@@ -1,4 +1,2 @@
1
1
  export * from "./htmlElementTexture.pure.js";
2
- import "../../Engines/Extensions/engine.dynamicTexture.js";
3
- import "../../Engines/Extensions/engine.videoTexture.js";
4
2
  //# sourceMappingURL=htmlElementTexture.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"htmlElementTexture.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/htmlElementTexture.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAE1C,OAAO,gDAAgD,CAAC;AACxD,OAAO,8CAA8C,CAAC","sourcesContent":["export * from \"./htmlElementTexture.pure\";\n\nimport \"../../Engines/Extensions/engine.dynamicTexture\";\nimport \"../../Engines/Extensions/engine.videoTexture\";\n"]}
1
+ {"version":3,"file":"htmlElementTexture.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/htmlElementTexture.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC","sourcesContent":["export * from \"./htmlElementTexture.pure\";\n"]}
@@ -3,6 +3,8 @@ import { BaseTexture } from "../../Materials/Textures/baseTexture.pure.js";
3
3
 
4
4
  import { Matrix } from "../../Maths/math.vector.pure.js";
5
5
  import { Observable } from "../../Misc/observable.pure.js";
6
+ import { RegisterEnginesExtensionsEngineDynamicTexture } from "../../Engines/Extensions/engine.dynamicTexture.pure.js";
7
+ import { RegisterEnginesExtensionsEngineVideoTexture } from "../../Engines/Extensions/engine.videoTexture.pure.js";
6
8
  /**
7
9
  * This represents the smallest workload to use an already existing element (Canvas or Video) as a texture.
8
10
  * To be as efficient as possible depending on your constraints nothing aside the first upload
@@ -26,6 +28,8 @@ export class HtmlElementTexture extends BaseTexture {
26
28
  * Observable triggered once the texture has been loaded.
27
29
  */
28
30
  this.onLoadObservable = new Observable();
31
+ RegisterEnginesExtensionsEngineDynamicTexture();
32
+ RegisterEnginesExtensionsEngineVideoTexture();
29
33
  if (!element || (!options.engine && !options.scene)) {
30
34
  return;
31
35
  }
@@ -1 +1 @@
1
- {"version":3,"file":"htmlElementTexture.pure.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/htmlElementTexture.pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAG7D,OAAO,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAiCxD;;;;;;;;GAQG;AACH,MAAM,OAAO,kBAAmB,SAAQ,WAAW;IA0B/C;;;;;;OAMG;IACH,YAAY,IAAY,EAAE,OAA6C,EAAE,OAAmC;QACxG,KAAK,CAAC,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;QA5B3C;;WAEG;QACI,qBAAgB,GAAmC,IAAI,UAAU,EAAsB,CAAC;QA2B3F,IAAI,CAAC,OAAO,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YAClD,OAAO;QACX,CAAC;QAED,OAAO,GAAG;YACN,GAAG,kBAAkB,CAAC,eAAe;YACrC,GAAG,OAAO;SACb,CAAC;QAEF,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC,eAAgB,CAAC;QACjD,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,YAAa,CAAC;QAC3C,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;QACxC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,MAAO,CAAC;QAE/B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAE,OAA4B,CAAC,uBAAuB,CAAC;QAExE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A6B;IACrD,MAAM,EAAE,SAAS,CAAC,kBAAkB;IACpC,MAAM,EAAE,IAAI;IACZ,KAAK,EAAE,IAAI;CACd,AANsC,CAMrC","sourcesContent":["/** This file must only contain pure code and pure imports */\r\n\r\nimport { type Nullable } from \"../../types\";\r\nimport { BaseTexture } from \"../../Materials/Textures/baseTexture.pure\";\r\nimport { Constants } from \"../../Engines/constants\";\r\nimport { Matrix } from \"../../Maths/math.vector.pure\";\r\nimport { Observable } from \"../../Misc/observable.pure\";\r\nimport { type ExternalTexture } from \"./externalTexture\";\r\n\r\nimport { type AbstractEngine } from \"../../Engines/abstractEngine.pure\";\r\nimport { type Scene } from \"../../scene.pure\";\r\nimport { type WebGPUEngine } from \"core/Engines/webgpuEngine.pure\";\r\n\r\n/**\r\n * Defines the options related to the creation of an HtmlElementTexture\r\n */\r\nexport interface IHtmlElementTextureOptions {\r\n /**\r\n * Defines whether mip maps should be created or not.\r\n */\r\n generateMipMaps?: boolean;\r\n /**\r\n * Defines the sampling mode of the texture.\r\n */\r\n samplingMode?: number;\r\n /**\r\n * Defines the associated texture format.\r\n */\r\n format?: number;\r\n /**\r\n * Defines the engine instance to use the texture with. It is not mandatory if you define a scene.\r\n */\r\n engine: Nullable<AbstractEngine>;\r\n /**\r\n * Defines the scene the texture belongs to. It is not mandatory if you define an engine.\r\n */\r\n scene: Nullable<Scene>;\r\n}\r\n\r\n/**\r\n * This represents the smallest workload to use an already existing element (Canvas or Video) as a texture.\r\n * To be as efficient as possible depending on your constraints nothing aside the first upload\r\n * is automatically managed.\r\n * It is a cheap VideoTexture or DynamicTexture if you prefer to keep full control of the elements\r\n * in your application.\r\n *\r\n * As the update is not automatic, you need to call them manually.\r\n */\r\nexport class HtmlElementTexture extends BaseTexture {\r\n /**\r\n * The texture URL.\r\n */\r\n public element: HTMLVideoElement | HTMLCanvasElement;\r\n\r\n /**\r\n * Observable triggered once the texture has been loaded.\r\n */\r\n public onLoadObservable: Observable<HtmlElementTexture> = new Observable<HtmlElementTexture>();\r\n\r\n private static readonly _DefaultOptions: IHtmlElementTextureOptions = {\r\n generateMipMaps: false,\r\n samplingMode: Constants.TEXTURE_BILINEAR_SAMPLINGMODE,\r\n format: Constants.TEXTUREFORMAT_RGBA,\r\n engine: null,\r\n scene: null,\r\n };\r\n\r\n private readonly _format: number;\r\n private _textureMatrix: Matrix;\r\n private _isVideo: boolean;\r\n private _generateMipMaps: boolean;\r\n private _samplingMode: number;\r\n private _externalTexture: Nullable<ExternalTexture>;\r\n\r\n /**\r\n * Instantiates a HtmlElementTexture from the following parameters.\r\n *\r\n * @param name Defines the name of the texture\r\n * @param element Defines the video or canvas the texture is filled with\r\n * @param options Defines the other none mandatory texture creation options\r\n */\r\n constructor(name: string, element: HTMLVideoElement | HTMLCanvasElement, options: IHtmlElementTextureOptions) {\r\n super(options.scene || options.engine);\r\n\r\n if (!element || (!options.engine && !options.scene)) {\r\n return;\r\n }\r\n\r\n options = {\r\n ...HtmlElementTexture._DefaultOptions,\r\n ...options,\r\n };\r\n\r\n this._generateMipMaps = options.generateMipMaps!;\r\n this._samplingMode = options.samplingMode!;\r\n this._textureMatrix = Matrix.Identity();\r\n this._format = options.format!;\r\n\r\n this.name = name;\r\n this.element = element;\r\n this._isVideo = !!(element as HTMLVideoElement).getVideoPlaybackQuality;\r\n\r\n if (this._isVideo) {\r\n const engineWebGPU = this._engine as Nullable<WebGPUEngine>;\r\n const createExternalTexture = engineWebGPU?.createExternalTexture;\r\n if (createExternalTexture) {\r\n this._externalTexture = createExternalTexture.call(engineWebGPU, element as HTMLVideoElement);\r\n }\r\n }\r\n\r\n this.anisotropicFilteringLevel = 1;\r\n\r\n this._createInternalTexture();\r\n }\r\n\r\n private _createInternalTexture(): void {\r\n let width: number;\r\n let height: number;\r\n if (this._isVideo) {\r\n width = (this.element as HTMLVideoElement).videoWidth;\r\n height = (this.element as HTMLVideoElement).videoHeight;\r\n } else {\r\n width = this.element.width;\r\n height = this.element.height;\r\n }\r\n\r\n const engine = this._getEngine();\r\n if (engine) {\r\n this._texture = engine.createDynamicTexture(width, height, this._generateMipMaps, this._samplingMode);\r\n this._texture.format = this._format;\r\n }\r\n\r\n this.update();\r\n }\r\n\r\n /**\r\n * @returns the texture matrix used in most of the material.\r\n */\r\n public override getTextureMatrix(): Matrix {\r\n return this._textureMatrix;\r\n }\r\n\r\n /**\r\n * Updates the content of the texture.\r\n * @param invertY Defines whether the texture should be inverted on Y (false by default on video and true on canvas)\r\n */\r\n public update(invertY: Nullable<boolean> = null): void {\r\n const engine = this._getEngine();\r\n if (this._texture == null || engine == null) {\r\n return;\r\n }\r\n\r\n const wasReady = this.isReady();\r\n if (this._isVideo) {\r\n const videoElement = this.element as HTMLVideoElement;\r\n if (videoElement.readyState < videoElement.HAVE_CURRENT_DATA) {\r\n return;\r\n }\r\n\r\n engine.updateVideoTexture(this._texture, this._externalTexture ? this._externalTexture : videoElement, invertY === null ? true : invertY);\r\n } else {\r\n const canvasElement = this.element as HTMLCanvasElement;\r\n engine.updateDynamicTexture(this._texture, canvasElement, invertY === null ? true : invertY, false, this._format);\r\n }\r\n\r\n if (!wasReady && this.isReady()) {\r\n this.onLoadObservable.notifyObservers(this);\r\n }\r\n }\r\n\r\n /**\r\n * Dispose the texture and release its associated resources.\r\n */\r\n public override dispose(): void {\r\n this.onLoadObservable.clear();\r\n super.dispose();\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"htmlElementTexture.pure.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/htmlElementTexture.pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAG7D,OAAO,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAMxD,OAAO,EAAE,6CAA6C,EAAE,MAAM,qDAAqD,CAAC;A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,CAAC,OAA2B,CAAC;YACtD,IAAI,YAAY,CAAC,UAAU,GAAG,YAAY,CAAC,iBAAiB,EAAE,CAAC;gBAC3D,OAAO;YACX,CAAC;YAED,MAAM,CAAC,kBAAkB,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,YAAY,EAAE,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;QAC9I,CAAC;aAAM,CAAC;YACJ,MAAM,aAAa,GAAG,IAAI,CAAC,OAA4B,CAAC;YACxD,MAAM,CAAC,oBAAoB,CAAC,IAAI,CAAC,QAAQ,EAAE,aAAa,EAAE,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACtH,CAAC;QAED,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC;YAC9B,IAAI,CAAC,gBAAgB,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;QAChD,CAAC;IACL,CAAC;IAED;;OAEG;IACa,OAAO;QACnB,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAC;QAC9B,KAAK,CAAC,OAAO,EAAE,CAAC;IACpB,CAAC;;AAxHuB,kCAAe,GAA+B;IAClE,eAAe,EAAE,KAAK;IACtB,YAAY,EAAE,SAAS,CAAC,6BAA6B;IACrD,MAAM,EAAE,SAAS,CAAC,kBAAkB;IACpC,MAAM,EAAE,IAAI;IACZ,KAAK,EAAE,IAAI;CACd,AANsC,CAMrC","sourcesContent":["/** This file must only contain pure code and pure imports */\r\n\r\nimport { type Nullable } from \"../../types\";\r\nimport { BaseTexture } from \"../../Materials/Textures/baseTexture.pure\";\r\nimport { Constants } from \"../../Engines/constants\";\r\nimport { Matrix } from \"../../Maths/math.vector.pure\";\r\nimport { Observable } from \"../../Misc/observable.pure\";\r\nimport { type ExternalTexture } from \"./externalTexture\";\r\n\r\nimport { type AbstractEngine } from \"../../Engines/abstractEngine.pure\";\r\nimport { type Scene } from \"../../scene.pure\";\r\nimport { type WebGPUEngine } from \"core/Engines/webgpuEngine.pure\";\r\nimport { RegisterEnginesExtensionsEngineDynamicTexture } from \"../../Engines/Extensions/engine.dynamicTexture.pure\";\r\nimport { RegisterEnginesExtensionsEngineVideoTexture } from \"../../Engines/Extensions/engine.videoTexture.pure\";\r\n\r\n/**\r\n * Defines the options related to the creation of an HtmlElementTexture\r\n */\r\nexport interface IHtmlElementTextureOptions {\r\n /**\r\n * Defines whether mip maps should be created or not.\r\n */\r\n generateMipMaps?: boolean;\r\n /**\r\n * Defines the sampling mode of the texture.\r\n */\r\n samplingMode?: number;\r\n /**\r\n * Defines the associated texture format.\r\n */\r\n format?: number;\r\n /**\r\n * Defines the engine instance to use the texture with. It is not mandatory if you define a scene.\r\n */\r\n engine: Nullable<AbstractEngine>;\r\n /**\r\n * Defines the scene the texture belongs to. It is not mandatory if you define an engine.\r\n */\r\n scene: Nullable<Scene>;\r\n}\r\n\r\n/**\r\n * This represents the smallest workload to use an already existing element (Canvas or Video) as a texture.\r\n * To be as efficient as possible depending on your constraints nothing aside the first upload\r\n * is automatically managed.\r\n * It is a cheap VideoTexture or DynamicTexture if you prefer to keep full control of the elements\r\n * in your application.\r\n *\r\n * As the update is not automatic, you need to call them manually.\r\n */\r\nexport class HtmlElementTexture extends BaseTexture {\r\n /**\r\n * The texture URL.\r\n */\r\n public element: HTMLVideoElement | HTMLCanvasElement;\r\n\r\n /**\r\n * Observable triggered once the texture has been loaded.\r\n */\r\n public onLoadObservable: Observable<HtmlElementTexture> = new Observable<HtmlElementTexture>();\r\n\r\n private static readonly _DefaultOptions: IHtmlElementTextureOptions = {\r\n generateMipMaps: false,\r\n samplingMode: Constants.TEXTURE_BILINEAR_SAMPLINGMODE,\r\n format: Constants.TEXTUREFORMAT_RGBA,\r\n engine: null,\r\n scene: null,\r\n };\r\n\r\n private readonly _format: number;\r\n private _textureMatrix: Matrix;\r\n private _isVideo: boolean;\r\n private _generateMipMaps: boolean;\r\n private _samplingMode: number;\r\n private _externalTexture: Nullable<ExternalTexture>;\r\n\r\n /**\r\n * Instantiates a HtmlElementTexture from the following parameters.\r\n *\r\n * @param name Defines the name of the texture\r\n * @param element Defines the video or canvas the texture is filled with\r\n * @param options Defines the other none mandatory texture creation options\r\n */\r\n constructor(name: string, element: HTMLVideoElement | HTMLCanvasElement, options: IHtmlElementTextureOptions) {\r\n super(options.scene || options.engine);\r\n\r\n RegisterEnginesExtensionsEngineDynamicTexture();\r\n RegisterEnginesExtensionsEngineVideoTexture();\r\n\r\n if (!element || (!options.engine && !options.scene)) {\r\n return;\r\n }\r\n\r\n options = {\r\n ...HtmlElementTexture._DefaultOptions,\r\n ...options,\r\n };\r\n\r\n this._generateMipMaps = options.generateMipMaps!;\r\n this._samplingMode = options.samplingMode!;\r\n this._textureMatrix = Matrix.Identity();\r\n this._format = options.format!;\r\n\r\n this.name = name;\r\n this.element = element;\r\n this._isVideo = !!(element as HTMLVideoElement).getVideoPlaybackQuality;\r\n\r\n if (this._isVideo) {\r\n const engineWebGPU = this._engine as Nullable<WebGPUEngine>;\r\n const createExternalTexture = engineWebGPU?.createExternalTexture;\r\n if (createExternalTexture) {\r\n this._externalTexture = createExternalTexture.call(engineWebGPU, element as HTMLVideoElement);\r\n }\r\n }\r\n\r\n this.anisotropicFilteringLevel = 1;\r\n\r\n this._createInternalTexture();\r\n }\r\n\r\n private _createInternalTexture(): void {\r\n let width: number;\r\n let height: number;\r\n if (this._isVideo) {\r\n width = (this.element as HTMLVideoElement).videoWidth;\r\n height = (this.element as HTMLVideoElement).videoHeight;\r\n } else {\r\n width = this.element.width;\r\n height = this.element.height;\r\n }\r\n\r\n const engine = this._getEngine();\r\n if (engine) {\r\n this._texture = engine.createDynamicTexture(width, height, this._generateMipMaps, this._samplingMode);\r\n this._texture.format = this._format;\r\n }\r\n\r\n this.update();\r\n }\r\n\r\n /**\r\n * @returns the texture matrix used in most of the material.\r\n */\r\n public override getTextureMatrix(): Matrix {\r\n return this._textureMatrix;\r\n }\r\n\r\n /**\r\n * Updates the content of the texture.\r\n * @param invertY Defines whether the texture should be inverted on Y (false by default on video and true on canvas)\r\n */\r\n public update(invertY: Nullable<boolean> = null): void {\r\n const engine = this._getEngine();\r\n if (this._texture == null || engine == null) {\r\n return;\r\n }\r\n\r\n const wasReady = this.isReady();\r\n if (this._isVideo) {\r\n const videoElement = this.element as HTMLVideoElement;\r\n if (videoElement.readyState < videoElement.HAVE_CURRENT_DATA) {\r\n return;\r\n }\r\n\r\n engine.updateVideoTexture(this._texture, this._externalTexture ? this._externalTexture : videoElement, invertY === null ? true : invertY);\r\n } else {\r\n const canvasElement = this.element as HTMLCanvasElement;\r\n engine.updateDynamicTexture(this._texture, canvasElement, invertY === null ? true : invertY, false, this._format);\r\n }\r\n\r\n if (!wasReady && this.isReady()) {\r\n this.onLoadObservable.notifyObservers(this);\r\n }\r\n }\r\n\r\n /**\r\n * Dispose the texture and release its associated resources.\r\n */\r\n public override dispose(): void {\r\n this.onLoadObservable.clear();\r\n super.dispose();\r\n }\r\n}\r\n"]}
@@ -10,6 +10,7 @@ export * from "./envCubeTexture.js";
10
10
  export * from "./hdrCubeTexture.js";
11
11
  export * from "./exrCubeTexture.js";
12
12
  export * from "./htmlElementTexture.js";
13
+ export * from "./HTML/index.js";
13
14
  export * from "./internalTexture.js";
14
15
  export * from "./Loaders/index.js";
15
16
  export * from "./mirrorTexture.js";