@woosh/meep-engine 3.69.0 → 3.71.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 (725) hide show
  1. package/CHANGELOG.md +45 -1
  2. package/MIGRATION_2_TO_3.md +1 -1
  3. package/build/bundle-worker-terrain.js +1 -1
  4. package/package.json +1 -1
  5. package/src/core/bvh8/build/BVH8Converter.d.ts +16 -0
  6. package/src/core/bvh8/build/BVH8Converter.d.ts.map +1 -1
  7. package/src/core/bvh8/build/BVH8Converter.js +64 -37
  8. package/src/core/bvh8/build/bvh8_assign_slots_greedy.d.ts +25 -0
  9. package/src/core/bvh8/build/bvh8_assign_slots_greedy.d.ts.map +1 -0
  10. package/src/core/bvh8/build/bvh8_assign_slots_greedy.js +68 -0
  11. package/src/core/bvh8/build/bvh8_from_proxy.d.ts.map +1 -1
  12. package/src/core/bvh8/build/bvh8_from_proxy.js +2 -33
  13. package/src/core/bvh8/build/bvh8_node_fit_slots.d.ts +22 -0
  14. package/src/core/bvh8/build/bvh8_node_fit_slots.d.ts.map +1 -0
  15. package/src/core/bvh8/build/bvh8_node_fit_slots.js +115 -0
  16. package/src/core/bvh8/bvh8_depth.d.ts +8 -0
  17. package/src/core/bvh8/bvh8_depth.d.ts.map +1 -0
  18. package/src/core/bvh8/bvh8_depth.js +39 -0
  19. package/src/core/math/complex/complex_fft_radix2.d.ts +19 -0
  20. package/src/core/math/complex/complex_fft_radix2.d.ts.map +1 -0
  21. package/src/core/math/complex/complex_fft_radix2.js +71 -0
  22. package/src/engine/graphics3/GPUFluidSystem.d.ts +17 -4
  23. package/src/engine/graphics3/GPUFluidSystem.d.ts.map +1 -1
  24. package/src/engine/graphics3/GPUFluidSystem.js +113 -16
  25. package/src/engine/graphics3/VolumetricLightMapSystem.d.ts +1 -1
  26. package/src/engine/graphics3/VolumetricLightMapSystem.js +261 -261
  27. package/src/engine/physics/cloth/playground/wind_main.js +7 -6
  28. package/src/engine/physics/cloth/wind/AbstractClothWind.d.ts +2 -2
  29. package/src/engine/physics/cloth/wind/AbstractClothWind.js +2 -2
  30. package/src/engine/physics/cloth/wind/ClothFluidWind.d.ts +3 -3
  31. package/src/engine/physics/cloth/wind/ClothFluidWind.d.ts.map +1 -1
  32. package/src/engine/physics/cloth/wind/ClothFluidWind.js +7 -9
  33. package/src/engine/physics/cloth/wind/ClothGPUFluidWind.d.ts +10 -10
  34. package/src/engine/physics/cloth/wind/ClothGPUFluidWind.d.ts.map +1 -1
  35. package/src/engine/physics/cloth/wind/ClothGPUFluidWind.js +14 -22
  36. package/src/engine/physics/fluid/FluidAtmosphere.d.ts +16 -2
  37. package/src/engine/physics/fluid/FluidAtmosphere.d.ts.map +1 -1
  38. package/src/engine/physics/fluid/FluidAtmosphere.js +17 -3
  39. package/src/engine/physics/fluid/ecs/FluidEffectorsComponentSerializationAdapter.d.ts +1 -2
  40. package/src/engine/physics/fluid/ecs/FluidEffectorsComponentSerializationAdapter.d.ts.map +1 -1
  41. package/src/engine/physics/fluid/ecs/FluidEffectorsComponentSerializationAdapter.js +1 -2
  42. package/src/engine/physics/fluid/ecs/FluidEffectorsSystem.d.ts +8 -5
  43. package/src/engine/physics/fluid/ecs/FluidEffectorsSystem.d.ts.map +1 -1
  44. package/src/engine/physics/fluid/ecs/FluidEffectorsSystem.js +60 -17
  45. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
  46. package/src/engine/physics/fluid/effector/AbstractFluidEffector.d.ts +1 -1
  47. package/src/engine/physics/fluid/effector/AbstractFluidEffector.js +1 -1
  48. package/src/engine/physics/fluid/effector/GlobalFluidEffector.d.ts +33 -47
  49. package/src/engine/physics/fluid/effector/GlobalFluidEffector.d.ts.map +1 -1
  50. package/src/engine/physics/fluid/effector/GlobalFluidEffector.js +38 -176
  51. package/src/engine/physics/fluid/effector/GlobalFluidEffectorSerializationAdapter.d.ts +8 -11
  52. package/src/engine/physics/fluid/effector/GlobalFluidEffectorSerializationAdapter.d.ts.map +1 -1
  53. package/src/engine/physics/fluid/effector/GlobalFluidEffectorSerializationAdapter.js +13 -24
  54. package/src/engine/physics/fluid/effector/GlobalFluidEffectorSerializationUpgrader_0_1.d.ts +16 -0
  55. package/src/engine/physics/fluid/effector/GlobalFluidEffectorSerializationUpgrader_0_1.d.ts.map +1 -0
  56. package/src/engine/physics/fluid/effector/GlobalFluidEffectorSerializationUpgrader_0_1.js +35 -0
  57. package/src/engine/physics/fluid/fluid_apply_atmosphere.d.ts +1 -1
  58. package/src/engine/physics/fluid/fluid_apply_atmosphere.js +1 -1
  59. package/src/engine/physics/fluid/turbulence/FLUID_TURBULENCE_TILE.d.ts +28 -0
  60. package/src/engine/physics/fluid/turbulence/FLUID_TURBULENCE_TILE.d.ts.map +1 -0
  61. package/src/engine/physics/fluid/turbulence/FLUID_TURBULENCE_TILE.js +29 -0
  62. package/src/engine/physics/fluid/turbulence/fluid_atmosphere_velocity_at.d.ts +16 -0
  63. package/src/engine/physics/fluid/turbulence/fluid_atmosphere_velocity_at.d.ts.map +1 -0
  64. package/src/engine/physics/fluid/turbulence/fluid_atmosphere_velocity_at.js +49 -0
  65. package/src/engine/physics/fluid/turbulence/fluid_turbulence_inverse_tile_size.d.ts +11 -0
  66. package/src/engine/physics/fluid/turbulence/fluid_turbulence_inverse_tile_size.d.ts.map +1 -0
  67. package/src/engine/physics/fluid/turbulence/fluid_turbulence_inverse_tile_size.js +18 -0
  68. package/src/engine/physics/fluid/turbulence/fluid_turbulence_tile_data.d.ts +25 -0
  69. package/src/engine/physics/fluid/turbulence/fluid_turbulence_tile_data.d.ts.map +1 -0
  70. package/src/engine/physics/fluid/turbulence/fluid_turbulence_tile_data.js +65 -0
  71. package/src/engine/physics/fluid/turbulence/fluid_turbulence_tile_generate.d.ts +56 -0
  72. package/src/engine/physics/fluid/turbulence/fluid_turbulence_tile_generate.d.ts.map +1 -0
  73. package/src/engine/physics/fluid/turbulence/fluid_turbulence_tile_generate.js +313 -0
  74. package/src/engine/physics/fluid/turbulence/fluid_turbulence_tile_sample.d.ts +16 -0
  75. package/src/engine/physics/fluid/turbulence/fluid_turbulence_tile_sample.d.ts.map +1 -0
  76. package/src/engine/physics/fluid/turbulence/fluid_turbulence_tile_sample.js +69 -0
  77. package/src/engine/sound/simulation/probe/probe_place_sdf_cover.d.ts +1 -2
  78. package/src/engine/sound/simulation/probe/probe_place_sdf_cover.d.ts.map +1 -1
  79. package/src/engine/sound/simulation/probe/probe_place_sdf_cover.js +1 -2
  80. package/src/generation/foliage/mesh/branch_ring_triangulate.d.ts +1 -1
  81. package/src/generation/foliage/mesh/branch_ring_triangulate.js +1 -1
  82. package/src/shade/playground/bvh_repro/README.md +8 -6
  83. package/src/shade/playground/bvh_repro/index.html +125 -124
  84. package/src/shade/playground/bvh_repro/main.js +259 -254
  85. package/src/shade/playground/foliage_wind/foliage_world.d.ts.map +1 -1
  86. package/src/shade/playground/foliage_wind/foliage_world.js +7 -4
  87. package/src/shade/playground/grass_surfaces/main.js +3 -2
  88. package/src/shade/playground/particle_ecs/bonfire_wind.d.ts +23 -13
  89. package/src/shade/playground/particle_ecs/bonfire_wind.d.ts.map +1 -1
  90. package/src/shade/playground/particle_ecs/bonfire_wind.js +30 -33
  91. package/src/shade/playground/skinned_blas_refit/README.md +26 -14
  92. package/src/shade/playground/skinned_blas_refit/shader_blas_audit_leaf_triangles.d.ts +14 -9
  93. package/src/shade/playground/skinned_blas_refit/shader_blas_audit_leaf_triangles.d.ts.map +1 -1
  94. package/src/shade/playground/skinned_blas_refit/shader_blas_audit_leaf_triangles.js +126 -127
  95. package/src/shade/playground/skinned_blas_refit/shader_blas_audit_points.js +95 -95
  96. package/src/shade/playground/skinned_blas_refit/shader_blas_audit_visibility.d.ts +9 -1
  97. package/src/shade/playground/skinned_blas_refit/shader_blas_audit_visibility.d.ts.map +1 -1
  98. package/src/shade/playground/skinned_blas_refit/shader_blas_audit_visibility.js +146 -135
  99. package/src/shade/playground/skinned_blas_refit/verify_clone_leaves.d.ts +6 -6
  100. package/src/shade/playground/skinned_blas_refit/verify_clone_leaves.d.ts.map +1 -1
  101. package/src/shade/playground/skinned_blas_refit/verify_clone_leaves.js +148 -134
  102. package/src/shade/playground/skinned_blas_refit/verify_leaf_triangles.d.ts +11 -8
  103. package/src/shade/playground/skinned_blas_refit/verify_leaf_triangles.d.ts.map +1 -1
  104. package/src/shade/playground/skinned_blas_refit/verify_leaf_triangles.js +342 -202
  105. package/src/shade/playground/skinned_blas_refit/verify_skinned_blas_refit.d.ts +12 -13
  106. package/src/shade/playground/skinned_blas_refit/verify_skinned_blas_refit.d.ts.map +1 -1
  107. package/src/shade/playground/skinned_blas_refit/verify_skinned_blas_refit.js +136 -116
  108. package/src/shade/playground/skinned_blas_refit/verify_traversal_reachability.d.ts +4 -4
  109. package/src/shade/playground/skinned_blas_refit/verify_traversal_reachability.d.ts.map +1 -1
  110. package/src/shade/playground/skinned_blas_refit/verify_traversal_reachability.js +255 -249
  111. package/src/shade/playground/water_surface/main.js +6 -3
  112. package/src/shade/renderer/Renderer.d.ts +0 -12
  113. package/src/shade/renderer/Renderer.d.ts.map +1 -1
  114. package/src/shade/renderer/Renderer.js +0 -101
  115. package/src/shade/renderer/ShadeIndirectLightingMode.d.ts +0 -1
  116. package/src/shade/renderer/ShadeIndirectLightingMode.js +0 -2
  117. package/src/shade/renderer/animation/GPUAnimationManager.js +2 -2
  118. package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.d.ts.map +1 -1
  119. package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.js +7 -8
  120. package/src/shade/renderer/atmosphere/ATMOSPHERE_PARAMETERS_STRUCT.d.ts.map +1 -1
  121. package/src/shade/renderer/atmosphere/ATMOSPHERE_PARAMETERS_STRUCT.js +7 -0
  122. package/src/shade/renderer/atmosphere/shader_sky_irradiance_lut.d.ts.map +1 -1
  123. package/src/shade/renderer/atmosphere/shader_sky_irradiance_lut.js +1 -4
  124. package/src/shade/renderer/fluid/FLUID_FAR_FIELD_STRUCT.d.ts +111 -0
  125. package/src/shade/renderer/fluid/FLUID_FAR_FIELD_STRUCT.d.ts.map +1 -0
  126. package/src/shade/renderer/fluid/FLUID_FAR_FIELD_STRUCT.js +162 -0
  127. package/src/shade/renderer/fluid/GPUFluidCascade.d.ts +40 -11
  128. package/src/shade/renderer/fluid/GPUFluidCascade.d.ts.map +1 -1
  129. package/src/shade/renderer/fluid/GPUFluidCascade.js +149 -47
  130. package/src/shade/renderer/fluid/GPUFluidCascadeStack.d.ts +11 -4
  131. package/src/shade/renderer/fluid/GPUFluidCascadeStack.d.ts.map +1 -1
  132. package/src/shade/renderer/fluid/GPUFluidCascadeStack.js +69 -10
  133. package/src/shade/renderer/fluid/chunk_fluid_far_field.d.ts +19 -0
  134. package/src/shade/renderer/fluid/chunk_fluid_far_field.d.ts.map +1 -0
  135. package/src/shade/renderer/fluid/chunk_fluid_far_field.js +43 -0
  136. package/src/shade/renderer/fluid/coupling/FLUID_CASCADE_PARENT_STRUCT.d.ts +10 -9
  137. package/src/shade/renderer/fluid/coupling/FLUID_CASCADE_PARENT_STRUCT.d.ts.map +1 -1
  138. package/src/shade/renderer/fluid/coupling/FLUID_CASCADE_PARENT_STRUCT.js +14 -12
  139. package/src/shade/renderer/fluid/coupling/FLUID_CASCADE_RESTRICT_STRUCT.d.ts +3 -2
  140. package/src/shade/renderer/fluid/coupling/FLUID_CASCADE_RESTRICT_STRUCT.d.ts.map +1 -1
  141. package/src/shade/renderer/fluid/coupling/FLUID_CASCADE_RESTRICT_STRUCT.js +7 -5
  142. package/src/shade/renderer/fluid/coupling/chunk_fluid_cascade_epilogue.d.ts +17 -9
  143. package/src/shade/renderer/fluid/coupling/chunk_fluid_cascade_epilogue.d.ts.map +1 -1
  144. package/src/shade/renderer/fluid/coupling/chunk_fluid_cascade_epilogue.js +58 -18
  145. package/src/shade/renderer/fluid/coupling/chunk_fluid_cascade_parent.d.ts +23 -11
  146. package/src/shade/renderer/fluid/coupling/chunk_fluid_cascade_parent.d.ts.map +1 -1
  147. package/src/shade/renderer/fluid/coupling/chunk_fluid_cascade_parent.js +371 -335
  148. package/src/shade/renderer/fluid/coupling/shader_fluid_cascade_fill.d.ts.map +1 -1
  149. package/src/shade/renderer/fluid/coupling/shader_fluid_cascade_fill.js +2 -1
  150. package/src/shade/renderer/fluid/coupling/shader_fluid_cascade_ghosts.d.ts.map +1 -1
  151. package/src/shade/renderer/fluid/coupling/shader_fluid_cascade_ghosts.js +109 -108
  152. package/src/shade/renderer/fluid/coupling/shader_fluid_cascade_restrict.d.ts +5 -3
  153. package/src/shade/renderer/fluid/coupling/shader_fluid_cascade_restrict.d.ts.map +1 -1
  154. package/src/shade/renderer/fluid/coupling/shader_fluid_cascade_restrict.js +24 -12
  155. package/src/shade/renderer/fluid/forcing/GPUFluidForcing.d.ts +7 -7
  156. package/src/shade/renderer/fluid/mac/FLUID_MAC_STEP_STRUCT.d.ts +6 -2
  157. package/src/shade/renderer/fluid/mac/FLUID_MAC_STEP_STRUCT.d.ts.map +1 -1
  158. package/src/shade/renderer/fluid/mac/FLUID_MAC_STEP_STRUCT.js +10 -5
  159. package/src/shade/renderer/fluid/mac/FluidMacPasses.d.ts +20 -21
  160. package/src/shade/renderer/fluid/mac/FluidMacPasses.d.ts.map +1 -1
  161. package/src/shade/renderer/fluid/mac/FluidMacPasses.js +453 -427
  162. package/src/shade/renderer/fluid/mac/shader_fluid_mac_advect_correct.d.ts.map +1 -1
  163. package/src/shade/renderer/fluid/mac/shader_fluid_mac_advect_correct.js +2 -1
  164. package/src/shade/renderer/fluid/pressure/GPUFluidPressureSolve.d.ts +1 -1
  165. package/src/shade/renderer/fluid/publish/FluidWindPublish.d.ts +13 -5
  166. package/src/shade/renderer/fluid/publish/FluidWindPublish.d.ts.map +1 -1
  167. package/src/shade/renderer/fluid/publish/FluidWindPublish.js +20 -10
  168. package/src/shade/renderer/fluid/publish/chunk_fluid_wind_publish_cell.d.ts +2 -2
  169. package/src/shade/renderer/fluid/publish/chunk_fluid_wind_publish_cell.js +2 -2
  170. package/src/shade/renderer/fluid/publish/shader_fluid_wind_publish.d.ts +5 -3
  171. package/src/shade/renderer/fluid/publish/shader_fluid_wind_publish.d.ts.map +1 -1
  172. package/src/shade/renderer/fluid/publish/shader_fluid_wind_publish.js +147 -142
  173. package/src/shade/renderer/fluid/query/GPUFluidQueries.d.ts +1 -1
  174. package/src/shade/renderer/fluid/query/GPUFluidQueries.js +2 -2
  175. package/src/shade/renderer/geometry/GPUGeometryManager.d.ts.map +1 -1
  176. package/src/shade/renderer/geometry/GPUGeometryManager.js +5 -7
  177. package/src/shade/renderer/geometry/MeshletGeometry.d.ts +4 -1
  178. package/src/shade/renderer/geometry/MeshletGeometry.d.ts.map +1 -1
  179. package/src/shade/renderer/geometry/MeshletGeometry.js +4 -1
  180. package/src/shade/renderer/geometry/MeshletGeometrySerializationAdapter.d.ts +20 -0
  181. package/src/shade/renderer/geometry/MeshletGeometrySerializationAdapter.d.ts.map +1 -1
  182. package/src/shade/renderer/geometry/MeshletGeometrySerializationAdapter.js +35 -3
  183. package/src/shade/renderer/geometry/blas_from_meshlets.d.ts +9 -3
  184. package/src/shade/renderer/geometry/blas_from_meshlets.d.ts.map +1 -1
  185. package/src/shade/renderer/geometry/blas_from_meshlets.js +16 -30
  186. package/src/shade/renderer/geometry/bvh/BLAS8_REFIT_TARGET_STRUCT.d.ts +14 -0
  187. package/src/shade/renderer/geometry/bvh/BLAS8_REFIT_TARGET_STRUCT.d.ts.map +1 -0
  188. package/src/shade/renderer/geometry/bvh/BLAS8_REFIT_TARGET_STRUCT.js +33 -0
  189. package/src/shade/renderer/geometry/bvh/GPUBLASRefitBatch.d.ts +18 -21
  190. package/src/shade/renderer/geometry/bvh/GPUBLASRefitBatch.d.ts.map +1 -1
  191. package/src/shade/renderer/geometry/bvh/GPUBLASRefitBatch.js +78 -158
  192. package/src/shade/renderer/geometry/bvh/GPUGeometryBVHManager.d.ts +18 -39
  193. package/src/shade/renderer/geometry/bvh/GPUGeometryBVHManager.d.ts.map +1 -1
  194. package/src/shade/renderer/geometry/bvh/GPUGeometryBVHManager.js +39 -398
  195. package/src/shade/renderer/geometry/bvh/GPUGeometryMeshletsBVH.d.ts +6 -7
  196. package/src/shade/renderer/geometry/bvh/GPUGeometryMeshletsBVH.d.ts.map +1 -1
  197. package/src/shade/renderer/geometry/bvh/GPUGeometryMeshletsBVH.js +5 -7
  198. package/src/shade/renderer/geometry/bvh/bvh8_build_for_meshlets.d.ts +36 -0
  199. package/src/shade/renderer/geometry/bvh/bvh8_build_for_meshlets.d.ts.map +1 -0
  200. package/src/shade/renderer/geometry/bvh/bvh8_build_for_meshlets.js +179 -0
  201. package/src/shade/renderer/geometry/bvh/meshlet_batch_to_clustered_bvh.d.ts +30 -0
  202. package/src/shade/renderer/geometry/bvh/meshlet_batch_to_clustered_bvh.d.ts.map +1 -0
  203. package/src/shade/renderer/geometry/bvh/meshlet_batch_to_clustered_bvh.js +207 -0
  204. package/src/shade/renderer/geometry/bvh/shader_blas8_refit_batch.d.ts +52 -0
  205. package/src/shade/renderer/geometry/bvh/shader_blas8_refit_batch.d.ts.map +1 -0
  206. package/src/shade/renderer/geometry/bvh/shader_blas8_refit_batch.js +464 -0
  207. package/src/shade/renderer/geometry/meshlet/MeshletBatch.d.ts +12 -0
  208. package/src/shade/renderer/geometry/meshlet/MeshletBatch.d.ts.map +1 -1
  209. package/src/shade/renderer/geometry/meshlet/MeshletBatch.js +37 -0
  210. package/src/shade/renderer/geometry/sdf/bake/shader_mesh_sdf_classify.d.ts.map +1 -1
  211. package/src/shade/renderer/geometry/sdf/bake/shader_mesh_sdf_classify.js +4 -4
  212. package/src/shade/renderer/geometry/sdf/bake/shader_mesh_sdf_evaluate.d.ts.map +1 -1
  213. package/src/shade/renderer/geometry/sdf/bake/shader_mesh_sdf_evaluate.js +2 -2
  214. package/src/shade/renderer/geometry/sdf/chunk_blas_query_band_sdf.d.ts.map +1 -1
  215. package/src/shade/renderer/geometry/sdf/chunk_blas_query_band_sdf.js +2 -2
  216. package/src/shade/renderer/geometry/sdf/shader_sdf_visualize.d.ts.map +1 -1
  217. package/src/shade/renderer/geometry/sdf/shader_sdf_visualize.js +4 -4
  218. package/src/shade/renderer/geometry/sdf/surface/shader_mesh_surface_trace.d.ts.map +1 -1
  219. package/src/shade/renderer/geometry/sdf/surface/shader_mesh_surface_trace.js +2 -2
  220. package/src/shade/renderer/geometry/sr_create_group_RTX.d.ts.map +1 -1
  221. package/src/shade/renderer/geometry/sr_create_group_RTX.js +4 -4
  222. package/src/shade/renderer/global_illumination/brick4/gpu/bake/brick4_bake_basic.d.ts.map +1 -1
  223. package/src/shade/renderer/global_illumination/brick4/gpu/bake/brick4_bake_basic.js +1 -0
  224. package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts +1 -1
  225. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/MESH_BRICK.d.ts +9 -10
  226. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/MESH_BRICK.d.ts.map +1 -1
  227. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/MESH_BRICK.js +10 -11
  228. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_walk.d.ts +2 -2
  229. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_walk.js +2 -2
  230. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_gather.d.ts +12 -8
  231. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_gather.d.ts.map +1 -1
  232. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_gather.js +109 -60
  233. package/src/shade/renderer/global_illumination/probe_clipmap/debug/graph_probe_clipmap_debug_mesh_sdf.js +2 -2
  234. package/src/shade/renderer/global_illumination/probe_clipmap/debug/graph_probe_clipmap_debug_mesh_surfaces.js +2 -2
  235. package/src/shade/renderer/gpu_primitive/bvh/BVH_BUFFER_LAYOUT.d.ts +2 -2
  236. package/src/shade/renderer/gpu_primitive/bvh/BVH_BUFFER_LAYOUT.js +70 -70
  237. package/src/shade/renderer/gpu_primitive/bvh/BVH_BUILD_SETTINGS_STRUCT.d.ts +6 -7
  238. package/src/shade/renderer/gpu_primitive/bvh/BVH_BUILD_SETTINGS_STRUCT.d.ts.map +1 -1
  239. package/src/shade/renderer/gpu_primitive/bvh/BVH_BUILD_SETTINGS_STRUCT.js +6 -7
  240. package/src/shade/renderer/gpu_primitive/bvh/graph_bvh_build_lbvh.d.ts +3 -3
  241. package/src/shade/renderer/gpu_primitive/bvh/graph_bvh_build_lbvh.js +3 -3
  242. package/src/shade/renderer/gpu_primitive/bvh/shader_bvh_build_single_workgroup.js +1 -1
  243. package/src/shade/renderer/gpu_primitive/bvh/shader_bvh_emit_hierarchy.d.ts +2 -2
  244. package/src/shade/renderer/gpu_primitive/bvh/shader_bvh_emit_hierarchy.js +3 -3
  245. package/src/shade/renderer/gpu_primitive/bvh8/BVH8_TREE_BUFFER_LAYOUT.d.ts +69 -0
  246. package/src/shade/renderer/gpu_primitive/bvh8/BVH8_TREE_BUFFER_LAYOUT.d.ts.map +1 -0
  247. package/src/shade/renderer/gpu_primitive/bvh8/BVH8_TREE_BUFFER_LAYOUT.js +89 -0
  248. package/src/shade/renderer/gpu_primitive/bvh8/bvh8_encode_from_bvh2.d.ts +41 -0
  249. package/src/shade/renderer/gpu_primitive/bvh8/bvh8_encode_from_bvh2.d.ts.map +1 -0
  250. package/src/shade/renderer/gpu_primitive/bvh8/bvh8_encode_from_bvh2.js +348 -0
  251. package/src/shade/renderer/gpu_primitive/bvh8/check_bvh8_tree.d.ts +34 -0
  252. package/src/shade/renderer/gpu_primitive/bvh8/check_bvh8_tree.d.ts.map +1 -0
  253. package/src/shade/renderer/gpu_primitive/bvh8/check_bvh8_tree.js +291 -0
  254. package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_assign.d.ts +31 -0
  255. package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_assign.d.ts.map +1 -0
  256. package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_assign.js +175 -0
  257. package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_depth.d.ts +27 -0
  258. package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_depth.d.ts.map +1 -0
  259. package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_depth.js +48 -0
  260. package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_gather.d.ts +26 -0
  261. package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_gather.d.ts.map +1 -0
  262. package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_gather.js +118 -0
  263. package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_node.d.ts +22 -0
  264. package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_node.d.ts.map +1 -0
  265. package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_node.js +143 -0
  266. package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_sums.d.ts +36 -0
  267. package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_sums.d.ts.map +1 -0
  268. package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_sums.js +97 -0
  269. package/src/shade/renderer/gpu_primitive/bvh8/graph_bvh8_encode_from_bvh2.d.ts +49 -0
  270. package/src/shade/renderer/gpu_primitive/bvh8/graph_bvh8_encode_from_bvh2.d.ts.map +1 -0
  271. package/src/shade/renderer/gpu_primitive/bvh8/graph_bvh8_encode_from_bvh2.js +265 -0
  272. package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_assign.d.ts +37 -0
  273. package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_assign.d.ts.map +1 -0
  274. package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_assign.js +109 -0
  275. package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_count.d.ts +15 -0
  276. package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_count.d.ts.map +1 -0
  277. package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_count.js +85 -0
  278. package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_count_single_workgroup.d.ts +26 -0
  279. package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_count_single_workgroup.d.ts.map +1 -0
  280. package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_count_single_workgroup.js +200 -0
  281. package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_parents.d.ts +19 -0
  282. package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_parents.d.ts.map +1 -0
  283. package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_parents.js +81 -0
  284. package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_write.d.ts +14 -0
  285. package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_write.d.ts.map +1 -0
  286. package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_write.js +101 -0
  287. package/src/shade/renderer/gpu_primitive/bvh8/verify_gpu_bvh8_encode.d.ts +19 -0
  288. package/src/shade/renderer/gpu_primitive/bvh8/verify_gpu_bvh8_encode.d.ts.map +1 -0
  289. package/src/shade/renderer/gpu_primitive/bvh8/verify_gpu_bvh8_encode.js +361 -0
  290. package/src/shade/renderer/grass/surface/shader_grass_surface_bake.d.ts.map +1 -1
  291. package/src/shade/renderer/grass/surface/shader_grass_surface_bake.js +5 -6
  292. package/src/shade/renderer/light/GPULightCollection.d.ts +3 -2
  293. package/src/shade/renderer/light/GPULightCollection.d.ts.map +1 -1
  294. package/src/shade/renderer/light/GPULightCollection.js +28 -2
  295. package/src/shade/renderer/light/environment/shader_project_environment_sh.d.ts +2 -2
  296. package/src/shade/renderer/light/environment/shader_project_environment_sh.js +2 -2
  297. package/src/shade/renderer/light/make_sunlight.d.ts +14 -0
  298. package/src/shade/renderer/light/make_sunlight.d.ts.map +1 -1
  299. package/src/shade/renderer/light/make_sunlight.js +16 -2
  300. package/src/shade/renderer/light/model/DirectionalLight.d.ts +9 -0
  301. package/src/shade/renderer/light/model/DirectionalLight.d.ts.map +1 -1
  302. package/src/shade/renderer/light/model/DirectionalLight.js +10 -1
  303. package/src/shade/renderer/light/model/Light.d.ts +4 -2
  304. package/src/shade/renderer/light/model/Light.d.ts.map +1 -1
  305. package/src/shade/renderer/light/model/Light.js +4 -2
  306. package/src/shade/renderer/light/model/io/light_record_directional.d.ts.map +1 -1
  307. package/src/shade/renderer/light/model/io/light_record_directional.js +3 -0
  308. package/src/shade/renderer/light/shader_refresh_light_poses.d.ts +16 -1
  309. package/src/shade/renderer/light/shader_refresh_light_poses.d.ts.map +1 -1
  310. package/src/shade/renderer/light/shader_refresh_light_poses.js +211 -154
  311. package/src/shade/renderer/lightmap/GPULightMap.d.ts.map +1 -1
  312. package/src/shade/renderer/lightmap/GPULightMap.js +1 -0
  313. package/src/shade/renderer/loader/gltf/tiny-gltf.d.ts +1 -1
  314. package/src/shade/renderer/path_tracer/accumulating/AccumulatingPathTracer.d.ts.map +1 -1
  315. package/src/shade/renderer/path_tracer/accumulating/AccumulatingPathTracer.js +1 -0
  316. package/src/shade/renderer/path_tracer/graph_path_trace_scene.d.ts.map +1 -1
  317. package/src/shade/renderer/path_tracer/graph_path_trace_scene.js +1 -0
  318. package/src/shade/renderer/postprocess/nss/NSS.d.ts +1 -1
  319. package/src/shade/renderer/postprocess/ssr/SSR.d.ts +2 -5
  320. package/src/shade/renderer/postprocess/ssr/SSR.d.ts.map +1 -1
  321. package/src/shade/renderer/postprocess/ssr/SSR.js +1 -13
  322. package/src/shade/renderer/postprocess/ssr/resolve/chunk_ssr_add_hit_irradiance.d.ts +2 -9
  323. package/src/shade/renderer/postprocess/ssr/resolve/chunk_ssr_add_hit_irradiance.d.ts.map +1 -1
  324. package/src/shade/renderer/postprocess/ssr/resolve/chunk_ssr_add_hit_irradiance.js +2 -38
  325. package/src/shade/renderer/postprocess/ssr/resolve/chunk_ssr_sample_radiance.d.ts +0 -5
  326. package/src/shade/renderer/postprocess/ssr/resolve/chunk_ssr_sample_radiance.d.ts.map +1 -1
  327. package/src/shade/renderer/postprocess/ssr/resolve/chunk_ssr_sample_radiance.js +0 -16
  328. package/src/shade/renderer/postprocess/ssr/resolve/ssr_resolve_shader.d.ts.map +1 -1
  329. package/src/shade/renderer/postprocess/ssr/resolve/ssr_resolve_shader.js +3 -10
  330. package/src/shade/renderer/rasterize/forward/chunk_forward_sample_indirect.d.ts +0 -2
  331. package/src/shade/renderer/rasterize/forward/chunk_forward_sample_indirect.d.ts.map +1 -1
  332. package/src/shade/renderer/rasterize/forward/chunk_forward_sample_indirect.js +0 -3
  333. package/src/shade/renderer/scene/GPUInstancesAccelerationStructure.d.ts +8 -4
  334. package/src/shade/renderer/scene/GPUInstancesAccelerationStructure.d.ts.map +1 -1
  335. package/src/shade/renderer/scene/GPUInstancesAccelerationStructure.js +60 -33
  336. package/src/shade/renderer/scene/GPUSceneContext.d.ts +0 -6
  337. package/src/shade/renderer/scene/GPUSceneContext.d.ts.map +1 -1
  338. package/src/shade/renderer/scene/GPUSceneContext.js +0 -19
  339. package/src/shade/renderer/scene/Scene.d.ts +1 -7
  340. package/src/shade/renderer/scene/Scene.d.ts.map +1 -1
  341. package/src/shade/renderer/scene/Scene.js +1 -8
  342. package/src/shade/renderer/scene/bvh/sdf_build_from_scene.d.ts.map +1 -0
  343. package/src/shade/renderer/{global_illumination/lpv/placement/software → scene/bvh}/sdf_build_from_scene.js +6 -6
  344. package/src/shade/renderer/scene/bvh/sdf_find_local_maxima.d.ts.map +1 -0
  345. package/src/shade/renderer/{global_illumination/lpv/placement/software → scene/bvh}/sdf_find_local_maxima.js +1 -1
  346. package/src/shade/renderer/scene/verify_gpu_tlas_build.d.ts +6 -6
  347. package/src/shade/renderer/scene/verify_gpu_tlas_build.d.ts.map +1 -1
  348. package/src/shade/renderer/scene/verify_gpu_tlas_build.js +23 -53
  349. package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/BVH8_INODE_STRUCT.d.ts +3 -1
  350. package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/BVH8_INODE_STRUCT.d.ts.map +1 -1
  351. package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/BVH8_INODE_STRUCT.js +5 -3
  352. package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/BVH8_MAX_DEPTH.d.ts +28 -0
  353. package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/BVH8_MAX_DEPTH.d.ts.map +1 -0
  354. package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/BVH8_MAX_DEPTH.js +29 -0
  355. package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_node_grid.d.ts +25 -0
  356. package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_node_grid.d.ts.map +1 -0
  357. package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_node_grid.js +97 -0
  358. package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_node_intersect.d.ts +8 -0
  359. package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_node_intersect.d.ts.map +1 -1
  360. package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_node_intersect.js +23 -14
  361. package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_node_slot_distances.d.ts +36 -0
  362. package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_node_slot_distances.d.ts.map +1 -0
  363. package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_node_slot_distances.js +222 -0
  364. package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_ray_direction_rcp.d.ts +20 -0
  365. package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_ray_direction_rcp.d.ts.map +1 -0
  366. package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_ray_direction_rcp.js +30 -0
  367. package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_tree_read.d.ts +30 -0
  368. package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_tree_read.d.ts.map +1 -0
  369. package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_tree_read.js +91 -0
  370. package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_waiting_slots.d.ts +23 -0
  371. package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_waiting_slots.d.ts.map +1 -0
  372. package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_waiting_slots.js +40 -0
  373. package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_blas_nearest.d.ts +22 -0
  374. package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_blas_nearest.d.ts.map +1 -1
  375. package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_blas_nearest.js +121 -70
  376. package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_blas_occluded.d.ts +13 -1
  377. package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_blas_occluded.d.ts.map +1 -1
  378. package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_blas_occluded.js +117 -61
  379. package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_nearest.d.ts +21 -0
  380. package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_nearest.d.ts.map +1 -1
  381. package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_nearest.js +111 -72
  382. package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_nearest_among.d.ts +1 -2
  383. package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_nearest_among.d.ts.map +1 -1
  384. package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_nearest_among.js +83 -54
  385. package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_occluded.d.ts +14 -0
  386. package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_occluded.d.ts.map +1 -1
  387. package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_occluded.js +92 -60
  388. package/src/shade/renderer/shader/chunk/light/DIRECTIONAL_LIGHT_STRUCT.d.ts.map +1 -1
  389. package/src/shade/renderer/shader/chunk/light/DIRECTIONAL_LIGHT_STRUCT.js +12 -2
  390. package/src/shade/renderer/shader/chunk/light/io/chunk_point_lights_iterate.d.ts +1 -1
  391. package/src/shade/renderer/shader/chunk/light/io/chunk_point_lights_iterate.js +1 -1
  392. package/src/shade/renderer/{global_illumination/probe/octahedral/sample → shader/chunk/light/probe}/chunk_parallax_correct_spherical_probe.d.ts +1 -1
  393. package/src/shade/renderer/shader/chunk/light/probe/chunk_parallax_correct_spherical_probe.d.ts.map +1 -0
  394. package/src/shade/renderer/{global_illumination/probe/octahedral/sample → shader/chunk/light/probe}/chunk_parallax_correct_spherical_probe.js +2 -2
  395. package/src/shade/renderer/shader/chunk/light/probe/chunk_probe_visibility_weight.d.ts +1 -1
  396. package/src/shade/renderer/shader/chunk/light/probe/chunk_probe_visibility_weight.js +1 -1
  397. package/src/shade/renderer/shader/chunk/sdf/chunk_point_query_blas_nearest.d.ts +22 -0
  398. package/src/shade/renderer/shader/chunk/sdf/chunk_point_query_blas_nearest.d.ts.map +1 -1
  399. package/src/shade/renderer/shader/chunk/sdf/chunk_point_query_blas_nearest.js +153 -106
  400. package/src/shade/renderer/shader/chunk/sdf/chunk_scene_point_query_nearest.d.ts +21 -0
  401. package/src/shade/renderer/shader/chunk/sdf/chunk_scene_point_query_nearest.d.ts.map +1 -1
  402. package/src/shade/renderer/shader/chunk/sdf/chunk_scene_point_query_nearest.js +115 -74
  403. package/src/shade/renderer/shader/chunk/sdf/chunk_scene_sdf_raymarch.d.ts +5 -2
  404. package/src/shade/renderer/shader/chunk/sdf/chunk_scene_sdf_raymarch.d.ts.map +1 -1
  405. package/src/shade/renderer/shader/chunk/sdf/chunk_scene_sdf_raymarch.js +89 -63
  406. package/src/shade/renderer/shader/chunk/sdf/chunk_sdf_query_distance.d.ts +15 -0
  407. package/src/shade/renderer/shader/chunk/sdf/chunk_sdf_query_distance.d.ts.map +1 -1
  408. package/src/shade/renderer/shader/chunk/sdf/chunk_sdf_query_distance.js +108 -63
  409. package/src/shade/renderer/shader/chunk/spherical_harmonics/dering/chunk_sh2_dering_optimize_positive.d.ts +1 -2
  410. package/src/shade/renderer/shader/chunk/spherical_harmonics/dering/chunk_sh2_dering_optimize_positive.d.ts.map +1 -1
  411. package/src/shade/renderer/shader/chunk/spherical_harmonics/dering/chunk_sh2_dering_optimize_positive.js +1 -2
  412. package/src/shade/renderer/shadow/sdf/chunk_ray_query_sdf_raycast.d.ts +14 -0
  413. package/src/shade/renderer/shadow/sdf/chunk_ray_query_sdf_raycast.d.ts.map +1 -1
  414. package/src/shade/renderer/shadow/sdf/chunk_ray_query_sdf_raycast.js +94 -60
  415. package/src/shade/renderer/shadow/sdf/graph_draw_sdf_shadows.d.ts.map +1 -1
  416. package/src/shade/renderer/shadow/sdf/graph_draw_sdf_shadows.js +4 -4
  417. package/src/shade/renderer/trails/GPUTrailSystem.d.ts +4 -0
  418. package/src/shade/renderer/trails/GPUTrailSystem.d.ts.map +1 -1
  419. package/src/shade/renderer/trails/GPUTrailSystem.js +9 -3
  420. package/src/shade/renderer/volumetrics/GPUViewVolumetrics.d.ts +1 -3
  421. package/src/shade/renderer/volumetrics/GPUViewVolumetrics.d.ts.map +1 -1
  422. package/src/shade/renderer/volumetrics/GPUViewVolumetrics.js +0 -3
  423. package/src/shade/renderer/volumetrics/chunk_volumetrics_irradiance_sh.d.ts +2 -2
  424. package/src/shade/renderer/volumetrics/chunk_volumetrics_irradiance_sh.js +2 -2
  425. package/src/shade/renderer/volumetrics/graph_build_volumetrics.js +2 -2
  426. package/src/shade/renderer/volumetrics/irradiance_clipmap/GPUIrradianceClipmap.d.ts +1 -3
  427. package/src/shade/renderer/volumetrics/irradiance_clipmap/GPUIrradianceClipmap.d.ts.map +1 -1
  428. package/src/shade/renderer/volumetrics/irradiance_clipmap/GPUIrradianceClipmap.js +0 -9
  429. package/src/shade/renderer/volumetrics/irradiance_clipmap/chunk_irradiance_clipmap_gi_sample.d.ts +0 -5
  430. package/src/shade/renderer/volumetrics/irradiance_clipmap/chunk_irradiance_clipmap_gi_sample.d.ts.map +1 -1
  431. package/src/shade/renderer/volumetrics/irradiance_clipmap/chunk_irradiance_clipmap_gi_sample.js +0 -29
  432. package/src/shade/renderer/volumetrics/irradiance_clipmap/shader_irradiance_clipmap_build.d.ts.map +1 -1
  433. package/src/shade/renderer/volumetrics/irradiance_clipmap/shader_irradiance_clipmap_build.js +0 -2
  434. package/src/shade/renderer/volumetrics/shader_volumetrics_build_lighting.d.ts.map +1 -1
  435. package/src/shade/renderer/volumetrics/shader_volumetrics_build_lighting.js +11 -6
  436. package/src/shade/renderer/volumetrics/shader_volumetrics_build_scattering_lut.d.ts.map +1 -1
  437. package/src/shade/renderer/volumetrics/shader_volumetrics_build_scattering_lut.js +10 -4
  438. package/src/shade/renderer/water/chunk_water_gi.d.ts +1 -1
  439. package/src/shade/renderer/water/chunk_water_gi.d.ts.map +1 -1
  440. package/src/shade/renderer/water/chunk_water_gi.js +1 -3
  441. package/src/shade/renderer/water/query/GPUWaterQueries.d.ts +1 -1
  442. package/src/shade/renderer/water/query/shader_water_surface_query.d.ts.map +1 -1
  443. package/src/shade/renderer/water/query/shader_water_surface_query.js +227 -227
  444. package/src/shade/renderer/water/surface/particles/chunk_water_particle_step.d.ts.map +1 -1
  445. package/src/shade/renderer/water/surface/particles/chunk_water_particle_step.js +7 -4
  446. package/src/shade/renderer/water/surface/particles/shader_water_particles.js +2 -2
  447. package/src/shade/renderer/wind/GPUSceneWind.d.ts +37 -5
  448. package/src/shade/renderer/wind/GPUSceneWind.d.ts.map +1 -1
  449. package/src/shade/renderer/wind/GPUSceneWind.js +150 -4
  450. package/src/shade/renderer/wind/WIND_FIELD_STRUCT.d.ts +9 -3
  451. package/src/shade/renderer/wind/WIND_FIELD_STRUCT.d.ts.map +1 -1
  452. package/src/shade/renderer/wind/WIND_FIELD_STRUCT.js +13 -3
  453. package/src/shade/renderer/wind/WIND_FIELD_UNIFORM.d.ts +6 -6
  454. package/src/shade/renderer/wind/WIND_FIELD_UNIFORM.js +6 -6
  455. package/src/shade/renderer/wind/chunk_fluid_turbulence.d.ts +39 -0
  456. package/src/shade/renderer/wind/chunk_fluid_turbulence.d.ts.map +1 -0
  457. package/src/shade/renderer/wind/chunk_fluid_turbulence.js +63 -0
  458. package/src/shade/renderer/wind/chunk_wind_field_sample_cascades.d.ts +10 -7
  459. package/src/shade/renderer/wind/chunk_wind_field_sample_cascades.d.ts.map +1 -1
  460. package/src/shade/renderer/wind/chunk_wind_field_sample_cascades.js +34 -11
  461. package/src/shade/renderer/wind/chunk_wind_field_sample_uniform.d.ts +2 -2
  462. package/src/shade/renderer/wind/chunk_wind_field_sample_uniform.js +2 -2
  463. package/src/shade/renderer/wind/wind_field_add_resources.d.ts +6 -4
  464. package/src/shade/renderer/wind/wind_field_add_resources.d.ts.map +1 -1
  465. package/src/shade/renderer/wind/wind_field_add_resources.js +9 -6
  466. package/src/shade/renderer/deferred/indirect/chunk_gi_sample_lpv_cache.d.ts +0 -3
  467. package/src/shade/renderer/deferred/indirect/chunk_gi_sample_lpv_cache.d.ts.map +0 -1
  468. package/src/shade/renderer/deferred/indirect/chunk_gi_sample_lpv_cache.js +0 -41
  469. package/src/shade/renderer/deferred/indirect/chunk_lpv_2d_cache_sample_irradiance.d.ts +0 -6
  470. package/src/shade/renderer/deferred/indirect/chunk_lpv_2d_cache_sample_irradiance.d.ts.map +0 -1
  471. package/src/shade/renderer/deferred/indirect/chunk_lpv_2d_cache_sample_irradiance.js +0 -108
  472. package/src/shade/renderer/deferred/indirect/chunk_lpv_sample_light.d.ts +0 -6
  473. package/src/shade/renderer/deferred/indirect/chunk_lpv_sample_light.d.ts.map +0 -1
  474. package/src/shade/renderer/deferred/indirect/chunk_lpv_sample_light.js +0 -100
  475. package/src/shade/renderer/geometry/bvh/BLAS_REFIT_TARGET_STRUCT.d.ts +0 -18
  476. package/src/shade/renderer/geometry/bvh/BLAS_REFIT_TARGET_STRUCT.d.ts.map +0 -1
  477. package/src/shade/renderer/geometry/bvh/BLAS_REFIT_TARGET_STRUCT.js +0 -50
  478. package/src/shade/renderer/geometry/bvh/bvh2_derive_topology.d.ts +0 -23
  479. package/src/shade/renderer/geometry/bvh/bvh2_derive_topology.d.ts.map +0 -1
  480. package/src/shade/renderer/geometry/bvh/bvh2_derive_topology.js +0 -87
  481. package/src/shade/renderer/geometry/bvh/shader_blas_refit_batch.d.ts +0 -42
  482. package/src/shade/renderer/geometry/bvh/shader_blas_refit_batch.d.ts.map +0 -1
  483. package/src/shade/renderer/geometry/bvh/shader_blas_refit_batch.js +0 -141
  484. package/src/shade/renderer/geometry/bvh/shader_blas_refit_batch_seed.d.ts +0 -21
  485. package/src/shade/renderer/geometry/bvh/shader_blas_refit_batch_seed.d.ts.map +0 -1
  486. package/src/shade/renderer/geometry/bvh/shader_blas_refit_batch_seed.js +0 -75
  487. package/src/shade/renderer/geometry/meshlet_batch_to_bvh.d.ts +0 -17
  488. package/src/shade/renderer/geometry/meshlet_batch_to_bvh.d.ts.map +0 -1
  489. package/src/shade/renderer/geometry/meshlet_batch_to_bvh.js +0 -247
  490. package/src/shade/renderer/global_illumination/lpv/GPULightProbeVolume.d.ts +0 -51
  491. package/src/shade/renderer/global_illumination/lpv/GPULightProbeVolume.d.ts.map +0 -1
  492. package/src/shade/renderer/global_illumination/lpv/GPULightProbeVolume.js +0 -384
  493. package/src/shade/renderer/global_illumination/lpv/LIGHT_PROBE_STRUCT.d.ts +0 -3
  494. package/src/shade/renderer/global_illumination/lpv/LIGHT_PROBE_STRUCT.d.ts.map +0 -1
  495. package/src/shade/renderer/global_illumination/lpv/LIGHT_PROBE_STRUCT.js +0 -20
  496. package/src/shade/renderer/global_illumination/lpv/LIGHT_PROBE_VOLUME_METADATA_STRUCT.d.ts +0 -3
  497. package/src/shade/renderer/global_illumination/lpv/LIGHT_PROBE_VOLUME_METADATA_STRUCT.d.ts.map +0 -1
  498. package/src/shade/renderer/global_illumination/lpv/LIGHT_PROBE_VOLUME_METADATA_STRUCT.js +0 -10
  499. package/src/shade/renderer/global_illumination/lpv/LightProbeVolume.d.ts +0 -63
  500. package/src/shade/renderer/global_illumination/lpv/LightProbeVolume.d.ts.map +0 -1
  501. package/src/shade/renderer/global_illumination/lpv/LightProbeVolume.js +0 -177
  502. package/src/shade/renderer/global_illumination/lpv/TETRAHEDRAL_MESH_CELL_STRUCT.d.ts +0 -3
  503. package/src/shade/renderer/global_illumination/lpv/TETRAHEDRAL_MESH_CELL_STRUCT.d.ts.map +0 -1
  504. package/src/shade/renderer/global_illumination/lpv/TETRAHEDRAL_MESH_CELL_STRUCT.js +0 -7
  505. package/src/shade/renderer/global_illumination/lpv/bake/GPULightProbeVolumeRenderer.d.ts +0 -68
  506. package/src/shade/renderer/global_illumination/lpv/bake/GPULightProbeVolumeRenderer.d.ts.map +0 -1
  507. package/src/shade/renderer/global_illumination/lpv/bake/GPULightProbeVolumeRenderer.js +0 -409
  508. package/src/shade/renderer/global_illumination/lpv/bake/PROBE_RAYS_PER_WORKGROUP.d.ts +0 -2
  509. package/src/shade/renderer/global_illumination/lpv/bake/PROBE_RAYS_PER_WORKGROUP.d.ts.map +0 -1
  510. package/src/shade/renderer/global_illumination/lpv/bake/PROBE_RAYS_PER_WORKGROUP.js +0 -1
  511. package/src/shade/renderer/global_illumination/lpv/debug/shader_visualize_probe_depth.d.ts +0 -3
  512. package/src/shade/renderer/global_illumination/lpv/debug/shader_visualize_probe_depth.d.ts.map +0 -1
  513. package/src/shade/renderer/global_illumination/lpv/debug/shader_visualize_probe_depth.js +0 -38
  514. package/src/shade/renderer/global_illumination/lpv/deprecated/LIGHT_PROBE_DEPTH_RESOLUTION.d.ts +0 -8
  515. package/src/shade/renderer/global_illumination/lpv/deprecated/LIGHT_PROBE_DEPTH_RESOLUTION.d.ts.map +0 -1
  516. package/src/shade/renderer/global_illumination/lpv/deprecated/LIGHT_PROBE_DEPTH_RESOLUTION.js +0 -7
  517. package/src/shade/renderer/global_illumination/lpv/deprecated/LIGHT_PROBE_DEPTH_STRUCT.d.ts +0 -3
  518. package/src/shade/renderer/global_illumination/lpv/deprecated/LIGHT_PROBE_DEPTH_STRUCT.d.ts.map +0 -1
  519. package/src/shade/renderer/global_illumination/lpv/deprecated/LIGHT_PROBE_DEPTH_STRUCT.js +0 -8
  520. package/src/shade/renderer/global_illumination/lpv/deprecated/chunk_lpv_get_visibility_mask.d.ts +0 -3
  521. package/src/shade/renderer/global_illumination/lpv/deprecated/chunk_lpv_get_visibility_mask.d.ts.map +0 -1
  522. package/src/shade/renderer/global_illumination/lpv/deprecated/chunk_lpv_get_visibility_mask.js +0 -48
  523. package/src/shade/renderer/global_illumination/lpv/deprecated/chunk_lpv_probe_depth_coordinate_to_address.d.ts +0 -3
  524. package/src/shade/renderer/global_illumination/lpv/deprecated/chunk_lpv_probe_depth_coordinate_to_address.d.ts.map +0 -1
  525. package/src/shade/renderer/global_illumination/lpv/deprecated/chunk_lpv_probe_depth_coordinate_to_address.js +0 -11
  526. package/src/shade/renderer/global_illumination/lpv/deprecated/chunk_lpv_probe_depth_get_pixel.d.ts +0 -3
  527. package/src/shade/renderer/global_illumination/lpv/deprecated/chunk_lpv_probe_depth_get_pixel.d.ts.map +0 -1
  528. package/src/shade/renderer/global_illumination/lpv/deprecated/chunk_lpv_probe_depth_get_pixel.js +0 -20
  529. package/src/shade/renderer/global_illumination/lpv/deprecated/probe_trace_compute_shader_code.d.ts +0 -5
  530. package/src/shade/renderer/global_illumination/lpv/deprecated/probe_trace_compute_shader_code.d.ts.map +0 -1
  531. package/src/shade/renderer/global_illumination/lpv/deprecated/probe_trace_compute_shader_code.js +0 -206
  532. package/src/shade/renderer/global_illumination/lpv/edit/AddProbeAction.d.ts +0 -14
  533. package/src/shade/renderer/global_illumination/lpv/edit/AddProbeAction.d.ts.map +0 -1
  534. package/src/shade/renderer/global_illumination/lpv/edit/AddProbeAction.js +0 -39
  535. package/src/shade/renderer/global_illumination/lpv/graph_bake_irradiance_lookup_2d.d.ts +0 -16
  536. package/src/shade/renderer/global_illumination/lpv/graph_bake_irradiance_lookup_2d.d.ts.map +0 -1
  537. package/src/shade/renderer/global_illumination/lpv/graph_bake_irradiance_lookup_2d.js +0 -201
  538. package/src/shade/renderer/global_illumination/lpv/lpv_jitter_points.d.ts +0 -10
  539. package/src/shade/renderer/global_illumination/lpv/lpv_jitter_points.d.ts.map +0 -1
  540. package/src/shade/renderer/global_illumination/lpv/lpv_jitter_points.js +0 -27
  541. package/src/shade/renderer/global_illumination/lpv/lpv_visualise_probes.d.ts +0 -18
  542. package/src/shade/renderer/global_illumination/lpv/lpv_visualise_probes.d.ts.map +0 -1
  543. package/src/shade/renderer/global_illumination/lpv/lpv_visualise_probes.js +0 -265
  544. package/src/shade/renderer/global_illumination/lpv/placement/chunk_refine_probe_placement.d.ts +0 -7
  545. package/src/shade/renderer/global_illumination/lpv/placement/chunk_refine_probe_placement.d.ts.map +0 -1
  546. package/src/shade/renderer/global_illumination/lpv/placement/chunk_refine_probe_placement.js +0 -126
  547. package/src/shade/renderer/global_illumination/lpv/placement/graph_generate_probe_locations.d.ts +0 -13
  548. package/src/shade/renderer/global_illumination/lpv/placement/graph_generate_probe_locations.d.ts.map +0 -1
  549. package/src/shade/renderer/global_illumination/lpv/placement/graph_generate_probe_locations.js +0 -377
  550. package/src/shade/renderer/global_illumination/lpv/placement/software/lpv_generate_probe_locations2.d.ts +0 -14
  551. package/src/shade/renderer/global_illumination/lpv/placement/software/lpv_generate_probe_locations2.d.ts.map +0 -1
  552. package/src/shade/renderer/global_illumination/lpv/placement/software/lpv_generate_probe_locations2.js +0 -225
  553. package/src/shade/renderer/global_illumination/lpv/placement/software/sdf_build_from_scene.d.ts.map +0 -1
  554. package/src/shade/renderer/global_illumination/lpv/placement/software/sdf_find_local_maxima.d.ts.map +0 -1
  555. package/src/shade/renderer/global_illumination/lpv/shader_diffuse_LPV.d.ts +0 -3
  556. package/src/shade/renderer/global_illumination/lpv/shader_diffuse_LPV.d.ts.map +0 -1
  557. package/src/shade/renderer/global_illumination/lpv/shader_diffuse_LPV.js +0 -91
  558. package/src/shade/renderer/global_illumination/probe/chunk_compute_probe_dering.d.ts +0 -5
  559. package/src/shade/renderer/global_illumination/probe/chunk_compute_probe_dering.d.ts.map +0 -1
  560. package/src/shade/renderer/global_illumination/probe/chunk_compute_probe_dering.js +0 -45
  561. package/src/shade/renderer/global_illumination/probe/compute_pipeline_probe_dering.d.ts +0 -3
  562. package/src/shade/renderer/global_illumination/probe/compute_pipeline_probe_dering.d.ts.map +0 -1
  563. package/src/shade/renderer/global_illumination/probe/compute_pipeline_probe_dering.js +0 -17
  564. package/src/shade/renderer/global_illumination/probe/lpv_dering_software.d.ts +0 -6
  565. package/src/shade/renderer/global_illumination/probe/lpv_dering_software.d.ts.map +0 -1
  566. package/src/shade/renderer/global_illumination/probe/lpv_dering_software.js +0 -21
  567. package/src/shade/renderer/global_illumination/probe/octahedral/GPUProbeAtlas.d.ts +0 -79
  568. package/src/shade/renderer/global_illumination/probe/octahedral/GPUProbeAtlas.d.ts.map +0 -1
  569. package/src/shade/renderer/global_illumination/probe/octahedral/GPUProbeAtlas.js +0 -437
  570. package/src/shade/renderer/global_illumination/probe/octahedral/LPV_ACCUMULATION_PUSH_CONSTANTS.d.ts +0 -3
  571. package/src/shade/renderer/global_illumination/probe/octahedral/LPV_ACCUMULATION_PUSH_CONSTANTS.d.ts.map +0 -1
  572. package/src/shade/renderer/global_illumination/probe/octahedral/LPV_ACCUMULATION_PUSH_CONSTANTS.js +0 -14
  573. package/src/shade/renderer/global_illumination/probe/octahedral/LPV_SHADER_RESOURCE_GROUP.d.ts +0 -42
  574. package/src/shade/renderer/global_illumination/probe/octahedral/LPV_SHADER_RESOURCE_GROUP.d.ts.map +0 -1
  575. package/src/shade/renderer/global_illumination/probe/octahedral/LPV_SHADER_RESOURCE_GROUP.js +0 -68
  576. package/src/shade/renderer/global_illumination/probe/octahedral/ProbeGBufferTypes.d.ts +0 -9
  577. package/src/shade/renderer/global_illumination/probe/octahedral/ProbeGBufferTypes.d.ts.map +0 -1
  578. package/src/shade/renderer/global_illumination/probe/octahedral/ProbeGBufferTypes.js +0 -20
  579. package/src/shade/renderer/global_illumination/probe/octahedral/border/chunk_lpv_map_index_to_border.d.ts +0 -3
  580. package/src/shade/renderer/global_illumination/probe/octahedral/border/chunk_lpv_map_index_to_border.d.ts.map +0 -1
  581. package/src/shade/renderer/global_illumination/probe/octahedral/border/chunk_lpv_map_index_to_border.js +0 -47
  582. package/src/shade/renderer/global_illumination/probe/octahedral/border/chunk_lpv_paint_borders_body.d.ts +0 -3
  583. package/src/shade/renderer/global_illumination/probe/octahedral/border/chunk_lpv_paint_borders_body.d.ts.map +0 -1
  584. package/src/shade/renderer/global_illumination/probe/octahedral/border/chunk_lpv_paint_borders_body.js +0 -55
  585. package/src/shade/renderer/global_illumination/probe/octahedral/border/graph_lpv_paint_border_depth.d.ts +0 -19
  586. package/src/shade/renderer/global_illumination/probe/octahedral/border/graph_lpv_paint_border_depth.d.ts.map +0 -1
  587. package/src/shade/renderer/global_illumination/probe/octahedral/border/graph_lpv_paint_border_depth.js +0 -85
  588. package/src/shade/renderer/global_illumination/probe/octahedral/border/shader_lpv_atlas_border_read.d.ts +0 -3
  589. package/src/shade/renderer/global_illumination/probe/octahedral/border/shader_lpv_atlas_border_read.d.ts.map +0 -1
  590. package/src/shade/renderer/global_illumination/probe/octahedral/border/shader_lpv_atlas_border_read.js +0 -78
  591. package/src/shade/renderer/global_illumination/probe/octahedral/border/shader_lpv_atlas_paint_borders_depth.d.ts +0 -7
  592. package/src/shade/renderer/global_illumination/probe/octahedral/border/shader_lpv_atlas_paint_borders_depth.d.ts.map +0 -1
  593. package/src/shade/renderer/global_illumination/probe/octahedral/border/shader_lpv_atlas_paint_borders_depth.js +0 -70
  594. package/src/shade/renderer/global_illumination/probe/octahedral/border/shader_lpv_atlas_paint_borders_radiance.d.ts +0 -7
  595. package/src/shade/renderer/global_illumination/probe/octahedral/border/shader_lpv_atlas_paint_borders_radiance.d.ts.map +0 -1
  596. package/src/shade/renderer/global_illumination/probe/octahedral/border/shader_lpv_atlas_paint_borders_radiance.js +0 -20
  597. package/src/shade/renderer/global_illumination/probe/octahedral/convolve/chunk_compute_coefficient_address.d.ts +0 -3
  598. package/src/shade/renderer/global_illumination/probe/octahedral/convolve/chunk_compute_coefficient_address.d.ts.map +0 -1
  599. package/src/shade/renderer/global_illumination/probe/octahedral/convolve/chunk_compute_coefficient_address.js +0 -20
  600. package/src/shade/renderer/global_illumination/probe/octahedral/convolve/graph_lpv_store_sh.d.ts +0 -19
  601. package/src/shade/renderer/global_illumination/probe/octahedral/convolve/graph_lpv_store_sh.d.ts.map +0 -1
  602. package/src/shade/renderer/global_illumination/probe/octahedral/convolve/graph_lpv_store_sh.js +0 -128
  603. package/src/shade/renderer/global_illumination/probe/octahedral/convolve/graph_lvp_atlas_to_sh.d.ts +0 -22
  604. package/src/shade/renderer/global_illumination/probe/octahedral/convolve/graph_lvp_atlas_to_sh.d.ts.map +0 -1
  605. package/src/shade/renderer/global_illumination/probe/octahedral/convolve/graph_lvp_atlas_to_sh.js +0 -200
  606. package/src/shade/renderer/global_illumination/probe/octahedral/convolve/graph_reduce_atlas_to_sh.d.ts +0 -23
  607. package/src/shade/renderer/global_illumination/probe/octahedral/convolve/graph_reduce_atlas_to_sh.d.ts.map +0 -1
  608. package/src/shade/renderer/global_illumination/probe/octahedral/convolve/graph_reduce_atlas_to_sh.js +0 -179
  609. package/src/shade/renderer/global_illumination/probe/octahedral/graph_lpv_shade.d.ts +0 -13
  610. package/src/shade/renderer/global_illumination/probe/octahedral/graph_lpv_shade.d.ts.map +0 -1
  611. package/src/shade/renderer/global_illumination/probe/octahedral/graph_lpv_shade.js +0 -416
  612. package/src/shade/renderer/global_illumination/probe/octahedral/graph_sample_light_probes.d.ts +0 -16
  613. package/src/shade/renderer/global_illumination/probe/octahedral/graph_sample_light_probes.d.ts.map +0 -1
  614. package/src/shade/renderer/global_illumination/probe/octahedral/graph_sample_light_probes.js +0 -268
  615. package/src/shade/renderer/global_illumination/probe/octahedral/sample/chunk_lpv_atlas_patch_texel_coord.d.ts +0 -17
  616. package/src/shade/renderer/global_illumination/probe/octahedral/sample/chunk_lpv_atlas_patch_texel_coord.d.ts.map +0 -1
  617. package/src/shade/renderer/global_illumination/probe/octahedral/sample/chunk_lpv_atlas_patch_texel_coord.js +0 -38
  618. package/src/shade/renderer/global_illumination/probe/octahedral/sample/chunk_lpv_atlas_read_patch_texel.d.ts +0 -3
  619. package/src/shade/renderer/global_illumination/probe/octahedral/sample/chunk_lpv_atlas_read_patch_texel.d.ts.map +0 -1
  620. package/src/shade/renderer/global_illumination/probe/octahedral/sample/chunk_lpv_atlas_read_patch_texel.js +0 -34
  621. package/src/shade/renderer/global_illumination/probe/octahedral/sample/chunk_lpv_atlas_sample_probe_radiance.d.ts +0 -3
  622. package/src/shade/renderer/global_illumination/probe/octahedral/sample/chunk_lpv_atlas_sample_probe_radiance.d.ts.map +0 -1
  623. package/src/shade/renderer/global_illumination/probe/octahedral/sample/chunk_lpv_atlas_sample_probe_radiance.js +0 -62
  624. package/src/shade/renderer/global_illumination/probe/octahedral/sample/chunk_lpv_atlas_sample_probe_radiance_nearest.d.ts +0 -3
  625. package/src/shade/renderer/global_illumination/probe/octahedral/sample/chunk_lpv_atlas_sample_probe_radiance_nearest.d.ts.map +0 -1
  626. package/src/shade/renderer/global_illumination/probe/octahedral/sample/chunk_lpv_atlas_sample_probe_radiance_nearest.js +0 -37
  627. package/src/shade/renderer/global_illumination/probe/octahedral/sample/chunk_lpv_mesh_interpolate_radiance_via_atlas.d.ts +0 -7
  628. package/src/shade/renderer/global_illumination/probe/octahedral/sample/chunk_lpv_mesh_interpolate_radiance_via_atlas.d.ts.map +0 -1
  629. package/src/shade/renderer/global_illumination/probe/octahedral/sample/chunk_lpv_mesh_interpolate_radiance_via_atlas.js +0 -62
  630. package/src/shade/renderer/global_illumination/probe/octahedral/sample/chunk_lpv_radiance_sample_reflection.d.ts +0 -7
  631. package/src/shade/renderer/global_illumination/probe/octahedral/sample/chunk_lpv_radiance_sample_reflection.d.ts.map +0 -1
  632. package/src/shade/renderer/global_illumination/probe/octahedral/sample/chunk_lpv_radiance_sample_reflection.js +0 -61
  633. package/src/shade/renderer/global_illumination/probe/octahedral/sample/chunk_parallax_correct_spherical_probe.d.ts.map +0 -1
  634. package/src/shade/renderer/global_illumination/probe/octahedral/sample/chunk_parallax_correct_spherical_probe_iterative.d.ts +0 -3
  635. package/src/shade/renderer/global_illumination/probe/octahedral/sample/chunk_parallax_correct_spherical_probe_iterative.d.ts.map +0 -1
  636. package/src/shade/renderer/global_illumination/probe/octahedral/sample/chunk_parallax_correct_spherical_probe_iterative.js +0 -80
  637. package/src/shade/renderer/global_illumination/probe/octahedral/shader_lpv_accumulate_depth.d.ts +0 -3
  638. package/src/shade/renderer/global_illumination/probe/octahedral/shader_lpv_accumulate_depth.d.ts.map +0 -1
  639. package/src/shade/renderer/global_illumination/probe/octahedral/shader_lpv_accumulate_depth.js +0 -143
  640. package/src/shade/renderer/global_illumination/probe/octahedral/shader_lpv_atlas_write_depth.d.ts +0 -3
  641. package/src/shade/renderer/global_illumination/probe/octahedral/shader_lpv_atlas_write_depth.d.ts.map +0 -1
  642. package/src/shade/renderer/global_illumination/probe/octahedral/shader_lpv_atlas_write_depth.js +0 -59
  643. package/src/shade/renderer/global_illumination/probe/octahedral/shader_lpv_build_gbuffer.d.ts +0 -3
  644. package/src/shade/renderer/global_illumination/probe/octahedral/shader_lpv_build_gbuffer.d.ts.map +0 -1
  645. package/src/shade/renderer/global_illumination/probe/octahedral/shader_lpv_build_gbuffer.js +0 -227
  646. package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_ray_query_blas_occlusion.d.ts +0 -7
  647. package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_ray_query_blas_occlusion.d.ts.map +0 -1
  648. package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_ray_query_blas_occlusion.js +0 -226
  649. package/src/shade/renderer/shader/chunk/light/lpv/INVALID_TET_DECLARATION.d.ts +0 -7
  650. package/src/shade/renderer/shader/chunk/light/lpv/INVALID_TET_DECLARATION.d.ts.map +0 -1
  651. package/src/shade/renderer/shader/chunk/light/lpv/INVALID_TET_DECLARATION.js +0 -12
  652. package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_interpolate_probe_irradiance8.d.ts +0 -7
  653. package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_interpolate_probe_irradiance8.d.ts.map +0 -1
  654. package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_interpolate_probe_irradiance8.js +0 -37
  655. package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_mask_visibility_via_rays.d.ts +0 -8
  656. package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_mask_visibility_via_rays.d.ts.map +0 -1
  657. package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_mask_visibility_via_rays.js +0 -45
  658. package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_mesh_get_barycentric_coordinates.d.ts +0 -3
  659. package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_mesh_get_barycentric_coordinates.d.ts.map +0 -1
  660. package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_mesh_get_barycentric_coordinates.js +0 -29
  661. package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_mesh_get_neighbours.d.ts +0 -3
  662. package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_mesh_get_neighbours.d.ts.map +0 -1
  663. package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_mesh_get_neighbours.js +0 -20
  664. package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_mesh_get_vertices.d.ts +0 -3
  665. package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_mesh_get_vertices.d.ts.map +0 -1
  666. package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_mesh_get_vertices.js +0 -22
  667. package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_mesh_interpolate_probe.d.ts +0 -4
  668. package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_mesh_interpolate_probe.d.ts.map +0 -1
  669. package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_mesh_interpolate_probe.js +0 -53
  670. package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_mesh_interpolate_probe_irradiance.d.ts +0 -7
  671. package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_mesh_interpolate_probe_irradiance.d.ts.map +0 -1
  672. package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_mesh_interpolate_probe_irradiance.js +0 -48
  673. package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_mesh_interpolate_probe_irradiance_pre.d.ts +0 -7
  674. package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_mesh_interpolate_probe_irradiance_pre.d.ts.map +0 -1
  675. package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_mesh_interpolate_probe_irradiance_pre.js +0 -35
  676. package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_mesh_interpolation_probe_sh.d.ts +0 -3
  677. package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_mesh_interpolation_probe_sh.d.ts.map +0 -1
  678. package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_mesh_interpolation_probe_sh.js +0 -38
  679. package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_mesh_lookup_nearest_cell.d.ts +0 -3
  680. package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_mesh_lookup_nearest_cell.d.ts.map +0 -1
  681. package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_mesh_lookup_nearest_cell.js +0 -67
  682. package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_mesh_walk_to_tetrahedron.d.ts +0 -3
  683. package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_mesh_walk_to_tetrahedron.d.ts.map +0 -1
  684. package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_mesh_walk_to_tetrahedron.js +0 -52
  685. package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_probe_get_data.d.ts +0 -3
  686. package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_probe_get_data.d.ts.map +0 -1
  687. package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_probe_get_data.js +0 -22
  688. package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_probe_get_position.d.ts +0 -3
  689. package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_probe_get_position.d.ts.map +0 -1
  690. package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_probe_get_position.js +0 -17
  691. package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_sample_irradiance.d.ts +0 -3
  692. package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_sample_irradiance.d.ts.map +0 -1
  693. package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_sample_irradiance.js +0 -48
  694. package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_sample_irradiance_8.d.ts +0 -9
  695. package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_sample_irradiance_8.d.ts.map +0 -1
  696. package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_sample_irradiance_8.js +0 -126
  697. package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_sample_irradiance_no_depth.d.ts +0 -3
  698. package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_sample_irradiance_no_depth.d.ts.map +0 -1
  699. package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_sample_irradiance_no_depth.js +0 -45
  700. package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_sample_radiance.d.ts +0 -3
  701. package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_sample_radiance.d.ts.map +0 -1
  702. package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_sample_radiance.js +0 -61
  703. package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_sample_sh3_at.d.ts +0 -3
  704. package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_sample_sh3_at.d.ts.map +0 -1
  705. package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_sample_sh3_at.js +0 -33
  706. package/src/shade/renderer/shader/chunk/light/lpv/depth/chunk_lpv_mask_weights_by_visibility.d.ts +0 -4
  707. package/src/shade/renderer/shader/chunk/light/lpv/depth/chunk_lpv_mask_weights_by_visibility.d.ts.map +0 -1
  708. package/src/shade/renderer/shader/chunk/light/lpv/depth/chunk_lpv_mask_weights_by_visibility.js +0 -161
  709. package/src/shade/renderer/shader/chunk/light/lpv/depth/chunk_lpv_probe_sample_depth_array.d.ts +0 -3
  710. package/src/shade/renderer/shader/chunk/light/lpv/depth/chunk_lpv_probe_sample_depth_array.d.ts.map +0 -1
  711. package/src/shade/renderer/shader/chunk/light/lpv/depth/chunk_lpv_probe_sample_depth_array.js +0 -59
  712. package/src/shade/renderer/shader/chunk/light/lpv/depth/chunk_lpv_sample_depth_atlas.d.ts +0 -4
  713. package/src/shade/renderer/shader/chunk/light/lpv/depth/chunk_lpv_sample_depth_atlas.d.ts.map +0 -1
  714. package/src/shade/renderer/shader/chunk/light/lpv/depth/chunk_lpv_sample_depth_atlas.js +0 -97
  715. package/src/shade/renderer/shader/chunk/light/sample/chunk_ray_sample_light.d.ts +0 -3
  716. package/src/shade/renderer/shader/chunk/light/sample/chunk_ray_sample_light.d.ts.map +0 -1
  717. package/src/shade/renderer/shader/chunk/light/sample/chunk_ray_sample_light.js +0 -105
  718. package/src/shade/renderer/shadow/sdf/chunk_ray_query_sdf_distance.d.ts +0 -6
  719. package/src/shade/renderer/shadow/sdf/chunk_ray_query_sdf_distance.d.ts.map +0 -1
  720. package/src/shade/renderer/shadow/sdf/chunk_ray_query_sdf_distance.js +0 -86
  721. package/src/shade/renderer/shadow/sdf/chunk_ray_query_sdf_raycast_traversal_count.d.ts +0 -2
  722. package/src/shade/renderer/shadow/sdf/chunk_ray_query_sdf_raycast_traversal_count.d.ts.map +0 -1
  723. package/src/shade/renderer/shadow/sdf/chunk_ray_query_sdf_raycast_traversal_count.js +0 -136
  724. /package/src/shade/renderer/{global_illumination/lpv/placement/software → scene/bvh}/sdf_build_from_scene.d.ts +0 -0
  725. /package/src/shade/renderer/{global_illumination/lpv/placement/software → scene/bvh}/sdf_find_local_maxima.d.ts +0 -0
@@ -1,427 +1,453 @@
1
- import { assert } from "../../../../core/assert.js";
2
- import { isPowerOfTwo } from "../../../../core/math/isPowerOfTwo.js";
3
- import { GRID_TILE_SIZE } from "../../shader/chunk/grid/chunk_grid_tile_window.js";
4
- import { fluid_cascade_window_place, fluid_cascade_window_value } from "../fluid_cascade_window.js";
5
- import { FLUID_CASCADE_DEVIATION_CELLS } from "../coupling/chunk_fluid_cascade_epilogue.js";
6
- import { FLUID_MAC_STEP_STRUCT } from "./FLUID_MAC_STEP_STRUCT.js";
7
- import { shader_fluid_mac_advect_correct } from "./shader_fluid_mac_advect_correct.js";
8
- import { shader_fluid_mac_advect_predict } from "./shader_fluid_mac_advect_predict.js";
9
- import { shader_fluid_mac_curl } from "./shader_fluid_mac_curl.js";
10
- import { shader_fluid_mac_divergence } from "./shader_fluid_mac_divergence.js";
11
- import { shader_fluid_mac_gradient } from "./shader_fluid_mac_gradient.js";
12
- import { shader_fluid_cascade_ghosts } from "../coupling/shader_fluid_cascade_ghosts.js";
13
- import { FLUID_CASCADE_GHOST_DEPTH } from "../coupling/FLUID_CASCADE_GHOSTS.js";
14
-
15
- /**
16
- * @typedef {import("../../../device/ShadeGPUCommandContext.js").ShadeGPUCommandContext} ShadeGPUCommandContext
17
- * @typedef {import("./FluidMacVelocitySet.js").FluidMacVelocitySet} FluidMacVelocitySet
18
- * @typedef {{u: GPUTextureView, v: GPUTextureView, w: GPUTextureView}} FluidMacVelocityViews a MAC
19
- * velocity field's three component views: a {@link FluidMacVelocitySet}'s, or a frame graph's
20
- * transient textures'
21
- * @typedef {{uniform: GPUBuffer, u: GPUTextureView, v: GPUTextureView, w: GPUTextureView, pressure: GPUBuffer}} FluidCascadeParentBindings
22
- * what a step reads of its parent beyond its window: `uniform`, the parent as
23
- * {@link FLUID_CASCADE_PARENT_STRUCT}; `u`, `v`, `w`, its persistent faces; `pressure`, its pressure.
24
- * A far-field parent binds stand-ins it never reads.
25
- * @typedef {{u: GPUTextureView, v: GPUTextureView, w: GPUTextureView, pressure: GPUBuffer}} FluidCascadeGhostBindings
26
- * a step's ghosts (`shader_fluid_cascade_ghosts`): `u`, `v`, `w`, the velocity shells, transient
27
- * `r32float` textures of each face lattice grown by `FLUID_CASCADE_GHOST_DEPTH` on every side;
28
- * `pressure`, the pressure ghosts over the window grown by one cell.
29
- */
30
-
31
- /**
32
- * Records the MAC passes of one cascade's step (GPU_FLUID_CASCADES_PROPOSAL_2026_10_16.md §8): the
33
- * advection (predict, then correct), the right-hand side of the pressure solve, and the gradient
34
- * subtraction that writes the step's end velocity. The pressure solve between the last two is not
35
- * here.
36
- *
37
- * One instance a cascade. {@link place} puts its window, {@link set_step} sets a step's h, dt and far
38
- * field, and each `record_*` records into the encoder a frame-graph pass hands its callback. Each
39
- * record serialises the step's parameters into a transient uniform of its own (pooled by the
40
- * encoder), so a step recorded later in the frame cannot change what an earlier one reads.
41
- *
42
- * The step's order and what moves between the passes, A the cascade's persistent velocity:
43
- *
44
- * record_ghosts(encoder, parent, G) parent → G (the step's ghosts)
45
- * record_curl(encoder, A, solid, C) A → C, the confinement force (with confinement)
46
- * record_advect(encoder, A, F, B, solid, forcing, C, parent, G) A → F (predict), A + F + C + forcing → B (correct)
47
- * record_divergence(encoder, B, solid, rhs, words) B → rhs = div/dt, solid → level 0 words
48
- * (the pressure solve: rhs → pressure, its ghosts G)
49
- * record_gradient(encoder, B, pressure, solid, A, G) B + pressure → A
50
- *
51
- * so A is the only velocity a cascade keeps between steps, and F and B are transients. Beyond the
52
- * window, the advection reads the step's ghosts of the parent's faces and the gradient those of its
53
- * pressure ({@link FluidCascadeGhostBindings}), each written once a step from the parent
54
- * ({@link FluidCascadeParentBindings}).
55
- *
56
- * Every pass dispatches `(nx / 8, ny / 8, nz / 4)` workgroups, the ghosts `ceil((n + 1 + 2·depth) / 4)`
57
- * on each axis, a texel of the largest shell an invocation. Nothing here allocates once placed:
58
- * the parameters, bindings and dispatch arguments are retained and rewritten in place.
59
- */
60
- export class FluidMacPasses {
61
- /**
62
- * Offer the compute pipelines the MAC step passes dispatch — see {@link PipelineEnquiry}.
63
- *
64
- * @param {import("../../../device/pipeline/PipelineEnquiry.js").PipelineEnquiry} enquiry
65
- */
66
- static enquirePipelines(enquiry) {
67
- enquiry.compute.push(
68
- shader_fluid_mac_advect_correct.pipeline,
69
- shader_fluid_mac_advect_predict.pipeline,
70
- shader_fluid_mac_curl.pipeline,
71
- shader_fluid_mac_divergence.pipeline,
72
- shader_fluid_mac_gradient.pipeline,
73
- shader_fluid_cascade_ghosts.pipeline,
74
- );
75
- }
76
-
77
- /** The value of {@link FLUID_MAC_STEP_STRUCT}, rewritten in place. */
78
- #step = {
79
- cells: fluid_cascade_window_value(),
80
- faces_u: fluid_cascade_window_value(),
81
- faces_v: fluid_cascade_window_value(),
82
- faces_w: fluid_cascade_window_value(),
83
- far_velocity: new Float32Array(3),
84
- dt_over_h: 0,
85
- far_velocity_end: new Float32Array(3),
86
- rhs_scale: 0,
87
- keep: 1,
88
- deviation_limit: 0,
89
- band: 0,
90
- confinement_dt: 0,
91
- };
92
-
93
- #placed = false;
94
- #stepped = false;
95
-
96
- /** Stand-in words buffer when {@link record_divergence} is called without an explicit words buffer. */
97
- #stand_in_device = null;
98
- #stand_in_words = null;
99
-
100
- #curl = {
101
- encoder: null,
102
- bindings: { step: null, source_u: null, source_v: null, source_w: null, solid: null, confinement: null },
103
- group_count_x: 1, group_count_y: 1, group_count_z: 1,
104
- };
105
-
106
- #predict = {
107
- encoder: null,
108
- bindings: {
109
- step: null, source_u: null, source_v: null, source_w: null,
110
- ghost_u: null, ghost_v: null, ghost_w: null,
111
- solid: null, forward_u: null, forward_v: null, forward_w: null,
112
- },
113
- group_count_x: 1, group_count_y: 1, group_count_z: 1,
114
- };
115
-
116
- #correct = {
117
- encoder: null,
118
- bindings: {
119
- step: null, parent: null, source_u: null, source_v: null, source_w: null, forward_u: null, forward_v: null, forward_w: null,
120
- parent_u: null, parent_v: null, parent_w: null, ghost_u: null, ghost_v: null, ghost_w: null,
121
- solid: null, forcing: null, confinement: null, out_u: null, out_v: null, out_w: null,
122
- },
123
- group_count_x: 1, group_count_y: 1, group_count_z: 1,
124
- };
125
-
126
- #divergence = {
127
- encoder: null,
128
- bindings: { step: null, velocity_u: null, velocity_v: null, velocity_w: null, solid: null, rhs: null, words: null },
129
- group_count_x: 1, group_count_y: 1, group_count_z: 1,
130
- };
131
-
132
- #ghosts = {
133
- encoder: null,
134
- bindings: {
135
- step: null, parent: null, parent_u: null, parent_v: null, parent_w: null, parent_pressure: null,
136
- ghost_u: null, ghost_v: null, ghost_w: null, ghost_pressure: null,
137
- },
138
- group_count_x: 1, group_count_y: 1, group_count_z: 1,
139
- };
140
-
141
- #gradient = {
142
- encoder: null,
143
- bindings: {
144
- step: null, velocity_u: null, velocity_v: null, velocity_w: null, pressure: null, ghost_pressure: null,
145
- solid: null, out_u: null, out_v: null, out_w: null,
146
- },
147
- group_count_x: 1, group_count_y: 1, group_count_z: 1,
148
- };
149
-
150
- /**
151
- * Where the cascade's window is.
152
- *
153
- * @param {ArrayLike<number>} resolution cells on each axis, each a power of two, at least 8, 8, 4
154
- * @param {ArrayLike<number>} corner the world cell at window-local (0, 0, 0)
155
- */
156
- place(resolution, corner) {
157
- for (let i = 0; i < 3; i++) {
158
- assert.isNonNegativeInteger(resolution[i], 'resolution');
159
- assert.ok(isPowerOfTwo(resolution[i]), 'resolution is a power of two on each axis');
160
- assert.greaterThanOrEqual(resolution[i], GRID_TILE_SIZE[i], 'resolution holds a whole tile on each axis');
161
- assert.isInteger(corner[i], 'corner');
162
- }
163
-
164
- const step = this.#step;
165
-
166
- fluid_cascade_window_place(step.cells, corner, resolution, -1);
167
- fluid_cascade_window_place(step.faces_u, corner, resolution, 0);
168
- fluid_cascade_window_place(step.faces_v, corner, resolution, 1);
169
- fluid_cascade_window_place(step.faces_w, corner, resolution, 2);
170
-
171
- const x = resolution[0] / GRID_TILE_SIZE[0];
172
- const y = resolution[1] / GRID_TILE_SIZE[1];
173
- const z = resolution[2] / GRID_TILE_SIZE[2];
174
-
175
- for (const pass of [this.#curl, this.#predict, this.#correct, this.#divergence, this.#gradient]) {
176
- pass.group_count_x = x;
177
- pass.group_count_y = y;
178
- pass.group_count_z = z;
179
- }
180
-
181
- // the ghosts: a texel of the largest shell an invocation
182
- const ghosts = this.#ghosts;
183
- ghosts.group_count_x = Math.ceil((resolution[0] + 1 + 2 * FLUID_CASCADE_GHOST_DEPTH) / 4);
184
- ghosts.group_count_y = Math.ceil((resolution[1] + 1 + 2 * FLUID_CASCADE_GHOST_DEPTH) / 4);
185
- ghosts.group_count_z = Math.ceil((resolution[2] + 1 + 2 * FLUID_CASCADE_GHOST_DEPTH) / 4);
186
-
187
- this.#placed = true;
188
- }
189
-
190
- /**
191
- * The step about to be recorded, from `t₀` to `t₁` (GPU_FLUID_CASCADES_PROPOSAL_2026_10_16.md §6, §8).
192
- *
193
- * @param {number} h cell size, m
194
- * @param {number} dt time step, s
195
- * @param {ArrayLike<number>} far_velocity `v_far(t₀)`, m/s: what the velocity the step starts from
196
- * is a deviation from
197
- * @param {ArrayLike<number>} far_velocity_end `v_far(t₁)`, m/s
198
- * @param {number} keep `e^(−(Λ(t₁) − Λ(t₀)))`, in [0, 1]
199
- * @param {boolean} band whether the faces of rows 2..5 relax toward the parent
200
- * @param {number} confinement the vorticity confinement's strength ε, per second, ≥ 0: 0 for none,
201
- * and then {@link record_curl} is not recorded for the step
202
- */
203
- set_step(h, dt, far_velocity, far_velocity_end, keep, band, confinement) {
204
- assert.isFinite(h, 'h'); assert.greaterThan(h, 0, 'h');
205
- assert.isFinite(dt, 'dt'); assert.greaterThan(dt, 0, 'dt');
206
- assert.isFinite(keep, 'keep');
207
- assert.greaterThanOrEqual(keep, 0, 'keep');
208
- assert.lessThanOrEqual(keep, 1, 'keep');
209
- assert.isBoolean(band, 'band');
210
- assert.isFinite(confinement, 'confinement');
211
- assert.greaterThanOrEqual(confinement, 0, 'confinement');
212
-
213
- const step = this.#step;
214
-
215
- step.dt_over_h = dt / h;
216
- step.rhs_scale = 1 / (h * dt);
217
- step.keep = keep;
218
- step.deviation_limit = FLUID_CASCADE_DEVIATION_CELLS * h / dt;
219
- step.band = band ? 1 : 0;
220
- step.confinement_dt = confinement * dt;
221
-
222
- for (let i = 0; i < 3; i++) {
223
- assert.isFinite(far_velocity[i], 'far_velocity');
224
- assert.isFinite(far_velocity_end[i], 'far_velocity_end');
225
-
226
- step.far_velocity[i] = far_velocity[i];
227
- step.far_velocity_end[i] = far_velocity_end[i];
228
- }
229
-
230
- this.#stepped = true;
231
- }
232
-
233
- /**
234
- * @param {ShadeGPUCommandContext} encoder
235
- * @returns {GPUBuffer}
236
- */
237
- #uniform(encoder) {
238
- assert.ok(this.#placed, 'placed before recording');
239
- assert.ok(this.#stepped, 'a step set before recording');
240
-
241
- return encoder.allocateTransientValueBuffer(FLUID_MAC_STEP_STRUCT, this.#step, GPUBufferUsage.UNIFORM);
242
- }
243
-
244
- /**
245
- * The step's vorticity confinement, pass 1 (`shader_fluid_mac_curl`): the curl of the persistent
246
- * velocity and the force it makes in every cell, for the correct pass. Recorded only for a step whose
247
- * confinement is not 0, before {@link record_advect}.
248
- *
249
- * @param {ShadeGPUCommandContext} encoder
250
- * @param {FluidMacVelocityViews} source the persistent velocity, toroidal; read
251
- * @param {GPUBuffer} solid the window-local solid flags, `array<u32>`, bit 0
252
- * @param {GPUBuffer} confinement written, `array<f32>` of 3·N cells, window-local
253
- */
254
- record_curl(encoder, source, solid, confinement) {
255
- assert.greaterThan(this.#step.confinement_dt, 0, 'a step with confinement');
256
-
257
- const pass = this.#curl;
258
- const b = pass.bindings;
259
- b.step = this.#uniform(encoder);
260
- b.source_u = source.u; b.source_v = source.v; b.source_w = source.w;
261
- b.solid = solid;
262
- b.confinement = confinement;
263
- pass.encoder = encoder;
264
-
265
- shader_fluid_mac_curl.dispatch(pass);
266
-
267
- pass.encoder = null;
268
- b.confinement = null;
269
- }
270
-
271
- /**
272
- * MacCormack advection of the persistent velocity by itself: predict into `forward`, then correct
273
- * into `out`, which adds the step's confinement and the tick's forcing.
274
- *
275
- * @param {ShadeGPUCommandContext} encoder
276
- * @param {FluidMacVelocityViews} source the persistent velocity, toroidal; read
277
- * @param {FluidMacVelocityViews} forward a transient, window-local; written, then read
278
- * @param {FluidMacVelocityViews} out a transient, window-local; written
279
- * @param {GPUBuffer} solid the window-local solid flags, `array<u32>`: bit 0 solid, bit 1
280
- * (`FLUID_FORCED_FLAG`) forcing written for the cell's faces
281
- * @param {GPUBuffer} forcing the tick's forcing, `array<f32>` over the three face lattices
282
- * (`shader_fluid_mac_advect_correct`); read only where `solid` says it was written
283
- * @param {GPUBuffer} confinement what {@link record_curl} wrote for the step; read only when the
284
- * step's confinement is not 0
285
- * @param {FluidCascadeParentBindings} parent what the relaxation band reads on rows 2..5
286
- * @param {FluidCascadeGhostBindings} ghosts the step's ghosts, written by {@link record_ghosts}
287
- */
288
- record_advect(encoder, source, forward, out, solid, forcing, confinement, parent, ghosts) {
289
- assert.notEqual(source, forward, 'source and forward are different sets');
290
- assert.notEqual(source, out, 'source and out are different sets');
291
- assert.notEqual(forward, out, 'forward and out are different sets');
292
-
293
- const step = this.#uniform(encoder);
294
-
295
- const predict = this.#predict;
296
- const p = predict.bindings;
297
- p.step = step;
298
- p.source_u = source.u; p.source_v = source.v; p.source_w = source.w;
299
- p.ghost_u = ghosts.u; p.ghost_v = ghosts.v; p.ghost_w = ghosts.w;
300
- p.solid = solid;
301
- p.forward_u = forward.u; p.forward_v = forward.v; p.forward_w = forward.w;
302
- predict.encoder = encoder;
303
-
304
- shader_fluid_mac_advect_predict.dispatch(predict);
305
-
306
- const correct = this.#correct;
307
- const c = correct.bindings;
308
- c.step = step;
309
- c.parent = parent.uniform;
310
- c.source_u = source.u; c.source_v = source.v; c.source_w = source.w;
311
- c.forward_u = forward.u; c.forward_v = forward.v; c.forward_w = forward.w;
312
- c.parent_u = parent.u; c.parent_v = parent.v; c.parent_w = parent.w;
313
- c.ghost_u = ghosts.u; c.ghost_v = ghosts.v; c.ghost_w = ghosts.w;
314
- c.solid = solid;
315
- c.forcing = forcing;
316
- c.confinement = confinement;
317
- c.out_u = out.u; c.out_v = out.v; c.out_w = out.w;
318
- correct.encoder = encoder;
319
-
320
- shader_fluid_mac_advect_correct.dispatch(correct);
321
-
322
- predict.encoder = null;
323
- correct.encoder = null;
324
- c.forcing = null;
325
- c.confinement = null;
326
- }
327
-
328
- /**
329
- * The step's ghosts (`shader_fluid_cascade_ghosts`): the parent's identity read at every face of the
330
- * velocity shells and its pressure at every cell one past the window, once, for the step's passes.
331
- *
332
- * @param {ShadeGPUCommandContext} encoder
333
- * @param {FluidCascadeParentBindings} parent
334
- * @param {FluidCascadeGhostBindings} ghosts written
335
- */
336
- record_ghosts(encoder, parent, ghosts) {
337
- const pass = this.#ghosts;
338
- const b = pass.bindings;
339
- b.step = this.#uniform(encoder);
340
- b.parent = parent.uniform;
341
- b.parent_u = parent.u; b.parent_v = parent.v; b.parent_w = parent.w;
342
- b.parent_pressure = parent.pressure;
343
- b.ghost_u = ghosts.u; b.ghost_v = ghosts.v; b.ghost_w = ghosts.w;
344
- b.ghost_pressure = ghosts.pressure;
345
- pass.encoder = encoder;
346
-
347
- shader_fluid_cascade_ghosts.dispatch(pass);
348
-
349
- pass.encoder = null;
350
- }
351
-
352
- /**
353
- * @param {GPUDevice} device
354
- * @param {number} size
355
- * @returns {GPUBuffer}
356
- */
357
- #ensure_stand_in_words(device, size) {
358
- if (this.#stand_in_device === device && this.#stand_in_words !== null && this.#stand_in_words.size === size) {
359
- return this.#stand_in_words;
360
- }
361
-
362
- this.#stand_in_words?.destroy();
363
- this.#stand_in_device = device;
364
- this.#stand_in_words = device.createBuffer({
365
- label: 'Fluid / MAC / stand-in words',
366
- size,
367
- usage: GPUBufferUsage.STORAGE,
368
- });
369
-
370
- return this.#stand_in_words;
371
- }
372
-
373
- /**
374
- * The right-hand side and finest-level weight words of the pressure solve, `div/dt` at every cell,
375
- * 0 in solid cells.
376
- *
377
- * @param {ShadeGPUCommandContext} encoder
378
- * @param {FluidMacVelocityViews} velocity the advected velocity, window-local; read
379
- * @param {GPUBuffer} solid the window-local solid flags, `array<u32>`, bit 0
380
- * @param {GPUBuffer} rhs written, `array<f32>` of N cells, window-local, x fastest
381
- * @param {GPUBuffer} [words] written, `array<u32>` of N cells, the finest level's weight words
382
- */
383
- record_divergence(encoder, velocity, solid, rhs, words = null) {
384
- const pass = this.#divergence;
385
- const b = pass.bindings;
386
- b.step = this.#uniform(encoder);
387
- b.velocity_u = velocity.u; b.velocity_v = velocity.v; b.velocity_w = velocity.w;
388
- b.solid = solid;
389
- b.rhs = rhs;
390
- b.words = words ?? this.#ensure_stand_in_words(encoder.device, rhs.size);
391
- pass.encoder = encoder;
392
-
393
- shader_fluid_mac_divergence.dispatch(pass);
394
-
395
- pass.encoder = null;
396
- b.words = null;
397
- }
398
-
399
- /**
400
- * The pressure gradient taken from the advected velocity, into the persistent velocity.
401
- *
402
- * @param {ShadeGPUCommandContext} encoder
403
- * @param {FluidMacVelocityViews} velocity the advected velocity, window-local; read
404
- * @param {GPUBuffer} pressure kinematic pressure, m²/s², `array<f32>` of N cells, toroidal; read
405
- * @param {GPUBuffer} solid the window-local solid flags, `array<u32>`, bit 0
406
- * @param {FluidMacVelocityViews} out the persistent velocity, toroidal; written
407
- * @param {FluidCascadeGhostBindings} ghosts the step's ghosts: `pressure` is the pressure beyond the window
408
- */
409
- record_gradient(encoder, velocity, pressure, solid, out, ghosts) {
410
- assert.notEqual(velocity, out, 'velocity and out are different sets');
411
- assert.notEqual(pressure, ghosts.pressure, 'the ghosts are not the cascade\'s pressure');
412
-
413
- const pass = this.#gradient;
414
- const b = pass.bindings;
415
- b.step = this.#uniform(encoder);
416
- b.velocity_u = velocity.u; b.velocity_v = velocity.v; b.velocity_w = velocity.w;
417
- b.pressure = pressure;
418
- b.ghost_pressure = ghosts.pressure;
419
- b.solid = solid;
420
- b.out_u = out.u; b.out_v = out.v; b.out_w = out.w;
421
- pass.encoder = encoder;
422
-
423
- shader_fluid_mac_gradient.dispatch(pass);
424
-
425
- pass.encoder = null;
426
- }
427
- }
1
+ import { assert } from "../../../../core/assert.js";
2
+ import { isPowerOfTwo } from "../../../../core/math/isPowerOfTwo.js";
3
+ import { GRID_TILE_SIZE } from "../../shader/chunk/grid/chunk_grid_tile_window.js";
4
+ import { fluid_cascade_window_place, fluid_cascade_window_value } from "../fluid_cascade_window.js";
5
+ import { FLUID_CASCADE_DEVIATION_CELLS } from "../coupling/chunk_fluid_cascade_epilogue.js";
6
+ import { FLUID_MAC_STEP_STRUCT } from "./FLUID_MAC_STEP_STRUCT.js";
7
+ import { shader_fluid_mac_advect_correct } from "./shader_fluid_mac_advect_correct.js";
8
+ import { shader_fluid_mac_advect_predict } from "./shader_fluid_mac_advect_predict.js";
9
+ import { shader_fluid_mac_curl } from "./shader_fluid_mac_curl.js";
10
+ import { shader_fluid_mac_divergence } from "./shader_fluid_mac_divergence.js";
11
+ import { shader_fluid_mac_gradient } from "./shader_fluid_mac_gradient.js";
12
+ import { shader_fluid_cascade_ghosts } from "../coupling/shader_fluid_cascade_ghosts.js";
13
+ import { FLUID_CASCADE_GHOST_DEPTH } from "../coupling/FLUID_CASCADE_GHOSTS.js";
14
+ import { fluid_far_field_value } from "../FLUID_FAR_FIELD_STRUCT.js";
15
+
16
+ /**
17
+ * @typedef {import("../../../device/ShadeGPUCommandContext.js").ShadeGPUCommandContext} ShadeGPUCommandContext
18
+ * @typedef {import("./FluidMacVelocitySet.js").FluidMacVelocitySet} FluidMacVelocitySet
19
+ * @typedef {{u: GPUTextureView, v: GPUTextureView, w: GPUTextureView}} FluidMacVelocityViews a MAC
20
+ * velocity field's three component views: a {@link FluidMacVelocitySet}'s, or a frame graph's
21
+ * transient textures'
22
+ * @typedef {{uniform: GPUBuffer, u: GPUTextureView, v: GPUTextureView, w: GPUTextureView, pressure: GPUBuffer, turbulence: GPUTextureView}} FluidCascadeParentBindings
23
+ * what a step reads of its parent beyond its window: `uniform`, the parent as
24
+ * {@link FLUID_CASCADE_PARENT_STRUCT}; `u`, `v`, `w`, its persistent faces; `pressure`, its pressure;
25
+ * `turbulence`, the far field's turbulence tile, which the step's far field reads too. A far-field
26
+ * parent binds stand-ins it never reads.
27
+ * @typedef {{u: GPUTextureView, v: GPUTextureView, w: GPUTextureView, pressure: GPUBuffer}} FluidCascadeGhostBindings
28
+ * a step's ghosts (`shader_fluid_cascade_ghosts`): `u`, `v`, `w`, the velocity shells, transient
29
+ * `r32float` textures of each face lattice grown by `FLUID_CASCADE_GHOST_DEPTH` on every side;
30
+ * `pressure`, the pressure ghosts over the window grown by one cell.
31
+ */
32
+
33
+ /**
34
+ * Copy a far field value ({@link FLUID_FAR_FIELD_STRUCT}) into another, checking it is finite.
35
+ *
36
+ * @param {{mean: Float32Array, sigma: number, origin: Float32Array, scale: Float32Array}} out
37
+ * @param {{mean: ArrayLike<number>, sigma: number, origin: ArrayLike<number>, scale: ArrayLike<number>}} from
38
+ */
39
+ function copy_far_field(out, from) {
40
+ assert.isFinite(from.sigma, 'sigma');
41
+
42
+ for (let i = 0; i < 3; i++) {
43
+ assert.isFinite(from.mean[i], 'far mean');
44
+ assert.isFinite(from.origin[i], 'far origin');
45
+ assert.isFinite(from.scale[i], 'far scale');
46
+
47
+ out.mean[i] = from.mean[i];
48
+ out.origin[i] = from.origin[i];
49
+ out.scale[i] = from.scale[i];
50
+ }
51
+
52
+ out.sigma = from.sigma;
53
+ out.lod = from.lod ?? 0;
54
+ }
55
+
56
+ /**
57
+ * Records the MAC passes of one cascade's step (GPU_FLUID_CASCADES_PROPOSAL_2026_10_16.md §8): the
58
+ * advection (predict, then correct), the right-hand side of the pressure solve, and the gradient
59
+ * subtraction that writes the step's end velocity. The pressure solve between the last two is not
60
+ * here.
61
+ *
62
+ * One instance a cascade. {@link place} puts its window, {@link set_step} sets a step's h, dt and far
63
+ * field, and each `record_*` records into the encoder a frame-graph pass hands its callback. Each
64
+ * record serialises the step's parameters into a transient uniform of its own (pooled by the
65
+ * encoder), so a step recorded later in the frame cannot change what an earlier one reads.
66
+ *
67
+ * The step's order and what moves between the passes, A the cascade's persistent velocity:
68
+ *
69
+ * record_ghosts(encoder, parent, G) parent → G (the step's ghosts)
70
+ * record_curl(encoder, A, solid, C) A → C, the confinement force (with confinement)
71
+ * record_advect(encoder, A, F, B, solid, forcing, C, parent, G) A → F (predict), A + F + C + forcing → B (correct)
72
+ * record_divergence(encoder, B, solid, rhs, words) B → rhs = div/dt, solid → level 0 words
73
+ * (the pressure solve: rhs → pressure, its ghosts G)
74
+ * record_gradient(encoder, B, pressure, solid, A, G) B + pressure → A
75
+ *
76
+ * so A is the only velocity a cascade keeps between steps, and F and B are transients. Beyond the
77
+ * window, the advection reads the step's ghosts of the parent's faces and the gradient those of its
78
+ * pressure ({@link FluidCascadeGhostBindings}), each written once a step from the parent
79
+ * ({@link FluidCascadeParentBindings}).
80
+ *
81
+ * Every pass dispatches `(nx / 8, ny / 8, nz / 4)` workgroups, the ghosts `ceil((n + 1 + 2·depth) / 4)`
82
+ * on each axis, a texel of the largest shell an invocation. Nothing here allocates once placed:
83
+ * the parameters, bindings and dispatch arguments are retained and rewritten in place.
84
+ */
85
+ export class FluidMacPasses {
86
+ /**
87
+ * Offer the compute pipelines the MAC step passes dispatch — see {@link PipelineEnquiry}.
88
+ *
89
+ * @param {import("../../../device/pipeline/PipelineEnquiry.js").PipelineEnquiry} enquiry
90
+ */
91
+ static enquirePipelines(enquiry) {
92
+ enquiry.compute.push(
93
+ shader_fluid_mac_advect_correct.pipeline,
94
+ shader_fluid_mac_advect_predict.pipeline,
95
+ shader_fluid_mac_curl.pipeline,
96
+ shader_fluid_mac_divergence.pipeline,
97
+ shader_fluid_mac_gradient.pipeline,
98
+ shader_fluid_cascade_ghosts.pipeline,
99
+ );
100
+ }
101
+
102
+ /** The value of {@link FLUID_MAC_STEP_STRUCT}, rewritten in place. */
103
+ #step = {
104
+ cells: fluid_cascade_window_value(),
105
+ faces_u: fluid_cascade_window_value(),
106
+ faces_v: fluid_cascade_window_value(),
107
+ faces_w: fluid_cascade_window_value(),
108
+ far: fluid_far_field_value(),
109
+ far_end: fluid_far_field_value(),
110
+ dt_over_h: 0,
111
+ rhs_scale: 0,
112
+ keep: 1,
113
+ deviation_limit: 0,
114
+ band: 0,
115
+ confinement_dt: 0,
116
+ };
117
+
118
+ #placed = false;
119
+ #stepped = false;
120
+
121
+ /** Stand-in words buffer when {@link record_divergence} is called without an explicit words buffer. */
122
+ #stand_in_device = null;
123
+ #stand_in_words = null;
124
+
125
+ #curl = {
126
+ encoder: null,
127
+ bindings: { step: null, source_u: null, source_v: null, source_w: null, solid: null, confinement: null },
128
+ group_count_x: 1, group_count_y: 1, group_count_z: 1,
129
+ };
130
+
131
+ #predict = {
132
+ encoder: null,
133
+ bindings: {
134
+ step: null, source_u: null, source_v: null, source_w: null,
135
+ ghost_u: null, ghost_v: null, ghost_w: null,
136
+ solid: null, forward_u: null, forward_v: null, forward_w: null,
137
+ },
138
+ group_count_x: 1, group_count_y: 1, group_count_z: 1,
139
+ };
140
+
141
+ #correct = {
142
+ encoder: null,
143
+ bindings: {
144
+ step: null, parent: null, source_u: null, source_v: null, source_w: null, forward_u: null, forward_v: null, forward_w: null,
145
+ parent_u: null, parent_v: null, parent_w: null, ghost_u: null, ghost_v: null, ghost_w: null,
146
+ solid: null, forcing: null, confinement: null, out_u: null, out_v: null, out_w: null, fluid_turbulence: null,
147
+ },
148
+ group_count_x: 1, group_count_y: 1, group_count_z: 1,
149
+ };
150
+
151
+ #divergence = {
152
+ encoder: null,
153
+ bindings: { step: null, velocity_u: null, velocity_v: null, velocity_w: null, solid: null, rhs: null, words: null },
154
+ group_count_x: 1, group_count_y: 1, group_count_z: 1,
155
+ };
156
+
157
+ #ghosts = {
158
+ encoder: null,
159
+ bindings: {
160
+ step: null, parent: null, parent_u: null, parent_v: null, parent_w: null, parent_pressure: null,
161
+ ghost_u: null, ghost_v: null, ghost_w: null, ghost_pressure: null, fluid_turbulence: null,
162
+ },
163
+ group_count_x: 1, group_count_y: 1, group_count_z: 1,
164
+ };
165
+
166
+ #gradient = {
167
+ encoder: null,
168
+ bindings: {
169
+ step: null, velocity_u: null, velocity_v: null, velocity_w: null, pressure: null, ghost_pressure: null,
170
+ solid: null, out_u: null, out_v: null, out_w: null,
171
+ },
172
+ group_count_x: 1, group_count_y: 1, group_count_z: 1,
173
+ };
174
+
175
+ /**
176
+ * Where the cascade's window is.
177
+ *
178
+ * @param {ArrayLike<number>} resolution cells on each axis, each a power of two, at least 8, 8, 4
179
+ * @param {ArrayLike<number>} corner the world cell at window-local (0, 0, 0)
180
+ */
181
+ place(resolution, corner) {
182
+ for (let i = 0; i < 3; i++) {
183
+ assert.isNonNegativeInteger(resolution[i], 'resolution');
184
+ assert.ok(isPowerOfTwo(resolution[i]), 'resolution is a power of two on each axis');
185
+ assert.greaterThanOrEqual(resolution[i], GRID_TILE_SIZE[i], 'resolution holds a whole tile on each axis');
186
+ assert.isInteger(corner[i], 'corner');
187
+ }
188
+
189
+ const step = this.#step;
190
+
191
+ fluid_cascade_window_place(step.cells, corner, resolution, -1);
192
+ fluid_cascade_window_place(step.faces_u, corner, resolution, 0);
193
+ fluid_cascade_window_place(step.faces_v, corner, resolution, 1);
194
+ fluid_cascade_window_place(step.faces_w, corner, resolution, 2);
195
+
196
+ const x = resolution[0] / GRID_TILE_SIZE[0];
197
+ const y = resolution[1] / GRID_TILE_SIZE[1];
198
+ const z = resolution[2] / GRID_TILE_SIZE[2];
199
+
200
+ for (const pass of [this.#curl, this.#predict, this.#correct, this.#divergence, this.#gradient]) {
201
+ pass.group_count_x = x;
202
+ pass.group_count_y = y;
203
+ pass.group_count_z = z;
204
+ }
205
+
206
+ // the ghosts: a texel of the largest shell an invocation
207
+ const ghosts = this.#ghosts;
208
+ ghosts.group_count_x = Math.ceil((resolution[0] + 1 + 2 * FLUID_CASCADE_GHOST_DEPTH) / 4);
209
+ ghosts.group_count_y = Math.ceil((resolution[1] + 1 + 2 * FLUID_CASCADE_GHOST_DEPTH) / 4);
210
+ ghosts.group_count_z = Math.ceil((resolution[2] + 1 + 2 * FLUID_CASCADE_GHOST_DEPTH) / 4);
211
+
212
+ this.#placed = true;
213
+ }
214
+
215
+ /**
216
+ * The step about to be recorded, from `t₀` to `t₁` (GPU_FLUID_CASCADES_PROPOSAL_2026_10_16.md §6, §8).
217
+ *
218
+ * @param {number} h cell size, m
219
+ * @param {number} dt time step, s
220
+ * @param {{mean: ArrayLike<number>, sigma: number, origin: ArrayLike<number>, scale: ArrayLike<number>}} far
221
+ * `v_far(t₀)` as {@link FLUID_MAC_STEP_STRUCT} `far` holds it, over the window's cells: what the
222
+ * velocity the step starts from is a deviation from
223
+ * @param {{mean: ArrayLike<number>, sigma: number, origin: ArrayLike<number>, scale: ArrayLike<number>}} far_end
224
+ * `v_far(t₁)`, likewise
225
+ * @param {number} keep `e^(−(Λ(t₁) − Λ(t₀)))`, in [0, 1]
226
+ * @param {boolean} band whether the faces of rows 2..5 relax toward the parent
227
+ * @param {number} confinement the vorticity confinement's strength ε, per second, ≥ 0: 0 for none,
228
+ * and then {@link record_curl} is not recorded for the step
229
+ */
230
+ set_step(h, dt, far, far_end, keep, band, confinement) {
231
+ assert.isFinite(h, 'h'); assert.greaterThan(h, 0, 'h');
232
+ assert.isFinite(dt, 'dt'); assert.greaterThan(dt, 0, 'dt');
233
+ assert.isFinite(keep, 'keep');
234
+ assert.greaterThanOrEqual(keep, 0, 'keep');
235
+ assert.lessThanOrEqual(keep, 1, 'keep');
236
+ assert.isBoolean(band, 'band');
237
+ assert.isFinite(confinement, 'confinement');
238
+ assert.greaterThanOrEqual(confinement, 0, 'confinement');
239
+
240
+ const step = this.#step;
241
+
242
+ step.dt_over_h = dt / h;
243
+ step.rhs_scale = 1 / (h * dt);
244
+ step.keep = keep;
245
+ step.deviation_limit = FLUID_CASCADE_DEVIATION_CELLS * h / dt;
246
+ step.band = band ? 1 : 0;
247
+ step.confinement_dt = confinement * dt;
248
+
249
+ copy_far_field(step.far, far);
250
+ copy_far_field(step.far_end, far_end);
251
+
252
+ this.#stepped = true;
253
+ }
254
+
255
+ /**
256
+ * @param {ShadeGPUCommandContext} encoder
257
+ * @returns {GPUBuffer}
258
+ */
259
+ #uniform(encoder) {
260
+ assert.ok(this.#placed, 'placed before recording');
261
+ assert.ok(this.#stepped, 'a step set before recording');
262
+
263
+ return encoder.allocateTransientValueBuffer(FLUID_MAC_STEP_STRUCT, this.#step, GPUBufferUsage.UNIFORM);
264
+ }
265
+
266
+ /**
267
+ * The step's vorticity confinement, pass 1 (`shader_fluid_mac_curl`): the curl of the persistent
268
+ * velocity and the force it makes in every cell, for the correct pass. Recorded only for a step whose
269
+ * confinement is not 0, before {@link record_advect}.
270
+ *
271
+ * @param {ShadeGPUCommandContext} encoder
272
+ * @param {FluidMacVelocityViews} source the persistent velocity, toroidal; read
273
+ * @param {GPUBuffer} solid the window-local solid flags, `array<u32>`, bit 0
274
+ * @param {GPUBuffer} confinement written, `array<f32>` of 3·N cells, window-local
275
+ */
276
+ record_curl(encoder, source, solid, confinement) {
277
+ assert.greaterThan(this.#step.confinement_dt, 0, 'a step with confinement');
278
+
279
+ const pass = this.#curl;
280
+ const b = pass.bindings;
281
+ b.step = this.#uniform(encoder);
282
+ b.source_u = source.u; b.source_v = source.v; b.source_w = source.w;
283
+ b.solid = solid;
284
+ b.confinement = confinement;
285
+ pass.encoder = encoder;
286
+
287
+ shader_fluid_mac_curl.dispatch(pass);
288
+
289
+ pass.encoder = null;
290
+ b.confinement = null;
291
+ }
292
+
293
+ /**
294
+ * MacCormack advection of the persistent velocity by itself: predict into `forward`, then correct
295
+ * into `out`, which adds the step's confinement and the tick's forcing.
296
+ *
297
+ * @param {ShadeGPUCommandContext} encoder
298
+ * @param {FluidMacVelocityViews} source the persistent velocity, toroidal; read
299
+ * @param {FluidMacVelocityViews} forward a transient, window-local; written, then read
300
+ * @param {FluidMacVelocityViews} out a transient, window-local; written
301
+ * @param {GPUBuffer} solid the window-local solid flags, `array<u32>`: bit 0 solid, bit 1
302
+ * (`FLUID_FORCED_FLAG`) forcing written for the cell's faces
303
+ * @param {GPUBuffer} forcing the tick's forcing, `array<f32>` over the three face lattices
304
+ * (`shader_fluid_mac_advect_correct`); read only where `solid` says it was written
305
+ * @param {GPUBuffer} confinement what {@link record_curl} wrote for the step; read only when the
306
+ * step's confinement is not 0
307
+ * @param {FluidCascadeParentBindings} parent what the relaxation band reads on rows 2..5
308
+ * @param {FluidCascadeGhostBindings} ghosts the step's ghosts, written by {@link record_ghosts}
309
+ */
310
+ record_advect(encoder, source, forward, out, solid, forcing, confinement, parent, ghosts) {
311
+ assert.notEqual(source, forward, 'source and forward are different sets');
312
+ assert.notEqual(source, out, 'source and out are different sets');
313
+ assert.notEqual(forward, out, 'forward and out are different sets');
314
+
315
+ const step = this.#uniform(encoder);
316
+
317
+ const predict = this.#predict;
318
+ const p = predict.bindings;
319
+ p.step = step;
320
+ p.source_u = source.u; p.source_v = source.v; p.source_w = source.w;
321
+ p.ghost_u = ghosts.u; p.ghost_v = ghosts.v; p.ghost_w = ghosts.w;
322
+ p.solid = solid;
323
+ p.forward_u = forward.u; p.forward_v = forward.v; p.forward_w = forward.w;
324
+ predict.encoder = encoder;
325
+
326
+ shader_fluid_mac_advect_predict.dispatch(predict);
327
+
328
+ const correct = this.#correct;
329
+ const c = correct.bindings;
330
+ c.step = step;
331
+ c.parent = parent.uniform;
332
+ c.source_u = source.u; c.source_v = source.v; c.source_w = source.w;
333
+ c.forward_u = forward.u; c.forward_v = forward.v; c.forward_w = forward.w;
334
+ c.parent_u = parent.u; c.parent_v = parent.v; c.parent_w = parent.w;
335
+ c.ghost_u = ghosts.u; c.ghost_v = ghosts.v; c.ghost_w = ghosts.w;
336
+ c.solid = solid;
337
+ c.forcing = forcing;
338
+ c.confinement = confinement;
339
+ c.out_u = out.u; c.out_v = out.v; c.out_w = out.w;
340
+ c.fluid_turbulence = parent.turbulence;
341
+ correct.encoder = encoder;
342
+
343
+ shader_fluid_mac_advect_correct.dispatch(correct);
344
+
345
+ predict.encoder = null;
346
+ correct.encoder = null;
347
+ c.forcing = null;
348
+ c.confinement = null;
349
+ c.fluid_turbulence = null;
350
+ }
351
+
352
+ /**
353
+ * The step's ghosts (`shader_fluid_cascade_ghosts`): the parent's identity read at every face of the
354
+ * velocity shells and its pressure at every cell one past the window, once, for the step's passes.
355
+ *
356
+ * @param {ShadeGPUCommandContext} encoder
357
+ * @param {FluidCascadeParentBindings} parent
358
+ * @param {FluidCascadeGhostBindings} ghosts written
359
+ */
360
+ record_ghosts(encoder, parent, ghosts) {
361
+ const pass = this.#ghosts;
362
+ const b = pass.bindings;
363
+ b.step = this.#uniform(encoder);
364
+ b.parent = parent.uniform;
365
+ b.parent_u = parent.u; b.parent_v = parent.v; b.parent_w = parent.w;
366
+ b.parent_pressure = parent.pressure;
367
+ b.ghost_u = ghosts.u; b.ghost_v = ghosts.v; b.ghost_w = ghosts.w;
368
+ b.ghost_pressure = ghosts.pressure;
369
+ b.fluid_turbulence = parent.turbulence;
370
+ pass.encoder = encoder;
371
+
372
+ shader_fluid_cascade_ghosts.dispatch(pass);
373
+
374
+ pass.encoder = null;
375
+ b.fluid_turbulence = null;
376
+ }
377
+
378
+ /**
379
+ * @param {GPUDevice} device
380
+ * @param {number} size
381
+ * @returns {GPUBuffer}
382
+ */
383
+ #ensure_stand_in_words(device, size) {
384
+ if (this.#stand_in_device === device && this.#stand_in_words !== null && this.#stand_in_words.size === size) {
385
+ return this.#stand_in_words;
386
+ }
387
+
388
+ this.#stand_in_words?.destroy();
389
+ this.#stand_in_device = device;
390
+ this.#stand_in_words = device.createBuffer({
391
+ label: 'Fluid / MAC / stand-in words',
392
+ size,
393
+ usage: GPUBufferUsage.STORAGE,
394
+ });
395
+
396
+ return this.#stand_in_words;
397
+ }
398
+
399
+ /**
400
+ * The right-hand side and finest-level weight words of the pressure solve, `div/dt` at every cell,
401
+ * 0 in solid cells.
402
+ *
403
+ * @param {ShadeGPUCommandContext} encoder
404
+ * @param {FluidMacVelocityViews} velocity the advected velocity, window-local; read
405
+ * @param {GPUBuffer} solid the window-local solid flags, `array<u32>`, bit 0
406
+ * @param {GPUBuffer} rhs written, `array<f32>` of N cells, window-local, x fastest
407
+ * @param {GPUBuffer} [words] written, `array<u32>` of N cells, the finest level's weight words
408
+ */
409
+ record_divergence(encoder, velocity, solid, rhs, words = null) {
410
+ const pass = this.#divergence;
411
+ const b = pass.bindings;
412
+ b.step = this.#uniform(encoder);
413
+ b.velocity_u = velocity.u; b.velocity_v = velocity.v; b.velocity_w = velocity.w;
414
+ b.solid = solid;
415
+ b.rhs = rhs;
416
+ b.words = words ?? this.#ensure_stand_in_words(encoder.device, rhs.size);
417
+ pass.encoder = encoder;
418
+
419
+ shader_fluid_mac_divergence.dispatch(pass);
420
+
421
+ pass.encoder = null;
422
+ b.words = null;
423
+ }
424
+
425
+ /**
426
+ * The pressure gradient taken from the advected velocity, into the persistent velocity.
427
+ *
428
+ * @param {ShadeGPUCommandContext} encoder
429
+ * @param {FluidMacVelocityViews} velocity the advected velocity, window-local; read
430
+ * @param {GPUBuffer} pressure kinematic pressure, m²/s², `array<f32>` of N cells, toroidal; read
431
+ * @param {GPUBuffer} solid the window-local solid flags, `array<u32>`, bit 0
432
+ * @param {FluidMacVelocityViews} out the persistent velocity, toroidal; written
433
+ * @param {FluidCascadeGhostBindings} ghosts the step's ghosts: `pressure` is the pressure beyond the window
434
+ */
435
+ record_gradient(encoder, velocity, pressure, solid, out, ghosts) {
436
+ assert.notEqual(velocity, out, 'velocity and out are different sets');
437
+ assert.notEqual(pressure, ghosts.pressure, 'the ghosts are not the cascade\'s pressure');
438
+
439
+ const pass = this.#gradient;
440
+ const b = pass.bindings;
441
+ b.step = this.#uniform(encoder);
442
+ b.velocity_u = velocity.u; b.velocity_v = velocity.v; b.velocity_w = velocity.w;
443
+ b.pressure = pressure;
444
+ b.ghost_pressure = ghosts.pressure;
445
+ b.solid = solid;
446
+ b.out_u = out.u; b.out_v = out.v; b.out_w = out.w;
447
+ pass.encoder = encoder;
448
+
449
+ shader_fluid_mac_gradient.dispatch(pass);
450
+
451
+ pass.encoder = null;
452
+ }
453
+ }