@woosh/meep-engine 3.45.0 → 3.47.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 (435) hide show
  1. package/build/bundle-worker-terrain.js +1 -1
  2. package/editor/actions/concrete/TransformModifyAction.d.ts.map +1 -1
  3. package/editor/actions/concrete/TransformModifyAction.js +10 -2
  4. package/editor/ecs/component/FieldDescriptor.js +15 -0
  5. package/editor/ecs/component/createObjectEditor.js +41 -12
  6. package/editor/ecs/component/editors/ecs/Transform64Editor.d.ts.map +1 -1
  7. package/editor/ecs/component/editors/ecs/Transform64Editor.js +77 -70
  8. package/editor/tools/TransformToolV2.d.ts.map +1 -1
  9. package/editor/tools/TransformToolV2.js +4 -0
  10. package/editor/tools/v2/TransformControls.d.ts.map +1 -1
  11. package/editor/tools/v2/TransformControls.js +7 -0
  12. package/editor/view/ecs/EntityEditor.d.ts.map +1 -1
  13. package/editor/view/ecs/EntityEditor.js +4 -2
  14. package/package.json +1 -1
  15. package/src/core/assert.d.ts.map +1 -1
  16. package/src/core/assert.js +5 -1
  17. package/src/core/binary/hash/XXH128Hash.d.ts +1 -37
  18. package/src/core/binary/hash/XXH128Hash.d.ts.map +1 -1
  19. package/src/core/binary/hash/XXH128Hash.js +4 -55
  20. package/src/core/binary/hash/XXH3_SECRET.d.ts +1 -12
  21. package/src/core/binary/hash/XXH3_SECRET.d.ts.map +1 -1
  22. package/src/core/binary/hash/XXH3_SECRET.js +4 -25
  23. package/src/core/binary/hash/crc32.d.ts +1 -15
  24. package/src/core/binary/hash/crc32.d.ts.map +1 -1
  25. package/src/core/binary/hash/crc32.js +4 -96
  26. package/src/core/binary/hash/xxh3_128.d.ts +1 -9
  27. package/src/core/binary/hash/xxh3_128.d.ts.map +1 -1
  28. package/src/core/binary/hash/xxh3_128.js +4 -341
  29. package/src/core/binary/hash/xxh3_64.d.ts +1 -8
  30. package/src/core/binary/hash/xxh3_64.d.ts.map +1 -1
  31. package/src/core/binary/hash/xxh3_64.js +4 -241
  32. package/src/core/binary/hash/xxh3_common.d.ts +1 -223
  33. package/src/core/binary/hash/xxh3_common.d.ts.map +1 -1
  34. package/src/core/binary/hash/xxh3_common.js +90 -476
  35. package/src/core/collection/array/array_insert_at.d.ts +16 -0
  36. package/src/core/collection/array/array_insert_at.d.ts.map +1 -0
  37. package/src/core/collection/array/array_insert_at.js +32 -0
  38. package/src/core/collection/array/array_remove_at.d.ts +15 -0
  39. package/src/core/collection/array/array_remove_at.d.ts.map +1 -0
  40. package/src/core/collection/array/array_remove_at.js +30 -0
  41. package/src/core/collection/array/combine_hash.d.ts +6 -0
  42. package/src/core/collection/array/combine_hash.d.ts.map +1 -1
  43. package/src/core/collection/array/combine_hash.js +6 -0
  44. package/src/core/function/FunctionCompiler.js +2 -2
  45. package/src/core/geom/3d/mat4/m4_multiply.d.ts +3 -0
  46. package/src/core/geom/3d/mat4/m4_multiply.d.ts.map +1 -1
  47. package/src/core/geom/3d/mat4/m4_multiply.js +3 -0
  48. package/src/core/geom/3d/mat4/m4_multiply_f64.d.ts +30 -0
  49. package/src/core/geom/3d/mat4/m4_multiply_f64.d.ts.map +1 -0
  50. package/src/core/geom/3d/mat4/m4_multiply_f64.js +106 -0
  51. package/src/core/geom/3d/quaternion/quat3_look_rotation.d.ts +37 -0
  52. package/src/core/geom/3d/quaternion/quat3_look_rotation.d.ts.map +1 -0
  53. package/src/core/geom/3d/quaternion/quat3_look_rotation.js +172 -0
  54. package/src/core/geom/ConicRay.js +2 -2
  55. package/src/core/geom/Quaternion.d.ts +1 -0
  56. package/src/core/geom/Quaternion.d.ts.map +1 -1
  57. package/src/core/geom/Quaternion.js +12 -48
  58. package/src/core/geom/Vector4.d.ts.map +1 -1
  59. package/src/core/geom/Vector4.js +8 -5
  60. package/src/core/math/hash/XXH128Hash.d.ts +38 -0
  61. package/src/core/math/hash/XXH128Hash.d.ts.map +1 -0
  62. package/src/core/math/hash/XXH128Hash.js +55 -0
  63. package/src/core/math/hash/XXH3_SECRET.d.ts +13 -0
  64. package/src/core/math/hash/XXH3_SECRET.d.ts.map +1 -0
  65. package/src/core/math/hash/XXH3_SECRET.js +25 -0
  66. package/src/core/math/hash/crc32.d.ts +16 -0
  67. package/src/core/math/hash/crc32.d.ts.map +1 -0
  68. package/src/core/math/hash/crc32.js +96 -0
  69. package/src/core/math/hash/xxh3_128.d.ts +10 -0
  70. package/src/core/math/hash/xxh3_128.d.ts.map +1 -0
  71. package/src/core/math/hash/xxh3_128.js +341 -0
  72. package/src/core/math/hash/xxh3_64.d.ts +9 -0
  73. package/src/core/math/hash/xxh3_64.d.ts.map +1 -0
  74. package/src/core/math/hash/xxh3_64.js +241 -0
  75. package/src/core/math/hash/xxh3_common.d.ts +224 -0
  76. package/src/core/math/hash/xxh3_common.d.ts.map +1 -0
  77. package/src/core/math/hash/xxh3_common.js +476 -0
  78. package/src/core/math/lookup/ParameterLookupTable.js +2 -2
  79. package/src/core/model/node-graph/node/NodeInstancePortReference.js +2 -2
  80. package/src/core/model/reactive/model/ReactiveBinaryExpression.js +2 -2
  81. package/src/core/model/reactive/model/terminal/ReactiveReference.js +2 -2
  82. package/src/engine/Engine.d.ts.map +1 -1
  83. package/src/engine/Engine.js +9 -4
  84. package/src/engine/asset/AssetDescription.js +2 -2
  85. package/src/engine/ecs/animation/Animation.js +2 -2
  86. package/src/engine/ecs/animation/AnimationClip.d.ts.map +1 -1
  87. package/src/engine/ecs/animation/AnimationClip.js +7 -5
  88. package/src/engine/ecs/gui/GUIElement.d.ts.map +1 -1
  89. package/src/engine/ecs/gui/GUIElement.js +7 -5
  90. package/src/engine/ecs/gui/hud/HeadsUpDisplay.js +2 -2
  91. package/src/engine/ecs/gui/position/ViewportPosition.d.ts.map +1 -1
  92. package/src/engine/ecs/gui/position/ViewportPosition.js +11 -7
  93. package/src/engine/ecs/storage/populateEngineSerializationRegistry.d.ts.map +1 -1
  94. package/src/engine/ecs/storage/populateEngineSerializationRegistry.js +10 -0
  95. package/src/engine/ecs/transform/Transform64.d.ts +1 -1
  96. package/src/engine/ecs/transform/Transform64.d.ts.map +1 -1
  97. package/src/engine/ecs/transform/Transform64.js +5 -4
  98. package/src/engine/ecs/transform/t64_look_rotation.d.ts +4 -4
  99. package/src/engine/ecs/transform/t64_look_rotation.d.ts.map +1 -1
  100. package/src/engine/ecs/transform/t64_look_rotation.js +7 -18
  101. package/src/engine/graphics/ecs/animation/animator/AnimationClip.d.ts.map +1 -1
  102. package/src/engine/graphics/ecs/animation/animator/AnimationClip.js +8 -5
  103. package/src/engine/graphics/ecs/animation/animator/AnimationClipDefinition.js +2 -2
  104. package/src/engine/graphics/ecs/animation/animator/AnimationNotification.js +2 -2
  105. package/src/engine/graphics/ecs/animation/animator/AnimationNotificationDefinition.js +2 -2
  106. package/src/engine/graphics/ecs/animation/animator/graph/definition/AnimationGraphDefinition.js +2 -2
  107. package/src/engine/graphics/ecs/animation/animator/graph/definition/AnimationStateDefinition.js +2 -2
  108. package/src/engine/graphics/ecs/animation/animator/graph/definition/AnimationTransitionDefinition.d.ts.map +1 -1
  109. package/src/engine/graphics/ecs/animation/animator/graph/definition/AnimationTransitionDefinition.js +8 -5
  110. package/src/engine/graphics/ecs/camera/topdown/TopDownCameraControllerSystem.d.ts.map +1 -1
  111. package/src/engine/graphics/ecs/camera/topdown/TopDownCameraControllerSystem.js +30 -1
  112. package/src/engine/graphics/ecs/decal/v2/Decal.d.ts.map +1 -1
  113. package/src/engine/graphics/ecs/decal/v2/Decal.js +9 -8
  114. package/src/engine/graphics/render/frame_graph/resource/TextureResourceDescriptor.d.ts.map +1 -1
  115. package/src/engine/graphics/render/frame_graph/resource/TextureResourceDescriptor.js +9 -6
  116. package/src/engine/graphics3/GPUParticleEmitterSystem.d.ts +6 -0
  117. package/src/engine/graphics3/GPUParticleEmitterSystem.d.ts.map +1 -1
  118. package/src/engine/graphics3/GPUParticleEmitterSystem.js +72 -29
  119. package/src/engine/graphics3/ParticipatingMedia.js +204 -204
  120. package/src/engine/graphics3/animation/AnimationClips.d.ts +5 -0
  121. package/src/engine/graphics3/animation/AnimationClips.d.ts.map +1 -1
  122. package/src/engine/graphics3/animation/AnimationClips.js +5 -0
  123. package/src/engine/grid/obstacle/GridObstacle.js +2 -2
  124. package/src/engine/input/devices/KeyboardDevice.d.ts +1 -0
  125. package/src/engine/input/devices/KeyboardDevice.d.ts.map +1 -1
  126. package/src/engine/input/devices/KeyboardDevice.js +7 -6
  127. package/src/engine/intelligence/behavior/selector/WeightedElement.js +2 -2
  128. package/src/engine/interpolation/Interpolated.js +2 -2
  129. package/src/engine/navigation/ecs/path_following/PathFollowingSystem.d.ts.map +1 -1
  130. package/src/engine/navigation/ecs/path_following/PathFollowingSystem.js +15 -2
  131. package/src/engine/network/CONGESTION_CONTROL.md +9 -9
  132. package/src/engine/network/MESSAGE_TRANSPORT.md +364 -0
  133. package/src/engine/network/NetworkSession.d.ts +31 -11
  134. package/src/engine/network/NetworkSession.d.ts.map +1 -1
  135. package/src/engine/network/NetworkSession.js +453 -286
  136. package/src/engine/network/README.md +77 -27
  137. package/src/engine/network/SMOOTHNESS_DESIGN.md +13 -5
  138. package/src/engine/network/diagnostics/BandwidthMeter.d.ts +1 -1
  139. package/src/engine/network/diagnostics/BandwidthMeter.js +1 -1
  140. package/src/engine/network/orchestrator/HostJoin.d.ts +111 -0
  141. package/src/engine/network/orchestrator/HostJoin.d.ts.map +1 -0
  142. package/src/engine/network/orchestrator/HostJoin.js +271 -0
  143. package/src/engine/network/orchestrator/NetworkPeer.d.ts +151 -112
  144. package/src/engine/network/orchestrator/NetworkPeer.d.ts.map +1 -1
  145. package/src/engine/network/orchestrator/NetworkPeer.js +450 -499
  146. package/src/engine/network/orchestrator/PendingSlices.d.ts +30 -0
  147. package/src/engine/network/orchestrator/PendingSlices.d.ts.map +1 -0
  148. package/src/engine/network/orchestrator/PendingSlices.js +83 -0
  149. package/src/engine/network/orchestrator/ReliableFrames.d.ts +34 -0
  150. package/src/engine/network/orchestrator/ReliableFrames.d.ts.map +1 -0
  151. package/src/engine/network/orchestrator/ReliableFrames.js +96 -0
  152. package/src/engine/network/orchestrator/ServerAuthoritativeClient.d.ts +77 -10
  153. package/src/engine/network/orchestrator/ServerAuthoritativeClient.d.ts.map +1 -1
  154. package/src/engine/network/orchestrator/ServerAuthoritativeClient.js +236 -61
  155. package/src/engine/network/orchestrator/ServerAuthoritativeServer.d.ts +20 -6
  156. package/src/engine/network/orchestrator/ServerAuthoritativeServer.d.ts.map +1 -1
  157. package/src/engine/network/orchestrator/ServerAuthoritativeServer.js +33 -8
  158. package/src/engine/network/replication/Replicator.d.ts.map +1 -1
  159. package/src/engine/network/replication/Replicator.js +7 -1
  160. package/src/engine/network/sim/ActionLog.d.ts +32 -5
  161. package/src/engine/network/sim/ActionLog.d.ts.map +1 -1
  162. package/src/engine/network/sim/ActionLog.js +47 -5
  163. package/src/engine/network/sim/SimActionExecutor.d.ts +42 -2
  164. package/src/engine/network/sim/SimActionExecutor.d.ts.map +1 -1
  165. package/src/engine/network/sim/SimActionExecutor.js +100 -4
  166. package/src/engine/network/sim/Snapshotter.d.ts +12 -0
  167. package/src/engine/network/sim/Snapshotter.d.ts.map +1 -1
  168. package/src/engine/network/sim/Snapshotter.js +43 -0
  169. package/src/engine/network/state/Baseline.d.ts +1 -1
  170. package/src/engine/network/state/Baseline.js +1 -1
  171. package/src/engine/network/state/FrameBufferRing.d.ts +25 -6
  172. package/src/engine/network/state/FrameBufferRing.d.ts.map +1 -1
  173. package/src/engine/network/state/FrameBufferRing.js +51 -6
  174. package/src/engine/network/state/InputRing.d.ts +4 -0
  175. package/src/engine/network/state/InputRing.d.ts.map +1 -1
  176. package/src/engine/network/state/InputRing.js +7 -0
  177. package/src/engine/network/transport/DeferredTransport.d.ts.map +1 -1
  178. package/src/engine/network/transport/DeferredTransport.js +1 -0
  179. package/src/engine/network/transport/LoopbackTransport.d.ts.map +1 -1
  180. package/src/engine/network/transport/LoopbackTransport.js +4 -2
  181. package/src/engine/network/transport/Transport.d.ts +7 -0
  182. package/src/engine/network/transport/Transport.d.ts.map +1 -1
  183. package/src/engine/network/transport/Transport.js +8 -0
  184. package/src/engine/network/transport/adapters/NodeUDPTransport.d.ts.map +1 -1
  185. package/src/engine/network/transport/adapters/NodeUDPTransport.js +20 -5
  186. package/src/engine/network/transport/adapters/WebRTCDataChannelTransport.d.ts.map +1 -1
  187. package/src/engine/network/transport/adapters/WebRTCDataChannelTransport.js +8 -0
  188. package/src/engine/network/transport/adapters/WebTransportTransport.d.ts.map +1 -1
  189. package/src/engine/network/transport/adapters/WebTransportTransport.js +6 -0
  190. package/src/engine/network/transport/connection/Connection.d.ts +191 -0
  191. package/src/engine/network/transport/connection/Connection.d.ts.map +1 -0
  192. package/src/engine/network/transport/connection/Connection.js +1262 -0
  193. package/src/engine/network/transport/connection/RangeSet.d.ts +94 -0
  194. package/src/engine/network/transport/connection/RangeSet.d.ts.map +1 -0
  195. package/src/engine/network/transport/connection/RangeSet.js +260 -0
  196. package/src/engine/network/transport/connection/RxStream.d.ts +48 -0
  197. package/src/engine/network/transport/connection/RxStream.d.ts.map +1 -0
  198. package/src/engine/network/transport/connection/RxStream.js +211 -0
  199. package/src/engine/network/transport/connection/TxStream.d.ts +90 -0
  200. package/src/engine/network/transport/connection/TxStream.d.ts.map +1 -0
  201. package/src/engine/network/transport/connection/TxStream.js +243 -0
  202. package/src/engine/network/transport/connection/bytes_copy.d.ts +17 -0
  203. package/src/engine/network/transport/connection/bytes_copy.d.ts.map +1 -0
  204. package/src/engine/network/transport/connection/bytes_copy.js +34 -0
  205. package/src/engine/network/transport/connection/varint.d.ts +46 -0
  206. package/src/engine/network/transport/connection/varint.d.ts.map +1 -0
  207. package/src/engine/network/transport/connection/varint.js +107 -0
  208. package/src/engine/physics/cloth/ecs/Cloth.d.ts.map +1 -1
  209. package/src/engine/physics/cloth/ecs/Cloth.js +7 -5
  210. package/src/engine/physics/cloth/ecs/ClothCollider.d.ts.map +1 -1
  211. package/src/engine/physics/cloth/ecs/ClothCollider.js +7 -5
  212. package/src/engine/physics/cloth/ecs/ClothDynamics.d.ts.map +1 -1
  213. package/src/engine/physics/cloth/ecs/ClothDynamics.js +20 -11
  214. package/src/engine/physics/fluid/FluidField.d.ts.map +1 -1
  215. package/src/engine/physics/fluid/FluidField.js +7 -5
  216. package/src/engine/physics/fluid/ecs/FluidComponent.d.ts.map +1 -1
  217. package/src/engine/physics/fluid/ecs/FluidComponent.js +19 -11
  218. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
  219. package/src/engine/physics/fluid/effector/AbstractFluidEffector.d.ts +2 -2
  220. package/src/engine/physics/fluid/effector/AbstractFluidEffector.js +2 -2
  221. package/src/engine/physics/fluid/effector/GlobalFluidEffector.d.ts.map +1 -1
  222. package/src/engine/physics/fluid/effector/GlobalFluidEffector.js +11 -7
  223. package/src/engine/physics/fluid/effector/ImpulseFluidEffector.d.ts.map +1 -1
  224. package/src/engine/physics/fluid/effector/ImpulseFluidEffector.js +11 -7
  225. package/src/engine/physics/fluid/effector/WakeFluidEffector.d.ts.map +1 -1
  226. package/src/engine/physics/fluid/effector/WakeFluidEffector.js +16 -9
  227. package/src/engine/sound/ecs/audio/AudioEmitter.d.ts +38 -7
  228. package/src/engine/sound/ecs/audio/AudioEmitter.d.ts.map +1 -1
  229. package/src/engine/sound/ecs/audio/AudioEmitter.js +47 -14
  230. package/src/engine/sound/ecs/audio/AudioEmitterSerializationAdapter.d.ts.map +1 -1
  231. package/src/engine/sound/ecs/audio/AudioEmitterSerializationAdapter.js +5 -1
  232. package/src/engine/sound/ecs/audio/AudioEmitterSerializationUpgrader_0_1.d.ts +18 -0
  233. package/src/engine/sound/ecs/audio/AudioEmitterSerializationUpgrader_0_1.d.ts.map +1 -0
  234. package/src/engine/sound/ecs/audio/AudioEmitterSerializationUpgrader_0_1.js +48 -0
  235. package/src/engine/sound/ecs/audio/AudioEmitterSystem.d.ts +12 -2
  236. package/src/engine/sound/ecs/audio/AudioEmitterSystem.d.ts.map +1 -1
  237. package/src/engine/sound/ecs/audio/AudioEmitterSystem.js +173 -9
  238. package/src/engine/sound/ecs/audio/LiveEmitterSet.d.ts +9 -3
  239. package/src/engine/sound/ecs/audio/LiveEmitterSet.d.ts.map +1 -1
  240. package/src/engine/sound/ecs/audio/LiveEmitterSet.js +28 -8
  241. package/src/engine/sound/ecs/trigger/AudioEventTrigger.d.ts +8 -0
  242. package/src/engine/sound/ecs/trigger/AudioEventTrigger.d.ts.map +1 -1
  243. package/src/engine/sound/ecs/trigger/AudioEventTrigger.js +192 -191
  244. package/src/engine/sound/ecs/trigger/AudioEventTriggerSerializationAdapter.d.ts.map +1 -1
  245. package/src/engine/sound/ecs/trigger/AudioEventTriggerSerializationAdapter.js +5 -1
  246. package/src/engine/sound/ecs/trigger/AudioEventTriggerSerializationUpgrader_0_1.d.ts +18 -0
  247. package/src/engine/sound/ecs/trigger/AudioEventTriggerSerializationUpgrader_0_1.d.ts.map +1 -0
  248. package/src/engine/sound/ecs/trigger/AudioEventTriggerSerializationUpgrader_0_1.js +51 -0
  249. package/src/engine/sound/ecs/trigger/AudioEventTriggerSystem.d.ts.map +1 -1
  250. package/src/engine/sound/ecs/trigger/AudioEventTriggerSystem.js +15 -1
  251. package/src/engine/sound/simulation/core/AcousticMedium.js +2 -2
  252. package/src/engine/sound/simulation/definition/AcousticDirectivity.js +2 -2
  253. package/src/engine/sound/simulation/definition/AcousticMaterial.d.ts.map +1 -1
  254. package/src/engine/sound/simulation/definition/AcousticMaterial.js +11 -7
  255. package/src/engine/sound/sopra/README.md +768 -644
  256. package/src/engine/sound/sopra/SopraEngine.d.ts +104 -8
  257. package/src/engine/sound/sopra/SopraEngine.d.ts.map +1 -1
  258. package/src/engine/sound/sopra/SopraEngine.js +327 -12
  259. package/src/engine/sound/sopra/definition/BusDefinition.d.ts.map +1 -1
  260. package/src/engine/sound/sopra/definition/BusDefinition.js +5 -4
  261. package/src/engine/sound/sopra/definition/DuckingRule.d.ts.map +1 -1
  262. package/src/engine/sound/sopra/definition/DuckingRule.js +7 -5
  263. package/src/engine/sound/sopra/definition/EventDescription.d.ts +28 -2
  264. package/src/engine/sound/sopra/definition/EventDescription.d.ts.map +1 -1
  265. package/src/engine/sound/sopra/definition/EventDescription.js +77 -17
  266. package/src/engine/sound/sopra/definition/EventDescriptionSerializationAdapter.d.ts +10 -0
  267. package/src/engine/sound/sopra/definition/EventDescriptionSerializationAdapter.d.ts.map +1 -1
  268. package/src/engine/sound/sopra/definition/EventDescriptionSerializationAdapter.js +77 -55
  269. package/src/engine/sound/sopra/definition/EventDescriptionSerializationUpgrader_0_1.d.ts +31 -0
  270. package/src/engine/sound/sopra/definition/EventDescriptionSerializationUpgrader_0_1.d.ts.map +1 -0
  271. package/src/engine/sound/sopra/definition/EventDescriptionSerializationUpgrader_0_1.js +75 -0
  272. package/src/engine/sound/sopra/definition/MixerSnapshot.js +2 -2
  273. package/src/engine/sound/sopra/definition/ParameterDefinition.d.ts.map +1 -1
  274. package/src/engine/sound/sopra/definition/ParameterDefinition.js +7 -5
  275. package/src/engine/sound/sopra/definition/clip/AbstractAudioClip.js +2 -2
  276. package/src/engine/sound/sopra/definition/clip/BlendContainerAudioClip.d.ts.map +1 -1
  277. package/src/engine/sound/sopra/definition/clip/BlendContainerAudioClip.js +4 -3
  278. package/src/engine/sound/sopra/definition/clip/ContainerAudioClip.js +2 -2
  279. package/src/engine/sound/sopra/definition/clip/RandomContainerAudioClip.js +3 -3
  280. package/src/engine/sound/sopra/definition/clip/SampleAudioClip.d.ts.map +1 -1
  281. package/src/engine/sound/sopra/definition/clip/SampleAudioClip.js +16 -9
  282. package/src/engine/sound/sopra/definition/clip/SilenceAudioClip.js +2 -2
  283. package/src/engine/sound/sopra/definition/clip/SwitchContainerAudioClip.d.ts +1 -1
  284. package/src/engine/sound/sopra/definition/clip/SwitchContainerAudioClip.d.ts.map +1 -1
  285. package/src/engine/sound/sopra/definition/clip/SwitchContainerAudioClip.js +2 -2
  286. package/src/engine/sound/sopra/definition/effect/AbstractAudioEffect.d.ts +38 -9
  287. package/src/engine/sound/sopra/definition/effect/AbstractAudioEffect.d.ts.map +1 -1
  288. package/src/engine/sound/sopra/definition/effect/AbstractAudioEffect.js +34 -5
  289. package/src/engine/sound/sopra/definition/effect/CompressorEffect.d.ts +7 -2
  290. package/src/engine/sound/sopra/definition/effect/CompressorEffect.d.ts.map +1 -1
  291. package/src/engine/sound/sopra/definition/effect/CompressorEffect.js +137 -120
  292. package/src/engine/sound/sopra/definition/effect/EqEffect.d.ts +3 -1
  293. package/src/engine/sound/sopra/definition/effect/EqEffect.d.ts.map +1 -1
  294. package/src/engine/sound/sopra/definition/effect/EqEffect.js +146 -128
  295. package/src/engine/sound/sopra/definition/effect/ReverbEffect.d.ts +1 -0
  296. package/src/engine/sound/sopra/definition/effect/ReverbEffect.d.ts.map +1 -1
  297. package/src/engine/sound/sopra/definition/effect/ReverbEffect.js +8 -3
  298. package/src/engine/sound/sopra/legacy/SoundEmitter.d.ts.map +1 -1
  299. package/src/engine/sound/sopra/legacy/SoundEmitter.js +357 -352
  300. package/src/engine/sound/sopra/legacy/SoundTrack.d.ts.map +1 -1
  301. package/src/engine/sound/sopra/legacy/SoundTrack.js +281 -278
  302. package/src/engine/sound/sopra/runtime/BusGraph.d.ts +44 -2
  303. package/src/engine/sound/sopra/runtime/BusGraph.d.ts.map +1 -1
  304. package/src/engine/sound/sopra/runtime/BusGraph.js +83 -43
  305. package/src/engine/sound/sopra/runtime/EffectChain.d.ts +96 -0
  306. package/src/engine/sound/sopra/runtime/EffectChain.d.ts.map +1 -0
  307. package/src/engine/sound/sopra/runtime/EffectChain.js +286 -0
  308. package/src/engine/sound/sopra/runtime/EffectParamOverrides.d.ts +123 -0
  309. package/src/engine/sound/sopra/runtime/EffectParamOverrides.d.ts.map +1 -0
  310. package/src/engine/sound/sopra/runtime/EffectParamOverrides.js +320 -0
  311. package/src/engine/sound/sopra/runtime/EventInstance.d.ts +55 -5
  312. package/src/engine/sound/sopra/runtime/EventInstance.d.ts.map +1 -1
  313. package/src/engine/sound/sopra/runtime/EventInstance.js +201 -26
  314. package/src/engine/sound/sopra/serialization/populateSopraSerializationRegistry.d.ts +2 -1
  315. package/src/engine/sound/sopra/serialization/populateSopraSerializationRegistry.d.ts.map +1 -1
  316. package/src/engine/sound/sopra/serialization/populateSopraSerializationRegistry.js +6 -1
  317. package/src/engine/sound/sopra/serialization/sopraSerializationHarness.d.ts +15 -0
  318. package/src/engine/sound/sopra/serialization/sopraSerializationHarness.d.ts.map +1 -1
  319. package/src/engine/sound/sopra/serialization/sopraSerializationHarness.js +32 -0
  320. package/src/engine/sound/sopra/util/MockAudioContext.d.ts.map +1 -1
  321. package/src/engine/sound/sopra/util/MockAudioContext.js +3 -0
  322. package/src/engine/sound/sopra/util/fadeOutAndStop.d.ts +13 -3
  323. package/src/engine/sound/sopra/util/fadeOutAndStop.d.ts.map +1 -1
  324. package/src/engine/sound/sopra/util/fadeOutAndStop.js +25 -13
  325. package/src/format/image/png/PNGReader.js +644 -644
  326. package/src/format/image/png/crc32.d.ts +1 -1
  327. package/src/format/image/png/crc32.js +7 -8
  328. package/src/shade/RENDERER_CONTRACT.md +6 -3
  329. package/src/shade/descriptor/binding/BindGroupLayoutDescriptor.js +2 -2
  330. package/src/shade/descriptor/binding/BindGroupLayoutEntry.d.ts.map +1 -1
  331. package/src/shade/descriptor/binding/BindGroupLayoutEntry.js +12 -8
  332. package/src/shade/descriptor/binding/StorageTextureBindingLayout.js +2 -2
  333. package/src/shade/descriptor/binding/TextureBindingLayout.js +2 -2
  334. package/src/shade/descriptor/blend/BlendComponent.js +2 -2
  335. package/src/shade/descriptor/pipeline/PipelineDescriptorBase.js +2 -2
  336. package/src/shade/descriptor/pipeline/PipelineLayoutDescriptor.js +2 -2
  337. package/src/shade/descriptor/pipeline/ProgrammableStage.js +2 -2
  338. package/src/shade/descriptor/pipeline/compute/ComputePipelineDescriptor.js +2 -2
  339. package/src/shade/descriptor/pipeline/render/ColorTargetState.js +2 -2
  340. package/src/shade/descriptor/pipeline/render/FragmentState.js +2 -2
  341. package/src/shade/descriptor/pipeline/render/PrimitiveState.js +2 -2
  342. package/src/shade/descriptor/pipeline/render/RenderPipelineDescriptor.d.ts.map +1 -1
  343. package/src/shade/descriptor/pipeline/render/RenderPipelineDescriptor.js +8 -5
  344. package/src/shade/descriptor/pipeline/render/VertexAttribute.js +2 -2
  345. package/src/shade/descriptor/texture/SamplerDescriptor.d.ts.map +1 -1
  346. package/src/shade/descriptor/texture/SamplerDescriptor.js +20 -12
  347. package/src/shade/descriptor/texture/TextureDescriptor.d.ts.map +1 -1
  348. package/src/shade/descriptor/texture/TextureDescriptor.js +11 -7
  349. package/src/shade/device/SHADE_DEVICE_FLOOR.d.ts +24 -0
  350. package/src/shade/device/SHADE_DEVICE_FLOOR.d.ts.map +1 -0
  351. package/src/shade/device/SHADE_DEVICE_FLOOR.js +34 -0
  352. package/src/shade/device/ShadeDeviceFailure.d.ts +12 -5
  353. package/src/shade/device/ShadeDeviceFailure.d.ts.map +1 -1
  354. package/src/shade/device/ShadeDeviceFailure.js +17 -8
  355. package/src/shade/device/ShadeDeviceFailureReason.d.ts +1 -1
  356. package/src/shade/device/ShadeDeviceFailureReason.js +2 -2
  357. package/src/shade/device/graph/BufferResourceDescriptor.d.ts.map +1 -1
  358. package/src/shade/device/graph/BufferResourceDescriptor.js +196 -193
  359. package/src/shade/device/graph/TextureResourceDescriptor.d.ts.map +1 -1
  360. package/src/shade/device/graph/TextureResourceDescriptor.js +178 -173
  361. package/src/shade/device/shade_device_floor_unmet.d.ts +13 -0
  362. package/src/shade/device/shade_device_floor_unmet.d.ts.map +1 -0
  363. package/src/shade/device/shade_device_floor_unmet.js +32 -0
  364. package/src/shade/device/timing/profile/sgpt_read_header.js +1 -1
  365. package/src/shade/device/timing/profile/sgpt_read_records.js +1 -1
  366. package/src/shade/device/timing/profile/sgpt_write_header.js +1 -1
  367. package/src/shade/device/timing/profile/sgpt_write_record.js +1 -1
  368. package/src/shade/renderer/Renderer.d.ts +2 -0
  369. package/src/shade/renderer/Renderer.d.ts.map +1 -1
  370. package/src/shade/renderer/Renderer.js +29 -55
  371. package/src/shade/renderer/binding/BufferBinding.js +2 -2
  372. package/src/shade/renderer/buffer/GPUBufferAllocator.d.ts.map +1 -1
  373. package/src/shade/renderer/buffer/GPUBufferAllocator.js +9 -0
  374. package/src/shade/renderer/buffer/buffer_pool_ops.d.ts +21 -12
  375. package/src/shade/renderer/buffer/buffer_pool_ops.d.ts.map +1 -1
  376. package/src/shade/renderer/buffer/buffer_pool_ops.js +18 -19
  377. package/src/shade/renderer/camera/Camera.js +2 -2
  378. package/src/shade/renderer/geometry/Attribute.js +2 -2
  379. package/src/shade/renderer/geometry/Geometry.js +2 -2
  380. package/src/shade/renderer/geometry/geometry_deduplicate_vertices.js +2 -2
  381. package/src/shade/renderer/geometry/meshlet/MeshletBatch.js +2 -2
  382. package/src/shade/renderer/geometry/virtual/format/checksum/vgeo_compute_asset_id.js +13 -13
  383. package/src/shade/renderer/geometry/virtual/format/checksum/vgeo_compute_directory_block_checksum.js +41 -41
  384. package/src/shade/renderer/geometry/virtual/format/checksum/vgeo_compute_frame_checksum.js +41 -41
  385. package/src/shade/renderer/geometry/virtual/format/checksum/vgeo_compute_header_checksum.js +25 -25
  386. package/src/shade/renderer/gpu_primitive/test/gpu_test.d.ts.map +1 -1
  387. package/src/shade/renderer/gpu_primitive/test/gpu_test.js +8 -11
  388. package/src/shade/renderer/loader/gltf/tiny-gltf.d.ts +1 -1
  389. package/src/shade/renderer/material/StandardShadeMaterial.d.ts.map +1 -1
  390. package/src/shade/renderer/material/StandardShadeMaterial.js +13 -8
  391. package/src/shade/renderer/pool/TransientResourcePool.d.ts +24 -0
  392. package/src/shade/renderer/pool/TransientResourcePool.d.ts.map +1 -1
  393. package/src/shade/renderer/pool/TransientResourcePool.js +41 -10
  394. package/src/shade/renderer/scene/optimization/geometry/internal/triangle_fingerprint_stream.d.ts.map +1 -1
  395. package/src/shade/renderer/scene/optimization/geometry/internal/triangle_fingerprint_stream.js +14 -5
  396. package/src/shade/renderer/scene/optimization/sampler2d_from_image_bitmap.js +1 -1
  397. package/src/shade/renderer/shader/ComputeShader.d.ts.map +1 -1
  398. package/src/shade/renderer/shader/ComputeShader.js +18 -2
  399. package/src/shade/renderer/shader/ImageShader.d.ts.map +1 -1
  400. package/src/shade/renderer/shader/ImageShader.js +230 -218
  401. package/src/shade/renderer/shader/type/WGSLStructField.js +2 -2
  402. package/src/shade/renderer/shader/type/WebGPUArray.js +2 -2
  403. package/src/shade/renderer/shader/type/WebGPUStruct.d.ts.map +1 -1
  404. package/src/shade/renderer/shader/type/WebGPUStruct.js +9 -6
  405. package/src/shade/renderer/texture/ShadeTexture.d.ts.map +1 -1
  406. package/src/shade/renderer/texture/ShadeTexture.js +17 -10
  407. package/src/shade/renderer/texture/mipmaps/WebGPUMipmapGenerator.js +2 -2
  408. package/src/shade/renderer/water/surface/chunk_water_surface_sample.d.ts +4 -4
  409. package/src/shade/renderer/water/surface/chunk_water_surface_sample.js +6 -6
  410. package/src/shade/renderer/water/surface/particles/GPUWaterParticles.d.ts.map +1 -1
  411. package/src/shade/renderer/water/surface/particles/GPUWaterParticles.js +46 -55
  412. package/src/shade/renderer/water/surface/particles/WATER_PARTICLE_STRUCT.d.ts +3 -3
  413. package/src/shade/renderer/water/surface/particles/WATER_PARTICLE_STRUCT.d.ts.map +1 -1
  414. package/src/shade/renderer/water/surface/particles/WATER_PARTICLE_STRUCT.js +14 -4
  415. package/src/shade/renderer/water/surface/particles/chunk_water_particle.d.ts +10 -1
  416. package/src/shade/renderer/water/surface/particles/chunk_water_particle.d.ts.map +1 -1
  417. package/src/shade/renderer/water/surface/particles/chunk_water_particle.js +82 -40
  418. package/src/shade/renderer/water/surface/particles/chunk_water_particle_step.d.ts +4 -1
  419. package/src/shade/renderer/water/surface/particles/chunk_water_particle_step.d.ts.map +1 -1
  420. package/src/shade/renderer/water/surface/particles/chunk_water_particle_step.js +8 -4
  421. package/src/shade/renderer/water/surface/particles/shader_water_particles.d.ts +98 -86
  422. package/src/shade/renderer/water/surface/particles/shader_water_particles.d.ts.map +1 -1
  423. package/src/shade/renderer/water/surface/particles/shader_water_particles.js +440 -298
  424. package/src/view/common/HTMLElementCacheKey.d.ts.map +1 -1
  425. package/src/view/common/HTMLElementCacheKey.js +4 -3
  426. package/src/view/graphics/GraphicsContextFailureView.d.ts +1 -2
  427. package/src/view/graphics/GraphicsContextFailureView.d.ts.map +1 -1
  428. package/src/view/graphics/GraphicsContextFailureView.js +1 -2
  429. package/src/view/minimap/MinimapMarker.js +2 -2
  430. package/src/engine/network/transport/Channel.js +0 -336
  431. package/src/engine/network/transport/ReliableCommandPipeline.js +0 -335
  432. package/src/engine/network/transport/fragments/FragmentAssembler.js +0 -350
  433. package/src/engine/network/transport/fragments/FragmentRetention.js +0 -191
  434. package/src/engine/network/transport/fragments/fragment_send.js +0 -157
  435. package/src/engine/network/transport/fragments/packet_size.js +0 -107
@@ -14,15 +14,15 @@ import {
14
14
  shader_water_particles_bin,
15
15
  shader_water_particles_bounds,
16
16
  shader_water_particles_clear,
17
+ shader_water_particles_cut,
17
18
  shader_water_particles_emit,
18
19
  shader_water_particles_finalize,
19
- shader_water_particles_fronts,
20
- shader_water_particles_groups,
20
+ shader_water_particles_keep,
21
+ shader_water_particles_links,
22
+ shader_water_particles_mark,
21
23
  shader_water_particles_nest,
22
24
  shader_water_particles_rank,
23
- shader_water_particles_runs,
24
25
  shader_water_particles_scatter,
25
- shader_water_particles_share,
26
26
  shader_water_particles_split,
27
27
  shader_water_particles_total,
28
28
  shader_water_particles_update,
@@ -58,17 +58,15 @@ export class GPUWaterParticles {
58
58
  #children = null;
59
59
  #child_sums = null;
60
60
  #images = null;
61
- #fronts = null;
62
- #front_sums = null;
63
- #runs = null;
64
- #draw = null;
61
+ #links = null;
62
+ #reaches = null;
63
+ #shown = null;
65
64
  #buckets = null;
66
65
  #offsets = null;
67
66
  #slots = null;
68
67
  #bucket_amplitude = null;
69
- #bucket_weight = null;
68
+ #bucket_crowd = null;
70
69
  #bucket_nest = null;
71
- #visible = null;
72
70
  #staging = null;
73
71
  #entries = null;
74
72
  #body_bounds = null;
@@ -114,22 +112,21 @@ export class GPUWaterParticles {
114
112
  this.#child_sums = buffer('child sums', sums(capacity));
115
113
  // per particle the mirror image the step left beside it at the outline
116
114
  this.#images = buffer('images', capacity * WATER_PARTICLE_STRUCT.size);
117
- // per particle whether it starts a run, then the scanned run it is in; per run its first particle and its
118
- // share; per particle its run and how it is drawn
119
- this.#fronts = buffer('fronts', 16 + capacity * 4);
120
- this.#front_sums = buffer('front sums', sums(capacity));
121
- this.#runs = buffer('runs', capacity * 8);
122
- this.#draw = buffer('draw', capacity * 8);
115
+ // per particle its front's neighbours before and after it
116
+ this.#links = buffer('links', capacity * 8);
117
+ // per particle the cells its support overlaps this frame: its first, its level and spans
118
+ this.#reaches = buffer('reaches', capacity * 12);
119
+ // per particle whether its crowds draw it
120
+ this.#shown = buffer('shown', capacity * 4);
123
121
  // per bucket its entries, then the hash: table size and inclusive offsets
124
122
  this.#buckets = buffer('buckets', 16 + this.#table_limit * 4);
125
123
  this.#offsets = buffer('offsets', sums(this.#table_limit));
126
124
  this.#slots = buffer('slots', capacity * WATER_PARTICLE_CORNERS * 4);
127
125
  this.#bucket_amplitude = buffer('bucket amplitude', this.#table_limit * 4);
128
- // the summed steepness, the largest front and front complement entered, and the entries; then the most a point
129
- // under it reads, and its entries by key
130
- this.#bucket_weight = buffer('bucket weight', this.#table_limit * WATER_PARTICLE_CROWD_WORDS * 4);
126
+ // its runs by steepness class and in all; then the most a point under it reads at finer levels, the classes its
127
+ // points keep and draw, and a slot of the frame's table of cut fronts
128
+ this.#bucket_crowd = buffer('bucket crowd', this.#table_limit * WATER_PARTICLE_CROWD_WORDS * 4);
131
129
  this.#bucket_nest = buffer('bucket nest', this.#table_limit * WATER_PARTICLE_NEST_WORDS * 4);
132
- this.#visible = buffer('visible', capacity * 4);
133
130
  const entries = capacity * WATER_PARTICLE_CORNERS * WATER_PARTICLE_ENTRY_STRUCT.size;
134
131
  this.#staging = buffer('staging', entries);
135
132
  this.#entries = buffer('entries', entries);
@@ -157,16 +154,15 @@ export class GPUWaterParticles {
157
154
  }
158
155
 
159
156
  dispose() {
160
- for (const buffer of [...this.#particles, this.#children, this.#child_sums, this.#images, this.#fronts, this.#front_sums, this.#runs,
161
- this.#draw, this.#buckets, this.#offsets, this.#slots, this.#bucket_amplitude, this.#bucket_weight, this.#bucket_nest, this.#visible,
162
- this.#staging, this.#entries, this.#body_bounds, ...(this.#commands ?? [])]) {
157
+ for (const buffer of [...this.#particles, this.#children, this.#child_sums, this.#images, this.#links, this.#reaches, this.#shown, this.#buckets,
158
+ this.#offsets, this.#slots, this.#bucket_amplitude, this.#bucket_crowd, this.#bucket_nest, this.#staging, this.#entries, this.#body_bounds,
159
+ ...(this.#commands ?? [])]) {
163
160
  buffer?.destroy();
164
161
  }
165
162
  this.#particles = [];
166
163
  this.#children = this.#child_sums = this.#images = this.#buckets = this.#offsets = this.#slots = this.#bucket_amplitude = null;
167
164
  this.#staging = this.#entries = null;
168
- this.#fronts = this.#front_sums = this.#runs = this.#draw = null;
169
- this.#bucket_weight = this.#bucket_nest = this.#visible = null;
165
+ this.#links = this.#reaches = this.#shown = this.#bucket_crowd = this.#bucket_nest = null;
170
166
  this.#body_bounds = null;
171
167
  this.#commands = null;
172
168
  this.#device = null;
@@ -205,8 +201,6 @@ export class GPUWaterParticles {
205
201
  let child_sums = graph_import_buffer(graph, this.#child_sums, 'Water / particle child sums');
206
202
  let buckets = graph_import_buffer(graph, this.#buckets, 'Water / particle buckets');
207
203
  let offsets = graph_import_buffer(graph, this.#offsets, 'Water / particle offsets');
208
- let fronts = graph_import_buffer(graph, this.#fronts, 'Water / particle fronts');
209
- let front_sums = graph_import_buffer(graph, this.#front_sums, 'Water / particle front sums');
210
204
  const node = (name, execute, reads, writes) => {
211
205
  const data = {};
212
206
  const pass = graph.add(name, data, (d, resources, context) => execute(resources, context, d));
@@ -243,49 +237,46 @@ export class GPUWaterParticles {
243
237
  }, { child_sums }, {});
244
238
  }
245
239
 
246
- // Each front's run of particles, so that a whole one is drawn as the seven it was emitted as.
247
- fronts = node('Water / particles fronts', (resources, { encoder }) => {
240
+ // The frame's hash: each particle's neighbours round its front, so that a run of them is drawn as one; how crowded
241
+ // each cell is and so which runs it keeps, the steepest, dooming the rest and cutting, whole, the fronts the gather
242
+ // cannot read;
243
+ // then each drawn run entered into every cell its first particle's support overlaps, offsets, entries in order.
244
+ buckets = node('Water / particles bin', (resources, { encoder }) => {
248
245
  if (!stepping) {
249
246
  // the table size the last stepping frame chose for these particles
250
247
  shader_water_particles_finalize.dispatch({ encoder, bindings: { limits: { capacity, table_limit }, next, offsets: this.#buckets,
251
248
  table_command: command_table } });
252
249
  }
253
250
  build_indirect_compute_dispatch_command(64, encoder, next, 0, command_next, 0, true);
254
- encoder.copyBufferToBuffer(next, 0, this.#fronts, 0, 4);
255
- shader_water_particles_fronts.dispatchIndirect({ encoder, command: command_next, bindings: { next, fronts: this.#fronts } });
256
- }, {}, { fronts }).fronts;
257
- front_sums = graph_prefix_scan_csdldf({ graph, input: fronts, output: front_sums, element_max_count: capacity });
258
-
259
- // The frame's hash: how each particle is drawn, how crowded each cell is and so how much of each run its crowd
260
- // leaves drawn, then each packet drawn into the cells its support overlaps, offsets, entries in order.
261
- buckets = node('Water / particles bin', (resources, { encoder }) => {
262
- const draw = this.#draw, runs = this.#runs;
263
- shader_water_particles_runs.dispatchIndirect({ encoder, command: command_next, bindings: { next, fronts: this.#front_sums, runs } });
264
- shader_water_particles_groups.dispatchIndirect({ encoder, command: command_next, bindings: { next, fronts: this.#front_sums, runs, draw } });
251
+ const links = this.#links;
252
+ const reaches = this.#reaches;
253
+ shader_water_particles_links.dispatchIndirect({ encoder, command: command_next, bindings: { next, links, reaches } });
265
254
  shader_water_particles_clear.dispatchIndirect({ encoder, command: command_table, bindings: {
266
- buckets: this.#buckets, bucket_amplitude: this.#bucket_amplitude, bucket_weight: this.#bucket_weight,
267
- bucket_nest: this.#bucket_nest } });
268
- shader_water_particles_weigh.dispatchIndirect({ encoder, command: command_next, bindings: {
269
- next, activity, offsets: this.#buckets, draw, bucket_weight: this.#bucket_weight, body_bounds: this.#body_bounds } });
270
- shader_water_particles_nest.dispatchIndirect({ encoder, command: command_next, bindings: {
271
- next, activity, offsets: this.#buckets, draw, body_bounds: this.#body_bounds, bucket_weight: this.#bucket_weight,
255
+ buckets: this.#buckets, bucket_amplitude: this.#bucket_amplitude, bucket_crowd: this.#bucket_crowd,
272
256
  bucket_nest: this.#bucket_nest } });
273
- shader_water_particles_share.dispatchIndirect({ encoder, command: command_next, bindings: {
274
- next, activity, offsets: this.#buckets, bucket_weight: this.#bucket_weight, bucket_nest: this.#bucket_nest,
275
- body_bounds: this.#body_bounds, draw, runs } });
257
+ const crowd = { next, activity, offsets: this.#buckets, links, reaches, body_bounds: this.#body_bounds,
258
+ bucket_crowd: this.#bucket_crowd };
259
+ shader_water_particles_weigh.dispatchIndirect({ encoder, command: command_next, bindings: crowd });
260
+ shader_water_particles_nest.dispatchIndirect({ encoder, command: command_next, bindings: { ...crowd, bucket_nest: this.#bucket_nest } });
261
+ shader_water_particles_cut.dispatchIndirect({ encoder, command: command_next, bindings: { ...crowd, bucket_nest: this.#bucket_nest } });
262
+ const shown = this.#shown;
263
+ shader_water_particles_mark.dispatchIndirect({ encoder, command: command_next, bindings: {
264
+ next, activity, offsets: this.#buckets, reaches, bucket_nest: this.#bucket_nest } });
265
+ shader_water_particles_keep.dispatchIndirect({ encoder, command: command_next, bindings: {
266
+ next, activity, offsets: this.#buckets, reaches, bucket_nest: this.#bucket_nest, shown } });
276
267
  shader_water_particles_bin.dispatchIndirect({ encoder, command: command_next, bindings: {
277
268
  next, activity, buckets: this.#buckets, slots: this.#slots, bucket_amplitude: this.#bucket_amplitude,
278
- body_bounds: this.#body_bounds, draw, runs, visible: this.#visible } });
279
- }, { front_sums }, { buckets }).buckets;
269
+ body_bounds: this.#body_bounds, links, reaches, shown } });
270
+ }, {}, { buckets }).buckets;
280
271
  offsets = graph_prefix_scan_csdldf({ graph, input: buckets, output: offsets, element_max_count: table_limit });
281
272
  node('Water / particles order and bound', (resources, { encoder }) => {
282
- const bindings = { next, offsets: this.#offsets, slots: this.#slots, draw: this.#draw };
273
+ const bindings = { next, offsets: this.#offsets, slots: this.#slots, reaches: this.#reaches };
283
274
  shader_water_particles_scatter.dispatchIndirect({ encoder, command: command_next, bindings: { ...bindings,
284
- visible: this.#visible, staging: this.#staging } });
275
+ links: this.#links, shown: this.#shown, staging: this.#staging } });
285
276
  shader_water_particles_rank.dispatchIndirect({ encoder, command: command_next, bindings: { ...bindings,
286
277
  staging: this.#staging, entries: this.#entries } });
287
- shader_water_particles_bounds.dispatchIndirect({ encoder, command: command_next, bindings: { next, activity,
288
- offsets: this.#offsets, bucket_amplitude: this.#bucket_amplitude, draw: this.#draw, body_bounds: this.#body_bounds } });
278
+ shader_water_particles_bounds.dispatchIndirect({ encoder, command: command_next, bindings: { ...bindings, activity,
279
+ bucket_amplitude: this.#bucket_amplitude, body_bounds: this.#body_bounds } });
289
280
  }, { offsets }, {});
290
281
  }
291
282
  }
@@ -8,9 +8,9 @@
8
8
  */
9
9
  export const WATER_PARTICLE_STRUCT: WebGPUStruct;
10
10
  /**
11
- * A particle as one hash cell holds it for the surface sampler: everything its kernel needs at the frame's
12
- * time, and the cell it was entered for, since one particle is entered in every cell its support overlaps and
13
- * two cells may share a bucket.
11
+ * A run of a front's particles as one hash cell holds it for the surface sampler: everything its kernel needs at the
12
+ * frame's time, from the run's first particle, and the cell it was entered for, since a front is entered in every cell
13
+ * its support overlaps and two cells may share a bucket.
14
14
  */
15
15
  export const WATER_PARTICLE_ENTRY_STRUCT: WebGPUStruct;
16
16
  import { WebGPUStruct } from "../../../shader/type/WebGPUStruct.js";
@@ -1 +1 @@
1
- {"version":3,"file":"WATER_PARTICLE_STRUCT.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/water/surface/particles/WATER_PARTICLE_STRUCT.js"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,iDAoBoB;AAEpB;;;;GAIG;AACH,uDAkByB;6BAvDI,sCAAsC"}
1
+ {"version":3,"file":"WATER_PARTICLE_STRUCT.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/water/surface/particles/WATER_PARTICLE_STRUCT.js"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,iDAyBoB;AAEpB;;;;GAIG;AACH,uDAuByB;6BAjEI,sCAAsC"}
@@ -29,12 +29,17 @@ export const WATER_PARTICLE_STRUCT = WebGPUStruct.from({
29
29
  * image was emitted then, and it dies once the last of it has left too. 0 from emission.
30
30
  */
31
31
  reflected: u32,
32
+ /**
33
+ * 0, or once a crowd it cannot be drawn in has doomed it, the steepness |a|/r below which it dies: it fades from
34
+ * then on, as a packet below the drawing threshold does.
35
+ */
36
+ fading: f32,
32
37
  }, 'WaterParticle');
33
38
 
34
39
  /**
35
- * A particle as one hash cell holds it for the surface sampler: everything its kernel needs at the frame's
36
- * time, and the cell it was entered for, since one particle is entered in every cell its support overlaps and
37
- * two cells may share a bucket.
40
+ * A run of a front's particles as one hash cell holds it for the surface sampler: everything its kernel needs at the
41
+ * frame's time, from the run's first particle, and the cell it was entered for, since a front is entered in every cell
42
+ * its support overlaps and two cells may share a bucket.
38
43
  */
39
44
  export const WATER_PARTICLE_ENTRY_STRUCT = WebGPUStruct.from({
40
45
  position: vec2f,
@@ -48,10 +53,15 @@ export const WATER_PARTICLE_ENTRY_STRUCT = WebGPUStruct.from({
48
53
  phase: f32,
49
54
  /** water_waves row and level, as water_particle_key packs them */
50
55
  key: u32,
51
- /** Index of the particle, which orders a bucket. */
56
+ /** Index of the run's first particle, which orders a bucket. */
52
57
  source: u32,
53
58
  /** How far the particle stands from its front's centre, metres. */
54
59
  distance: f32,
55
60
  /** Half the length of its envelope across its front, metres. */
56
61
  half_length: f32,
62
+ /**
63
+ * The run of the front's particles it draws, from this one on, each β further round: their count, and which ends
64
+ * are open, tapering by the end particle's own window (chunk_water_particle's water_particle_run_profile).
65
+ */
66
+ run: u32,
57
67
  }, 'WaterParticleEntry');
@@ -19,6 +19,14 @@ export const WATER_PARTICLE_LEVEL0_CELL: number;
19
19
  * gathers at that speed and the peak falls as t^(−1/3), which no κ draws: up to 16% below r = 12 mm, 27% at 3 cm.
20
20
  */
21
21
  export const WATER_PARTICLE_STRETCH: number[];
22
+ /** Bits of a hash entry's run word that hold its count of particles; the two above them mark its open ends. */
23
+ export const WATER_PARTICLE_RUN_MEMBERS: 1073741823;
24
+ /** A run whose first particle has no neighbour of its front before it: it tapers there by that particle's window. */
25
+ export const WATER_PARTICLE_RUN_OPEN_START: 1073741824;
26
+ /** A run whose last particle has no neighbour of its front after it. */
27
+ export const WATER_PARTICLE_RUN_OPEN_END: 2147483648;
28
+ /** A particle drawn alone: a run of one, open at both ends, which is its own window. */
29
+ export const WATER_PARTICLE_LONE: number;
22
30
  /**
23
31
  * The physics of one wave particle as pure functions (WATER_SURFACE_SIMULATION_PLAN_2026_10_06.md §5).
24
32
  *
@@ -34,7 +42,8 @@ export const WATER_PARTICLE_STRETCH: number[];
34
42
  * The particles of a front are β apart in angle around its centre, and a packet's crests are arcs around that
35
43
  * centre; a cosine window of half-angle β is a partition of unity over them at every radius, so the front's
36
44
  * height is the packet's amplitude whatever the spacing, splitting a front changes none of it, and one front
37
- * adds at most two particles at any point.
45
+ * adds at most two particles at any point. So a run of neighbours alike in all but angle is drawn as one: height one
46
+ * over its particles and its own window past either end that has no neighbour, the same surface its windows sum to.
38
47
  *
39
48
  * @type {CodeChunk}
40
49
  */
@@ -1 +1 @@
1
- {"version":3,"file":"chunk_water_particle.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/water/surface/particles/chunk_water_particle.js"],"names":[],"mappings":"AAKA;;;GAGG;AACH,uCAAwC;AAKxC,yHAAyH;AACzH,gDAAkD;AAElD;;;;;;;;;;;;GAYG;AACH,8CAIE;AAKF;;;;;;;;;;;;;;;;;;GAkBG;AACH,mCAFU,SAAS,CAmN6G;0BA3QtG,uCAAuC"}
1
+ {"version":3,"file":"chunk_water_particle.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/water/surface/particles/chunk_water_particle.js"],"names":[],"mappings":"AAKA;;;GAGG;AACH,uCAAwC;AAKxC,yHAAyH;AACzH,gDAAkD;AAElD;;;;;;;;;;;;GAYG;AACH,8CAIE;AAKF,+GAA+G;AAC/G,oDAAqD;AAErD,qHAAqH;AACrH,uDAAwD;AAExD,wEAAwE;AACxE,qDAAsD;AAEtD,wFAAwF;AACxF,yCAA2G;AAE3G;;;;;;;;;;;;;;;;;;;GAmBG;AACH,mCAFU,SAAS,CAgP6G;0BArTtG,uCAAuC"}
@@ -37,6 +37,18 @@ export const WATER_PARTICLE_STRETCH = [
37
37
  /** log₂(k/k_m) of the stretch table's first entry; entries are a quarter apart. */
38
38
  const WATER_PARTICLE_STRETCH_FIRST = -7;
39
39
 
40
+ /** Bits of a hash entry's run word that hold its count of particles; the two above them mark its open ends. */
41
+ export const WATER_PARTICLE_RUN_MEMBERS = 0x3fffffff;
42
+
43
+ /** A run whose first particle has no neighbour of its front before it: it tapers there by that particle's window. */
44
+ export const WATER_PARTICLE_RUN_OPEN_START = 0x40000000;
45
+
46
+ /** A run whose last particle has no neighbour of its front after it. */
47
+ export const WATER_PARTICLE_RUN_OPEN_END = 0x80000000;
48
+
49
+ /** A particle drawn alone: a run of one, open at both ends, which is its own window. */
50
+ export const WATER_PARTICLE_LONE = (1 | WATER_PARTICLE_RUN_OPEN_START | WATER_PARTICLE_RUN_OPEN_END) >>> 0;
51
+
40
52
  /**
41
53
  * The physics of one wave particle as pure functions (WATER_SURFACE_SIMULATION_PLAN_2026_10_06.md §5).
42
54
  *
@@ -52,7 +64,8 @@ const WATER_PARTICLE_STRETCH_FIRST = -7;
52
64
  * The particles of a front are β apart in angle around its centre, and a packet's crests are arcs around that
53
65
  * centre; a cosine window of half-angle β is a partition of unity over them at every radius, so the front's
54
66
  * height is the packet's amplitude whatever the spacing, splitting a front changes none of it, and one front
55
- * adds at most two particles at any point.
67
+ * adds at most two particles at any point. So a run of neighbours alike in all but angle is drawn as one: height one
68
+ * over its particles and its own window past either end that has no neighbour, the same surface its windows sum to.
56
69
  *
57
70
  * @type {CodeChunk}
58
71
  */
@@ -62,6 +75,10 @@ const WATER_PARTICLE_LEVEL_BITS: u32 = ${WATER_PARTICLE_LEVEL_BITS}u;
62
75
  const WATER_PARTICLE_LEVEL0_CELL: f32 = ${WATER_PARTICLE_LEVEL0_CELL};
63
76
  const WATER_PARTICLE_STRETCH = array<f32, ${WATER_PARTICLE_STRETCH.length}>(${WATER_PARTICLE_STRETCH.join(', ')});
64
77
  const WATER_PARTICLE_STRETCH_FIRST: f32 = ${WATER_PARTICLE_STRETCH_FIRST}.0;
78
+ const WATER_PARTICLE_RUN_MEMBERS: u32 = ${WATER_PARTICLE_RUN_MEMBERS}u;
79
+ const WATER_PARTICLE_RUN_OPEN_START: u32 = ${WATER_PARTICLE_RUN_OPEN_START}u;
80
+ const WATER_PARTICLE_RUN_OPEN_END: u32 = ${WATER_PARTICLE_RUN_OPEN_END}u;
81
+ const WATER_PARTICLE_LONE: u32 = ${WATER_PARTICLE_LONE}u;
65
82
  // kinematic viscosity of water, m²/s
66
83
  const WATER_VISCOSITY: f32 = 1e-6;
67
84
  const WATER_PI: f32 = 3.14159265358979;
@@ -153,38 +170,57 @@ fn water_particle_support_limit() -> f32 {
153
170
  return 0.5 * water_particle_cell_size(WATER_PARTICLE_LEVELS - 1u);
154
171
  }
155
172
 
156
- // Whether two particles are of one front: one splash's, neither reflected or faded apart, alike in all but angle.
157
- fn water_particle_same_front(a: ${WATER_PARTICLE_STRUCT.wgsl_ref}, b: ${WATER_PARTICLE_STRUCT.wgsl_ref}) -> bool {
173
+ // An angle as a turn from 0 round to 2π.
174
+ fn water_particle_turn(angle: f32) -> f32 {
175
+ return angle - WATER_TAU * floor(angle / WATER_TAU);
176
+ }
177
+
178
+ // Where round its centre a front's particles are not neighbours: an angle of the front's own, from its centre, so that
179
+ // fronts' ends lie anywhere rather than all to one side of them.
180
+ fn water_particle_break(particle: ${WATER_PARTICLE_STRUCT.wgsl_ref}) -> f32 {
181
+ let bits = pcg3d(vec3<u32>(bitcast<u32>(particle.origin.x), bitcast<u32>(particle.origin.y), particle.body)).x;
182
+ return f32(bits >> 8u) * (WATER_TAU / 16777216.0);
183
+ }
184
+
185
+ // Whether two particles are of one front as it is drawn: one splash's, neither faded apart from the other, alike in all
186
+ // but angle. A doom does not part them until the fade it starts does: what is drawn is all that links them.
187
+ fn water_particle_alike(a: ${WATER_PARTICLE_STRUCT.wgsl_ref}, b: ${WATER_PARTICLE_STRUCT.wgsl_ref}) -> bool {
158
188
  return a.body == b.body && all(a.origin == b.origin) && a.age == b.age && a.amplitude == b.amplitude
159
189
  && a.radius == b.radius && a.dispersion == b.dispersion;
160
190
  }
161
191
 
162
- // How a particle is drawn, given its front's run of particles in the array and its place in it: 1 as itself; 0 not at
163
- // all, or a group of 3^g as one packet with 3^g times its window, when its front is whole. Whole is every particle
164
- // the front split into still there, in order and alike: as many as fill its circle. The step puts a particle's three
165
- // in its place, the middle at its own angle, so a group of 3^g is 3^g in a row and its middle stands at the angle
166
- // the group was emitted at; with curved crests the groups draw what the particles do. The largest group whose packet
167
- // the hash holds: the seven a front was emitted as, until their windows outgrow the coarsest cell.
168
- fn water_particle_group(particle: ${WATER_PARTICLE_STRUCT.wgsl_ref}, members: u32, offset: u32) -> u32 {
169
- if (members != u32(round(WATER_TAU / particle.dispersion))) { return 1u; }
170
- var group = 1u;
171
- for (var g = 0u; g < 20u && members % (3u * group) == 0u; g++) { group *= 3u; }
172
- let distance = water_particle_distance(particle);
173
- let half_length = water_particle_half_length_at(particle.radius, distance);
174
- for (var g = 0u; g < 20u && group > 1u; g++) {
175
- let dispersion = particle.dispersion * f32(group);
176
- let width = max(dispersion * distance, 1e-3 * particle.radius);
177
- if (water_particle_support(half_length, width, dispersion) <= water_particle_support_limit()) { break; }
178
- group /= 3u;
179
- }
180
- return select(0u, group, offset % group == group / 2u);
192
+ // Whether b is a's neighbour round their front, β further on. Angles are compared as turns from the front's break, so
193
+ // its particles either side of it are never neighbours and a run of them never closes on itself; that pair's windows sum
194
+ // to one there as any unlinked pair's do.
195
+ fn water_particle_linked(a: ${WATER_PARTICLE_STRUCT.wgsl_ref}, b: ${WATER_PARTICLE_STRUCT.wgsl_ref}) -> bool {
196
+ if (!water_particle_alike(a, b)) { return false; }
197
+ let cut = water_particle_break(a);
198
+ return abs(water_particle_turn(b.angle - cut) - water_particle_turn(a.angle - cut) - a.dispersion) < 0.01 * a.dispersion;
181
199
  }
182
200
 
183
- // The particle as its group draws it: one packet with the group's window.
184
- fn water_particle_drawn(particle: ${WATER_PARTICLE_STRUCT.wgsl_ref}, group: u32) -> ${WATER_PARTICLE_STRUCT.wgsl_ref} {
185
- var drawn = particle;
186
- drawn.dispersion *= f32(group);
187
- return drawn;
201
+ // A particle's window over x from its axis, |x| < β, and its derivative.
202
+ fn water_particle_taper(x: f32, dispersion: f32) -> vec2<f32> {
203
+ let t = WATER_PI * x / dispersion;
204
+ return vec2<f32>(0.5 * (1.0 + cos(t)), -0.5 * WATER_PI / dispersion * sin(t));
205
+ }
206
+
207
+ // The angular profile of a run of a front's particles at ψ round the front's centre from its first particle's axis, and
208
+ // its derivative: one from its first particle's axis to its last's, where the windows of neighbours β apart sum to one;
209
+ // past an open end the end particle's own window, all there is of the front there; past an end with a neighbour, nothing,
210
+ // since that neighbour's own run draws it there.
211
+ fn water_particle_run_profile(psi: f32, dispersion: f32, run: u32) -> vec2<f32> {
212
+ let span = f32(max(run & WATER_PARTICLE_RUN_MEMBERS, 1u) - 1u) * dispersion;
213
+ let onward = water_particle_turn(psi);
214
+ if (onward <= span) { return vec2<f32>(1.0, 0.0); }
215
+ var profile = vec2<f32>(0.0);
216
+ if ((run & WATER_PARTICLE_RUN_OPEN_START) != 0u && psi < 0.0 && psi > -dispersion) {
217
+ profile += water_particle_taper(psi, dispersion);
218
+ }
219
+ let past = onward - span;
220
+ if ((run & WATER_PARTICLE_RUN_OPEN_END) != 0u && past < dispersion) {
221
+ profile += water_particle_taper(past, dispersion);
222
+ }
223
+ return profile;
188
224
  }
189
225
 
190
226
  // The smallest hash level whose cell is at least the support's diameter, so the support overlaps at most
@@ -220,13 +256,13 @@ struct WaterParticleField {
220
256
  displacement_gradient: vec2<f32>,
221
257
  }
222
258
 
223
- // The packet at offset d from its particle, which stands distance from its front's centre. ρ the radius from the
224
- // centre and u = ρ − distance across the front, ψ the angle around the centre from the particle's direction:
225
- // envelope E(u) over half_length either side, window T(ψ) over the dispersion β either side, carrier phase πu/r − phase.
226
- // Height a·E·T·cos; horizontal displacement −a·E·T·sin along the radius (Gerstner-like orbits, Yuksel's longitudinal
227
- // sign); with derivatives, ∇ψ = e_ψ/ρ.
228
- fn water_particle_field(d: vec2<f32>, angle: f32, amplitude: f32, radius: f32, half_length: f32, dispersion: f32, distance: f32,
229
- phase: f32) -> WaterParticleField {
259
+ // The run of a front's packets from the particle at offset d (water_particle_run_profile), which stands distance from
260
+ // its front's centre. ρ the radius from the centre and u = ρ − distance across the front, ψ the angle around the centre
261
+ // from the particle's direction: envelope E(u) over half_length either side, the run's profile T(ψ), carrier phase
262
+ // πu/r − phase. Height a·E·T·cos; horizontal displacement −a·E·T·sin along the radius (Gerstner-like orbits, Yuksel's
263
+ // longitudinal sign); with derivatives, ∇ψ = e_ψ/ρ.
264
+ fn water_particle_run_field(d: vec2<f32>, angle: f32, amplitude: f32, radius: f32, half_length: f32, dispersion: f32, distance: f32,
265
+ phase: f32, run: u32) -> WaterParticleField {
230
266
  var field: WaterParticleField;
231
267
  let direction = water_particle_direction(angle);
232
268
  let tangent = vec2<f32>(-direction.y, direction.x);
@@ -236,15 +272,15 @@ fn water_particle_field(d: vec2<f32>, angle: f32, amplitude: f32, radius: f32, h
236
272
  let u = (dot(d, d) + 2.0 * distance * dot(d, direction)) / max(rho + distance, 1e-30);
237
273
  if (abs(u) >= half_length || !(rho > 0.0)) { return field; }
238
274
  let psi = atan2(dot(d, tangent), distance + dot(d, direction));
239
- if (abs(psi) >= dispersion) { return field; }
275
+ let profile = water_particle_run_profile(psi, dispersion, run);
276
+ if (!(profile.x > 0.0)) { return field; }
240
277
  let radial = q / rho;
241
278
  let around = vec2<f32>(-radial.y, radial.x);
242
279
  let eu = WATER_PI * u / half_length;
243
280
  let envelope = 0.5 * (1.0 + cos(eu));
244
281
  let envelope_du = -0.5 * WATER_PI / half_length * sin(eu);
245
- let tv = WATER_PI * psi / dispersion;
246
- let window = 0.5 * (1.0 + cos(tv));
247
- let window_dpsi = -0.5 * WATER_PI / dispersion * sin(tv);
282
+ let window = profile.x;
283
+ let window_dpsi = profile.y;
248
284
  let carrier = WATER_PI * u / radius - phase;
249
285
  let c = cos(carrier);
250
286
  let s = sin(carrier);
@@ -257,12 +293,18 @@ fn water_particle_field(d: vec2<f32>, angle: f32, amplitude: f32, radius: f32, h
257
293
  let h_psi = -amplitude * envelope * window_dpsi * s;
258
294
  let gradient_h = h_u * radial + (h_psi / rho) * around;
259
295
  // the radius turns as the point moves around the centre: ∂e_ρ/∂x_j = e_ψ (e_ψ)_j / ρ
260
- let turn = (h / rho) * around;
296
+ let swing = (h / rho) * around;
261
297
  field.height = z;
262
298
  field.slope = z_u * radial + (z_psi / rho) * around;
263
299
  field.displacement = h * radial;
264
- field.jacobian = mat2x2<f32>(radial * gradient_h.x + turn * around.x, radial * gradient_h.y + turn * around.y);
300
+ field.jacobian = mat2x2<f32>(radial * gradient_h.x + swing * around.x, radial * gradient_h.y + swing * around.y);
265
301
  field.displacement_gradient = gradient_h;
266
302
  return field;
267
303
  }
304
+
305
+ // One particle's packet: a run of one, its window over the dispersion β either side of its axis.
306
+ fn water_particle_field(d: vec2<f32>, angle: f32, amplitude: f32, radius: f32, half_length: f32, dispersion: f32, distance: f32,
307
+ phase: f32) -> WaterParticleField {
308
+ return water_particle_run_field(d, angle, amplitude, radius, half_length, dispersion, distance, phase, WATER_PARTICLE_LONE);
309
+ }
268
310
  `, [chunk_water_spectrum, chunk_pcg3d, WATER_PARTICLE_STRUCT.declaration_chunk, WATER_PARTICLE_ENTRY_STRUCT.declaration_chunk]);
@@ -1,4 +1,7 @@
1
- /** Seconds over which a packet that has fallen below the drawing threshold fades to a tenth of it, where it dies. */
1
+ /**
2
+ * Time constant of a dying packet's fade: one that has fallen below the drawing threshold fades to a tenth of it, where
3
+ * it dies, and one a crowd doomed to a tenth of its steepness then; about a third of a second either way.
4
+ */
2
5
  export const WATER_PARTICLE_FADE_SECONDS: 0.15;
3
6
  /**
4
7
  * One frame of one wave particle (WATER_SURFACE_SIMULATION_PLAN_2026_10_06.md §5.1): it ages, spreads over its
@@ -1 +1 @@
1
- {"version":3,"file":"chunk_water_particle_step.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/water/surface/particles/chunk_water_particle_step.js"],"names":[],"mappings":"AAQA,qHAAqH;AACrH,+CAAgD;AAEhD;;;;;;;;;;;;;;GAcG;AACH,wCAFU,SAAS,CAsN8E;0BA9OvE,uCAAuC"}
1
+ {"version":3,"file":"chunk_water_particle_step.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/water/surface/particles/chunk_water_particle_step.js"],"names":[],"mappings":"AAQA;;;GAGG;AACH,+CAAgD;AAEhD;;;;;;;;;;;;;;GAcG;AACH,wCAFU,SAAS,CAuN8E;0BAlPvE,uCAAuC"}
@@ -6,7 +6,10 @@ import { RAY_HIT_INFO } from "../../../shader/chunk/geometry/ray/RAY_HIT_INFO.js
6
6
  import { WATER_PARTICLE_STRUCT } from "./WATER_PARTICLE_STRUCT.js";
7
7
  import { chunk_water_particle } from "./chunk_water_particle.js";
8
8
 
9
- /** Seconds over which a packet that has fallen below the drawing threshold fades to a tenth of it, where it dies. */
9
+ /**
10
+ * Time constant of a dying packet's fade: one that has fallen below the drawing threshold fades to a tenth of it, where
11
+ * it dies, and one a crowd doomed to a tenth of its steepness then; about a third of a second either way.
12
+ */
10
13
  export const WATER_PARTICLE_FADE_SECONDS = 0.15;
11
14
 
12
15
  /**
@@ -141,11 +144,12 @@ fn water_particle_advance(input: ${WATER_PARTICLE_STRUCT.wgsl_ref}, dt: f32, geo
141
144
  particle.amplitude *= sqrt(max(distance_before, 1e-30) / max(distance_after, 1e-30)
142
145
  * half_length_before / water_particle_half_length(particle)) * exp(-water_particle_damping(particle.radius) * dt);
143
146
  // below the threshold a packet fades out rather than vanishing: its amplitude decays on top of the water's own
144
- // damping until it is a tenth of the threshold's height, where it dies
147
+ // damping until it is a tenth of the threshold's height, where it dies; and so does one a crowd doomed, until it is
148
+ // as steep as its doom says
145
149
  let floor = threshold * particle.radius;
146
- if (!(abs(particle.amplitude) >= floor)) {
150
+ if (particle.fading > 0.0 || !(abs(particle.amplitude) >= floor)) {
147
151
  particle.amplitude *= exp(-dt / WATER_PARTICLE_FADE_SECONDS);
148
- if (!(abs(particle.amplitude) >= 0.1 * floor)) { return WaterParticleStep(particle, particle, 0u); }
152
+ if (!(abs(particle.amplitude) >= max(0.1 * floor, particle.fading * particle.radius))) { return WaterParticleStep(particle, particle, 0u); }
149
153
  }
150
154
  // its support: its envelope's half-length either side of its front, its window's angle either side of its axis
151
155
  let reach = water_particle_half_length(particle);