@woosh/meep-engine 3.41.0 → 3.43.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.
- package/build/bundle-worker-image-decoder.js +1 -1
- package/build/bundle-worker-terrain.js +1 -1
- package/editor/selection/editor_pick.d.ts.map +1 -1
- package/editor/selection/editor_pick.js +2 -1
- package/editor/tools/TransformToolV2.d.ts.map +1 -1
- package/editor/tools/TransformToolV2.js +7 -1
- package/editor/tools/engine/ToolEngine.d.ts.map +1 -1
- package/editor/tools/engine/ToolEngine.js +10 -0
- package/editor/tools/v2/TransformControls.d.ts.map +1 -1
- package/editor/tools/v2/TransformControls.js +7 -20
- package/editor/tools/v2/handle/gizmo_drag_plane.d.ts.map +1 -1
- package/editor/tools/v2/handle/gizmo_drag_plane.js +4 -0
- package/editor/view/ecs/EntityEditor.d.ts.map +1 -1
- package/editor/view/ecs/EntityEditor.js +3 -1
- package/editor/view/node-graph/NodeGraphView.d.ts.map +1 -1
- package/editor/view/node-graph/NodeGraphView.js +28 -12
- package/package.json +91 -96
- package/samples/engine/first-scene/index.html +4 -1
- package/samples/engine/first-scene/main.js +14 -9
- package/src/core/binary/utf8/utf8_decode.js +3 -3
- package/src/core/bvh2/binary/2/bvh32_query_user_data_ray.d.ts.map +1 -1
- package/src/core/bvh2/binary/2/bvh32_query_user_data_ray.js +112 -113
- package/src/core/bvh2/bvh3/ebvh_nodes_sort_sah_local4.js +2 -2
- package/src/core/cache/wtinylfu/benchmark/CacheWTinylfu.bench.md +14 -14
- package/src/core/collection/RingBuffer.d.ts.map +1 -1
- package/src/core/collection/RingBuffer.js +4 -0
- package/src/core/collection/array/array_contains_duplicates.d.ts.map +1 -1
- package/src/core/collection/array/array_contains_duplicates.js +2 -1
- package/src/core/collection/array/array_copy.d.ts.map +1 -1
- package/src/core/collection/array/array_copy.js +23 -0
- package/src/core/collection/array/typed/sparse_typed_array_hash.d.ts +2 -2
- package/src/core/collection/array/typed/sparse_typed_array_hash.d.ts.map +1 -1
- package/src/core/collection/array/typed/sparse_typed_array_hash.js +9 -8
- package/src/core/collection/array/typed/uint16_array_hash.d.ts +2 -2
- package/src/core/collection/array/typed/uint16_array_hash.js +4 -4
- package/src/core/collection/array/typed/uint8_array_hash.d.ts +2 -2
- package/src/core/collection/array/typed/uint8_array_hash.js +4 -4
- package/src/core/collection/array/weightedRandomFromArray.d.ts +1 -0
- package/src/core/collection/array/weightedRandomFromArray.d.ts.map +1 -1
- package/src/core/collection/array/weightedRandomFromArray.js +9 -1
- package/src/core/collection/heap/BinaryHeap.d.ts.map +1 -1
- package/src/core/collection/heap/BinaryHeap.js +4 -0
- package/src/core/collection/list/List.d.ts.map +1 -1
- package/src/core/collection/list/List.js +4 -2
- package/src/core/collection/set/ArraySet.js +1 -1
- package/src/core/collection/set/HashSet.d.ts +1 -1
- package/src/core/collection/set/HashSet.d.ts.map +1 -1
- package/src/core/collection/set/HashSet.js +4 -2
- package/src/core/debug/matchers/IsEqual.js +1 -1
- package/src/core/debug/matchers/IsIterableContaining.d.ts.map +1 -1
- package/src/core/debug/matchers/IsIterableContaining.js +61 -74
- package/src/core/events/signal/SignalBinding.js +101 -101
- package/src/core/function/extractFunctionBody.js +13 -13
- package/src/core/function/objectsEqual.d.ts.map +1 -1
- package/src/core/function/objectsEqual.js +15 -14
- package/src/core/geom/3d/frustum/frustum3_compute_closest_point.d.ts.map +1 -1
- package/src/core/geom/3d/frustum/frustum3_compute_closest_point.js +207 -172
- package/src/core/geom/3d/gjk/gjk_epa_penetration.d.ts.map +1 -1
- package/src/core/geom/3d/gjk/gjk_epa_penetration.js +5 -4
- package/src/core/geom/3d/line/line3_compute_segment_point_distance_eikonal.d.ts.map +1 -1
- package/src/core/geom/3d/line/line3_compute_segment_point_distance_eikonal.js +8 -2
- package/src/core/geom/3d/triangle/tri3_ray_intersection.d.ts +20 -0
- package/src/core/geom/3d/triangle/tri3_ray_intersection.d.ts.map +1 -1
- package/src/core/geom/3d/triangle/tri3_ray_intersection.js +182 -0
- package/src/core/math/noise/curl_noise_3dt.d.ts.map +1 -1
- package/src/core/math/noise/curl_noise_3dt.js +20 -10
- package/src/core/math/noise/sdnoise.d.ts +16 -5
- package/src/core/math/noise/sdnoise.d.ts.map +1 -1
- package/src/core/math/noise/sdnoise.js +43 -9
- package/src/core/math/spline/spline3_hermite_nearest_point.d.ts +16 -1
- package/src/core/math/spline/spline3_hermite_nearest_point.d.ts.map +1 -1
- package/src/core/math/spline/spline3_hermite_nearest_point.js +44 -3
- package/src/engine/Engine.d.ts.map +1 -1
- package/src/engine/Engine.js +6 -2
- package/src/engine/control/first-person/FirstPersonPlayerController.d.ts +9 -0
- package/src/engine/control/first-person/FirstPersonPlayerController.d.ts.map +1 -1
- package/src/engine/control/first-person/FirstPersonPlayerControllerConfig.d.ts +26 -0
- package/src/engine/control/first-person/FirstPersonPlayerControllerConfig.d.ts.map +1 -1
- package/src/engine/control/first-person/FirstPersonPlayerControllerConfig.js +2 -0
- package/src/engine/control/first-person/abilities/AbilitySet.d.ts.map +1 -1
- package/src/engine/control/first-person/abilities/AbilitySet.js +9 -0
- package/src/engine/control/first-person/abilities/LedgeGrab.d.ts.map +1 -1
- package/src/engine/control/first-person/abilities/LedgeGrab.js +6 -0
- package/src/engine/control/first-person/abilities/Slide.d.ts.map +1 -1
- package/src/engine/control/first-person/abilities/Slide.js +1 -0
- package/src/engine/control/first-person/abilities/WallRun.d.ts +4 -1
- package/src/engine/control/first-person/abilities/WallRun.d.ts.map +1 -1
- package/src/engine/control/first-person/abilities/WallRun.js +13 -1
- package/src/engine/control/first-person/mastery/SlideInitiationTimingEvaluator.d.ts +1 -1
- package/src/engine/control/first-person/mastery/SlideInitiationTimingEvaluator.d.ts.map +1 -1
- package/src/engine/control/first-person/mastery/SlideInitiationTimingEvaluator.js +6 -5
- package/src/engine/control/first-person/mastery/StrideTimingJumpEvaluator.d.ts +3 -3
- package/src/engine/control/first-person/mastery/StrideTimingJumpEvaluator.d.ts.map +1 -1
- package/src/engine/control/first-person/mastery/StrideTimingJumpEvaluator.js +9 -8
- package/src/engine/control/first-person/sensors/FirstPersonSensorsSystem.d.ts.map +1 -1
- package/src/engine/control/first-person/sensors/FirstPersonSensorsSystem.js +13 -4
- package/src/engine/ecs/EntityManager.d.ts.map +1 -1
- package/src/engine/ecs/EntityManager.js +18 -15
- package/src/engine/ecs/dynamic_actions/rules/DynamicRuleDescription.d.ts.map +1 -1
- package/src/engine/ecs/dynamic_actions/rules/DynamicRuleDescription.js +2 -1
- package/src/engine/ecs/dynamic_actions/rules/DynamicRuleDescriptionTable.d.ts.map +1 -1
- package/src/engine/ecs/dynamic_actions/rules/DynamicRuleDescriptionTable.js +1 -0
- package/src/engine/ecs/fow/FogOfWarRevealerSystem.d.ts.map +1 -1
- package/src/engine/ecs/fow/FogOfWarRevealerSystem.js +3 -0
- package/src/engine/ecs/parent/EntityNode.js +3 -3
- package/src/engine/ecs/speaker/VoiceSystem.d.ts.map +1 -1
- package/src/engine/ecs/speaker/VoiceSystem.js +4 -0
- package/src/engine/ecs/storage/BinaryBufferDeSerializer.js +5 -5
- package/src/engine/ecs/storage/binary/BinarySerializationRegistry.d.ts.map +1 -1
- package/src/engine/ecs/storage/binary/BinarySerializationRegistry.js +3 -2
- package/src/engine/ecs/storage/binary/object/BinaryObjectSerializationAdapter2.js +1 -1
- package/src/engine/ecs/storage/binary/object-v2/BinaryObjectDeSerializer.d.ts.map +1 -1
- package/src/engine/ecs/storage/binary/object-v2/BinaryObjectDeSerializer.js +8 -1
- package/src/engine/ecs/storage/populateEngineSerializationRegistry.d.ts.map +1 -1
- package/src/engine/ecs/storage/populateEngineSerializationRegistry.js +8 -0
- package/src/engine/ecs/terrain/ecs/cling/ClingToTerrainSystem.d.ts.map +1 -1
- package/src/engine/ecs/terrain/ecs/cling/ClingToTerrainSystem.js +5 -2
- package/src/engine/ecs/terrain/ecs/layers/TerrainLayers.d.ts.map +1 -1
- package/src/engine/ecs/terrain/ecs/layers/TerrainLayers.js +3 -0
- package/src/engine/ecs/terrain/ecs/splat/SplatMapping.d.ts.map +1 -1
- package/src/engine/ecs/terrain/ecs/splat/SplatMapping.js +1 -0
- package/src/engine/ecs/terrain/overlay/TerrainOverlay.js +1 -1
- package/src/engine/ecs/terrain/tiles/TerrainTile.d.ts.map +1 -1
- package/src/engine/ecs/terrain/tiles/TerrainTile.js +13 -1
- package/src/engine/ecs/terrain/tiles/TerrainTileManager.d.ts.map +1 -1
- package/src/engine/ecs/terrain/tiles/TerrainTileManager.js +1 -0
- package/src/engine/graphics/ecs/light/LightSerializationAdapter.d.ts.map +1 -1
- package/src/engine/graphics/ecs/light/LightSerializationAdapter.js +13 -1
- package/src/engine/graphics/ecs/light/LightSerializationUpgrader_0_1.d.ts +5 -0
- package/src/engine/graphics/ecs/light/LightSerializationUpgrader_0_1.d.ts.map +1 -0
- package/src/engine/graphics/ecs/light/LightSerializationUpgrader_0_1.js +27 -0
- package/src/engine/graphics/ecs/water/Water.d.ts +11 -0
- package/src/engine/graphics/ecs/water/Water.d.ts.map +1 -1
- package/src/engine/graphics/ecs/water/Water.js +17 -0
- package/src/engine/graphics/ecs/water/WaterSerializationAdapter.d.ts.map +1 -1
- package/src/engine/graphics/ecs/water/WaterSerializationAdapter.js +3 -1
- package/src/engine/graphics/ecs/water/WaterSerializationUpgrader_4_5.d.ts +9 -0
- package/src/engine/graphics/ecs/water/WaterSerializationUpgrader_4_5.d.ts.map +1 -0
- package/src/engine/graphics/ecs/water/WaterSerializationUpgrader_4_5.js +24 -0
- package/src/engine/graphics/ecs/water/WaterWaves.d.ts +30 -9
- package/src/engine/graphics/ecs/water/WaterWaves.d.ts.map +1 -1
- package/src/engine/graphics/ecs/water/WaterWaves.js +41 -9
- package/src/engine/graphics/ecs/water/WaterWavesSerializationAdapter.d.ts.map +1 -1
- package/src/engine/graphics/ecs/water/WaterWavesSerializationAdapter.js +30 -26
- package/src/engine/graphics/ecs/water/WaterWavesSerializationUpgrader_0_1.d.ts +6 -0
- package/src/engine/graphics/ecs/water/WaterWavesSerializationUpgrader_0_1.d.ts.map +1 -0
- package/src/engine/graphics/ecs/water/WaterWavesSerializationUpgrader_0_1.js +22 -0
- package/src/engine/graphics/geometry/buffered/query/bvh32_geometry_raycast.d.ts.map +1 -1
- package/src/engine/graphics/geometry/buffered/query/bvh32_geometry_raycast.js +3 -5
- package/src/engine/graphics/texture/3d/scs3d_sample_linear3.d.ts +20 -0
- package/src/engine/graphics/texture/3d/scs3d_sample_linear3.d.ts.map +1 -1
- package/src/engine/graphics/texture/3d/scs3d_sample_linear3.js +36 -0
- package/src/engine/graphics3/WaterSystem.d.ts +12 -3
- package/src/engine/graphics3/WaterSystem.d.ts.map +1 -1
- package/src/engine/graphics3/WaterSystem.js +78 -46
- package/src/engine/input/devices/PointerDevice.d.ts.map +1 -1
- package/src/engine/input/devices/PointerDevice.js +29 -4
- package/src/engine/intelligence/behavior/selector/WeightedRandomBehavior.d.ts +1 -0
- package/src/engine/intelligence/behavior/selector/WeightedRandomBehavior.d.ts.map +1 -1
- package/src/engine/intelligence/behavior/selector/WeightedRandomBehavior.js +14 -3
- package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
- package/src/engine/physics/fluid/solver/v3_grid_advect_maccormack_velocity.d.ts.map +1 -1
- package/src/engine/physics/fluid/solver/v3_grid_advect_maccormack_velocity.js +12 -3
- package/src/engine/physics/fluid/solver/v3_grid_advect_sl_velocity.d.ts.map +1 -1
- package/src/engine/physics/fluid/solver/v3_grid_advect_sl_velocity.js +8 -2
- package/src/engine/physics/fluid/solver/v3_grid_sample_scalar_masked.d.ts +19 -0
- package/src/engine/physics/fluid/solver/v3_grid_sample_scalar_masked.d.ts.map +1 -1
- package/src/engine/physics/fluid/solver/v3_grid_sample_scalar_masked.js +41 -2
- package/src/engine/physics/fluid/solver/v3_mac_advect_scalar.d.ts.map +1 -1
- package/src/engine/physics/fluid/solver/v3_mac_advect_scalar.js +9 -3
- package/src/engine/physics/fluid/solver/v3_mac_advect_sl_velocity.d.ts.map +1 -1
- package/src/engine/physics/fluid/solver/v3_mac_advect_sl_velocity.js +26 -10
- package/src/engine/sound/sopra/definition/clip/RandomContainerAudioClip.d.ts +3 -6
- package/src/engine/sound/sopra/definition/clip/RandomContainerAudioClip.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/clip/RandomContainerAudioClip.js +22 -9
- package/src/engine/ui/DraggableAspect.d.ts +5 -1
- package/src/engine/ui/DraggableAspect.d.ts.map +1 -1
- package/src/engine/ui/DraggableAspect.js +61 -4
- package/src/format/image/avif/heif/ItemProperty.d.ts +1 -1
- package/src/format/image/avif/heif/ItemProperty.js +1 -1
- package/src/format/image/png/chunk/png_chunk_decode_iTXt.d.ts.map +1 -1
- package/src/format/image/png/chunk/png_chunk_decode_iTXt.js +17 -6
- package/src/shade/device/mock/SoftwareGPUDevice.d.ts +2 -4
- package/src/shade/device/mock/SoftwareGPUDevice.d.ts.map +1 -1
- package/src/shade/device/mock/SoftwareGPUDevice.js +20 -13
- package/src/shade/playground/skinned_blas_refit/sweep_views.d.ts.map +1 -1
- package/src/shade/playground/skinned_blas_refit/sweep_views.js +2 -1
- package/src/shade/playground/vgeo_runtime/README.md +5 -4
- package/src/shade/playground/water_refraction/README.md +10 -11
- package/src/shade/playground/water_refraction/main.js +9 -8
- package/src/shade/playground/water_refraction/world.js +1 -1
- package/src/shade/playground/water_surface/README.md +43 -0
- package/src/shade/playground/water_surface/index.html +30 -0
- package/src/shade/playground/water_surface/main.d.ts +2 -0
- package/src/shade/playground/water_surface/main.d.ts.map +1 -0
- package/src/shade/playground/water_surface/main.js +154 -0
- package/src/shade/playground/water_surface/world.d.ts +44 -0
- package/src/shade/playground/water_surface/world.d.ts.map +1 -0
- package/src/shade/playground/water_surface/world.js +160 -0
- package/src/shade/renderer/Renderer.d.ts.map +1 -1
- package/src/shade/renderer/Renderer.js +6 -5
- package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.d.ts.map +1 -1
- package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.js +5 -0
- package/src/shade/renderer/atmosphere/GPUSky.d.ts +12 -0
- package/src/shade/renderer/atmosphere/GPUSky.d.ts.map +1 -1
- package/src/shade/renderer/atmosphere/GPUSky.js +162 -147
- package/src/shade/renderer/binding/BufferBinding.js +2 -2
- package/src/shade/renderer/buffer/table/GPUTypedTable.d.ts.map +1 -1
- package/src/shade/renderer/buffer/table/GPUTypedTable.js +5 -3
- package/src/shade/renderer/buffer/table/GPUTypedTableDescriptor.d.ts +10 -3
- package/src/shade/renderer/buffer/table/GPUTypedTableDescriptor.d.ts.map +1 -1
- package/src/shade/renderer/buffer/table/GPUTypedTableDescriptor.js +17 -9
- package/src/shade/renderer/camera/orbital/OrbitalCameraInput.d.ts +3 -0
- package/src/shade/renderer/camera/orbital/OrbitalCameraInput.d.ts.map +1 -1
- package/src/shade/renderer/camera/orbital/OrbitalCameraInput.js +16 -0
- package/src/shade/renderer/camera/orbital/OrbitalCameraRig.d.ts +2 -0
- package/src/shade/renderer/camera/orbital/OrbitalCameraRig.d.ts.map +1 -1
- package/src/shade/renderer/camera/orbital/OrbitalCameraRig.js +11 -0
- package/src/shade/renderer/geometry/meshlet/build/meshoptimizer/geometry_to_meshlets_meshoptimizer.d.ts +1 -1
- package/src/shade/renderer/geometry/meshlet/build/meshoptimizer/geometry_to_meshlets_meshoptimizer.d.ts.map +1 -1
- package/src/shade/renderer/geometry/meshlet/build/meshoptimizer/geometry_to_meshlets_meshoptimizer.js +9 -3
- package/src/shade/renderer/geometry/util/geometry_simplify_redundant_topology.d.ts.map +1 -1
- package/src/shade/renderer/geometry/util/geometry_simplify_redundant_topology.js +2 -2
- package/src/shade/renderer/geometry/virtual/format/vgeo_validate_container.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/format/vgeo_validate_container.js +85 -0
- package/src/shade/renderer/geometry/virtual/runtime/GPUVirtualGeometryRuntime.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/runtime/GPUVirtualGeometryRuntime.js +12 -6
- package/src/shade/renderer/geometry/virtual/runtime/VGeoPageFetcher.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/runtime/VGeoPageFetcher.js +7 -0
- package/src/shade/renderer/geometry/virtual/runtime/VGeoRuntimeTables.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/runtime/VGeoRuntimeTables.js +3 -1
- package/src/shade/renderer/lightmap/bake/shader_lightmap_denoise_sh.d.ts.map +1 -1
- package/src/shade/renderer/lightmap/bake/shader_lightmap_denoise_sh.js +10 -3
- package/src/shade/renderer/loader/gltf/tiny-gltf.d.ts +1 -1
- package/src/shade/renderer/particles/DESIGN.md +13 -9
- package/src/shade/renderer/particles/shaders/chunk_particle_lighting.d.ts +1 -1
- package/src/shade/renderer/particles/shaders/chunk_particle_lighting.js +1 -1
- package/src/shade/renderer/postprocess/nss/NSS.d.ts +1 -1
- package/src/shade/renderer/rasterize/native/avboit/AVBOITSideChannel.d.ts +3 -2
- package/src/shade/renderer/rasterize/native/avboit/AVBOITSideChannel.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/native/avboit/AVBOITSideChannel.js +3 -2
- package/src/shade/renderer/scene/GPUSceneContext.d.ts +9 -1
- package/src/shade/renderer/scene/GPUSceneContext.d.ts.map +1 -1
- package/src/shade/renderer/scene/GPUSceneContext.js +23 -1
- package/src/shade/renderer/scene/SCENE_DATABASE_SPEC.js +2 -1
- package/src/shade/renderer/shader/chunk/math/fft/chunk_fft128_inverse.d.ts +13 -0
- package/src/shade/renderer/shader/chunk/math/fft/chunk_fft128_inverse.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/math/fft/chunk_fft128_inverse.js +42 -0
- package/src/shade/renderer/shader/chunk/math/fft/chunk_fft128x4_inverse_workgroup.d.ts +15 -0
- package/src/shade/renderer/shader/chunk/math/fft/chunk_fft128x4_inverse_workgroup.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/math/fft/chunk_fft128x4_inverse_workgroup.js +39 -0
- package/src/shade/renderer/shader/resource/ShaderResourceSetDescriptor.d.ts.map +1 -1
- package/src/shade/renderer/shader/resource/ShaderResourceSetDescriptor.js +2 -0
- package/src/shade/renderer/volumetrics/GPUViewVolumetrics.d.ts +4 -1
- package/src/shade/renderer/volumetrics/GPUViewVolumetrics.d.ts.map +1 -1
- package/src/shade/renderer/volumetrics/GPUViewVolumetrics.js +74 -3
- package/src/shade/renderer/volumetrics/NOTES.md +1023 -957
- package/src/shade/renderer/volumetrics/chunk_volumetrics_irradiance_sh.d.ts +5 -4
- package/src/shade/renderer/volumetrics/chunk_volumetrics_irradiance_sh.d.ts.map +1 -1
- package/src/shade/renderer/volumetrics/chunk_volumetrics_irradiance_sh.js +5 -4
- package/src/shade/renderer/volumetrics/gi/chunk_volumetrics_gi.d.ts +1 -1
- package/src/shade/renderer/volumetrics/gi/chunk_volumetrics_gi.js +1 -1
- package/src/shade/renderer/volumetrics/gi/graph_build_froxel_gi.d.ts +1 -1
- package/src/shade/renderer/volumetrics/gi/graph_build_froxel_gi.js +1 -1
- package/src/shade/renderer/volumetrics/graph_build_froxel_irradiance.d.ts +41 -0
- package/src/shade/renderer/volumetrics/graph_build_froxel_irradiance.d.ts.map +1 -0
- package/src/shade/renderer/volumetrics/graph_build_froxel_irradiance.js +112 -0
- package/src/shade/renderer/volumetrics/graph_build_volumetrics.d.ts +9 -23
- package/src/shade/renderer/volumetrics/graph_build_volumetrics.d.ts.map +1 -1
- package/src/shade/renderer/volumetrics/graph_build_volumetrics.js +18 -126
- package/src/shade/renderer/volumetrics/shader_volumetrics_build_irradiance.d.ts +22 -0
- package/src/shade/renderer/volumetrics/shader_volumetrics_build_irradiance.d.ts.map +1 -0
- package/src/shade/renderer/volumetrics/shader_volumetrics_build_irradiance.js +228 -0
- package/src/shade/renderer/volumetrics/shader_volumetrics_build_lighting.d.ts.map +1 -1
- package/src/shade/renderer/volumetrics/shader_volumetrics_build_lighting.js +0 -53
- package/src/shade/renderer/water/GPUWaterRenderer.d.ts +15 -0
- package/src/shade/renderer/water/GPUWaterRenderer.d.ts.map +1 -1
- package/src/shade/renderer/water/GPUWaterRenderer.js +110 -30
- package/src/shade/renderer/water/medium/GPUWaterBodies.d.ts +16 -8
- package/src/shade/renderer/water/medium/GPUWaterBodies.d.ts.map +1 -1
- package/src/shade/renderer/water/medium/GPUWaterBodies.js +31 -26
- package/src/shade/renderer/water/medium/shader_water_meshlets.d.ts +0 -1
- package/src/shade/renderer/water/medium/shader_water_meshlets.d.ts.map +1 -1
- package/src/shade/renderer/water/medium/shader_water_meshlets.js +1 -39
- package/src/shade/renderer/water/shader_water.d.ts +0 -1
- package/src/shade/renderer/water/shader_water.d.ts.map +1 -1
- package/src/shade/renderer/water/shader_water.js +201 -72
- package/src/shade/renderer/water/surface/GPUWaterSurface.d.ts +70 -0
- package/src/shade/renderer/water/surface/GPUWaterSurface.d.ts.map +1 -0
- package/src/shade/renderer/water/surface/GPUWaterSurface.js +199 -0
- package/src/shade/renderer/water/surface/WATER_WAVE_RECORD_STRUCT.d.ts +5 -2
- package/src/shade/renderer/water/surface/WATER_WAVE_RECORD_STRUCT.d.ts.map +1 -1
- package/src/shade/renderer/water/surface/WATER_WAVE_RECORD_STRUCT.js +32 -12
- package/src/shade/renderer/water/surface/chunk_water_surface_sample.d.ts +23 -0
- package/src/shade/renderer/water/surface/chunk_water_surface_sample.d.ts.map +1 -0
- package/src/shade/renderer/water/surface/chunk_water_surface_sample.js +227 -0
- package/src/shade/renderer/water/surface/graph_water_tessellation.d.ts +65 -11
- package/src/shade/renderer/water/surface/graph_water_tessellation.d.ts.map +1 -1
- package/src/shade/renderer/water/surface/graph_water_tessellation.js +163 -28
- package/src/shade/renderer/water/surface/lod/WATER_LOD.d.ts +51 -0
- package/src/shade/renderer/water/surface/lod/WATER_LOD.d.ts.map +1 -0
- package/src/shade/renderer/water/surface/lod/WATER_LOD.js +95 -0
- package/src/shade/renderer/water/surface/lod/chunk_water_lod.d.ts +10 -0
- package/src/shade/renderer/water/surface/lod/chunk_water_lod.d.ts.map +1 -0
- package/src/shade/renderer/water/surface/lod/chunk_water_lod.js +127 -0
- package/src/shade/renderer/water/surface/lod/chunk_water_lod_cell.d.ts +17 -0
- package/src/shade/renderer/water/surface/lod/chunk_water_lod_cell.d.ts.map +1 -0
- package/src/shade/renderer/water/surface/lod/chunk_water_lod_cell.js +246 -0
- package/src/shade/renderer/water/surface/lod/shader_water_lod.d.ts +118 -0
- package/src/shade/renderer/water/surface/lod/shader_water_lod.d.ts.map +1 -0
- package/src/shade/renderer/water/surface/lod/shader_water_lod.js +727 -0
- package/src/shade/renderer/water/surface/particles/GPUWaterParticles.d.ts +60 -0
- package/src/shade/renderer/water/surface/particles/GPUWaterParticles.d.ts.map +1 -0
- package/src/shade/renderer/water/surface/particles/GPUWaterParticles.js +274 -0
- package/src/shade/renderer/water/surface/particles/WATER_PARTICLE_STRUCT.d.ts +17 -0
- package/src/shade/renderer/water/surface/particles/WATER_PARTICLE_STRUCT.d.ts.map +1 -0
- package/src/shade/renderer/water/surface/particles/WATER_PARTICLE_STRUCT.js +57 -0
- package/src/shade/renderer/water/surface/particles/chunk_water_particle.d.ts +43 -0
- package/src/shade/renderer/water/surface/particles/chunk_water_particle.d.ts.map +1 -0
- package/src/shade/renderer/water/surface/particles/chunk_water_particle.js +268 -0
- package/src/shade/renderer/water/surface/particles/chunk_water_particle_step.d.ts +20 -0
- package/src/shade/renderer/water/surface/particles/chunk_water_particle_step.d.ts.map +1 -0
- package/src/shade/renderer/water/surface/particles/chunk_water_particle_step.js +239 -0
- package/src/shade/renderer/water/surface/particles/shader_water_particles.d.ts +153 -0
- package/src/shade/renderer/water/surface/particles/shader_water_particles.d.ts.map +1 -0
- package/src/shade/renderer/water/surface/particles/shader_water_particles.js +874 -0
- package/src/shade/renderer/water/surface/shader_water_cull.d.ts +42 -0
- package/src/shade/renderer/water/surface/shader_water_cull.d.ts.map +1 -0
- package/src/shade/renderer/water/surface/shader_water_cull.js +269 -0
- package/src/shade/renderer/water/surface/shader_water_waves_combine.d.ts +15 -0
- package/src/shade/renderer/water/surface/shader_water_waves_combine.d.ts.map +1 -0
- package/src/shade/renderer/water/surface/shader_water_waves_combine.js +73 -0
- package/src/shade/renderer/water/surface/shader_water_waves_derive.d.ts +11 -0
- package/src/shade/renderer/water/surface/shader_water_waves_derive.d.ts.map +1 -0
- package/src/shade/renderer/water/surface/shader_water_waves_derive.js +78 -0
- package/src/shade/renderer/water/surface/spectrum/GPUWaterSpectrum.d.ts +35 -0
- package/src/shade/renderer/water/surface/spectrum/GPUWaterSpectrum.d.ts.map +1 -0
- package/src/shade/renderer/water/surface/spectrum/GPUWaterSpectrum.js +103 -0
- package/src/shade/renderer/water/surface/spectrum/WATER_BAND_STATE.d.ts +22 -0
- package/src/shade/renderer/water/surface/spectrum/WATER_BAND_STATE.d.ts.map +1 -0
- package/src/shade/renderer/water/surface/spectrum/WATER_BAND_STATE.js +57 -0
- package/src/shade/renderer/water/surface/spectrum/WATER_SPECTRUM.d.ts +22 -0
- package/src/shade/renderer/water/surface/spectrum/WATER_SPECTRUM.d.ts.map +1 -0
- package/src/shade/renderer/water/surface/spectrum/WATER_SPECTRUM.js +25 -0
- package/src/shade/renderer/water/surface/spectrum/chunk_water_jonswap.d.ts +14 -0
- package/src/shade/renderer/water/surface/spectrum/chunk_water_jonswap.d.ts.map +1 -0
- package/src/shade/renderer/water/surface/spectrum/chunk_water_jonswap.js +48 -0
- package/src/shade/renderer/water/surface/spectrum/chunk_water_spectrum.d.ts +23 -0
- package/src/shade/renderer/water/surface/spectrum/chunk_water_spectrum.d.ts.map +1 -0
- package/src/shade/renderer/water/surface/spectrum/chunk_water_spectrum.js +169 -0
- package/src/shade/renderer/water/surface/spectrum/shader_water_spectrum.d.ts +26 -0
- package/src/shade/renderer/water/surface/spectrum/shader_water_spectrum.d.ts.map +1 -0
- package/src/shade/renderer/water/surface/spectrum/shader_water_spectrum.js +161 -0
- package/src/shade/wgsl/emulator/WGSLJavaScriptCompiler.d.ts.map +1 -1
- package/src/shade/wgsl/emulator/WGSLJavaScriptCompiler.js +29 -9
- package/src/shade/wgsl/emulator/WGSLLanguageCore.d.ts.map +1 -1
- package/src/shade/wgsl/emulator/WGSLLanguageCore.js +14 -3
- package/src/core/geom/2d/polygon/polygon2_triangulate.corpus.d.ts +0 -28
- package/src/core/geom/2d/polygon/polygon2_triangulate.corpus.d.ts.map +0 -1
- package/src/core/geom/2d/polygon/polygon2_triangulate.corpus.js +0 -86
- package/src/engine/ecs/storage/binary/object-v2/serializerTestHarness.d.ts +0 -29
- package/src/engine/ecs/storage/binary/object-v2/serializerTestHarness.d.ts.map +0 -1
- package/src/engine/ecs/storage/binary/object-v2/serializerTestHarness.js +0 -44
- package/src/shade/renderer/water/medium/shader_water_bodies_derive.d.ts +0 -4
- package/src/shade/renderer/water/medium/shader_water_bodies_derive.d.ts.map +0 -1
- package/src/shade/renderer/water/medium/shader_water_bodies_derive.js +0 -32
- package/src/shade/renderer/water/surface/GPUWaterWaveSimulation.d.ts +0 -25
- package/src/shade/renderer/water/surface/GPUWaterWaveSimulation.d.ts.map +0 -1
- package/src/shade/renderer/water/surface/GPUWaterWaveSimulation.js +0 -128
- package/src/shade/renderer/water/surface/chunk_water_tessellation.d.ts +0 -9
- package/src/shade/renderer/water/surface/chunk_water_tessellation.d.ts.map +0 -1
- package/src/shade/renderer/water/surface/chunk_water_tessellation.js +0 -144
- package/src/shade/renderer/water/surface/chunk_water_wave.d.ts +0 -13
- package/src/shade/renderer/water/surface/chunk_water_wave.d.ts.map +0 -1
- package/src/shade/renderer/water/surface/chunk_water_wave.js +0 -40
- package/src/shade/renderer/water/surface/shader_water_tiles.d.ts +0 -4
- package/src/shade/renderer/water/surface/shader_water_tiles.d.ts.map +0 -1
- package/src/shade/renderer/water/surface/shader_water_tiles.js +0 -123
- package/src/shade/renderer/water/surface/shader_water_wave_batch.d.ts +0 -6
- package/src/shade/renderer/water/surface/shader_water_wave_batch.d.ts.map +0 -1
- package/src/shade/renderer/water/surface/shader_water_wave_batch.js +0 -85
- package/src/shade/renderer/water/surface/shader_water_wave_domain.d.ts +0 -6
- package/src/shade/renderer/water/surface/shader_water_wave_domain.d.ts.map +0 -1
- package/src/shade/renderer/water/surface/shader_water_wave_domain.js +0 -83
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/** The longest step a particle takes in one frame, seconds: a stalled tab does not fling fronts across a lake. */
|
|
2
|
+
export const WATER_PARTICLE_STEP_LIMIT: number;
|
|
3
|
+
/**
|
|
4
|
+
* The wave particles of every water body of a scene, on the device (WATER_SURFACE_SIMULATION_PLAN_2026_10_06.md
|
|
5
|
+
* §5.4): ping-pong particle arrays, and each frame's hash of them for the surface sampler. Counts never leave
|
|
6
|
+
* the GPU; every pass over particles is dispatched indirectly from the count the previous pass wrote.
|
|
7
|
+
*/
|
|
8
|
+
export class GPUWaterParticles {
|
|
9
|
+
/** @returns {GPUBuffer} the frame's hash: table size, then inclusive bucket offsets */
|
|
10
|
+
get offsets(): GPUBuffer;
|
|
11
|
+
/** @returns {GPUBuffer} the frame's entries, bucket by bucket, each bucket ordered by particle */
|
|
12
|
+
get entries(): GPUBuffer;
|
|
13
|
+
/** @returns {GPUBuffer} per wave row: occupied-level mask, then a height bound per level (f32 bits) */
|
|
14
|
+
get body_bounds(): GPUBuffer;
|
|
15
|
+
/** @returns {GPUBuffer} the live particles: count, then records */
|
|
16
|
+
get particles(): GPUBuffer;
|
|
17
|
+
get capacity(): number;
|
|
18
|
+
/**
|
|
19
|
+
* Allocate for a device, a capacity and a number of wave rows.
|
|
20
|
+
*
|
|
21
|
+
* When the rows grow, the bounds the last stepping frame wrote are carried into the larger buffer: a paused
|
|
22
|
+
* frame does not rebuild them, and every body's surface is culled and tessellated by them.
|
|
23
|
+
*
|
|
24
|
+
* @param {GPUDevice} device
|
|
25
|
+
* @param {number} capacity
|
|
26
|
+
* @param {number} rows
|
|
27
|
+
* @returns {function(import("../../../../device/ShadeGPUCommandContext.js").ShadeGPUCommandContext):void|null} when the
|
|
28
|
+
* rows grew, encodes the carry and releases the old buffer once it ran; encode it before this frame's passes
|
|
29
|
+
*/
|
|
30
|
+
prepare(device: GPUDevice, capacity: number, rows: number): (arg0: import("../../../../device/ShadeGPUCommandContext.js").ShadeGPUCommandContext) => void | null;
|
|
31
|
+
dispose(): void;
|
|
32
|
+
/**
|
|
33
|
+
* The frame's particles (§5.4): when the frame steps, one step of every particle of a body simulated this frame (a
|
|
34
|
+
* paused body's stand still) and the splashes of the culling pass's emit list; then, every frame, the hash of the
|
|
35
|
+
* particles of the bodies simulated this frame, which the surface sampler gathers from, and their bounds. The hash
|
|
36
|
+
* is rebuilt on a frame that does not step too, since the bodies in view change with the camera.
|
|
37
|
+
*
|
|
38
|
+
* @param {object} options
|
|
39
|
+
* @param {import("../../../../../engine/graphics/render/frame_graph/FrameGraph.js").FrameGraph} options.graph
|
|
40
|
+
* @param {object} options.scene GPU scene context: database, geometries
|
|
41
|
+
* @param {GPUBuffer} options.steep per wave row: non-zero for a body that must stay calm
|
|
42
|
+
* @param {GPUBuffer} options.activity per wave row: the culling pass's {@link WaterActivity} bits
|
|
43
|
+
* @param {GPUBuffer} options.emit_rows the culling pass's emit list
|
|
44
|
+
* @param {GPUBuffer} options.commands the culling pass's commands
|
|
45
|
+
* @param {number} options.emit_command byte offset of the emit list's command in `commands`
|
|
46
|
+
* @param {number} options.dt seconds; zero for a frame that does not step
|
|
47
|
+
*/
|
|
48
|
+
record({ graph, scene, steep, activity, emit_rows, commands, emit_command, dt }: {
|
|
49
|
+
graph: import("../../../../../engine/graphics/render/frame_graph/FrameGraph.js").FrameGraph;
|
|
50
|
+
scene: object;
|
|
51
|
+
steep: GPUBuffer;
|
|
52
|
+
activity: GPUBuffer;
|
|
53
|
+
emit_rows: GPUBuffer;
|
|
54
|
+
commands: GPUBuffer;
|
|
55
|
+
emit_command: number;
|
|
56
|
+
dt: number;
|
|
57
|
+
}): void;
|
|
58
|
+
#private;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=GPUWaterParticles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GPUWaterParticles.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/water/surface/particles/GPUWaterParticles.js"],"names":[],"mappings":"AA+BA,kHAAkH;AAClH,+CAAgD;AAUhD;;;;GAIG;AACH;IAuBI,uFAAuF;IACvF,yBAAuC;IACvC,kGAAkG;IAClG,yBAAuC;IACvC,uGAAuG;IACvG,6BAA+C;IAC/C,mEAAmE;IACnE,2BAAyD;IACzD,uBAAyC;IAEzC;;;;;;;;;;;OAWG;IACH,qCALW,MAAM,QACN,MAAM,UACK,OAAO,8CAA8C,EAAE,sBAAsB,KAAE,IAAI,GAAC,IAAI,CAuD7G;IAED,gBAcC;IAED;;;;;;;;;;;;;;;OAeG;IACH;QATyG,KAAK,EAAnG,OAAO,iEAAiE,EAAE,UAAU;QACpE,KAAK,EAArB,MAAM;QACa,KAAK;QACL,QAAQ;QACR,SAAS;QACT,QAAQ;QACX,YAAY,EAA5B,MAAM;QACU,EAAE,EAAlB,MAAM;aAgGhB;;CACJ"}
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
import { assert } from "../../../../../core/assert.js";
|
|
2
|
+
import { graph_prefix_scan_csdldf } from "../../../gpu_primitive/prefix_sum/v1/graph_prefix_scan_csdldf.js";
|
|
3
|
+
import {
|
|
4
|
+
build_indirect_compute_dispatch_command,
|
|
5
|
+
INDIRECT_COMPUTE_COMMAND_DESCRIPTOR
|
|
6
|
+
} from "../../../gpu_primitive/indirect/IndirectComputeCommandBuildPass.js";
|
|
7
|
+
import { graph_import_buffer } from "../../../shader/graph/graph_import_buffer.js";
|
|
8
|
+
import { WATER_PARTICLE_BODY_BOUNDS_STRIDE } from "../shader_water_waves_combine.js";
|
|
9
|
+
import { WATER_PARTICLE_ENTRY_STRUCT, WATER_PARTICLE_STRUCT } from "./WATER_PARTICLE_STRUCT.js";
|
|
10
|
+
import {
|
|
11
|
+
shader_water_particles_bin,
|
|
12
|
+
shader_water_particles_bounds,
|
|
13
|
+
shader_water_particles_clear,
|
|
14
|
+
shader_water_particles_emit,
|
|
15
|
+
shader_water_particles_finalize,
|
|
16
|
+
shader_water_particles_fronts,
|
|
17
|
+
shader_water_particles_groups,
|
|
18
|
+
shader_water_particles_nest,
|
|
19
|
+
shader_water_particles_rank,
|
|
20
|
+
shader_water_particles_runs,
|
|
21
|
+
shader_water_particles_scatter,
|
|
22
|
+
shader_water_particles_share,
|
|
23
|
+
shader_water_particles_split,
|
|
24
|
+
shader_water_particles_total,
|
|
25
|
+
shader_water_particles_update,
|
|
26
|
+
shader_water_particles_weigh,
|
|
27
|
+
WATER_PARTICLE_CORNERS,
|
|
28
|
+
WATER_PARTICLE_CROWD_WORDS,
|
|
29
|
+
WATER_PARTICLE_NEST_WORDS
|
|
30
|
+
} from "./shader_water_particles.js";
|
|
31
|
+
|
|
32
|
+
/** The longest step a particle takes in one frame, seconds: a stalled tab does not fling fronts across a lake. */
|
|
33
|
+
export const WATER_PARTICLE_STEP_LIMIT = 1 / 15;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @param {number} value
|
|
37
|
+
* @returns {number} the smallest power of two at least value
|
|
38
|
+
*/
|
|
39
|
+
function power_of_two_at_least(value) {
|
|
40
|
+
return 2 ** Math.ceil(Math.log2(Math.max(value, 1)));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* The wave particles of every water body of a scene, on the device (WATER_SURFACE_SIMULATION_PLAN_2026_10_06.md
|
|
45
|
+
* §5.4): ping-pong particle arrays, and each frame's hash of them for the surface sampler. Counts never leave
|
|
46
|
+
* the GPU; every pass over particles is dispatched indirectly from the count the previous pass wrote.
|
|
47
|
+
*/
|
|
48
|
+
export class GPUWaterParticles {
|
|
49
|
+
#device = null;
|
|
50
|
+
#capacity = 0;
|
|
51
|
+
#table_limit = 0;
|
|
52
|
+
#rows = 0;
|
|
53
|
+
#parity = 0;
|
|
54
|
+
#particles = [];
|
|
55
|
+
#children = null;
|
|
56
|
+
#images = null;
|
|
57
|
+
#fronts = null;
|
|
58
|
+
#runs = null;
|
|
59
|
+
#draw = null;
|
|
60
|
+
#buckets = null;
|
|
61
|
+
#slots = null;
|
|
62
|
+
#bucket_amplitude = null;
|
|
63
|
+
#bucket_weight = null;
|
|
64
|
+
#bucket_nest = null;
|
|
65
|
+
#visible = null;
|
|
66
|
+
#staging = null;
|
|
67
|
+
#entries = null;
|
|
68
|
+
#body_bounds = null;
|
|
69
|
+
#commands = null;
|
|
70
|
+
|
|
71
|
+
/** @returns {GPUBuffer} the frame's hash: table size, then inclusive bucket offsets */
|
|
72
|
+
get offsets() { return this.#buckets; }
|
|
73
|
+
/** @returns {GPUBuffer} the frame's entries, bucket by bucket, each bucket ordered by particle */
|
|
74
|
+
get entries() { return this.#entries; }
|
|
75
|
+
/** @returns {GPUBuffer} per wave row: occupied-level mask, then a height bound per level (f32 bits) */
|
|
76
|
+
get body_bounds() { return this.#body_bounds; }
|
|
77
|
+
/** @returns {GPUBuffer} the live particles: count, then records */
|
|
78
|
+
get particles() { return this.#particles[this.#parity]; }
|
|
79
|
+
get capacity() { return this.#capacity; }
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Allocate for a device, a capacity and a number of wave rows.
|
|
83
|
+
*
|
|
84
|
+
* When the rows grow, the bounds the last stepping frame wrote are carried into the larger buffer: a paused
|
|
85
|
+
* frame does not rebuild them, and every body's surface is culled and tessellated by them.
|
|
86
|
+
*
|
|
87
|
+
* @param {GPUDevice} device
|
|
88
|
+
* @param {number} capacity
|
|
89
|
+
* @param {number} rows
|
|
90
|
+
* @returns {function(import("../../../../device/ShadeGPUCommandContext.js").ShadeGPUCommandContext):void|null} when the
|
|
91
|
+
* rows grew, encodes the carry and releases the old buffer once it ran; encode it before this frame's passes
|
|
92
|
+
*/
|
|
93
|
+
prepare(device, capacity, rows) {
|
|
94
|
+
assert.isNonNegativeInteger(capacity, 'capacity');
|
|
95
|
+
assert.greaterThan(capacity, 0, 'capacity');
|
|
96
|
+
if (device !== this.#device || capacity !== this.#capacity) {
|
|
97
|
+
this.dispose();
|
|
98
|
+
this.#device = device;
|
|
99
|
+
this.#capacity = capacity;
|
|
100
|
+
this.#table_limit = power_of_two_at_least(2 * WATER_PARTICLE_CORNERS * capacity);
|
|
101
|
+
const buffer = (label, size, usage = 0) => device.createBuffer({ label: `Water / particles ${label}`,
|
|
102
|
+
size: Math.max(16, size), usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST | GPUBufferUsage.COPY_SRC | usage });
|
|
103
|
+
const array_size = 16 + capacity * WATER_PARTICLE_STRUCT.size;
|
|
104
|
+
this.#particles = [buffer('a', array_size), buffer('b', array_size)];
|
|
105
|
+
this.#children = buffer('children', 16 + capacity * 4);
|
|
106
|
+
// per particle the mirror image the step left beside it at the outline
|
|
107
|
+
this.#images = buffer('images', capacity * WATER_PARTICLE_STRUCT.size);
|
|
108
|
+
// per particle the scanned run it is in; per run its first particle and its share; per particle its run
|
|
109
|
+
// and how it is drawn
|
|
110
|
+
this.#fronts = buffer('fronts', 16 + capacity * 4);
|
|
111
|
+
this.#runs = buffer('runs', capacity * 8);
|
|
112
|
+
this.#draw = buffer('draw', capacity * 8);
|
|
113
|
+
this.#buckets = buffer('buckets', 16 + this.#table_limit * 4);
|
|
114
|
+
this.#slots = buffer('slots', capacity * WATER_PARTICLE_CORNERS * 4);
|
|
115
|
+
this.#bucket_amplitude = buffer('bucket amplitude', this.#table_limit * 4);
|
|
116
|
+
// the summed steepness, the largest front and front complement entered, and the entries; then the most a point
|
|
117
|
+
// under it reads, and its entries by key
|
|
118
|
+
this.#bucket_weight = buffer('bucket weight', this.#table_limit * WATER_PARTICLE_CROWD_WORDS * 4);
|
|
119
|
+
this.#bucket_nest = buffer('bucket nest', this.#table_limit * WATER_PARTICLE_NEST_WORDS * 4);
|
|
120
|
+
this.#visible = buffer('visible', capacity * 4);
|
|
121
|
+
const entries = capacity * WATER_PARTICLE_CORNERS * WATER_PARTICLE_ENTRY_STRUCT.size;
|
|
122
|
+
this.#staging = buffer('staging', entries);
|
|
123
|
+
this.#entries = buffer('entries', entries);
|
|
124
|
+
// the particles' this frame and next, and the clear of the frame's table
|
|
125
|
+
this.#commands = [0, 1, 2].map(i => device.createBuffer({ label: `Water / particles command ${i}`,
|
|
126
|
+
size: INDIRECT_COMPUTE_COMMAND_DESCRIPTOR.size, usage: INDIRECT_COMPUTE_COMMAND_DESCRIPTOR.usage }));
|
|
127
|
+
this.#rows = 0;
|
|
128
|
+
this.#parity = 0;
|
|
129
|
+
}
|
|
130
|
+
let carry = null;
|
|
131
|
+
if (rows > this.#rows || this.#body_bounds === null) {
|
|
132
|
+
const old = this.#body_bounds, old_rows = this.#rows;
|
|
133
|
+
this.#rows = Math.max(rows, 1);
|
|
134
|
+
const bounds = this.#body_bounds = device.createBuffer({ label: 'Water / particle body bounds',
|
|
135
|
+
size: this.#rows * WATER_PARTICLE_BODY_BOUNDS_STRIDE * 4,
|
|
136
|
+
usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST | GPUBufferUsage.COPY_SRC });
|
|
137
|
+
if (old !== null) {
|
|
138
|
+
carry = encoder => {
|
|
139
|
+
encoder.copyBufferToBuffer(old, 0, bounds, 0, old_rows * WATER_PARTICLE_BODY_BOUNDS_STRIDE * 4);
|
|
140
|
+
encoder.done.then(() => old.destroy());
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return carry;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
dispose() {
|
|
148
|
+
for (const buffer of [...this.#particles, this.#children, this.#images, this.#fronts, this.#runs, this.#draw, this.#buckets, this.#slots,
|
|
149
|
+
this.#bucket_amplitude, this.#bucket_weight, this.#bucket_nest, this.#visible, this.#staging, this.#entries, this.#body_bounds, ...(this.#commands ?? [])]) {
|
|
150
|
+
buffer?.destroy();
|
|
151
|
+
}
|
|
152
|
+
this.#particles = [];
|
|
153
|
+
this.#children = this.#images = this.#buckets = this.#slots = this.#bucket_amplitude = this.#staging = this.#entries = null;
|
|
154
|
+
this.#fronts = this.#runs = this.#draw = null;
|
|
155
|
+
this.#bucket_weight = this.#bucket_nest = this.#visible = null;
|
|
156
|
+
this.#body_bounds = null;
|
|
157
|
+
this.#commands = null;
|
|
158
|
+
this.#device = null;
|
|
159
|
+
this.#capacity = 0;
|
|
160
|
+
this.#rows = 0;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* The frame's particles (§5.4): when the frame steps, one step of every particle of a body simulated this frame (a
|
|
165
|
+
* paused body's stand still) and the splashes of the culling pass's emit list; then, every frame, the hash of the
|
|
166
|
+
* particles of the bodies simulated this frame, which the surface sampler gathers from, and their bounds. The hash
|
|
167
|
+
* is rebuilt on a frame that does not step too, since the bodies in view change with the camera.
|
|
168
|
+
*
|
|
169
|
+
* @param {object} options
|
|
170
|
+
* @param {import("../../../../../engine/graphics/render/frame_graph/FrameGraph.js").FrameGraph} options.graph
|
|
171
|
+
* @param {object} options.scene GPU scene context: database, geometries
|
|
172
|
+
* @param {GPUBuffer} options.steep per wave row: non-zero for a body that must stay calm
|
|
173
|
+
* @param {GPUBuffer} options.activity per wave row: the culling pass's {@link WaterActivity} bits
|
|
174
|
+
* @param {GPUBuffer} options.emit_rows the culling pass's emit list
|
|
175
|
+
* @param {GPUBuffer} options.commands the culling pass's commands
|
|
176
|
+
* @param {number} options.emit_command byte offset of the emit list's command in `commands`
|
|
177
|
+
* @param {number} options.dt seconds; zero for a frame that does not step
|
|
178
|
+
*/
|
|
179
|
+
record({ graph, scene, steep, activity, emit_rows, commands, emit_command, dt }) {
|
|
180
|
+
assert.notNull(this.#device, 'prepare() first');
|
|
181
|
+
const stepping = dt > 0;
|
|
182
|
+
const step = Math.min(Math.max(dt, 0), WATER_PARTICLE_STEP_LIMIT);
|
|
183
|
+
const capacity = this.#capacity, table_limit = this.#table_limit;
|
|
184
|
+
const current = this.#particles[this.#parity];
|
|
185
|
+
// a frame that does not step bins the particles where they are
|
|
186
|
+
const next = stepping ? this.#particles[1 - this.#parity] : current;
|
|
187
|
+
if (stepping) { this.#parity = 1 - this.#parity; }
|
|
188
|
+
const [command_current, command_next, command_table] = this.#commands;
|
|
189
|
+
const geometries = scene.geometries;
|
|
190
|
+
let children = graph_import_buffer(graph, this.#children, 'Water / particle children');
|
|
191
|
+
let buckets = graph_import_buffer(graph, this.#buckets, 'Water / particle buckets');
|
|
192
|
+
let fronts = graph_import_buffer(graph, this.#fronts, 'Water / particle fronts');
|
|
193
|
+
const node = (name, execute, reads, writes) => {
|
|
194
|
+
const data = {};
|
|
195
|
+
const pass = graph.add(name, data, (d, resources, context) => execute(resources, context, d));
|
|
196
|
+
for (const [key, handle] of Object.entries(reads)) { data[key] = pass.read(handle); }
|
|
197
|
+
for (const [key, handle] of Object.entries(writes)) { data[key] = pass.write(handle); }
|
|
198
|
+
pass.make_side_effect();
|
|
199
|
+
return data;
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
if (stepping) {
|
|
203
|
+
// Each particle in place, and what it leaves.
|
|
204
|
+
children = node('Water / particles update', (resources, { encoder }) => {
|
|
205
|
+
encoder.copyBufferToBuffer(current, 0, this.#children, 0, 4);
|
|
206
|
+
build_indirect_compute_dispatch_command(64, encoder, current, 0, command_current, 0, true);
|
|
207
|
+
shader_water_particles_update.dispatchIndirect({ encoder, command: command_current, bindings: {
|
|
208
|
+
frame: { dt: step, capacity }, particles: current, children: this.#children, images: this.#images, activity,
|
|
209
|
+
scene_database: scene.scene_database_buffer, geometries: geometries.buffer_metadata,
|
|
210
|
+
blas_lookup: geometries.blas.buffer_metadata, blas_data: geometries.blas.buffer_data,
|
|
211
|
+
meshlet_metadata: geometries.meshlets.buffer_metadata, meshlet_data: geometries.meshlets.buffer_data,
|
|
212
|
+
} });
|
|
213
|
+
}, {}, { children }).children;
|
|
214
|
+
children = graph_prefix_scan_csdldf({ graph, data: children, element_max_count: capacity });
|
|
215
|
+
|
|
216
|
+
// What they leave into the next array, then the frame's splashes after them.
|
|
217
|
+
node('Water / particles split and emit', (resources, { encoder }) => {
|
|
218
|
+
shader_water_particles_split.dispatchIndirect({ encoder, command: command_current, bindings: {
|
|
219
|
+
capacity, particles: current, children: this.#children, images: this.#images, next } });
|
|
220
|
+
shader_water_particles_total.dispatch({ encoder, bindings: { capacity, children: this.#children, next } });
|
|
221
|
+
shader_water_particles_emit.dispatchIndirect({ encoder, command: commands, command_offset: emit_command,
|
|
222
|
+
bindings: { capacity, scene_database: scene.scene_database_buffer, emit_rows, steep, activity,
|
|
223
|
+
particle_bounds: this.#body_bounds, next } });
|
|
224
|
+
shader_water_particles_finalize.dispatch({ encoder, bindings: { limits: { capacity, table_limit }, next, offsets: this.#buckets,
|
|
225
|
+
table_command: command_table } });
|
|
226
|
+
}, { children }, {});
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// Each front's run of particles, so that a whole one is drawn as the seven it was emitted as.
|
|
230
|
+
fronts = node('Water / particles fronts', (resources, { encoder }) => {
|
|
231
|
+
if (!stepping) {
|
|
232
|
+
// the table size the last stepping frame chose for these particles
|
|
233
|
+
shader_water_particles_finalize.dispatch({ encoder, bindings: { limits: { capacity, table_limit }, next, offsets: this.#buckets,
|
|
234
|
+
table_command: command_table } });
|
|
235
|
+
}
|
|
236
|
+
build_indirect_compute_dispatch_command(64, encoder, next, 0, command_next, 0, true);
|
|
237
|
+
encoder.copyBufferToBuffer(next, 0, this.#fronts, 0, 4);
|
|
238
|
+
shader_water_particles_fronts.dispatchIndirect({ encoder, command: command_next, bindings: { next, fronts: this.#fronts } });
|
|
239
|
+
}, {}, { fronts }).fronts;
|
|
240
|
+
fronts = graph_prefix_scan_csdldf({ graph, data: fronts, element_max_count: capacity });
|
|
241
|
+
|
|
242
|
+
// The frame's hash: how each particle is drawn, how crowded each cell is and so how much of each run its crowd
|
|
243
|
+
// leaves drawn, then each packet drawn into the cells its support overlaps, offsets, entries in order.
|
|
244
|
+
buckets = node('Water / particles bin', (resources, { encoder }) => {
|
|
245
|
+
const draw = this.#draw, runs = this.#runs;
|
|
246
|
+
shader_water_particles_runs.dispatchIndirect({ encoder, command: command_next, bindings: { next, fronts: this.#fronts, runs } });
|
|
247
|
+
shader_water_particles_groups.dispatchIndirect({ encoder, command: command_next, bindings: { next, fronts: this.#fronts, runs, draw } });
|
|
248
|
+
shader_water_particles_clear.dispatchIndirect({ encoder, command: command_table, bindings: {
|
|
249
|
+
buckets: this.#buckets, bucket_amplitude: this.#bucket_amplitude, bucket_weight: this.#bucket_weight,
|
|
250
|
+
bucket_nest: this.#bucket_nest } });
|
|
251
|
+
shader_water_particles_weigh.dispatchIndirect({ encoder, command: command_next, bindings: {
|
|
252
|
+
next, activity, offsets: this.#buckets, draw, bucket_weight: this.#bucket_weight, body_bounds: this.#body_bounds } });
|
|
253
|
+
shader_water_particles_nest.dispatchIndirect({ encoder, command: command_next, bindings: {
|
|
254
|
+
next, activity, offsets: this.#buckets, draw, body_bounds: this.#body_bounds, bucket_weight: this.#bucket_weight,
|
|
255
|
+
bucket_nest: this.#bucket_nest } });
|
|
256
|
+
shader_water_particles_share.dispatchIndirect({ encoder, command: command_next, bindings: {
|
|
257
|
+
next, activity, offsets: this.#buckets, bucket_weight: this.#bucket_weight, bucket_nest: this.#bucket_nest,
|
|
258
|
+
body_bounds: this.#body_bounds, draw, runs } });
|
|
259
|
+
shader_water_particles_bin.dispatchIndirect({ encoder, command: command_next, bindings: {
|
|
260
|
+
next, activity, buckets: this.#buckets, slots: this.#slots, bucket_amplitude: this.#bucket_amplitude,
|
|
261
|
+
body_bounds: this.#body_bounds, draw, runs, visible: this.#visible } });
|
|
262
|
+
}, { fronts }, { buckets }).buckets;
|
|
263
|
+
buckets = graph_prefix_scan_csdldf({ graph, data: buckets, element_max_count: table_limit });
|
|
264
|
+
node('Water / particles order and bound', (resources, { encoder }) => {
|
|
265
|
+
const bindings = { next, offsets: this.#buckets, slots: this.#slots, draw: this.#draw };
|
|
266
|
+
shader_water_particles_scatter.dispatchIndirect({ encoder, command: command_next, bindings: { ...bindings,
|
|
267
|
+
visible: this.#visible, staging: this.#staging } });
|
|
268
|
+
shader_water_particles_rank.dispatchIndirect({ encoder, command: command_next, bindings: { ...bindings,
|
|
269
|
+
staging: this.#staging, entries: this.#entries } });
|
|
270
|
+
shader_water_particles_bounds.dispatchIndirect({ encoder, command: command_next, bindings: { next, activity,
|
|
271
|
+
offsets: this.#buckets, bucket_amplitude: this.#bucket_amplitude, draw: this.#draw, body_bounds: this.#body_bounds } });
|
|
272
|
+
}, { buckets }, {});
|
|
273
|
+
}
|
|
274
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One wave particle (Yuksel, House & Keyser 2007): a point of an expanding wave front carrying a small wave
|
|
3
|
+
* packet, in the metric local frame of the water body it lives on
|
|
4
|
+
* (WATER_SURFACE_SIMULATION_PLAN_2026_10_06.md §5).
|
|
5
|
+
*
|
|
6
|
+
* Its position is not stored; it is `origin + direction(angle) · group_speed(radius) · age`, so it moves
|
|
7
|
+
* without integration error and every particle of one front shares the origin and the age.
|
|
8
|
+
*/
|
|
9
|
+
export const WATER_PARTICLE_STRUCT: WebGPUStruct;
|
|
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.
|
|
14
|
+
*/
|
|
15
|
+
export const WATER_PARTICLE_ENTRY_STRUCT: WebGPUStruct;
|
|
16
|
+
import { WebGPUStruct } from "../../../shader/type/WebGPUStruct.js";
|
|
17
|
+
//# sourceMappingURL=WATER_PARTICLE_STRUCT.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { f32, u32, vec2f, vec2i } from "../../../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
|
|
2
|
+
import { WebGPUStruct } from "../../../shader/type/WebGPUStruct.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* One wave particle (Yuksel, House & Keyser 2007): a point of an expanding wave front carrying a small wave
|
|
6
|
+
* packet, in the metric local frame of the water body it lives on
|
|
7
|
+
* (WATER_SURFACE_SIMULATION_PLAN_2026_10_06.md §5).
|
|
8
|
+
*
|
|
9
|
+
* Its position is not stored; it is `origin + direction(angle) · group_speed(radius) · age`, so it moves
|
|
10
|
+
* without integration error and every particle of one front shares the origin and the age.
|
|
11
|
+
*/
|
|
12
|
+
export const WATER_PARTICLE_STRUCT = WebGPUStruct.from({
|
|
13
|
+
/** Centre of the front, or the mirror image of it for a reflection; metric local xz. */
|
|
14
|
+
origin: vec2f,
|
|
15
|
+
/** Propagation direction, radians from local +x towards +z. */
|
|
16
|
+
angle: f32,
|
|
17
|
+
/** Seconds the front has travelled from its origin. */
|
|
18
|
+
age: f32,
|
|
19
|
+
/** Signed ridge height at the packet's centre, metres. */
|
|
20
|
+
amplitude: f32,
|
|
21
|
+
/** Half the packet's wavelength, metres. */
|
|
22
|
+
radius: f32,
|
|
23
|
+
/** Angle to the neighbouring particle of the same front. */
|
|
24
|
+
dispersion: f32,
|
|
25
|
+
/** The water_waves row of the body it lives on. */
|
|
26
|
+
body: u32,
|
|
27
|
+
/**
|
|
28
|
+
* 1 once the first of its support has left its body's outline, or that of the particle it split from: its mirror
|
|
29
|
+
* image was emitted then, and it dies once the last of it has left too. 0 from emission.
|
|
30
|
+
*/
|
|
31
|
+
reflected: u32,
|
|
32
|
+
}, 'WaterParticle');
|
|
33
|
+
|
|
34
|
+
/**
|
|
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.
|
|
38
|
+
*/
|
|
39
|
+
export const WATER_PARTICLE_ENTRY_STRUCT = WebGPUStruct.from({
|
|
40
|
+
position: vec2f,
|
|
41
|
+
cell: vec2i,
|
|
42
|
+
angle: f32,
|
|
43
|
+
amplitude: f32,
|
|
44
|
+
radius: f32,
|
|
45
|
+
/** Half-angle of the window around the front's centre: the angle to the front's neighbouring particle. */
|
|
46
|
+
dispersion: f32,
|
|
47
|
+
/** Carrier phase lag of the crests behind the envelope, radians. */
|
|
48
|
+
phase: f32,
|
|
49
|
+
/** water_waves row and level, as water_particle_key packs them */
|
|
50
|
+
key: u32,
|
|
51
|
+
/** Index of the particle, which orders a bucket. */
|
|
52
|
+
source: u32,
|
|
53
|
+
/** How far the particle stands from its front's centre, metres. */
|
|
54
|
+
distance: f32,
|
|
55
|
+
/** Half the length of its envelope across its front, metres. */
|
|
56
|
+
half_length: f32,
|
|
57
|
+
}, 'WaterParticleEntry');
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Levels of the particle hash: cell sizes 4 mm · 2^level, so supports up to 256 m, which a 2 m splash's stretched
|
|
3
|
+
* packets reach before they die.
|
|
4
|
+
*/
|
|
5
|
+
export const WATER_PARTICLE_LEVELS: 18;
|
|
6
|
+
/** Cell size of level 0, metres. A particle sits at the smallest level whose cell is at least its support's diameter. */
|
|
7
|
+
export const WATER_PARTICLE_LEVEL0_CELL: number;
|
|
8
|
+
/**
|
|
9
|
+
* How fast a packet's envelope stretches as it disperses, as a fraction κ of its group speed, by its wavenumber k against
|
|
10
|
+
* k_m = √(g/(σ/ρ)), the wavenumber of the slowest crests (λ = 1.71 cm): from x = log₂(k/k_m) = -7 in steps of a quarter,
|
|
11
|
+
* held at both ends.
|
|
12
|
+
*
|
|
13
|
+
* Its half-length h, 2r when emitted, grows as h² = (2r)² + (κD/2)² over the distance D its front has travelled since:
|
|
14
|
+
* the spread of an unchirped packet's energy grows as the spread of its group speeds times time, in quadrature with
|
|
15
|
+
* where it began (Jeschke & Wojtan 2017 grow it linearly, eq. 14, its far limit). Each κ is the one whose peak
|
|
16
|
+
* √(2r/h) best matches exact linear theory, ω² = gk + (σ/ρ)k³, for the emitted packet at 5 to 225 wavelengths (FFT,
|
|
17
|
+
* worst ratio minimised): within 2% for capillary waves up to r = 8.5 mm and gravity waves from r = 6 cm, where κ
|
|
18
|
+
* tends to 1 and 0.9, and 5% from 4 cm. Between, around the slowest group speed (λ = 4.4 cm), a broad band's energy
|
|
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
|
+
*/
|
|
21
|
+
export const WATER_PARTICLE_STRETCH: number[];
|
|
22
|
+
/**
|
|
23
|
+
* The physics of one wave particle as pure functions (WATER_SURFACE_SIMULATION_PLAN_2026_10_06.md §5).
|
|
24
|
+
*
|
|
25
|
+
* A particle of radius r carries a packet of wavelength 2r, k = π/r. Under the gravity–capillary
|
|
26
|
+
* dispersion relation the packet's envelope travels at the group speed and its crests at the phase speed
|
|
27
|
+
* (Jeschke & Wojtan 2017; Xue et al. 2025 give wave particles their own wavelength's dispersion). The packet holds a
|
|
28
|
+
* band of wavelengths around 2r, which the same relation moves apart: its envelope, two radii either side when emitted,
|
|
29
|
+
* stretches as it travels and its height falls to keep its energy (WATER_PARTICLE_STRETCH), as a splash's single ring
|
|
30
|
+
* becomes a widening train of ripples. It loses amplitude at the clean-surface viscous rate 2νk² plus the surface-film
|
|
31
|
+
* rate k√(νω)/(2√2) of natural water — so a raindrop's ripple is gone in a fraction of a second while a big splash
|
|
32
|
+
* crosses a bay.
|
|
33
|
+
*
|
|
34
|
+
* The particles of a front are β apart in angle around its centre, and a packet's crests are arcs around that
|
|
35
|
+
* centre; a cosine window of half-angle β is a partition of unity over them at every radius, so the front's
|
|
36
|
+
* 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.
|
|
38
|
+
*
|
|
39
|
+
* @type {CodeChunk}
|
|
40
|
+
*/
|
|
41
|
+
export const chunk_water_particle: CodeChunk;
|
|
42
|
+
import { CodeChunk } from "../../../shader/compiler/CodeChunk.js";
|
|
43
|
+
//# sourceMappingURL=chunk_water_particle.d.ts.map
|
|
@@ -0,0 +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"}
|