@woosh/meep-engine 3.42.0 → 3.44.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 (345) hide show
  1. package/editor/prototypeEditorShell.d.ts.map +1 -1
  2. package/editor/prototypeEditorShell.js +4 -2
  3. package/package.json +91 -96
  4. package/src/engine/Clock.d.ts +15 -0
  5. package/src/engine/Clock.d.ts.map +1 -1
  6. package/src/engine/Clock.js +29 -5
  7. package/src/engine/Engine.d.ts.map +1 -1
  8. package/src/engine/Engine.js +11 -19
  9. package/src/engine/graphics/ecs/mesh-v2/MeshSkin.d.ts +57 -0
  10. package/src/engine/graphics/ecs/mesh-v2/MeshSkin.d.ts.map +1 -0
  11. package/src/engine/graphics/ecs/mesh-v2/MeshSkin.js +84 -0
  12. package/src/engine/graphics3/AnimationGraphSystem.d.ts +23 -13
  13. package/src/engine/graphics3/AnimationGraphSystem.d.ts.map +1 -1
  14. package/src/engine/graphics3/AnimationGraphSystem.js +61 -64
  15. package/src/engine/graphics3/AnimationSystem.d.ts +24 -15
  16. package/src/engine/graphics3/AnimationSystem.d.ts.map +1 -1
  17. package/src/engine/graphics3/AnimationSystem.js +67 -61
  18. package/src/engine/graphics3/MeshSkinSystem.d.ts +56 -0
  19. package/src/engine/graphics3/MeshSkinSystem.d.ts.map +1 -0
  20. package/src/engine/graphics3/MeshSkinSystem.js +317 -0
  21. package/src/engine/graphics3/MeshSystem.d.ts +15 -35
  22. package/src/engine/graphics3/MeshSystem.d.ts.map +1 -1
  23. package/src/engine/graphics3/MeshSystem.js +21 -298
  24. package/src/engine/graphics3/RowChains.d.ts +76 -0
  25. package/src/engine/graphics3/RowChains.d.ts.map +1 -0
  26. package/src/engine/graphics3/RowChains.js +347 -0
  27. package/src/engine/graphics3/ShadedGeometrySystem.d.ts +6 -0
  28. package/src/engine/graphics3/ShadedGeometrySystem.d.ts.map +1 -1
  29. package/src/engine/graphics3/ShadedGeometrySystem.js +329 -309
  30. package/src/engine/graphics3/animation/AnimationClips.d.ts +56 -0
  31. package/src/engine/graphics3/animation/AnimationClips.d.ts.map +1 -0
  32. package/src/engine/graphics3/animation/AnimationClips.js +79 -0
  33. package/src/engine/graphics3/animation/ClipListPlayer.d.ts +13 -14
  34. package/src/engine/graphics3/animation/ClipListPlayer.d.ts.map +1 -1
  35. package/src/engine/graphics3/animation/ClipListPlayer.js +262 -263
  36. package/src/engine/graphics3/animation/write_clip_playback.d.ts +3 -3
  37. package/src/engine/graphics3/animation/write_clip_playback.js +4 -4
  38. package/src/engine/graphics3/pose/query_entity_node_world_pose.d.ts +5 -0
  39. package/src/engine/graphics3/pose/query_entity_node_world_pose.d.ts.map +1 -1
  40. package/src/engine/graphics3/pose/query_entity_node_world_pose.js +80 -75
  41. package/src/engine/graphics3/prefab/PrefabInstance.d.ts +4 -24
  42. package/src/engine/graphics3/prefab/PrefabInstance.d.ts.map +1 -1
  43. package/src/engine/graphics3/prefab/PrefabInstance.js +60 -80
  44. package/src/engine/graphics3/prefab/prefab_instantiate.d.ts +16 -3
  45. package/src/engine/graphics3/prefab/prefab_instantiate.d.ts.map +1 -1
  46. package/src/engine/graphics3/prefab/prefab_instantiate.js +49 -12
  47. package/src/engine/graphics3/prefab/prefab_place.d.ts +31 -17
  48. package/src/engine/graphics3/prefab/prefab_place.d.ts.map +1 -1
  49. package/src/engine/graphics3/prefab/prefab_place.js +175 -130
  50. package/src/engine/graphics3/register_clips.d.ts +64 -0
  51. package/src/engine/graphics3/register_clips.d.ts.map +1 -0
  52. package/src/engine/graphics3/register_clips.js +114 -0
  53. package/src/engine/physics/cloth/MEASUREMENTS.md +795 -0
  54. package/src/engine/physics/cloth/PLAN.md +339 -9
  55. package/src/engine/physics/cloth/build/ClothProxy.d.ts +113 -61
  56. package/src/engine/physics/cloth/build/ClothProxy.d.ts.map +1 -1
  57. package/src/engine/physics/cloth/build/ClothProxy.js +142 -77
  58. package/src/engine/physics/cloth/build/cloth_bind_in_frame.d.ts +22 -0
  59. package/src/engine/physics/cloth/build/cloth_bind_in_frame.d.ts.map +1 -0
  60. package/src/engine/physics/cloth/build/cloth_bind_in_frame.js +75 -0
  61. package/src/engine/physics/cloth/build/cloth_proxy_from_joints.d.ts +43 -30
  62. package/src/engine/physics/cloth/build/cloth_proxy_from_joints.d.ts.map +1 -1
  63. package/src/engine/physics/cloth/build/cloth_proxy_from_joints.js +357 -284
  64. package/src/engine/physics/cloth/build/cloth_proxy_from_mesh.d.ts +62 -0
  65. package/src/engine/physics/cloth/build/cloth_proxy_from_mesh.d.ts.map +1 -0
  66. package/src/engine/physics/cloth/build/cloth_proxy_from_mesh.js +280 -0
  67. package/src/engine/physics/cloth/collider/cloth_collider_sdf.d.ts +1 -1
  68. package/src/engine/physics/cloth/collider/cloth_collider_sdf.js +1 -1
  69. package/src/engine/physics/cloth/ecs/Cloth.d.ts +17 -9
  70. package/src/engine/physics/cloth/ecs/Cloth.d.ts.map +1 -1
  71. package/src/engine/physics/cloth/ecs/Cloth.js +220 -212
  72. package/src/engine/physics/cloth/ecs/ClothDynamicsFlags.js +6 -0
  73. package/src/engine/physics/cloth/ecs/ClothHold.d.ts +91 -0
  74. package/src/engine/physics/cloth/ecs/ClothHold.d.ts.map +1 -0
  75. package/src/engine/physics/cloth/ecs/ClothHold.js +103 -0
  76. package/src/engine/physics/cloth/ecs/ClothInstance.d.ts +254 -48
  77. package/src/engine/physics/cloth/ecs/ClothInstance.d.ts.map +1 -1
  78. package/src/engine/physics/cloth/ecs/ClothInstance.js +277 -47
  79. package/src/engine/physics/cloth/ecs/ClothPin.d.ts +73 -0
  80. package/src/engine/physics/cloth/ecs/ClothPin.d.ts.map +1 -0
  81. package/src/engine/physics/cloth/ecs/ClothPin.js +92 -0
  82. package/src/engine/physics/cloth/ecs/ClothPinSerializationAdapter.d.ts +36 -0
  83. package/src/engine/physics/cloth/ecs/ClothPinSerializationAdapter.d.ts.map +1 -0
  84. package/src/engine/physics/cloth/ecs/ClothPinSerializationAdapter.js +61 -0
  85. package/src/engine/physics/cloth/ecs/ClothRig.d.ts +23 -17
  86. package/src/engine/physics/cloth/ecs/ClothRig.d.ts.map +1 -1
  87. package/src/engine/physics/cloth/ecs/ClothRig.js +29 -27
  88. package/src/engine/physics/cloth/ecs/ClothSystem.d.ts +12 -14
  89. package/src/engine/physics/cloth/ecs/ClothSystem.d.ts.map +1 -1
  90. package/src/engine/physics/cloth/ecs/ClothSystem.js +20 -15
  91. package/src/engine/physics/cloth/ecs/ClothWorld.d.ts +57 -36
  92. package/src/engine/physics/cloth/ecs/ClothWorld.d.ts.map +1 -1
  93. package/src/engine/physics/cloth/ecs/ClothWorld.js +816 -179
  94. package/src/engine/physics/cloth/ecs/WorkerClothSystem.d.ts +12 -13
  95. package/src/engine/physics/cloth/ecs/WorkerClothSystem.d.ts.map +1 -1
  96. package/src/engine/physics/cloth/ecs/WorkerClothSystem.js +20 -14
  97. package/src/engine/physics/cloth/ecs/cloth_build_rows.d.ts +63 -11
  98. package/src/engine/physics/cloth/ecs/cloth_build_rows.d.ts.map +1 -1
  99. package/src/engine/physics/cloth/ecs/cloth_build_rows.js +321 -84
  100. package/src/engine/physics/cloth/ecs/cloth_dynamics_map.d.ts +9 -7
  101. package/src/engine/physics/cloth/ecs/cloth_dynamics_map.d.ts.map +1 -1
  102. package/src/engine/physics/cloth/ecs/cloth_dynamics_map.js +9 -7
  103. package/src/engine/physics/cloth/ecs/cloth_gather_colliders.d.ts +3 -3
  104. package/src/engine/physics/cloth/ecs/cloth_gather_colliders.js +30 -30
  105. package/src/engine/physics/cloth/ecs/cloth_geodesic.d.ts +37 -0
  106. package/src/engine/physics/cloth/ecs/cloth_geodesic.d.ts.map +1 -0
  107. package/src/engine/physics/cloth/ecs/cloth_geodesic.js +142 -0
  108. package/src/engine/physics/cloth/ecs/cloth_holds.d.ts +97 -0
  109. package/src/engine/physics/cloth/ecs/cloth_holds.d.ts.map +1 -0
  110. package/src/engine/physics/cloth/ecs/cloth_holds.js +608 -0
  111. package/src/engine/physics/cloth/ecs/cloth_reconstruct_pose.d.ts +2 -2
  112. package/src/engine/physics/cloth/ecs/cloth_reconstruct_pose.d.ts.map +1 -1
  113. package/src/engine/physics/cloth/ecs/cloth_reconstruct_pose.js +160 -9
  114. package/src/engine/physics/cloth/ecs/cloth_seed_rig.d.ts +17 -22
  115. package/src/engine/physics/cloth/ecs/cloth_seed_rig.d.ts.map +1 -1
  116. package/src/engine/physics/cloth/ecs/cloth_seed_rig.js +55 -117
  117. package/src/engine/physics/cloth/ecs/cloth_seed_subtree.d.ts +21 -6
  118. package/src/engine/physics/cloth/ecs/cloth_seed_subtree.d.ts.map +1 -1
  119. package/src/engine/physics/cloth/ecs/cloth_seed_subtree.js +44 -15
  120. package/src/engine/physics/cloth/ecs/cloth_write_back.d.ts +5 -0
  121. package/src/engine/physics/cloth/ecs/cloth_write_back.d.ts.map +1 -1
  122. package/src/engine/physics/cloth/ecs/cloth_write_back.js +60 -16
  123. package/src/engine/physics/cloth/ecs/cloth_write_back_rig.d.ts.map +1 -1
  124. package/src/engine/physics/cloth/ecs/cloth_write_back_rig.js +65 -58
  125. package/src/engine/physics/cloth/playground/collide_main.js +1 -1
  126. package/src/engine/physics/cloth/playground/garment_build.d.ts.map +1 -1
  127. package/src/engine/physics/cloth/playground/garment_build.js +17 -5
  128. package/src/engine/physics/cloth/playground/garment_main.js +1 -1
  129. package/src/engine/physics/cloth/playground/rig_build.d.ts.map +1 -1
  130. package/src/engine/physics/cloth/playground/rig_build.js +302 -296
  131. package/src/engine/physics/cloth/solver/ClothState.d.ts +45 -7
  132. package/src/engine/physics/cloth/solver/ClothState.d.ts.map +1 -1
  133. package/src/engine/physics/cloth/solver/ClothState.js +63 -7
  134. package/src/engine/physics/cloth/solver/cloth_contact_find.d.ts +6 -1
  135. package/src/engine/physics/cloth/solver/cloth_contact_find.d.ts.map +1 -1
  136. package/src/engine/physics/cloth/solver/cloth_contact_find.js +7 -2
  137. package/src/engine/physics/cloth/solver/cloth_hold_line.d.ts +114 -0
  138. package/src/engine/physics/cloth/solver/cloth_hold_line.d.ts.map +1 -0
  139. package/src/engine/physics/cloth/solver/cloth_hold_line.js +362 -0
  140. package/src/engine/physics/cloth/solver/cloth_self_find.d.ts +6 -2
  141. package/src/engine/physics/cloth/solver/cloth_self_find.d.ts.map +1 -1
  142. package/src/engine/physics/cloth/solver/cloth_self_find.js +13 -13
  143. package/src/engine/physics/cloth/solver/cloth_solver_constants.d.ts +24 -12
  144. package/src/engine/physics/cloth/solver/cloth_solver_constants.d.ts.map +1 -1
  145. package/src/engine/physics/cloth/solver/cloth_solver_constants.js +24 -12
  146. package/src/engine/physics/cloth/solver/cloth_step.d.ts +16 -0
  147. package/src/engine/physics/cloth/solver/cloth_step.d.ts.map +1 -1
  148. package/src/engine/physics/cloth/solver/cloth_step.js +183 -20
  149. package/src/engine/physics/cloth/solver/cloth_step_instance.d.ts +1 -0
  150. package/src/engine/physics/cloth/solver/cloth_step_instance.d.ts.map +1 -1
  151. package/src/engine/physics/cloth/solver/cloth_step_instance.js +10 -3
  152. package/src/engine/physics/cloth/solver/constraint/cloth_leash_row.d.ts +1 -1
  153. package/src/engine/physics/cloth/solver/constraint/cloth_leash_row.d.ts.map +1 -1
  154. package/src/engine/physics/cloth/solver/constraint/cloth_leash_row.js +353 -346
  155. package/src/engine/physics/cloth/solver/constraint/cloth_self_row.d.ts +7 -5
  156. package/src/engine/physics/cloth/solver/constraint/cloth_self_row.d.ts.map +1 -1
  157. package/src/engine/physics/cloth/solver/constraint/cloth_self_row.js +7 -5
  158. package/src/engine/physics/cloth/wind/cloth_sample_air.d.ts +9 -9
  159. package/src/engine/physics/cloth/wind/cloth_sample_air.d.ts.map +1 -1
  160. package/src/engine/physics/cloth/wind/cloth_sample_air.js +26 -26
  161. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
  162. package/src/engine/simulation/Ticker.d.ts +13 -0
  163. package/src/engine/simulation/Ticker.d.ts.map +1 -1
  164. package/src/engine/simulation/Ticker.js +43 -8
  165. package/src/shade/RENDERER_CONTRACT.md +8 -2
  166. package/src/shade/playground/mesh_row_ceiling/main.js +2 -1
  167. package/src/shade/playground/skinned_blas_refit/main.d.ts.map +1 -1
  168. package/src/shade/playground/skinned_blas_refit/main.js +11 -19
  169. package/src/shade/playground/skinned_blas_refit/place_character.d.ts +6 -3
  170. package/src/shade/playground/skinned_blas_refit/place_character.d.ts.map +1 -1
  171. package/src/shade/playground/skinned_blas_refit/place_character.js +90 -90
  172. package/src/shade/playground/skinned_mesh_soup/main.d.ts.map +1 -1
  173. package/src/shade/playground/skinned_mesh_soup/main.js +502 -509
  174. package/src/shade/playground/texture_encode/README.md +129 -109
  175. package/src/shade/playground/texture_encode/main.js +1430 -1430
  176. package/src/shade/playground/vgeo_runtime/README.md +5 -4
  177. package/src/shade/renderer/Renderer.d.ts.map +1 -1
  178. package/src/shade/renderer/Renderer.js +6 -5
  179. package/src/shade/renderer/animation/GPUAnimationManager.d.ts +45 -14
  180. package/src/shade/renderer/animation/GPUAnimationManager.d.ts.map +1 -1
  181. package/src/shade/renderer/animation/GPUAnimationManager.js +316 -64
  182. package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.d.ts +5 -0
  183. package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.d.ts.map +1 -1
  184. package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.js +11 -1
  185. package/src/shade/renderer/atmosphere/GPUSky.d.ts +12 -0
  186. package/src/shade/renderer/atmosphere/GPUSky.d.ts.map +1 -1
  187. package/src/shade/renderer/atmosphere/GPUSky.js +162 -147
  188. package/src/shade/renderer/geometry/BoxGeometry.d.ts +1 -11
  189. package/src/shade/renderer/geometry/BoxGeometry.d.ts.map +1 -1
  190. package/src/shade/renderer/geometry/BoxGeometry.js +6 -13
  191. package/src/shade/renderer/geometry/CapsuleGeometry.d.ts +19 -0
  192. package/src/shade/renderer/geometry/CapsuleGeometry.d.ts.map +1 -0
  193. package/src/shade/renderer/geometry/CapsuleGeometry.js +24 -0
  194. package/src/shade/renderer/geometry/ConeGeometry.d.ts +20 -0
  195. package/src/shade/renderer/geometry/ConeGeometry.d.ts.map +1 -0
  196. package/src/shade/renderer/geometry/ConeGeometry.js +33 -0
  197. package/src/shade/renderer/geometry/CylinderGeometry.d.ts +21 -0
  198. package/src/shade/renderer/geometry/CylinderGeometry.d.ts.map +1 -0
  199. package/src/shade/renderer/geometry/CylinderGeometry.js +35 -0
  200. package/src/shade/renderer/geometry/PlaneGeometry.d.ts +17 -0
  201. package/src/shade/renderer/geometry/PlaneGeometry.d.ts.map +1 -0
  202. package/src/shade/renderer/geometry/PlaneGeometry.js +22 -0
  203. package/src/shade/renderer/geometry/TorusGeometry.d.ts +18 -0
  204. package/src/shade/renderer/geometry/TorusGeometry.d.ts.map +1 -0
  205. package/src/shade/renderer/geometry/TorusGeometry.js +23 -0
  206. package/src/shade/renderer/geometry/UVSphereGeometry.d.ts +21 -0
  207. package/src/shade/renderer/geometry/UVSphereGeometry.d.ts.map +1 -0
  208. package/src/shade/renderer/geometry/UVSphereGeometry.js +34 -0
  209. package/src/shade/renderer/geometry/primitives/make_capsule_geometry.d.ts +19 -0
  210. package/src/shade/renderer/geometry/primitives/make_capsule_geometry.d.ts.map +1 -0
  211. package/src/shade/renderer/geometry/primitives/make_capsule_geometry.js +205 -0
  212. package/src/shade/renderer/geometry/primitives/make_cone_geometry.d.ts +21 -0
  213. package/src/shade/renderer/geometry/primitives/make_cone_geometry.d.ts.map +1 -0
  214. package/src/shade/renderer/geometry/primitives/make_cone_geometry.js +36 -0
  215. package/src/shade/renderer/geometry/primitives/make_cylinder_geometry.d.ts +1 -1
  216. package/src/shade/renderer/geometry/primitives/make_cylinder_geometry.d.ts.map +1 -1
  217. package/src/shade/renderer/geometry/primitives/make_cylinder_geometry.js +44 -9
  218. package/src/shade/renderer/geometry/primitives/make_uv_sphere_geometry.d.ts +20 -0
  219. package/src/shade/renderer/geometry/primitives/make_uv_sphere_geometry.d.ts.map +1 -0
  220. package/src/shade/renderer/geometry/primitives/make_uv_sphere_geometry.js +190 -0
  221. package/src/shade/renderer/geometry/virtual/runtime/graph_vgeo_expand_instances_to_meshlets.d.ts.map +1 -1
  222. package/src/shade/renderer/geometry/virtual/runtime/graph_vgeo_expand_instances_to_meshlets.js +7 -2
  223. package/src/shade/renderer/gpu_primitive/prefix_sum/v1/graph_prefix_scan_csdldf.d.ts +26 -8
  224. package/src/shade/renderer/gpu_primitive/prefix_sum/v1/graph_prefix_scan_csdldf.d.ts.map +1 -1
  225. package/src/shade/renderer/gpu_primitive/prefix_sum/v1/graph_prefix_scan_csdldf.js +56 -39
  226. package/src/shade/renderer/gpu_primitive/prefix_sum/v1/shader_prefix_scan_csdldf.d.ts +7 -0
  227. package/src/shade/renderer/gpu_primitive/prefix_sum/v1/shader_prefix_scan_csdldf.d.ts.map +1 -1
  228. package/src/shade/renderer/gpu_primitive/prefix_sum/v1/shader_prefix_scan_csdldf.js +46 -4
  229. package/src/shade/renderer/gpu_primitive/prefix_sum/v1/test_prefix_sum.d.ts.map +1 -1
  230. package/src/shade/renderer/gpu_primitive/prefix_sum/v1/test_prefix_sum.js +4 -2
  231. package/src/shade/renderer/gpu_primitive/sort/defs.d.ts +2 -2
  232. package/src/shade/renderer/gpu_primitive/sort/defs.js +79 -79
  233. package/src/shade/renderer/gpu_primitive/sort/graph_radix_sort.d.ts +1 -1
  234. package/src/shade/renderer/gpu_primitive/sort/graph_radix_sort.d.ts.map +1 -1
  235. package/src/shade/renderer/gpu_primitive/sort/graph_radix_sort.js +7 -3
  236. package/src/shade/renderer/lightmap/bake/shader_lightmap_denoise_sh.d.ts.map +1 -1
  237. package/src/shade/renderer/lightmap/bake/shader_lightmap_denoise_sh.js +10 -3
  238. package/src/shade/renderer/loader/gltf/tiny-gltf.d.ts +1 -1
  239. package/src/shade/renderer/particles/DESIGN.md +13 -9
  240. package/src/shade/renderer/particles/GPUParticleSystem.js +1 -1
  241. package/src/shade/renderer/particles/coherence/graph_particle_bucket.d.ts +4 -3
  242. package/src/shade/renderer/particles/coherence/graph_particle_bucket.d.ts.map +1 -1
  243. package/src/shade/renderer/particles/coherence/graph_particle_bucket.js +200 -194
  244. package/src/shade/renderer/particles/graph_particles.d.ts.map +1 -1
  245. package/src/shade/renderer/particles/graph_particles.js +6 -2
  246. package/src/shade/renderer/particles/shaders/chunk_particle_lighting.d.ts +1 -1
  247. package/src/shade/renderer/particles/shaders/chunk_particle_lighting.js +1 -1
  248. package/src/shade/renderer/particles/warmup/graph_particle_warmup.d.ts.map +1 -1
  249. package/src/shade/renderer/particles/warmup/graph_particle_warmup.js +334 -329
  250. package/src/shade/renderer/postprocess/nss/NSS.d.ts +1 -1
  251. package/src/shade/renderer/rasterize/bucket/prepare_meshlet_draw_commands_by_material.d.ts.map +1 -1
  252. package/src/shade/renderer/rasterize/bucket/prepare_meshlet_draw_commands_by_material.js +7 -2
  253. package/src/shade/renderer/rasterize/expand/mesh/graph_expand_meshes_to_meshlets.d.ts.map +1 -1
  254. package/src/shade/renderer/rasterize/expand/mesh/graph_expand_meshes_to_meshlets.js +16 -4
  255. package/src/shade/renderer/rasterize/native/avboit/AVBOITSideChannel.d.ts +3 -2
  256. package/src/shade/renderer/rasterize/native/avboit/AVBOITSideChannel.d.ts.map +1 -1
  257. package/src/shade/renderer/rasterize/native/avboit/AVBOITSideChannel.js +3 -2
  258. package/src/shade/renderer/scene/GPUSceneContext.d.ts +9 -1
  259. package/src/shade/renderer/scene/GPUSceneContext.d.ts.map +1 -1
  260. package/src/shade/renderer/scene/GPUSceneContext.js +23 -1
  261. package/src/shade/renderer/texture/COMPRESSED_TEXTURE_PLAN_2026_09_01.md +2444 -2345
  262. package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4_rgb.d.ts.map +1 -1
  263. package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4_rgb.js +312 -310
  264. package/src/shade/renderer/texture/encode/chunk_bc1_encode_block.d.ts +3 -3
  265. package/src/shade/renderer/texture/encode/chunk_bc1_encode_block.d.ts.map +1 -1
  266. package/src/shade/renderer/texture/encode/chunk_bc1_encode_block.js +383 -375
  267. package/src/shade/renderer/texture/encode/chunk_bc6h_encode_block_mode11.d.ts.map +1 -1
  268. package/src/shade/renderer/texture/encode/chunk_bc6h_encode_block_mode11.js +349 -346
  269. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block.d.ts +58 -0
  270. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block.d.ts.map +1 -0
  271. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block.js +536 -0
  272. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block_mode6.d.ts +21 -7
  273. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block_mode6.d.ts.map +1 -1
  274. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block_mode6.js +291 -327
  275. package/src/shade/renderer/texture/encode/chunk_bc7_pack_mode1.d.ts +25 -0
  276. package/src/shade/renderer/texture/encode/chunk_bc7_pack_mode1.d.ts.map +1 -0
  277. package/src/shade/renderer/texture/encode/chunk_bc7_pack_mode1.js +99 -0
  278. package/src/shade/renderer/texture/encode/chunk_bc7_pack_mode6.d.ts +5 -3
  279. package/src/shade/renderer/texture/encode/chunk_bc7_pack_mode6.d.ts.map +1 -1
  280. package/src/shade/renderer/texture/encode/chunk_bc7_pack_mode6.js +47 -71
  281. package/src/shade/renderer/texture/encode/chunk_bc7_partition_2.d.ts +10 -0
  282. package/src/shade/renderer/texture/encode/chunk_bc7_partition_2.d.ts.map +1 -0
  283. package/src/shade/renderer/texture/encode/chunk_bc7_partition_2.js +50 -0
  284. package/src/shade/renderer/texture/encode/shader_texture_encode_bc7.d.ts +4 -5
  285. package/src/shade/renderer/texture/encode/shader_texture_encode_bc7.d.ts.map +1 -1
  286. package/src/shade/renderer/texture/encode/shader_texture_encode_bc7.js +7 -8
  287. package/src/shade/renderer/volumetrics/GPUViewVolumetrics.d.ts +4 -1
  288. package/src/shade/renderer/volumetrics/GPUViewVolumetrics.d.ts.map +1 -1
  289. package/src/shade/renderer/volumetrics/GPUViewVolumetrics.js +74 -3
  290. package/src/shade/renderer/volumetrics/NOTES.md +1023 -957
  291. package/src/shade/renderer/volumetrics/chunk_volumetrics_irradiance_sh.d.ts +5 -4
  292. package/src/shade/renderer/volumetrics/chunk_volumetrics_irradiance_sh.d.ts.map +1 -1
  293. package/src/shade/renderer/volumetrics/chunk_volumetrics_irradiance_sh.js +5 -4
  294. package/src/shade/renderer/volumetrics/gi/chunk_volumetrics_gi.d.ts +1 -1
  295. package/src/shade/renderer/volumetrics/gi/chunk_volumetrics_gi.js +1 -1
  296. package/src/shade/renderer/volumetrics/gi/graph_build_froxel_gi.d.ts +1 -1
  297. package/src/shade/renderer/volumetrics/gi/graph_build_froxel_gi.js +1 -1
  298. package/src/shade/renderer/volumetrics/graph_build_froxel_irradiance.d.ts +41 -0
  299. package/src/shade/renderer/volumetrics/graph_build_froxel_irradiance.d.ts.map +1 -0
  300. package/src/shade/renderer/volumetrics/graph_build_froxel_irradiance.js +112 -0
  301. package/src/shade/renderer/volumetrics/graph_build_volumetrics.d.ts +9 -23
  302. package/src/shade/renderer/volumetrics/graph_build_volumetrics.d.ts.map +1 -1
  303. package/src/shade/renderer/volumetrics/graph_build_volumetrics.js +18 -126
  304. package/src/shade/renderer/volumetrics/shader_volumetrics_build_irradiance.d.ts +22 -0
  305. package/src/shade/renderer/volumetrics/shader_volumetrics_build_irradiance.d.ts.map +1 -0
  306. package/src/shade/renderer/volumetrics/shader_volumetrics_build_irradiance.js +228 -0
  307. package/src/shade/renderer/volumetrics/shader_volumetrics_build_lighting.d.ts.map +1 -1
  308. package/src/shade/renderer/volumetrics/shader_volumetrics_build_lighting.js +0 -53
  309. package/src/shade/renderer/water/chunk_water_transport.d.ts.map +1 -1
  310. package/src/shade/renderer/water/chunk_water_transport.js +7 -5
  311. package/src/shade/renderer/water/medium/GPUWaterBodies.d.ts.map +1 -1
  312. package/src/shade/renderer/water/medium/GPUWaterBodies.js +8 -2
  313. package/src/shade/renderer/water/optics/chunk_water_receiver_downwelling.d.ts +3 -2
  314. package/src/shade/renderer/water/optics/chunk_water_receiver_downwelling.d.ts.map +1 -1
  315. package/src/shade/renderer/water/optics/chunk_water_receiver_downwelling.js +3 -2
  316. package/src/shade/renderer/water/shader_water.d.ts.map +1 -1
  317. package/src/shade/renderer/water/shader_water.js +3 -1
  318. package/src/shade/renderer/water/surface/GPUWaterSurface.d.ts.map +1 -1
  319. package/src/shade/renderer/water/surface/GPUWaterSurface.js +3 -1
  320. package/src/shade/renderer/water/surface/chunk_water_surface_sample.d.ts +4 -3
  321. package/src/shade/renderer/water/surface/chunk_water_surface_sample.d.ts.map +1 -1
  322. package/src/shade/renderer/water/surface/chunk_water_surface_sample.js +17 -7
  323. package/src/shade/renderer/water/surface/graph_water_tessellation.d.ts.map +1 -1
  324. package/src/shade/renderer/water/surface/graph_water_tessellation.js +11 -4
  325. package/src/shade/renderer/water/surface/particles/GPUWaterParticles.d.ts.map +1 -1
  326. package/src/shade/renderer/water/surface/particles/GPUWaterParticles.js +93 -30
  327. package/src/shade/renderer/water/surface/particles/WATER_PARTICLE_STRUCT.d.ts.map +1 -1
  328. package/src/shade/renderer/water/surface/particles/WATER_PARTICLE_STRUCT.js +13 -5
  329. package/src/shade/renderer/water/surface/particles/chunk_water_particle.d.ts +29 -8
  330. package/src/shade/renderer/water/surface/particles/chunk_water_particle.d.ts.map +1 -1
  331. package/src/shade/renderer/water/surface/particles/chunk_water_particle.js +155 -30
  332. package/src/shade/renderer/water/surface/particles/chunk_water_particle_step.d.ts +6 -1
  333. package/src/shade/renderer/water/surface/particles/chunk_water_particle_step.d.ts.map +1 -1
  334. package/src/shade/renderer/water/surface/particles/chunk_water_particle_step.js +157 -39
  335. package/src/shade/renderer/water/surface/particles/shader_water_particles.d.ts +91 -21
  336. package/src/shade/renderer/water/surface/particles/shader_water_particles.d.ts.map +1 -1
  337. package/src/shade/renderer/water/surface/particles/shader_water_particles.js +442 -70
  338. package/src/shade/wgsl/emulator/WGSLJavaScriptCompiler.js +11 -3
  339. package/src/shade/wgsl/emulator/WGSLLanguageCore.d.ts.map +1 -1
  340. package/src/shade/wgsl/emulator/WGSLLanguageCore.js +3 -0
  341. package/src/shade/wgsl/validate_wgsl_source.d.ts.map +1 -1
  342. package/src/shade/wgsl/validate_wgsl_source.js +74 -3
  343. package/src/engine/graphics3/register_instance_animation.d.ts +0 -114
  344. package/src/engine/graphics3/register_instance_animation.d.ts.map +0 -1
  345. package/src/engine/graphics3/register_instance_animation.js +0 -201
@@ -1,6 +1,7 @@
1
1
  import { CodeChunk } from "../../../shader/compiler/CodeChunk.js";
2
2
  import { BVH_TRAVERSAL_STACK_SIZE } from "../../../shader/chunk/bvh/BVH_TRAVERSAL_STACK_SIZE.js";
3
3
  import { chunk_ray_query_blas_nearest } from "../../../shader/chunk/geometry/ray/chunk_ray_query_blas_nearest.js";
4
+ import { chunk_geometry_read_triangle_positions } from "../../../shader/chunk/geometry/format/chunk_geometry_read_triangle_positions.js";
4
5
  import { RAY_HIT_INFO } from "../../../shader/chunk/geometry/ray/RAY_HIT_INFO.js";
5
6
  import { WATER_PARTICLE_STRUCT } from "./WATER_PARTICLE_STRUCT.js";
6
7
  import { chunk_water_particle } from "./chunk_water_particle.js";
@@ -10,7 +11,12 @@ export const WATER_PARTICLE_FADE_SECONDS = 0.15;
10
11
 
11
12
  /**
12
13
  * One frame of one wave particle (WATER_SURFACE_SIMULATION_PLAN_2026_10_06.md §5.1): it ages, spreads over its
13
- * widening front, damps, reflects off its body's authored outline, and dies or splits.
14
+ * widening front, damps, meets its body's authored outline, and dies or splits.
15
+ *
16
+ * At the outline the water shows the packet plus the shore's share of its mirror image in the outline (the image
17
+ * method, as Jeschke & Wojtan 2017 §4.4 keep a "ghost" of a reflected packet): the image is emitted the step the first
18
+ * of the packet's support leaves the body, and the packet carries on until the last of it has left it too. The body's
19
+ * outline clips what of either lies beyond it, so the water changes only as the two move.
14
20
  *
15
21
  * Whether a point is over the body is a down-ray into the body's own BLAS, so the outline is exactly the
16
22
  * authored mesh's, holes for islands included. Bindings: `geometries`, `blas_lookup`, `blas_data`,
@@ -22,8 +28,11 @@ export const chunk_water_particle_step = CodeChunk.from(/* language=WGSL */ `
22
28
  const WATER_PARTICLE_FADE_SECONDS: f32 = ${WATER_PARTICLE_FADE_SECONDS};
23
29
 
24
30
  struct WaterParticleStep {
31
+ // the particle a step on
25
32
  particle: ${WATER_PARTICLE_STRUCT.wgsl_ref},
26
- // 0 dies, 1 lives on, 3 splits into three
33
+ // the mirror image it leaves, when it leaves one
34
+ image: ${WATER_PARTICLE_STRUCT.wgsl_ref},
35
+ // the particles it leaves, each split into three when they split: 0, 1, 2 (it, then its image), 3 or 6
27
36
  children: u32,
28
37
  }
29
38
 
@@ -37,6 +46,50 @@ fn water_particle_over_body(geometry_index: u32, local: vec2<f32>) -> ${RAY_HIT_
37
46
  top - box[1] + margin), geometry_index, &stack, 0u);
38
47
  }
39
48
 
49
+ // The points of a packet's support the step tests against the outline, on its arc ρ from its front's centre: the k-th
50
+ // of its axis and its window's ends, β either side of it. The support is the annular sector of two radii either side of
51
+ // the front and β either side of the axis, so a straight outline meets first the point of its leading arc whose
52
+ // direction is nearest the outline's normal, an end unless the normal is within β of the axis, and leaves last the end
53
+ // of its trailing arc farthest from it: at any incidence, these three find both, or within the arc's sagitta.
54
+ fn water_particle_support_point(particle: ${WATER_PARTICLE_STRUCT.wgsl_ref}, k: u32, rho: f32) -> vec2<f32> {
55
+ let turn = select(0.0, select(particle.dispersion, -particle.dispersion, k == 1u), k > 0u);
56
+ return particle.origin + water_particle_direction(particle.angle + turn) * rho;
57
+ }
58
+
59
+ // Whether a triangle seen from above holds a point strictly inside it, in the body's local xz.
60
+ fn water_triangle_covers(a: vec2<f32>, b: vec2<f32>, c: vec2<f32>, point: vec2<f32>) -> bool {
61
+ let side = sign((b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x));
62
+ let ab = (b.x - a.x) * (point.y - a.y) - (b.y - a.y) * (point.x - a.x);
63
+ let bc = (c.x - b.x) * (point.y - b.y) - (c.y - b.y) * (point.x - b.x);
64
+ let ca = (a.x - c.x) * (point.y - c.y) - (a.y - c.y) * (point.x - c.x);
65
+ return side * ab > 0.0 && side * bc > 0.0 && side * ca > 0.0;
66
+ }
67
+
68
+ // The k-th tested point of a particle's leading arc once it has stepped dt on: what water_particle_advance tests.
69
+ fn water_particle_leading_point(particle: ${WATER_PARTICLE_STRUCT.wgsl_ref}, dt: f32, k: u32) -> vec2<f32> {
70
+ var stepped = particle;
71
+ stepped.age += dt;
72
+ return water_particle_support_point(stepped, k, water_particle_distance(stepped) + water_particle_half_length(stepped));
73
+ }
74
+
75
+ // What is already known of a particle's leading arc a step on, bit k for its k-th tested point: whether that is known,
76
+ // and whether it is over the body; and the triangle under the axis's point when that is. Zero is nothing known. A
77
+ // particle's window's ends are its neighbours' axis points when they are of its front, so the update pass hands each
78
+ // what its neighbours in the subgroup found.
79
+ struct WaterParticleArcHint {
80
+ known: u32,
81
+ over: u32,
82
+ triangle: u32,
83
+ }
84
+
85
+ // Whether any of an arc's tested points is over the body.
86
+ fn water_particle_arc_over(particle: ${WATER_PARTICLE_STRUCT.wgsl_ref}, geometry_index: u32, scale: vec2<f32>, rho: f32) -> bool {
87
+ for (var k = 0u; k < 3u; k++) {
88
+ if (water_particle_over_body(geometry_index, water_particle_support_point(particle, k, rho) / scale).t >= 0.0) { return true; }
89
+ }
90
+ return false;
91
+ }
92
+
40
93
  // The line of the edge of a triangle nearest a point inside it, in the metric xz frame: a point on it and a
41
94
  // unit normal. Which side the normal points to does not matter: a mirror in a line is the same for either.
42
95
  struct WaterOutlineLine {
@@ -62,54 +115,119 @@ fn water_outline_line(geometry_index: u32, triangle: u32, point: vec2<f32>, scal
62
115
  return line;
63
116
  }
64
117
 
118
+ // The particle's mirror image in a line of the outline: its front's centre and its direction mirrored. Not yet reflected.
119
+ fn water_particle_mirrored(particle: ${WATER_PARTICLE_STRUCT.wgsl_ref}, line: WaterOutlineLine) -> ${WATER_PARTICLE_STRUCT.wgsl_ref} {
120
+ var image = particle;
121
+ let direction = water_particle_direction(particle.angle);
122
+ let mirrored = direction - 2.0 * dot(direction, line.normal) * line.normal;
123
+ image.origin -= 2.0 * dot(particle.origin - line.point, line.normal) * line.normal;
124
+ image.angle = atan2(mirrored.y, mirrored.x);
125
+ image.reflected = 0u;
126
+ return image;
127
+ }
128
+
65
129
  // Advance a particle by dt. scale turns the body's metric frame into its local one; reflection is the
66
- // outline's amplitude reflection coefficient; threshold is the steepness |a|/r below which it dies.
130
+ // outline's amplitude reflection coefficient; threshold is the steepness |a|/r below which it dies; hint is what is
131
+ // already known of its leading arc.
67
132
  fn water_particle_advance(input: ${WATER_PARTICLE_STRUCT.wgsl_ref}, dt: f32, geometry_index: u32, scale: vec2<f32>,
68
- reflection: f32, threshold: f32) -> WaterParticleStep {
133
+ reflection: f32, threshold: f32, hint: WaterParticleArcHint) -> WaterParticleStep {
69
134
  var particle = input;
70
- let before = water_particle_position(particle);
71
135
  let distance_before = water_particle_distance(particle);
136
+ let half_length_before = water_particle_half_length(particle);
72
137
  particle.age += dt;
73
138
  let distance_after = water_particle_distance(particle);
74
- // energy spread over the widening circumference, and the water's own damping
75
- particle.amplitude *= sqrt(max(distance_before, 1e-30) / max(distance_after, 1e-30))
76
- * exp(-water_particle_damping(particle.radius) * dt);
77
- let after = water_particle_position(particle);
78
- if (water_particle_over_body(geometry_index, after / scale).t < 0.0) {
79
- let start = water_particle_over_body(geometry_index, before / scale);
80
- if (!(reflection > 0.0) || start.t < 0.0) { return WaterParticleStep(particle, 0u); }
81
- // where along this frame's step it left the mesh
82
- var lo = 0.0;
83
- var hi = 1.0;
84
- var last = start;
85
- for (var halving = 0u; halving < 6u; halving++) {
86
- let mid = 0.5 * (lo + hi);
87
- let probe = water_particle_over_body(geometry_index, mix(before, after, mid) / scale);
88
- if (probe.t >= 0.0) { lo = mid; last = probe; } else { hi = mid; }
89
- }
90
- // the mirror image of its front in the outline's own line, wherever along the step it was crossed
91
- let line = water_outline_line(geometry_index, last.triangle, mix(before, after, lo), scale);
92
- let normal = line.normal;
93
- let direction = water_particle_direction(particle.angle);
94
- let reflected = direction - 2.0 * dot(direction, normal) * normal;
95
- particle.origin -= 2.0 * dot(particle.origin - line.point, normal) * normal;
96
- particle.angle = atan2(reflected.y, reflected.x);
97
- particle.amplitude *= reflection;
98
- // a corner can send the mirror image off the mesh too
99
- if (water_particle_over_body(geometry_index, water_particle_position(particle) / scale).t < 0.0) {
100
- return WaterParticleStep(particle, 0u);
101
- }
102
- }
139
+ // energy spread over the widening circumference and the lengthening envelope (Jeschke & Wojtan 2017 eq. 17), and the
140
+ // water's own damping
141
+ particle.amplitude *= sqrt(max(distance_before, 1e-30) / max(distance_after, 1e-30)
142
+ * half_length_before / water_particle_half_length(particle)) * exp(-water_particle_damping(particle.radius) * dt);
103
143
  // below the threshold a packet fades out rather than vanishing: its amplitude decays on top of the water's own
104
144
  // damping until it is a tenth of the threshold's height, where it dies
105
145
  let floor = threshold * particle.radius;
106
146
  if (!(abs(particle.amplitude) >= floor)) {
107
147
  particle.amplitude *= exp(-dt / WATER_PARTICLE_FADE_SECONDS);
108
- if (!(abs(particle.amplitude) >= 0.1 * floor)) { return WaterParticleStep(particle, 0u); }
148
+ if (!(abs(particle.amplitude) >= 0.1 * floor)) { return WaterParticleStep(particle, particle, 0u); }
149
+ }
150
+ // its support: its envelope's half-length either side of its front, its window's angle either side of its axis
151
+ let reach = water_particle_half_length(particle);
152
+ // whether any of it may still be over the body
153
+ var remains = true;
154
+ var image = particle;
155
+ var mirrored = false;
156
+ if (particle.reflected == 0u) {
157
+ // which of its leading arc's tested points are over the body: what the hint knows, then the axis's by a down-ray,
158
+ // the ends by the triangle under it, which covers them away from the outline, and the rest by a down-ray each
159
+ let ahead = distance_after + reach;
160
+ var known = hint.known;
161
+ var over = hint.over & known;
162
+ var triangle = hint.triangle;
163
+ if ((known & 1u) == 0u) {
164
+ let hit = water_particle_over_body(geometry_index, water_particle_support_point(particle, 0u, ahead) / scale);
165
+ known |= 1u;
166
+ over |= select(0u, 1u, hit.t >= 0.0);
167
+ triangle = hit.triangle;
168
+ }
169
+ if ((over & 1u) != 0u && (known & 6u) != 6u) {
170
+ var a: vec3<f32>;
171
+ var b: vec3<f32>;
172
+ var c: vec3<f32>;
173
+ geometry_read_triangle_positions(&a, &b, &c, geometries[geometry_index], triangle);
174
+ for (var k = 1u; k < 3u; k++) {
175
+ if (((known >> k) & 1u) == 0u && water_triangle_covers(a.xz, b.xz, c.xz, water_particle_support_point(particle, k, ahead) / scale)) {
176
+ known |= 1u << k;
177
+ over |= 1u << k;
178
+ }
179
+ }
180
+ }
181
+ for (var k = 1u; k < 3u; k++) {
182
+ if (((known >> k) & 1u) == 0u
183
+ && water_particle_over_body(geometry_index, water_particle_support_point(particle, k, ahead) / scale).t >= 0.0) { over |= 1u << k; }
184
+ }
185
+ // the first of them to leave the body: one off it whose radius was over it where its trailing arc was when the
186
+ // step began. With none over it there, the point is not leaving the body but entering it, as a mirror image's
187
+ // do: every radius of one starts beyond its outline.
188
+ var crossing = 3u;
189
+ var back = vec2<f32>(0.0);
190
+ var last: ${RAY_HIT_INFO.wgsl_ref};
191
+ for (var k = 0u; k < 3u && crossing == 3u; k++) {
192
+ if (((over >> k) & 1u) != 0u) { continue; }
193
+ back = water_particle_support_point(particle, k, distance_before - reach);
194
+ last = water_particle_over_body(geometry_index, back / scale);
195
+ if (last.t >= 0.0) { crossing = k; }
196
+ }
197
+ if (crossing < 3u) {
198
+ // it is kept this step: if all of it has left the body too, it dies at the next, unseen beyond the outline
199
+ particle.reflected = 1u;
200
+ // where from there that radius leaves the body
201
+ let leading = water_particle_support_point(particle, crossing, ahead);
202
+ var lo = 0.0;
203
+ var hi = 1.0;
204
+ for (var halving = 0u; halving < 10u; halving++) {
205
+ let mid = 0.5 * (lo + hi);
206
+ let probe = water_particle_over_body(geometry_index, mix(back, leading, mid) / scale);
207
+ if (probe.t >= 0.0) { lo = mid; last = probe; } else { hi = mid; }
208
+ }
209
+ // the mirror image of its front in the outline's own line, wherever that was crossed
210
+ image = water_particle_mirrored(particle, water_outline_line(geometry_index, last.triangle, mix(back, leading, lo), scale));
211
+ image.amplitude *= reflection;
212
+ mirrored = abs(image.amplitude) >= 0.1 * floor;
213
+ } else if (over == 0u) {
214
+ // with none of them over the body and none leaving it, all of it is beyond the outline: a splash off the
215
+ // mesh, or a mirror image landing off it at a corner (one entering the body has the point it was mirrored
216
+ // from over it)
217
+ remains = false;
218
+ }
219
+ } else {
220
+ remains = water_particle_arc_over(particle, geometry_index, scale, distance_after - reach);
109
221
  }
110
- // Yuksel's subdivision, at a coarser spacing: the window along the front keeps its height
111
- if (water_particle_width(particle) > 2.0 * particle.radius) { return WaterParticleStep(particle, 3u); }
112
- return WaterParticleStep(particle, 1u);
222
+ // Yuksel's subdivision, at a coarser spacing: the three windows of a third of the angle sum to the front's height
223
+ // as the parents' did, so the surface does not change. A window splits once its arc along the front is longer than
224
+ // its envelope is across it, so a packet's support stays about round, whatever its stretch. An image is as wide as
225
+ // its packet and splits with it.
226
+ let split = select(1u, 3u, water_particle_width(particle) > water_particle_half_length(particle));
227
+ // a reflected packet lives until the last of it has left the body
228
+ if (!remains) { return WaterParticleStep(particle, particle, 0u); }
229
+ if (mirrored) { return WaterParticleStep(particle, image, 2u * split); }
230
+ return WaterParticleStep(particle, particle, split);
113
231
  }
114
232
 
115
233
  // The death threshold: a packet flatter than the body's own wind waves is not drawn, and the fuller the pool,
@@ -118,4 +236,4 @@ fn water_particle_threshold(slope_variance: f32, live: u32, capacity: u32) -> f3
118
236
  let pressure = f32(live) / f32(max(capacity, 1u));
119
237
  return max(0.003, 0.1 * sqrt(max(slope_variance, 0.0))) / max(1.0 - pressure, 0.05);
120
238
  }
121
- `, [chunk_water_particle, chunk_ray_query_blas_nearest]);
239
+ `, [chunk_water_particle, chunk_ray_query_blas_nearest, chunk_geometry_read_triangle_positions]);
@@ -11,25 +11,54 @@ export const WATER_PARTICLE_CORNERS: 4;
11
11
  /** Buckets ordered by particle; a crowded bucket past this keeps its arrival order. */
12
12
  export const WATER_PARTICLE_RANK_LIMIT: 64;
13
13
  /**
14
- * Packets a crowded cell keeps: where more crowd a cell, each is drawn by its share of the cell's summed steepness
15
- * times this, so about this many stay, the steepest whole. Well under the surface sampler's gather budget and the rank
16
- * limit, so a point reads all of its cell and every bucket keeps the particles' order.
14
+ * Packets a crowded point keeps. A point reads a cell of every level its body has, and a cell is crowded where its most
15
+ * crowded point reads more than this: a point of it at its level and the coarser ones, or one under it where finer
16
+ * levels hold packets too. Then each run of a front in it is drawn by its packets' least share of their cells: this
17
+ * many times the packet's steepness over the summed steepness that point reads, whatever the levels it is read at. So
18
+ * about this many stay at a point, the steepest whole wherever they sit, and a front stays whole or goes. What is
19
+ * elsewhere on the body does not count, so a splash far off, or a front moving to a coarser level, changes nothing here.
20
+ *
21
+ * A front's lot is its own for life and the same in every cell it reaches, so the fronts of the lowest lots are kept in
22
+ * every crowd they are in, whatever their size: the count at a point varies by fronts' worth around this, and a front
23
+ * the outline broke is drawn particle by particle, ~20 entries in one cell. Where a point would read more than the
24
+ * gather budget, its cells keep no more of it than their steepness's part, the lowest keys first
25
+ * ({@link WATER_PARTICLE_CROWD_BINS}), so no point reads past the budget. A whole front is drawn as the seven it was
26
+ * emitted as (water_particle_group), so three fresh splashes cross whole, whatever their steepness and levels; a fourth
27
+ * over them thins one.
28
+ *
29
+ * A cell only one front reaches is not crowded, however many of its packets it holds: one front puts at most ~40 in
30
+ * a cell, within the gather budget.
31
+ */
32
+ export const WATER_PARTICLE_CELL_SHARE: 24;
33
+ /**
34
+ * Octaves a crowded cell counts its entries in, by the key its lottery keeps them by (a front's lot over its
35
+ * steepness; the lowest kept first), below the most it can keep: bin j holds keys from 2^-(j+1) of that reach to
36
+ * 2^-j of it, the last everything below. A cell whose point could read past the gather budget drops its octaves from
37
+ * the top until the rest fit its part of the budget, so it may keep up to an octave's worth fewer than would fit.
38
+ */
39
+ export const WATER_PARTICLE_CROWD_BINS: 4;
40
+ /**
41
+ * Words a bucket's crowd takes, as the weigh pass sums it: its summed steepness, its largest front and complement of a
42
+ * front entered, and its entries.
17
43
  */
18
- export const WATER_PARTICLE_CELL_SHARE: 16;
44
+ export const WATER_PARTICLE_CROWD_WORDS: 4;
45
+ /**
46
+ * Words the nest pass adds to a bucket's crowd, in a buffer of their own so that it reads weigh's sums as plain loads:
47
+ * the most entries and the most summed steepness a point under it reads where finer levels hold packets, and its
48
+ * entries by key, {@link WATER_PARTICLE_CROWD_BINS} octaves.
49
+ */
50
+ export const WATER_PARTICLE_NEST_WORDS: number;
19
51
  /** Width of the ramp a thinned packet fades over, a fraction of its share. */
20
52
  export const WATER_PARTICLE_THINNING_RAMP: 0.25;
21
53
  /** The step's settings: one immediate per entry point. */
22
54
  export const WATER_PARTICLE_STEP_STRUCT: WebGPUStruct;
23
55
  /** The pool's limits for the frame's finalize. */
24
56
  export const WATER_PARTICLE_LIMITS_STRUCT: WebGPUStruct;
25
- /**
26
- * Advance every live particle of a body simulated this frame in place and count what it leaves: 0, 1 or 3. A paused
27
- * body's particles stand still and leave themselves.
28
- */
29
57
  export const shader_water_particles_update: ComputeShader;
30
58
  /**
31
- * Write what each particle leaves into the next array at its scanned offset, in order: a split particle's
32
- * three at θ − β/3, θ, θ + β/3 with β/3 each. Past capacity, the tail is dropped.
59
+ * Write what each particle leaves into the next array at its scanned offset, in order: the particle, then the mirror
60
+ * image it left; each split one's three at θ − β/3, θ, θ + β/3 with β/3 each. So a front's particles stay in a row
61
+ * and in order, and an image follows its packet as a front of its own. Past capacity, the tail is dropped.
33
62
  */
34
63
  export const shader_water_particles_split: ComputeShader;
35
64
  /** The next array's count: everything the scan placed, up to capacity. */
@@ -37,30 +66,71 @@ export const shader_water_particles_total: ComputeShader;
37
66
  /**
38
67
  * Each queued splash of a row on the culling pass's emit list becomes a ring
39
68
  * (WATER_SURFACE_SIMULATION_PLAN_2026_10_06.md §5.3): packets of the splash's radius r, two radii out from its centre,
40
- * a front's width apart, ridge height strength·r/c (a vertical velocity over the time a crest takes to cross the
69
+ * their windows' arcs no longer than their envelopes, ridge height strength·r/c (a vertical velocity over the time a crest takes to cross the
41
70
  * packet), no steeper than 0.1. The row's queue is spent. A paused body's ring stands still with its other particles,
42
71
  * which this frame's binning does not visit, so the ring's bound is added to the body's own here.
43
72
  */
44
73
  export const shader_water_particles_emit: ComputeShader;
45
74
  /**
46
75
  * The live count, clamped to capacity (emitters append past it), and the frame's hash table size: twice the
47
- * entries the particles can take, a power of two, at least ${WATER_PARTICLE_TABLE_MIN}.
76
+ * entries the particles can take, a power of two, at least ${WATER_PARTICLE_TABLE_MIN}; and the command that clears
77
+ * that much of the table, a thread a bucket.
48
78
  */
49
79
  export const shader_water_particles_finalize: ComputeShader;
50
80
  /**
51
- * Each particle of a body simulated this frame adds its steepness to every cell its support overlaps: how crowded a
52
- * cell is, for the bin pass to thin it by.
81
+ * Zero the frame's table, as far as finalize sized it: each bucket's count, largest |a| and crowd. A frame pays for the
82
+ * table its particles take, not for the pool's capacity; the buckets past it are never read.
83
+ */
84
+ export const shader_water_particles_clear: ComputeShader;
85
+ /**
86
+ * Where each front's run of particles begins: 1 at a particle not of the front before it, else 0. A front keeps its
87
+ * particles in a row and in order — a ring is emitted whole, a split puts its three in its place, the dead leave no
88
+ * gap — so the inclusive scan of these numbers each run from 1. A mirror image follows its packet in the row: it
89
+ * breaks its front's run there, as a death does, and is a front of its own.
90
+ */
91
+ export const shader_water_particles_fronts: ComputeShader;
92
+ /**
93
+ * Two words a run: its first particle, and the share its crowd leaves it, none yet (the share pass lowers it).
94
+ */
95
+ export const shader_water_particles_runs: ComputeShader;
96
+ /**
97
+ * Two words a particle: its run, and how the frame draws it ({@link chunk_water_particle}'s water_particle_group): 1 as
98
+ * itself, 0 not at all, 3^g for the middle of a whole front's group of 3^g, drawn as one packet.
99
+ */
100
+ export const shader_water_particles_groups: ComputeShader;
101
+ /**
102
+ * Each packet drawn of a body simulated this frame adds its steepness to every cell its support overlaps: how crowded
103
+ * a cell is, for the share pass to thin it by. Per bucket ({@link WATER_PARTICLE_CROWD_WORDS}) the sum, the largest
104
+ * front and complement of a front entered, which are each other's complements only where one front alone was, and the
105
+ * entries. And its level to its body's: a point reads a cell of every level its body has.
53
106
  */
54
107
  export const shader_water_particles_weigh: ComputeShader;
55
108
  /**
56
- * Enter each particle of a body simulated this frame in every hash cell its support overlaps: count it into the cell's
57
- * bucket, keep its slot there, raise the bucket's largest |a| to its own, and mark its level on its body. One atomic
58
- * each: no compare-exchange loop a crowded bucket would serialize. A paused body's particles take no slot: nothing
59
- * draws them this frame.
109
+ * Each packet drawn of a body simulated this frame, its cells weighed: what a point of each of its cells reads at its
110
+ * level and the coarser ones, entries and summed steepness, raised onto the cell over it at every coarser level its
111
+ * body has, so a cell knows its most crowded point where finer levels hold packets under it; and its entry counted
112
+ * among its cell's by its key (water_particle_crowd_bin), for the share pass to cap a crowd by.
113
+ */
114
+ export const shader_water_particles_nest: ComputeShader;
115
+ /**
116
+ * Each packet drawn its share of the most crowded of its cells, lowered onto its run: a run is thinned whole, by the most
117
+ * crowded cell any of its packets is in, so a front is never holed. A cell is crowded where its most crowded point (one
118
+ * of it at its level and the coarser ones, or one under it the nest pass raised) reads more than
119
+ * {@link WATER_PARTICLE_CELL_SHARE} entries, and a packet's share there is that many times its steepness over the summed
120
+ * steepness that point reads. Where that point would read more than the gather budget, the cell keeps no more of it
121
+ * than its own steepness's part: its keys' octaves dropped from the top until the rest fit
122
+ * ({@link WATER_PARTICLE_CROWD_BINS}). A cell only one front reaches does not count.
123
+ */
124
+ export const shader_water_particles_share: ComputeShader;
125
+ /**
126
+ * Enter each packet drawn of a body simulated this frame in every hash cell its support overlaps: count it into the
127
+ * cell's bucket, keep its slot there, raise the bucket's largest |a| to its own, and mark its level on its body. One
128
+ * atomic each: no compare-exchange loop a crowded bucket would serialize. A paused body's particles take no slot:
129
+ * nothing draws them this frame.
60
130
  *
61
- * Where cells are crowded (the weigh pass), a particle is drawn by how much its most crowded cell leaves it
62
- * ({@link WATER_PARTICLE_CELL_SHARE}): one decision for all its cells, so the surface stays continuous across them, and
63
- * from its own lot, so it does not change with the order particles arrive in. One left out takes no slot.
131
+ * Where cells are crowded (the share pass), a run is drawn by the share its most crowded cell leaves it and its
132
+ * front's lot: one decision for all its packets and all their cells, so neither a front nor the surface across cells
133
+ * is holed, and it does not change with the order particles arrive in. One left out takes no slot.
64
134
  */
65
135
  export const shader_water_particles_bin: ComputeShader;
66
136
  /** Each entry to its bucket's range, in arrival order, at the height its crowd leaves it; the rank pass orders it. */
@@ -1 +1 @@
1
- {"version":3,"file":"shader_water_particles.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/water/surface/particles/shader_water_particles.js"],"names":[],"mappings":"AAuBA,uFAAuF;AACvF,uDAGE;AAEF,+DAA+D;AAC/D,8DAGE;AAEF,oFAAoF;AACpF,yDAGE;AAEF,0DAA0D;AAC1D,4CAA6C;AAE7C,gFAAgF;AAChF,uCAAwC;AAExC,uFAAuF;AACvF,2CAA4C;AAE5C;;;;GAIG;AACH,2CAA4C;AAE5C,8EAA8E;AAC9E,gDAAiD;AAOjD,0DAA0D;AAC1D,sDAAqH;AAErH,kDAAkD;AAClD,wDAA0H;AAe1H;;;GAGG;AACH,0DA0B8G;AAS9G;;;GAGG;AACH,yDAsB+E;AAQ/E,0EAA0E;AAC1E,yDAOiD;AAYjD;;;;;;GAMG;AACH,wDAwC0C;AAQ1C;;;GAGG;AACH,4DASiD;AA+DjD;;;GAGG;AACH,yDAekE;AAalE;;;;;;;;;GASG;AACH,uDAqCkE;AAUlE,sHAAsH;AACtH,2DAqBkE;AAUlE;;;;GAIG;AACH,wDA8BkE;AAUlE;;;;;GAKG;AACH,0DAqBkE;6BAjfrC,sCAAsC;8BAJrC,kCAAkC"}
1
+ {"version":3,"file":"shader_water_particles.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/water/surface/particles/shader_water_particles.js"],"names":[],"mappings":"AA0BA,uFAAuF;AACvF,uDAGE;AAEF,+DAA+D;AAC/D,8DAGE;AAEF,oFAAoF;AACpF,yDAGE;AAEF,0DAA0D;AAC1D,4CAA6C;AAE7C,gFAAgF;AAChF,uCAAwC;AAExC,uFAAuF;AACvF,2CAA4C;AAE5C;;;;;;;;;;;;;;;;;;GAkBG;AACH,2CAA4C;AAE5C;;;;;GAKG;AACH,0CAA2C;AAE3C;;;GAGG;AACH,2CAA4C;AAE5C;;;;GAIG;AACH,+CAAuE;AAEvE,8EAA8E;AAC9E,gDAAiD;AAUjD,0DAA0D;AAC1D,sDAAqH;AAErH,kDAAkD;AAClD,wDAA0H;AAuF1H,0DACyB;AAUzB;;;;GAIG;AACH,yDA4B+E;AAQ/E,0EAA0E;AAC1E,yDAOiD;AAYjD;;;;;;GAMG;AACH,wDAyC0C;AAS1C;;;;GAIG;AACH,4DAaiD;AASjD;;;GAGG;AACH,yDAWsC;AA6FtC;;;;;GAKG;AACH,0DAQ4D;AAQ5D;;GAEG;AACH,wDAY+E;AAS/E;;;GAGG;AACH,0DAc4D;AAW5D;;;;;GAKG;AACH,yDAuBkE;AAYlE;;;;;GAKG;AACH,wDAwCkE;AAalE;;;;;;;;GAQG;AACH,yDAoDkE;AAclE;;;;;;;;;GASG;AACH,uDA6BkE;AAWlE,sHAAsH;AACtH,2DAuBkE;AAWlE;;;;GAIG;AACH,wDAgCkE;AAWlE;;;;;GAKG;AACH,0DAuBkE;6BAp2BrC,sCAAsC;8BAJrC,kCAAkC"}