@onerjs/core 9.0.2 → 9.0.3

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 (473) hide show
  1. package/Buffers/buffer.pure.js +4 -0
  2. package/Buffers/buffer.pure.js.map +1 -1
  3. package/Cameras/camera.pure.d.ts +14 -0
  4. package/Cameras/camera.pure.js +15 -0
  5. package/Cameras/camera.pure.js.map +1 -1
  6. package/Compute/computeShader.pure.d.ts +2 -1
  7. package/Compute/computeShader.pure.js +29 -10
  8. package/Compute/computeShader.pure.js.map +1 -1
  9. package/Culling/ray.core.js +22 -9
  10. package/Culling/ray.core.js.map +1 -1
  11. package/Engines/IDrawContext.d.ts +2 -0
  12. package/Engines/IDrawContext.js.map +1 -1
  13. package/Engines/Native/nativeInterfaces.d.ts +55 -4
  14. package/Engines/Native/nativeInterfaces.js.map +1 -1
  15. package/Engines/Native/nativeRenderTargetWrapper.d.ts +1 -0
  16. package/Engines/Native/nativeRenderTargetWrapper.js +5 -1
  17. package/Engines/Native/nativeRenderTargetWrapper.js.map +1 -1
  18. package/Engines/Processors/shaderCodeInliner.d.ts +2 -0
  19. package/Engines/Processors/shaderCodeInliner.js +251 -6
  20. package/Engines/Processors/shaderCodeInliner.js.map +1 -1
  21. package/Engines/Processors/shaderProcessor.js +10 -1
  22. package/Engines/Processors/shaderProcessor.js.map +1 -1
  23. package/Engines/WebGPU/Extensions/engine.debugging.pure.js +12 -0
  24. package/Engines/WebGPU/Extensions/engine.debugging.pure.js.map +1 -1
  25. package/Engines/WebGPU/Extensions/engine.multiRender.pure.js +0 -1
  26. package/Engines/WebGPU/Extensions/engine.multiRender.pure.js.map +1 -1
  27. package/Engines/WebGPU/Extensions/engine.query.pure.js +5 -0
  28. package/Engines/WebGPU/Extensions/engine.query.pure.js.map +1 -1
  29. package/Engines/WebGPU/webgpuBufferManager.js +7 -0
  30. package/Engines/WebGPU/webgpuBufferManager.js.map +1 -1
  31. package/Engines/WebGPU/webgpuCacheTextureView.d.ts +1 -1
  32. package/Engines/WebGPU/webgpuCacheTextureView.js +20 -8
  33. package/Engines/WebGPU/webgpuCacheTextureView.js.map +1 -1
  34. package/Engines/WebGPU/webgpuDrawContext.d.ts +2 -0
  35. package/Engines/WebGPU/webgpuDrawContext.js +6 -0
  36. package/Engines/WebGPU/webgpuDrawContext.js.map +1 -1
  37. package/Engines/WebGPU/webgpuQuerySet.d.ts +3 -3
  38. package/Engines/WebGPU/webgpuQuerySet.js +23 -9
  39. package/Engines/WebGPU/webgpuQuerySet.js.map +1 -1
  40. package/Engines/WebGPU/webgpuRenderPassCommandStream.d.ts +156 -0
  41. package/Engines/WebGPU/webgpuRenderPassCommandStream.js +323 -0
  42. package/Engines/WebGPU/webgpuRenderPassCommandStream.js.map +1 -0
  43. package/Engines/WebGPU/webgpuTextureManager.d.ts +1 -1
  44. package/Engines/WebGPU/webgpuTextureManager.js +4 -3
  45. package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
  46. package/Engines/WebGPU/webgpuTimestampQuery.d.ts +3 -1
  47. package/Engines/WebGPU/webgpuTimestampQuery.js +9 -6
  48. package/Engines/WebGPU/webgpuTimestampQuery.js.map +1 -1
  49. package/Engines/abstractEngine.pure.d.ts +2 -0
  50. package/Engines/abstractEngine.pure.js +14 -5
  51. package/Engines/abstractEngine.pure.js.map +1 -1
  52. package/Engines/constants.d.ts +6 -0
  53. package/Engines/constants.js +6 -0
  54. package/Engines/constants.js.map +1 -1
  55. package/Engines/engine.d.ts +198 -24
  56. package/Engines/pure.d.ts +1 -0
  57. package/Engines/pure.js +1 -0
  58. package/Engines/pure.js.map +1 -1
  59. package/Engines/renderCommandBatcher.pure.d.ts +16 -0
  60. package/Engines/renderCommandBatcher.pure.js +24 -0
  61. package/Engines/renderCommandBatcher.pure.js.map +1 -0
  62. package/Engines/thinEngine.functions.js +3 -2
  63. package/Engines/thinEngine.functions.js.map +1 -1
  64. package/Engines/thinEngine.pure.js +18 -2
  65. package/Engines/thinEngine.pure.js.map +1 -1
  66. package/Engines/thinNativeEngine.pure.d.ts +10 -7
  67. package/Engines/thinNativeEngine.pure.js +117 -46
  68. package/Engines/thinNativeEngine.pure.js.map +1 -1
  69. package/Engines/thinWebGPUEngine.d.ts +8 -0
  70. package/Engines/thinWebGPUEngine.js +11 -0
  71. package/Engines/thinWebGPUEngine.js.map +1 -1
  72. package/Engines/webgpuEngine.pure.d.ts +60 -1
  73. package/Engines/webgpuEngine.pure.js +238 -42
  74. package/Engines/webgpuEngine.pure.js.map +1 -1
  75. package/FlowGraph/Blocks/Data/Audio/flowGraphGetSoundVolumeBlock.pure.d.ts +3 -3
  76. package/FlowGraph/Blocks/Data/Audio/flowGraphGetSoundVolumeBlock.pure.js +2 -1
  77. package/FlowGraph/Blocks/Data/Audio/flowGraphGetSoundVolumeBlock.pure.js.map +1 -1
  78. package/FlowGraph/Blocks/Data/Audio/flowGraphIsSoundPlayingBlock.pure.d.ts +3 -3
  79. package/FlowGraph/Blocks/Data/Audio/flowGraphIsSoundPlayingBlock.pure.js +2 -1
  80. package/FlowGraph/Blocks/Data/Audio/flowGraphIsSoundPlayingBlock.pure.js.map +1 -1
  81. package/FlowGraph/Blocks/Event/flowGraphMeshIntersectionEventBlock.d.ts +5 -0
  82. package/FlowGraph/Blocks/Event/flowGraphMeshIntersectionEventBlock.js +8 -0
  83. package/FlowGraph/Blocks/Event/flowGraphMeshIntersectionEventBlock.js.map +1 -0
  84. package/FlowGraph/Blocks/Event/flowGraphMeshIntersectionEventBlock.pure.d.ts +77 -0
  85. package/FlowGraph/Blocks/Event/flowGraphMeshIntersectionEventBlock.pure.js +141 -0
  86. package/FlowGraph/Blocks/Event/flowGraphMeshIntersectionEventBlock.pure.js.map +1 -0
  87. package/FlowGraph/Blocks/Event/flowGraphSoundEndedEventBlock.pure.d.ts +5 -3
  88. package/FlowGraph/Blocks/Event/flowGraphSoundEndedEventBlock.pure.js +38 -7
  89. package/FlowGraph/Blocks/Event/flowGraphSoundEndedEventBlock.pure.js.map +1 -1
  90. package/FlowGraph/Blocks/Event/index.d.ts +1 -0
  91. package/FlowGraph/Blocks/Event/index.js +1 -0
  92. package/FlowGraph/Blocks/Event/index.js.map +1 -1
  93. package/FlowGraph/Blocks/Event/pure.d.ts +1 -0
  94. package/FlowGraph/Blocks/Event/pure.js +1 -0
  95. package/FlowGraph/Blocks/Event/pure.js.map +1 -1
  96. package/FlowGraph/Blocks/Execution/Audio/flowGraphPauseSoundBlock.pure.d.ts +3 -3
  97. package/FlowGraph/Blocks/Execution/Audio/flowGraphPauseSoundBlock.pure.js +2 -1
  98. package/FlowGraph/Blocks/Execution/Audio/flowGraphPauseSoundBlock.pure.js.map +1 -1
  99. package/FlowGraph/Blocks/Execution/Audio/flowGraphPlaySoundBlock.pure.d.ts +3 -3
  100. package/FlowGraph/Blocks/Execution/Audio/flowGraphPlaySoundBlock.pure.js +2 -1
  101. package/FlowGraph/Blocks/Execution/Audio/flowGraphPlaySoundBlock.pure.js.map +1 -1
  102. package/FlowGraph/Blocks/Execution/Audio/flowGraphSetSoundVolumeBlock.pure.d.ts +3 -3
  103. package/FlowGraph/Blocks/Execution/Audio/flowGraphSetSoundVolumeBlock.pure.js +2 -1
  104. package/FlowGraph/Blocks/Execution/Audio/flowGraphSetSoundVolumeBlock.pure.js.map +1 -1
  105. package/FlowGraph/Blocks/Execution/Audio/flowGraphStopSoundBlock.pure.d.ts +3 -3
  106. package/FlowGraph/Blocks/Execution/Audio/flowGraphStopSoundBlock.pure.js +2 -1
  107. package/FlowGraph/Blocks/Execution/Audio/flowGraphStopSoundBlock.pure.js.map +1 -1
  108. package/FlowGraph/Blocks/allBlocks.pure.js +2 -0
  109. package/FlowGraph/Blocks/allBlocks.pure.js.map +1 -1
  110. package/FlowGraph/Blocks/flowGraphBlockFactory.js +2 -0
  111. package/FlowGraph/Blocks/flowGraphBlockFactory.js.map +1 -1
  112. package/FlowGraph/Blocks/flowGraphBlockNames.d.ts +1 -0
  113. package/FlowGraph/Blocks/flowGraphBlockNames.js +1 -0
  114. package/FlowGraph/Blocks/flowGraphBlockNames.js.map +1 -1
  115. package/FlowGraph/flowGraph.d.ts +12 -1
  116. package/FlowGraph/flowGraph.js +38 -0
  117. package/FlowGraph/flowGraph.js.map +1 -1
  118. package/FlowGraph/flowGraphCoordinator.d.ts +44 -0
  119. package/FlowGraph/flowGraphCoordinator.js +141 -0
  120. package/FlowGraph/flowGraphCoordinator.js.map +1 -1
  121. package/FlowGraph/flowGraphDataConnection.pure.js +41 -14
  122. package/FlowGraph/flowGraphDataConnection.pure.js.map +1 -1
  123. package/FlowGraph/flowGraphParser.js +105 -5
  124. package/FlowGraph/flowGraphParser.js.map +1 -1
  125. package/FlowGraph/flowGraphSoundAssets.d.ts +40 -0
  126. package/FlowGraph/flowGraphSoundAssets.js +33 -0
  127. package/FlowGraph/flowGraphSoundAssets.js.map +1 -0
  128. package/FlowGraph/index.d.ts +1 -0
  129. package/FlowGraph/index.js +1 -0
  130. package/FlowGraph/index.js.map +1 -1
  131. package/FlowGraph/pure.d.ts +1 -0
  132. package/FlowGraph/pure.js +1 -0
  133. package/FlowGraph/pure.js.map +1 -1
  134. package/FlowGraph/serialization.d.ts +8 -0
  135. package/FlowGraph/serialization.js +31 -12
  136. package/FlowGraph/serialization.js.map +1 -1
  137. package/FlowGraph/typeDefinitions.d.ts +25 -0
  138. package/FlowGraph/typeDefinitions.js.map +1 -1
  139. package/FrameGraph/Tasks/PostProcesses/taaTask.js +2 -0
  140. package/FrameGraph/Tasks/PostProcesses/taaTask.js.map +1 -1
  141. package/Instrumentation/engineInstrumentation.d.ts +1 -0
  142. package/Instrumentation/engineInstrumentation.js +25 -6
  143. package/Instrumentation/engineInstrumentation.js.map +1 -1
  144. package/Lights/Clustered/clusteredLightContainer.pure.js +2 -0
  145. package/Lights/Clustered/clusteredLightContainer.pure.js.map +1 -1
  146. package/Lights/Shadows/cascadedShadowGenerator.pure.d.ts +36 -1
  147. package/Lights/Shadows/cascadedShadowGenerator.pure.js +202 -27
  148. package/Lights/Shadows/cascadedShadowGenerator.pure.js.map +1 -1
  149. package/Lights/directionalLight.pure.d.ts +24 -10
  150. package/Lights/directionalLight.pure.js +29 -11
  151. package/Lights/directionalLight.pure.js.map +1 -1
  152. package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.js +4 -4
  153. package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.js.map +1 -1
  154. package/Materials/Node/Blocks/Dual/lightBlock.pure.js +1 -1
  155. package/Materials/Node/Blocks/Dual/lightBlock.pure.js.map +1 -1
  156. package/Materials/Node/Blocks/Input/inputBlock.pure.js +4 -0
  157. package/Materials/Node/Blocks/Input/inputBlock.pure.js.map +1 -1
  158. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.pure.d.ts +9 -0
  159. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.pure.js +23 -3
  160. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.pure.js.map +1 -1
  161. package/Materials/PBR/openpbrMaterial.pure.js +1 -1
  162. package/Materials/PBR/openpbrMaterial.pure.js.map +1 -1
  163. package/Materials/PBR/pbrBaseMaterial.pure.d.ts +9 -0
  164. package/Materials/PBR/pbrBaseMaterial.pure.js +60 -1
  165. package/Materials/PBR/pbrBaseMaterial.pure.js.map +1 -1
  166. package/Materials/PBR/pbrBaseSimpleMaterial.d.ts +11 -0
  167. package/Materials/PBR/pbrBaseSimpleMaterial.js +21 -2
  168. package/Materials/PBR/pbrBaseSimpleMaterial.js.map +1 -1
  169. package/Materials/PBR/pbrMaterial.pure.d.ts +12 -0
  170. package/Materials/PBR/pbrMaterial.pure.js +23 -3
  171. package/Materials/PBR/pbrMaterial.pure.js.map +1 -1
  172. package/Materials/Textures/Filtering/hdrIrradianceFiltering.d.ts +1 -0
  173. package/Materials/Textures/Filtering/hdrIrradianceFiltering.js +10 -0
  174. package/Materials/Textures/Filtering/hdrIrradianceFiltering.js.map +1 -1
  175. package/Materials/Textures/HTML/htmlInCanvasPolyfill.d.ts +5 -0
  176. package/Materials/Textures/HTML/htmlInCanvasPolyfill.js +7 -0
  177. package/Materials/Textures/HTML/htmlInCanvasPolyfill.js.map +1 -1
  178. package/Materials/Textures/HTML/htmlInteractionManager.d.ts +9 -3
  179. package/Materials/Textures/HTML/htmlInteractionManager.js +64 -5
  180. package/Materials/Textures/HTML/htmlInteractionManager.js.map +1 -1
  181. package/Materials/Textures/HTML/htmlTexture.d.ts +11 -11
  182. package/Materials/Textures/HTML/htmlTexture.js +106 -65
  183. package/Materials/Textures/HTML/htmlTexture.js.map +1 -1
  184. package/Materials/Textures/Loaders/internalTextureLoader.d.ts +2 -1
  185. package/Materials/Textures/Loaders/internalTextureLoader.js.map +1 -1
  186. package/Materials/Textures/Loaders/ktxTextureLoader.d.ts +2 -1
  187. package/Materials/Textures/Loaders/ktxTextureLoader.js +4 -50
  188. package/Materials/Textures/Loaders/ktxTextureLoader.js.map +1 -1
  189. package/Materials/Textures/Procedurals/proceduralTexture.pure.js +10 -0
  190. package/Materials/Textures/Procedurals/proceduralTexture.pure.js.map +1 -1
  191. package/Materials/Textures/dynamicTexture.pure.js +6 -0
  192. package/Materials/Textures/dynamicTexture.pure.js.map +1 -1
  193. package/Materials/Textures/ktx2encoderTypes.d.ts +51 -0
  194. package/Materials/Textures/ktx2encoderTypes.js +2 -0
  195. package/Materials/Textures/ktx2encoderTypes.js.map +1 -0
  196. package/Materials/Textures/renderTargetTexture.pure.js +10 -2
  197. package/Materials/Textures/renderTargetTexture.pure.js.map +1 -1
  198. package/Materials/Textures/textureMerger.d.ts +11 -0
  199. package/Materials/Textures/textureMerger.js +34 -19
  200. package/Materials/Textures/textureMerger.js.map +1 -1
  201. package/Materials/Textures/textureProcessor.d.ts +145 -0
  202. package/Materials/Textures/textureProcessor.js +445 -45
  203. package/Materials/Textures/textureProcessor.js.map +1 -1
  204. package/Materials/Textures/textureSampling.functions.d.ts +41 -0
  205. package/Materials/Textures/textureSampling.functions.js +82 -0
  206. package/Materials/Textures/textureSampling.functions.js.map +1 -0
  207. package/Materials/drawWrapper.d.ts +8 -0
  208. package/Materials/drawWrapper.js +19 -0
  209. package/Materials/drawWrapper.js.map +1 -1
  210. package/Materials/effect.pure.d.ts +6 -0
  211. package/Materials/effect.pure.js +28 -6
  212. package/Materials/effect.pure.js.map +1 -1
  213. package/Materials/effect.webgl.functions.pure.js +1 -1
  214. package/Materials/effect.webgl.functions.pure.js.map +1 -1
  215. package/Materials/material.pure.d.ts +5 -0
  216. package/Materials/material.pure.js +9 -2
  217. package/Materials/material.pure.js.map +1 -1
  218. package/Materials/materialFlags.d.ts +6 -0
  219. package/Materials/materialFlags.js +14 -0
  220. package/Materials/materialFlags.js.map +1 -1
  221. package/Materials/materialHelper.functions.d.ts +2 -1
  222. package/Materials/materialHelper.functions.js +36 -2
  223. package/Materials/materialHelper.functions.js.map +1 -1
  224. package/Materials/materialHelper.geometryrendering.js +19 -16
  225. package/Materials/materialHelper.geometryrendering.js.map +1 -1
  226. package/Materials/materialPluginManager.pure.js +12 -8
  227. package/Materials/materialPluginManager.pure.js.map +1 -1
  228. package/Materials/prePassConfiguration.js +19 -16
  229. package/Materials/prePassConfiguration.js.map +1 -1
  230. package/Materials/shaderMaterial.pure.js +19 -6
  231. package/Materials/shaderMaterial.pure.js.map +1 -1
  232. package/Materials/shadowDepthWrapper.d.ts +6 -0
  233. package/Materials/shadowDepthWrapper.js +17 -0
  234. package/Materials/shadowDepthWrapper.js.map +1 -1
  235. package/Meshes/Compression/dracoCodec.d.ts +14 -0
  236. package/Meshes/Compression/dracoCodec.js +22 -0
  237. package/Meshes/Compression/dracoCodec.js.map +1 -1
  238. package/Meshes/Compression/dracoDecoder.d.ts +1 -0
  239. package/Meshes/Compression/dracoDecoder.js +27 -0
  240. package/Meshes/Compression/dracoDecoder.js.map +1 -1
  241. package/Meshes/Compression/dracoEncoder.d.ts +1 -0
  242. package/Meshes/Compression/dracoEncoder.js +8 -0
  243. package/Meshes/Compression/dracoEncoder.js.map +1 -1
  244. package/Meshes/Compression/meshoptCompression.d.ts +1 -0
  245. package/Meshes/Compression/meshoptCompression.js +9 -0
  246. package/Meshes/Compression/meshoptCompression.js.map +1 -1
  247. package/Meshes/GaussianSplatting/gaussianSplattingGpuSorter.d.ts +415 -0
  248. package/Meshes/GaussianSplatting/gaussianSplattingGpuSorter.js +912 -0
  249. package/Meshes/GaussianSplatting/gaussianSplattingGpuSorter.js.map +1 -0
  250. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.d.ts +3 -0
  251. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js +40 -9
  252. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js.map +1 -1
  253. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.d.ts +112 -8
  254. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js +696 -74
  255. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js.map +1 -1
  256. package/Meshes/abstractMesh.pure.js +12 -4
  257. package/Meshes/abstractMesh.pure.js.map +1 -1
  258. package/Meshes/geometry.d.ts +5 -0
  259. package/Meshes/geometry.js +25 -0
  260. package/Meshes/geometry.js.map +1 -1
  261. package/Meshes/index.d.ts +1 -0
  262. package/Meshes/index.js +1 -0
  263. package/Meshes/index.js.map +1 -1
  264. package/Meshes/mesh.pure.d.ts +7 -0
  265. package/Meshes/mesh.pure.js +18 -13
  266. package/Meshes/mesh.pure.js.map +1 -1
  267. package/Meshes/pure.d.ts +1 -0
  268. package/Meshes/pure.js +1 -0
  269. package/Meshes/pure.js.map +1 -1
  270. package/Meshes/subMesh.pure.d.ts +3 -0
  271. package/Meshes/subMesh.pure.js +26 -0
  272. package/Meshes/subMesh.pure.js.map +1 -1
  273. package/Meshes/thinInstanceMesh.pure.js +5 -3
  274. package/Meshes/thinInstanceMesh.pure.js.map +1 -1
  275. package/Misc/index.d.ts +1 -0
  276. package/Misc/index.js +1 -0
  277. package/Misc/index.js.map +1 -1
  278. package/Misc/khronosTextureContainer2.d.ts +3 -2
  279. package/Misc/khronosTextureContainer2.js +24 -6
  280. package/Misc/khronosTextureContainer2.js.map +1 -1
  281. package/Misc/khronosTextureContainer2Encoder.d.ts +166 -0
  282. package/Misc/khronosTextureContainer2Encoder.js +556 -0
  283. package/Misc/khronosTextureContainer2Encoder.js.map +1 -0
  284. package/Misc/khronosTextureContainer2EncoderWorker.d.ts +61 -0
  285. package/Misc/khronosTextureContainer2EncoderWorker.js +55 -0
  286. package/Misc/khronosTextureContainer2EncoderWorker.js.map +1 -0
  287. package/Misc/pure.d.ts +1 -0
  288. package/Misc/pure.js +1 -0
  289. package/Misc/pure.js.map +1 -1
  290. package/Misc/textureFormat.functions.d.ts +6 -0
  291. package/Misc/textureFormat.functions.js +54 -0
  292. package/Misc/textureFormat.functions.js.map +1 -0
  293. package/Misc/textureTools.d.ts +6 -2
  294. package/Misc/textureTools.js +100 -42
  295. package/Misc/textureTools.js.map +1 -1
  296. package/Misc/tools.pure.js +1 -1
  297. package/Misc/tools.pure.js.map +1 -1
  298. package/Particles/Node/Blocks/systemBlock.pure.d.ts +1 -1
  299. package/Particles/Node/Blocks/systemBlock.pure.js +6 -3
  300. package/Particles/Node/Blocks/systemBlock.pure.js.map +1 -1
  301. package/Particles/computeShaderParticleSystem.pure.js +5 -0
  302. package/Particles/computeShaderParticleSystem.pure.js.map +1 -1
  303. package/Particles/gpuParticleSystem.pure.d.ts +2 -0
  304. package/Particles/gpuParticleSystem.pure.js +25 -1
  305. package/Particles/gpuParticleSystem.pure.js.map +1 -1
  306. package/Particles/solidParticle.d.ts +5 -0
  307. package/Particles/solidParticle.js +5 -0
  308. package/Particles/solidParticle.js.map +1 -1
  309. package/Particles/solidParticleSystem.d.ts +10 -0
  310. package/Particles/solidParticleSystem.js +72 -13
  311. package/Particles/solidParticleSystem.js.map +1 -1
  312. package/Particles/thinParticleSystem.pure.js +4 -0
  313. package/Particles/thinParticleSystem.pure.js.map +1 -1
  314. package/PostProcesses/RenderPipeline/Pipelines/taaMaterialManager.pure.d.ts +27 -6
  315. package/PostProcesses/RenderPipeline/Pipelines/taaMaterialManager.pure.js +60 -5
  316. package/PostProcesses/RenderPipeline/Pipelines/taaMaterialManager.pure.js.map +1 -1
  317. package/PostProcesses/thinTAAPostProcess.d.ts +1 -0
  318. package/PostProcesses/thinTAAPostProcess.js +17 -1
  319. package/PostProcesses/thinTAAPostProcess.js.map +1 -1
  320. package/PostProcesses/volumetricLightScatteringPostProcess.pure.d.ts +2 -1
  321. package/PostProcesses/volumetricLightScatteringPostProcess.pure.js +6 -5
  322. package/PostProcesses/volumetricLightScatteringPostProcess.pure.js.map +1 -1
  323. package/Rendering/boundingBoxRenderer.pure.js +2 -3
  324. package/Rendering/boundingBoxRenderer.pure.js.map +1 -1
  325. package/Rendering/geometryBufferRenderer.pure.js +8 -2
  326. package/Rendering/geometryBufferRenderer.pure.js.map +1 -1
  327. package/Rendering/objectRenderer.d.ts +1 -0
  328. package/Rendering/objectRenderer.js +14 -0
  329. package/Rendering/objectRenderer.js.map +1 -1
  330. package/Shaders/ShadersInclude/bumpFragmentMainFunctions.js +2 -2
  331. package/Shaders/ShadersInclude/bumpFragmentMainFunctions.js.map +1 -1
  332. package/Shaders/ShadersInclude/bumpVertex.js +1 -1
  333. package/Shaders/ShadersInclude/bumpVertex.js.map +1 -1
  334. package/Shaders/ShadersInclude/bumpVertexDeclaration.js +1 -1
  335. package/Shaders/ShadersInclude/bumpVertexDeclaration.js.map +1 -1
  336. package/Shaders/ShadersInclude/hdrFilteringFunctions.js +5 -1
  337. package/Shaders/ShadersInclude/hdrFilteringFunctions.js.map +1 -1
  338. package/Shaders/ShadersInclude/helperFunctions.js +2 -2
  339. package/Shaders/ShadersInclude/helperFunctions.js.map +1 -1
  340. package/Shaders/ShadersInclude/openpbrBackgroundTransmission.js +1 -1
  341. package/Shaders/ShadersInclude/openpbrBackgroundTransmission.js.map +1 -1
  342. package/Shaders/ShadersInclude/openpbrVertexDeclaration.js +6 -0
  343. package/Shaders/ShadersInclude/openpbrVertexDeclaration.js.map +1 -1
  344. package/Shaders/ShadersInclude/pbrBlockFinalLitComponents.js +11 -1
  345. package/Shaders/ShadersInclude/pbrBlockFinalLitComponents.js.map +1 -1
  346. package/Shaders/ShadersInclude/pbrBlockNormalFinal.js +9 -0
  347. package/Shaders/ShadersInclude/pbrBlockNormalFinal.js.map +1 -1
  348. package/Shaders/ShadersInclude/pbrBlockReflectance.js +1 -1
  349. package/Shaders/ShadersInclude/pbrBlockReflectance.js.map +1 -1
  350. package/Shaders/ShadersInclude/pbrClusteredLightingFunctions.js +1 -1
  351. package/Shaders/ShadersInclude/pbrClusteredLightingFunctions.js.map +1 -1
  352. package/Shaders/ShadersInclude/pbrFragmentDeclaration.js +7 -1
  353. package/Shaders/ShadersInclude/pbrFragmentDeclaration.js.map +1 -1
  354. package/Shaders/ShadersInclude/pbrFragmentSamplersDeclaration.js +1 -0
  355. package/Shaders/ShadersInclude/pbrFragmentSamplersDeclaration.js.map +1 -1
  356. package/Shaders/ShadersInclude/pbrIBLFunctions.js +12 -0
  357. package/Shaders/ShadersInclude/pbrIBLFunctions.js.map +1 -1
  358. package/Shaders/ShadersInclude/pbrUboDeclaration.js +1 -1
  359. package/Shaders/ShadersInclude/pbrUboDeclaration.js.map +1 -1
  360. package/Shaders/ShadersInclude/pbrVertexDeclaration.js +3 -0
  361. package/Shaders/ShadersInclude/pbrVertexDeclaration.js.map +1 -1
  362. package/Shaders/geometry.vertex.js +6 -6
  363. package/Shaders/geometry.vertex.js.map +1 -1
  364. package/Shaders/gpuUpdateParticles.vertex.js +1 -1
  365. package/Shaders/gpuUpdateParticles.vertex.js.map +1 -1
  366. package/Shaders/lod.fragment.js +15 -2
  367. package/Shaders/lod.fragment.js.map +1 -1
  368. package/Shaders/lod3D.fragment.js +15 -2
  369. package/Shaders/lod3D.fragment.js.map +1 -1
  370. package/Shaders/lodCube.fragment.js +15 -2
  371. package/Shaders/lodCube.fragment.js.map +1 -1
  372. package/Shaders/openpbr.vertex.js +2 -0
  373. package/Shaders/openpbr.vertex.js.map +1 -1
  374. package/Shaders/pbr.fragment.js +12 -1
  375. package/Shaders/pbr.fragment.js.map +1 -1
  376. package/Shaders/pbr.vertex.js +2 -0
  377. package/Shaders/pbr.vertex.js.map +1 -1
  378. package/Shaders/textureMerger.fragment.js +28 -0
  379. package/Shaders/textureMerger.fragment.js.map +1 -1
  380. package/Shaders/textureProcessor.fragment.js +26 -4
  381. package/Shaders/textureProcessor.fragment.js.map +1 -1
  382. package/Shaders/volumetricLightScattering.fragment.js +1 -1
  383. package/Shaders/volumetricLightScattering.fragment.js.map +1 -1
  384. package/ShadersWGSL/ShadersInclude/bumpFragmentMainFunctions.js +2 -2
  385. package/ShadersWGSL/ShadersInclude/bumpFragmentMainFunctions.js.map +1 -1
  386. package/ShadersWGSL/ShadersInclude/bumpVertex.js +1 -1
  387. package/ShadersWGSL/ShadersInclude/bumpVertex.js.map +1 -1
  388. package/ShadersWGSL/ShadersInclude/bumpVertexDeclaration.js +1 -1
  389. package/ShadersWGSL/ShadersInclude/bumpVertexDeclaration.js.map +1 -1
  390. package/ShadersWGSL/ShadersInclude/hdrFilteringFunctions.js +1 -1
  391. package/ShadersWGSL/ShadersInclude/hdrFilteringFunctions.js.map +1 -1
  392. package/ShadersWGSL/ShadersInclude/helperFunctions.js +2 -2
  393. package/ShadersWGSL/ShadersInclude/helperFunctions.js.map +1 -1
  394. package/ShadersWGSL/ShadersInclude/lightFragment.js +44 -2
  395. package/ShadersWGSL/ShadersInclude/lightFragment.js.map +1 -1
  396. package/ShadersWGSL/ShadersInclude/lightUboDeclaration.js +17 -3
  397. package/ShadersWGSL/ShadersInclude/lightUboDeclaration.js.map +1 -1
  398. package/ShadersWGSL/ShadersInclude/lightVxUboDeclaration.js +12 -1
  399. package/ShadersWGSL/ShadersInclude/lightVxUboDeclaration.js.map +1 -1
  400. package/ShadersWGSL/ShadersInclude/openpbrBackgroundTransmission.js +1 -1
  401. package/ShadersWGSL/ShadersInclude/openpbrBackgroundTransmission.js.map +1 -1
  402. package/ShadersWGSL/ShadersInclude/pbrBlockFinalLitComponents.js +11 -1
  403. package/ShadersWGSL/ShadersInclude/pbrBlockFinalLitComponents.js.map +1 -1
  404. package/ShadersWGSL/ShadersInclude/pbrBlockNormalFinal.js +9 -0
  405. package/ShadersWGSL/ShadersInclude/pbrBlockNormalFinal.js.map +1 -1
  406. package/ShadersWGSL/ShadersInclude/pbrBlockReflectance.js +1 -1
  407. package/ShadersWGSL/ShadersInclude/pbrBlockReflectance.js.map +1 -1
  408. package/ShadersWGSL/ShadersInclude/pbrClusteredLightingFunctions.js +1 -1
  409. package/ShadersWGSL/ShadersInclude/pbrClusteredLightingFunctions.js.map +1 -1
  410. package/ShadersWGSL/ShadersInclude/pbrDirectLightingSetupFunctions.js +1 -1
  411. package/ShadersWGSL/ShadersInclude/pbrDirectLightingSetupFunctions.js.map +1 -1
  412. package/ShadersWGSL/ShadersInclude/pbrFragmentSamplersDeclaration.js +1 -0
  413. package/ShadersWGSL/ShadersInclude/pbrFragmentSamplersDeclaration.js.map +1 -1
  414. package/ShadersWGSL/ShadersInclude/pbrIBLFunctions.js +8 -0
  415. package/ShadersWGSL/ShadersInclude/pbrIBLFunctions.js.map +1 -1
  416. package/ShadersWGSL/ShadersInclude/pbrUboDeclaration.js +1 -1
  417. package/ShadersWGSL/ShadersInclude/pbrUboDeclaration.js.map +1 -1
  418. package/ShadersWGSL/ShadersInclude/prePassVertex.js +2 -2
  419. package/ShadersWGSL/ShadersInclude/prePassVertex.js.map +1 -1
  420. package/ShadersWGSL/ShadersInclude/prePassVertexDeclaration.js +1 -1
  421. package/ShadersWGSL/ShadersInclude/prePassVertexDeclaration.js.map +1 -1
  422. package/ShadersWGSL/ShadersInclude/sceneUboDeclaration.js +3 -1
  423. package/ShadersWGSL/ShadersInclude/sceneUboDeclaration.js.map +1 -1
  424. package/ShadersWGSL/ShadersInclude/shadowsVertex.js +16 -0
  425. package/ShadersWGSL/ShadersInclude/shadowsVertex.js.map +1 -1
  426. package/ShadersWGSL/default.fragment.js +4 -4
  427. package/ShadersWGSL/default.fragment.js.map +1 -1
  428. package/ShadersWGSL/default.vertex.js +1 -1
  429. package/ShadersWGSL/default.vertex.js.map +1 -1
  430. package/ShadersWGSL/gaussianSplatting.vertex.js +3 -3
  431. package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
  432. package/ShadersWGSL/gpuUpdateParticles.compute.js +1 -1
  433. package/ShadersWGSL/gpuUpdateParticles.compute.js.map +1 -1
  434. package/ShadersWGSL/gsSortCount.compute.d.ts +5 -0
  435. package/ShadersWGSL/gsSortCount.compute.js +19 -0
  436. package/ShadersWGSL/gsSortCount.compute.js.map +1 -0
  437. package/ShadersWGSL/gsSortKeys.compute.d.ts +5 -0
  438. package/ShadersWGSL/gsSortKeys.compute.js +49 -0
  439. package/ShadersWGSL/gsSortKeys.compute.js.map +1 -0
  440. package/ShadersWGSL/gsSortOutput.compute.d.ts +5 -0
  441. package/ShadersWGSL/gsSortOutput.compute.js +28 -0
  442. package/ShadersWGSL/gsSortOutput.compute.js.map +1 -0
  443. package/ShadersWGSL/gsSortScanLocal.compute.d.ts +5 -0
  444. package/ShadersWGSL/gsSortScanLocal.compute.js +23 -0
  445. package/ShadersWGSL/gsSortScanLocal.compute.js.map +1 -0
  446. package/ShadersWGSL/gsSortScanSums.compute.d.ts +5 -0
  447. package/ShadersWGSL/gsSortScanSums.compute.js +19 -0
  448. package/ShadersWGSL/gsSortScanSums.compute.js.map +1 -0
  449. package/ShadersWGSL/gsSortScatter.compute.d.ts +5 -0
  450. package/ShadersWGSL/gsSortScatter.compute.js +33 -0
  451. package/ShadersWGSL/gsSortScatter.compute.js.map +1 -0
  452. package/ShadersWGSL/lod.fragment.js +14 -2
  453. package/ShadersWGSL/lod.fragment.js.map +1 -1
  454. package/ShadersWGSL/lod3D.fragment.js +14 -2
  455. package/ShadersWGSL/lod3D.fragment.js.map +1 -1
  456. package/ShadersWGSL/lodCube.fragment.js +14 -2
  457. package/ShadersWGSL/lodCube.fragment.js.map +1 -1
  458. package/ShadersWGSL/openpbr.vertex.js +3 -1
  459. package/ShadersWGSL/openpbr.vertex.js.map +1 -1
  460. package/ShadersWGSL/pbr.fragment.js +11 -0
  461. package/ShadersWGSL/pbr.fragment.js.map +1 -1
  462. package/ShadersWGSL/pbr.vertex.js +3 -1
  463. package/ShadersWGSL/pbr.vertex.js.map +1 -1
  464. package/ShadersWGSL/textureMerger.fragment.js +40 -4
  465. package/ShadersWGSL/textureMerger.fragment.js.map +1 -1
  466. package/ShadersWGSL/textureProcessor.fragment.js +26 -4
  467. package/ShadersWGSL/textureProcessor.fragment.js.map +1 -1
  468. package/Sprites/spriteRenderer.js +15 -5
  469. package/Sprites/spriteRenderer.js.map +1 -1
  470. package/package.json +1 -1
  471. package/scene.pure.d.ts +23 -1
  472. package/scene.pure.js +83 -1
  473. package/scene.pure.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"hdrIrradianceFiltering.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Materials/Textures/Filtering/hdrIrradianceFiltering.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,sCAAsC,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGlD,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAKvF,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAsBrE;;GAEG;AACH,MAAM,OAAO,sBAAsB;IAsB/B;;;;;OAKG;IACH,YAAY,MAAsB,EAAE,UAA0C,EAAE;QAtBhF;;;WAGG;QACI,YAAO,GAAW,SAAS,CAAC,iCAAiC,CAAC;QAErE;;WAEG;QACI,aAA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C9B,IAAI,CAAC,aAAa,EAAE,OAAO,EAAE,CAAC;QAE9B,OAAO,iBAAiB,CAAC;IAC7B,CAAC;CACJ","sourcesContent":["import { Vector3 } from \"../../../Maths/math\";\r\nimport { ILog2 } from \"../../../Maths/math.scalar.functions\";\r\nimport { BaseTexture } from \"../baseTexture.pure\";\r\nimport { type AbstractEngine } from \"../../../Engines/abstractEngine\";\r\nimport { type Effect } from \"../../../Materials/effect\";\r\nimport { Constants } from \"../../../Engines/constants\";\r\nimport { EffectWrapper, EffectRenderer } from \"../../../Materials/effectRenderer.pure\";\r\nimport { type Nullable } from \"../../../types\";\r\nimport { type RenderTargetWrapper } from \"../../../Engines/renderTargetWrapper\";\r\n\r\nimport { ShaderLanguage } from \"core/Materials/shaderLanguage\";\r\nimport { IblCdfGenerator } from \"../../../Rendering/iblCdfGenerator\";\r\n\r\n/**\r\n * Options for texture filtering\r\n */\r\ninterface IHDRIrradianceFilteringOptions {\r\n /**\r\n * Scales pixel intensity for the input HDR map.\r\n */\r\n hdrScale?: number;\r\n\r\n /**\r\n * Quality of the filter. Should be `Constants.TEXTURE_FILTERING_QUALITY_OFFLINE` for prefiltering\r\n */\r\n quality?: number;\r\n\r\n /**\r\n * Use the Cumulative Distribution Function (CDF) for filtering\r\n */\r\n useCdf?: boolean;\r\n}\r\n\r\n/**\r\n * Filters HDR maps to get correct renderings of PBR reflections\r\n */\r\nexport class HDRIrradianceFiltering {\r\n private _engine: AbstractEngine;\r\n private _effectRenderer: EffectRenderer;\r\n private _effectWrapper: EffectWrapper;\r\n private _cdfGenerator: IblCdfGenerator;\r\n\r\n /**\r\n * Quality switch for prefiltering. Should be set to `Constants.TEXTURE_FILTERING_QUALITY_OFFLINE` unless\r\n * you care about baking speed.\r\n */\r\n public quality: number = Constants.TEXTURE_FILTERING_QUALITY_OFFLINE;\r\n\r\n /**\r\n * Scales pixel intensity for the input HDR map.\r\n */\r\n public hdrScale: number = 1;\r\n\r\n /**\r\n * Use the Cumulative Distribution Function (CDF) for filtering\r\n */\r\n public useCdf: boolean = false;\r\n\r\n /**\r\n * Instantiates HDR filter for irradiance map\r\n *\r\n * @param engine Thin engine\r\n * @param options Options\r\n */\r\n constructor(engine: AbstractEngine, options: IHDRIrradianceFilteringOptions = {}) {\r\n // pass\r\n this._engine = engine;\r\n this.hdrScale = options.hdrScale || this.hdrScale;\r\n this.quality = options.quality || this.quality;\r\n this.useCdf = options.useCdf || this.useCdf;\r\n }\r\n\r\n private _createRenderTarget(size: number): RenderTargetWrapper {\r\n let textureType = Constants.TEXTURETYPE_UNSIGNED_BYTE;\r\n if (this._engine.getCaps().textureHalfFloatRender) {\r\n textureType = Constants.TEXTURETYPE_HALF_FLOAT;\r\n } else if (this._engine.getCaps().textureFloatRender) {\r\n textureType = Constants.TEXTURETYPE_FLOAT;\r\n }\r\n\r\n const rtWrapper = this._engine.createRenderTargetCubeTexture(size, {\r\n format: Constants.TEXTUREFORMAT_RGBA,\r\n type: textureType,\r\n createMipMaps: false,\r\n generateMipMaps: false,\r\n generateDepthBuffer: false,\r\n generateStencilBuffer: false,\r\n samplingMode: Constants.TEXTURE_BILINEAR_SAMPLINGMODE,\r\n label: \"HDR_Irradiance_Filtering_Target\",\r\n });\r\n this._engine.updateTextureWrappingMode(rtWrapper.texture!, Constants.TEXTURE_CLAMP_ADDRESSMODE, Constants.TEXTURE_CLAMP_ADDRESSMODE, Constants.TEXTURE_CLAMP_ADDRESSMODE);\r\n\r\n return rtWrapper;\r\n }\r\n\r\n private _prefilterInternal(texture: BaseTexture): BaseTexture {\r\n const width = texture.getSize().width;\r\n const mipmapsCount = ILog2(width);\r\n\r\n const effect = this._effectWrapper.effect;\r\n if (!effect) {\r\n return texture;\r\n }\r\n // Choose a power of 2 size for the irradiance map.\r\n // It can be much smaller than the original texture.\r\n const irradianceSize = Math.max(32, 1 << ILog2(width >> 3));\r\n const outputTexture = this._createRenderTarget(irradianceSize);\r\n this._effectRenderer.saveStates();\r\n this._effectRenderer.setViewport();\r\n\r\n this._effectRenderer.applyEffectWrapper(this._effectWrapper);\r\n\r\n const directions = [\r\n [new Vector3(0, 0, -1), new Vector3(0, -1, 0), new Vector3(1, 0, 0)], // PositiveX\r\n [new Vector3(0, 0, 1), new Vector3(0, -1, 0), new Vector3(-1, 0, 0)], // NegativeX\r\n [new Vector3(1, 0, 0), new Vector3(0, 0, 1), new Vector3(0, 1, 0)], // PositiveY\r\n [new Vector3(1, 0, 0), new Vector3(0, 0, -1), new Vector3(0, -1, 0)], // NegativeY\r\n [new Vector3(1, 0, 0), new Vector3(0, -1, 0), new Vector3(0, 0, 1)], // PositiveZ\r\n [new Vector3(-1, 0, 0), new Vector3(0, -1, 0), new Vector3(0, 0, -1)], // NegativeZ\r\n ];\r\n\r\n effect.setFloat(\"hdrScale\", this.hdrScale);\r\n effect.setFloat2(\"vFilteringInfo\", texture.getSize().width, mipmapsCount);\r\n effect.setTexture(\"inputTexture\", texture);\r\n if (this._cdfGenerator) {\r\n effect.setTexture(\"icdfTexture\", this._cdfGenerator.getIcdfTexture());\r\n }\r\n\r\n for (let face = 0; face < 6; face++) {\r\n effect.setVector3(\"up\", directions[face][0]);\r\n effect.setVector3(\"right\", directions[face][1]);\r\n effect.setVector3(\"front\", directions[face][2]);\r\n\r\n this._engine.bindFramebuffer(outputTexture, face, undefined, undefined, true);\r\n this._effectRenderer.applyEffectWrapper(this._effectWrapper);\r\n\r\n this._effectRenderer.draw();\r\n }\r\n\r\n // Cleanup\r\n this._effectRenderer.restoreStates();\r\n this._engine.restoreDefaultFramebuffer();\r\n effect.setTexture(\"inputTexture\", null);\r\n effect.setTexture(\"icdfTexture\", null);\r\n const irradianceTexture = new BaseTexture(texture.getScene(), outputTexture.texture);\r\n irradianceTexture.name = texture.name + \"_irradiance\";\r\n irradianceTexture.displayName = texture.name + \"_irradiance\";\r\n irradianceTexture.gammaSpace = false;\r\n return irradianceTexture;\r\n }\r\n\r\n private _createEffect(texture: BaseTexture, onCompiled?: Nullable<(effect: Effect) => void>): EffectWrapper {\r\n const defines = [];\r\n if (texture.gammaSpace) {\r\n defines.push(\"#define GAMMA_INPUT\");\r\n }\r\n\r\n defines.push(\"#define NUM_SAMPLES \" + this.quality + \"u\"); // unsigned int\r\n\r\n const isWebGPU = this._engine.isWebGPU;\r\n const samplers = [\"inputTexture\"];\r\n if (this._cdfGenerator) {\r\n samplers.push(\"icdfTexture\");\r\n defines.push(\"#define IBL_CDF_FILTERING\");\r\n }\r\n const effectWrapper = new EffectWrapper({\r\n engine: this._engine,\r\n name: \"HDRIrradianceFiltering\",\r\n vertexShader: \"hdrIrradianceFiltering\",\r\n fragmentShader: \"hdrIrradianceFiltering\",\r\n samplerNames: samplers,\r\n uniformNames: [\"vSampleDirections\", \"vWeights\", \"up\", \"right\", \"front\", \"vFilteringInfo\", \"hdrScale\"],\r\n useShaderStore: true,\r\n defines,\r\n onCompiled: onCompiled,\r\n shaderLanguage: isWebGPU ? ShaderLanguage.WGSL : ShaderLanguage.GLSL,\r\n extraInitializationsAsync: async () => {\r\n if (isWebGPU) {\r\n await Promise.all([import(\"../../../ShadersWGSL/hdrIrradianceFiltering.vertex\"), import(\"../../../ShadersWGSL/hdrIrradianceFiltering.fragment\")]);\r\n } else {\r\n await Promise.all([import(\"../../../Shaders/hdrIrradianceFiltering.vertex\"), import(\"../../../Shaders/hdrIrradianceFiltering.fragment\")]);\r\n }\r\n },\r\n });\r\n\r\n return effectWrapper;\r\n }\r\n\r\n /**\r\n * Get a value indicating if the filter is ready to be used\r\n * @param texture Texture to filter\r\n * @returns true if the filter is ready\r\n */\r\n public isReady(texture: BaseTexture) {\r\n return texture.isReady() && this._effectWrapper.effect.isReady();\r\n }\r\n\r\n /**\r\n * Prefilters a cube texture to contain IBL irradiance.\r\n * Prefiltering will be invoked at the end of next rendering pass.\r\n * This has to be done once the map is loaded, and has not been prefiltered by a third party software.\r\n * See http://blog.selfshadow.com/publications/s2013-shading-course/karis/s2013_pbs_epic_notes_v2.pdf for more information\r\n * @param texture Texture to filter\r\n * @returns Promise called when prefiltering is done\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public async prefilter(texture: BaseTexture): Promise<BaseTexture> {\r\n if (!this._engine._features.allowTexturePrefiltering) {\r\n throw new Error(\"HDR prefiltering is not available in WebGL 1., you can use real time filtering instead.\");\r\n }\r\n\r\n if (this.useCdf) {\r\n this._cdfGenerator = new IblCdfGenerator(this._engine);\r\n this._cdfGenerator.iblSource = texture;\r\n\r\n await this._cdfGenerator.renderWhenReady();\r\n }\r\n\r\n this._effectRenderer = new EffectRenderer(this._engine);\r\n this._effectWrapper = this._createEffect(texture);\r\n await this._effectWrapper.effect.whenCompiledAsync();\r\n\r\n const irradianceTexture = this._prefilterInternal(texture);\r\n\r\n if (this.useCdf) {\r\n // eslint-disable-next-line github/no-then\r\n await this._cdfGenerator.findDominantDirection().then((dir) => {\r\n irradianceTexture._dominantDirection = dir;\r\n });\r\n }\r\n this._effectRenderer.dispose();\r\n this._effectWrapper.dispose();\r\n this._cdfGenerator?.dispose();\r\n\r\n return irradianceTexture;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"hdrIrradianceFiltering.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Materials/Textures/Filtering/hdrIrradianceFiltering.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,sCAAsC,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGlD,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAMvF,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAsBrE;;GAEG;AACH,MAAM,OAAO,sBAAsB;IAsB/B;;;;;OAKG;IACH,YAAY,MAAsB,EAAE,UAA0C,EAAE;QAtBhF;;;WAGG;QAC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,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QAClD,MAAM,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,iBAAiB,EAAE,CAAC;QAErD,MAAM,iBAAiB,GAAG,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;QAE3D,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YACd,0CAA0C;YAC1C,MAAM,IAAI,CAAC,aAAa,CAAC,qBAAqB,EAAE,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE;gBAC1D,iBAAiB,CAAC,kBAAkB,GAAG,GAAG,CAAC;YAC/C,CAAC,CAAC,CAAC;QACP,CAAC;QACD,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,CAAC;QAC/B,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;QAC9B,IAAI,CAAC,aAAa,EAAE,OAAO,EAAE,CAAC;QAE9B,OAAO,iBAAiB,CAAC;IAC7B,CAAC;CACJ","sourcesContent":["import { Vector3 } from \"../../../Maths/math\";\r\nimport { ILog2 } from \"../../../Maths/math.scalar.functions\";\r\nimport { BaseTexture } from \"../baseTexture.pure\";\r\nimport { type AbstractEngine } from \"../../../Engines/abstractEngine\";\r\nimport { type Effect } from \"../../../Materials/effect\";\r\nimport { Constants } from \"../../../Engines/constants\";\r\nimport { EffectWrapper, EffectRenderer } from \"../../../Materials/effectRenderer.pure\";\r\nimport { type Nullable } from \"../../../types\";\r\nimport { type RenderTargetWrapper } from \"../../../Engines/renderTargetWrapper\";\r\nimport { type InternalTexture } from \"../internalTexture\";\r\n\r\nimport { ShaderLanguage } from \"core/Materials/shaderLanguage\";\r\nimport { IblCdfGenerator } from \"../../../Rendering/iblCdfGenerator\";\r\n\r\n/**\r\n * Options for texture filtering\r\n */\r\ninterface IHDRIrradianceFilteringOptions {\r\n /**\r\n * Scales pixel intensity for the input HDR map.\r\n */\r\n hdrScale?: number;\r\n\r\n /**\r\n * Quality of the filter. Should be `Constants.TEXTURE_FILTERING_QUALITY_OFFLINE` for prefiltering\r\n */\r\n quality?: number;\r\n\r\n /**\r\n * Use the Cumulative Distribution Function (CDF) for filtering\r\n */\r\n useCdf?: boolean;\r\n}\r\n\r\n/**\r\n * Filters HDR maps to get correct renderings of PBR reflections\r\n */\r\nexport class HDRIrradianceFiltering {\r\n private _engine: AbstractEngine;\r\n private _effectRenderer: EffectRenderer;\r\n private _effectWrapper: EffectWrapper;\r\n private _cdfGenerator: IblCdfGenerator;\r\n\r\n /**\r\n * Quality switch for prefiltering. Should be set to `Constants.TEXTURE_FILTERING_QUALITY_OFFLINE` unless\r\n * you care about baking speed.\r\n */\r\n public quality: number = Constants.TEXTURE_FILTERING_QUALITY_OFFLINE;\r\n\r\n /**\r\n * Scales pixel intensity for the input HDR map.\r\n */\r\n public hdrScale: number = 1;\r\n\r\n /**\r\n * Use the Cumulative Distribution Function (CDF) for filtering\r\n */\r\n public useCdf: boolean = false;\r\n\r\n /**\r\n * Instantiates HDR filter for irradiance map\r\n *\r\n * @param engine Thin engine\r\n * @param options Options\r\n */\r\n constructor(engine: AbstractEngine, options: IHDRIrradianceFilteringOptions = {}) {\r\n // pass\r\n this._engine = engine;\r\n this.hdrScale = options.hdrScale || this.hdrScale;\r\n this.quality = options.quality || this.quality;\r\n this.useCdf = options.useCdf || this.useCdf;\r\n }\r\n\r\n private _createRenderTarget(size: number): RenderTargetWrapper {\r\n let textureType = Constants.TEXTURETYPE_UNSIGNED_BYTE;\r\n if (this._engine.getCaps().textureHalfFloatRender) {\r\n textureType = Constants.TEXTURETYPE_HALF_FLOAT;\r\n } else if (this._engine.getCaps().textureFloatRender) {\r\n textureType = Constants.TEXTURETYPE_FLOAT;\r\n }\r\n\r\n const rtWrapper = this._engine.createRenderTargetCubeTexture(size, {\r\n format: Constants.TEXTUREFORMAT_RGBA,\r\n type: textureType,\r\n createMipMaps: false,\r\n generateMipMaps: false,\r\n generateDepthBuffer: false,\r\n generateStencilBuffer: false,\r\n samplingMode: Constants.TEXTURE_BILINEAR_SAMPLINGMODE,\r\n label: \"HDR_Irradiance_Filtering_Target\",\r\n });\r\n this._engine.updateTextureWrappingMode(rtWrapper.texture!, Constants.TEXTURE_CLAMP_ADDRESSMODE, Constants.TEXTURE_CLAMP_ADDRESSMODE, Constants.TEXTURE_CLAMP_ADDRESSMODE);\r\n\r\n return rtWrapper;\r\n }\r\n\r\n private _rebuildRenderTargetStorage(size: number): { proxy: InternalTexture; isReady: boolean; isAsync: boolean } {\r\n const rtWrapper = this._createRenderTarget(size);\r\n const proxy = rtWrapper.texture!;\r\n rtWrapper.dispose(true);\r\n return { proxy, isReady: true, isAsync: false };\r\n }\r\n\r\n private _prefilterInternal(texture: BaseTexture): BaseTexture {\r\n const width = texture.getSize().width;\r\n const mipmapsCount = ILog2(width);\r\n\r\n const effect = this._effectWrapper.effect;\r\n if (!effect) {\r\n return texture;\r\n }\r\n // Choose a power of 2 size for the irradiance map.\r\n // It can be much smaller than the original texture.\r\n const irradianceSize = Math.max(32, 1 << ILog2(width >> 3));\r\n const outputTexture = this._createRenderTarget(irradianceSize);\r\n this._effectRenderer.saveStates();\r\n this._effectRenderer.setViewport();\r\n\r\n this._effectRenderer.applyEffectWrapper(this._effectWrapper);\r\n\r\n const directions = [\r\n [new Vector3(0, 0, -1), new Vector3(0, -1, 0), new Vector3(1, 0, 0)], // PositiveX\r\n [new Vector3(0, 0, 1), new Vector3(0, -1, 0), new Vector3(-1, 0, 0)], // NegativeX\r\n [new Vector3(1, 0, 0), new Vector3(0, 0, 1), new Vector3(0, 1, 0)], // PositiveY\r\n [new Vector3(1, 0, 0), new Vector3(0, 0, -1), new Vector3(0, -1, 0)], // NegativeY\r\n [new Vector3(1, 0, 0), new Vector3(0, -1, 0), new Vector3(0, 0, 1)], // PositiveZ\r\n [new Vector3(-1, 0, 0), new Vector3(0, -1, 0), new Vector3(0, 0, -1)], // NegativeZ\r\n ];\r\n\r\n effect.setFloat(\"hdrScale\", this.hdrScale);\r\n effect.setFloat2(\"vFilteringInfo\", texture.getSize().width, mipmapsCount);\r\n effect.setTexture(\"inputTexture\", texture);\r\n if (this._cdfGenerator) {\r\n effect.setTexture(\"icdfTexture\", this._cdfGenerator.getIcdfTexture());\r\n }\r\n\r\n for (let face = 0; face < 6; face++) {\r\n effect.setVector3(\"up\", directions[face][0]);\r\n effect.setVector3(\"right\", directions[face][1]);\r\n effect.setVector3(\"front\", directions[face][2]);\r\n\r\n this._engine.bindFramebuffer(outputTexture, face, undefined, undefined, true);\r\n this._effectRenderer.applyEffectWrapper(this._effectWrapper);\r\n\r\n this._effectRenderer.draw();\r\n }\r\n\r\n // Cleanup\r\n this._effectRenderer.restoreStates();\r\n this._engine.restoreDefaultFramebuffer();\r\n effect.setTexture(\"inputTexture\", null);\r\n effect.setTexture(\"icdfTexture\", null);\r\n const irradianceTexture = new BaseTexture(texture.getScene(), outputTexture.texture);\r\n // The returned texture now owns the internal texture; only the framebuffers need releasing.\r\n // That also drops the wrapper from the engine's restore cache, so recreate the storage on context restore.\r\n outputTexture.texture!.onRebuildCallback = () => this._rebuildRenderTargetStorage(irradianceSize);\r\n outputTexture.dispose(true);\r\n irradianceTexture.name = texture.name + \"_irradiance\";\r\n irradianceTexture.displayName = texture.name + \"_irradiance\";\r\n irradianceTexture.gammaSpace = false;\r\n return irradianceTexture;\r\n }\r\n\r\n private _createEffect(texture: BaseTexture, onCompiled?: Nullable<(effect: Effect) => void>): EffectWrapper {\r\n const defines = [];\r\n if (texture.gammaSpace) {\r\n defines.push(\"#define GAMMA_INPUT\");\r\n }\r\n\r\n defines.push(\"#define NUM_SAMPLES \" + this.quality + \"u\"); // unsigned int\r\n\r\n const isWebGPU = this._engine.isWebGPU;\r\n const samplers = [\"inputTexture\"];\r\n if (this._cdfGenerator) {\r\n samplers.push(\"icdfTexture\");\r\n defines.push(\"#define IBL_CDF_FILTERING\");\r\n }\r\n const effectWrapper = new EffectWrapper({\r\n engine: this._engine,\r\n name: \"HDRIrradianceFiltering\",\r\n vertexShader: \"hdrIrradianceFiltering\",\r\n fragmentShader: \"hdrIrradianceFiltering\",\r\n samplerNames: samplers,\r\n uniformNames: [\"vSampleDirections\", \"vWeights\", \"up\", \"right\", \"front\", \"vFilteringInfo\", \"hdrScale\"],\r\n useShaderStore: true,\r\n defines,\r\n onCompiled: onCompiled,\r\n shaderLanguage: isWebGPU ? ShaderLanguage.WGSL : ShaderLanguage.GLSL,\r\n extraInitializationsAsync: async () => {\r\n if (isWebGPU) {\r\n await Promise.all([import(\"../../../ShadersWGSL/hdrIrradianceFiltering.vertex\"), import(\"../../../ShadersWGSL/hdrIrradianceFiltering.fragment\")]);\r\n } else {\r\n await Promise.all([import(\"../../../Shaders/hdrIrradianceFiltering.vertex\"), import(\"../../../Shaders/hdrIrradianceFiltering.fragment\")]);\r\n }\r\n },\r\n });\r\n\r\n return effectWrapper;\r\n }\r\n\r\n /**\r\n * Get a value indicating if the filter is ready to be used\r\n * @param texture Texture to filter\r\n * @returns true if the filter is ready\r\n */\r\n public isReady(texture: BaseTexture) {\r\n return texture.isReady() && this._effectWrapper.effect.isReady();\r\n }\r\n\r\n /**\r\n * Prefilters a cube texture to contain IBL irradiance.\r\n * Prefiltering will be invoked at the end of next rendering pass.\r\n * This has to be done once the map is loaded, and has not been prefiltered by a third party software.\r\n * See http://blog.selfshadow.com/publications/s2013-shading-course/karis/s2013_pbs_epic_notes_v2.pdf for more information\r\n * @param texture Texture to filter\r\n * @returns Promise called when prefiltering is done\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public async prefilter(texture: BaseTexture): Promise<BaseTexture> {\r\n if (!this._engine._features.allowTexturePrefiltering) {\r\n throw new Error(\"HDR prefiltering is not available in WebGL 1., you can use real time filtering instead.\");\r\n }\r\n\r\n if (this.useCdf) {\r\n this._cdfGenerator = new IblCdfGenerator(this._engine);\r\n this._cdfGenerator.iblSource = texture;\r\n\r\n await this._cdfGenerator.renderWhenReady();\r\n }\r\n\r\n this._effectRenderer = new EffectRenderer(this._engine);\r\n this._effectWrapper = this._createEffect(texture);\r\n await this._effectWrapper.effect.whenCompiledAsync();\r\n\r\n const irradianceTexture = this._prefilterInternal(texture);\r\n\r\n if (this.useCdf) {\r\n // eslint-disable-next-line github/no-then\r\n await this._cdfGenerator.findDominantDirection().then((dir) => {\r\n irradianceTexture._dominantDirection = dir;\r\n });\r\n }\r\n this._effectRenderer.dispose();\r\n this._effectWrapper.dispose();\r\n this._cdfGenerator?.dispose();\r\n\r\n return irradianceTexture;\r\n }\r\n}\r\n"]}
@@ -21,6 +21,11 @@ export interface IInstallHtmlInCanvasPolyfillOptions {
21
21
  /** A pre-imported polyfill module to use instead of dynamically importing one. */
22
22
  polyfillModule?: IHtmlInCanvasPolyfillModule;
23
23
  }
24
+ /**
25
+ * Tracks the installer-owned polyfill so consumers use its legacy snapshot APIs even when newer native APIs remain exposed.
26
+ * @internal
27
+ */
28
+ export declare function _IsHtmlInCanvasPolyfillInstalled(): boolean;
24
29
  /**
25
30
  * Detects whether the browser supports the WICG HTML-in-Canvas API natively (or already has it installed).
26
31
  * @returns true when an HTMLCanvasElement exposes `captureElementImage`
@@ -1,6 +1,13 @@
1
1
  /** This module has no top-level side effects: it only declares the optional HTML-in-Canvas polyfill installer */
2
2
  import { Logger } from "../../../Misc/logger.js";
3
3
  let _InstalledModule = null;
4
+ /**
5
+ * Tracks the installer-owned polyfill so consumers use its legacy snapshot APIs even when newer native APIs remain exposed.
6
+ * @internal
7
+ */
8
+ export function _IsHtmlInCanvasPolyfillInstalled() {
9
+ return _InstalledModule !== null;
10
+ }
4
11
  /**
5
12
  * Detects whether the browser supports the WICG HTML-in-Canvas API natively (or already has it installed).
6
13
  * @returns true when an HTMLCanvasElement exposes `captureElementImage`
@@ -1 +1 @@
1
- {"version":3,"file":"htmlInCanvasPolyfill.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Materials/Textures/HTML/htmlInCanvasPolyfill.ts"],"names":[],"mappings":"AAAA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6B,EAAE,CAAC;IACrD,CAAC;IACD,gBAAgB,GAAG,IAAI,CAAC;AAC5B,CAAC;AAED,KAAK,UAAU,eAAe,CAAC,SAAiB;IAC5C,IAAI,CAAC;QACD,qGAAqG;QACrG,gGAAgG;QAChG,oGAAoG;QACpG,sDAAsD;QACtD,OAAO,CAAC,MAAM,MAAM,CAAC,kBAAkB,CAAC,yBAAyB,CAAC,SAAS,CAAC,CAAgC,CAAC;IACjH,CAAC;IAAC,MAAM,CAAC;QACL,MAAM,CAAC,IAAI,CAAC,mDAAmD,SAAS,wDAAwD,CAAC,CAAC;QAClI,OAAO,IAAI,CAAC;IAChB,CAAC;AACL,CAAC;AAED,SAAS,mBAAmB;IACxB,OAAO,OAAO,MAAM,KAAK,WAAW,IAAI,CAAC,CAAC,MAAM,CAAC,QAAQ,IAAI,oBAAoB,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AACnH,CAAC","sourcesContent":["/** This module has no top-level side effects: it only declares the optional HTML-in-Canvas polyfill installer */\n\nimport { type Nullable } from \"../../../types\";\nimport { Logger } from \"../../../Misc/logger\";\n\n// Attribution: the WICG HTML-in-Canvas polyfill is `three-html-render` by Palash Bansal (`repalash`),\n// MIT. It is consumed as an optional, lazily-imported dependency and is never bundled into Babylon.\n\n/**\n * Shape of the `three-html-render` polyfill module (only the parts this wrapper uses).\n */\nexport interface IHtmlInCanvasPolyfillModule {\n /** Installs the WICG HTML-in-Canvas polyfill onto the relevant DOM prototypes. */\n installHtmlInCanvasPolyfill?: (options?: { force?: boolean }) => void;\n /** Removes a previously installed polyfill. */\n uninstallHtmlInCanvasPolyfill?: () => void;\n}\n\n/**\n * Options for {@link InstallHtmlInCanvasPolyfill}.\n */\nexport interface IInstallHtmlInCanvasPolyfillOptions {\n /** Install the polyfill even when the browser already supports the API natively (default false). */\n force?: boolean;\n /** Module specifier to lazily import the polyfill from (default `\"three-html-render\"`). */\n moduleSpecifier?: string;\n /** A pre-imported polyfill module to use instead of dynamically importing one. */\n polyfillModule?: IHtmlInCanvasPolyfillModule;\n}\n\nlet _InstalledModule: Nullable<IHtmlInCanvasPolyfillModule> = null;\n\n/**\n * Detects whether the browser supports the WICG HTML-in-Canvas API natively (or already has it installed).\n * @returns true when an HTMLCanvasElement exposes `captureElementImage`\n */\nexport function IsHtmlInCanvasSupportedNatively(): boolean {\n if (typeof document === \"undefined\") {\n return false;\n }\n const canvas = document.createElement(\"canvas\") as HTMLCanvasElement & { captureElementImage?: unknown };\n return typeof canvas.captureElementImage === \"function\";\n}\n\n/**\n * Lazily installs the WICG HTML-in-Canvas polyfill (`three-html-render`) so that {@link HtmlTexture} and the\n * interaction managers work in browsers that do not yet ship the native API.\n *\n * The polyfill is an optional dependency: it is imported on demand and never bundled into Babylon. When the\n * browser already supports the API natively, this is a no-op unless `force` is set or the `?polyfillHIC` URL\n * flag is present.\n * @param options optional installation configuration\n * @returns a promise that resolves to true when the polyfill was installed, false otherwise\n */\nexport async function InstallHtmlInCanvasPolyfill(options: IInstallHtmlInCanvasPolyfillOptions = {}): Promise<boolean> {\n const force = options.force ?? _HasPolyfillUrlFlag();\n\n if (!force && IsHtmlInCanvasSupportedNatively()) {\n return false;\n }\n\n const module = options.polyfillModule ?? (await _ImportPolyfill(options.moduleSpecifier ?? \"three-html-render\"));\n if (!module || typeof module.installHtmlInCanvasPolyfill !== \"function\") {\n Logger.Warn(\"HTML-in-Canvas: the polyfill module does not expose installHtmlInCanvasPolyfill; nothing was installed.\");\n return false;\n }\n\n module.installHtmlInCanvasPolyfill(force ? { force: true } : undefined);\n _InstalledModule = module;\n return true;\n}\n\n/**\n * Removes a polyfill previously installed by {@link InstallHtmlInCanvasPolyfill}.\n */\nexport function UninstallHtmlInCanvasPolyfill(): void {\n if (_InstalledModule && typeof _InstalledModule.uninstallHtmlInCanvasPolyfill === \"function\") {\n _InstalledModule.uninstallHtmlInCanvasPolyfill();\n }\n _InstalledModule = null;\n}\n\nasync function _ImportPolyfill(specifier: string): Promise<Nullable<IHtmlInCanvasPolyfillModule>> {\n try {\n // The specifier is a variable so bundlers leave this as a runtime import and the optional package is\n // not required to be installed at build time. The UMD/global build cannot resolve a bare module\n // specifier, so this dynamic import is neutralized there (see rewriteDynamicExternalImportsPlugin);\n // UMD consumers should pass `polyfillModule` instead.\n return (await import(/* @vite-ignore */ /* webpackIgnore: true */ specifier)) as IHtmlInCanvasPolyfillModule;\n } catch {\n Logger.Warn(`HTML-in-Canvas: could not load polyfill module \"${specifier}\". Install three-html-render or pass a polyfillModule.`);\n return null;\n }\n}\n\nfunction _HasPolyfillUrlFlag(): boolean {\n return typeof window !== \"undefined\" && !!window.location && /[?&]polyfillHIC\\b/i.test(window.location.search);\n}\n"]}
1
+ {"version":3,"file":"htmlInCanvasPolyfill.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Materials/Textures/HTML/htmlInCanvasPolyfill.ts"],"names":[],"mappings":"AAAA,iHAAiH;AAGjH,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AA2B9C,IAAI,gBAAgB,GAA0C,IAAI,CAAC;AAEnE;;;GAGG;AACH,MAAM,UAAU,gCAAgC;IAC5C,OAAO,gBAAgB,KAAK,IAAI,CAAC;AACrC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,+BAA+B;IAC3C,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,CAAC;QAClC,OAAO,KAAK,CAAC;IACjB,CAAC;IACD,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAA0D,CAAC;IACzG,OAAO,OAAO,MAAM,CAAC,mBAAmB,KAAK,UAAU,CAAC;AAC5D,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAAC,UAA+C,EAAE;IAC/F,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,mBAAmB,EAAE,CAAC;IAErD,IAAI,CAAC,KAAK,IAAI,+BAA+B,EAAE,EAAE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,MAAM,CAAC,CAAC;AACnH,CAAC","sourcesContent":["/** This module has no top-level side effects: it only declares the optional HTML-in-Canvas polyfill installer */\n\nimport { type Nullable } from \"../../../types\";\nimport { Logger } from \"../../../Misc/logger\";\n\n// Attribution: the WICG HTML-in-Canvas polyfill is `three-html-render` by Palash Bansal (`repalash`),\n// MIT. It is consumed as an optional, lazily-imported dependency and is never bundled into Babylon.\n\n/**\n * Shape of the `three-html-render` polyfill module (only the parts this wrapper uses).\n */\nexport interface IHtmlInCanvasPolyfillModule {\n /** Installs the WICG HTML-in-Canvas polyfill onto the relevant DOM prototypes. */\n installHtmlInCanvasPolyfill?: (options?: { force?: boolean }) => void;\n /** Removes a previously installed polyfill. */\n uninstallHtmlInCanvasPolyfill?: () => void;\n}\n\n/**\n * Options for {@link InstallHtmlInCanvasPolyfill}.\n */\nexport interface IInstallHtmlInCanvasPolyfillOptions {\n /** Install the polyfill even when the browser already supports the API natively (default false). */\n force?: boolean;\n /** Module specifier to lazily import the polyfill from (default `\"three-html-render\"`). */\n moduleSpecifier?: string;\n /** A pre-imported polyfill module to use instead of dynamically importing one. */\n polyfillModule?: IHtmlInCanvasPolyfillModule;\n}\n\nlet _InstalledModule: Nullable<IHtmlInCanvasPolyfillModule> = null;\n\n/**\n * Tracks the installer-owned polyfill so consumers use its legacy snapshot APIs even when newer native APIs remain exposed.\n * @internal\n */\nexport function _IsHtmlInCanvasPolyfillInstalled(): boolean {\n return _InstalledModule !== null;\n}\n\n/**\n * Detects whether the browser supports the WICG HTML-in-Canvas API natively (or already has it installed).\n * @returns true when an HTMLCanvasElement exposes `captureElementImage`\n */\nexport function IsHtmlInCanvasSupportedNatively(): boolean {\n if (typeof document === \"undefined\") {\n return false;\n }\n const canvas = document.createElement(\"canvas\") as HTMLCanvasElement & { captureElementImage?: unknown };\n return typeof canvas.captureElementImage === \"function\";\n}\n\n/**\n * Lazily installs the WICG HTML-in-Canvas polyfill (`three-html-render`) so that {@link HtmlTexture} and the\n * interaction managers work in browsers that do not yet ship the native API.\n *\n * The polyfill is an optional dependency: it is imported on demand and never bundled into Babylon. When the\n * browser already supports the API natively, this is a no-op unless `force` is set or the `?polyfillHIC` URL\n * flag is present.\n * @param options optional installation configuration\n * @returns a promise that resolves to true when the polyfill was installed, false otherwise\n */\nexport async function InstallHtmlInCanvasPolyfill(options: IInstallHtmlInCanvasPolyfillOptions = {}): Promise<boolean> {\n const force = options.force ?? _HasPolyfillUrlFlag();\n\n if (!force && IsHtmlInCanvasSupportedNatively()) {\n return false;\n }\n\n const module = options.polyfillModule ?? (await _ImportPolyfill(options.moduleSpecifier ?? \"three-html-render\"));\n if (!module || typeof module.installHtmlInCanvasPolyfill !== \"function\") {\n Logger.Warn(\"HTML-in-Canvas: the polyfill module does not expose installHtmlInCanvasPolyfill; nothing was installed.\");\n return false;\n }\n\n module.installHtmlInCanvasPolyfill(force ? { force: true } : undefined);\n _InstalledModule = module;\n return true;\n}\n\n/**\n * Removes a polyfill previously installed by {@link InstallHtmlInCanvasPolyfill}.\n */\nexport function UninstallHtmlInCanvasPolyfill(): void {\n if (_InstalledModule && typeof _InstalledModule.uninstallHtmlInCanvasPolyfill === \"function\") {\n _InstalledModule.uninstallHtmlInCanvasPolyfill();\n }\n _InstalledModule = null;\n}\n\nasync function _ImportPolyfill(specifier: string): Promise<Nullable<IHtmlInCanvasPolyfillModule>> {\n try {\n // The specifier is a variable so bundlers leave this as a runtime import and the optional package is\n // not required to be installed at build time. The UMD/global build cannot resolve a bare module\n // specifier, so this dynamic import is neutralized there (see rewriteDynamicExternalImportsPlugin);\n // UMD consumers should pass `polyfillModule` instead.\n return (await import(/* @vite-ignore */ /* webpackIgnore: true */ specifier)) as IHtmlInCanvasPolyfillModule;\n } catch {\n Logger.Warn(`HTML-in-Canvas: could not load polyfill module \"${specifier}\". Install three-html-render or pass a polyfillModule.`);\n return null;\n }\n}\n\nfunction _HasPolyfillUrlFlag(): boolean {\n return typeof window !== \"undefined\" && !!window.location && /[?&]polyfillHIC\\b/i.test(window.location.search);\n}\n"]}
@@ -30,9 +30,9 @@ export interface IHtmlInteractionManagerOptions {
30
30
  * Overlays the live HTML element of an {@link HtmlTexture} on top of the projected face of a planar mesh,
31
31
  * so the browser hit-tests the real DOM element natively (enabling focus, text selection and form input).
32
32
  *
33
- * Each frame the mesh face is projected to screen space and the element is translated, scaled and rotated
34
- * to match. This is best suited to planar, camera-facing surfaces. For arbitrary or curved meshes, use the
35
- * UV-based {@link HtmlRaycastInteractionManager} instead.
33
+ * Each frame the mesh face is projected to screen space and the element's canvas geometry is updated
34
+ * to match. Older implementations use a CSS transform instead. This is best suited to planar,
35
+ * camera-facing surfaces. For arbitrary or curved meshes, use the UV-based {@link HtmlRaycastInteractionManager} instead.
36
36
  *
37
37
  * The overlay is screen-aligned (position, size and in-plane rotation); it does not apply a full
38
38
  * perspective skew, so steeply oblique faces will not be perspective-correct.
@@ -43,6 +43,11 @@ export declare class HtmlInteractionManager {
43
43
  private readonly _element;
44
44
  private _observer;
45
45
  private _previousTransform;
46
+ private readonly _canvas;
47
+ private readonly _canvasTransform;
48
+ private readonly _geometryOptions;
49
+ private _geometryRegistered;
50
+ private readonly _stopPointerCapture;
46
51
  private readonly _viewport;
47
52
  private readonly _center;
48
53
  private readonly _xAxis;
@@ -61,6 +66,7 @@ export declare class HtmlInteractionManager {
61
66
  */
62
67
  constructor(scene: Scene, texture: HtmlTexture, mesh: AbstractMesh, options?: IHtmlInteractionManagerOptions);
63
68
  private _update;
69
+ private _clearGeometry;
64
70
  private _setTransform;
65
71
  /**
66
72
  * Detaches the manager and stops updating the overlay.
@@ -1,5 +1,6 @@
1
1
  import { Matrix, Vector3 } from "../../../Maths/math.vector.pure.js";
2
2
  import { Viewport } from "../../../Maths/math.viewport.js";
3
+ import { _IsHtmlInCanvasPolyfillInstalled } from "./htmlInCanvasPolyfill.js";
3
4
  // Attribution: the overlay-and-hit-test technique used here is prior art from `three-html-render`
4
5
  // (Palash Bansal, MIT), three.js' `InteractionManager`, and Jake Archibald's `curved-markup` demo.
5
6
  // The implementation below is a clean-room rewrite against Babylon.js' own projection APIs.
@@ -25,9 +26,9 @@ export function ComputeOverlayCssTransform(centerX, centerY, scaleX, scaleY, rot
25
26
  * Overlays the live HTML element of an {@link HtmlTexture} on top of the projected face of a planar mesh,
26
27
  * so the browser hit-tests the real DOM element natively (enabling focus, text selection and form input).
27
28
  *
28
- * Each frame the mesh face is projected to screen space and the element is translated, scaled and rotated
29
- * to match. This is best suited to planar, camera-facing surfaces. For arbitrary or curved meshes, use the
30
- * UV-based {@link HtmlRaycastInteractionManager} instead.
29
+ * Each frame the mesh face is projected to screen space and the element's canvas geometry is updated
30
+ * to match. Older implementations use a CSS transform instead. This is best suited to planar,
31
+ * camera-facing surfaces. For arbitrary or curved meshes, use the UV-based {@link HtmlRaycastInteractionManager} instead.
31
32
  *
32
33
  * The overlay is screen-aligned (position, size and in-plane rotation); it does not apply a full
33
34
  * perspective skew, so steeply oblique faces will not be perspective-correct.
@@ -42,6 +43,11 @@ export class HtmlInteractionManager {
42
43
  */
43
44
  constructor(scene, texture, mesh, options = {}) {
44
45
  this._previousTransform = "";
46
+ this._canvas = null;
47
+ this._canvasTransform = null;
48
+ this._geometryOptions = null;
49
+ this._geometryRegistered = false;
50
+ this._stopPointerCapture = (event) => event.stopPropagation();
45
51
  // Reused across frames to avoid per-frame allocations.
46
52
  this._viewport = new Viewport(0, 0, 0, 0);
47
53
  this._center = new Vector3();
@@ -55,6 +61,20 @@ export class HtmlInteractionManager {
55
61
  this._scene = scene;
56
62
  this._mesh = mesh;
57
63
  this._element = options.targetElement ?? texture.element;
64
+ if (typeof HTMLCanvasElement !== "undefined" &&
65
+ texture.host instanceof HTMLCanvasElement &&
66
+ texture.host.content === "drawable" &&
67
+ typeof texture.host.updateElementGeometry === "function" &&
68
+ typeof texture.host.clearElementGeometry === "function" &&
69
+ this._element.hasAttribute("drawable") &&
70
+ texture.host.contains(this._element) &&
71
+ !_IsHtmlInCanvasPolyfillInstalled()) {
72
+ this._canvas = texture.host;
73
+ this._canvasTransform = new DOMMatrix();
74
+ this._geometryOptions = { canvasTransform: this._canvasTransform, preserveHitTestOrder: true };
75
+ // Otherwise the engine captures the pointer on the canvas and retargets the button's up/click.
76
+ this._element.addEventListener("pointerdown", this._stopPointerCapture);
77
+ }
58
78
  this._element.style.position = "absolute";
59
79
  this._element.style.left = "0px";
60
80
  this._element.style.top = "0px";
@@ -91,7 +111,12 @@ export class HtmlInteractionManager {
91
111
  Vector3.ProjectToRef(this._corner, Matrix.IdentityReadOnly, transform, this._viewport, this._projectedY);
92
112
  // Hide the overlay when the face is behind the camera.
93
113
  if (this._projectedCenter.z < 0 || this._projectedCenter.z > 1) {
94
- this._setTransform("translate(-99999px, -99999px)");
114
+ if (this._canvas) {
115
+ this._clearGeometry();
116
+ }
117
+ else {
118
+ this._setTransform("translate(-99999px, -99999px)");
119
+ }
95
120
  return;
96
121
  }
97
122
  const dpr = engine.getHardwareScalingLevel();
@@ -104,7 +129,39 @@ export class HtmlInteractionManager {
104
129
  const elementHeight = this._element.offsetHeight || 1;
105
130
  const scaleX = (2 * halfWidth) / elementWidth;
106
131
  const scaleY = (2 * halfHeight) / elementHeight;
107
- this._setTransform(ComputeOverlayCssTransform(centerX, centerY, scaleX, scaleY, rotation, elementWidth, elementHeight));
132
+ if (this._canvas && this._canvasTransform && this._geometryOptions) {
133
+ const cosine = Math.cos(rotation);
134
+ const sine = Math.sin(rotation);
135
+ const a = cosine * scaleX;
136
+ const b = sine * scaleX;
137
+ const c = -sine * scaleY;
138
+ const d = cosine * scaleY;
139
+ const e = centerX - (a * elementWidth + c * elementHeight) / 2;
140
+ const f = centerY - (b * elementWidth + d * elementHeight) / 2;
141
+ const matrix = this._canvasTransform;
142
+ if (this._geometryRegistered && matrix.a === a && matrix.b === b && matrix.c === c && matrix.d === d && matrix.e === e && matrix.f === f) {
143
+ return;
144
+ }
145
+ matrix.a = a;
146
+ matrix.b = b;
147
+ matrix.c = c;
148
+ matrix.d = d;
149
+ matrix.e = e;
150
+ matrix.f = f;
151
+ this._canvas.updateElementGeometry(this._element, this._geometryOptions);
152
+ this._geometryRegistered = true;
153
+ }
154
+ else {
155
+ this._setTransform(ComputeOverlayCssTransform(centerX, centerY, scaleX, scaleY, rotation, elementWidth, elementHeight));
156
+ }
157
+ }
158
+ _clearGeometry() {
159
+ if (this._geometryRegistered && this._canvas) {
160
+ if (this._element.hasAttribute("drawable") && this._canvas.contains(this._element)) {
161
+ this._canvas.clearElementGeometry(this._element);
162
+ }
163
+ this._geometryRegistered = false;
164
+ }
108
165
  }
109
166
  _setTransform(transform) {
110
167
  if (transform === this._previousTransform) {
@@ -117,6 +174,8 @@ export class HtmlInteractionManager {
117
174
  * Detaches the manager and stops updating the overlay.
118
175
  */
119
176
  dispose() {
177
+ this._clearGeometry();
178
+ this._element.removeEventListener("pointerdown", this._stopPointerCapture);
120
179
  if (this._restoreInertOnDispose) {
121
180
  this._element.setAttribute("inert", "");
122
181
  this._restoreInertOnDispose = false;
@@ -1 +1 @@
1
- {"version":3,"file":"htmlInteractionManager.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Materials/Textures/HTML/htmlInteractionManager.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAExD,kGAAkG;AAClG,mGAAmG;AACnG,4FAA4F;AAE5F;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,0BAA0B,CACtC,OAAe,EACf,OAAe,EACf,MAAc,EACd,MAAc,EACd,QAAgB,EAChB,YAAoB,EACpB,aAAqB;IAErB,OAAO,aAAa,OAAO,OAAO,OAAO,cAAc,QAAQ,cAAc,MAAM,KAAK,MAAM,eAAe,CAAC,YAAY,GAAG,CAAC,OAAO,CAAC,aAAa,GAAG,CAAC,KAAK,CAAC;AACjK,CAAC;AAYD;;;;;;;;;;GAUG;AACH,MAAM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IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;YACxC,IAAI,CAAC,sBAAsB,GAAG,KAAK,CAAC;QACxC,CAAC;QACD,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACjB,IAAI,CAAC,MAAM,CAAC,uBAAuB,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAC3D,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QAC1B,CAAC;IACL,CAAC;CACJ","sourcesContent":["import { type Scene } from \"../../../scene.pure\";\nimport { type AbstractMesh } from \"../../../Meshes/abstractMesh.pure\";\nimport { type HtmlTexture } from \"./htmlTexture\";\nimport { type Observer } from \"../../../Misc/observable.pure\";\nimport { type Nullable } from \"../../../types\";\n\nimport { Matrix, Vector3 } from \"../../../Maths/math.vector.pure\";\nimport { Viewport } from \"../../../Maths/math.viewport\";\n\n// Attribution: the overlay-and-hit-test technique used here is prior art from `three-html-render`\n// (Palash Bansal, MIT), three.js' `InteractionManager`, and Jake Archibald's `curved-markup` demo.\n// The implementation below is a clean-room rewrite against Babylon.js' own projection APIs.\n\n/**\n * Builds the CSS `transform` string that positions an overlay element over the projected face of a mesh.\n *\n * The transform is applied with `transform-origin: 0 0`. Reading right to left it centers the element on\n * its own origin, scales and rotates it to match the projected face, then translates it to the projected\n * center (in CSS pixels, top-left origin).\n * @param centerX projected center X in CSS pixels\n * @param centerY projected center Y in CSS pixels\n * @param scaleX horizontal scale to apply to the element\n * @param scaleY vertical scale to apply to the element\n * @param rotation in-plane rotation in radians\n * @param elementWidth element width in pixels\n * @param elementHeight element height in pixels\n * @returns the CSS transform string\n */\nexport function ComputeOverlayCssTransform(\n centerX: number,\n centerY: number,\n scaleX: number,\n scaleY: number,\n rotation: number,\n elementWidth: number,\n elementHeight: number\n): string {\n return `translate(${centerX}px, ${centerY}px) rotate(${rotation}rad) scale(${scaleX}, ${scaleY}) translate(${-elementWidth / 2}px, ${-elementHeight / 2}px)`;\n}\n\n/**\n * Options for {@link HtmlInteractionManager}.\n */\nexport interface IHtmlInteractionManagerOptions {\n /** The DOM element to overlay (defaults to the texture's element). */\n targetElement?: HTMLElement;\n /** Whether the overlay element captures pointer events so the browser hit-tests it natively (default true). */\n enablePointerEvents?: boolean;\n}\n\n/**\n * Overlays the live HTML element of an {@link HtmlTexture} on top of the projected face of a planar mesh,\n * so the browser hit-tests the real DOM element natively (enabling focus, text selection and form input).\n *\n * Each frame the mesh face is projected to screen space and the element is translated, scaled and rotated\n * to match. This is best suited to planar, camera-facing surfaces. For arbitrary or curved meshes, use the\n * UV-based {@link HtmlRaycastInteractionManager} instead.\n *\n * The overlay is screen-aligned (position, size and in-plane rotation); it does not apply a full\n * perspective skew, so steeply oblique faces will not be perspective-correct.\n */\nexport class HtmlInteractionManager {\n private readonly _scene: Scene;\n private readonly _mesh: AbstractMesh;\n private readonly _element: HTMLElement;\n private _observer: Nullable<Observer<Scene>>;\n private _previousTransform: string = \"\";\n\n // Reused across frames to avoid per-frame allocations.\n private readonly _viewport = new Viewport(0, 0, 0, 0);\n private readonly _center = new Vector3();\n private readonly _xAxis = new Vector3();\n private readonly _yAxis = new Vector3();\n private readonly _projectedCenter = new Vector3();\n private readonly _projectedX = new Vector3();\n private readonly _projectedY = new Vector3();\n private readonly _corner = new Vector3();\n private _restoreInertOnDispose: boolean = false;\n\n /**\n * Creates an overlay interaction manager.\n * @param scene the scene whose camera drives the projection\n * @param texture the HTML texture whose element should be overlaid\n * @param mesh the planar mesh displaying the texture\n * @param options optional configuration\n */\n constructor(scene: Scene, texture: HtmlTexture, mesh: AbstractMesh, options: IHtmlInteractionManagerOptions = {}) {\n this._scene = scene;\n this._mesh = mesh;\n this._element = options.targetElement ?? texture.element;\n\n this._element.style.position = \"absolute\";\n this._element.style.left = \"0px\";\n this._element.style.top = \"0px\";\n this._element.style.transformOrigin = \"0 0\";\n this._element.style.pointerEvents = (options.enablePointerEvents ?? true) ? \"auto\" : \"none\";\n\n // This manager relies on native browser hit testing of the element. HtmlTexture marks the element\n // `inert` while hosting it inside the rendering canvas (so it does not steal input from the canvas);\n // clear that here so native interaction works, and restore it on dispose.\n this._restoreInertOnDispose = this._element.hasAttribute(\"inert\");\n if (this._restoreInertOnDispose) {\n this._element.removeAttribute(\"inert\");\n }\n\n this._observer = scene.onAfterRenderObservable.add(() => this._update());\n }\n\n private _update(): void {\n const camera = this._scene.activeCamera;\n const engine = this._scene.getEngine();\n if (!camera) {\n return;\n }\n\n const boundingBox = this._mesh.getBoundingInfo().boundingBox;\n const world = this._mesh.getWorldMatrix();\n const extend = boundingBox.extendSize;\n\n this._center.copyFrom(boundingBox.centerWorld);\n // World-space half-axis directions of the mesh face.\n Vector3.TransformNormalFromFloatsToRef(extend.x, 0, 0, world, this._xAxis);\n Vector3.TransformNormalFromFloatsToRef(0, extend.y, 0, world, this._yAxis);\n\n const transform = this._scene.getTransformMatrix();\n camera.viewport.toGlobalToRef(engine.getRenderWidth(), engine.getRenderHeight(), this._viewport);\n\n Vector3.ProjectToRef(this._center, Matrix.IdentityReadOnly, transform, this._viewport, this._projectedCenter);\n this._center.addToRef(this._xAxis, this._corner);\n Vector3.ProjectToRef(this._corner, Matrix.IdentityReadOnly, transform, this._viewport, this._projectedX);\n this._center.addToRef(this._yAxis, this._corner);\n Vector3.ProjectToRef(this._corner, Matrix.IdentityReadOnly, transform, this._viewport, this._projectedY);\n\n // Hide the overlay when the face is behind the camera.\n if (this._projectedCenter.z < 0 || this._projectedCenter.z > 1) {\n this._setTransform(\"translate(-99999px, -99999px)\");\n return;\n }\n\n const dpr = engine.getHardwareScalingLevel();\n const centerX = this._projectedCenter.x * dpr;\n const centerY = this._projectedCenter.y * dpr;\n\n const halfWidth = Math.hypot(this._projectedX.x - this._projectedCenter.x, this._projectedX.y - this._projectedCenter.y) * dpr;\n const halfHeight = Math.hypot(this._projectedY.x - this._projectedCenter.x, this._projectedY.y - this._projectedCenter.y) * dpr;\n const rotation = Math.atan2(this._projectedX.y - this._projectedCenter.y, this._projectedX.x - this._projectedCenter.x);\n\n const elementWidth = this._element.offsetWidth || 1;\n const elementHeight = this._element.offsetHeight || 1;\n const scaleX = (2 * halfWidth) / elementWidth;\n const scaleY = (2 * halfHeight) / elementHeight;\n\n this._setTransform(ComputeOverlayCssTransform(centerX, centerY, scaleX, scaleY, rotation, elementWidth, elementHeight));\n }\n\n private _setTransform(transform: string): void {\n if (transform === this._previousTransform) {\n return;\n }\n this._previousTransform = transform;\n this._element.style.transform = transform;\n }\n\n /**\n * Detaches the manager and stops updating the overlay.\n */\n public dispose(): void {\n if (this._restoreInertOnDispose) {\n this._element.setAttribute(\"inert\", \"\");\n this._restoreInertOnDispose = false;\n }\n if (this._observer) {\n this._scene.onAfterRenderObservable.remove(this._observer);\n this._observer = null;\n }\n }\n}\n"]}
1
+ {"version":3,"file":"htmlInteractionManager.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Materials/Textures/HTML/htmlInteractionManager.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,gCAAgC,EAAE,MAAM,wBAAwB,CAAC;AAE1E,kGAAkG;AAClG,mGAAmG;AACnG,4FAA4F;AAE5F;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,0BAA0B,CACtC,OAAe,EACf,OAAe,EACf,MAAc,EACd,MAAc,EACd,QAAgB,EAChB,YAAoB,EACpB,aAAqB;IAErB,OAAO,aAAa,OAAO,OAAO,OAAO,cAAc,QAAQ,cAAc,MAAM,KAAK,MAAM,eAAe,CAAC,YAAY,GAAG,CAAC,OAAO,CAAC,aAAa,GAAG,CAAC,KAAK,CAAC;AACjK,CAAC;AAYD;;;;;;;;;;GAUG;AACH,MAAM,OAAO,sBAAsB;IAuB/B;;;;;;OAMG;IACH,YAAY,KAAY,EAAE,OAAoB,EAAE,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;QACrC,CAAC;IACL,CAAC;IAEO,aAAa,CAAC,SAAiB;QACnC,IAAI,SAAS,KAAK,IAAI,CAAC,kBAAkB,EAAE,CAAC;YACxC,OAAO;QACX,CAAC;QACD,IAAI,CAAC,kBAAkB,GAAG,SAAS,CAAC;QACpC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,GAAG,SAAS,CAAC;IAC9C,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,CAAC,cAAc,EAAE,CAAC;QACtB,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC,aAAa,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC;QAC3E,IAAI,IAAI,CAAC,sBAAsB,EAAE,CAAC;YAC9B,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;YACxC,IAAI,CAAC,sBAAsB,GAAG,KAAK,CAAC;QACxC,CAAC;QACD,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACjB,IAAI,CAAC,MAAM,CAAC,uBAAuB,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAC3D,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QAC1B,CAAC;IACL,CAAC;CACJ","sourcesContent":["import { type Scene } from \"../../../scene.pure\";\nimport { type AbstractMesh } from \"../../../Meshes/abstractMesh.pure\";\nimport { type HtmlTexture } from \"./htmlTexture\";\nimport { type Observer } from \"../../../Misc/observable.pure\";\nimport { type Nullable } from \"../../../types\";\n\nimport { Matrix, Vector3 } from \"../../../Maths/math.vector.pure\";\nimport { Viewport } from \"../../../Maths/math.viewport\";\nimport { _IsHtmlInCanvasPolyfillInstalled } from \"./htmlInCanvasPolyfill\";\n\n// Attribution: the overlay-and-hit-test technique used here is prior art from `three-html-render`\n// (Palash Bansal, MIT), three.js' `InteractionManager`, and Jake Archibald's `curved-markup` demo.\n// The implementation below is a clean-room rewrite against Babylon.js' own projection APIs.\n\n/**\n * Builds the CSS `transform` string that positions an overlay element over the projected face of a mesh.\n *\n * The transform is applied with `transform-origin: 0 0`. Reading right to left it centers the element on\n * its own origin, scales and rotates it to match the projected face, then translates it to the projected\n * center (in CSS pixels, top-left origin).\n * @param centerX projected center X in CSS pixels\n * @param centerY projected center Y in CSS pixels\n * @param scaleX horizontal scale to apply to the element\n * @param scaleY vertical scale to apply to the element\n * @param rotation in-plane rotation in radians\n * @param elementWidth element width in pixels\n * @param elementHeight element height in pixels\n * @returns the CSS transform string\n */\nexport function ComputeOverlayCssTransform(\n centerX: number,\n centerY: number,\n scaleX: number,\n scaleY: number,\n rotation: number,\n elementWidth: number,\n elementHeight: number\n): string {\n return `translate(${centerX}px, ${centerY}px) rotate(${rotation}rad) scale(${scaleX}, ${scaleY}) translate(${-elementWidth / 2}px, ${-elementHeight / 2}px)`;\n}\n\n/**\n * Options for {@link HtmlInteractionManager}.\n */\nexport interface IHtmlInteractionManagerOptions {\n /** The DOM element to overlay (defaults to the texture's element). */\n targetElement?: HTMLElement;\n /** Whether the overlay element captures pointer events so the browser hit-tests it natively (default true). */\n enablePointerEvents?: boolean;\n}\n\n/**\n * Overlays the live HTML element of an {@link HtmlTexture} on top of the projected face of a planar mesh,\n * so the browser hit-tests the real DOM element natively (enabling focus, text selection and form input).\n *\n * Each frame the mesh face is projected to screen space and the element's canvas geometry is updated\n * to match. Older implementations use a CSS transform instead. This is best suited to planar,\n * camera-facing surfaces. For arbitrary or curved meshes, use the UV-based {@link HtmlRaycastInteractionManager} instead.\n *\n * The overlay is screen-aligned (position, size and in-plane rotation); it does not apply a full\n * perspective skew, so steeply oblique faces will not be perspective-correct.\n */\nexport class HtmlInteractionManager {\n private readonly _scene: Scene;\n private readonly _mesh: AbstractMesh;\n private readonly _element: HTMLElement;\n private _observer: Nullable<Observer<Scene>>;\n private _previousTransform: string = \"\";\n private readonly _canvas: Nullable<HTMLCanvasElement> = null;\n private readonly _canvasTransform: Nullable<DOMMatrix> = null;\n private readonly _geometryOptions: Nullable<UpdateElementGeometryOptions> = null;\n private _geometryRegistered = false;\n private readonly _stopPointerCapture = (event: Event) => event.stopPropagation();\n\n // Reused across frames to avoid per-frame allocations.\n private readonly _viewport = new Viewport(0, 0, 0, 0);\n private readonly _center = new Vector3();\n private readonly _xAxis = new Vector3();\n private readonly _yAxis = new Vector3();\n private readonly _projectedCenter = new Vector3();\n private readonly _projectedX = new Vector3();\n private readonly _projectedY = new Vector3();\n private readonly _corner = new Vector3();\n private _restoreInertOnDispose: boolean = false;\n\n /**\n * Creates an overlay interaction manager.\n * @param scene the scene whose camera drives the projection\n * @param texture the HTML texture whose element should be overlaid\n * @param mesh the planar mesh displaying the texture\n * @param options optional configuration\n */\n constructor(scene: Scene, texture: HtmlTexture, mesh: AbstractMesh, options: IHtmlInteractionManagerOptions = {}) {\n this._scene = scene;\n this._mesh = mesh;\n this._element = options.targetElement ?? texture.element;\n\n if (\n typeof HTMLCanvasElement !== \"undefined\" &&\n texture.host instanceof HTMLCanvasElement &&\n texture.host.content === \"drawable\" &&\n typeof texture.host.updateElementGeometry === \"function\" &&\n typeof texture.host.clearElementGeometry === \"function\" &&\n this._element.hasAttribute(\"drawable\") &&\n texture.host.contains(this._element) &&\n !_IsHtmlInCanvasPolyfillInstalled()\n ) {\n this._canvas = texture.host;\n this._canvasTransform = new DOMMatrix();\n this._geometryOptions = { canvasTransform: this._canvasTransform, preserveHitTestOrder: true };\n // Otherwise the engine captures the pointer on the canvas and retargets the button's up/click.\n this._element.addEventListener(\"pointerdown\", this._stopPointerCapture);\n }\n\n this._element.style.position = \"absolute\";\n this._element.style.left = \"0px\";\n this._element.style.top = \"0px\";\n this._element.style.transformOrigin = \"0 0\";\n this._element.style.pointerEvents = (options.enablePointerEvents ?? true) ? \"auto\" : \"none\";\n\n // This manager relies on native browser hit testing of the element. HtmlTexture marks the element\n // `inert` while hosting it inside the rendering canvas (so it does not steal input from the canvas);\n // clear that here so native interaction works, and restore it on dispose.\n this._restoreInertOnDispose = this._element.hasAttribute(\"inert\");\n if (this._restoreInertOnDispose) {\n this._element.removeAttribute(\"inert\");\n }\n\n this._observer = scene.onAfterRenderObservable.add(() => this._update());\n }\n\n private _update(): void {\n const camera = this._scene.activeCamera;\n const engine = this._scene.getEngine();\n if (!camera) {\n return;\n }\n\n const boundingBox = this._mesh.getBoundingInfo().boundingBox;\n const world = this._mesh.getWorldMatrix();\n const extend = boundingBox.extendSize;\n\n this._center.copyFrom(boundingBox.centerWorld);\n // World-space half-axis directions of the mesh face.\n Vector3.TransformNormalFromFloatsToRef(extend.x, 0, 0, world, this._xAxis);\n Vector3.TransformNormalFromFloatsToRef(0, extend.y, 0, world, this._yAxis);\n\n const transform = this._scene.getTransformMatrix();\n camera.viewport.toGlobalToRef(engine.getRenderWidth(), engine.getRenderHeight(), this._viewport);\n\n Vector3.ProjectToRef(this._center, Matrix.IdentityReadOnly, transform, this._viewport, this._projectedCenter);\n this._center.addToRef(this._xAxis, this._corner);\n Vector3.ProjectToRef(this._corner, Matrix.IdentityReadOnly, transform, this._viewport, this._projectedX);\n this._center.addToRef(this._yAxis, this._corner);\n Vector3.ProjectToRef(this._corner, Matrix.IdentityReadOnly, transform, this._viewport, this._projectedY);\n\n // Hide the overlay when the face is behind the camera.\n if (this._projectedCenter.z < 0 || this._projectedCenter.z > 1) {\n if (this._canvas) {\n this._clearGeometry();\n } else {\n this._setTransform(\"translate(-99999px, -99999px)\");\n }\n return;\n }\n\n const dpr = engine.getHardwareScalingLevel();\n const centerX = this._projectedCenter.x * dpr;\n const centerY = this._projectedCenter.y * dpr;\n\n const halfWidth = Math.hypot(this._projectedX.x - this._projectedCenter.x, this._projectedX.y - this._projectedCenter.y) * dpr;\n const halfHeight = Math.hypot(this._projectedY.x - this._projectedCenter.x, this._projectedY.y - this._projectedCenter.y) * dpr;\n const rotation = Math.atan2(this._projectedX.y - this._projectedCenter.y, this._projectedX.x - this._projectedCenter.x);\n\n const elementWidth = this._element.offsetWidth || 1;\n const elementHeight = this._element.offsetHeight || 1;\n const scaleX = (2 * halfWidth) / elementWidth;\n const scaleY = (2 * halfHeight) / elementHeight;\n\n if (this._canvas && this._canvasTransform && this._geometryOptions) {\n const cosine = Math.cos(rotation);\n const sine = Math.sin(rotation);\n const a = cosine * scaleX;\n const b = sine * scaleX;\n const c = -sine * scaleY;\n const d = cosine * scaleY;\n const e = centerX - (a * elementWidth + c * elementHeight) / 2;\n const f = centerY - (b * elementWidth + d * elementHeight) / 2;\n const matrix = this._canvasTransform;\n if (this._geometryRegistered && matrix.a === a && matrix.b === b && matrix.c === c && matrix.d === d && matrix.e === e && matrix.f === f) {\n return;\n }\n matrix.a = a;\n matrix.b = b;\n matrix.c = c;\n matrix.d = d;\n matrix.e = e;\n matrix.f = f;\n this._canvas.updateElementGeometry(this._element, this._geometryOptions);\n this._geometryRegistered = true;\n } else {\n this._setTransform(ComputeOverlayCssTransform(centerX, centerY, scaleX, scaleY, rotation, elementWidth, elementHeight));\n }\n }\n\n private _clearGeometry(): void {\n if (this._geometryRegistered && this._canvas) {\n if (this._element.hasAttribute(\"drawable\") && this._canvas.contains(this._element)) {\n this._canvas.clearElementGeometry(this._element);\n }\n this._geometryRegistered = false;\n }\n }\n\n private _setTransform(transform: string): void {\n if (transform === this._previousTransform) {\n return;\n }\n this._previousTransform = transform;\n this._element.style.transform = transform;\n }\n\n /**\n * Detaches the manager and stops updating the overlay.\n */\n public dispose(): void {\n this._clearGeometry();\n this._element.removeEventListener(\"pointerdown\", this._stopPointerCapture);\n if (this._restoreInertOnDispose) {\n this._element.setAttribute(\"inert\", \"\");\n this._restoreInertOnDispose = false;\n }\n if (this._observer) {\n this._scene.onAfterRenderObservable.remove(this._observer);\n this._observer = null;\n }\n }\n}\n"]}
@@ -19,9 +19,9 @@ export declare function IsHtmlInCanvasUploadSupported(engine: AbstractEngine): b
19
19
  *
20
20
  * This is a side-effect-free helper - it is only reachable when {@link HtmlTexture} (or a direct caller)
21
21
  * is imported, so it adds nothing to bundles that do not use it. It relies on
22
- * `WebGLRenderingContext.texElementImage2D` (WebGL) or `GPUQueue.copyElementImageToTexture` (WebGPU),
23
- * available either natively (behind chrome://flags/#canvas-draw-element) or through the
24
- * three-html-render polyfill.
22
+ * `WebGLRenderingContext.texElementSubImage2D` (WebGL) or `GPUQueue.drawElementImageToTexture` (WebGPU),
23
+ * with support for their older `texElementImage2D` / `copyElementImageToTexture` counterparts, including
24
+ * the three-html-render polyfill.
25
25
  * @param engine defines the engine that owns the texture
26
26
  * @param texture defines the internal texture to update
27
27
  * @param element defines the source HTML element (or captured ElementImage) to upload
@@ -61,11 +61,10 @@ export interface IHtmlTextureOptions {
61
61
  * A texture whose content is rendered from a live HTML element using the WICG HTML-in-Canvas API
62
62
  * (https://github.com/WICG/html-in-canvas).
63
63
  *
64
- * The element is hosted as a child of the engine's rendering canvas (which is marked `layoutsubtree`) so
65
- * the browser can lay it out and snapshot it; the WICG API requires the source element to be a direct
66
- * child of the canvas whose context performs the upload. Content is uploaded through
67
- * `WebGLRenderingContext.texElementImage2D` (WebGL) or `GPUQueue.copyElementImageToTexture` (WebGPU),
68
- * available either natively (behind chrome://flags/#canvas-draw-element) or via the three-html-render
64
+ * The element is hosted as a drawable child of the engine's rendering canvas (marked `content="drawable"`,
65
+ * or `layoutsubtree` on older implementations) so the browser can lay it out and snapshot it.
66
+ * Content is uploaded through `WebGLRenderingContext.texElementSubImage2D` (WebGL) or
67
+ * `GPUQueue.drawElementImageToTexture` (WebGPU), with support for older browsers and the three-html-render
69
68
  * polyfill (https://github.com/repalash/three-html-render). When neither is present, a built-in SVG
70
69
  * `<foreignObject>` fallback is used instead (see `useSvgFallback`).
71
70
  *
@@ -98,6 +97,8 @@ export declare class HtmlTexture extends BaseTexture {
98
97
  private _originalParent;
99
98
  private _originalNextSibling;
100
99
  private _addedInert;
100
+ private _addedDrawable;
101
+ private _updateRequested;
101
102
  private _width;
102
103
  private _height;
103
104
  /**
@@ -114,9 +115,8 @@ export declare class HtmlTexture extends BaseTexture {
114
115
  */
115
116
  getTextureMatrix(): Matrix;
116
117
  /**
117
- * Requests the host canvas to emit a paint event on the next rendering update. When auto-update is
118
- * enabled, this triggers a texture refresh in sync with the DOM. Falls back to an immediate update
119
- * when the WICG API is not available.
118
+ * Requests a texture refresh in sync with the host canvas's next paint event, even when auto-update is
119
+ * disabled. Updates immediately when the engine's WICG upload API is not available.
120
120
  */
121
121
  requestUpdate(): void;
122
122
  /**