@onerjs/core 8.32.0 → 8.32.1

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 (312) hide show
  1. package/Audio/Interfaces/ISoundOptions.d.ts +1 -1
  2. package/Audio/Interfaces/ISoundOptions.js.map +1 -1
  3. package/Audio/audioEngine.d.ts +3 -4
  4. package/Audio/audioEngine.js +9 -6
  5. package/Audio/audioEngine.js.map +1 -1
  6. package/Audio/sound.d.ts +33 -54
  7. package/Audio/sound.js +450 -718
  8. package/Audio/sound.js.map +1 -1
  9. package/AudioV2/abstractAudio/abstractAudioOutNode.d.ts +1 -1
  10. package/AudioV2/abstractAudio/abstractAudioOutNode.js +1 -1
  11. package/AudioV2/abstractAudio/abstractAudioOutNode.js.map +1 -1
  12. package/AudioV2/abstractAudio/abstractSound.d.ts +1 -1
  13. package/AudioV2/abstractAudio/abstractSound.js +2 -2
  14. package/AudioV2/abstractAudio/abstractSound.js.map +1 -1
  15. package/AudioV2/abstractAudio/abstractSoundSource.d.ts +11 -3
  16. package/AudioV2/abstractAudio/abstractSoundSource.js +37 -1
  17. package/AudioV2/abstractAudio/abstractSoundSource.js.map +1 -1
  18. package/AudioV2/abstractAudio/audioBus.d.ts +8 -3
  19. package/AudioV2/abstractAudio/audioBus.js +24 -1
  20. package/AudioV2/abstractAudio/audioBus.js.map +1 -1
  21. package/AudioV2/abstractAudio/staticSound.d.ts +1 -1
  22. package/AudioV2/abstractAudio/staticSound.js +2 -2
  23. package/AudioV2/abstractAudio/staticSound.js.map +1 -1
  24. package/AudioV2/abstractAudio/streamingSound.d.ts +1 -1
  25. package/AudioV2/abstractAudio/streamingSound.js +2 -2
  26. package/AudioV2/abstractAudio/streamingSound.js.map +1 -1
  27. package/AudioV2/abstractAudio/subNodes/abstractAudioSubGraph.d.ts +1 -1
  28. package/AudioV2/abstractAudio/subNodes/abstractAudioSubGraph.js +3 -0
  29. package/AudioV2/abstractAudio/subNodes/abstractAudioSubGraph.js.map +1 -1
  30. package/AudioV2/abstractAudio/subNodes/spatialAudioSubNode.d.ts +1 -0
  31. package/AudioV2/abstractAudio/subNodes/spatialAudioSubNode.js +1 -0
  32. package/AudioV2/abstractAudio/subNodes/spatialAudioSubNode.js.map +1 -1
  33. package/AudioV2/abstractAudio/subProperties/abstractSpatialAudio.d.ts +12 -2
  34. package/AudioV2/abstractAudio/subProperties/abstractSpatialAudio.js +2 -0
  35. package/AudioV2/abstractAudio/subProperties/abstractSpatialAudio.js.map +1 -1
  36. package/AudioV2/abstractAudio/subProperties/spatialAudio.d.ts +6 -0
  37. package/AudioV2/abstractAudio/subProperties/spatialAudio.js +25 -0
  38. package/AudioV2/abstractAudio/subProperties/spatialAudio.js.map +1 -1
  39. package/AudioV2/webAudio/components/webAudioParameterComponent.js +2 -2
  40. package/AudioV2/webAudio/components/webAudioParameterComponent.js.map +1 -1
  41. package/AudioV2/webAudio/subNodes/spatialWebAudioSubNode.d.ts +3 -0
  42. package/AudioV2/webAudio/subNodes/spatialWebAudioSubNode.js +14 -17
  43. package/AudioV2/webAudio/subNodes/spatialWebAudioSubNode.js.map +1 -1
  44. package/AudioV2/webAudio/subNodes/webAudioBusAndSoundSubGraph.js +1 -0
  45. package/AudioV2/webAudio/subNodes/webAudioBusAndSoundSubGraph.js.map +1 -1
  46. package/AudioV2/webAudio/subProperties/spatialWebAudio.js +1 -0
  47. package/AudioV2/webAudio/subProperties/spatialWebAudio.js.map +1 -1
  48. package/AudioV2/webAudio/webAudioBus.d.ts +2 -7
  49. package/AudioV2/webAudio/webAudioBus.js +4 -24
  50. package/AudioV2/webAudio/webAudioBus.js.map +1 -1
  51. package/AudioV2/webAudio/webAudioEngine.js +1 -0
  52. package/AudioV2/webAudio/webAudioEngine.js.map +1 -1
  53. package/AudioV2/webAudio/webAudioSoundSource.d.ts +2 -7
  54. package/AudioV2/webAudio/webAudioSoundSource.js +3 -24
  55. package/AudioV2/webAudio/webAudioSoundSource.js.map +1 -1
  56. package/AudioV2/webAudio/webAudioStaticSound.d.ts +3 -7
  57. package/AudioV2/webAudio/webAudioStaticSound.js +13 -26
  58. package/AudioV2/webAudio/webAudioStaticSound.js.map +1 -1
  59. package/AudioV2/webAudio/webAudioStreamingSound.d.ts +3 -7
  60. package/AudioV2/webAudio/webAudioStreamingSound.js +6 -23
  61. package/AudioV2/webAudio/webAudioStreamingSound.js.map +1 -1
  62. package/Cameras/arcRotateCamera.js +4 -5
  63. package/Cameras/arcRotateCamera.js.map +1 -1
  64. package/Compute/computeEffect.js +5 -1
  65. package/Compute/computeEffect.js.map +1 -1
  66. package/Compute/computeShader.d.ts +4 -0
  67. package/Compute/computeShader.js +9 -3
  68. package/Compute/computeShader.js.map +1 -1
  69. package/Debug/debugLayer.d.ts +1 -1
  70. package/Debug/debugLayer.js.map +1 -1
  71. package/Engines/abstractEngine.d.ts +2 -2
  72. package/Engines/abstractEngine.js +2 -2
  73. package/Engines/abstractEngine.js.map +1 -1
  74. package/Engines/thinEngine.js +1 -1
  75. package/Engines/thinEngine.js.map +1 -1
  76. package/Engines/webgpuEngine.js +8 -9
  77. package/Engines/webgpuEngine.js.map +1 -1
  78. package/FrameGraph/Node/Blocks/PostProcesses/volumetricLightingBlock.d.ts +74 -0
  79. package/FrameGraph/Node/Blocks/PostProcesses/volumetricLightingBlock.js +179 -0
  80. package/FrameGraph/Node/Blocks/PostProcesses/volumetricLightingBlock.js.map +1 -0
  81. package/FrameGraph/Node/Blocks/index.d.ts +2 -0
  82. package/FrameGraph/Node/Blocks/index.js +2 -0
  83. package/FrameGraph/Node/Blocks/index.js.map +1 -1
  84. package/FrameGraph/Node/Blocks/lightingVolumeBlock.d.ts +43 -0
  85. package/FrameGraph/Node/Blocks/lightingVolumeBlock.js +93 -0
  86. package/FrameGraph/Node/Blocks/lightingVolumeBlock.js.map +1 -0
  87. package/FrameGraph/Passes/renderPass.js +2 -2
  88. package/FrameGraph/Passes/renderPass.js.map +1 -1
  89. package/FrameGraph/Tasks/Layers/baseLayerTask.d.ts +2 -0
  90. package/FrameGraph/Tasks/Layers/baseLayerTask.js +6 -0
  91. package/FrameGraph/Tasks/Layers/baseLayerTask.js.map +1 -1
  92. package/FrameGraph/Tasks/Layers/glowLayerTask.d.ts +1 -0
  93. package/FrameGraph/Tasks/Layers/glowLayerTask.js +3 -0
  94. package/FrameGraph/Tasks/Layers/glowLayerTask.js.map +1 -1
  95. package/FrameGraph/Tasks/Layers/highlightLayerTask.d.ts +1 -0
  96. package/FrameGraph/Tasks/Layers/highlightLayerTask.js +3 -0
  97. package/FrameGraph/Tasks/Layers/highlightLayerTask.js.map +1 -1
  98. package/FrameGraph/Tasks/Misc/computeShaderTask.d.ts +1 -0
  99. package/FrameGraph/Tasks/Misc/computeShaderTask.js +3 -0
  100. package/FrameGraph/Tasks/Misc/computeShaderTask.js.map +1 -1
  101. package/FrameGraph/Tasks/Misc/cullObjectsTask.d.ts +1 -0
  102. package/FrameGraph/Tasks/Misc/cullObjectsTask.js +3 -0
  103. package/FrameGraph/Tasks/Misc/cullObjectsTask.js.map +1 -1
  104. package/FrameGraph/Tasks/Misc/executeTask.d.ts +1 -0
  105. package/FrameGraph/Tasks/Misc/executeTask.js +3 -0
  106. package/FrameGraph/Tasks/Misc/executeTask.js.map +1 -1
  107. package/FrameGraph/Tasks/Misc/lightingVolumeTask.d.ts +32 -0
  108. package/FrameGraph/Tasks/Misc/lightingVolumeTask.js +63 -0
  109. package/FrameGraph/Tasks/Misc/lightingVolumeTask.js.map +1 -0
  110. package/FrameGraph/Tasks/PostProcesses/anaglyphTask.d.ts +1 -0
  111. package/FrameGraph/Tasks/PostProcesses/anaglyphTask.js +3 -0
  112. package/FrameGraph/Tasks/PostProcesses/anaglyphTask.js.map +1 -1
  113. package/FrameGraph/Tasks/PostProcesses/blackAndWhiteTask.d.ts +1 -0
  114. package/FrameGraph/Tasks/PostProcesses/blackAndWhiteTask.js +3 -0
  115. package/FrameGraph/Tasks/PostProcesses/blackAndWhiteTask.js.map +1 -1
  116. package/FrameGraph/Tasks/PostProcesses/bloomMergeTask.d.ts +1 -0
  117. package/FrameGraph/Tasks/PostProcesses/bloomMergeTask.js +3 -0
  118. package/FrameGraph/Tasks/PostProcesses/bloomMergeTask.js.map +1 -1
  119. package/FrameGraph/Tasks/PostProcesses/bloomTask.d.ts +1 -0
  120. package/FrameGraph/Tasks/PostProcesses/bloomTask.js +3 -0
  121. package/FrameGraph/Tasks/PostProcesses/bloomTask.js.map +1 -1
  122. package/FrameGraph/Tasks/PostProcesses/blurTask.d.ts +1 -0
  123. package/FrameGraph/Tasks/PostProcesses/blurTask.js +3 -0
  124. package/FrameGraph/Tasks/PostProcesses/blurTask.js.map +1 -1
  125. package/FrameGraph/Tasks/PostProcesses/chromaticAberrationTask.d.ts +1 -0
  126. package/FrameGraph/Tasks/PostProcesses/chromaticAberrationTask.js +3 -0
  127. package/FrameGraph/Tasks/PostProcesses/chromaticAberrationTask.js.map +1 -1
  128. package/FrameGraph/Tasks/PostProcesses/circleOfConfusionTask.d.ts +1 -0
  129. package/FrameGraph/Tasks/PostProcesses/circleOfConfusionTask.js +3 -0
  130. package/FrameGraph/Tasks/PostProcesses/circleOfConfusionTask.js.map +1 -1
  131. package/FrameGraph/Tasks/PostProcesses/colorCorrectionTask.d.ts +1 -0
  132. package/FrameGraph/Tasks/PostProcesses/colorCorrectionTask.js +3 -0
  133. package/FrameGraph/Tasks/PostProcesses/colorCorrectionTask.js.map +1 -1
  134. package/FrameGraph/Tasks/PostProcesses/convolutionTask.d.ts +1 -0
  135. package/FrameGraph/Tasks/PostProcesses/convolutionTask.js +3 -0
  136. package/FrameGraph/Tasks/PostProcesses/convolutionTask.js.map +1 -1
  137. package/FrameGraph/Tasks/PostProcesses/customPostProcessTask.d.ts +1 -0
  138. package/FrameGraph/Tasks/PostProcesses/customPostProcessTask.js +3 -0
  139. package/FrameGraph/Tasks/PostProcesses/customPostProcessTask.js.map +1 -1
  140. package/FrameGraph/Tasks/PostProcesses/depthOfFieldBlurTask.d.ts +1 -0
  141. package/FrameGraph/Tasks/PostProcesses/depthOfFieldBlurTask.js +3 -0
  142. package/FrameGraph/Tasks/PostProcesses/depthOfFieldBlurTask.js.map +1 -1
  143. package/FrameGraph/Tasks/PostProcesses/depthOfFieldMergeTask.d.ts +1 -0
  144. package/FrameGraph/Tasks/PostProcesses/depthOfFieldMergeTask.js +3 -0
  145. package/FrameGraph/Tasks/PostProcesses/depthOfFieldMergeTask.js.map +1 -1
  146. package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.d.ts +1 -0
  147. package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.js +3 -0
  148. package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.js.map +1 -1
  149. package/FrameGraph/Tasks/PostProcesses/extractHighlightsTask.d.ts +1 -0
  150. package/FrameGraph/Tasks/PostProcesses/extractHighlightsTask.js +3 -0
  151. package/FrameGraph/Tasks/PostProcesses/extractHighlightsTask.js.map +1 -1
  152. package/FrameGraph/Tasks/PostProcesses/filterTask.d.ts +1 -0
  153. package/FrameGraph/Tasks/PostProcesses/filterTask.js +3 -0
  154. package/FrameGraph/Tasks/PostProcesses/filterTask.js.map +1 -1
  155. package/FrameGraph/Tasks/PostProcesses/fxaaTask.d.ts +1 -0
  156. package/FrameGraph/Tasks/PostProcesses/fxaaTask.js +3 -0
  157. package/FrameGraph/Tasks/PostProcesses/fxaaTask.js.map +1 -1
  158. package/FrameGraph/Tasks/PostProcesses/grainTask.d.ts +1 -0
  159. package/FrameGraph/Tasks/PostProcesses/grainTask.js +3 -0
  160. package/FrameGraph/Tasks/PostProcesses/grainTask.js.map +1 -1
  161. package/FrameGraph/Tasks/PostProcesses/imageProcessingTask.d.ts +1 -0
  162. package/FrameGraph/Tasks/PostProcesses/imageProcessingTask.js +3 -0
  163. package/FrameGraph/Tasks/PostProcesses/imageProcessingTask.js.map +1 -1
  164. package/FrameGraph/Tasks/PostProcesses/motionBlurTask.d.ts +1 -0
  165. package/FrameGraph/Tasks/PostProcesses/motionBlurTask.js +3 -0
  166. package/FrameGraph/Tasks/PostProcesses/motionBlurTask.js.map +1 -1
  167. package/FrameGraph/Tasks/PostProcesses/passTask.d.ts +2 -0
  168. package/FrameGraph/Tasks/PostProcesses/passTask.js +6 -0
  169. package/FrameGraph/Tasks/PostProcesses/passTask.js.map +1 -1
  170. package/FrameGraph/Tasks/PostProcesses/postProcessTask.d.ts +3 -2
  171. package/FrameGraph/Tasks/PostProcesses/postProcessTask.js +3 -0
  172. package/FrameGraph/Tasks/PostProcesses/postProcessTask.js.map +1 -1
  173. package/FrameGraph/Tasks/PostProcesses/screenSpaceCurvatureTask.d.ts +1 -0
  174. package/FrameGraph/Tasks/PostProcesses/screenSpaceCurvatureTask.js +3 -0
  175. package/FrameGraph/Tasks/PostProcesses/screenSpaceCurvatureTask.js.map +1 -1
  176. package/FrameGraph/Tasks/PostProcesses/sharpenTask.d.ts +1 -0
  177. package/FrameGraph/Tasks/PostProcesses/sharpenTask.js +3 -0
  178. package/FrameGraph/Tasks/PostProcesses/sharpenTask.js.map +1 -1
  179. package/FrameGraph/Tasks/PostProcesses/ssao2BlurTask.d.ts +1 -0
  180. package/FrameGraph/Tasks/PostProcesses/ssao2BlurTask.js +3 -0
  181. package/FrameGraph/Tasks/PostProcesses/ssao2BlurTask.js.map +1 -1
  182. package/FrameGraph/Tasks/PostProcesses/ssao2RenderingPipelineTask.d.ts +1 -0
  183. package/FrameGraph/Tasks/PostProcesses/ssao2RenderingPipelineTask.js +3 -0
  184. package/FrameGraph/Tasks/PostProcesses/ssao2RenderingPipelineTask.js.map +1 -1
  185. package/FrameGraph/Tasks/PostProcesses/ssao2Task.d.ts +1 -0
  186. package/FrameGraph/Tasks/PostProcesses/ssao2Task.js +3 -0
  187. package/FrameGraph/Tasks/PostProcesses/ssao2Task.js.map +1 -1
  188. package/FrameGraph/Tasks/PostProcesses/ssrBlurTask.d.ts +1 -0
  189. package/FrameGraph/Tasks/PostProcesses/ssrBlurTask.js +3 -0
  190. package/FrameGraph/Tasks/PostProcesses/ssrBlurTask.js.map +1 -1
  191. package/FrameGraph/Tasks/PostProcesses/ssrRenderingPipelineTask.d.ts +1 -0
  192. package/FrameGraph/Tasks/PostProcesses/ssrRenderingPipelineTask.js +3 -0
  193. package/FrameGraph/Tasks/PostProcesses/ssrRenderingPipelineTask.js.map +1 -1
  194. package/FrameGraph/Tasks/PostProcesses/ssrTask.d.ts +1 -0
  195. package/FrameGraph/Tasks/PostProcesses/ssrTask.js +3 -0
  196. package/FrameGraph/Tasks/PostProcesses/ssrTask.js.map +1 -1
  197. package/FrameGraph/Tasks/PostProcesses/taaTask.d.ts +1 -0
  198. package/FrameGraph/Tasks/PostProcesses/taaTask.js +3 -0
  199. package/FrameGraph/Tasks/PostProcesses/taaTask.js.map +1 -1
  200. package/FrameGraph/Tasks/PostProcesses/tonemapTask.d.ts +1 -0
  201. package/FrameGraph/Tasks/PostProcesses/tonemapTask.js +3 -0
  202. package/FrameGraph/Tasks/PostProcesses/tonemapTask.js.map +1 -1
  203. package/FrameGraph/Tasks/PostProcesses/volumetricLightingBlendVolumeTask.d.ts +31 -0
  204. package/FrameGraph/Tasks/PostProcesses/volumetricLightingBlendVolumeTask.js +60 -0
  205. package/FrameGraph/Tasks/PostProcesses/volumetricLightingBlendVolumeTask.js.map +1 -0
  206. package/FrameGraph/Tasks/PostProcesses/volumetricLightingTask.d.ts +93 -0
  207. package/FrameGraph/Tasks/PostProcesses/volumetricLightingTask.js +183 -0
  208. package/FrameGraph/Tasks/PostProcesses/volumetricLightingTask.js.map +1 -0
  209. package/FrameGraph/Tasks/Rendering/csmShadowGeneratorTask.d.ts +1 -0
  210. package/FrameGraph/Tasks/Rendering/csmShadowGeneratorTask.js +3 -0
  211. package/FrameGraph/Tasks/Rendering/csmShadowGeneratorTask.js.map +1 -1
  212. package/FrameGraph/Tasks/Rendering/geometryRendererTask.d.ts +1 -0
  213. package/FrameGraph/Tasks/Rendering/geometryRendererTask.js +3 -0
  214. package/FrameGraph/Tasks/Rendering/geometryRendererTask.js.map +1 -1
  215. package/FrameGraph/Tasks/Rendering/objectRendererTask.d.ts +1 -0
  216. package/FrameGraph/Tasks/Rendering/objectRendererTask.js +4 -1
  217. package/FrameGraph/Tasks/Rendering/objectRendererTask.js.map +1 -1
  218. package/FrameGraph/Tasks/Rendering/shadowGeneratorTask.d.ts +1 -0
  219. package/FrameGraph/Tasks/Rendering/shadowGeneratorTask.js +3 -0
  220. package/FrameGraph/Tasks/Rendering/shadowGeneratorTask.js.map +1 -1
  221. package/FrameGraph/Tasks/Rendering/utilityLayerRendererTask.d.ts +1 -0
  222. package/FrameGraph/Tasks/Rendering/utilityLayerRendererTask.js +3 -0
  223. package/FrameGraph/Tasks/Rendering/utilityLayerRendererTask.js.map +1 -1
  224. package/FrameGraph/Tasks/Texture/clearTextureTask.d.ts +1 -0
  225. package/FrameGraph/Tasks/Texture/clearTextureTask.js +4 -1
  226. package/FrameGraph/Tasks/Texture/clearTextureTask.js.map +1 -1
  227. package/FrameGraph/Tasks/Texture/copyToBackbufferColorTask.d.ts +1 -0
  228. package/FrameGraph/Tasks/Texture/copyToBackbufferColorTask.js +3 -0
  229. package/FrameGraph/Tasks/Texture/copyToBackbufferColorTask.js.map +1 -1
  230. package/FrameGraph/Tasks/Texture/copyToTextureTask.d.ts +1 -0
  231. package/FrameGraph/Tasks/Texture/copyToTextureTask.js +21 -4
  232. package/FrameGraph/Tasks/Texture/copyToTextureTask.js.map +1 -1
  233. package/FrameGraph/Tasks/Texture/generateMipMapsTask.d.ts +1 -0
  234. package/FrameGraph/Tasks/Texture/generateMipMapsTask.js +3 -0
  235. package/FrameGraph/Tasks/Texture/generateMipMapsTask.js.map +1 -1
  236. package/FrameGraph/frameGraphRenderContext.d.ts +3 -2
  237. package/FrameGraph/frameGraphRenderContext.js +14 -5
  238. package/FrameGraph/frameGraphRenderContext.js.map +1 -1
  239. package/FrameGraph/frameGraphTask.d.ts +5 -0
  240. package/FrameGraph/frameGraphTask.js +11 -2
  241. package/FrameGraph/frameGraphTask.js.map +1 -1
  242. package/FrameGraph/index.d.ts +2 -0
  243. package/FrameGraph/index.js +2 -0
  244. package/FrameGraph/index.js.map +1 -1
  245. package/Lights/lightingVolume.d.ts +12 -6
  246. package/Lights/lightingVolume.js +218 -108
  247. package/Lights/lightingVolume.js.map +1 -1
  248. package/Loading/Plugins/babylonFileLoader.js.map +1 -1
  249. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +2 -0
  250. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
  251. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +2 -2
  252. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
  253. package/Meshes/geometry.d.ts +2 -1
  254. package/Meshes/geometry.js +6 -2
  255. package/Meshes/geometry.js.map +1 -1
  256. package/Meshes/mesh.d.ts +2 -1
  257. package/Meshes/mesh.js +4 -3
  258. package/Meshes/mesh.js.map +1 -1
  259. package/Particles/Node/Blocks/Update/updateFlowMapBlock.d.ts +9 -1
  260. package/Particles/Node/Blocks/Update/updateFlowMapBlock.js +8 -0
  261. package/Particles/Node/Blocks/Update/updateFlowMapBlock.js.map +1 -1
  262. package/Particles/Node/Blocks/Update/updateNoiseBlock.d.ts +39 -0
  263. package/Particles/Node/Blocks/Update/updateNoiseBlock.js +102 -0
  264. package/Particles/Node/Blocks/Update/updateNoiseBlock.js.map +1 -0
  265. package/Particles/Node/Blocks/index.d.ts +1 -0
  266. package/Particles/Node/Blocks/index.js +1 -0
  267. package/Particles/Node/Blocks/index.js.map +1 -1
  268. package/Particles/Node/Blocks/particleSourceTextureBlock.d.ts +9 -5
  269. package/Particles/Node/Blocks/particleSourceTextureBlock.js +31 -13
  270. package/Particles/Node/Blocks/particleSourceTextureBlock.js.map +1 -1
  271. package/Particles/Node/nodeParticleSystemSet.helper.js +39 -21
  272. package/Particles/Node/nodeParticleSystemSet.helper.js.map +1 -1
  273. package/Particles/particle.d.ts +2 -2
  274. package/Particles/particle.js +4 -2
  275. package/Particles/particle.js.map +1 -1
  276. package/Particles/thinParticleSystem.d.ts +1 -1
  277. package/Particles/thinParticleSystem.function.js +2 -2
  278. package/Particles/thinParticleSystem.function.js.map +1 -1
  279. package/Particles/thinParticleSystem.js.map +1 -1
  280. package/Physics/v2/characterController.d.ts +42 -2
  281. package/Physics/v2/characterController.js +140 -46
  282. package/Physics/v2/characterController.js.map +1 -1
  283. package/Shaders/gaussianSplatting.vertex.js +2 -2
  284. package/Shaders/gaussianSplatting.vertex.js.map +1 -1
  285. package/Shaders/volumetricLightingBlendVolume.fragment.d.ts +5 -0
  286. package/Shaders/volumetricLightingBlendVolume.fragment.js +21 -0
  287. package/Shaders/volumetricLightingBlendVolume.fragment.js.map +1 -0
  288. package/Shaders/volumetricLightingRenderVolume.fragment.d.ts +7 -0
  289. package/Shaders/volumetricLightingRenderVolume.fragment.js +25 -0
  290. package/Shaders/volumetricLightingRenderVolume.fragment.js.map +1 -0
  291. package/Shaders/volumetricLightingRenderVolume.vertex.d.ts +9 -0
  292. package/Shaders/volumetricLightingRenderVolume.vertex.js +18 -0
  293. package/Shaders/volumetricLightingRenderVolume.vertex.js.map +1 -0
  294. package/ShadersWGSL/gaussianSplatting.vertex.js +3 -3
  295. package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
  296. package/ShadersWGSL/lightingVolume.compute.js +10 -4
  297. package/ShadersWGSL/lightingVolume.compute.js.map +1 -1
  298. package/ShadersWGSL/volumetricLightingBlendVolume.fragment.d.ts +5 -0
  299. package/ShadersWGSL/volumetricLightingBlendVolume.fragment.js +22 -0
  300. package/ShadersWGSL/volumetricLightingBlendVolume.fragment.js.map +1 -0
  301. package/ShadersWGSL/volumetricLightingRenderVolume.fragment.d.ts +7 -0
  302. package/ShadersWGSL/volumetricLightingRenderVolume.fragment.js +27 -0
  303. package/ShadersWGSL/volumetricLightingRenderVolume.fragment.js.map +1 -0
  304. package/ShadersWGSL/volumetricLightingRenderVolume.vertex.d.ts +7 -0
  305. package/ShadersWGSL/volumetricLightingRenderVolume.vertex.js +17 -0
  306. package/ShadersWGSL/volumetricLightingRenderVolume.vertex.js.map +1 -0
  307. package/States/IStencilState.d.ts +48 -2
  308. package/States/IStencilState.js.map +1 -1
  309. package/States/alphaCullingState.d.ts +1 -0
  310. package/States/alphaCullingState.js +3 -0
  311. package/States/alphaCullingState.js.map +1 -1
  312. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  import { AbortError } from "../Misc/error.js";
2
2
 
3
- import { Matrix, Vector3 } from "../Maths/math.vector.js";
3
+ import { Matrix, Vector3, TmpVectors } from "../Maths/math.vector.js";
4
4
  import { DirectionalLight } from "./directionalLight.js";
5
5
  import { Mesh } from "../Meshes/mesh.js";
6
6
  import { ComputeShader } from "../Compute/computeShader.js";
@@ -10,7 +10,6 @@ import { StorageBuffer } from "../Buffers/storageBuffer.js";
10
10
  import { BaseTexture } from "../Materials/Textures/baseTexture.js";
11
11
  import { VertexBuffer } from "../Buffers/buffer.js";
12
12
  import "../ShadersWGSL/lightingVolume.compute.js";
13
- const InvViewProjMatrix = new Matrix();
14
13
  const TmpVec3 = new Vector3();
15
14
  /**
16
15
  * Class used to create a lighting volume from a directional light's shadow generator.
@@ -29,13 +28,14 @@ export class LightingVolume {
29
28
  }
30
29
  this._shadowGenerator = sg;
31
30
  this._light = light;
32
- this._createGeometry();
31
+ this._updateGeometry();
33
32
  if (!this._engine.isWebGPU) {
34
33
  this._createFallbackTextures();
35
34
  }
36
35
  const depthTexture = this._shadowGenerator.getShadowMap()?.depthStencilTexture;
37
- if (this._cs && depthTexture) {
36
+ if (this._engine.isWebGPU && depthTexture) {
38
37
  this._cs.setInternalTexture("shadowMap", depthTexture);
38
+ this._cs2.setInternalTexture("shadowMap", depthTexture);
39
39
  }
40
40
  }
41
41
  /**
@@ -48,20 +48,6 @@ export class LightingVolume {
48
48
  this._tesselation = n;
49
49
  this._createGeometry();
50
50
  }
51
- /**
52
- * Indicates whether to build the full volume (true) or only the far plane (false). Default is false.
53
- */
54
- get buildFullVolume() {
55
- return this._buildFullVolume;
56
- }
57
- set buildFullVolume(value) {
58
- if (this._buildFullVolume === value) {
59
- return;
60
- }
61
- this._buildFullVolume = value;
62
- this._createGeometry();
63
- this._createComputeShader();
64
- }
65
51
  /**
66
52
  * The mesh used as a support for the lighting volume.
67
53
  * Note that this mesh is not automatically added to the scene's mesh array.
@@ -99,6 +85,17 @@ export class LightingVolume {
99
85
  get firstUpdate() {
100
86
  return this._firstUpdate;
101
87
  }
88
+ /** @internal */
89
+ _setComputeShaderFastMode(enabled) {
90
+ if (this._cs) {
91
+ this._cs.fastMode = enabled;
92
+ this._cs.triggerContextRebuild = enabled;
93
+ }
94
+ if (this._cs2) {
95
+ this._cs2.fastMode = enabled;
96
+ this._cs2.triggerContextRebuild = enabled;
97
+ }
98
+ }
102
99
  /**
103
100
  * Creates a new LightingVolume.
104
101
  * @param name The name of the lighting volume.
@@ -107,12 +104,14 @@ export class LightingVolume {
107
104
  * @param tesselation The tesselation level of the lighting volume (default: 64).
108
105
  */
109
106
  constructor(name, scene, shadowGenerator, tesselation = 64) {
107
+ this._buildFullVolume = true;
110
108
  this._readPixelPromise = null;
111
109
  this._readPixelAbortController = null;
112
110
  this._numFrames = 0;
113
111
  this._firstUpdate = true;
112
+ this._currentLightDirection = new Vector3();
113
+ this._needFullUpdateUBO = true;
114
114
  this._tesselation = 0;
115
- this._buildFullVolume = false;
116
115
  this._frequency = 1;
117
116
  const light = shadowGenerator ? shadowGenerator.getLight() : undefined;
118
117
  if (light && !(light instanceof DirectionalLight)) {
@@ -121,6 +120,7 @@ export class LightingVolume {
121
120
  this._name = name;
122
121
  this._shadowGenerator = shadowGenerator;
123
122
  this._light = light;
123
+ this._indices = [];
124
124
  this._engine = scene.getEngine();
125
125
  this._scene = scene;
126
126
  this._mesh = new Mesh(name, this._scene);
@@ -128,9 +128,12 @@ export class LightingVolume {
128
128
  if (this._engine.isWebGPU) {
129
129
  this._uBuffer = new UniformBuffer(this._engine);
130
130
  this._uBuffer.addUniform("invViewProjMatrix", 16);
131
+ this._uBuffer.addUniform("invViewMatrix", 16);
131
132
  this._uBuffer.addUniform("startVertexIndex", 1);
132
133
  this._uBuffer.addUniform("step", 1);
133
134
  this._uBuffer.addUniform("tesselation", 1);
135
+ this._uBuffer.addUniform("orthoMin", 3);
136
+ this._uBuffer.addUniform("orthoMax", 3);
134
137
  this._uBuffer.update();
135
138
  this._createComputeShader();
136
139
  }
@@ -150,6 +153,9 @@ export class LightingVolume {
150
153
  if (this._cs) {
151
154
  isReady = this._cs.isReady() && isReady;
152
155
  }
156
+ if (this._cs2) {
157
+ isReady = this._cs2.isReady() && isReady;
158
+ }
153
159
  return isReady;
154
160
  }
155
161
  /**
@@ -164,15 +170,24 @@ export class LightingVolume {
164
170
  return;
165
171
  }
166
172
  this._numFrames = 0;
167
- if (this._cs && this._uBuffer) {
173
+ if (this._engine.isWebGPU) {
174
+ this._uBuffer.updateMatrix("invViewProjMatrix", this._shadowGenerator.getTransformMatrix().invertToRef(TmpVectors.Matrix[0]));
175
+ this._engine._debugPushGroup?.(`Update lighting volume (${this._name})`, 1);
176
+ if (this._needUpdateGeometry()) {
177
+ this._fullUpdateUBO(true);
178
+ const dispatchSize = Math.ceil((this._tesselation + 1) / 32);
179
+ this._engine._debugPushGroup?.(`Update vertices of other planes`, 1);
180
+ this._cs2.dispatch(dispatchSize, 1, 1);
181
+ this._engine._debugPopGroup?.(1);
182
+ }
183
+ else {
184
+ this._fullUpdateUBO();
185
+ }
168
186
  const dispatchSize = Math.ceil((this._tesselation + 1) / 8);
169
- const viewProjMatrix = this._shadowGenerator.getTransformMatrix();
170
- viewProjMatrix.invertToRef(InvViewProjMatrix);
171
- this._uBuffer.updateMatrix("invViewProjMatrix", InvViewProjMatrix);
172
- this._uBuffer.update();
173
- this._engine._debugPushGroup?.(`Generate lighting volume (${this._name})`);
187
+ this._engine._debugPushGroup?.(`Update vertices of far plane`, 1);
174
188
  this._cs.dispatch(dispatchSize, dispatchSize, 1);
175
- this._engine._debugPopGroup?.();
189
+ this._engine._debugPopGroup?.(1);
190
+ this._engine._debugPopGroup?.(1);
176
191
  this._firstUpdate = false;
177
192
  }
178
193
  else {
@@ -200,26 +215,45 @@ export class LightingVolume {
200
215
  this._uBuffer?.dispose();
201
216
  this._depthCopy?.dispose();
202
217
  }
218
+ _needUpdateGeometry() {
219
+ if (this._cs?.triggerContextRebuild || (this._light && !this._currentLightDirection.equals(this._light.direction))) {
220
+ this._currentLightDirection.copyFrom(this._light.direction);
221
+ return true;
222
+ }
223
+ return false;
224
+ }
203
225
  _createComputeShader() {
204
- this._cs = new ComputeShader("createLightVolume", this._engine, "lightingVolume", {
226
+ this._cs = new ComputeShader("updateFarPlaneVertices", this._engine, "lightingVolume", {
205
227
  bindingsMapping: {
206
228
  shadowMap: { group: 0, binding: 0 },
207
229
  params: { group: 0, binding: 1 },
208
230
  positions: { group: 0, binding: 2 },
209
231
  },
210
232
  defines: !this._buildFullVolume ? ["#define KEEP_EDGES", "#define MOVE_FAR_DEPTH_TO_NEAR"] : undefined,
233
+ entryPoint: "updateFarPlaneVertices",
234
+ });
235
+ this._cs2 = new ComputeShader("updatePlaneVertices", this._engine, "lightingVolume", {
236
+ bindingsMapping: {
237
+ shadowMap: { group: 0, binding: 0 },
238
+ params: { group: 0, binding: 1 },
239
+ positions: { group: 0, binding: 2 },
240
+ },
241
+ entryPoint: "updatePlaneVertices",
211
242
  });
212
243
  if (this._shadowGenerator) {
213
244
  const depthTexture = this._shadowGenerator.getShadowMap()?.depthStencilTexture;
214
245
  if (depthTexture) {
215
246
  this._cs.setInternalTexture("shadowMap", depthTexture);
247
+ this._cs2.setInternalTexture("shadowMap", depthTexture);
216
248
  }
217
249
  }
218
250
  if (this._uBuffer) {
219
251
  this._cs.setUniformBuffer("params", this._uBuffer);
252
+ this._cs2.setUniformBuffer("params", this._uBuffer);
220
253
  }
221
254
  if (this._storageBuffer) {
222
255
  this._cs.setStorageBuffer("positions", this._storageBuffer);
256
+ this._cs2.setStorageBuffer("positions", this._storageBuffer);
223
257
  }
224
258
  }
225
259
  _createFallbackTextures() {
@@ -280,13 +314,22 @@ export class LightingVolume {
280
314
  const invViewProjMatrix = shadowGenerator.getTransformMatrix().clone();
281
315
  invViewProjMatrix.invertToRef(invViewProjMatrix);
282
316
  const factor = 4;
317
+ if (this._needUpdateGeometry()) {
318
+ this._updateGeometry();
319
+ }
283
320
  let posIndex = startPos;
284
321
  let stepY = 0;
285
322
  for (let y = 0; y < numTesselation + 1; ++y) {
286
323
  for (let x = 0; x < numTesselation + 1; ++x) {
287
324
  let depth = depthValues[Math.floor(mapSize * Math.floor(stepY) + x * step) * factor];
288
- if (!this._buildFullVolume && (depth === 1 || y === 0 || x === 0 || y === numTesselation || x === numTesselation)) {
289
- depth = 0;
325
+ if (!this._buildFullVolume) {
326
+ if (y === 0 || x === 0 || y === numTesselation || x === numTesselation) {
327
+ posIndex += 3;
328
+ continue;
329
+ }
330
+ if (depth === 1) {
331
+ depth = 0;
332
+ }
290
333
  }
291
334
  TmpVec3.set((x - halfTesselation) / halfTesselation, (y - halfTesselation) / halfTesselation, -1 + 2 * depth);
292
335
  Vector3.TransformCoordinatesToRef(TmpVec3, invViewProjMatrix, TmpVec3);
@@ -301,126 +344,193 @@ export class LightingVolume {
301
344
  this._readPixelPromise = null;
302
345
  this._firstUpdate = false;
303
346
  }
347
+ _fullUpdateUBO(force = false) {
348
+ const light = this._light;
349
+ if ((!force && !this._needFullUpdateUBO) || !light || !this._shadowGenerator) {
350
+ this._uBuffer.update();
351
+ return;
352
+ }
353
+ this._needFullUpdateUBO = false;
354
+ const numTesselation = this._tesselation;
355
+ const min = TmpVectors.Vector3[0].set(light.orthoLeft, light.orthoBottom, light.shadowMinZ ?? 0);
356
+ const max = TmpVectors.Vector3[1].set(light.orthoRight, light.orthoTop, light.shadowMaxZ ?? 10000);
357
+ const invViewMatrix = this._shadowGenerator.viewMatrix.invertToRef(TmpVectors.Matrix[1]);
358
+ this._uBuffer.updateUInt("startVertexIndex", this._buildFullVolume ? (numTesselation + 1) * 4 * 3 : 4 * 3);
359
+ this._uBuffer.updateFloat("step", ((this._shadowGenerator?.mapSize ?? 128) - 1) / numTesselation);
360
+ this._uBuffer.updateUInt("tesselation", numTesselation);
361
+ this._uBuffer.updateVector3("orthoMin", min);
362
+ this._uBuffer.updateVector3("orthoMax", max);
363
+ this._uBuffer.updateMatrix("invViewMatrix", invViewMatrix);
364
+ this._uBuffer.update();
365
+ }
304
366
  _createGeometry() {
305
- if (!this._light) {
367
+ const light = this._light;
368
+ if (!light) {
306
369
  return;
307
370
  }
308
371
  this._tesselation = Math.max(Math.ceil(this._tesselation) & ~1, 2);
372
+ const numTesselation = this._tesselation;
373
+ const vertexNumber = (numTesselation + 1) * (numTesselation + 1) + (this._buildFullVolume ? (numTesselation + 1) * 4 : 4);
374
+ this._positions = new Float32Array(vertexNumber * 3);
375
+ this._indices.length = 0;
376
+ this._createIndices(light);
377
+ this._mesh.setIndices(this._indices, vertexNumber);
378
+ if (this._engine.isWebGPU) {
379
+ const webGPUEngine = this._engine;
380
+ this._storageBuffer?.dispose();
381
+ this._storageBuffer = new StorageBuffer(webGPUEngine, vertexNumber * 3 * 4, 8 | 3);
382
+ this._mesh.setVerticesBuffer(new VertexBuffer(webGPUEngine, this._storageBuffer.getBuffer(), "position", { takeBufferOwnership: false }), true, vertexNumber);
383
+ this._cs.setStorageBuffer("positions", this._storageBuffer);
384
+ this._cs2.setStorageBuffer("positions", this._storageBuffer);
385
+ this._cs.triggerContextRebuild = true;
386
+ this._cs2.triggerContextRebuild = true;
387
+ this._needFullUpdateUBO = true;
388
+ }
389
+ this._updateGeometry();
390
+ }
391
+ _updateGeometry() {
309
392
  const light = this._light;
310
- const min = new Vector3(light.orthoLeft, light.orthoBottom, light.shadowMinZ ?? 0);
311
- const max = new Vector3(light.orthoRight, light.orthoTop, light.shadowMaxZ ?? 10000);
312
- const invViewMatrix = Matrix.LookAtLH(light.position, light.position.add(light.direction), Vector3.UpReadOnly);
313
- invViewMatrix.invertToRef(invViewMatrix);
314
- const positions = [];
315
- const indices = [];
393
+ if (!light || !this._shadowGenerator) {
394
+ return;
395
+ }
396
+ if (this._indices.length === 0) {
397
+ this._createGeometry();
398
+ return;
399
+ }
400
+ if (this._engine.isWebGPU) {
401
+ return;
402
+ }
316
403
  const numTesselation = this._tesselation;
404
+ const min = TmpVectors.Vector3[0].set(light.orthoLeft, light.orthoBottom, light.shadowMinZ ?? 0);
405
+ const max = TmpVectors.Vector3[1].set(light.orthoRight, light.orthoTop, light.shadowMaxZ ?? 10000);
406
+ const invViewMatrix = this._shadowGenerator.viewMatrix.invertToRef(TmpVectors.Matrix[1]);
317
407
  const stepX = (max.x - min.x) / numTesselation;
318
408
  const stepY = (max.y - min.y) / numTesselation;
319
- const v = new Vector3();
409
+ let vIndex = 0;
410
+ if (this._buildFullVolume) {
411
+ // Right faces of the frustum
412
+ for (let i = 0; i <= numTesselation; ++i) {
413
+ TmpVec3.set(max.x, min.y + i * stepY, min.z);
414
+ Vector3.TransformCoordinatesToRef(TmpVec3, invViewMatrix, TmpVec3);
415
+ this._positions[vIndex++] = TmpVec3.x;
416
+ this._positions[vIndex++] = TmpVec3.y;
417
+ this._positions[vIndex++] = TmpVec3.z;
418
+ }
419
+ // Left faces of the frustum
420
+ for (let i = 0; i <= numTesselation; ++i) {
421
+ TmpVec3.set(min.x, min.y + i * stepY, min.z);
422
+ Vector3.TransformCoordinatesToRef(TmpVec3, invViewMatrix, TmpVec3);
423
+ this._positions[vIndex++] = TmpVec3.x;
424
+ this._positions[vIndex++] = TmpVec3.y;
425
+ this._positions[vIndex++] = TmpVec3.z;
426
+ }
427
+ // Bottom faces of the frustum
428
+ for (let i = 0; i <= numTesselation; ++i) {
429
+ TmpVec3.set(min.x + i * stepX, min.y, min.z);
430
+ Vector3.TransformCoordinatesToRef(TmpVec3, invViewMatrix, TmpVec3);
431
+ this._positions[vIndex++] = TmpVec3.x;
432
+ this._positions[vIndex++] = TmpVec3.y;
433
+ this._positions[vIndex++] = TmpVec3.z;
434
+ }
435
+ // Top faces of the frustum
436
+ for (let i = 0; i <= numTesselation; ++i) {
437
+ TmpVec3.set(min.x + i * stepX, max.y, min.z);
438
+ Vector3.TransformCoordinatesToRef(TmpVec3, invViewMatrix, TmpVec3);
439
+ this._positions[vIndex++] = TmpVec3.x;
440
+ this._positions[vIndex++] = TmpVec3.y;
441
+ this._positions[vIndex++] = TmpVec3.z;
442
+ }
443
+ }
444
+ else {
445
+ // Closes the volume with two near triangles
446
+ TmpVec3.set(max.x, min.y, min.z);
447
+ Vector3.TransformCoordinatesToRef(TmpVec3, invViewMatrix, TmpVec3);
448
+ this._positions[vIndex++] = TmpVec3.x;
449
+ this._positions[vIndex++] = TmpVec3.y;
450
+ this._positions[vIndex++] = TmpVec3.z;
451
+ TmpVec3.set(max.x, max.y, min.z);
452
+ Vector3.TransformCoordinatesToRef(TmpVec3, invViewMatrix, TmpVec3);
453
+ this._positions[vIndex++] = TmpVec3.x;
454
+ this._positions[vIndex++] = TmpVec3.y;
455
+ this._positions[vIndex++] = TmpVec3.z;
456
+ TmpVec3.set(min.x, min.y, min.z);
457
+ Vector3.TransformCoordinatesToRef(TmpVec3, invViewMatrix, TmpVec3);
458
+ this._positions[vIndex++] = TmpVec3.x;
459
+ this._positions[vIndex++] = TmpVec3.y;
460
+ this._positions[vIndex++] = TmpVec3.z;
461
+ TmpVec3.set(min.x, max.y, min.z);
462
+ Vector3.TransformCoordinatesToRef(TmpVec3, invViewMatrix, TmpVec3);
463
+ this._positions[vIndex++] = TmpVec3.x;
464
+ this._positions[vIndex++] = TmpVec3.y;
465
+ this._positions[vIndex++] = TmpVec3.z;
466
+ }
467
+ this._mesh.setVerticesData("position", this._positions);
468
+ }
469
+ _createIndices(light) {
470
+ const invViewMatrix = Matrix.LookAtLH(light.position, light.position.add(light.direction), Vector3.UpReadOnly);
471
+ invViewMatrix.invertToRef(invViewMatrix);
472
+ const numTesselation = this._tesselation;
320
473
  const startFarIndices = this._buildFullVolume ? (numTesselation + 1) * 4 : 4;
321
474
  if (this._buildFullVolume) {
322
- let startIndices = 0;
475
+ const rightFaceStartIndex = 0;
323
476
  // Right faces of the frustum
324
477
  for (let i = 0; i <= numTesselation; ++i) {
325
- v.set(max.x, min.y + i * stepY, min.z);
326
- const p = Vector3.TransformCoordinates(v, invViewMatrix);
327
- positions.push(p.x, p.y, p.z);
328
478
  if (i < numTesselation) {
329
- indices.push(startIndices + i, startFarIndices + numTesselation + (i + 1) * (numTesselation + 1), startFarIndices + numTesselation + i * (numTesselation + 1));
330
- indices.push(startIndices + i, startIndices + i + 1, startFarIndices + numTesselation + (i + 1) * (numTesselation + 1));
479
+ this._indices.push(rightFaceStartIndex + i, startFarIndices + numTesselation + (i + 1) * (numTesselation + 1), startFarIndices + numTesselation + i * (numTesselation + 1));
480
+ this._indices.push(rightFaceStartIndex + i, rightFaceStartIndex + i + 1, startFarIndices + numTesselation + (i + 1) * (numTesselation + 1));
331
481
  }
332
482
  }
333
- const n0 = 0;
334
- const n1 = positions.length / 3 - 1;
335
- const n2 = n1 + 1;
336
- startIndices = positions.length / 3;
483
+ const leftFaceStartIndex = rightFaceStartIndex + numTesselation + 1;
337
484
  // Left faces of the frustum
338
485
  for (let i = 0; i <= numTesselation; ++i) {
339
- v.set(min.x, min.y + i * stepY, min.z);
340
- const p = Vector3.TransformCoordinates(v, invViewMatrix);
341
- positions.push(p.x, p.y, p.z);
342
486
  if (i < numTesselation) {
343
- indices.push(startIndices + i, startFarIndices + 0 + i * (numTesselation + 1), startFarIndices + 0 + (i + 1) * (numTesselation + 1));
344
- indices.push(startIndices + i, startFarIndices + 0 + (i + 1) * (numTesselation + 1), startIndices + i + 1);
487
+ this._indices.push(leftFaceStartIndex + i, startFarIndices + 0 + i * (numTesselation + 1), startFarIndices + 0 + (i + 1) * (numTesselation + 1));
488
+ this._indices.push(leftFaceStartIndex + i, startFarIndices + 0 + (i + 1) * (numTesselation + 1), leftFaceStartIndex + i + 1);
345
489
  }
346
490
  }
347
- const n3 = positions.length / 3 - 1;
348
- startIndices = positions.length / 3;
491
+ const bottomFaceStartIndex = leftFaceStartIndex + numTesselation + 1;
349
492
  // Bottom faces of the frustum
350
493
  for (let i = 0; i <= numTesselation; ++i) {
351
- v.set(min.x + i * stepX, min.y, min.z);
352
- const p = Vector3.TransformCoordinates(v, invViewMatrix);
353
- positions.push(p.x, p.y, p.z);
354
494
  if (i < numTesselation) {
355
- indices.push(startIndices + i, startIndices + i + 1, startFarIndices + i + 0 * (numTesselation + 1));
356
- indices.push(startIndices + i + 1, startFarIndices + i + 1 + 0 * (numTesselation + 1), startFarIndices + i + 0 * (numTesselation + 1));
495
+ this._indices.push(bottomFaceStartIndex + i, bottomFaceStartIndex + i + 1, startFarIndices + i + 0 * (numTesselation + 1));
496
+ this._indices.push(bottomFaceStartIndex + i + 1, startFarIndices + i + 1 + 0 * (numTesselation + 1), startFarIndices + i + 0 * (numTesselation + 1));
357
497
  }
358
498
  }
359
- startIndices = positions.length / 3;
499
+ const topFaceStartIndex = bottomFaceStartIndex + numTesselation + 1;
360
500
  // Top faces of the frustum
361
501
  for (let i = 0; i <= numTesselation; ++i) {
362
- v.set(min.x + i * stepX, max.y, min.z);
363
- const p = Vector3.TransformCoordinates(v, invViewMatrix);
364
- positions.push(p.x, p.y, p.z);
365
502
  if (i < numTesselation) {
366
- indices.push(startIndices + i, startFarIndices + i + numTesselation * (numTesselation + 1), startIndices + i + 1);
367
- indices.push(startIndices + i + 1, startFarIndices + i + numTesselation * (numTesselation + 1), startFarIndices + i + 1 + numTesselation * (numTesselation + 1));
503
+ this._indices.push(topFaceStartIndex + i, startFarIndices + i + numTesselation * (numTesselation + 1), topFaceStartIndex + i + 1);
504
+ this._indices.push(topFaceStartIndex + i + 1, startFarIndices + i + numTesselation * (numTesselation + 1), startFarIndices + i + 1 + numTesselation * (numTesselation + 1));
368
505
  }
369
506
  }
370
- startIndices = positions.length / 3;
371
507
  // Near faces of the frustum
372
- indices.push(n0, n2, n1);
373
- indices.push(n2, n3, n1);
508
+ for (let i = 0; i < numTesselation; ++i) {
509
+ this._indices.push(leftFaceStartIndex + i, leftFaceStartIndex + i + 1, topFaceStartIndex + numTesselation - i);
510
+ if (i < numTesselation - 1) {
511
+ this._indices.push(leftFaceStartIndex + i + 1, topFaceStartIndex + numTesselation - i - 1, topFaceStartIndex + numTesselation - i);
512
+ }
513
+ }
514
+ for (let i = 0; i < numTesselation; ++i) {
515
+ this._indices.push(bottomFaceStartIndex + i, rightFaceStartIndex + numTesselation - i, rightFaceStartIndex + numTesselation - i - 1);
516
+ if (i < numTesselation - 1) {
517
+ this._indices.push(bottomFaceStartIndex + i, rightFaceStartIndex + numTesselation - i - 1, bottomFaceStartIndex + i + 1);
518
+ }
519
+ }
374
520
  }
375
521
  else {
376
- let p;
377
- v.set(max.x, min.y, min.z);
378
- p = Vector3.TransformCoordinates(v, invViewMatrix);
379
- positions.push(p.x, p.y, p.z);
380
- v.set(max.x, max.y, min.z);
381
- p = Vector3.TransformCoordinates(v, invViewMatrix);
382
- positions.push(p.x, p.y, p.z);
383
- v.set(min.x, min.y, min.z);
384
- p = Vector3.TransformCoordinates(v, invViewMatrix);
385
- positions.push(p.x, p.y, p.z);
386
- v.set(min.x, max.y, min.z);
387
- p = Vector3.TransformCoordinates(v, invViewMatrix);
388
- positions.push(p.x, p.y, p.z);
389
- indices.push(0, 2, 1);
390
- indices.push(2, 3, 1);
522
+ this._indices.push(0, 2, 1);
523
+ this._indices.push(2, 3, 1);
391
524
  }
392
525
  // Tesselate the far plane
393
- let y = min.y;
394
526
  for (let iy = 0; iy <= numTesselation; ++iy) {
395
- let x = min.x;
396
527
  for (let ix = 0; ix <= numTesselation; ++ix) {
397
- v.set(x, y, min.z);
398
- const p = Vector3.TransformCoordinates(v, invViewMatrix);
399
- positions.push(p.x, p.y, p.z);
400
528
  if (ix < numTesselation && iy < numTesselation) {
401
- indices.push(startFarIndices + ix + iy * (numTesselation + 1), startFarIndices + ix + 1 + iy * (numTesselation + 1), startFarIndices + ix + 1 + (iy + 1) * (numTesselation + 1));
402
- indices.push(startFarIndices + ix + iy * (numTesselation + 1), startFarIndices + ix + 1 + (iy + 1) * (numTesselation + 1), startFarIndices + ix + (iy + 1) * (numTesselation + 1));
529
+ this._indices.push(startFarIndices + ix + iy * (numTesselation + 1), startFarIndices + ix + 1 + iy * (numTesselation + 1), startFarIndices + ix + 1 + (iy + 1) * (numTesselation + 1));
530
+ this._indices.push(startFarIndices + ix + iy * (numTesselation + 1), startFarIndices + ix + 1 + (iy + 1) * (numTesselation + 1), startFarIndices + ix + (iy + 1) * (numTesselation + 1));
403
531
  }
404
- x += stepX;
405
532
  }
406
- y += stepY;
407
- }
408
- if (this._uBuffer && this._cs) {
409
- const webGPUEngine = this._engine;
410
- this._storageBuffer?.dispose();
411
- this._storageBuffer = new StorageBuffer(webGPUEngine, positions.length * 4, 8 | 3);
412
- this._storageBuffer.update(positions);
413
- const vertexBuffer = new VertexBuffer(webGPUEngine, this._storageBuffer.getBuffer(), "position");
414
- this._mesh.setVerticesBuffer(vertexBuffer);
415
- this._cs.setStorageBuffer("positions", this._storageBuffer);
416
- this._uBuffer.updateUInt("startVertexIndex", this._buildFullVolume ? (numTesselation + 1) * 4 * 3 : 4 * 3);
417
- this._uBuffer.updateFloat("step", ((this._shadowGenerator?.mapSize ?? 128) - 1) / numTesselation);
418
- this._uBuffer.updateUInt("tesselation", numTesselation);
419
- }
420
- else {
421
- this._mesh.setVerticesData("position", positions);
422
533
  }
423
- this._mesh.setIndices(indices, positions.length / 3);
424
534
  }
425
535
  }
426
536
  //# sourceMappingURL=lightingVolume.js.map