@onerjs/core 8.56.3 → 9.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (484) hide show
  1. package/Animations/animatable.core.js +36 -0
  2. package/Animations/animatable.core.js.map +1 -1
  3. package/Animations/animationGroup.pure.d.ts +61 -1
  4. package/Animations/animationGroup.pure.js +191 -2
  5. package/Animations/animationGroup.pure.js.map +1 -1
  6. package/Animations/index.d.ts +1 -0
  7. package/Animations/index.js +1 -0
  8. package/Animations/index.js.map +1 -1
  9. package/Animations/pure.d.ts +1 -0
  10. package/Animations/pure.js +1 -0
  11. package/Animations/pure.js.map +1 -1
  12. package/Animations/rootMotion.d.ts +560 -0
  13. package/Animations/rootMotion.js +1709 -0
  14. package/Animations/rootMotion.js.map +1 -0
  15. package/Animations/runtimeAnimation.d.ts +57 -0
  16. package/Animations/runtimeAnimation.js +127 -3
  17. package/Animations/runtimeAnimation.js.map +1 -1
  18. package/Cameras/arcRotateCamera.pure.d.ts +2 -0
  19. package/Cameras/arcRotateCamera.pure.js +2 -0
  20. package/Cameras/arcRotateCamera.pure.js.map +1 -1
  21. package/Cameras/camera.pure.js +4 -0
  22. package/Cameras/camera.pure.js.map +1 -1
  23. package/Cameras/targetCamera.pure.d.ts +2 -0
  24. package/Cameras/targetCamera.pure.js +7 -1
  25. package/Cameras/targetCamera.pure.js.map +1 -1
  26. package/Collisions/gpuPicker.js +5 -5
  27. package/Collisions/gpuPicker.js.map +1 -1
  28. package/Engines/AbstractEngine/abstractEngine.query.pure.js +4 -2
  29. package/Engines/AbstractEngine/abstractEngine.query.pure.js.map +1 -1
  30. package/Engines/AbstractEngine/abstractEngine.query.types.d.ts +11 -2
  31. package/Engines/AbstractEngine/abstractEngine.query.types.js.map +1 -1
  32. package/Engines/AbstractEngine/abstractEngine.renderPass.pure.js +1 -0
  33. package/Engines/AbstractEngine/abstractEngine.renderPass.pure.js.map +1 -1
  34. package/Engines/Extensions/engine.multiRender.pure.js +63 -0
  35. package/Engines/Extensions/engine.multiRender.pure.js.map +1 -1
  36. package/Engines/Extensions/engine.multiRender.types.d.ts +13 -0
  37. package/Engines/Extensions/engine.multiRender.types.js.map +1 -1
  38. package/Engines/Extensions/engine.prefilteredCubeTexture.pure.js +2 -2
  39. package/Engines/Extensions/engine.prefilteredCubeTexture.pure.js.map +1 -1
  40. package/Engines/Extensions/engine.prefilteredCubeTexture.types.d.ts +2 -1
  41. package/Engines/Extensions/engine.prefilteredCubeTexture.types.js.map +1 -1
  42. package/Engines/Extensions/index.d.ts +1 -0
  43. package/Engines/Extensions/index.js +1 -0
  44. package/Engines/Extensions/index.js.map +1 -1
  45. package/Engines/Extensions/pure.d.ts +1 -1
  46. package/Engines/Extensions/pure.js +1 -1
  47. package/Engines/Extensions/pure.js.map +1 -1
  48. package/Engines/Native/Extensions/nativeEngine.cubeTexture.pure.js +88 -39
  49. package/Engines/Native/Extensions/nativeEngine.cubeTexture.pure.js.map +1 -1
  50. package/Engines/Native/Extensions/nativeEngine.cubeTexture.types.d.ts +20 -2
  51. package/Engines/Native/Extensions/nativeEngine.cubeTexture.types.js.map +1 -1
  52. package/Engines/WebGPU/Extensions/engine.multiRender.pure.js +4 -0
  53. package/Engines/WebGPU/Extensions/engine.multiRender.pure.js.map +1 -1
  54. package/Engines/WebGPU/Extensions/engine.multiRender.types.d.ts +13 -0
  55. package/Engines/WebGPU/Extensions/engine.multiRender.types.js.map +1 -1
  56. package/Engines/WebGPU/Extensions/engine.query.pure.js +11 -3
  57. package/Engines/WebGPU/Extensions/engine.query.pure.js.map +1 -1
  58. package/Engines/WebGPU/Extensions/index.d.ts +1 -0
  59. package/Engines/WebGPU/Extensions/index.js +1 -0
  60. package/Engines/WebGPU/Extensions/index.js.map +1 -1
  61. package/Engines/WebGPU/Extensions/pure.d.ts +1 -1
  62. package/Engines/WebGPU/Extensions/pure.js +1 -1
  63. package/Engines/WebGPU/Extensions/pure.js.map +1 -1
  64. package/Engines/WebGPU/webgpuBundleList.d.ts +2 -0
  65. package/Engines/WebGPU/webgpuBundleList.js +4 -0
  66. package/Engines/WebGPU/webgpuBundleList.js.map +1 -1
  67. package/Engines/WebGPU/webgpuCacheRenderPipeline.js +5 -2
  68. package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
  69. package/Engines/WebGPU/webgpuHardwareTexture.js +3 -1
  70. package/Engines/WebGPU/webgpuHardwareTexture.js.map +1 -1
  71. package/Engines/WebGPU/webgpuOcclusionQuery.js +1 -1
  72. package/Engines/WebGPU/webgpuOcclusionQuery.js.map +1 -1
  73. package/Engines/WebGPU/webgpuSnapshotRendering.d.ts +4 -0
  74. package/Engines/WebGPU/webgpuSnapshotRendering.js +40 -7
  75. package/Engines/WebGPU/webgpuSnapshotRendering.js.map +1 -1
  76. package/Engines/WebGPU/webgpuTextureHelper.d.ts +1 -1
  77. package/Engines/WebGPU/webgpuTextureHelper.js +2 -2
  78. package/Engines/WebGPU/webgpuTextureHelper.js.map +1 -1
  79. package/Engines/WebGPU/webgpuTextureManager.d.ts +2 -0
  80. package/Engines/WebGPU/webgpuTextureManager.js +286 -13
  81. package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
  82. package/Engines/abstractEngine.pure.d.ts +2 -0
  83. package/Engines/abstractEngine.pure.js +7 -3
  84. package/Engines/abstractEngine.pure.js.map +1 -1
  85. package/Engines/constants.d.ts +4 -0
  86. package/Engines/constants.js +4 -0
  87. package/Engines/constants.js.map +1 -1
  88. package/Engines/thinEngine.pure.d.ts +14 -0
  89. package/Engines/thinEngine.pure.js +48 -12
  90. package/Engines/thinEngine.pure.js.map +1 -1
  91. package/Engines/thinNativeEngine.pure.d.ts +1 -0
  92. package/Engines/thinNativeEngine.pure.js +7 -1
  93. package/Engines/thinNativeEngine.pure.js.map +1 -1
  94. package/Engines/thinWebGPUEngine.d.ts +4 -0
  95. package/Engines/thinWebGPUEngine.js +10 -1
  96. package/Engines/thinWebGPUEngine.js.map +1 -1
  97. package/Engines/webgpuEngine.pure.d.ts +5 -2
  98. package/Engines/webgpuEngine.pure.js +48 -13
  99. package/Engines/webgpuEngine.pure.js.map +1 -1
  100. package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.pure.js +2 -2
  101. package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.pure.js.map +1 -1
  102. package/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.pure.d.ts +11 -2
  103. package/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.pure.js +1 -1
  104. package/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.pure.js.map +1 -1
  105. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.pure.d.ts +9 -1
  106. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.pure.js +6 -8
  107. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.pure.js.map +1 -1
  108. package/FlowGraph/Blocks/Event/flowGraphPointerOutEventBlock.pure.d.ts +2 -0
  109. package/FlowGraph/Blocks/Event/flowGraphPointerOutEventBlock.pure.js +5 -1
  110. package/FlowGraph/Blocks/Event/flowGraphPointerOutEventBlock.pure.js.map +1 -1
  111. package/FlowGraph/Blocks/Event/flowGraphPointerOverEventBlock.pure.d.ts +2 -0
  112. package/FlowGraph/Blocks/Event/flowGraphPointerOverEventBlock.pure.js +5 -1
  113. package/FlowGraph/Blocks/Event/flowGraphPointerOverEventBlock.pure.js.map +1 -1
  114. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.pure.d.ts +9 -0
  115. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.pure.js +34 -9
  116. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.pure.js.map +1 -1
  117. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.pure.d.ts +2 -0
  118. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.pure.js +4 -0
  119. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.pure.js.map +1 -1
  120. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.pure.d.ts +2 -0
  121. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.pure.js +4 -0
  122. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.pure.js.map +1 -1
  123. package/FlowGraph/Blocks/Event/flowGraphSendCustomEventBlock.pure.js +19 -7
  124. package/FlowGraph/Blocks/Event/flowGraphSendCustomEventBlock.pure.js.map +1 -1
  125. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.pure.d.ts +20 -2
  126. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.pure.js +53 -10
  127. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.pure.js.map +1 -1
  128. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.pure.d.ts +16 -1
  129. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.pure.js +64 -14
  130. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.pure.js.map +1 -1
  131. package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.pure.js +64 -16
  132. package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.pure.js.map +1 -1
  133. package/FlowGraph/flowGraph.d.ts +4 -0
  134. package/FlowGraph/flowGraph.js +38 -7
  135. package/FlowGraph/flowGraph.js.map +1 -1
  136. package/FlowGraph/flowGraphBlock.js +3 -0
  137. package/FlowGraph/flowGraphBlock.js.map +1 -1
  138. package/FlowGraph/flowGraphConnection.d.ts +7 -0
  139. package/FlowGraph/flowGraphConnection.js +7 -0
  140. package/FlowGraph/flowGraphConnection.js.map +1 -1
  141. package/FlowGraph/flowGraphContext.d.ts +2 -1
  142. package/FlowGraph/flowGraphContext.js +4 -3
  143. package/FlowGraph/flowGraphContext.js.map +1 -1
  144. package/FlowGraph/flowGraphCoordinator.d.ts +15 -1
  145. package/FlowGraph/flowGraphCoordinator.js +47 -16
  146. package/FlowGraph/flowGraphCoordinator.js.map +1 -1
  147. package/FlowGraph/flowGraphEventBlock.d.ts +5 -0
  148. package/FlowGraph/flowGraphEventBlock.js +7 -0
  149. package/FlowGraph/flowGraphEventBlock.js.map +1 -1
  150. package/FlowGraph/flowGraphHostResolver.d.ts +2 -1
  151. package/FlowGraph/flowGraphHostResolver.js.map +1 -1
  152. package/FlowGraph/flowGraphParser.js +60 -2
  153. package/FlowGraph/flowGraphParser.js.map +1 -1
  154. package/FlowGraph/serialization.d.ts +2 -0
  155. package/FlowGraph/serialization.js +10 -22
  156. package/FlowGraph/serialization.js.map +1 -1
  157. package/FlowGraph/typeDefinitions.d.ts +8 -0
  158. package/FlowGraph/typeDefinitions.js.map +1 -1
  159. package/FrameGraph/Node/Blocks/PostProcesses/meshBlendingPostProcessBlock.d.ts +5 -0
  160. package/FrameGraph/Node/Blocks/PostProcesses/meshBlendingPostProcessBlock.js +8 -0
  161. package/FrameGraph/Node/Blocks/PostProcesses/meshBlendingPostProcessBlock.js.map +1 -0
  162. package/FrameGraph/Node/Blocks/PostProcesses/meshBlendingPostProcessBlock.pure.d.ts +87 -0
  163. package/FrameGraph/Node/Blocks/PostProcesses/meshBlendingPostProcessBlock.pure.js +295 -0
  164. package/FrameGraph/Node/Blocks/PostProcesses/meshBlendingPostProcessBlock.pure.js.map +1 -0
  165. package/FrameGraph/Node/Blocks/PostProcesses/pure.d.ts +1 -0
  166. package/FrameGraph/Node/Blocks/PostProcesses/pure.js +1 -0
  167. package/FrameGraph/Node/Blocks/PostProcesses/pure.js.map +1 -1
  168. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js +4 -4
  169. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js.map +1 -1
  170. package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.pure.d.ts +5 -1
  171. package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.pure.js +13 -1
  172. package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.pure.js.map +1 -1
  173. package/FrameGraph/Node/Blocks/allBlocks.pure.js +2 -0
  174. package/FrameGraph/Node/Blocks/allBlocks.pure.js.map +1 -1
  175. package/FrameGraph/Node/Blocks/index.d.ts +1 -0
  176. package/FrameGraph/Node/Blocks/index.js +1 -0
  177. package/FrameGraph/Node/Blocks/index.js.map +1 -1
  178. package/FrameGraph/Node/Blocks/inputBlock.pure.js +20 -1
  179. package/FrameGraph/Node/Blocks/inputBlock.pure.js.map +1 -1
  180. package/FrameGraph/Node/Blocks/pure.d.ts +1 -0
  181. package/FrameGraph/Node/Blocks/pure.js +1 -0
  182. package/FrameGraph/Node/Blocks/pure.js.map +1 -1
  183. package/FrameGraph/Node/Types/nodeRenderGraphTypes.d.ts +4 -2
  184. package/FrameGraph/Node/Types/nodeRenderGraphTypes.js +4 -2
  185. package/FrameGraph/Node/Types/nodeRenderGraphTypes.js.map +1 -1
  186. package/FrameGraph/Node/nodeRenderGraph.js +1 -1
  187. package/FrameGraph/Node/nodeRenderGraph.js.map +1 -1
  188. package/FrameGraph/Tasks/Layers/selectionOutlineTask.js +1 -0
  189. package/FrameGraph/Tasks/Layers/selectionOutlineTask.js.map +1 -1
  190. package/FrameGraph/Tasks/Misc/cullObjectsTask.js +5 -1
  191. package/FrameGraph/Tasks/Misc/cullObjectsTask.js.map +1 -1
  192. package/FrameGraph/Tasks/Misc/lightingVolumeTask.js +1 -0
  193. package/FrameGraph/Tasks/Misc/lightingVolumeTask.js.map +1 -1
  194. package/FrameGraph/Tasks/PostProcesses/meshBlendingTask.d.ts +69 -0
  195. package/FrameGraph/Tasks/PostProcesses/meshBlendingTask.js +223 -0
  196. package/FrameGraph/Tasks/PostProcesses/meshBlendingTask.js.map +1 -0
  197. package/FrameGraph/Tasks/Rendering/geometryRendererTask.d.ts +25 -3
  198. package/FrameGraph/Tasks/Rendering/geometryRendererTask.js +69 -33
  199. package/FrameGraph/Tasks/Rendering/geometryRendererTask.js.map +1 -1
  200. package/FrameGraph/Tasks/Rendering/objectRendererTask.js +3 -1
  201. package/FrameGraph/Tasks/Rendering/objectRendererTask.js.map +1 -1
  202. package/FrameGraph/frameGraphObjectList.d.ts +6 -1
  203. package/FrameGraph/frameGraphObjectList.js.map +1 -1
  204. package/FrameGraph/frameGraphRenderContext.d.ts +3 -1
  205. package/FrameGraph/frameGraphRenderContext.js +5 -5
  206. package/FrameGraph/frameGraphRenderContext.js.map +1 -1
  207. package/FrameGraph/index.d.ts +1 -0
  208. package/FrameGraph/index.js +1 -0
  209. package/FrameGraph/index.js.map +1 -1
  210. package/FrameGraph/pure.d.ts +1 -0
  211. package/FrameGraph/pure.js +1 -0
  212. package/FrameGraph/pure.js.map +1 -1
  213. package/Inputs/scene.inputManager.d.ts +4 -0
  214. package/Inputs/scene.inputManager.js +50 -8
  215. package/Inputs/scene.inputManager.js.map +1 -1
  216. package/Materials/GaussianSplatting/gaussianSplattingDebugMaterialPlugin.pure.js +5 -5
  217. package/Materials/GaussianSplatting/gaussianSplattingDebugMaterialPlugin.pure.js.map +1 -1
  218. package/Materials/GaussianSplatting/gaussianSplattingGpuPickingMaterialPlugin.pure.js +5 -5
  219. package/Materials/GaussianSplatting/gaussianSplattingGpuPickingMaterialPlugin.pure.js.map +1 -1
  220. package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.d.ts +26 -1
  221. package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.js +151 -47
  222. package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.js.map +1 -1
  223. package/Materials/GaussianSplatting/gaussianSplattingSolidColorMaterialPlugin.pure.js +5 -5
  224. package/Materials/GaussianSplatting/gaussianSplattingSolidColorMaterialPlugin.pure.js.map +1 -1
  225. package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.pure.js +11 -1
  226. package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.pure.js.map +1 -1
  227. package/Materials/Node/Blocks/Fragment/prePassOutputBlock.pure.js +17 -2
  228. package/Materials/Node/Blocks/Fragment/prePassOutputBlock.pure.js.map +1 -1
  229. package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.pure.js +2 -2
  230. package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.pure.js.map +1 -1
  231. package/Materials/Node/nodeMaterial.pure.d.ts +4 -0
  232. package/Materials/Node/nodeMaterial.pure.js +4 -0
  233. package/Materials/Node/nodeMaterial.pure.js.map +1 -1
  234. package/Materials/Node/nodeMaterialBuildState.d.ts +1 -1
  235. package/Materials/Node/nodeMaterialBuildState.js +25 -3
  236. package/Materials/Node/nodeMaterialBuildState.js.map +1 -1
  237. package/Materials/PBR/openpbrMaterial.pure.d.ts +2 -0
  238. package/Materials/PBR/pbrBaseMaterial.pure.d.ts +2 -0
  239. package/Materials/Textures/Procedurals/proceduralTexture.pure.d.ts +13 -14
  240. package/Materials/Textures/Procedurals/proceduralTexture.pure.js +6 -6
  241. package/Materials/Textures/Procedurals/proceduralTexture.pure.js.map +1 -1
  242. package/Materials/Textures/baseTexture.pure.js +3 -0
  243. package/Materials/Textures/baseTexture.pure.js.map +1 -1
  244. package/Materials/Textures/cubeTexture.pure.js +1 -1
  245. package/Materials/Textures/cubeTexture.pure.js.map +1 -1
  246. package/Materials/Textures/internalTexture.d.ts +8 -1
  247. package/Materials/Textures/internalTexture.js +9 -2
  248. package/Materials/Textures/internalTexture.js.map +1 -1
  249. package/Materials/Textures/rawTexture2DArray.functions.d.ts +3 -3
  250. package/Materials/Textures/rawTexture2DArray.functions.js.map +1 -1
  251. package/Materials/Textures/rawTexture3D.d.ts +1 -1
  252. package/Materials/Textures/rawTexture3D.js +1 -1
  253. package/Materials/Textures/rawTexture3D.js.map +1 -1
  254. package/Materials/Textures/textureHelper.functions.d.ts +14 -0
  255. package/Materials/Textures/textureHelper.functions.js +24 -0
  256. package/Materials/Textures/textureHelper.functions.js.map +1 -1
  257. package/Materials/ditheredTileFadeMaterialPlugin.d.ts +210 -0
  258. package/Materials/ditheredTileFadeMaterialPlugin.js +509 -0
  259. package/Materials/ditheredTileFadeMaterialPlugin.js.map +1 -0
  260. package/Materials/index.d.ts +1 -0
  261. package/Materials/index.js +1 -0
  262. package/Materials/index.js.map +1 -1
  263. package/Materials/materialHelper.geometryrendering.d.ts +46 -1
  264. package/Materials/materialHelper.geometryrendering.js +105 -8
  265. package/Materials/materialHelper.geometryrendering.js.map +1 -1
  266. package/Materials/prepass.defines.d.ts +2 -0
  267. package/Materials/prepass.defines.js +2 -0
  268. package/Materials/prepass.defines.js.map +1 -1
  269. package/Materials/pure.d.ts +1 -0
  270. package/Materials/pure.js +1 -0
  271. package/Materials/pure.js.map +1 -1
  272. package/Materials/standardMaterial.pure.d.ts +2 -0
  273. package/Materials/standardMaterial.pure.js +6 -3
  274. package/Materials/standardMaterial.pure.js.map +1 -1
  275. package/Meshes/Builders/polygonBuilder.pure.d.ts +4 -0
  276. package/Meshes/Builders/polygonBuilder.pure.js +4 -1
  277. package/Meshes/Builders/polygonBuilder.pure.js.map +1 -1
  278. package/Meshes/GaussianSplatting/gaussianSplatting.functions.d.ts +19 -0
  279. package/Meshes/GaussianSplatting/gaussianSplatting.functions.js +23 -0
  280. package/Meshes/GaussianSplatting/gaussianSplatting.functions.js.map +1 -0
  281. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.d.ts +3 -14
  282. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js +20 -24
  283. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js.map +1 -1
  284. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.d.ts +2 -0
  285. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js +11 -4
  286. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js.map +1 -1
  287. package/Meshes/abstractMesh.pure.d.ts +18 -0
  288. package/Meshes/abstractMesh.pure.js +22 -0
  289. package/Meshes/abstractMesh.pure.js.map +1 -1
  290. package/Meshes/index.d.ts +1 -0
  291. package/Meshes/index.js +1 -0
  292. package/Meshes/index.js.map +1 -1
  293. package/Meshes/instancedMesh.pure.d.ts +5 -0
  294. package/Meshes/instancedMesh.pure.js +12 -0
  295. package/Meshes/instancedMesh.pure.js.map +1 -1
  296. package/Meshes/mesh.pure.js +23 -8
  297. package/Meshes/mesh.pure.js.map +1 -1
  298. package/Meshes/meshBlendingTag.d.ts +47 -0
  299. package/Meshes/meshBlendingTag.js +64 -0
  300. package/Meshes/meshBlendingTag.js.map +1 -0
  301. package/Meshes/polygonMesh.js +2 -2
  302. package/Meshes/polygonMesh.js.map +1 -1
  303. package/Meshes/pure.d.ts +1 -0
  304. package/Meshes/pure.js +1 -0
  305. package/Meshes/pure.js.map +1 -1
  306. package/Misc/fileTools.pure.js +21 -0
  307. package/Misc/fileTools.pure.js.map +1 -1
  308. package/Misc/snapshotRenderingHelper.js +2 -2
  309. package/Misc/snapshotRenderingHelper.js.map +1 -1
  310. package/Misc/tools.pure.js +1 -1
  311. package/Misc/tools.pure.js.map +1 -1
  312. package/Particles/gpuParticleSystem.pure.d.ts +2 -0
  313. package/Particles/gpuParticleSystem.pure.js +89 -28
  314. package/Particles/gpuParticleSystem.pure.js.map +1 -1
  315. package/Particles/thinParticleSystem.pure.d.ts +2 -0
  316. package/Particles/thinParticleSystem.pure.js +84 -19
  317. package/Particles/thinParticleSystem.pure.js.map +1 -1
  318. package/Particles/webgl2ParticleSystem.pure.d.ts +1 -0
  319. package/Particles/webgl2ParticleSystem.pure.js +12 -4
  320. package/Particles/webgl2ParticleSystem.pure.js.map +1 -1
  321. package/PostProcesses/RenderPipeline/Pipelines/lensRenderingPipeline.pure.js +7 -0
  322. package/PostProcesses/RenderPipeline/Pipelines/lensRenderingPipeline.pure.js.map +1 -1
  323. package/PostProcesses/index.d.ts +2 -0
  324. package/PostProcesses/index.js +2 -0
  325. package/PostProcesses/index.js.map +1 -1
  326. package/PostProcesses/meshBlendingBlueNoise.d.ts +15 -0
  327. package/PostProcesses/meshBlendingBlueNoise.js +77 -0
  328. package/PostProcesses/meshBlendingBlueNoise.js.map +1 -0
  329. package/PostProcesses/meshBlendingPostProcess.d.ts +131 -0
  330. package/PostProcesses/meshBlendingPostProcess.js +315 -0
  331. package/PostProcesses/meshBlendingPostProcess.js.map +1 -0
  332. package/PostProcesses/pure.d.ts +2 -0
  333. package/PostProcesses/pure.js +2 -0
  334. package/PostProcesses/pure.js.map +1 -1
  335. package/PostProcesses/thinMeshBlendingPostProcess.d.ts +339 -0
  336. package/PostProcesses/thinMeshBlendingPostProcess.js +771 -0
  337. package/PostProcesses/thinMeshBlendingPostProcess.js.map +1 -0
  338. package/Rendering/IBLShadows/iblShadowsRenderPipeline.pure.js +6 -6
  339. package/Rendering/IBLShadows/iblShadowsRenderPipeline.pure.js.map +1 -1
  340. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.pure.js +8 -8
  341. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.pure.js.map +1 -1
  342. package/Rendering/boundingBoxRenderer.pure.js +2 -1
  343. package/Rendering/boundingBoxRenderer.pure.js.map +1 -1
  344. package/Rendering/depthRenderer.pure.js +3 -4
  345. package/Rendering/depthRenderer.pure.js.map +1 -1
  346. package/Rendering/edgesRenderer.pure.d.ts +4 -2
  347. package/Rendering/edgesRenderer.pure.js +11 -2
  348. package/Rendering/edgesRenderer.pure.js.map +1 -1
  349. package/Rendering/fluidRenderer/fluidRenderingObject.d.ts +10 -0
  350. package/Rendering/fluidRenderer/fluidRenderingObject.js +20 -0
  351. package/Rendering/fluidRenderer/fluidRenderingObject.js.map +1 -1
  352. package/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.d.ts +9 -3
  353. package/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.js +14 -9
  354. package/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.js.map +1 -1
  355. package/Rendering/geometryBufferRenderer.pure.d.ts +38 -4
  356. package/Rendering/geometryBufferRenderer.pure.js +126 -17
  357. package/Rendering/geometryBufferRenderer.pure.js.map +1 -1
  358. package/Rendering/objectRenderer.d.ts +7 -1
  359. package/Rendering/objectRenderer.js +45 -7
  360. package/Rendering/objectRenderer.js.map +1 -1
  361. package/Rendering/outlineRenderer.pure.js +6 -2
  362. package/Rendering/outlineRenderer.pure.js.map +1 -1
  363. package/Rendering/renderingManager.d.ts +1 -1
  364. package/Rendering/renderingManager.js +5 -4
  365. package/Rendering/renderingManager.js.map +1 -1
  366. package/Shaders/ShadersInclude/defaultFragmentAlpha.d.ts +5 -0
  367. package/Shaders/ShadersInclude/defaultFragmentAlpha.js +34 -0
  368. package/Shaders/ShadersInclude/defaultFragmentAlpha.js.map +1 -0
  369. package/Shaders/ShadersInclude/gaussianSplattingVertexDeclaration.js +5 -1
  370. package/Shaders/ShadersInclude/gaussianSplattingVertexDeclaration.js.map +1 -1
  371. package/Shaders/ShadersInclude/geometryRenderingFragment.d.ts +5 -0
  372. package/Shaders/ShadersInclude/geometryRenderingFragment.js +74 -0
  373. package/Shaders/ShadersInclude/geometryRenderingFragment.js.map +1 -0
  374. package/Shaders/ShadersInclude/mrtFragmentDeclaration.js +89 -0
  375. package/Shaders/ShadersInclude/mrtFragmentDeclaration.js.map +1 -1
  376. package/Shaders/ShadersInclude/openpbrBlockPrePass.js +24 -17
  377. package/Shaders/ShadersInclude/openpbrBlockPrePass.js.map +1 -1
  378. package/Shaders/ShadersInclude/pbrBlockPrePass.js +27 -20
  379. package/Shaders/ShadersInclude/pbrBlockPrePass.js.map +1 -1
  380. package/Shaders/ShadersInclude/pbrDebug.js +6 -2
  381. package/Shaders/ShadersInclude/pbrDebug.js.map +1 -1
  382. package/Shaders/ShadersInclude/prePassDeclaration.js +95 -2
  383. package/Shaders/ShadersInclude/prePassDeclaration.js.map +1 -1
  384. package/Shaders/default.fragment.js +31 -40
  385. package/Shaders/default.fragment.js.map +1 -1
  386. package/Shaders/depthOfField.fragment.js +13 -9
  387. package/Shaders/depthOfField.fragment.js.map +1 -1
  388. package/Shaders/fluidRenderingParticleDepth.vertex.js +16 -1
  389. package/Shaders/fluidRenderingParticleDepth.vertex.js.map +1 -1
  390. package/Shaders/fluidRenderingParticleThickness.vertex.js +16 -1
  391. package/Shaders/fluidRenderingParticleThickness.vertex.js.map +1 -1
  392. package/Shaders/gaussianSplatting.fragment.js +63 -3
  393. package/Shaders/gaussianSplatting.fragment.js.map +1 -1
  394. package/Shaders/gaussianSplatting.vertex.js +80 -0
  395. package/Shaders/gaussianSplatting.vertex.js.map +1 -1
  396. package/Shaders/geometry.fragment.js +17 -11
  397. package/Shaders/geometry.fragment.js.map +1 -1
  398. package/Shaders/gpuRenderParticles.fragment.js +43 -1
  399. package/Shaders/gpuRenderParticles.fragment.js.map +1 -1
  400. package/Shaders/gpuRenderParticles.vertex.js +96 -16
  401. package/Shaders/gpuRenderParticles.vertex.js.map +1 -1
  402. package/Shaders/meshBlending.fragment.d.ts +5 -0
  403. package/Shaders/meshBlending.fragment.js +519 -0
  404. package/Shaders/meshBlending.fragment.js.map +1 -0
  405. package/Shaders/particles.fragment.js +43 -1
  406. package/Shaders/particles.fragment.js.map +1 -1
  407. package/Shaders/particles.vertex.js +84 -3
  408. package/Shaders/particles.vertex.js.map +1 -1
  409. package/Shaders/sprites.fragment.js +52 -2
  410. package/Shaders/sprites.fragment.js.map +1 -1
  411. package/Shaders/sprites.vertex.js +62 -1
  412. package/Shaders/sprites.vertex.js.map +1 -1
  413. package/ShadersWGSL/ShadersInclude/defaultFragmentAlpha.d.ts +5 -0
  414. package/ShadersWGSL/ShadersInclude/defaultFragmentAlpha.js +33 -0
  415. package/ShadersWGSL/ShadersInclude/defaultFragmentAlpha.js.map +1 -0
  416. package/ShadersWGSL/ShadersInclude/geometryRenderingFragment.d.ts +6 -0
  417. package/ShadersWGSL/ShadersInclude/geometryRenderingFragment.js +76 -0
  418. package/ShadersWGSL/ShadersInclude/geometryRenderingFragment.js.map +1 -0
  419. package/ShadersWGSL/ShadersInclude/lightFragment.js +1 -1
  420. package/ShadersWGSL/ShadersInclude/lightFragment.js.map +1 -1
  421. package/ShadersWGSL/ShadersInclude/meshBlendTagFragmentOutput.d.ts +5 -0
  422. package/ShadersWGSL/ShadersInclude/meshBlendTagFragmentOutput.js +18 -0
  423. package/ShadersWGSL/ShadersInclude/meshBlendTagFragmentOutput.js.map +1 -0
  424. package/ShadersWGSL/ShadersInclude/openpbrBlockPrePass.d.ts +1 -0
  425. package/ShadersWGSL/ShadersInclude/openpbrBlockPrePass.js +11 -25
  426. package/ShadersWGSL/ShadersInclude/openpbrBlockPrePass.js.map +1 -1
  427. package/ShadersWGSL/ShadersInclude/pbrBlockPrePass.d.ts +1 -0
  428. package/ShadersWGSL/ShadersInclude/pbrBlockPrePass.js +11 -25
  429. package/ShadersWGSL/ShadersInclude/pbrBlockPrePass.js.map +1 -1
  430. package/ShadersWGSL/ShadersInclude/pbrDebug.js +5 -1
  431. package/ShadersWGSL/ShadersInclude/pbrDebug.js.map +1 -1
  432. package/ShadersWGSL/ShadersInclude/prePassDeclaration.js +6 -1
  433. package/ShadersWGSL/ShadersInclude/prePassDeclaration.js.map +1 -1
  434. package/ShadersWGSL/default.fragment.js +17 -48
  435. package/ShadersWGSL/default.fragment.js.map +1 -1
  436. package/ShadersWGSL/fluidRenderingParticleDepth.vertex.js +15 -2
  437. package/ShadersWGSL/fluidRenderingParticleDepth.vertex.js.map +1 -1
  438. package/ShadersWGSL/fluidRenderingParticleThickness.vertex.js +15 -2
  439. package/ShadersWGSL/fluidRenderingParticleThickness.vertex.js.map +1 -1
  440. package/ShadersWGSL/gaussianSplatting.fragment.js +63 -2
  441. package/ShadersWGSL/gaussianSplatting.fragment.js.map +1 -1
  442. package/ShadersWGSL/gaussianSplatting.vertex.js +80 -0
  443. package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
  444. package/ShadersWGSL/geometry.fragment.js +37 -2
  445. package/ShadersWGSL/geometry.fragment.js.map +1 -1
  446. package/ShadersWGSL/gpuRenderParticles.fragment.js +47 -2
  447. package/ShadersWGSL/gpuRenderParticles.fragment.js.map +1 -1
  448. package/ShadersWGSL/gpuRenderParticles.vertex.js +110 -7
  449. package/ShadersWGSL/gpuRenderParticles.vertex.js.map +1 -1
  450. package/ShadersWGSL/meshBlending.fragment.d.ts +5 -0
  451. package/ShadersWGSL/meshBlending.fragment.js +576 -0
  452. package/ShadersWGSL/meshBlending.fragment.js.map +1 -0
  453. package/ShadersWGSL/openpbr.fragment.js +2 -1
  454. package/ShadersWGSL/openpbr.fragment.js.map +1 -1
  455. package/ShadersWGSL/particles.fragment.js +45 -1
  456. package/ShadersWGSL/particles.fragment.js.map +1 -1
  457. package/ShadersWGSL/particles.vertex.js +86 -4
  458. package/ShadersWGSL/particles.vertex.js.map +1 -1
  459. package/ShadersWGSL/pbr.fragment.js +2 -1
  460. package/ShadersWGSL/pbr.fragment.js.map +1 -1
  461. package/ShadersWGSL/sprites.fragment.js +56 -2
  462. package/ShadersWGSL/sprites.fragment.js.map +1 -1
  463. package/ShadersWGSL/sprites.vertex.js +62 -1
  464. package/ShadersWGSL/sprites.vertex.js.map +1 -1
  465. package/Sprites/spriteManager.d.ts +13 -0
  466. package/Sprites/spriteManager.js +15 -0
  467. package/Sprites/spriteManager.js.map +1 -1
  468. package/Sprites/spriteRenderer.d.ts +24 -1
  469. package/Sprites/spriteRenderer.js +368 -50
  470. package/Sprites/spriteRenderer.js.map +1 -1
  471. package/Sprites/thinSprite.d.ts +4 -0
  472. package/Sprites/thinSprite.js +4 -0
  473. package/Sprites/thinSprite.js.map +1 -1
  474. package/States/alphaCullingState.d.ts +3 -1
  475. package/States/alphaCullingState.js +18 -3
  476. package/States/alphaCullingState.js.map +1 -1
  477. package/XR/webXRDefaultExperience.d.ts +5 -1
  478. package/XR/webXRDefaultExperience.js.map +1 -1
  479. package/XR/webXREnterExitUI.d.ts +2 -1
  480. package/XR/webXREnterExitUI.js.map +1 -1
  481. package/package.json +1 -1
  482. package/scene.pure.d.ts +23 -0
  483. package/scene.pure.js +35 -0
  484. package/scene.pure.js.map +1 -1
@@ -0,0 +1,223 @@
1
+
2
+ import { MeshBlendDepthType, ThinMeshBlendingPostProcess, _ClaimMeshBlendingEffectWrapper, _IsMeshBlendingEffectWrapperOwned, _ReleaseMeshBlendingEffectWrapper, } from "../../../PostProcesses/thinMeshBlendingPostProcess.js";
3
+ import { FrameGraphPostProcessTask } from "./postProcessTask.js";
4
+ import { _IsMeshBlendingSupported } from "../../../Meshes/meshBlendingTag.js";
5
+ function _Is2DTexture(creationOptions) {
6
+ return (creationOptions.options.targetTypes?.[0] ?? 3553) === 3553;
7
+ }
8
+ function _GetTextureType(creationOptions) {
9
+ return creationOptions.options.types?.[0] ?? 0;
10
+ }
11
+ function _GetTextureFormat(creationOptions) {
12
+ return creationOptions.options.formats?.[0] ?? 5;
13
+ }
14
+ /**
15
+ * Frame-graph task which visually blends SceneColor across validated contacts between opaque or alpha-tested meshes.
16
+ *
17
+ * This WebGL2 and WebGPU task uses the same effect and configuration as MeshBlendingPostProcess. It does not modify
18
+ * geometry, collision queries, depth, normals, or shadows. All source and geometry textures must have matching
19
+ * physical dimensions and sample counts. Transparent rendering is caller-controlled; overlapping transparent
20
+ * surfaces can make SceneColor inconsistent with the single-layer geometry inputs. On WebGL2, rendering transparent
21
+ * meshes into the integer tag attachment requires per-target blend parameters.
22
+ * @see https://playground.babylonjs.com/?version=preview#O05LI8#6
23
+ */
24
+ export class FrameGraphMeshBlendingTask extends FrameGraphPostProcessTask {
25
+ /** Gets or sets the compile-time mesh-blending quality variant. */
26
+ get quality() {
27
+ return this.postProcess.quality;
28
+ }
29
+ set quality(value) {
30
+ this.postProcess.quality = value;
31
+ }
32
+ /** Gets the four configurable radius definitions indexed by packed radius class. */
33
+ get radiusClasses() {
34
+ return this.postProcess.radiusClasses;
35
+ }
36
+ /** Gets or sets the contact-slope narrowing factor. A value of 1 disables narrowing. */
37
+ get slopeFactor() {
38
+ return this.postProcess.slopeFactor;
39
+ }
40
+ set slopeFactor(value) {
41
+ this.postProcess.slopeFactor = value;
42
+ }
43
+ /** Gets or sets the representation stored in depthTexture. */
44
+ get depthType() {
45
+ return this.postProcess.depthType;
46
+ }
47
+ set depthType(value) {
48
+ this.postProcess.depthType = value;
49
+ }
50
+ /** Gets or sets the compiled debug visualization. */
51
+ get debugMode() {
52
+ return this.postProcess.debugMode;
53
+ }
54
+ set debugMode(value) {
55
+ this.postProcess.debugMode = value;
56
+ }
57
+ /**
58
+ * Constructs a mesh-blending task.
59
+ * @param name The name of the task.
60
+ * @param frameGraph The frame graph this task belongs to.
61
+ * @param thinPostProcess The thin post process to use. A new one is created when omitted.
62
+ */
63
+ constructor(name, frameGraph, thinPostProcess) {
64
+ if (thinPostProcess && thinPostProcess.options.engine !== frameGraph.engine) {
65
+ throw new Error(`FrameGraphMeshBlendingTask "${name}": thinPostProcess must use the frame graph engine`);
66
+ }
67
+ if (thinPostProcess && _IsMeshBlendingEffectWrapperOwned(thinPostProcess)) {
68
+ throw new Error(`FrameGraphMeshBlendingTask "${name}": thinPostProcess is already attached to another owner`);
69
+ }
70
+ super(name, frameGraph, thinPostProcess || new ThinMeshBlendingPostProcess(name, frameGraph.engine));
71
+ _ClaimMeshBlendingEffectWrapper(this.postProcess, this);
72
+ this.sourceSamplingMode = 1;
73
+ }
74
+ dispose() {
75
+ _ReleaseMeshBlendingEffectWrapper(this.postProcess, this);
76
+ super.dispose();
77
+ }
78
+ /**
79
+ * Applies the same configuration accepted by the classic MeshBlendingPostProcess wrapper.
80
+ * @param options Values to apply. Omitted values retain their current settings.
81
+ */
82
+ configure(options) {
83
+ this.postProcess.configure(options);
84
+ }
85
+ getClassName() {
86
+ return "FrameGraphMeshBlendingTask";
87
+ }
88
+ record(skipCreationOfDisabledPasses = false) {
89
+ this.sourceSamplingMode = 1;
90
+ if (this.sourceTexture === undefined || this.meshBlendTagTexture === undefined || this.depthTexture === undefined || this.camera === undefined) {
91
+ throw new Error(`FrameGraphMeshBlendingTask "${this.name}": sourceTexture, meshBlendTagTexture, depthTexture and camera are required`);
92
+ }
93
+ const engine = this._frameGraph.engine;
94
+ if (!_IsMeshBlendingSupported(engine)) {
95
+ throw new Error(`FrameGraphMeshBlendingTask "${this.name}": mesh blending requires WebGL2 or WebGPU`);
96
+ }
97
+ if (this.depthType !== MeshBlendDepthType.View && this.depthType !== MeshBlendDepthType.Screen) {
98
+ throw new Error(`FrameGraphMeshBlendingTask "${this.name}": depthType must be View or Screen`);
99
+ }
100
+ const meshBlendTagCreationOptions = this._frameGraph.textureManager.getTextureCreationOptions(this.meshBlendTagTexture);
101
+ const meshBlendTagType = _GetTextureType(meshBlendTagCreationOptions);
102
+ const meshBlendTagFormat = _GetTextureFormat(meshBlendTagCreationOptions);
103
+ const meshBlendTagSamples = meshBlendTagCreationOptions.options.samples ?? 1;
104
+ if (meshBlendTagType !== 0 || meshBlendTagFormat !== 8) {
105
+ throw new Error(`FrameGraphMeshBlendingTask "${this.name}": meshBlendTagTexture must use TEXTURETYPE_UNSIGNED_BYTE with TEXTUREFORMAT_RED_INTEGER`);
106
+ }
107
+ if (!_Is2DTexture(meshBlendTagCreationOptions)) {
108
+ throw new Error(`FrameGraphMeshBlendingTask "${this.name}": meshBlendTagTexture must be a 2D texture`);
109
+ }
110
+ if (meshBlendTagSamples !== 1) {
111
+ throw new Error(`FrameGraphMeshBlendingTask "${this.name}": meshBlendTagTexture must be single-sampled`);
112
+ }
113
+ if (meshBlendTagCreationOptions.options.createMipMaps) {
114
+ throw new Error(`FrameGraphMeshBlendingTask "${this.name}": meshBlendTagTexture must not use mipmaps`);
115
+ }
116
+ const depthCreationOptions = this._frameGraph.textureManager.getTextureCreationOptions(this.depthTexture);
117
+ const depthType = _GetTextureType(depthCreationOptions);
118
+ const depthFormat = _GetTextureFormat(depthCreationOptions);
119
+ const depthSamples = depthCreationOptions.options.samples ?? 1;
120
+ const validDepthFormat = depthFormat === 6 || depthFormat === 7 || depthFormat === 5;
121
+ const validDepthType = depthType === 1 ||
122
+ depthType === 2 ||
123
+ (this.depthType === MeshBlendDepthType.Screen && depthType === 0);
124
+ if (!validDepthFormat || !validDepthType) {
125
+ throw new Error(`FrameGraphMeshBlendingTask "${this.name}": ${this.depthType === MeshBlendDepthType.View ? "view" : "screen"} depthTexture has an incompatible type or format`);
126
+ }
127
+ if (!_Is2DTexture(depthCreationOptions)) {
128
+ throw new Error(`FrameGraphMeshBlendingTask "${this.name}": depthTexture must be a 2D texture`);
129
+ }
130
+ if (depthSamples !== 1) {
131
+ throw new Error(`FrameGraphMeshBlendingTask "${this.name}": depthTexture must be single-sampled`);
132
+ }
133
+ if (depthCreationOptions.options.createMipMaps) {
134
+ throw new Error(`FrameGraphMeshBlendingTask "${this.name}": depthTexture must not use mipmaps`);
135
+ }
136
+ let baseColorSamples;
137
+ if (this.baseColorTexture !== undefined) {
138
+ const baseColorCreationOptions = this._frameGraph.textureManager.getTextureCreationOptions(this.baseColorTexture);
139
+ const baseColorType = _GetTextureType(baseColorCreationOptions);
140
+ const baseColorFormat = _GetTextureFormat(baseColorCreationOptions);
141
+ baseColorSamples = baseColorCreationOptions.options.samples ?? 1;
142
+ const validBaseColorFormat = baseColorFormat === 4 || baseColorFormat === 5;
143
+ const validBaseColorType = baseColorType === 0 || baseColorType === 2 || baseColorType === 1;
144
+ if (!validBaseColorFormat || !validBaseColorType) {
145
+ throw new Error(`FrameGraphMeshBlendingTask "${this.name}": baseColorTexture must use a non-integer RGB or RGBA color format`);
146
+ }
147
+ if (!_Is2DTexture(baseColorCreationOptions)) {
148
+ throw new Error(`FrameGraphMeshBlendingTask "${this.name}": baseColorTexture must be a 2D texture`);
149
+ }
150
+ if (baseColorCreationOptions.options.createMipMaps) {
151
+ throw new Error(`FrameGraphMeshBlendingTask "${this.name}": baseColorTexture must not use mipmaps`);
152
+ }
153
+ }
154
+ const sourceCreationOptions = this._frameGraph.textureManager.getTextureCreationOptions(this.sourceTexture);
155
+ const sourceType = _GetTextureType(sourceCreationOptions);
156
+ const sourceFormat = _GetTextureFormat(sourceCreationOptions);
157
+ const sourceSamples = sourceCreationOptions.options.samples ?? 1;
158
+ const validSourceFormat = sourceFormat === 4 || sourceFormat === 5;
159
+ const validSourceType = sourceType === 0 || sourceType === 2 || sourceType === 1;
160
+ if (!validSourceFormat || !validSourceType) {
161
+ throw new Error(`FrameGraphMeshBlendingTask "${this.name}": sourceTexture must use a non-integer RGB or RGBA color format`);
162
+ }
163
+ if (!_Is2DTexture(sourceCreationOptions)) {
164
+ throw new Error(`FrameGraphMeshBlendingTask "${this.name}": sourceTexture must be a 2D texture`);
165
+ }
166
+ if (sourceSamples !== meshBlendTagSamples || sourceSamples !== depthSamples || (baseColorSamples !== undefined && sourceSamples !== baseColorSamples)) {
167
+ throw new Error(`FrameGraphMeshBlendingTask "${this.name}": sourceTexture, meshBlendTagTexture, depthTexture and baseColorTexture when provided must have matching sample counts`);
168
+ }
169
+ const sourceSize = this._frameGraph.textureManager.getTextureDescription(this.sourceTexture).size;
170
+ const meshBlendTagSize = this._frameGraph.textureManager.getTextureDescription(this.meshBlendTagTexture).size;
171
+ const depthSize = this._frameGraph.textureManager.getTextureDescription(this.depthTexture).size;
172
+ const baseColorSize = this.baseColorTexture === undefined ? undefined : this._frameGraph.textureManager.getTextureDescription(this.baseColorTexture).size;
173
+ if (sourceSize.width !== meshBlendTagSize.width ||
174
+ sourceSize.height !== meshBlendTagSize.height ||
175
+ sourceSize.width !== depthSize.width ||
176
+ sourceSize.height !== depthSize.height ||
177
+ (baseColorSize !== undefined && (sourceSize.width !== baseColorSize.width || sourceSize.height !== baseColorSize.height))) {
178
+ throw new Error(`FrameGraphMeshBlendingTask "${this.name}": sourceTexture, meshBlendTagTexture, depthTexture and baseColorTexture when provided must have matching dimensions`);
179
+ }
180
+ if (this.targetTexture !== undefined) {
181
+ const targetCreationOptions = this._frameGraph.textureManager.getTextureCreationOptions(this.targetTexture);
182
+ const targetType = _GetTextureType(targetCreationOptions);
183
+ const targetFormat = _GetTextureFormat(targetCreationOptions);
184
+ const targetSamples = targetCreationOptions.options.samples ?? 1;
185
+ const validTargetFormat = targetFormat === 4 || targetFormat === 5;
186
+ const validTargetType = targetType === 0 || targetType === 2 || targetType === 1;
187
+ if (!validTargetFormat || !validTargetType) {
188
+ throw new Error(`FrameGraphMeshBlendingTask "${this.name}": targetTexture must use a non-integer RGB or RGBA color format`);
189
+ }
190
+ if (!_Is2DTexture(targetCreationOptions)) {
191
+ throw new Error(`FrameGraphMeshBlendingTask "${this.name}": targetTexture must be a 2D texture`);
192
+ }
193
+ if (targetSamples !== sourceSamples) {
194
+ throw new Error(`FrameGraphMeshBlendingTask "${this.name}": targetTexture and sourceTexture must have matching sample counts`);
195
+ }
196
+ const targetSize = this._frameGraph.textureManager.getTextureDescription(this.targetTexture).size;
197
+ if (targetSize.width !== sourceSize.width || targetSize.height !== sourceSize.height) {
198
+ throw new Error(`FrameGraphMeshBlendingTask "${this.name}": targetTexture and sourceTexture must have matching dimensions`);
199
+ }
200
+ }
201
+ this.postProcess.camera = this.camera;
202
+ this.postProcess.hasBaseColorTexture = this.baseColorTexture !== undefined;
203
+ const pass = super.record(skipCreationOfDisabledPasses, (context) => {
204
+ context.setTextureSamplingMode(this.meshBlendTagTexture, 1);
205
+ context.setTextureSamplingMode(this.depthTexture, 1);
206
+ if (this.baseColorTexture !== undefined) {
207
+ context.setTextureSamplingMode(this.baseColorTexture, 1);
208
+ }
209
+ }, (context) => {
210
+ context.bindTextureHandle(this._postProcessDrawWrapper.effect, "meshBlendTagSampler", this.meshBlendTagTexture);
211
+ context.bindTextureHandle(this._postProcessDrawWrapper.effect, "meshBlendDepthSampler", this.depthTexture);
212
+ if (this.baseColorTexture !== undefined) {
213
+ context.bindTextureHandle(this._postProcessDrawWrapper.effect, "meshBlendBaseColorSampler", this.baseColorTexture);
214
+ }
215
+ });
216
+ pass.addDependencies([this.meshBlendTagTexture, this.depthTexture]);
217
+ if (this.baseColorTexture !== undefined) {
218
+ pass.addDependencies(this.baseColorTexture);
219
+ }
220
+ return pass;
221
+ }
222
+ }
223
+ //# sourceMappingURL=meshBlendingTask.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"meshBlendingTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/PostProcesses/meshBlendingTask.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAKvD,OAAO,EAGH,kBAAkB,EAGlB,2BAA2B,EAC3B,+BAA+B,EAC/B,iCAAiC,EACjC,iCAAiC,GACpC,MAAM,oDAAoD,CAAC;AAC5D,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAE3E,SAAS,YAAY,CAAC,eAAiD;IACnE,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,IAAI,SAAS,CAAC,UAAU,CAAC,KAAK,SAAS,CAAC,UAAU,CAAC;AACvG,CAAC;AAED,SAAS,eAAe,CAAC,eAAiD;IACtE,OAAO,eAAe,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,SAAS,CAAC,yBAAyB,CAAC;AACrF,CAAC;AAED,SAAS,iBAAiB,CAAC,eAAiD;IACxE,OAAO,eAAe,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,SAAS,CAAC,kBAAkB,CAAC;AAChF,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,OAAO,0BAA2B,SAAQ,yBAAyB;IA4BrE,mEAAmE;IACnE,IAAW,OAAO;QACd,OAAO,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC;IACpC,CAAC;IAED,IAAW,OAAO,CAAC,KAAuB;QACtC,IAAI,CAAC,WAAW,CAAC,OAAO,GAAG,KAAK,CAAC;IACrC,CAAC;IAED,oFAAoF;IACpF,IAAW,aAAa;QACpB,OAAO,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC;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AK,SAAS,EAAE,CAAC;gBACtC,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,uBAAuB,CAAC,MAAO,EAAE,2BAA2B,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;YACxH,CAAC;QACL,CAAC,CACJ,CAAC;QAEF,IAAI,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,mBAAmB,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;QACpE,IAAI,IAAI,CAAC,gBAAgB,KAAK,SAAS,EAAE,CAAC;YACtC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAChD,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ","sourcesContent":["import { Constants } from \"../../../Engines/constants\";\r\nimport { type Camera } from \"../../../Cameras/camera.pure\";\r\nimport { type FrameGraph } from \"../../frameGraph\";\r\nimport { type FrameGraphRenderPass } from \"../../Passes/renderPass\";\r\nimport { type FrameGraphTextureCreationOptions, type FrameGraphTextureHandle } from \"../../frameGraphTypes\";\r\nimport {\r\n type IMeshBlendConfiguration,\r\n type MeshBlendDebugMode,\r\n MeshBlendDepthType,\r\n type MeshBlendQuality,\r\n type MeshBlendRadiusDefinitions,\r\n ThinMeshBlendingPostProcess,\r\n _ClaimMeshBlendingEffectWrapper,\r\n _IsMeshBlendingEffectWrapperOwned,\r\n _ReleaseMeshBlendingEffectWrapper,\r\n} from \"../../../PostProcesses/thinMeshBlendingPostProcess\";\r\nimport { FrameGraphPostProcessTask } from \"./postProcessTask\";\r\nimport { _IsMeshBlendingSupported } from \"../../../Meshes/meshBlendingTag\";\r\n\r\nfunction _Is2DTexture(creationOptions: FrameGraphTextureCreationOptions): boolean {\r\n return (creationOptions.options.targetTypes?.[0] ?? Constants.TEXTURE_2D) === Constants.TEXTURE_2D;\r\n}\r\n\r\nfunction _GetTextureType(creationOptions: FrameGraphTextureCreationOptions): number {\r\n return creationOptions.options.types?.[0] ?? Constants.TEXTURETYPE_UNSIGNED_BYTE;\r\n}\r\n\r\nfunction _GetTextureFormat(creationOptions: FrameGraphTextureCreationOptions): number {\r\n return creationOptions.options.formats?.[0] ?? Constants.TEXTUREFORMAT_RGBA;\r\n}\r\n\r\n/**\r\n * Frame-graph task which visually blends SceneColor across validated contacts between opaque or alpha-tested meshes.\r\n *\r\n * This WebGL2 and WebGPU task uses the same effect and configuration as MeshBlendingPostProcess. It does not modify\r\n * geometry, collision queries, depth, normals, or shadows. All source and geometry textures must have matching\r\n * physical dimensions and sample counts. Transparent rendering is caller-controlled; overlapping transparent\r\n * surfaces can make SceneColor inconsistent with the single-layer geometry inputs. On WebGL2, rendering transparent\r\n * meshes into the integer tag attachment requires per-target blend parameters.\r\n * @see https://playground.babylonjs.com/?version=preview#O05LI8#6\r\n */\r\nexport class FrameGraphMeshBlendingTask extends FrameGraphPostProcessTask {\r\n /**\r\n * The packed R8UI mesh-blending tag texture used to locate seams.\r\n */\r\n public meshBlendTagTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The view-depth or screen-depth texture aligned with the packed tag texture.\r\n */\r\n public depthTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * Optional linear base-color/albedo geometry texture aligned with SceneColor.\r\n *\r\n * When omitted, shadow estimation is compiled out.\r\n */\r\n public baseColorTexture?: FrameGraphTextureHandle;\r\n\r\n /**\r\n * Camera used to project radii and reconstruct view-space positions.\r\n */\r\n public camera: Camera;\r\n\r\n /**\r\n * The thin post process containing the shared quality variant and blend configuration.\r\n */\r\n public override readonly postProcess: ThinMeshBlendingPostProcess;\r\n\r\n /** Gets or sets the compile-time mesh-blending quality variant. */\r\n public get quality(): MeshBlendQuality {\r\n return this.postProcess.quality;\r\n }\r\n\r\n public set quality(value: MeshBlendQuality) {\r\n this.postProcess.quality = value;\r\n }\r\n\r\n /** Gets the four configurable radius definitions indexed by packed radius class. */\r\n public get radiusClasses(): MeshBlendRadiusDefinitions {\r\n return this.postProcess.radiusClasses;\r\n }\r\n\r\n /** Gets or sets the contact-slope narrowing factor. A value of 1 disables narrowing. */\r\n public get slopeFactor(): number {\r\n return this.postProcess.slopeFactor;\r\n }\r\n\r\n public set slopeFactor(value: number) {\r\n this.postProcess.slopeFactor = value;\r\n }\r\n\r\n /** Gets or sets the representation stored in depthTexture. */\r\n public get depthType(): MeshBlendDepthType {\r\n return this.postProcess.depthType;\r\n }\r\n\r\n public set depthType(value: MeshBlendDepthType) {\r\n this.postProcess.depthType = value;\r\n }\r\n\r\n /** Gets or sets the compiled debug visualization. */\r\n public get debugMode(): MeshBlendDebugMode {\r\n return this.postProcess.debugMode;\r\n }\r\n\r\n public set debugMode(value: MeshBlendDebugMode) {\r\n this.postProcess.debugMode = value;\r\n }\r\n\r\n /**\r\n * Constructs a mesh-blending task.\r\n * @param name The name of the task.\r\n * @param frameGraph The frame graph this task belongs to.\r\n * @param thinPostProcess The thin post process to use. A new one is created when omitted.\r\n */\r\n constructor(name: string, frameGraph: FrameGraph, thinPostProcess?: ThinMeshBlendingPostProcess) {\r\n if (thinPostProcess && thinPostProcess.options.engine !== frameGraph.engine) {\r\n throw new Error(`FrameGraphMeshBlendingTask \"${name}\": thinPostProcess must use the frame graph engine`);\r\n }\r\n if (thinPostProcess && _IsMeshBlendingEffectWrapperOwned(thinPostProcess)) {\r\n throw new Error(`FrameGraphMeshBlendingTask \"${name}\": thinPostProcess is already attached to another owner`);\r\n }\r\n super(name, frameGraph, thinPostProcess || new ThinMeshBlendingPostProcess(name, frameGraph.engine));\r\n _ClaimMeshBlendingEffectWrapper(this.postProcess, this);\r\n this.sourceSamplingMode = Constants.TEXTURE_NEAREST_SAMPLINGMODE;\r\n }\r\n\r\n public override dispose(): void {\r\n _ReleaseMeshBlendingEffectWrapper(this.postProcess, this);\r\n super.dispose();\r\n }\r\n\r\n /**\r\n * Applies the same configuration accepted by the classic MeshBlendingPostProcess wrapper.\r\n * @param options Values to apply. Omitted values retain their current settings.\r\n */\r\n public configure(options?: IMeshBlendConfiguration): void {\r\n this.postProcess.configure(options);\r\n }\r\n\r\n public override getClassName(): string {\r\n return \"FrameGraphMeshBlendingTask\";\r\n }\r\n\r\n public override record(skipCreationOfDisabledPasses = false): FrameGraphRenderPass {\r\n this.sourceSamplingMode = Constants.TEXTURE_NEAREST_SAMPLINGMODE;\r\n\r\n if (this.sourceTexture === undefined || this.meshBlendTagTexture === undefined || this.depthTexture === undefined || this.camera === undefined) {\r\n throw new Error(`FrameGraphMeshBlendingTask \"${this.name}\": sourceTexture, meshBlendTagTexture, depthTexture and camera are required`);\r\n }\r\n\r\n const engine = this._frameGraph.engine;\r\n if (!_IsMeshBlendingSupported(engine)) {\r\n throw new Error(`FrameGraphMeshBlendingTask \"${this.name}\": mesh blending requires WebGL2 or WebGPU`);\r\n }\r\n if (this.depthType !== MeshBlendDepthType.View && this.depthType !== MeshBlendDepthType.Screen) {\r\n throw new Error(`FrameGraphMeshBlendingTask \"${this.name}\": depthType must be View or Screen`);\r\n }\r\n\r\n const meshBlendTagCreationOptions = this._frameGraph.textureManager.getTextureCreationOptions(this.meshBlendTagTexture);\r\n const meshBlendTagType = _GetTextureType(meshBlendTagCreationOptions);\r\n const meshBlendTagFormat = _GetTextureFormat(meshBlendTagCreationOptions);\r\n const meshBlendTagSamples = meshBlendTagCreationOptions.options.samples ?? 1;\r\n\r\n if (meshBlendTagType !== Constants.TEXTURETYPE_UNSIGNED_BYTE || meshBlendTagFormat !== Constants.TEXTUREFORMAT_RED_INTEGER) {\r\n throw new Error(`FrameGraphMeshBlendingTask \"${this.name}\": meshBlendTagTexture must use TEXTURETYPE_UNSIGNED_BYTE with TEXTUREFORMAT_RED_INTEGER`);\r\n }\r\n if (!_Is2DTexture(meshBlendTagCreationOptions)) {\r\n throw new Error(`FrameGraphMeshBlendingTask \"${this.name}\": meshBlendTagTexture must be a 2D texture`);\r\n }\r\n if (meshBlendTagSamples !== 1) {\r\n throw new Error(`FrameGraphMeshBlendingTask \"${this.name}\": meshBlendTagTexture must be single-sampled`);\r\n }\r\n if (meshBlendTagCreationOptions.options.createMipMaps) {\r\n throw new Error(`FrameGraphMeshBlendingTask \"${this.name}\": meshBlendTagTexture must not use mipmaps`);\r\n }\r\n\r\n const depthCreationOptions = this._frameGraph.textureManager.getTextureCreationOptions(this.depthTexture);\r\n const depthType = _GetTextureType(depthCreationOptions);\r\n const depthFormat = _GetTextureFormat(depthCreationOptions);\r\n const depthSamples = depthCreationOptions.options.samples ?? 1;\r\n const validDepthFormat = depthFormat === Constants.TEXTUREFORMAT_RED || depthFormat === Constants.TEXTUREFORMAT_RG || depthFormat === Constants.TEXTUREFORMAT_RGBA;\r\n const validDepthType =\r\n depthType === Constants.TEXTURETYPE_FLOAT ||\r\n depthType === Constants.TEXTURETYPE_HALF_FLOAT ||\r\n (this.depthType === MeshBlendDepthType.Screen && depthType === Constants.TEXTURETYPE_UNSIGNED_BYTE);\r\n\r\n if (!validDepthFormat || !validDepthType) {\r\n throw new Error(\r\n `FrameGraphMeshBlendingTask \"${this.name}\": ${this.depthType === MeshBlendDepthType.View ? \"view\" : \"screen\"} depthTexture has an incompatible type or format`\r\n );\r\n }\r\n if (!_Is2DTexture(depthCreationOptions)) {\r\n throw new Error(`FrameGraphMeshBlendingTask \"${this.name}\": depthTexture must be a 2D texture`);\r\n }\r\n if (depthSamples !== 1) {\r\n throw new Error(`FrameGraphMeshBlendingTask \"${this.name}\": depthTexture must be single-sampled`);\r\n }\r\n if (depthCreationOptions.options.createMipMaps) {\r\n throw new Error(`FrameGraphMeshBlendingTask \"${this.name}\": depthTexture must not use mipmaps`);\r\n }\r\n\r\n let baseColorSamples: number | undefined;\r\n if (this.baseColorTexture !== undefined) {\r\n const baseColorCreationOptions = this._frameGraph.textureManager.getTextureCreationOptions(this.baseColorTexture);\r\n const baseColorType = _GetTextureType(baseColorCreationOptions);\r\n const baseColorFormat = _GetTextureFormat(baseColorCreationOptions);\r\n baseColorSamples = baseColorCreationOptions.options.samples ?? 1;\r\n const validBaseColorFormat = baseColorFormat === Constants.TEXTUREFORMAT_RGB || baseColorFormat === Constants.TEXTUREFORMAT_RGBA;\r\n const validBaseColorType =\r\n baseColorType === Constants.TEXTURETYPE_UNSIGNED_BYTE || baseColorType === Constants.TEXTURETYPE_HALF_FLOAT || baseColorType === Constants.TEXTURETYPE_FLOAT;\r\n if (!validBaseColorFormat || !validBaseColorType) {\r\n throw new Error(`FrameGraphMeshBlendingTask \"${this.name}\": baseColorTexture must use a non-integer RGB or RGBA color format`);\r\n }\r\n if (!_Is2DTexture(baseColorCreationOptions)) {\r\n throw new Error(`FrameGraphMeshBlendingTask \"${this.name}\": baseColorTexture must be a 2D texture`);\r\n }\r\n if (baseColorCreationOptions.options.createMipMaps) {\r\n throw new Error(`FrameGraphMeshBlendingTask \"${this.name}\": baseColorTexture must not use mipmaps`);\r\n }\r\n }\r\n\r\n const sourceCreationOptions = this._frameGraph.textureManager.getTextureCreationOptions(this.sourceTexture);\r\n const sourceType = _GetTextureType(sourceCreationOptions);\r\n const sourceFormat = _GetTextureFormat(sourceCreationOptions);\r\n const sourceSamples = sourceCreationOptions.options.samples ?? 1;\r\n const validSourceFormat = sourceFormat === Constants.TEXTUREFORMAT_RGB || sourceFormat === Constants.TEXTUREFORMAT_RGBA;\r\n const validSourceType = sourceType === Constants.TEXTURETYPE_UNSIGNED_BYTE || sourceType === Constants.TEXTURETYPE_HALF_FLOAT || sourceType === Constants.TEXTURETYPE_FLOAT;\r\n if (!validSourceFormat || !validSourceType) {\r\n throw new Error(`FrameGraphMeshBlendingTask \"${this.name}\": sourceTexture must use a non-integer RGB or RGBA color format`);\r\n }\r\n if (!_Is2DTexture(sourceCreationOptions)) {\r\n throw new Error(`FrameGraphMeshBlendingTask \"${this.name}\": sourceTexture must be a 2D texture`);\r\n }\r\n if (sourceSamples !== meshBlendTagSamples || sourceSamples !== depthSamples || (baseColorSamples !== undefined && sourceSamples !== baseColorSamples)) {\r\n throw new Error(\r\n `FrameGraphMeshBlendingTask \"${this.name}\": sourceTexture, meshBlendTagTexture, depthTexture and baseColorTexture when provided must have matching sample counts`\r\n );\r\n }\r\n\r\n const sourceSize = this._frameGraph.textureManager.getTextureDescription(this.sourceTexture).size;\r\n const meshBlendTagSize = this._frameGraph.textureManager.getTextureDescription(this.meshBlendTagTexture).size;\r\n const depthSize = this._frameGraph.textureManager.getTextureDescription(this.depthTexture).size;\r\n const baseColorSize = this.baseColorTexture === undefined ? undefined : this._frameGraph.textureManager.getTextureDescription(this.baseColorTexture).size;\r\n if (\r\n sourceSize.width !== meshBlendTagSize.width ||\r\n sourceSize.height !== meshBlendTagSize.height ||\r\n sourceSize.width !== depthSize.width ||\r\n sourceSize.height !== depthSize.height ||\r\n (baseColorSize !== undefined && (sourceSize.width !== baseColorSize.width || sourceSize.height !== baseColorSize.height))\r\n ) {\r\n throw new Error(\r\n `FrameGraphMeshBlendingTask \"${this.name}\": sourceTexture, meshBlendTagTexture, depthTexture and baseColorTexture when provided must have matching dimensions`\r\n );\r\n }\r\n\r\n if (this.targetTexture !== undefined) {\r\n const targetCreationOptions = this._frameGraph.textureManager.getTextureCreationOptions(this.targetTexture);\r\n const targetType = _GetTextureType(targetCreationOptions);\r\n const targetFormat = _GetTextureFormat(targetCreationOptions);\r\n const targetSamples = targetCreationOptions.options.samples ?? 1;\r\n const validTargetFormat = targetFormat === Constants.TEXTUREFORMAT_RGB || targetFormat === Constants.TEXTUREFORMAT_RGBA;\r\n const validTargetType =\r\n targetType === Constants.TEXTURETYPE_UNSIGNED_BYTE || targetType === Constants.TEXTURETYPE_HALF_FLOAT || targetType === Constants.TEXTURETYPE_FLOAT;\r\n if (!validTargetFormat || !validTargetType) {\r\n throw new Error(`FrameGraphMeshBlendingTask \"${this.name}\": targetTexture must use a non-integer RGB or RGBA color format`);\r\n }\r\n if (!_Is2DTexture(targetCreationOptions)) {\r\n throw new Error(`FrameGraphMeshBlendingTask \"${this.name}\": targetTexture must be a 2D texture`);\r\n }\r\n if (targetSamples !== sourceSamples) {\r\n throw new Error(`FrameGraphMeshBlendingTask \"${this.name}\": targetTexture and sourceTexture must have matching sample counts`);\r\n }\r\n\r\n const targetSize = this._frameGraph.textureManager.getTextureDescription(this.targetTexture).size;\r\n if (targetSize.width !== sourceSize.width || targetSize.height !== sourceSize.height) {\r\n throw new Error(`FrameGraphMeshBlendingTask \"${this.name}\": targetTexture and sourceTexture must have matching dimensions`);\r\n }\r\n }\r\n\r\n this.postProcess.camera = this.camera;\r\n this.postProcess.hasBaseColorTexture = this.baseColorTexture !== undefined;\r\n\r\n const pass = super.record(\r\n skipCreationOfDisabledPasses,\r\n (context) => {\r\n context.setTextureSamplingMode(this.meshBlendTagTexture, Constants.TEXTURE_NEAREST_SAMPLINGMODE);\r\n context.setTextureSamplingMode(this.depthTexture, Constants.TEXTURE_NEAREST_SAMPLINGMODE);\r\n if (this.baseColorTexture !== undefined) {\r\n context.setTextureSamplingMode(this.baseColorTexture, Constants.TEXTURE_NEAREST_SAMPLINGMODE);\r\n }\r\n },\r\n (context) => {\r\n context.bindTextureHandle(this._postProcessDrawWrapper.effect!, \"meshBlendTagSampler\", this.meshBlendTagTexture);\r\n context.bindTextureHandle(this._postProcessDrawWrapper.effect!, \"meshBlendDepthSampler\", this.depthTexture);\r\n if (this.baseColorTexture !== undefined) {\r\n context.bindTextureHandle(this._postProcessDrawWrapper.effect!, \"meshBlendBaseColorSampler\", this.baseColorTexture);\r\n }\r\n }\r\n );\r\n\r\n pass.addDependencies([this.meshBlendTagTexture, this.depthTexture]);\r\n if (this.baseColorTexture !== undefined) {\r\n pass.addDependencies(this.baseColorTexture);\r\n }\r\n\r\n return pass;\r\n }\r\n}\r\n"]}
@@ -1,4 +1,4 @@
1
- import { type FrameGraphTextureHandle, type Scene, type FrameGraph, type AbstractMesh, type ObjectRendererOptions, type FrameGraphRenderContext, type FrameGraphRenderPass, type ObjectRenderer } from "../../../index.js";
1
+ import { type FrameGraphTextureHandle, type Scene, type FrameGraph, type AbstractMesh, type ObjectRendererOptions, type FrameGraphRenderContext, type FrameGraphRenderPass, type ObjectRenderer, type GeometryRenderingMeshBlendTagProvider } from "../../../index.js";
2
2
  import { type GeometryRenderingObjectIdProvider } from "../../../Materials/materialHelper.geometryrendering.js";
3
3
  import { FrameGraphObjectRendererTask } from "./objectRendererTask.js";
4
4
  /**
@@ -61,6 +61,7 @@ export declare class FrameGraphGeometryRendererTask extends FrameGraphObjectRend
61
61
  */
62
62
  textureDescriptions: IFrameGraphGeometryRendererTextureDescription[];
63
63
  private _objectIdProvider?;
64
+ private _meshBlendTagProvider?;
64
65
  /**
65
66
  * Provides the object ID written for each rendered mesh.
66
67
  *
@@ -70,10 +71,20 @@ export declare class FrameGraphGeometryRendererTask extends FrameGraphObjectRend
70
71
  * Instances use the ID of their source mesh. Default IDs are only stable for the lifetime of the current scene and should not be persisted.
71
72
  * When using a RED texture, provide a custom ID if mesh unique IDs can exceed 0xFF.
72
73
  * The provider runs in the render hot path and may be called multiple times for the same mesh in a frame.
73
- * @see https://playground.babylonjs.com/#00T6WJ#0
74
+ * @see https://playground.babylonjs.com/?version=preview#00T6WJ#0
74
75
  */
75
76
  get objectIdProvider(): GeometryRenderingObjectIdProvider | undefined;
76
77
  set objectIdProvider(value: GeometryRenderingObjectIdProvider | undefined);
78
+ /**
79
+ * Provides the packed mesh-blending tag written for each rendered mesh.
80
+ *
81
+ * Tags must be 0 or contain a group ID between 1 and 63 in their low six bits. Tag 0 disables mesh blending.
82
+ * By default, meshes use their `meshBlendingTag` property. Instances and thin instances use the source mesh tag.
83
+ * The provider runs in the render hot path and receives the source mesh for instanced draws.
84
+ * It should avoid allocations and return a consistent value for a mesh during a render.
85
+ */
86
+ get meshBlendTagProvider(): GeometryRenderingMeshBlendTagProvider | undefined;
87
+ set meshBlendTagProvider(value: GeometryRenderingMeshBlendTagProvider | undefined);
77
88
  /**
78
89
  * The irradiance output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!
79
90
  */
@@ -96,7 +107,8 @@ export declare class FrameGraphGeometryRendererTask extends FrameGraphObjectRend
96
107
  */
97
108
  readonly geometryViewNormalTexture: FrameGraphTextureHandle;
98
109
  /**
99
- * The normal (in world space) output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!
110
+ * The normal (in world space, encoded from [-1, 1] to [0, 1]) output texture.
111
+ * Will point to a valid texture only if that texture has been requested in textureDescriptions!
100
112
  */
101
113
  readonly geometryWorldNormalTexture: FrameGraphTextureHandle;
102
114
  /**
@@ -117,10 +129,12 @@ export declare class FrameGraphGeometryRendererTask extends FrameGraphObjectRend
117
129
  readonly geometryReflectivityTexture: FrameGraphTextureHandle;
118
130
  /**
119
131
  * The velocity output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!
132
+ * Built-in CPU/GPU particles write neutral velocity (0.5, 0.5); their motion is not represented.
120
133
  */
121
134
  readonly geometryVelocityTexture: FrameGraphTextureHandle;
122
135
  /**
123
136
  * The linear velocity output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!
137
+ * Built-in CPU/GPU particles write neutral velocity (0, 0); their motion is not represented.
124
138
  */
125
139
  readonly geometryLinearVelocityTexture: FrameGraphTextureHandle;
126
140
  /**
@@ -129,6 +143,12 @@ export declare class FrameGraphGeometryRendererTask extends FrameGraphObjectRend
129
143
  * Decode RED values with `round(value * 255.0)`.
130
144
  */
131
145
  readonly geometryObjectIdTexture: FrameGraphTextureHandle;
146
+ /**
147
+ * The packed, single-sample R8UI mesh-blending tag output texture for WebGL2 and WebGPU.
148
+ *
149
+ * Opaque, alpha-tested, and caller-selected transparent meshes are supported.
150
+ */
151
+ readonly geometryMeshBlendTagTexture: FrameGraphTextureHandle;
132
152
  /**
133
153
  * Gets or sets the name of the task.
134
154
  */
@@ -136,6 +156,7 @@ export declare class FrameGraphGeometryRendererTask extends FrameGraphObjectRend
136
156
  set name(value: string);
137
157
  private _clearAttachmentsLayout;
138
158
  private _allAttachmentsLayout;
159
+ private _colorAttachmentsLayout;
139
160
  /**
140
161
  * Constructs a new geometry renderer task.
141
162
  * @param name The name of the task.
@@ -175,6 +196,7 @@ export declare class FrameGraphGeometryRendererTask extends FrameGraphObjectRend
175
196
  protected _checkTextureCompatibility(targetTextures: FrameGraphTextureHandle[]): boolean;
176
197
  protected _getTargetHandles(): FrameGraphTextureHandle[];
177
198
  protected _prepareRendering(context: FrameGraphRenderContext, depthEnabled: boolean): number[];
199
+ private _getTargetTextureCount;
178
200
  private _buildClearAttachmentsLayout;
179
201
  private _registerForRenderPassId;
180
202
  }
@@ -1,6 +1,7 @@
1
1
  import { Color4 } from "../../../Maths/math.color.pure.js";
2
2
  import { MaterialHelperGeometryRendering } from "../../../Materials/materialHelper.geometryrendering.js";
3
3
 
4
+ import { _IsMeshBlendingSupported } from "../../../Meshes/meshBlendingTag.js";
4
5
  import { FrameGraphObjectRendererTask } from "./objectRendererTask.js";
5
6
  const ClearColors = [new Color4(0, 0, 0, 0), new Color4(1, 1, 1, 1), new Color4(0, 0, 0, 0)];
6
7
  /**
@@ -41,7 +42,7 @@ export class FrameGraphGeometryRendererTask extends FrameGraphObjectRendererTask
41
42
  * Instances use the ID of their source mesh. Default IDs are only stable for the lifetime of the current scene and should not be persisted.
42
43
  * When using a RED texture, provide a custom ID if mesh unique IDs can exceed 0xFF.
43
44
  * The provider runs in the render hot path and may be called multiple times for the same mesh in a frame.
44
- * @see https://playground.babylonjs.com/#00T6WJ#0
45
+ * @see https://playground.babylonjs.com/?version=preview#00T6WJ#0
45
46
  */
46
47
  get objectIdProvider() {
47
48
  return this._objectIdProvider;
@@ -53,6 +54,24 @@ export class FrameGraphGeometryRendererTask extends FrameGraphObjectRendererTask
53
54
  configuration.objectIdProvider = value;
54
55
  }
55
56
  }
57
+ /**
58
+ * Provides the packed mesh-blending tag written for each rendered mesh.
59
+ *
60
+ * Tags must be 0 or contain a group ID between 1 and 63 in their low six bits. Tag 0 disables mesh blending.
61
+ * By default, meshes use their `meshBlendingTag` property. Instances and thin instances use the source mesh tag.
62
+ * The provider runs in the render hot path and receives the source mesh for instanced draws.
63
+ * It should avoid allocations and return a consistent value for a mesh during a render.
64
+ */
65
+ get meshBlendTagProvider() {
66
+ return this._meshBlendTagProvider;
67
+ }
68
+ set meshBlendTagProvider(value) {
69
+ this._meshBlendTagProvider = value;
70
+ const configuration = MaterialHelperGeometryRendering.GetConfiguration(this._renderer.renderPassId);
71
+ if (configuration) {
72
+ configuration.meshBlendTagProvider = value;
73
+ }
74
+ }
56
75
  /**
57
76
  * Gets or sets the name of the task.
58
77
  */
@@ -106,7 +125,7 @@ export class FrameGraphGeometryRendererTask extends FrameGraphObjectRendererTask
106
125
  if (this.dontRenderWhenMaterialDepthWriteIsDisabled && mesh.material && mesh.material.disableDepthWrite) {
107
126
  return !!preWarm;
108
127
  }
109
- return mesh.isReady(refreshRate === 0);
128
+ return mesh.isReady(!!preWarm || refreshRate === 0);
110
129
  };
111
130
  this._renderer.onBeforeRenderingManagerRenderObservable.add(() => {
112
131
  if (!this._renderer.options.doNotChangeAspectRatio) {
@@ -115,6 +134,7 @@ export class FrameGraphGeometryRendererTask extends FrameGraphObjectRendererTask
115
134
  });
116
135
  this._clearAttachmentsLayout = new Map();
117
136
  this._allAttachmentsLayout = [];
137
+ this._colorAttachmentsLayout = [];
118
138
  this.geometryIrradianceTexture = this._frameGraph.textureManager.createDanglingHandle();
119
139
  this.geometryViewDepthTexture = this._frameGraph.textureManager.createDanglingHandle();
120
140
  this.geometryNormViewDepthTexture = this._frameGraph.textureManager.createDanglingHandle();
@@ -128,6 +148,7 @@ export class FrameGraphGeometryRendererTask extends FrameGraphObjectRendererTask
128
148
  this.geometryVelocityTexture = this._frameGraph.textureManager.createDanglingHandle();
129
149
  this.geometryLinearVelocityTexture = this._frameGraph.textureManager.createDanglingHandle();
130
150
  this.geometryObjectIdTexture = this._frameGraph.textureManager.createDanglingHandle();
151
+ this.geometryMeshBlendTagTexture = this._frameGraph.textureManager.createDanglingHandle();
131
152
  }
132
153
  /**
133
154
  * Gets the list of excluded meshes from the velocity texture.
@@ -175,10 +196,11 @@ export class FrameGraphGeometryRendererTask extends FrameGraphObjectRendererTask
175
196
  MaterialHelperGeometryRendering.MarkAsDirty(this._renderer.renderPassId, this.objectList.meshes || this._scene.meshes);
176
197
  const pass = super.record(skipCreationOfDisabledPasses, additionalExecute);
177
198
  const outputTextureHandles = pass.renderTarget;
199
+ const targetTextureCount = this._getTargetTextureCount();
178
200
  let needPreviousWorldMatrices = false;
179
201
  for (let i = 0; i < this.textureDescriptions.length; i++) {
180
202
  const description = this.textureDescriptions[i];
181
- const handle = outputTextureHandles[i];
203
+ const handle = outputTextureHandles[targetTextureCount + i];
182
204
  const index = MaterialHelperGeometryRendering.GeometryTextureDescriptions.findIndex((f) => f.type === description.type);
183
205
  const geometryDescription = MaterialHelperGeometryRendering.GeometryTextureDescriptions[index];
184
206
  switch (geometryDescription.type) {
@@ -223,6 +245,9 @@ export class FrameGraphGeometryRendererTask extends FrameGraphObjectRendererTask
223
245
  case 15:
224
246
  this._frameGraph.textureManager.resolveDanglingHandle(this.geometryObjectIdTexture, handle);
225
247
  break;
248
+ case 16:
249
+ this._frameGraph.textureManager.resolveDanglingHandle(this.geometryMeshBlendTagTexture, handle);
250
+ break;
226
251
  }
227
252
  }
228
253
  this._scene.needsPreviousWorldMatrices = needPreviousWorldMatrices;
@@ -255,6 +280,23 @@ export class FrameGraphGeometryRendererTask extends FrameGraphObjectRendererTask
255
280
  throw new Error(`FrameGraphGeometryRendererTask ${this.name}: object ID textures must use TEXTURETYPE_UNSIGNED_BYTE with TEXTUREFORMAT_RGBA or TEXTUREFORMAT_RED`);
256
281
  }
257
282
  }
283
+ const meshBlendTagIndex = this.textureDescriptions.findIndex((description) => description.type === 16);
284
+ if (meshBlendTagIndex !== -1) {
285
+ const description = this.textureDescriptions[meshBlendTagIndex];
286
+ const engine = this._engine;
287
+ if (!_IsMeshBlendingSupported(engine)) {
288
+ throw new Error(`FrameGraphGeometryRendererTask ${this.name}: mesh-blending tag textures require WebGL2 or WebGPU`);
289
+ }
290
+ if ((this.renderTransparentMeshes || this.renderSprites || this.renderParticles) && !engine.isWebGPU && !engine.getCaps().blendParametersPerTarget) {
291
+ throw new Error(`FrameGraphGeometryRendererTask ${this.name}: transparent mesh-blending tags require per-target blend parameters`);
292
+ }
293
+ if (this.samples !== 1) {
294
+ throw new Error(`FrameGraphGeometryRendererTask ${this.name}: mesh-blending tag textures require samples to be 1`);
295
+ }
296
+ if (description.textureType !== 0 || description.textureFormat !== 8) {
297
+ throw new Error(`FrameGraphGeometryRendererTask ${this.name}: mesh-blending tag textures must use TEXTURETYPE_UNSIGNED_BYTE with TEXTUREFORMAT_RED_INTEGER`);
298
+ }
299
+ }
258
300
  const targetTextureCount = this.targetTexture === undefined ? 0 : Array.isArray(this.targetTexture) ? this.targetTexture.length : 1;
259
301
  const attachmentCount = this.textureDescriptions.length + targetTextureCount;
260
302
  const maxDrawBuffers = Math.min(this._engine.getCaps().maxDrawBuffers ?? 1, 8);
@@ -307,6 +349,14 @@ export class FrameGraphGeometryRendererTask extends FrameGraphObjectRendererTask
307
349
  useSRGBBuffers[i] = false;
308
350
  }
309
351
  const handles = [];
352
+ if (this.targetTexture !== undefined) {
353
+ if (Array.isArray(this.targetTexture)) {
354
+ handles.push(...this.targetTexture);
355
+ }
356
+ else {
357
+ handles.push(this.targetTexture);
358
+ }
359
+ }
310
360
  if (this.textureDescriptions.length > 0) {
311
361
  const baseHandle = this._frameGraph.textureManager.createRenderTargetTexture(this.name, {
312
362
  size: this.size,
@@ -324,14 +374,6 @@ export class FrameGraphGeometryRendererTask extends FrameGraphObjectRendererTask
324
374
  handles.push(baseHandle + i);
325
375
  }
326
376
  }
327
- if (this.targetTexture !== undefined) {
328
- if (Array.isArray(this.targetTexture)) {
329
- handles.push(...this.targetTexture);
330
- }
331
- else {
332
- handles.push(this.targetTexture);
333
- }
334
- }
335
377
  return handles;
336
378
  }
337
379
  _prepareRendering(context, depthEnabled) {
@@ -342,11 +384,15 @@ export class FrameGraphGeometryRendererTask extends FrameGraphObjectRendererTask
342
384
  });
343
385
  context.restoreDefaultFramebuffer();
344
386
  context.popDebugGroup();
345
- return this._allAttachmentsLayout;
387
+ return this._colorAttachmentsLayout;
388
+ }
389
+ _getTargetTextureCount() {
390
+ return this.targetTexture === undefined ? 0 : Array.isArray(this.targetTexture) ? this.targetTexture.length : 1;
346
391
  }
347
392
  _buildClearAttachmentsLayout() {
348
393
  const clearAttachmentsLayout = new Map();
349
- const allAttachmentsLayout = [];
394
+ const targetTextureCount = this._getTargetTextureCount();
395
+ const allAttachmentsLayout = new Array(targetTextureCount).fill(true);
350
396
  for (let i = 0; i < this.textureDescriptions.length; i++) {
351
397
  const description = this.textureDescriptions[i];
352
398
  const index = MaterialHelperGeometryRendering.GeometryTextureDescriptions.findIndex((f) => f.type === description.type);
@@ -358,7 +404,7 @@ export class FrameGraphGeometryRendererTask extends FrameGraphObjectRendererTask
358
404
  if (layout === undefined) {
359
405
  layout = [];
360
406
  clearAttachmentsLayout.set(clearType, layout);
361
- for (let j = 0; j < i; j++) {
407
+ for (let j = 0; j < targetTextureCount + i; j++) {
362
408
  layout[j] = false;
363
409
  }
364
410
  }
@@ -367,44 +413,34 @@ export class FrameGraphGeometryRendererTask extends FrameGraphObjectRendererTask
367
413
  });
368
414
  allAttachmentsLayout.push(true);
369
415
  }
370
- if (this.targetTexture !== undefined) {
371
- // We don't clear the target texture, but we need to add a layout for it in clearAttachmentsLayout to be able to use clearColorAttachments with the correct number of attachments in _prepareRendering.
372
- // We also need to add a value in allAttachmentsLayout for the target texture.
373
- let layout = clearAttachmentsLayout.get(0 /* GeometryRenderingTextureClearType.Zero */);
374
- if (layout === undefined) {
375
- layout = [];
376
- clearAttachmentsLayout.set(0 /* GeometryRenderingTextureClearType.Zero */, layout);
377
- for (let j = 0; j < this.textureDescriptions.length - 1; j++) {
378
- layout[j] = false;
379
- }
380
- }
381
- clearAttachmentsLayout.forEach((layout) => {
382
- layout.push(false);
383
- });
384
- allAttachmentsLayout.push(true);
385
- }
386
416
  this._clearAttachmentsLayout = new Map();
387
417
  clearAttachmentsLayout.forEach((layout, clearType) => {
388
418
  this._clearAttachmentsLayout.set(clearType, this._engine.buildTextureLayout(layout));
389
419
  });
390
420
  this._allAttachmentsLayout = this._engine.buildTextureLayout(allAttachmentsLayout);
421
+ this._colorAttachmentsLayout = this._engine.buildTextureLayout(allAttachmentsLayout.map((_, index) => targetTextureCount > 0 && index === 0));
391
422
  }
392
423
  _registerForRenderPassId(renderPassId) {
393
424
  const configuration = MaterialHelperGeometryRendering.CreateConfiguration(renderPassId);
425
+ const targetTextureCount = this._getTargetTextureCount();
394
426
  for (let i = 0; i < this.textureDescriptions.length; i++) {
395
427
  const description = this.textureDescriptions[i];
396
428
  const index = MaterialHelperGeometryRendering.GeometryTextureDescriptions.findIndex((f) => f.type === description.type);
397
429
  const geometryDescription = MaterialHelperGeometryRendering.GeometryTextureDescriptions[index];
398
- configuration.defines[geometryDescription.defineIndex] = i;
430
+ configuration.defines[geometryDescription.defineIndex] = targetTextureCount + i;
399
431
  if (description.type === 15) {
400
432
  configuration.objectIdIsRedFormat = description.textureFormat === 6;
401
433
  }
434
+ else if (description.type === 16) {
435
+ configuration.meshBlendTagProvider = this.meshBlendTagProvider;
436
+ }
402
437
  }
403
- if (this.targetTexture !== undefined) {
404
- configuration.defines["PREPASS_COLOR_INDEX"] = this.textureDescriptions.length;
438
+ if (targetTextureCount > 0) {
439
+ configuration.defines["PREPASS_COLOR_INDEX"] = 0;
405
440
  }
406
441
  configuration.reverseCulling = this.reverseCulling;
407
442
  configuration.objectIdProvider = this.objectIdProvider;
443
+ MaterialHelperGeometryRendering._PrepareConfiguration(renderPassId, this._allAttachmentsLayout, this._colorAttachmentsLayout);
408
444
  }
409
445
  }
410
446
  //# sourceMappingURL=geometryRendererTask.js.map