@woosh/meep-engine 3.68.0 → 3.70.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 (584) hide show
  1. package/CHANGELOG.md +74 -0
  2. package/build/bundle-worker-terrain.js +1 -1
  3. package/editor/ecs/component/editors/ecs/Trail3DEditor.d.ts +2 -17
  4. package/editor/ecs/component/editors/ecs/Trail3DEditor.d.ts.map +1 -1
  5. package/editor/ecs/component/editors/ecs/Trail3DEditor.js +3 -18
  6. package/package.json +1 -1
  7. package/src/core/bvh8/build/BVH8Converter.d.ts +16 -0
  8. package/src/core/bvh8/build/BVH8Converter.d.ts.map +1 -1
  9. package/src/core/bvh8/build/BVH8Converter.js +64 -37
  10. package/src/core/bvh8/build/bvh8_assign_slots_greedy.d.ts +25 -0
  11. package/src/core/bvh8/build/bvh8_assign_slots_greedy.d.ts.map +1 -0
  12. package/src/core/bvh8/build/bvh8_assign_slots_greedy.js +68 -0
  13. package/src/core/bvh8/build/bvh8_from_proxy.d.ts.map +1 -1
  14. package/src/core/bvh8/build/bvh8_from_proxy.js +2 -33
  15. package/src/core/bvh8/build/bvh8_node_fit_slots.d.ts +22 -0
  16. package/src/core/bvh8/build/bvh8_node_fit_slots.d.ts.map +1 -0
  17. package/src/core/bvh8/build/bvh8_node_fit_slots.js +115 -0
  18. package/src/core/bvh8/bvh8_depth.d.ts +8 -0
  19. package/src/core/bvh8/bvh8_depth.d.ts.map +1 -0
  20. package/src/core/bvh8/bvh8_depth.js +39 -0
  21. package/src/core/math/complex/complex_fft_radix2.d.ts +19 -0
  22. package/src/core/math/complex/complex_fft_radix2.d.ts.map +1 -0
  23. package/src/core/math/complex/complex_fft_radix2.js +71 -0
  24. package/src/engine/graphics/ecs/trail3d/Trail3D.d.ts +33 -65
  25. package/src/engine/graphics/ecs/trail3d/Trail3D.d.ts.map +1 -1
  26. package/src/engine/graphics/ecs/trail3d/Trail3D.js +37 -245
  27. package/src/engine/graphics/ecs/trail3d/Trail3DFlags.d.ts +0 -4
  28. package/src/engine/graphics/ecs/trail3d/Trail3DFlags.js +4 -10
  29. package/src/engine/graphics/ecs/trail3d/seed_trail_stroke.d.ts +13 -10
  30. package/src/engine/graphics/ecs/trail3d/seed_trail_stroke.d.ts.map +1 -1
  31. package/src/engine/graphics/ecs/trail3d/seed_trail_stroke.js +28 -37
  32. package/src/engine/graphics/ecs/trail3d/trail_knot_count.d.ts +10 -0
  33. package/src/engine/graphics/ecs/trail3d/trail_knot_count.d.ts.map +1 -0
  34. package/src/engine/graphics/ecs/trail3d/trail_knot_count.js +27 -0
  35. package/src/engine/graphics/trail/TrailKnots.d.ts +62 -0
  36. package/src/engine/graphics/trail/TrailKnots.d.ts.map +1 -0
  37. package/src/engine/graphics/trail/TrailKnots.js +137 -0
  38. package/src/engine/graphics/trail/tube/TubeXMaterialSpec.d.ts +1 -1
  39. package/src/engine/graphics/trail/tube/TubeXMaterialSpec.js +1 -1
  40. package/src/engine/graphics3/EntityRowHold.d.ts +48 -0
  41. package/src/engine/graphics3/EntityRowHold.d.ts.map +1 -0
  42. package/src/engine/graphics3/EntityRowHold.js +128 -0
  43. package/src/engine/graphics3/GPUFluidSystem.d.ts +17 -4
  44. package/src/engine/graphics3/GPUFluidSystem.d.ts.map +1 -1
  45. package/src/engine/graphics3/GPUFluidSystem.js +113 -16
  46. package/src/engine/graphics3/GPUParticleEmitterSystem.d.ts +6 -2
  47. package/src/engine/graphics3/GPUParticleEmitterSystem.d.ts.map +1 -1
  48. package/src/engine/graphics3/GPUParticleEmitterSystem.js +11 -44
  49. package/src/engine/graphics3/Trail3DSystem.d.ts +69 -35
  50. package/src/engine/graphics3/Trail3DSystem.d.ts.map +1 -1
  51. package/src/engine/graphics3/Trail3DSystem.js +380 -81
  52. package/src/engine/physics/cloth/playground/wind_main.js +7 -6
  53. package/src/engine/physics/cloth/wind/AbstractClothWind.d.ts +2 -2
  54. package/src/engine/physics/cloth/wind/AbstractClothWind.js +2 -2
  55. package/src/engine/physics/cloth/wind/ClothFluidWind.d.ts +3 -3
  56. package/src/engine/physics/cloth/wind/ClothFluidWind.d.ts.map +1 -1
  57. package/src/engine/physics/cloth/wind/ClothFluidWind.js +7 -9
  58. package/src/engine/physics/cloth/wind/ClothGPUFluidWind.d.ts +10 -10
  59. package/src/engine/physics/cloth/wind/ClothGPUFluidWind.d.ts.map +1 -1
  60. package/src/engine/physics/cloth/wind/ClothGPUFluidWind.js +14 -22
  61. package/src/engine/physics/fluid/FluidAtmosphere.d.ts +16 -2
  62. package/src/engine/physics/fluid/FluidAtmosphere.d.ts.map +1 -1
  63. package/src/engine/physics/fluid/FluidAtmosphere.js +17 -3
  64. package/src/engine/physics/fluid/ecs/FluidEffectorsComponentSerializationAdapter.d.ts +1 -2
  65. package/src/engine/physics/fluid/ecs/FluidEffectorsComponentSerializationAdapter.d.ts.map +1 -1
  66. package/src/engine/physics/fluid/ecs/FluidEffectorsComponentSerializationAdapter.js +1 -2
  67. package/src/engine/physics/fluid/ecs/FluidEffectorsSystem.d.ts +8 -5
  68. package/src/engine/physics/fluid/ecs/FluidEffectorsSystem.d.ts.map +1 -1
  69. package/src/engine/physics/fluid/ecs/FluidEffectorsSystem.js +60 -17
  70. package/src/engine/physics/fluid/ecs/FluidObstacle.d.ts +17 -0
  71. package/src/engine/physics/fluid/ecs/FluidObstacle.d.ts.map +1 -1
  72. package/src/engine/physics/fluid/ecs/FluidObstacle.js +22 -2
  73. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +6 -5
  74. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts.map +1 -1
  75. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.js +14 -3
  76. package/src/engine/physics/fluid/effector/AbstractFluidEffector.d.ts +1 -1
  77. package/src/engine/physics/fluid/effector/AbstractFluidEffector.js +1 -1
  78. package/src/engine/physics/fluid/effector/GlobalFluidEffector.d.ts +33 -47
  79. package/src/engine/physics/fluid/effector/GlobalFluidEffector.d.ts.map +1 -1
  80. package/src/engine/physics/fluid/effector/GlobalFluidEffector.js +38 -176
  81. package/src/engine/physics/fluid/effector/GlobalFluidEffectorSerializationAdapter.d.ts +8 -11
  82. package/src/engine/physics/fluid/effector/GlobalFluidEffectorSerializationAdapter.d.ts.map +1 -1
  83. package/src/engine/physics/fluid/effector/GlobalFluidEffectorSerializationAdapter.js +13 -24
  84. package/src/engine/physics/fluid/effector/GlobalFluidEffectorSerializationUpgrader_0_1.d.ts +16 -0
  85. package/src/engine/physics/fluid/effector/GlobalFluidEffectorSerializationUpgrader_0_1.d.ts.map +1 -0
  86. package/src/engine/physics/fluid/effector/GlobalFluidEffectorSerializationUpgrader_0_1.js +35 -0
  87. package/src/engine/physics/fluid/fluid_apply_atmosphere.d.ts +1 -1
  88. package/src/engine/physics/fluid/fluid_apply_atmosphere.js +1 -1
  89. package/src/engine/physics/fluid/obstacle/FLUID_OBSTACLE_RECORD_STRUCT.d.ts +9 -1
  90. package/src/engine/physics/fluid/obstacle/FLUID_OBSTACLE_RECORD_STRUCT.d.ts.map +1 -1
  91. package/src/engine/physics/fluid/obstacle/FLUID_OBSTACLE_RECORD_STRUCT.js +11 -1
  92. package/src/engine/physics/fluid/obstacle/fluid_obstacle_record_create.d.ts +5 -0
  93. package/src/engine/physics/fluid/obstacle/fluid_obstacle_record_create.d.ts.map +1 -1
  94. package/src/engine/physics/fluid/obstacle/fluid_obstacle_record_create.js +2 -0
  95. package/src/engine/physics/fluid/obstacle/fluid_obstacle_write_gpu_record.d.ts +4 -3
  96. package/src/engine/physics/fluid/obstacle/fluid_obstacle_write_gpu_record.d.ts.map +1 -1
  97. package/src/engine/physics/fluid/obstacle/fluid_obstacle_write_gpu_record.js +11 -3
  98. package/src/engine/physics/fluid/turbulence/FLUID_TURBULENCE_TILE.d.ts +28 -0
  99. package/src/engine/physics/fluid/turbulence/FLUID_TURBULENCE_TILE.d.ts.map +1 -0
  100. package/src/engine/physics/fluid/turbulence/FLUID_TURBULENCE_TILE.js +29 -0
  101. package/src/engine/physics/fluid/turbulence/fluid_atmosphere_velocity_at.d.ts +16 -0
  102. package/src/engine/physics/fluid/turbulence/fluid_atmosphere_velocity_at.d.ts.map +1 -0
  103. package/src/engine/physics/fluid/turbulence/fluid_atmosphere_velocity_at.js +49 -0
  104. package/src/engine/physics/fluid/turbulence/fluid_turbulence_inverse_tile_size.d.ts +11 -0
  105. package/src/engine/physics/fluid/turbulence/fluid_turbulence_inverse_tile_size.d.ts.map +1 -0
  106. package/src/engine/physics/fluid/turbulence/fluid_turbulence_inverse_tile_size.js +18 -0
  107. package/src/engine/physics/fluid/turbulence/fluid_turbulence_tile_data.d.ts +25 -0
  108. package/src/engine/physics/fluid/turbulence/fluid_turbulence_tile_data.d.ts.map +1 -0
  109. package/src/engine/physics/fluid/turbulence/fluid_turbulence_tile_data.js +65 -0
  110. package/src/engine/physics/fluid/turbulence/fluid_turbulence_tile_generate.d.ts +56 -0
  111. package/src/engine/physics/fluid/turbulence/fluid_turbulence_tile_generate.d.ts.map +1 -0
  112. package/src/engine/physics/fluid/turbulence/fluid_turbulence_tile_generate.js +313 -0
  113. package/src/engine/physics/fluid/turbulence/fluid_turbulence_tile_sample.d.ts +16 -0
  114. package/src/engine/physics/fluid/turbulence/fluid_turbulence_tile_sample.d.ts.map +1 -0
  115. package/src/engine/physics/fluid/turbulence/fluid_turbulence_tile_sample.js +69 -0
  116. package/src/generation/foliage/mesh/branch_ring_triangulate.d.ts +1 -1
  117. package/src/generation/foliage/mesh/branch_ring_triangulate.js +1 -1
  118. package/src/shade/playground/bvh_repro/README.md +8 -6
  119. package/src/shade/playground/bvh_repro/index.html +125 -124
  120. package/src/shade/playground/bvh_repro/main.js +259 -254
  121. package/src/shade/playground/foliage_wind/foliage_world.d.ts.map +1 -1
  122. package/src/shade/playground/foliage_wind/foliage_world.js +7 -4
  123. package/src/shade/playground/grass_surfaces/main.js +3 -2
  124. package/src/shade/playground/particle_ecs/bonfire_wind.d.ts +23 -13
  125. package/src/shade/playground/particle_ecs/bonfire_wind.d.ts.map +1 -1
  126. package/src/shade/playground/particle_ecs/bonfire_wind.js +30 -33
  127. package/src/shade/playground/skinned_blas_refit/README.md +26 -14
  128. package/src/shade/playground/skinned_blas_refit/shader_blas_audit_leaf_triangles.d.ts +14 -9
  129. package/src/shade/playground/skinned_blas_refit/shader_blas_audit_leaf_triangles.d.ts.map +1 -1
  130. package/src/shade/playground/skinned_blas_refit/shader_blas_audit_leaf_triangles.js +126 -127
  131. package/src/shade/playground/skinned_blas_refit/shader_blas_audit_points.js +95 -95
  132. package/src/shade/playground/skinned_blas_refit/shader_blas_audit_visibility.d.ts +9 -1
  133. package/src/shade/playground/skinned_blas_refit/shader_blas_audit_visibility.d.ts.map +1 -1
  134. package/src/shade/playground/skinned_blas_refit/shader_blas_audit_visibility.js +146 -135
  135. package/src/shade/playground/skinned_blas_refit/verify_clone_leaves.d.ts +6 -6
  136. package/src/shade/playground/skinned_blas_refit/verify_clone_leaves.d.ts.map +1 -1
  137. package/src/shade/playground/skinned_blas_refit/verify_clone_leaves.js +148 -134
  138. package/src/shade/playground/skinned_blas_refit/verify_leaf_triangles.d.ts +11 -8
  139. package/src/shade/playground/skinned_blas_refit/verify_leaf_triangles.d.ts.map +1 -1
  140. package/src/shade/playground/skinned_blas_refit/verify_leaf_triangles.js +342 -202
  141. package/src/shade/playground/skinned_blas_refit/verify_skinned_blas_refit.d.ts +12 -13
  142. package/src/shade/playground/skinned_blas_refit/verify_skinned_blas_refit.d.ts.map +1 -1
  143. package/src/shade/playground/skinned_blas_refit/verify_skinned_blas_refit.js +136 -116
  144. package/src/shade/playground/skinned_blas_refit/verify_traversal_reachability.d.ts +4 -4
  145. package/src/shade/playground/skinned_blas_refit/verify_traversal_reachability.d.ts.map +1 -1
  146. package/src/shade/playground/skinned_blas_refit/verify_traversal_reachability.js +255 -249
  147. package/src/shade/playground/trails/index.html +50 -0
  148. package/src/shade/playground/trails/main.d.ts +2 -0
  149. package/src/shade/playground/trails/main.d.ts.map +1 -0
  150. package/src/shade/playground/trails/main.js +258 -0
  151. package/src/shade/playground/water_surface/main.js +6 -3
  152. package/src/shade/renderer/animation/GPUAnimationManager.js +2 -2
  153. package/src/shade/renderer/animation/animation_curve_write_keys.d.ts +18 -0
  154. package/src/shade/renderer/animation/animation_curve_write_keys.d.ts.map +1 -0
  155. package/src/shade/renderer/animation/animation_curve_write_keys.js +34 -0
  156. package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.d.ts.map +1 -1
  157. package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.js +7 -8
  158. package/src/shade/renderer/deferred/tonemap/ColorGrade.d.ts.map +1 -1
  159. package/src/shade/renderer/deferred/tonemap/ColorGrade.js +13 -36
  160. package/src/shade/renderer/dynamic/GPUDynamicMeshResidency.js +2 -2
  161. package/src/shade/renderer/dynamic/chunk_dynamic_mesh_avboit_vertex.d.ts +2 -13
  162. package/src/shade/renderer/dynamic/chunk_dynamic_mesh_avboit_vertex.d.ts.map +1 -1
  163. package/src/shade/renderer/dynamic/chunk_dynamic_mesh_avboit_vertex.js +6 -21
  164. package/src/shade/renderer/dynamic/graph_dynamic_mesh_avboit.d.ts +17 -6
  165. package/src/shade/renderer/dynamic/graph_dynamic_mesh_avboit.d.ts.map +1 -1
  166. package/src/shade/renderer/dynamic/graph_dynamic_mesh_avboit.js +38 -178
  167. package/src/shade/renderer/dynamic/shader_dynamic_mesh_avboit_draw.d.ts +7 -9
  168. package/src/shade/renderer/dynamic/shader_dynamic_mesh_avboit_draw.d.ts.map +1 -1
  169. package/src/shade/renderer/dynamic/shader_dynamic_mesh_avboit_draw.js +17 -106
  170. package/src/shade/renderer/dynamic/shader_dynamic_mesh_avboit_splat.d.ts +7 -17
  171. package/src/shade/renderer/dynamic/shader_dynamic_mesh_avboit_splat.d.ts.map +1 -1
  172. package/src/shade/renderer/dynamic/shader_dynamic_mesh_avboit_splat.js +18 -118
  173. package/src/shade/renderer/fluid/FLUID_FAR_FIELD_STRUCT.d.ts +111 -0
  174. package/src/shade/renderer/fluid/FLUID_FAR_FIELD_STRUCT.d.ts.map +1 -0
  175. package/src/shade/renderer/fluid/FLUID_FAR_FIELD_STRUCT.js +162 -0
  176. package/src/shade/renderer/fluid/GPUFluidCascade.d.ts +37 -8
  177. package/src/shade/renderer/fluid/GPUFluidCascade.d.ts.map +1 -1
  178. package/src/shade/renderer/fluid/GPUFluidCascade.js +149 -47
  179. package/src/shade/renderer/fluid/GPUFluidCascadeStack.d.ts +10 -3
  180. package/src/shade/renderer/fluid/GPUFluidCascadeStack.d.ts.map +1 -1
  181. package/src/shade/renderer/fluid/GPUFluidCascadeStack.js +69 -10
  182. package/src/shade/renderer/fluid/chunk_fluid_far_field.d.ts +19 -0
  183. package/src/shade/renderer/fluid/chunk_fluid_far_field.d.ts.map +1 -0
  184. package/src/shade/renderer/fluid/chunk_fluid_far_field.js +43 -0
  185. package/src/shade/renderer/fluid/coupling/FLUID_CASCADE_PARENT_STRUCT.d.ts +10 -9
  186. package/src/shade/renderer/fluid/coupling/FLUID_CASCADE_PARENT_STRUCT.d.ts.map +1 -1
  187. package/src/shade/renderer/fluid/coupling/FLUID_CASCADE_PARENT_STRUCT.js +14 -12
  188. package/src/shade/renderer/fluid/coupling/FLUID_CASCADE_RESTRICT_STRUCT.d.ts +3 -2
  189. package/src/shade/renderer/fluid/coupling/FLUID_CASCADE_RESTRICT_STRUCT.d.ts.map +1 -1
  190. package/src/shade/renderer/fluid/coupling/FLUID_CASCADE_RESTRICT_STRUCT.js +7 -5
  191. package/src/shade/renderer/fluid/coupling/chunk_fluid_cascade_epilogue.d.ts +17 -9
  192. package/src/shade/renderer/fluid/coupling/chunk_fluid_cascade_epilogue.d.ts.map +1 -1
  193. package/src/shade/renderer/fluid/coupling/chunk_fluid_cascade_epilogue.js +58 -18
  194. package/src/shade/renderer/fluid/coupling/chunk_fluid_cascade_parent.d.ts +23 -11
  195. package/src/shade/renderer/fluid/coupling/chunk_fluid_cascade_parent.d.ts.map +1 -1
  196. package/src/shade/renderer/fluid/coupling/chunk_fluid_cascade_parent.js +371 -335
  197. package/src/shade/renderer/fluid/coupling/shader_fluid_cascade_fill.d.ts.map +1 -1
  198. package/src/shade/renderer/fluid/coupling/shader_fluid_cascade_fill.js +2 -1
  199. package/src/shade/renderer/fluid/coupling/shader_fluid_cascade_ghosts.d.ts.map +1 -1
  200. package/src/shade/renderer/fluid/coupling/shader_fluid_cascade_ghosts.js +109 -108
  201. package/src/shade/renderer/fluid/coupling/shader_fluid_cascade_restrict.d.ts +5 -3
  202. package/src/shade/renderer/fluid/coupling/shader_fluid_cascade_restrict.d.ts.map +1 -1
  203. package/src/shade/renderer/fluid/coupling/shader_fluid_cascade_restrict.js +24 -12
  204. package/src/shade/renderer/fluid/forcing/FLUID_FORCING.d.ts +14 -0
  205. package/src/shade/renderer/fluid/forcing/FLUID_FORCING.d.ts.map +1 -1
  206. package/src/shade/renderer/fluid/forcing/FLUID_FORCING.js +18 -0
  207. package/src/shade/renderer/fluid/forcing/FLUID_FORCING_APPLY_STRUCT.d.ts +3 -1
  208. package/src/shade/renderer/fluid/forcing/FLUID_FORCING_APPLY_STRUCT.d.ts.map +1 -1
  209. package/src/shade/renderer/fluid/forcing/FLUID_FORCING_APPLY_STRUCT.js +4 -1
  210. package/src/shade/renderer/fluid/forcing/GPUFluidForcing.d.ts +9 -0
  211. package/src/shade/renderer/fluid/forcing/GPUFluidForcing.d.ts.map +1 -1
  212. package/src/shade/renderer/fluid/forcing/GPUFluidForcing.js +20 -4
  213. package/src/shade/renderer/fluid/forcing/chunk_fluid_forcing_cell.d.ts +11 -2
  214. package/src/shade/renderer/fluid/forcing/chunk_fluid_forcing_cell.d.ts.map +1 -1
  215. package/src/shade/renderer/fluid/forcing/chunk_fluid_forcing_cell.js +59 -2
  216. package/src/shade/renderer/fluid/forcing/shader_fluid_forcing_apply.d.ts +4 -1
  217. package/src/shade/renderer/fluid/forcing/shader_fluid_forcing_apply.d.ts.map +1 -1
  218. package/src/shade/renderer/fluid/forcing/shader_fluid_forcing_apply.js +367 -341
  219. package/src/shade/renderer/fluid/mac/FLUID_MAC_STEP_STRUCT.d.ts +6 -2
  220. package/src/shade/renderer/fluid/mac/FLUID_MAC_STEP_STRUCT.d.ts.map +1 -1
  221. package/src/shade/renderer/fluid/mac/FLUID_MAC_STEP_STRUCT.js +10 -5
  222. package/src/shade/renderer/fluid/mac/FluidMacPasses.d.ts +20 -21
  223. package/src/shade/renderer/fluid/mac/FluidMacPasses.d.ts.map +1 -1
  224. package/src/shade/renderer/fluid/mac/FluidMacPasses.js +453 -427
  225. package/src/shade/renderer/fluid/mac/shader_fluid_mac_advect_correct.d.ts +6 -2
  226. package/src/shade/renderer/fluid/mac/shader_fluid_mac_advect_correct.d.ts.map +1 -1
  227. package/src/shade/renderer/fluid/mac/shader_fluid_mac_advect_correct.js +340 -282
  228. package/src/shade/renderer/fluid/publish/FluidWindPublish.d.ts +13 -5
  229. package/src/shade/renderer/fluid/publish/FluidWindPublish.d.ts.map +1 -1
  230. package/src/shade/renderer/fluid/publish/FluidWindPublish.js +20 -10
  231. package/src/shade/renderer/fluid/publish/chunk_fluid_wind_publish_cell.d.ts +2 -2
  232. package/src/shade/renderer/fluid/publish/chunk_fluid_wind_publish_cell.js +2 -2
  233. package/src/shade/renderer/fluid/publish/shader_fluid_wind_publish.d.ts +5 -3
  234. package/src/shade/renderer/fluid/publish/shader_fluid_wind_publish.d.ts.map +1 -1
  235. package/src/shade/renderer/fluid/publish/shader_fluid_wind_publish.js +147 -142
  236. package/src/shade/renderer/fluid/query/GPUFluidQueries.js +2 -2
  237. package/src/shade/renderer/geometry/GPUGeometryManager.d.ts.map +1 -1
  238. package/src/shade/renderer/geometry/GPUGeometryManager.js +5 -7
  239. package/src/shade/renderer/geometry/MeshletGeometry.d.ts +4 -1
  240. package/src/shade/renderer/geometry/MeshletGeometry.d.ts.map +1 -1
  241. package/src/shade/renderer/geometry/MeshletGeometry.js +4 -1
  242. package/src/shade/renderer/geometry/MeshletGeometrySerializationAdapter.d.ts +20 -0
  243. package/src/shade/renderer/geometry/MeshletGeometrySerializationAdapter.d.ts.map +1 -1
  244. package/src/shade/renderer/geometry/MeshletGeometrySerializationAdapter.js +35 -3
  245. package/src/shade/renderer/geometry/blas_from_meshlets.d.ts +9 -3
  246. package/src/shade/renderer/geometry/blas_from_meshlets.d.ts.map +1 -1
  247. package/src/shade/renderer/geometry/blas_from_meshlets.js +16 -30
  248. package/src/shade/renderer/geometry/bvh/BLAS8_REFIT_TARGET_STRUCT.d.ts +14 -0
  249. package/src/shade/renderer/geometry/bvh/BLAS8_REFIT_TARGET_STRUCT.d.ts.map +1 -0
  250. package/src/shade/renderer/geometry/bvh/BLAS8_REFIT_TARGET_STRUCT.js +33 -0
  251. package/src/shade/renderer/geometry/bvh/GPUBLASRefitBatch.d.ts +18 -21
  252. package/src/shade/renderer/geometry/bvh/GPUBLASRefitBatch.d.ts.map +1 -1
  253. package/src/shade/renderer/geometry/bvh/GPUBLASRefitBatch.js +78 -158
  254. package/src/shade/renderer/geometry/bvh/GPUGeometryBVHManager.d.ts +18 -39
  255. package/src/shade/renderer/geometry/bvh/GPUGeometryBVHManager.d.ts.map +1 -1
  256. package/src/shade/renderer/geometry/bvh/GPUGeometryBVHManager.js +39 -398
  257. package/src/shade/renderer/geometry/bvh/GPUGeometryMeshletsBVH.d.ts +6 -7
  258. package/src/shade/renderer/geometry/bvh/GPUGeometryMeshletsBVH.d.ts.map +1 -1
  259. package/src/shade/renderer/geometry/bvh/GPUGeometryMeshletsBVH.js +5 -7
  260. package/src/shade/renderer/geometry/bvh/bvh8_build_for_meshlets.d.ts +36 -0
  261. package/src/shade/renderer/geometry/bvh/bvh8_build_for_meshlets.d.ts.map +1 -0
  262. package/src/shade/renderer/geometry/bvh/bvh8_build_for_meshlets.js +179 -0
  263. package/src/shade/renderer/geometry/bvh/meshlet_batch_to_clustered_bvh.d.ts +30 -0
  264. package/src/shade/renderer/geometry/bvh/meshlet_batch_to_clustered_bvh.d.ts.map +1 -0
  265. package/src/shade/renderer/geometry/bvh/meshlet_batch_to_clustered_bvh.js +207 -0
  266. package/src/shade/renderer/geometry/bvh/shader_blas8_refit_batch.d.ts +52 -0
  267. package/src/shade/renderer/geometry/bvh/shader_blas8_refit_batch.d.ts.map +1 -0
  268. package/src/shade/renderer/geometry/bvh/shader_blas8_refit_batch.js +464 -0
  269. package/src/shade/renderer/geometry/meshlet/MeshletBatch.d.ts +12 -0
  270. package/src/shade/renderer/geometry/meshlet/MeshletBatch.d.ts.map +1 -1
  271. package/src/shade/renderer/geometry/meshlet/MeshletBatch.js +37 -0
  272. package/src/shade/renderer/geometry/sdf/bake/shader_mesh_sdf_classify.d.ts.map +1 -1
  273. package/src/shade/renderer/geometry/sdf/bake/shader_mesh_sdf_classify.js +4 -4
  274. package/src/shade/renderer/geometry/sdf/bake/shader_mesh_sdf_evaluate.d.ts.map +1 -1
  275. package/src/shade/renderer/geometry/sdf/bake/shader_mesh_sdf_evaluate.js +2 -2
  276. package/src/shade/renderer/geometry/sdf/chunk_blas_query_band_sdf.d.ts.map +1 -1
  277. package/src/shade/renderer/geometry/sdf/chunk_blas_query_band_sdf.js +2 -2
  278. package/src/shade/renderer/geometry/sdf/shader_sdf_visualize.d.ts.map +1 -1
  279. package/src/shade/renderer/geometry/sdf/shader_sdf_visualize.js +4 -4
  280. package/src/shade/renderer/geometry/sdf/surface/shader_mesh_surface_trace.d.ts.map +1 -1
  281. package/src/shade/renderer/geometry/sdf/surface/shader_mesh_surface_trace.js +2 -2
  282. package/src/shade/renderer/geometry/sr_create_group_RTX.d.ts.map +1 -1
  283. package/src/shade/renderer/geometry/sr_create_group_RTX.js +4 -4
  284. package/src/shade/renderer/global_illumination/brick4/gpu/bake/brick4_bake_basic.d.ts.map +1 -1
  285. package/src/shade/renderer/global_illumination/brick4/gpu/bake/brick4_bake_basic.js +1 -0
  286. package/src/shade/renderer/global_illumination/lpv/bake/GPULightProbeVolumeRenderer.d.ts.map +1 -1
  287. package/src/shade/renderer/global_illumination/lpv/bake/GPULightProbeVolumeRenderer.js +1 -0
  288. package/src/shade/renderer/global_illumination/lpv/placement/graph_generate_probe_locations.d.ts.map +1 -1
  289. package/src/shade/renderer/global_illumination/lpv/placement/graph_generate_probe_locations.js +372 -376
  290. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/MESH_BRICK.d.ts +9 -10
  291. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/MESH_BRICK.d.ts.map +1 -1
  292. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/MESH_BRICK.js +10 -11
  293. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_walk.d.ts +2 -2
  294. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_walk.js +2 -2
  295. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_gather.d.ts +12 -8
  296. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_gather.d.ts.map +1 -1
  297. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_gather.js +109 -60
  298. package/src/shade/renderer/global_illumination/probe_clipmap/debug/graph_probe_clipmap_debug_mesh_sdf.js +2 -2
  299. package/src/shade/renderer/global_illumination/probe_clipmap/debug/graph_probe_clipmap_debug_mesh_surfaces.js +2 -2
  300. package/src/shade/renderer/gpu_primitive/bvh/BVH_BUFFER_LAYOUT.d.ts +2 -2
  301. package/src/shade/renderer/gpu_primitive/bvh/BVH_BUFFER_LAYOUT.js +70 -70
  302. package/src/shade/renderer/gpu_primitive/bvh/BVH_BUILD_SETTINGS_STRUCT.d.ts +6 -7
  303. package/src/shade/renderer/gpu_primitive/bvh/BVH_BUILD_SETTINGS_STRUCT.d.ts.map +1 -1
  304. package/src/shade/renderer/gpu_primitive/bvh/BVH_BUILD_SETTINGS_STRUCT.js +6 -7
  305. package/src/shade/renderer/gpu_primitive/bvh/graph_bvh_build_lbvh.d.ts +3 -3
  306. package/src/shade/renderer/gpu_primitive/bvh/graph_bvh_build_lbvh.js +3 -3
  307. package/src/shade/renderer/gpu_primitive/bvh/shader_bvh_build_single_workgroup.js +1 -1
  308. package/src/shade/renderer/gpu_primitive/bvh/shader_bvh_emit_hierarchy.d.ts +2 -2
  309. package/src/shade/renderer/gpu_primitive/bvh/shader_bvh_emit_hierarchy.js +3 -3
  310. package/src/shade/renderer/gpu_primitive/bvh8/BVH8_TREE_BUFFER_LAYOUT.d.ts +69 -0
  311. package/src/shade/renderer/gpu_primitive/bvh8/BVH8_TREE_BUFFER_LAYOUT.d.ts.map +1 -0
  312. package/src/shade/renderer/gpu_primitive/bvh8/BVH8_TREE_BUFFER_LAYOUT.js +89 -0
  313. package/src/shade/renderer/gpu_primitive/bvh8/bvh8_encode_from_bvh2.d.ts +41 -0
  314. package/src/shade/renderer/gpu_primitive/bvh8/bvh8_encode_from_bvh2.d.ts.map +1 -0
  315. package/src/shade/renderer/gpu_primitive/bvh8/bvh8_encode_from_bvh2.js +348 -0
  316. package/src/shade/renderer/gpu_primitive/bvh8/check_bvh8_tree.d.ts +34 -0
  317. package/src/shade/renderer/gpu_primitive/bvh8/check_bvh8_tree.d.ts.map +1 -0
  318. package/src/shade/renderer/gpu_primitive/bvh8/check_bvh8_tree.js +291 -0
  319. package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_assign.d.ts +31 -0
  320. package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_assign.d.ts.map +1 -0
  321. package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_assign.js +175 -0
  322. package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_depth.d.ts +27 -0
  323. package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_depth.d.ts.map +1 -0
  324. package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_depth.js +48 -0
  325. package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_gather.d.ts +26 -0
  326. package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_gather.d.ts.map +1 -0
  327. package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_gather.js +118 -0
  328. package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_node.d.ts +22 -0
  329. package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_node.d.ts.map +1 -0
  330. package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_node.js +143 -0
  331. package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_sums.d.ts +36 -0
  332. package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_sums.d.ts.map +1 -0
  333. package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_sums.js +97 -0
  334. package/src/shade/renderer/gpu_primitive/bvh8/graph_bvh8_encode_from_bvh2.d.ts +49 -0
  335. package/src/shade/renderer/gpu_primitive/bvh8/graph_bvh8_encode_from_bvh2.d.ts.map +1 -0
  336. package/src/shade/renderer/gpu_primitive/bvh8/graph_bvh8_encode_from_bvh2.js +265 -0
  337. package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_assign.d.ts +37 -0
  338. package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_assign.d.ts.map +1 -0
  339. package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_assign.js +109 -0
  340. package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_count.d.ts +15 -0
  341. package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_count.d.ts.map +1 -0
  342. package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_count.js +85 -0
  343. package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_count_single_workgroup.d.ts +26 -0
  344. package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_count_single_workgroup.d.ts.map +1 -0
  345. package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_count_single_workgroup.js +200 -0
  346. package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_parents.d.ts +19 -0
  347. package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_parents.d.ts.map +1 -0
  348. package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_parents.js +81 -0
  349. package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_write.d.ts +14 -0
  350. package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_write.d.ts.map +1 -0
  351. package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_write.js +101 -0
  352. package/src/shade/renderer/gpu_primitive/bvh8/verify_gpu_bvh8_encode.d.ts +19 -0
  353. package/src/shade/renderer/gpu_primitive/bvh8/verify_gpu_bvh8_encode.d.ts.map +1 -0
  354. package/src/shade/renderer/gpu_primitive/bvh8/verify_gpu_bvh8_encode.js +361 -0
  355. package/src/shade/renderer/grass/press/shader_grass_press_mark.d.ts +3 -2
  356. package/src/shade/renderer/grass/press/shader_grass_press_mark.d.ts.map +1 -1
  357. package/src/shade/renderer/grass/press/shader_grass_press_mark.js +5 -3
  358. package/src/shade/renderer/grass/surface/shader_grass_surface_bake.d.ts.map +1 -1
  359. package/src/shade/renderer/grass/surface/shader_grass_surface_bake.js +5 -6
  360. package/src/shade/renderer/lightmap/GPULightMap.d.ts.map +1 -1
  361. package/src/shade/renderer/lightmap/GPULightMap.js +1 -0
  362. package/src/shade/renderer/path_tracer/accumulating/AccumulatingPathTracer.d.ts.map +1 -1
  363. package/src/shade/renderer/path_tracer/accumulating/AccumulatingPathTracer.js +1 -0
  364. package/src/shade/renderer/path_tracer/graph_path_trace_scene.d.ts.map +1 -1
  365. package/src/shade/renderer/path_tracer/graph_path_trace_scene.js +1 -0
  366. package/src/shade/renderer/rasterize/native/avboit/avboit_unlit_draw.d.ts +49 -0
  367. package/src/shade/renderer/rasterize/native/avboit/avboit_unlit_draw.d.ts.map +1 -0
  368. package/src/shade/renderer/rasterize/native/avboit/avboit_unlit_draw.js +144 -0
  369. package/src/shade/renderer/rasterize/native/avboit/avboit_unlit_splat.d.ts +71 -0
  370. package/src/shade/renderer/rasterize/native/avboit/avboit_unlit_splat.d.ts.map +1 -0
  371. package/src/shade/renderer/rasterize/native/avboit/avboit_unlit_splat.js +152 -0
  372. package/src/shade/renderer/rasterize/native/avboit/chunk_avboit_unlit_varyings.d.ts +21 -0
  373. package/src/shade/renderer/rasterize/native/avboit/chunk_avboit_unlit_varyings.d.ts.map +1 -0
  374. package/src/shade/renderer/rasterize/native/avboit/chunk_avboit_unlit_varyings.js +30 -0
  375. package/src/shade/renderer/rasterize/native/avboit/graph_avboit_unlit.d.ts +101 -0
  376. package/src/shade/renderer/rasterize/native/avboit/graph_avboit_unlit.d.ts.map +1 -0
  377. package/src/shade/renderer/rasterize/native/avboit/graph_avboit_unlit.js +306 -0
  378. package/src/shade/renderer/rasterize/native/avboit/shader_avboit_splat.d.ts +9 -0
  379. package/src/shade/renderer/rasterize/native/avboit/shader_avboit_splat.d.ts.map +1 -1
  380. package/src/shade/renderer/rasterize/native/avboit/shader_avboit_splat.js +11 -4
  381. package/src/shade/renderer/scene/GPUInstancesAccelerationStructure.d.ts +8 -4
  382. package/src/shade/renderer/scene/GPUInstancesAccelerationStructure.d.ts.map +1 -1
  383. package/src/shade/renderer/scene/GPUInstancesAccelerationStructure.js +60 -33
  384. package/src/shade/renderer/scene/verify_gpu_tlas_build.d.ts +6 -6
  385. package/src/shade/renderer/scene/verify_gpu_tlas_build.d.ts.map +1 -1
  386. package/src/shade/renderer/scene/verify_gpu_tlas_build.js +23 -53
  387. package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/BVH8_INODE_STRUCT.d.ts +3 -1
  388. package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/BVH8_INODE_STRUCT.d.ts.map +1 -1
  389. package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/BVH8_INODE_STRUCT.js +5 -3
  390. package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/BVH8_MAX_DEPTH.d.ts +28 -0
  391. package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/BVH8_MAX_DEPTH.d.ts.map +1 -0
  392. package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/BVH8_MAX_DEPTH.js +29 -0
  393. package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_node_grid.d.ts +25 -0
  394. package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_node_grid.d.ts.map +1 -0
  395. package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_node_grid.js +97 -0
  396. package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_node_intersect.d.ts +8 -0
  397. package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_node_intersect.d.ts.map +1 -1
  398. package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_node_intersect.js +23 -14
  399. package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_node_slot_distances.d.ts +36 -0
  400. package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_node_slot_distances.d.ts.map +1 -0
  401. package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_node_slot_distances.js +222 -0
  402. package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_ray_direction_rcp.d.ts +20 -0
  403. package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_ray_direction_rcp.d.ts.map +1 -0
  404. package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_ray_direction_rcp.js +30 -0
  405. package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_tree_read.d.ts +30 -0
  406. package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_tree_read.d.ts.map +1 -0
  407. package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_tree_read.js +91 -0
  408. package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_waiting_slots.d.ts +23 -0
  409. package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_waiting_slots.d.ts.map +1 -0
  410. package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_waiting_slots.js +40 -0
  411. package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_blas_nearest.d.ts +22 -0
  412. package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_blas_nearest.d.ts.map +1 -1
  413. package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_blas_nearest.js +121 -70
  414. package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_blas_occluded.d.ts +13 -1
  415. package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_blas_occluded.d.ts.map +1 -1
  416. package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_blas_occluded.js +117 -61
  417. package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_nearest.d.ts +21 -0
  418. package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_nearest.d.ts.map +1 -1
  419. package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_nearest.js +111 -72
  420. package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_nearest_among.d.ts +1 -2
  421. package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_nearest_among.d.ts.map +1 -1
  422. package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_nearest_among.js +83 -54
  423. package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_occluded.d.ts +14 -0
  424. package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_occluded.d.ts.map +1 -1
  425. package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_occluded.js +92 -60
  426. package/src/shade/renderer/shader/chunk/sdf/chunk_point_query_blas_nearest.d.ts +22 -0
  427. package/src/shade/renderer/shader/chunk/sdf/chunk_point_query_blas_nearest.d.ts.map +1 -1
  428. package/src/shade/renderer/shader/chunk/sdf/chunk_point_query_blas_nearest.js +153 -106
  429. package/src/shade/renderer/shader/chunk/sdf/chunk_scene_point_query_nearest.d.ts +21 -0
  430. package/src/shade/renderer/shader/chunk/sdf/chunk_scene_point_query_nearest.d.ts.map +1 -1
  431. package/src/shade/renderer/shader/chunk/sdf/chunk_scene_point_query_nearest.js +115 -74
  432. package/src/shade/renderer/shader/chunk/sdf/chunk_scene_sdf_raymarch.d.ts +5 -2
  433. package/src/shade/renderer/shader/chunk/sdf/chunk_scene_sdf_raymarch.d.ts.map +1 -1
  434. package/src/shade/renderer/shader/chunk/sdf/chunk_scene_sdf_raymarch.js +89 -63
  435. package/src/shade/renderer/shader/chunk/sdf/chunk_sdf_query_distance.d.ts +15 -0
  436. package/src/shade/renderer/shader/chunk/sdf/chunk_sdf_query_distance.d.ts.map +1 -1
  437. package/src/shade/renderer/shader/chunk/sdf/chunk_sdf_query_distance.js +108 -63
  438. package/src/shade/renderer/shadow/sdf/chunk_ray_query_sdf_raycast.d.ts +14 -0
  439. package/src/shade/renderer/shadow/sdf/chunk_ray_query_sdf_raycast.d.ts.map +1 -1
  440. package/src/shade/renderer/shadow/sdf/chunk_ray_query_sdf_raycast.js +94 -60
  441. package/src/shade/renderer/shadow/sdf/graph_draw_sdf_shadows.d.ts.map +1 -1
  442. package/src/shade/renderer/shadow/sdf/graph_draw_sdf_shadows.js +4 -4
  443. package/src/shade/renderer/trails/GPUTrailAVBOITChannel.d.ts +69 -0
  444. package/src/shade/renderer/trails/GPUTrailAVBOITChannel.d.ts.map +1 -0
  445. package/src/shade/renderer/trails/GPUTrailAVBOITChannel.js +129 -0
  446. package/src/shade/renderer/trails/GPUTrailSystem.d.ts +164 -0
  447. package/src/shade/renderer/trails/GPUTrailSystem.d.ts.map +1 -0
  448. package/src/shade/renderer/trails/GPUTrailSystem.js +725 -0
  449. package/src/shade/renderer/trails/data/TRAIL_DATABASE_SPEC.d.ts +14 -0
  450. package/src/shade/renderer/trails/data/TRAIL_DATABASE_SPEC.d.ts.map +1 -0
  451. package/src/shade/renderer/trails/data/TRAIL_DATABASE_SPEC.js +38 -0
  452. package/src/shade/renderer/trails/data/TRAIL_KNOT.d.ts +66 -0
  453. package/src/shade/renderer/trails/data/TRAIL_KNOT.d.ts.map +1 -0
  454. package/src/shade/renderer/trails/data/TRAIL_KNOT.js +154 -0
  455. package/src/shade/renderer/trails/data/TRAIL_RECORD.d.ts +19 -0
  456. package/src/shade/renderer/trails/data/TRAIL_RECORD.d.ts.map +1 -0
  457. package/src/shade/renderer/trails/data/TRAIL_RECORD.js +68 -0
  458. package/src/shade/renderer/trails/data/TRAIL_STATE.d.ts +18 -0
  459. package/src/shade/renderer/trails/data/TRAIL_STATE.d.ts.map +1 -0
  460. package/src/shade/renderer/trails/data/TRAIL_STATE.js +43 -0
  461. package/src/shade/renderer/trails/graph_trails.d.ts +58 -0
  462. package/src/shade/renderer/trails/graph_trails.d.ts.map +1 -0
  463. package/src/shade/renderer/trails/graph_trails.js +155 -0
  464. package/src/shade/renderer/trails/graph_trails_avboit.d.ts +126 -0
  465. package/src/shade/renderer/trails/graph_trails_avboit.d.ts.map +1 -0
  466. package/src/shade/renderer/trails/graph_trails_avboit.js +300 -0
  467. package/src/shade/renderer/trails/runtime/TrailFadeCurves.d.ts +56 -0
  468. package/src/shade/renderer/trails/runtime/TrailFadeCurves.d.ts.map +1 -0
  469. package/src/shade/renderer/trails/runtime/TrailFadeCurves.js +220 -0
  470. package/src/shade/renderer/trails/runtime/TrailKnotPool.d.ts +49 -0
  471. package/src/shade/renderer/trails/runtime/TrailKnotPool.d.ts.map +1 -0
  472. package/src/shade/renderer/trails/runtime/TrailKnotPool.js +162 -0
  473. package/src/shade/renderer/trails/runtime/TrailParameters.d.ts +52 -0
  474. package/src/shade/renderer/trails/runtime/TrailParameters.d.ts.map +1 -0
  475. package/src/shade/renderer/trails/runtime/TrailParameters.js +126 -0
  476. package/src/shade/renderer/trails/shaders/chunk_trail_frame_transport.d.ts +23 -0
  477. package/src/shade/renderer/trails/shaders/chunk_trail_frame_transport.d.ts.map +1 -0
  478. package/src/shade/renderer/trails/shaders/chunk_trail_frame_transport.js +57 -0
  479. package/src/shade/renderer/trails/shaders/chunk_trail_knot_alpha.d.ts +14 -0
  480. package/src/shade/renderer/trails/shaders/chunk_trail_knot_alpha.d.ts.map +1 -0
  481. package/src/shade/renderer/trails/shaders/chunk_trail_knot_alpha.js +40 -0
  482. package/src/shade/renderer/trails/shaders/chunk_trail_seed.d.ts +18 -0
  483. package/src/shade/renderer/trails/shaders/chunk_trail_seed.d.ts.map +1 -0
  484. package/src/shade/renderer/trails/shaders/chunk_trail_seed.js +64 -0
  485. package/src/shade/renderer/trails/shaders/chunk_trail_segment.d.ts +14 -0
  486. package/src/shade/renderer/trails/shaders/chunk_trail_segment.d.ts.map +1 -0
  487. package/src/shade/renderer/trails/shaders/chunk_trail_segment.js +51 -0
  488. package/src/shade/renderer/trails/shaders/chunk_trail_update.d.ts +48 -0
  489. package/src/shade/renderer/trails/shaders/chunk_trail_update.d.ts.map +1 -0
  490. package/src/shade/renderer/trails/shaders/chunk_trail_update.js +197 -0
  491. package/src/shade/renderer/trails/shaders/chunk_trail_vertex.d.ts +34 -0
  492. package/src/shade/renderer/trails/shaders/chunk_trail_vertex.d.ts.map +1 -0
  493. package/src/shade/renderer/trails/shaders/chunk_trail_vertex.js +111 -0
  494. package/src/shade/renderer/trails/shaders/shader_trail_avboit.d.ts +24 -0
  495. package/src/shade/renderer/trails/shaders/shader_trail_avboit.d.ts.map +1 -0
  496. package/src/shade/renderer/trails/shaders/shader_trail_avboit.js +78 -0
  497. package/src/shade/renderer/trails/shaders/shader_trail_avboit_segments.d.ts +23 -0
  498. package/src/shade/renderer/trails/shaders/shader_trail_avboit_segments.d.ts.map +1 -0
  499. package/src/shade/renderer/trails/shaders/shader_trail_avboit_segments.js +130 -0
  500. package/src/shade/renderer/trails/shaders/shader_trail_draw_args.d.ts +29 -0
  501. package/src/shade/renderer/trails/shaders/shader_trail_draw_args.d.ts.map +1 -0
  502. package/src/shade/renderer/trails/shaders/shader_trail_draw_args.js +78 -0
  503. package/src/shade/renderer/trails/shaders/shader_trail_seed.d.ts +18 -0
  504. package/src/shade/renderer/trails/shaders/shader_trail_seed.d.ts.map +1 -0
  505. package/src/shade/renderer/trails/shaders/shader_trail_seed.js +79 -0
  506. package/src/shade/renderer/trails/shaders/shader_trail_update.d.ts +20 -0
  507. package/src/shade/renderer/trails/shaders/shader_trail_update.d.ts.map +1 -0
  508. package/src/shade/renderer/trails/shaders/shader_trail_update.js +101 -0
  509. package/src/shade/renderer/volumetrics/graph_build_volumetrics.js +2 -2
  510. package/src/shade/renderer/water/query/shader_water_surface_query.d.ts.map +1 -1
  511. package/src/shade/renderer/water/query/shader_water_surface_query.js +227 -227
  512. package/src/shade/renderer/water/surface/particles/chunk_water_particle_step.d.ts.map +1 -1
  513. package/src/shade/renderer/water/surface/particles/chunk_water_particle_step.js +7 -4
  514. package/src/shade/renderer/water/surface/particles/shader_water_particles.js +2 -2
  515. package/src/shade/renderer/wind/GPUSceneWind.d.ts +36 -4
  516. package/src/shade/renderer/wind/GPUSceneWind.d.ts.map +1 -1
  517. package/src/shade/renderer/wind/GPUSceneWind.js +150 -4
  518. package/src/shade/renderer/wind/WIND_FIELD_STRUCT.d.ts +9 -3
  519. package/src/shade/renderer/wind/WIND_FIELD_STRUCT.d.ts.map +1 -1
  520. package/src/shade/renderer/wind/WIND_FIELD_STRUCT.js +13 -3
  521. package/src/shade/renderer/wind/WIND_FIELD_UNIFORM.d.ts +6 -6
  522. package/src/shade/renderer/wind/WIND_FIELD_UNIFORM.js +6 -6
  523. package/src/shade/renderer/wind/chunk_fluid_turbulence.d.ts +39 -0
  524. package/src/shade/renderer/wind/chunk_fluid_turbulence.d.ts.map +1 -0
  525. package/src/shade/renderer/wind/chunk_fluid_turbulence.js +63 -0
  526. package/src/shade/renderer/wind/chunk_wind_field_sample_cascades.d.ts +10 -7
  527. package/src/shade/renderer/wind/chunk_wind_field_sample_cascades.d.ts.map +1 -1
  528. package/src/shade/renderer/wind/chunk_wind_field_sample_cascades.js +34 -11
  529. package/src/shade/renderer/wind/chunk_wind_field_sample_uniform.d.ts +2 -2
  530. package/src/shade/renderer/wind/chunk_wind_field_sample_uniform.js +2 -2
  531. package/src/shade/renderer/wind/wind_field_add_resources.d.ts +6 -4
  532. package/src/shade/renderer/wind/wind_field_add_resources.d.ts.map +1 -1
  533. package/src/shade/renderer/wind/wind_field_add_resources.js +9 -6
  534. package/src/engine/graphics/ecs/trail3d/advance_trail.d.ts +0 -18
  535. package/src/engine/graphics/ecs/trail3d/advance_trail.d.ts.map +0 -1
  536. package/src/engine/graphics/ecs/trail3d/advance_trail.js +0 -42
  537. package/src/engine/graphics/ecs/trail3d/seed_trail_tube.d.ts +0 -14
  538. package/src/engine/graphics/ecs/trail3d/seed_trail_tube.d.ts.map +0 -1
  539. package/src/engine/graphics/ecs/trail3d/seed_trail_tube.js +0 -75
  540. package/src/engine/graphics/ecs/trail3d/trail_head_position.d.ts +0 -17
  541. package/src/engine/graphics/ecs/trail3d/trail_head_position.d.ts.map +0 -1
  542. package/src/engine/graphics/ecs/trail3d/trail_head_position.js +0 -19
  543. package/src/engine/graphics/trail/tube/TubeX.d.ts +0 -186
  544. package/src/engine/graphics/trail/tube/TubeX.d.ts.map +0 -1
  545. package/src/engine/graphics/trail/tube/TubeX.js +0 -575
  546. package/src/engine/graphics/trail/tube/simulator/TubeXFixedPhysicsSimulator.d.ts +0 -16
  547. package/src/engine/graphics/trail/tube/simulator/TubeXFixedPhysicsSimulator.d.ts.map +0 -1
  548. package/src/engine/graphics/trail/tube/simulator/TubeXFixedPhysicsSimulator.js +0 -34
  549. package/src/engine/graphics/trail/tube/tube_attributes_spec.d.ts +0 -27
  550. package/src/engine/graphics/trail/tube/tube_attributes_spec.d.ts.map +0 -1
  551. package/src/engine/graphics/trail/tube/tube_attributes_spec.js +0 -70
  552. package/src/engine/graphics3/trail/trail_tube_write_geometry.d.ts +0 -38
  553. package/src/engine/graphics3/trail/trail_tube_write_geometry.d.ts.map +0 -1
  554. package/src/engine/graphics3/trail/trail_tube_write_geometry.js +0 -119
  555. package/src/shade/renderer/geometry/bvh/BLAS_REFIT_TARGET_STRUCT.d.ts +0 -18
  556. package/src/shade/renderer/geometry/bvh/BLAS_REFIT_TARGET_STRUCT.d.ts.map +0 -1
  557. package/src/shade/renderer/geometry/bvh/BLAS_REFIT_TARGET_STRUCT.js +0 -50
  558. package/src/shade/renderer/geometry/bvh/bvh2_derive_topology.d.ts +0 -23
  559. package/src/shade/renderer/geometry/bvh/bvh2_derive_topology.d.ts.map +0 -1
  560. package/src/shade/renderer/geometry/bvh/bvh2_derive_topology.js +0 -87
  561. package/src/shade/renderer/geometry/bvh/shader_blas_refit_batch.d.ts +0 -42
  562. package/src/shade/renderer/geometry/bvh/shader_blas_refit_batch.d.ts.map +0 -1
  563. package/src/shade/renderer/geometry/bvh/shader_blas_refit_batch.js +0 -141
  564. package/src/shade/renderer/geometry/bvh/shader_blas_refit_batch_seed.d.ts +0 -21
  565. package/src/shade/renderer/geometry/bvh/shader_blas_refit_batch_seed.d.ts.map +0 -1
  566. package/src/shade/renderer/geometry/bvh/shader_blas_refit_batch_seed.js +0 -75
  567. package/src/shade/renderer/geometry/meshlet_batch_to_bvh.d.ts +0 -17
  568. package/src/shade/renderer/geometry/meshlet_batch_to_bvh.d.ts.map +0 -1
  569. package/src/shade/renderer/geometry/meshlet_batch_to_bvh.js +0 -247
  570. package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_ray_query_blas_occlusion.d.ts +0 -7
  571. package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_ray_query_blas_occlusion.d.ts.map +0 -1
  572. package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_ray_query_blas_occlusion.js +0 -226
  573. package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_mask_visibility_via_rays.d.ts +0 -8
  574. package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_mask_visibility_via_rays.d.ts.map +0 -1
  575. package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_mask_visibility_via_rays.js +0 -45
  576. package/src/shade/renderer/shader/chunk/light/sample/chunk_ray_sample_light.d.ts +0 -3
  577. package/src/shade/renderer/shader/chunk/light/sample/chunk_ray_sample_light.d.ts.map +0 -1
  578. package/src/shade/renderer/shader/chunk/light/sample/chunk_ray_sample_light.js +0 -105
  579. package/src/shade/renderer/shadow/sdf/chunk_ray_query_sdf_distance.d.ts +0 -6
  580. package/src/shade/renderer/shadow/sdf/chunk_ray_query_sdf_distance.d.ts.map +0 -1
  581. package/src/shade/renderer/shadow/sdf/chunk_ray_query_sdf_distance.js +0 -86
  582. package/src/shade/renderer/shadow/sdf/chunk_ray_query_sdf_raycast_traversal_count.d.ts +0 -2
  583. package/src/shade/renderer/shadow/sdf/chunk_ray_query_sdf_raycast_traversal_count.d.ts.map +0 -1
  584. package/src/shade/renderer/shadow/sdf/chunk_ray_query_sdf_raycast_traversal_count.js +0 -136
@@ -6,6 +6,7 @@ import { GPUFluidCascade } from "./GPUFluidCascade.js";
6
6
  import { FluidAtmosphere } from "../../../engine/physics/fluid/FluidAtmosphere.js";
7
7
  import { fluid_cascade_parent_value } from "./coupling/FLUID_CASCADE_PARENT_STRUCT.js";
8
8
  import { FluidWindPublish } from "./publish/FluidWindPublish.js";
9
+ import { fluid_far_field_value } from "./FLUID_FAR_FIELD_STRUCT.js";
9
10
 
10
11
  /**
11
12
  * @typedef {import("../../../engine/graphics/render/frame_graph/FrameGraph.js").FrameGraph} FrameGraph
@@ -59,7 +60,9 @@ export const GPU_FLUID_CASCADE_STACK_LIMIT = 8;
59
60
  * `read_keep` (`k`). All retained: nothing is allocated to read them.
60
61
  *
61
62
  * Created placed around `anchor` and filled from the far field of `atmosphere` (velocity `v_far`,
62
- * pressure 0); after that nothing is allocated per tick.
63
+ * pressure 0): its mean at creation, and with turbulence, at the first tick that has any, every
64
+ * cascade's whole window filled from its parent, coarsest first, so the coarsest takes the far field's
65
+ * eddies exactly and every finer one its parent's. After that nothing is allocated per tick.
63
66
  */
64
67
  export class GPUFluidCascadeStack {
65
68
  /**
@@ -105,6 +108,12 @@ export class GPUFluidCascadeStack {
105
108
 
106
109
  #destroyed = false;
107
110
 
111
+ /** Whether the windows hold the far field's turbulence yet: filled whole at the first tick with any. */
112
+ #seeded = false;
113
+
114
+ /** One box, a whole window, as `GPUFluidCascade#record_fill` takes it. */
115
+ #whole = new Int32Array(6);
116
+
108
117
  /**
109
118
  * Whether rows 2..5 of every cascade relax toward its parent (§9). On by design; off for the seam
110
119
  * probes' A/B.
@@ -159,7 +168,7 @@ export class GPUFluidCascadeStack {
159
168
 
160
169
  this.#publish_records.push({
161
170
  corner: new Int32Array(3),
162
- far_velocity: new Float32Array(3),
171
+ far: fluid_far_field_value(),
163
172
  parent: fluid_cascade_parent_value(),
164
173
  parent_faces: { u: null, v: null, w: null, pressure: null },
165
174
  });
@@ -248,8 +257,11 @@ export class GPUFluidCascadeStack {
248
257
  * @param {number} [options.vorticity_confinement] its strength ε, per second, ≥ 0, for both of the
249
258
  * tick's steps, each with its own cell and step (`GPUFluidCascade#record_step`); 0, the default,
250
259
  * records no curl pass
260
+ * @param {GPUTextureView|null} [options.turbulence] the far field's turbulence tile
261
+ * (`GPUSceneWind#turbulence`), which every pass that reads the far field binds; `null`, the default,
262
+ * only for a far field with none
251
263
  */
252
- record_tick({ graph, tick, dt, anchor, atmosphere, atmosphere_offset, forcing = null, vorticity_confinement = 0 }) {
264
+ record_tick({ graph, tick, dt, anchor, atmosphere, atmosphere_offset, forcing = null, vorticity_confinement = 0, turbulence = null }) {
253
265
  assert.notOk(this.#destroyed, 'the stack is destroyed');
254
266
  assert.defined(graph, 'graph');
255
267
  assert.isNonNegativeInteger(tick, 'tick');
@@ -288,10 +300,30 @@ export class GPUFluidCascadeStack {
288
300
  const box_count = window_scroll_regions(this.#old_corner, this.#new_corner, this.#resolution, 3, this.#boxes);
289
301
 
290
302
  cascade.place(this.#new_corner);
291
- cascade.record_fill({ graph, boxes: this.#boxes, box_count, parent: c + 1 < count ? cascades[c + 1] : null });
303
+ cascade.record_fill({ graph, boxes: this.#boxes, box_count, parent: c + 1 < count ? cascades[c + 1] : null, turbulence });
292
304
  this.#unpublished[c] = 1;
293
305
  }
294
306
 
307
+ // the far field's eddies into every window, once: the windows were made at its mean
308
+ if (!this.#seeded && atmosphere[atmosphere_offset + FluidAtmosphere.TURBULENCE_SIGMA] !== 0) {
309
+ const whole = this.#whole;
310
+
311
+ for (let c = count - 1; c >= 0; c--) {
312
+ const cascade = cascades[c];
313
+ const corner = cascade.corner;
314
+
315
+ for (let axis = 0; axis < 3; axis++) {
316
+ whole[axis] = corner[axis];
317
+ whole[3 + axis] = corner[axis] + this.#resolution[axis];
318
+ }
319
+
320
+ cascade.record_fill({ graph, boxes: whole, box_count: 1, parent: c + 1 < count ? cascades[c + 1] : null, turbulence });
321
+ this.#unpublished[c] = 1;
322
+ }
323
+
324
+ this.#seeded = true;
325
+ }
326
+
295
327
  const band = this.relaxation_band;
296
328
 
297
329
  // the brick queries of both stepping cascades, against the windows they step in
@@ -306,7 +338,7 @@ export class GPUFluidCascadeStack {
306
338
  this.#unpublished[coarse] = 1;
307
339
 
308
340
  if (this.feedback) {
309
- cascade.record_restrict({ graph, child: cascades[coarse - 1] });
341
+ cascade.record_restrict({ graph, child: cascades[coarse - 1], turbulence });
310
342
  }
311
343
 
312
344
  // after the restriction, which would overwrite the walls it pins
@@ -321,6 +353,7 @@ export class GPUFluidCascadeStack {
321
353
  relaxation_band: band,
322
354
  forcing: coarse_forcing,
323
355
  vorticity_confinement,
356
+ turbulence,
324
357
  });
325
358
  }
326
359
 
@@ -335,6 +368,7 @@ export class GPUFluidCascadeStack {
335
368
  relaxation_band: band,
336
369
  forcing: fine_forcing,
337
370
  vorticity_confinement,
371
+ turbulence,
338
372
  });
339
373
 
340
374
  this.#unpublished[0] = 1;
@@ -349,7 +383,8 @@ export class GPUFluidCascadeStack {
349
383
  * wind.set_cascades(count, resolution)
350
384
  * wind.set_cascade_window(c, corner, cell_size) every cascade
351
385
  * wind.set_cascade_decay(c, k) k = e^(−(Λ(t) − Λ(t_s,c))), read_keep
352
- * wind.set_far_velocity(v_far(t))
386
+ * wind.set_far_velocity(u(t)) the far field's mean
387
+ * wind.set_turbulence(σ, offset, L) its turbulence
353
388
  *
354
389
  * A tile holds `v − v_far(t_s,c)` and `k` is taken for `t`, so a cascade that did not step reads
355
390
  * from its old tile through its new decay. A cascade that is published takes the field's
@@ -393,7 +428,7 @@ export class GPUFluidCascadeStack {
393
428
  const record = this.#publish_records[c];
394
429
 
395
430
  record.corner.set(cascade.corner);
396
- record.far_velocity.set(cascade.read_far_velocity);
431
+ cascade.describe_far(record.far);
397
432
  cascade.describe_parent(record.parent, record.parent_faces, c + 1 < count ? cascades[c + 1] : null);
398
433
 
399
434
  // its tile is written beside the one the frame before read
@@ -409,6 +444,11 @@ export class GPUFluidCascadeStack {
409
444
  far[2] = atmosphere[atmosphere_offset + FluidAtmosphere.VELOCITY_Z];
410
445
 
411
446
  wind.set_far_velocity(far);
447
+ wind.set_turbulence(
448
+ atmosphere[atmosphere_offset + FluidAtmosphere.TURBULENCE_SIGMA],
449
+ this.#turbulence_offset_of(atmosphere, atmosphere_offset),
450
+ atmosphere[atmosphere_offset + FluidAtmosphere.TURBULENCE_LENGTH]
451
+ );
412
452
 
413
453
  if (pending === 0) {
414
454
  return;
@@ -421,7 +461,25 @@ export class GPUFluidCascadeStack {
421
461
  }
422
462
 
423
463
  /** The options {@link FluidWindPublish#record} takes, rewritten for every cascade. */
424
- #publish_options = { encoder: null, velocity: null, corner: null, far_velocity: null, parent: null, parent_faces: null, atlas: null, slot: 0 };
464
+ #publish_options = { encoder: null, velocity: null, corner: null, far: null, turbulence: null, parent: null, parent_faces: null, atlas: null, slot: 0 };
465
+
466
+ /** Scratch for an atmosphere's turbulence offset. */
467
+ #turbulence_offset = new Float64Array(3);
468
+
469
+ /**
470
+ * @param {Float64Array|number[]} atmosphere
471
+ * @param {number} offset
472
+ * @returns {Float64Array}
473
+ */
474
+ #turbulence_offset_of(atmosphere, offset) {
475
+ const out = this.#turbulence_offset;
476
+
477
+ out[0] = atmosphere[offset + FluidAtmosphere.TURBULENCE_OFFSET_X];
478
+ out[1] = atmosphere[offset + FluidAtmosphere.TURBULENCE_OFFSET_Y];
479
+ out[2] = atmosphere[offset + FluidAtmosphere.TURBULENCE_OFFSET_Z];
480
+
481
+ return out;
482
+ }
425
483
 
426
484
  /**
427
485
  * @param {object} pass
@@ -440,6 +498,7 @@ export class GPUFluidCascadeStack {
440
498
 
441
499
  options.encoder = context.encoder;
442
500
  options.atlas = wind.atlas;
501
+ options.turbulence = wind.turbulence;
443
502
 
444
503
  try {
445
504
  for (let i = 0; i < pass.count; i++) {
@@ -448,7 +507,7 @@ export class GPUFluidCascadeStack {
448
507
 
449
508
  options.velocity = stack.#cascades[c].velocity;
450
509
  options.corner = record.corner;
451
- options.far_velocity = record.far_velocity;
510
+ options.far = record.far;
452
511
  options.parent = record.parent;
453
512
  options.parent_faces = record.parent_faces;
454
513
  options.slot = wind.slot(c);
@@ -456,7 +515,7 @@ export class GPUFluidCascadeStack {
456
515
  stack.#publish.record(options);
457
516
  }
458
517
  } finally {
459
- options.encoder = options.atlas = options.velocity = options.corner = options.far_velocity = null;
518
+ options.encoder = options.atlas = options.velocity = options.corner = options.far = options.turbulence = null;
460
519
  options.parent = options.parent_faces = null;
461
520
  pass.wind = null;
462
521
  }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * The far field laid over a lattice ({@link FLUID_FAR_FIELD_STRUCT}), at the lattice's cell coordinate
3
+ * `c` (cell centres at integers; a u face `(i, j, k)` at `(i − ½, j, k)`):
4
+ *
5
+ * - `fluid_far_unit(far, c)`: `T(origin + c ⊙ scale)` at level `far.lod`, the unit-rms turbulence there,
6
+ * one tap of the tile; `vec3(0)` with no turbulence, and then no tap;
7
+ * - `fluid_far_field(far, c)`: `mean + sigma · T`, the far field there; `mean` exactly with no
8
+ * turbulence.
9
+ *
10
+ * Every lattice point of every pass branches on `sigma` from a uniform, so the branch is uniform too:
11
+ * a far field with no turbulence costs a compare.
12
+ *
13
+ * Binds the tile and its sampler (`fluid_turbulence_add_resources`).
14
+ *
15
+ * @type {CodeChunk}
16
+ */
17
+ export const chunk_fluid_far_field: CodeChunk;
18
+ import { CodeChunk } from "../shader/compiler/CodeChunk.js";
19
+ //# sourceMappingURL=chunk_fluid_far_field.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk_fluid_far_field.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/fluid/chunk_fluid_far_field.js"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;GAeG;AACH,oCAFU,SAAS,CAwBjB;0BA1CwB,iCAAiC"}
@@ -0,0 +1,43 @@
1
+ import { CodeChunk } from "../shader/compiler/CodeChunk.js";
2
+ import { chunk_fluid_turbulence } from "../wind/chunk_fluid_turbulence.js";
3
+ import { FLUID_FAR_FIELD_STRUCT } from "./FLUID_FAR_FIELD_STRUCT.js";
4
+
5
+ /**
6
+ * The far field laid over a lattice ({@link FLUID_FAR_FIELD_STRUCT}), at the lattice's cell coordinate
7
+ * `c` (cell centres at integers; a u face `(i, j, k)` at `(i − ½, j, k)`):
8
+ *
9
+ * - `fluid_far_unit(far, c)`: `T(origin + c ⊙ scale)` at level `far.lod`, the unit-rms turbulence there,
10
+ * one tap of the tile; `vec3(0)` with no turbulence, and then no tap;
11
+ * - `fluid_far_field(far, c)`: `mean + sigma · T`, the far field there; `mean` exactly with no
12
+ * turbulence.
13
+ *
14
+ * Every lattice point of every pass branches on `sigma` from a uniform, so the branch is uniform too:
15
+ * a far field with no turbulence costs a compare.
16
+ *
17
+ * Binds the tile and its sampler (`fluid_turbulence_add_resources`).
18
+ *
19
+ * @type {CodeChunk}
20
+ */
21
+ export const chunk_fluid_far_field = CodeChunk.from(
22
+ //language=WGSL
23
+ `
24
+ fn fluid_far_unit(far: ${FLUID_FAR_FIELD_STRUCT.wgsl_ref}, c: vec3<f32>) -> vec3<f32> {
25
+ if (far.sigma == 0.0) {
26
+ return vec3<f32>(0.0);
27
+ }
28
+
29
+ return fluid_turbulence_at(far.origin + c * far.scale, far.lod);
30
+ }
31
+
32
+ fn fluid_far_field(far: ${FLUID_FAR_FIELD_STRUCT.wgsl_ref}, c: vec3<f32>) -> vec3<f32> {
33
+ if (far.sigma == 0.0) {
34
+ return far.mean;
35
+ }
36
+
37
+ return far.mean + far.sigma * fluid_turbulence_at(far.origin + c * far.scale, far.lod);
38
+ }
39
+ `, [
40
+ FLUID_FAR_FIELD_STRUCT.declaration_chunk,
41
+ chunk_fluid_turbulence,
42
+ ]
43
+ );
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * A {@link FLUID_CASCADE_PARENT_STRUCT} value, to be filled in place (`GPUFluidCascade#describe_parent`).
3
3
  *
4
- * @returns {{origin: Int32Array, keep: number, cells: object, faces_u: object, faces_v: object, faces_w: object, far_velocity: Float32Array, read_far_velocity: Float32Array}}
4
+ * @returns {{origin: Int32Array, keep: number, cells: object, faces_u: object, faces_v: object, faces_w: object, far: object, read: object}}
5
5
  */
6
6
  export function fluid_cascade_parent_value(): {
7
7
  origin: Int32Array;
@@ -10,8 +10,8 @@ export function fluid_cascade_parent_value(): {
10
10
  faces_u: object;
11
11
  faces_v: object;
12
12
  faces_w: object;
13
- far_velocity: Float32Array;
14
- read_far_velocity: Float32Array;
13
+ far: object;
14
+ read: object;
15
15
  };
16
16
  /**
17
17
  * A cascade's parent as the cascade reads it beyond its own window, the uniform `parent`
@@ -27,16 +27,17 @@ export function fluid_cascade_parent_value(): {
27
27
  * - `cells`: where the parent's pressure is stored ({@link GRID_TILE_WINDOW_STRUCT}, in the parent's
28
28
  * cells).
29
29
  * - `faces_u`, `faces_v`, `faces_w`: where the parent's faces are stored.
30
- * - `far_velocity`: `v_far(t_s,p)`, m/s, the far field at the parent's last step: what its faces are
31
- * a deviation from.
32
- * - `read_far_velocity`: `v_far` at the instant the child reads at, m/s.
30
+ * - `far`: `v_far(t_s,p)`, the far field at the parent's last step: what its faces are a deviation
31
+ * from ({@link FLUID_FAR_FIELD_STRUCT}, over the child's lattice, cell coordinate 0 at the child-lattice
32
+ * cell `origin`).
33
+ * - `read`: `v_far` at the instant the child reads at, over the same lattice.
33
34
  * - `keep`: `e^(−(Λ(t_read) − Λ(t_s,p)))`, how much of the parent's deviation the read keeps.
34
35
  *
35
- * So the parent's identity read of a face value `v` is `read_far_velocity + (v − far_velocity)·keep`
36
- * (§6), and a read beyond the parent's window is `read_far_velocity`.
36
+ * So the parent's identity read of a face value `v` at `x` is `read(x) + (v − far(x))·keep` (§6), and a
37
+ * read beyond the parent's window is `read(x)`.
37
38
  *
38
39
  * **The far field is a parent with no window**: every window's size is 0, so every read lands
39
- * beyond it, velocity reads `read_far_velocity` and pressure 0. The coarsest cascade, and a cascade
40
+ * beyond it, velocity reads `read(x)` and pressure 0. The coarsest cascade, and a cascade
40
41
  * stepped on its own, read that.
41
42
  *
42
43
  * @type {WebGPUStruct}
@@ -1 +1 @@
1
- {"version":3,"file":"FLUID_CASCADE_PARENT_STRUCT.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/fluid/coupling/FLUID_CASCADE_PARENT_STRUCT.js"],"names":[],"mappings":"AA4CA;;;;GAIG;AACH,8CAFa;IAAC,MAAM,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,YAAY,CAAC;IAAC,iBAAiB,EAAE,YAAY,CAAA;CAAC,CAa7K;AAvDD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,0CAFU,YAAY,CAWG;6BAxCI,mCAAmC"}
1
+ {"version":3,"file":"FLUID_CASCADE_PARENT_STRUCT.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/fluid/coupling/FLUID_CASCADE_PARENT_STRUCT.js"],"names":[],"mappings":"AA8CA;;;;GAIG;AACH,8CAFa;IAAC,MAAM,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,CAa3I;AAxDD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,0CAFU,YAAY,CAWG;6BA1CI,mCAAmC"}
@@ -1,7 +1,8 @@
1
1
  import { GRID_TILE_WINDOW_STRUCT } from "../../shader/chunk/grid/GRID_TILE_WINDOW_STRUCT.js";
2
- import { f32, vec3f, vec3i } from "../../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
2
+ import { f32, vec3i } from "../../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
3
3
  import { WebGPUStruct } from "../../shader/type/WebGPUStruct.js";
4
4
  import { fluid_cascade_window_value } from "../fluid_cascade_window.js";
5
+ import { FLUID_FAR_FIELD_STRUCT, fluid_far_field_value } from "../FLUID_FAR_FIELD_STRUCT.js";
5
6
 
6
7
  /**
7
8
  * A cascade's parent as the cascade reads it beyond its own window, the uniform `parent`
@@ -17,16 +18,17 @@ import { fluid_cascade_window_value } from "../fluid_cascade_window.js";
17
18
  * - `cells`: where the parent's pressure is stored ({@link GRID_TILE_WINDOW_STRUCT}, in the parent's
18
19
  * cells).
19
20
  * - `faces_u`, `faces_v`, `faces_w`: where the parent's faces are stored.
20
- * - `far_velocity`: `v_far(t_s,p)`, m/s, the far field at the parent's last step: what its faces are
21
- * a deviation from.
22
- * - `read_far_velocity`: `v_far` at the instant the child reads at, m/s.
21
+ * - `far`: `v_far(t_s,p)`, the far field at the parent's last step: what its faces are a deviation
22
+ * from ({@link FLUID_FAR_FIELD_STRUCT}, over the child's lattice, cell coordinate 0 at the child-lattice
23
+ * cell `origin`).
24
+ * - `read`: `v_far` at the instant the child reads at, over the same lattice.
23
25
  * - `keep`: `e^(−(Λ(t_read) − Λ(t_s,p)))`, how much of the parent's deviation the read keeps.
24
26
  *
25
- * So the parent's identity read of a face value `v` is `read_far_velocity + (v − far_velocity)·keep`
26
- * (§6), and a read beyond the parent's window is `read_far_velocity`.
27
+ * So the parent's identity read of a face value `v` at `x` is `read(x) + (v − far(x))·keep` (§6), and a
28
+ * read beyond the parent's window is `read(x)`.
27
29
  *
28
30
  * **The far field is a parent with no window**: every window's size is 0, so every read lands
29
- * beyond it, velocity reads `read_far_velocity` and pressure 0. The coarsest cascade, and a cascade
31
+ * beyond it, velocity reads `read(x)` and pressure 0. The coarsest cascade, and a cascade
30
32
  * stepped on its own, read that.
31
33
  *
32
34
  * @type {WebGPUStruct}
@@ -38,14 +40,14 @@ export const FLUID_CASCADE_PARENT_STRUCT = WebGPUStruct.from({
38
40
  faces_u: GRID_TILE_WINDOW_STRUCT,
39
41
  faces_v: GRID_TILE_WINDOW_STRUCT,
40
42
  faces_w: GRID_TILE_WINDOW_STRUCT,
41
- far_velocity: vec3f,
42
- read_far_velocity: vec3f,
43
+ far: FLUID_FAR_FIELD_STRUCT,
44
+ read: FLUID_FAR_FIELD_STRUCT,
43
45
  }, 'FluidCascadeParent');
44
46
 
45
47
  /**
46
48
  * A {@link FLUID_CASCADE_PARENT_STRUCT} value, to be filled in place (`GPUFluidCascade#describe_parent`).
47
49
  *
48
- * @returns {{origin: Int32Array, keep: number, cells: object, faces_u: object, faces_v: object, faces_w: object, far_velocity: Float32Array, read_far_velocity: Float32Array}}
50
+ * @returns {{origin: Int32Array, keep: number, cells: object, faces_u: object, faces_v: object, faces_w: object, far: object, read: object}}
49
51
  */
50
52
  export function fluid_cascade_parent_value() {
51
53
  return {
@@ -55,7 +57,7 @@ export function fluid_cascade_parent_value() {
55
57
  faces_u: fluid_cascade_window_value(),
56
58
  faces_v: fluid_cascade_window_value(),
57
59
  faces_w: fluid_cascade_window_value(),
58
- far_velocity: new Float32Array(3),
59
- read_far_velocity: new Float32Array(3),
60
+ far: fluid_far_field_value(),
61
+ read: fluid_far_field_value(),
60
62
  };
61
63
  }
@@ -14,8 +14,9 @@ export const FLUID_CASCADE_FEEDBACK_MARGIN: number;
14
14
  * - `box`, `box_size`: the parent window-local cells restricted, whose six faces all take the child's;
15
15
  * - `child_offset`: the child window-local cell of the parent's window-local cell 0, so parent cell
16
16
  * `P` holds child cells `2P + child_offset` to `2P + child_offset + 1`;
17
- * - `child_far_velocity`: `v_far` at the child's record, what its faces deviate from;
18
- * - `far_velocity`: `v_far` at the parent's record;
17
+ * - `child_far`: `v_far` at the child's record, what its faces deviate from, laid over the parent's
18
+ * cells ({@link FLUID_FAR_FIELD_STRUCT}, cell coordinate 0 at the parent's window-local cell 0);
19
+ * - `far`: `v_far` at the parent's record, over the same lattice;
19
20
  * - `keep`: `e^(−(Λ(t_s,parent) − Λ(t_s,child)))`, the child's deviation as of the parent's record.
20
21
  *
21
22
  * @type {WebGPUStruct}
@@ -1 +1 @@
1
- {"version":3,"file":"FLUID_CASCADE_RESTRICT_STRUCT.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/fluid/coupling/FLUID_CASCADE_RESTRICT_STRUCT.js"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,4CAFU,MAAM,CAE+B;AAE/C;;;;;;;;;;;;;GAaG;AACH,4CAFU,YAAY,CAeK;6BAtCE,mCAAmC"}
1
+ {"version":3,"file":"FLUID_CASCADE_RESTRICT_STRUCT.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/fluid/coupling/FLUID_CASCADE_RESTRICT_STRUCT.js"],"names":[],"mappings":"AAKA;;;;;;GAMG;AACH,4CAFU,MAAM,CAE+B;AAE/C;;;;;;;;;;;;;;GAcG;AACH,4CAFU,YAAY,CAeK;6BAxCE,mCAAmC"}
@@ -1,6 +1,7 @@
1
1
  import { GRID_TILE_WINDOW_STRUCT } from "../../shader/chunk/grid/GRID_TILE_WINDOW_STRUCT.js";
2
- import { f32, vec3f, vec3i, vec3u } from "../../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
2
+ import { f32, vec3i, vec3u } from "../../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
3
3
  import { WebGPUStruct } from "../../shader/type/WebGPUStruct.js";
4
+ import { FLUID_FAR_FIELD_STRUCT } from "../FLUID_FAR_FIELD_STRUCT.js";
4
5
 
5
6
  /**
6
7
  * Child cells from each face of a child's window that its feedback leaves out: the edge row and the
@@ -19,8 +20,9 @@ export const FLUID_CASCADE_FEEDBACK_MARGIN = 6;
19
20
  * - `box`, `box_size`: the parent window-local cells restricted, whose six faces all take the child's;
20
21
  * - `child_offset`: the child window-local cell of the parent's window-local cell 0, so parent cell
21
22
  * `P` holds child cells `2P + child_offset` to `2P + child_offset + 1`;
22
- * - `child_far_velocity`: `v_far` at the child's record, what its faces deviate from;
23
- * - `far_velocity`: `v_far` at the parent's record;
23
+ * - `child_far`: `v_far` at the child's record, what its faces deviate from, laid over the parent's
24
+ * cells ({@link FLUID_FAR_FIELD_STRUCT}, cell coordinate 0 at the parent's window-local cell 0);
25
+ * - `far`: `v_far` at the parent's record, over the same lattice;
24
26
  * - `keep`: `e^(−(Λ(t_s,parent) − Λ(t_s,child)))`, the child's deviation as of the parent's record.
25
27
  *
26
28
  * @type {WebGPUStruct}
@@ -36,6 +38,6 @@ export const FLUID_CASCADE_RESTRICT_STRUCT = WebGPUStruct.from({
36
38
  keep: f32,
37
39
  box_size: vec3u,
38
40
  child_offset: vec3i,
39
- child_far_velocity: vec3f,
40
- far_velocity: vec3f,
41
+ child_far: FLUID_FAR_FIELD_STRUCT,
42
+ far: FLUID_FAR_FIELD_STRUCT,
41
43
  }, 'FluidCascadeRestrict');
@@ -33,17 +33,25 @@ export const FLUID_CASCADE_DEVIATION_CELLS: number;
33
33
  * faces are row 1.
34
34
  * - `fluid_mac_epilogue_u(face, value, push)`, `_v`, `_w`: the identity, plus `push`, the face's
35
35
  * vorticity confinement over the step (0 without it); then, with `step.band`, the band toward the
36
- * parent's identity read at the face carried through the same identity, then the clamp about
37
- * `v_far` at the step's end. The order is §8's pass 3: the atmosphere, confinement, the band, the
38
- * clamp, so the band relaxes and the clamp bounds the confined face like any other.
36
+ * parent carried through the same identity, `v_far(t₁)` plus what the step keeps of the parent's
37
+ * deviation at the face, then the clamp about `v_far(t₁)`. The order is §8's pass 3: the atmosphere,
38
+ * confinement, the band, the clamp, so the band relaxes and the clamp bounds the confined face like
39
+ * any other.
39
40
  *
40
- * Reads the uniforms `step` (`FLUID_MAC_STEP_STRUCT`) and `parent`, and the parent's faces
41
- * (`chunk_fluid_cascade_parent_velocity`), whose read is at the step's start; the band reads 8 parent
42
- * texels a face on its rows, nothing elsewhere.
41
+ * The far field at a face is `step.far` and `step.far_end` there (`FLUID_MAC_STEP_STRUCT`): with
42
+ * turbulence, the eddies the mean carries to the face by `t₁`, one tap of the tile a face shared by
43
+ * the step's start and end, so air the far field alone moves, advected to the face, is `v_far(t₀)`
44
+ * there and goes to `v_far(t₁)`. Turbulence carried by the mean and advection by the whole field part
45
+ * by the eddies' own speed over the step, a deviation the atmosphere relaxes like any other.
43
46
  *
44
- * Air the far field alone moves is exact through all of it: the identity maps `v_far(t₀)` to
45
- * `v_far(t₁)`, the parent reads `v_far(t₀)` there so the band's target is `v_far(t₁)` too, and the
46
- * clamp holds what is already at its centre.
47
+ * Reads the uniforms `step` (`FLUID_MAC_STEP_STRUCT`) and `parent`, the parent's faces
48
+ * (`chunk_fluid_cascade_parent_velocity`), whose read is at the step's start, and the turbulence tile:
49
+ * one tap a face with turbulence, none without; the band reads 8 parent texels a face on its rows, and
50
+ * a tap more with turbulence, nothing elsewhere.
51
+ *
52
+ * Air the far field alone moves is exact through all of it with no turbulence: the identity maps
53
+ * `v_far(t₀)` to `v_far(t₁)`, the parent's deviation there is 0 so the band's target is `v_far(t₁)` too,
54
+ * and the clamp holds what is already at its centre.
47
55
  *
48
56
  * @type {CodeChunk}
49
57
  */
@@ -1 +1 @@
1
- {"version":3,"file":"chunk_fluid_cascade_epilogue.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/fluid/coupling/chunk_fluid_cascade_epilogue.js"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,2CAFU,MAAM,CAE8B;AAE9C,qBAAqB;AACrB,0CADW,MAAM,CAC4B;AAE7C;;;;;;;;;GASG;AACH,4CAFU,MAAM,CAE+B;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,2CAFU,SAAS,CA4FjB;0BAjJwB,oCAAoC"}
1
+ {"version":3,"file":"chunk_fluid_cascade_epilogue.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/fluid/coupling/chunk_fluid_cascade_epilogue.js"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,2CAFU,MAAM,CAE8B;AAE9C,qBAAqB;AACrB,0CADW,MAAM,CAC4B;AAE7C;;;;;;;;;GASG;AACH,4CAFU,MAAM,CAE+B;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,2CAFU,SAAS,CA0HjB;0BAzLwB,oCAAoC"}
@@ -1,5 +1,7 @@
1
1
  import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
2
2
  import { chunk_fluid_cascade_parent_velocity } from "./chunk_fluid_cascade_parent.js";
3
+ import { chunk_fluid_turbulence } from "../../wind/chunk_fluid_turbulence.js";
4
+ import { FLUID_FAR_FIELD_STRUCT } from "../FLUID_FAR_FIELD_STRUCT.js";
3
5
 
4
6
  /**
5
7
  * Rows of a cascade's relaxation band (GPU_FLUID_CASCADES_PROPOSAL_2026_10_16.md §9, WRF's Davies
@@ -39,17 +41,25 @@ export const FLUID_CASCADE_DEVIATION_CELLS = 4;
39
41
  * faces are row 1.
40
42
  * - `fluid_mac_epilogue_u(face, value, push)`, `_v`, `_w`: the identity, plus `push`, the face's
41
43
  * vorticity confinement over the step (0 without it); then, with `step.band`, the band toward the
42
- * parent's identity read at the face carried through the same identity, then the clamp about
43
- * `v_far` at the step's end. The order is §8's pass 3: the atmosphere, confinement, the band, the
44
- * clamp, so the band relaxes and the clamp bounds the confined face like any other.
44
+ * parent carried through the same identity, `v_far(t₁)` plus what the step keeps of the parent's
45
+ * deviation at the face, then the clamp about `v_far(t₁)`. The order is §8's pass 3: the atmosphere,
46
+ * confinement, the band, the clamp, so the band relaxes and the clamp bounds the confined face like
47
+ * any other.
45
48
  *
46
- * Reads the uniforms `step` (`FLUID_MAC_STEP_STRUCT`) and `parent`, and the parent's faces
47
- * (`chunk_fluid_cascade_parent_velocity`), whose read is at the step's start; the band reads 8 parent
48
- * texels a face on its rows, nothing elsewhere.
49
+ * The far field at a face is `step.far` and `step.far_end` there (`FLUID_MAC_STEP_STRUCT`): with
50
+ * turbulence, the eddies the mean carries to the face by `t₁`, one tap of the tile a face shared by
51
+ * the step's start and end, so air the far field alone moves, advected to the face, is `v_far(t₀)`
52
+ * there and goes to `v_far(t₁)`. Turbulence carried by the mean and advection by the whole field part
53
+ * by the eddies' own speed over the step, a deviation the atmosphere relaxes like any other.
49
54
  *
50
- * Air the far field alone moves is exact through all of it: the identity maps `v_far(t₀)` to
51
- * `v_far(t₁)`, the parent reads `v_far(t₀)` there so the band's target is `v_far(t₁)` too, and the
52
- * clamp holds what is already at its centre.
55
+ * Reads the uniforms `step` (`FLUID_MAC_STEP_STRUCT`) and `parent`, the parent's faces
56
+ * (`chunk_fluid_cascade_parent_velocity`), whose read is at the step's start, and the turbulence tile:
57
+ * one tap a face with turbulence, none without; the band reads 8 parent texels a face on its rows, and
58
+ * a tap more with turbulence, nothing elsewhere.
59
+ *
60
+ * Air the far field alone moves is exact through all of it with no turbulence: the identity maps
61
+ * `v_far(t₀)` to `v_far(t₁)`, the parent's deviation there is 0 so the band's target is `v_far(t₁)` too,
62
+ * and the clamp holds what is already at its centre.
53
63
  *
54
64
  * @type {CodeChunk}
55
65
  */
@@ -99,48 +109,78 @@ fn fluid_mac_face_row_w(face: vec3<i32>) -> i32 {
99
109
  return 1 + min(along, across);
100
110
  }
101
111
 
112
+ // the eddies the far field alone brings to window-local cell coordinate c by t₁: one tap, which the
113
+ // start's far field and the end's share; 0 with no turbulence at either end
114
+ fn fluid_mac_step_eddies(c: vec3<f32>) -> vec3<f32> {
115
+ if (step.far.sigma == 0.0 && step.far_end.sigma == 0.0) {
116
+ return vec3<f32>(0.0);
117
+ }
118
+
119
+ // whichever end has turbulence lays it; both do alike when both have it
120
+ let end = step.far_end.sigma != 0.0;
121
+ let origin = select(step.far.origin, step.far_end.origin, end);
122
+ let scale = select(step.far.scale, step.far_end.scale, end);
123
+ let lod = select(step.far.lod, step.far_end.lod, end);
124
+
125
+ return fluid_turbulence_at(origin + c * scale, lod);
126
+ }
127
+
102
128
  fn fluid_mac_epilogue_u(face: vec3<i32>, value: f32, push: f32) -> f32 {
103
- var v = fluid_atmosphere_identity(value, step.far_velocity.x, step.far_velocity_end.x, step.keep) + push;
129
+ let eddy = fluid_mac_step_eddies(vec3<f32>(face) - vec3<f32>(0.5, 0.0, 0.0)).x;
130
+ let far_start = step.far.mean.x + step.far.sigma * eddy;
131
+ let far_end = step.far_end.mean.x + step.far_end.sigma * eddy;
132
+
133
+ var v = fluid_atmosphere_identity(value, far_start, far_end, step.keep) + push;
104
134
 
105
135
  let weight = select(0.0, fluid_relaxation_weight(fluid_mac_face_row_u(face)), step.band != 0u);
106
136
 
107
137
  if (weight > 0.0) {
108
- let toward = fluid_atmosphere_identity(fluid_parent_face_u(face, step.cells.corner - parent.origin), step.far_velocity.x, step.far_velocity_end.x, step.keep);
138
+ let toward = far_end + step.keep * fluid_parent_face_deviation_u(face, step.cells.corner - parent.origin);
109
139
 
110
140
  v += weight * (toward - v);
111
141
  }
112
142
 
113
- return fluid_deviation_clamp(v, step.far_velocity_end.x, step.deviation_limit);
143
+ return fluid_deviation_clamp(v, far_end, step.deviation_limit);
114
144
  }
115
145
 
116
146
  fn fluid_mac_epilogue_v(face: vec3<i32>, value: f32, push: f32) -> f32 {
117
- var v = fluid_atmosphere_identity(value, step.far_velocity.y, step.far_velocity_end.y, step.keep) + push;
147
+ let eddy = fluid_mac_step_eddies(vec3<f32>(face) - vec3<f32>(0.0, 0.5, 0.0)).y;
148
+ let far_start = step.far.mean.y + step.far.sigma * eddy;
149
+ let far_end = step.far_end.mean.y + step.far_end.sigma * eddy;
150
+
151
+ var v = fluid_atmosphere_identity(value, far_start, far_end, step.keep) + push;
118
152
 
119
153
  let weight = select(0.0, fluid_relaxation_weight(fluid_mac_face_row_v(face)), step.band != 0u);
120
154
 
121
155
  if (weight > 0.0) {
122
- let toward = fluid_atmosphere_identity(fluid_parent_face_v(face, step.cells.corner - parent.origin), step.far_velocity.y, step.far_velocity_end.y, step.keep);
156
+ let toward = far_end + step.keep * fluid_parent_face_deviation_v(face, step.cells.corner - parent.origin);
123
157
 
124
158
  v += weight * (toward - v);
125
159
  }
126
160
 
127
- return fluid_deviation_clamp(v, step.far_velocity_end.y, step.deviation_limit);
161
+ return fluid_deviation_clamp(v, far_end, step.deviation_limit);
128
162
  }
129
163
 
130
164
  fn fluid_mac_epilogue_w(face: vec3<i32>, value: f32, push: f32) -> f32 {
131
- var v = fluid_atmosphere_identity(value, step.far_velocity.z, step.far_velocity_end.z, step.keep) + push;
165
+ let eddy = fluid_mac_step_eddies(vec3<f32>(face) - vec3<f32>(0.0, 0.0, 0.5)).z;
166
+ let far_start = step.far.mean.z + step.far.sigma * eddy;
167
+ let far_end = step.far_end.mean.z + step.far_end.sigma * eddy;
168
+
169
+ var v = fluid_atmosphere_identity(value, far_start, far_end, step.keep) + push;
132
170
 
133
171
  let weight = select(0.0, fluid_relaxation_weight(fluid_mac_face_row_w(face)), step.band != 0u);
134
172
 
135
173
  if (weight > 0.0) {
136
- let toward = fluid_atmosphere_identity(fluid_parent_face_w(face, step.cells.corner - parent.origin), step.far_velocity.z, step.far_velocity_end.z, step.keep);
174
+ let toward = far_end + step.keep * fluid_parent_face_deviation_w(face, step.cells.corner - parent.origin);
137
175
 
138
176
  v += weight * (toward - v);
139
177
  }
140
178
 
141
- return fluid_deviation_clamp(v, step.far_velocity_end.z, step.deviation_limit);
179
+ return fluid_deviation_clamp(v, far_end, step.deviation_limit);
142
180
  }
143
181
  `, [
144
182
  chunk_fluid_cascade_parent_velocity,
183
+ chunk_fluid_turbulence,
184
+ FLUID_FAR_FIELD_STRUCT.declaration_chunk,
145
185
  ]
146
186
  );