@woosh/meep-engine 3.43.0 → 3.44.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/editor/prototypeEditorShell.d.ts.map +1 -1
- package/editor/prototypeEditorShell.js +4 -2
- package/package.json +1 -1
- package/src/engine/Clock.d.ts +15 -0
- package/src/engine/Clock.d.ts.map +1 -1
- package/src/engine/Clock.js +29 -5
- package/src/engine/Engine.d.ts.map +1 -1
- package/src/engine/Engine.js +11 -19
- package/src/engine/graphics/ecs/mesh-v2/MeshSkin.d.ts +57 -0
- package/src/engine/graphics/ecs/mesh-v2/MeshSkin.d.ts.map +1 -0
- package/src/engine/graphics/ecs/mesh-v2/MeshSkin.js +84 -0
- package/src/engine/graphics3/AnimationGraphSystem.d.ts +23 -13
- package/src/engine/graphics3/AnimationGraphSystem.d.ts.map +1 -1
- package/src/engine/graphics3/AnimationGraphSystem.js +61 -64
- package/src/engine/graphics3/AnimationSystem.d.ts +24 -15
- package/src/engine/graphics3/AnimationSystem.d.ts.map +1 -1
- package/src/engine/graphics3/AnimationSystem.js +67 -61
- package/src/engine/graphics3/MeshSkinSystem.d.ts +56 -0
- package/src/engine/graphics3/MeshSkinSystem.d.ts.map +1 -0
- package/src/engine/graphics3/MeshSkinSystem.js +317 -0
- package/src/engine/graphics3/MeshSystem.d.ts +15 -35
- package/src/engine/graphics3/MeshSystem.d.ts.map +1 -1
- package/src/engine/graphics3/MeshSystem.js +21 -298
- package/src/engine/graphics3/RowChains.d.ts +76 -0
- package/src/engine/graphics3/RowChains.d.ts.map +1 -0
- package/src/engine/graphics3/RowChains.js +347 -0
- package/src/engine/graphics3/ShadedGeometrySystem.d.ts +6 -0
- package/src/engine/graphics3/ShadedGeometrySystem.d.ts.map +1 -1
- package/src/engine/graphics3/ShadedGeometrySystem.js +329 -309
- package/src/engine/graphics3/animation/AnimationClips.d.ts +56 -0
- package/src/engine/graphics3/animation/AnimationClips.d.ts.map +1 -0
- package/src/engine/graphics3/animation/AnimationClips.js +79 -0
- package/src/engine/graphics3/animation/ClipListPlayer.d.ts +13 -14
- package/src/engine/graphics3/animation/ClipListPlayer.d.ts.map +1 -1
- package/src/engine/graphics3/animation/ClipListPlayer.js +262 -263
- package/src/engine/graphics3/animation/write_clip_playback.d.ts +3 -3
- package/src/engine/graphics3/animation/write_clip_playback.js +4 -4
- package/src/engine/graphics3/pose/query_entity_node_world_pose.d.ts +5 -0
- package/src/engine/graphics3/pose/query_entity_node_world_pose.d.ts.map +1 -1
- package/src/engine/graphics3/pose/query_entity_node_world_pose.js +80 -75
- package/src/engine/graphics3/prefab/PrefabInstance.d.ts +4 -24
- package/src/engine/graphics3/prefab/PrefabInstance.d.ts.map +1 -1
- package/src/engine/graphics3/prefab/PrefabInstance.js +60 -80
- package/src/engine/graphics3/prefab/prefab_instantiate.d.ts +16 -3
- package/src/engine/graphics3/prefab/prefab_instantiate.d.ts.map +1 -1
- package/src/engine/graphics3/prefab/prefab_instantiate.js +49 -12
- package/src/engine/graphics3/prefab/prefab_place.d.ts +31 -17
- package/src/engine/graphics3/prefab/prefab_place.d.ts.map +1 -1
- package/src/engine/graphics3/prefab/prefab_place.js +175 -130
- package/src/engine/graphics3/register_clips.d.ts +64 -0
- package/src/engine/graphics3/register_clips.d.ts.map +1 -0
- package/src/engine/graphics3/register_clips.js +114 -0
- package/src/engine/physics/cloth/MEASUREMENTS.md +795 -0
- package/src/engine/physics/cloth/PLAN.md +339 -9
- package/src/engine/physics/cloth/build/ClothProxy.d.ts +113 -61
- package/src/engine/physics/cloth/build/ClothProxy.d.ts.map +1 -1
- package/src/engine/physics/cloth/build/ClothProxy.js +142 -77
- package/src/engine/physics/cloth/build/cloth_bind_in_frame.d.ts +22 -0
- package/src/engine/physics/cloth/build/cloth_bind_in_frame.d.ts.map +1 -0
- package/src/engine/physics/cloth/build/cloth_bind_in_frame.js +75 -0
- package/src/engine/physics/cloth/build/cloth_proxy_from_joints.d.ts +43 -30
- package/src/engine/physics/cloth/build/cloth_proxy_from_joints.d.ts.map +1 -1
- package/src/engine/physics/cloth/build/cloth_proxy_from_joints.js +357 -284
- package/src/engine/physics/cloth/build/cloth_proxy_from_mesh.d.ts +62 -0
- package/src/engine/physics/cloth/build/cloth_proxy_from_mesh.d.ts.map +1 -0
- package/src/engine/physics/cloth/build/cloth_proxy_from_mesh.js +280 -0
- package/src/engine/physics/cloth/collider/cloth_collider_sdf.d.ts +1 -1
- package/src/engine/physics/cloth/collider/cloth_collider_sdf.js +1 -1
- package/src/engine/physics/cloth/ecs/Cloth.d.ts +17 -9
- package/src/engine/physics/cloth/ecs/Cloth.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/Cloth.js +220 -212
- package/src/engine/physics/cloth/ecs/ClothDynamicsFlags.js +6 -0
- package/src/engine/physics/cloth/ecs/ClothHold.d.ts +91 -0
- package/src/engine/physics/cloth/ecs/ClothHold.d.ts.map +1 -0
- package/src/engine/physics/cloth/ecs/ClothHold.js +103 -0
- package/src/engine/physics/cloth/ecs/ClothInstance.d.ts +254 -48
- package/src/engine/physics/cloth/ecs/ClothInstance.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/ClothInstance.js +277 -47
- package/src/engine/physics/cloth/ecs/ClothPin.d.ts +73 -0
- package/src/engine/physics/cloth/ecs/ClothPin.d.ts.map +1 -0
- package/src/engine/physics/cloth/ecs/ClothPin.js +92 -0
- package/src/engine/physics/cloth/ecs/ClothPinSerializationAdapter.d.ts +36 -0
- package/src/engine/physics/cloth/ecs/ClothPinSerializationAdapter.d.ts.map +1 -0
- package/src/engine/physics/cloth/ecs/ClothPinSerializationAdapter.js +61 -0
- package/src/engine/physics/cloth/ecs/ClothRig.d.ts +23 -17
- package/src/engine/physics/cloth/ecs/ClothRig.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/ClothRig.js +29 -27
- package/src/engine/physics/cloth/ecs/ClothSystem.d.ts +12 -14
- package/src/engine/physics/cloth/ecs/ClothSystem.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/ClothSystem.js +20 -15
- package/src/engine/physics/cloth/ecs/ClothWorld.d.ts +57 -36
- package/src/engine/physics/cloth/ecs/ClothWorld.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/ClothWorld.js +816 -179
- package/src/engine/physics/cloth/ecs/WorkerClothSystem.d.ts +12 -13
- package/src/engine/physics/cloth/ecs/WorkerClothSystem.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/WorkerClothSystem.js +20 -14
- package/src/engine/physics/cloth/ecs/cloth_build_rows.d.ts +63 -11
- package/src/engine/physics/cloth/ecs/cloth_build_rows.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/cloth_build_rows.js +321 -84
- package/src/engine/physics/cloth/ecs/cloth_dynamics_map.d.ts +9 -7
- package/src/engine/physics/cloth/ecs/cloth_dynamics_map.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/cloth_dynamics_map.js +9 -7
- package/src/engine/physics/cloth/ecs/cloth_gather_colliders.d.ts +3 -3
- package/src/engine/physics/cloth/ecs/cloth_gather_colliders.js +30 -30
- package/src/engine/physics/cloth/ecs/cloth_geodesic.d.ts +37 -0
- package/src/engine/physics/cloth/ecs/cloth_geodesic.d.ts.map +1 -0
- package/src/engine/physics/cloth/ecs/cloth_geodesic.js +142 -0
- package/src/engine/physics/cloth/ecs/cloth_holds.d.ts +97 -0
- package/src/engine/physics/cloth/ecs/cloth_holds.d.ts.map +1 -0
- package/src/engine/physics/cloth/ecs/cloth_holds.js +608 -0
- package/src/engine/physics/cloth/ecs/cloth_reconstruct_pose.d.ts +2 -2
- package/src/engine/physics/cloth/ecs/cloth_reconstruct_pose.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/cloth_reconstruct_pose.js +160 -9
- package/src/engine/physics/cloth/ecs/cloth_seed_rig.d.ts +17 -22
- package/src/engine/physics/cloth/ecs/cloth_seed_rig.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/cloth_seed_rig.js +55 -117
- package/src/engine/physics/cloth/ecs/cloth_seed_subtree.d.ts +21 -6
- package/src/engine/physics/cloth/ecs/cloth_seed_subtree.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/cloth_seed_subtree.js +44 -15
- package/src/engine/physics/cloth/ecs/cloth_write_back.d.ts +5 -0
- package/src/engine/physics/cloth/ecs/cloth_write_back.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/cloth_write_back.js +60 -16
- package/src/engine/physics/cloth/ecs/cloth_write_back_rig.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/cloth_write_back_rig.js +65 -58
- package/src/engine/physics/cloth/playground/collide_main.js +1 -1
- package/src/engine/physics/cloth/playground/garment_build.d.ts.map +1 -1
- package/src/engine/physics/cloth/playground/garment_build.js +17 -5
- package/src/engine/physics/cloth/playground/garment_main.js +1 -1
- package/src/engine/physics/cloth/playground/rig_build.d.ts.map +1 -1
- package/src/engine/physics/cloth/playground/rig_build.js +302 -296
- package/src/engine/physics/cloth/solver/ClothState.d.ts +45 -7
- package/src/engine/physics/cloth/solver/ClothState.d.ts.map +1 -1
- package/src/engine/physics/cloth/solver/ClothState.js +63 -7
- package/src/engine/physics/cloth/solver/cloth_contact_find.d.ts +6 -1
- package/src/engine/physics/cloth/solver/cloth_contact_find.d.ts.map +1 -1
- package/src/engine/physics/cloth/solver/cloth_contact_find.js +7 -2
- package/src/engine/physics/cloth/solver/cloth_hold_line.d.ts +114 -0
- package/src/engine/physics/cloth/solver/cloth_hold_line.d.ts.map +1 -0
- package/src/engine/physics/cloth/solver/cloth_hold_line.js +362 -0
- package/src/engine/physics/cloth/solver/cloth_self_find.d.ts +6 -2
- package/src/engine/physics/cloth/solver/cloth_self_find.d.ts.map +1 -1
- package/src/engine/physics/cloth/solver/cloth_self_find.js +13 -13
- package/src/engine/physics/cloth/solver/cloth_solver_constants.d.ts +24 -12
- package/src/engine/physics/cloth/solver/cloth_solver_constants.d.ts.map +1 -1
- package/src/engine/physics/cloth/solver/cloth_solver_constants.js +24 -12
- package/src/engine/physics/cloth/solver/cloth_step.d.ts +16 -0
- package/src/engine/physics/cloth/solver/cloth_step.d.ts.map +1 -1
- package/src/engine/physics/cloth/solver/cloth_step.js +183 -20
- package/src/engine/physics/cloth/solver/cloth_step_instance.d.ts +1 -0
- package/src/engine/physics/cloth/solver/cloth_step_instance.d.ts.map +1 -1
- package/src/engine/physics/cloth/solver/cloth_step_instance.js +10 -3
- package/src/engine/physics/cloth/solver/constraint/cloth_leash_row.d.ts +1 -1
- package/src/engine/physics/cloth/solver/constraint/cloth_leash_row.d.ts.map +1 -1
- package/src/engine/physics/cloth/solver/constraint/cloth_leash_row.js +353 -346
- package/src/engine/physics/cloth/solver/constraint/cloth_self_row.d.ts +7 -5
- package/src/engine/physics/cloth/solver/constraint/cloth_self_row.d.ts.map +1 -1
- package/src/engine/physics/cloth/solver/constraint/cloth_self_row.js +7 -5
- package/src/engine/physics/cloth/wind/cloth_sample_air.d.ts +9 -9
- package/src/engine/physics/cloth/wind/cloth_sample_air.d.ts.map +1 -1
- package/src/engine/physics/cloth/wind/cloth_sample_air.js +26 -26
- package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
- package/src/engine/simulation/Ticker.d.ts +13 -0
- package/src/engine/simulation/Ticker.d.ts.map +1 -1
- package/src/engine/simulation/Ticker.js +43 -8
- package/src/shade/RENDERER_CONTRACT.md +8 -2
- package/src/shade/playground/mesh_row_ceiling/main.js +2 -1
- package/src/shade/playground/skinned_blas_refit/main.d.ts.map +1 -1
- package/src/shade/playground/skinned_blas_refit/main.js +11 -19
- package/src/shade/playground/skinned_blas_refit/place_character.d.ts +6 -3
- package/src/shade/playground/skinned_blas_refit/place_character.d.ts.map +1 -1
- package/src/shade/playground/skinned_blas_refit/place_character.js +90 -90
- package/src/shade/playground/skinned_mesh_soup/main.d.ts.map +1 -1
- package/src/shade/playground/skinned_mesh_soup/main.js +502 -509
- package/src/shade/playground/texture_encode/README.md +129 -109
- package/src/shade/playground/texture_encode/main.js +1430 -1430
- package/src/shade/renderer/animation/GPUAnimationManager.d.ts +45 -14
- package/src/shade/renderer/animation/GPUAnimationManager.d.ts.map +1 -1
- package/src/shade/renderer/animation/GPUAnimationManager.js +316 -64
- package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.d.ts +5 -0
- package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.d.ts.map +1 -1
- package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.js +11 -1
- package/src/shade/renderer/geometry/BoxGeometry.d.ts +1 -11
- package/src/shade/renderer/geometry/BoxGeometry.d.ts.map +1 -1
- package/src/shade/renderer/geometry/BoxGeometry.js +6 -13
- package/src/shade/renderer/geometry/CapsuleGeometry.d.ts +19 -0
- package/src/shade/renderer/geometry/CapsuleGeometry.d.ts.map +1 -0
- package/src/shade/renderer/geometry/CapsuleGeometry.js +24 -0
- package/src/shade/renderer/geometry/ConeGeometry.d.ts +20 -0
- package/src/shade/renderer/geometry/ConeGeometry.d.ts.map +1 -0
- package/src/shade/renderer/geometry/ConeGeometry.js +33 -0
- package/src/shade/renderer/geometry/CylinderGeometry.d.ts +21 -0
- package/src/shade/renderer/geometry/CylinderGeometry.d.ts.map +1 -0
- package/src/shade/renderer/geometry/CylinderGeometry.js +35 -0
- package/src/shade/renderer/geometry/PlaneGeometry.d.ts +17 -0
- package/src/shade/renderer/geometry/PlaneGeometry.d.ts.map +1 -0
- package/src/shade/renderer/geometry/PlaneGeometry.js +22 -0
- package/src/shade/renderer/geometry/TorusGeometry.d.ts +18 -0
- package/src/shade/renderer/geometry/TorusGeometry.d.ts.map +1 -0
- package/src/shade/renderer/geometry/TorusGeometry.js +23 -0
- package/src/shade/renderer/geometry/UVSphereGeometry.d.ts +21 -0
- package/src/shade/renderer/geometry/UVSphereGeometry.d.ts.map +1 -0
- package/src/shade/renderer/geometry/UVSphereGeometry.js +34 -0
- package/src/shade/renderer/geometry/primitives/make_capsule_geometry.d.ts +19 -0
- package/src/shade/renderer/geometry/primitives/make_capsule_geometry.d.ts.map +1 -0
- package/src/shade/renderer/geometry/primitives/make_capsule_geometry.js +205 -0
- package/src/shade/renderer/geometry/primitives/make_cone_geometry.d.ts +21 -0
- package/src/shade/renderer/geometry/primitives/make_cone_geometry.d.ts.map +1 -0
- package/src/shade/renderer/geometry/primitives/make_cone_geometry.js +36 -0
- package/src/shade/renderer/geometry/primitives/make_cylinder_geometry.d.ts +1 -1
- package/src/shade/renderer/geometry/primitives/make_cylinder_geometry.d.ts.map +1 -1
- package/src/shade/renderer/geometry/primitives/make_cylinder_geometry.js +44 -9
- package/src/shade/renderer/geometry/primitives/make_uv_sphere_geometry.d.ts +20 -0
- package/src/shade/renderer/geometry/primitives/make_uv_sphere_geometry.d.ts.map +1 -0
- package/src/shade/renderer/geometry/primitives/make_uv_sphere_geometry.js +190 -0
- package/src/shade/renderer/geometry/virtual/runtime/graph_vgeo_expand_instances_to_meshlets.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/runtime/graph_vgeo_expand_instances_to_meshlets.js +7 -2
- package/src/shade/renderer/gpu_primitive/prefix_sum/v1/graph_prefix_scan_csdldf.d.ts +26 -8
- package/src/shade/renderer/gpu_primitive/prefix_sum/v1/graph_prefix_scan_csdldf.d.ts.map +1 -1
- package/src/shade/renderer/gpu_primitive/prefix_sum/v1/graph_prefix_scan_csdldf.js +56 -39
- package/src/shade/renderer/gpu_primitive/prefix_sum/v1/shader_prefix_scan_csdldf.d.ts +7 -0
- package/src/shade/renderer/gpu_primitive/prefix_sum/v1/shader_prefix_scan_csdldf.d.ts.map +1 -1
- package/src/shade/renderer/gpu_primitive/prefix_sum/v1/shader_prefix_scan_csdldf.js +46 -4
- package/src/shade/renderer/gpu_primitive/prefix_sum/v1/test_prefix_sum.d.ts.map +1 -1
- package/src/shade/renderer/gpu_primitive/prefix_sum/v1/test_prefix_sum.js +4 -2
- package/src/shade/renderer/gpu_primitive/sort/defs.d.ts +2 -2
- package/src/shade/renderer/gpu_primitive/sort/defs.js +79 -79
- package/src/shade/renderer/gpu_primitive/sort/graph_radix_sort.d.ts +1 -1
- package/src/shade/renderer/gpu_primitive/sort/graph_radix_sort.d.ts.map +1 -1
- package/src/shade/renderer/gpu_primitive/sort/graph_radix_sort.js +7 -3
- package/src/shade/renderer/particles/GPUParticleSystem.js +1 -1
- package/src/shade/renderer/particles/coherence/graph_particle_bucket.d.ts +4 -3
- package/src/shade/renderer/particles/coherence/graph_particle_bucket.d.ts.map +1 -1
- package/src/shade/renderer/particles/coherence/graph_particle_bucket.js +200 -194
- package/src/shade/renderer/particles/graph_particles.d.ts.map +1 -1
- package/src/shade/renderer/particles/graph_particles.js +6 -2
- package/src/shade/renderer/particles/warmup/graph_particle_warmup.d.ts.map +1 -1
- package/src/shade/renderer/particles/warmup/graph_particle_warmup.js +334 -329
- package/src/shade/renderer/rasterize/bucket/prepare_meshlet_draw_commands_by_material.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/bucket/prepare_meshlet_draw_commands_by_material.js +7 -2
- package/src/shade/renderer/rasterize/expand/mesh/graph_expand_meshes_to_meshlets.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/expand/mesh/graph_expand_meshes_to_meshlets.js +16 -4
- package/src/shade/renderer/texture/COMPRESSED_TEXTURE_PLAN_2026_09_01.md +2444 -2345
- package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4_rgb.d.ts.map +1 -1
- package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4_rgb.js +312 -310
- package/src/shade/renderer/texture/encode/chunk_bc1_encode_block.d.ts +3 -3
- package/src/shade/renderer/texture/encode/chunk_bc1_encode_block.d.ts.map +1 -1
- package/src/shade/renderer/texture/encode/chunk_bc1_encode_block.js +383 -375
- package/src/shade/renderer/texture/encode/chunk_bc6h_encode_block_mode11.d.ts.map +1 -1
- package/src/shade/renderer/texture/encode/chunk_bc6h_encode_block_mode11.js +349 -346
- package/src/shade/renderer/texture/encode/chunk_bc7_encode_block.d.ts +58 -0
- package/src/shade/renderer/texture/encode/chunk_bc7_encode_block.d.ts.map +1 -0
- package/src/shade/renderer/texture/encode/chunk_bc7_encode_block.js +536 -0
- package/src/shade/renderer/texture/encode/chunk_bc7_encode_block_mode6.d.ts +21 -7
- package/src/shade/renderer/texture/encode/chunk_bc7_encode_block_mode6.d.ts.map +1 -1
- package/src/shade/renderer/texture/encode/chunk_bc7_encode_block_mode6.js +291 -327
- package/src/shade/renderer/texture/encode/chunk_bc7_pack_mode1.d.ts +25 -0
- package/src/shade/renderer/texture/encode/chunk_bc7_pack_mode1.d.ts.map +1 -0
- package/src/shade/renderer/texture/encode/chunk_bc7_pack_mode1.js +99 -0
- package/src/shade/renderer/texture/encode/chunk_bc7_pack_mode6.d.ts +5 -3
- package/src/shade/renderer/texture/encode/chunk_bc7_pack_mode6.d.ts.map +1 -1
- package/src/shade/renderer/texture/encode/chunk_bc7_pack_mode6.js +47 -71
- package/src/shade/renderer/texture/encode/chunk_bc7_partition_2.d.ts +10 -0
- package/src/shade/renderer/texture/encode/chunk_bc7_partition_2.d.ts.map +1 -0
- package/src/shade/renderer/texture/encode/chunk_bc7_partition_2.js +50 -0
- package/src/shade/renderer/texture/encode/shader_texture_encode_bc7.d.ts +4 -5
- package/src/shade/renderer/texture/encode/shader_texture_encode_bc7.d.ts.map +1 -1
- package/src/shade/renderer/texture/encode/shader_texture_encode_bc7.js +7 -8
- package/src/shade/renderer/water/chunk_water_transport.d.ts.map +1 -1
- package/src/shade/renderer/water/chunk_water_transport.js +7 -5
- package/src/shade/renderer/water/medium/GPUWaterBodies.d.ts.map +1 -1
- package/src/shade/renderer/water/medium/GPUWaterBodies.js +8 -2
- package/src/shade/renderer/water/optics/chunk_water_receiver_downwelling.d.ts +3 -2
- package/src/shade/renderer/water/optics/chunk_water_receiver_downwelling.d.ts.map +1 -1
- package/src/shade/renderer/water/optics/chunk_water_receiver_downwelling.js +3 -2
- package/src/shade/renderer/water/shader_water.d.ts.map +1 -1
- package/src/shade/renderer/water/shader_water.js +3 -1
- package/src/shade/renderer/water/surface/GPUWaterSurface.d.ts.map +1 -1
- package/src/shade/renderer/water/surface/GPUWaterSurface.js +3 -1
- package/src/shade/renderer/water/surface/graph_water_tessellation.d.ts.map +1 -1
- package/src/shade/renderer/water/surface/graph_water_tessellation.js +11 -4
- package/src/shade/renderer/water/surface/particles/GPUWaterParticles.d.ts.map +1 -1
- package/src/shade/renderer/water/surface/particles/GPUWaterParticles.js +37 -20
- package/src/shade/wgsl/validate_wgsl_source.d.ts.map +1 -1
- package/src/shade/wgsl/validate_wgsl_source.js +74 -3
- package/src/engine/graphics3/register_instance_animation.d.ts +0 -114
- package/src/engine/graphics3/register_instance_animation.d.ts.map +0 -1
- package/src/engine/graphics3/register_instance_animation.js +0 -201
|
@@ -1,329 +1,334 @@
|
|
|
1
|
-
import { assert } from "../../../../core/assert.js";
|
|
2
|
-
import { align_4 } from "../../../../core/binary/align_4.js";
|
|
3
|
-
import { BufferResourceDescriptor } from "../../../device/graph/BufferResourceDescriptor.js";
|
|
4
|
-
import { INDIRECT_COMPUTE_COMMAND_DESCRIPTOR } from "../../gpu_primitive/indirect/IndirectComputeCommandBuildPass.js";
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
* main pool
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
* @param {
|
|
83
|
-
* @param {
|
|
84
|
-
* @param {number} params.
|
|
85
|
-
* @param {number} params.
|
|
86
|
-
* @param {number} params.
|
|
87
|
-
* @param {number} params.
|
|
88
|
-
* @param {number} params.
|
|
89
|
-
*
|
|
90
|
-
* @param {
|
|
91
|
-
* @param {number} params.
|
|
92
|
-
*
|
|
93
|
-
* @param {
|
|
94
|
-
* @param {number} params.
|
|
95
|
-
* @param {
|
|
96
|
-
* @param {
|
|
97
|
-
* @param {
|
|
98
|
-
* @param {
|
|
99
|
-
* @param {
|
|
100
|
-
* @
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
assert.
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
const
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
//
|
|
135
|
-
//
|
|
136
|
-
//
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
));
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
//
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
//
|
|
175
|
-
const
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
1
|
+
import { assert } from "../../../../core/assert.js";
|
|
2
|
+
import { align_4 } from "../../../../core/binary/align_4.js";
|
|
3
|
+
import { BufferResourceDescriptor } from "../../../device/graph/BufferResourceDescriptor.js";
|
|
4
|
+
import { INDIRECT_COMPUTE_COMMAND_DESCRIPTOR } from "../../gpu_primitive/indirect/IndirectComputeCommandBuildPass.js";
|
|
5
|
+
import {
|
|
6
|
+
graph_prefix_scan_csdldf,
|
|
7
|
+
prefix_scan_csdldf_output_descriptor
|
|
8
|
+
} from "../../gpu_primitive/prefix_sum/v1/graph_prefix_scan_csdldf.js";
|
|
9
|
+
import { PREFIX_SCAN_CSDLDF_HEADER_WORDS } from "../../gpu_primitive/prefix_sum/v1/shader_prefix_scan_csdldf.js";
|
|
10
|
+
import { shader_prefix_sum_to_command } from "../../rasterize/expand/mesh/shader_prefix_sum_to_command.js";
|
|
11
|
+
import { graph_compute_indirect_pass } from "../../shader/graph/compute/graph_compute_indirect_pass.js";
|
|
12
|
+
import { graph_compute_pass } from "../../shader/graph/compute/graph_compute_pass.js";
|
|
13
|
+
import { graph_create_buffer } from "../../shader/graph/graph_create_buffer.js";
|
|
14
|
+
import { graph_import_buffer } from "../../shader/graph/graph_import_buffer.js";
|
|
15
|
+
import { PARTICLE_RECORD_WORD_COUNT, PARTICLE_WARMUP_WORKGROUP_SIZE } from "../ParticleConstants.js";
|
|
16
|
+
import { PARTICLE_COUNTER_COUNT } from "../data/PARTICLE_COUNTERS.js";
|
|
17
|
+
import { shader_particle_emit } from "../shaders/shader_particle_emit.js";
|
|
18
|
+
import {
|
|
19
|
+
PARTICLE_EMIT_WIDE_WORKGROUP_COUNT,
|
|
20
|
+
shader_particle_emit_wide,
|
|
21
|
+
} from "../shaders/shader_particle_emit_wide.js";
|
|
22
|
+
import {
|
|
23
|
+
PARTICLE_WARMUP_WORKGROUP_COUNT,
|
|
24
|
+
shader_particle_warmup_init,
|
|
25
|
+
shader_particle_warmup_migrate,
|
|
26
|
+
shader_particle_warmup_reset,
|
|
27
|
+
shader_particle_warmup_tick,
|
|
28
|
+
} from "./shader_particle_warmup.js";
|
|
29
|
+
import { shader_particle_warmup_advance } from "./shader_particle_warmup_advance.js";
|
|
30
|
+
import { shader_particle_warmup_advance_wide } from "./shader_particle_warmup_advance_wide.js";
|
|
31
|
+
import { warmup_remaining } from "./warmup_schedule.js";
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Run a batch of newly added emitters' simulations forward before they are first shown, so that a
|
|
35
|
+
* continuous effect arrives at its steady state instead of growing into it in front of the player.
|
|
36
|
+
*
|
|
37
|
+
* ## What a warm-up is
|
|
38
|
+
*
|
|
39
|
+
* The ordinary loop — spawn, init, advance — run over a population of its own until every emitter
|
|
40
|
+
* in the batch has been running for its `prewarm`. It is not a batch of particles dumped in one
|
|
41
|
+
* tick and aged: an emitter keeps spawning throughout, the ones that die are replaced the way they
|
|
42
|
+
* are in a live scene, and whatever drives the rate (a curve, `EMITTER_AGE`, the program itself)
|
|
43
|
+
* drives it here, because it is the same program being run. What the loop leaves is the population
|
|
44
|
+
* the emitter would have had, moved into the main pool.
|
|
45
|
+
*
|
|
46
|
+
* ## Why it is a pipeline of its own
|
|
47
|
+
*
|
|
48
|
+
* Because the main one is tuned and it must not pay for this. Emit and simulate are the passes whose
|
|
49
|
+
* register pressure sets the system's occupancy, and their waves are kept program-uniform by the
|
|
50
|
+
* bucketing; a warm-up folded into either would spend registers on every frame for work that
|
|
51
|
+
* happens on one, and a loop inside a lane would break the uniform flow across a wave. So this
|
|
52
|
+
* shares code with the main frame and integrates nothing into it: the emit pass is reused unchanged
|
|
53
|
+
* over the warm-up's buffers, the advance is a pass of the warm-up's own (`./chunk_particle_warmup_step.js`
|
|
54
|
+
* says why), and the main passes' compiled code is byte-identical whether this file exists or not.
|
|
55
|
+
*
|
|
56
|
+
* ## The population is transient
|
|
57
|
+
*
|
|
58
|
+
* Pool, alive lists, free list and counters are graph transients that exist for this frame's loop
|
|
59
|
+
* and are then moved — record by record — into the main pool by the migrate pass. That is what keeps
|
|
60
|
+
* the separation clean: the loop's free-list traffic never touches the main free list, the main
|
|
61
|
+
* passes never see a half-warmed particle, and the one point of contact is a pass that pops from the
|
|
62
|
+
* main pool and pushes nothing back.
|
|
63
|
+
*
|
|
64
|
+
* ## Bounded
|
|
65
|
+
*
|
|
66
|
+
* The tick count is at most `PARTICLE_WARMUP_MAX_TICKS`, with the tick length stretched to cover the
|
|
67
|
+
* longest pre-warm in the batch (`./warmup_schedule.js`), so the frame that pays for a warm-up pays
|
|
68
|
+
* for a known number of dispatches whatever was asked. Per tick: reset, tick, the scan, the emit
|
|
69
|
+
* command, emit, advance — six or seven passes, all sized by constants or by the scan.
|
|
70
|
+
*
|
|
71
|
+
* ## Where it sits in the frame
|
|
72
|
+
*
|
|
73
|
+
* After the frame's own emit and simulate, before the bucketing. Migrate appends to the same alive
|
|
74
|
+
* list they did, so the bucketing puts the warmed particles in next frame's simulate list, the bounds
|
|
75
|
+
* pass measures them into their emitter's box this frame, and the draw draws them this frame. Which
|
|
76
|
+
* is also what closes the culling fixed point the bounds passes describe: an emitter that arrives
|
|
77
|
+
* with a warmed population is measured on its first frame, whatever the frustum thinks of its origin.
|
|
78
|
+
*
|
|
79
|
+
* Recorded only on a frame with something queued. The host knows: an emitter is queued when it is
|
|
80
|
+
* registered with a `prewarm`, and the queue is consumed by the frame that records it.
|
|
81
|
+
*
|
|
82
|
+
* @param {object} params
|
|
83
|
+
* @param {import("../../../../engine/graphics/render/frame_graph/FrameGraph.js").FrameGraph} params.graph
|
|
84
|
+
* @param {number} params.scene_database graph handle
|
|
85
|
+
* @param {number} params.emitter_database graph handle, threaded: the warm-up tick writes ages
|
|
86
|
+
* @param {number} params.program graph handle of the packed program buffer
|
|
87
|
+
* @param {number} params.pool main pool, threaded
|
|
88
|
+
* @param {number} params.alive_out main alive list, threaded
|
|
89
|
+
* @param {number} params.dead main free list, threaded
|
|
90
|
+
* @param {number} params.counters main counters, threaded
|
|
91
|
+
* @param {number} params.vm_registers the wide register file's handle, or -1 when the system is on
|
|
92
|
+
* the fast file
|
|
93
|
+
* @param {GPUBuffer} params.queue the host's queue buffer, `PARTICLE_WARMUP_QUEUE_WORDS` per entry
|
|
94
|
+
* @param {number} params.queue_count entries in the queue
|
|
95
|
+
* @param {number} params.warm_capacity slots in the transient pool
|
|
96
|
+
* @param {number} params.capacity main pool capacity
|
|
97
|
+
* @param {number} params.emitter_capacity element capacity of the emitter table
|
|
98
|
+
* @param {import("./warmup_schedule.js").WarmupSchedule} params.schedule
|
|
99
|
+
* @param {boolean} params.wide_registers
|
|
100
|
+
* @param {object} params.frame
|
|
101
|
+
* @param {number} params.frame.time the frame's clock — the loop counts down to it
|
|
102
|
+
* @param {number} params.frame.index
|
|
103
|
+
* @returns {{pool: number, alive_out: number, dead: number, counters: number, emitter_database: number, vm_registers: number}}
|
|
104
|
+
*/
|
|
105
|
+
export function graph_particle_warmup({
|
|
106
|
+
graph,
|
|
107
|
+
scene_database,
|
|
108
|
+
emitter_database,
|
|
109
|
+
program,
|
|
110
|
+
pool,
|
|
111
|
+
alive_out,
|
|
112
|
+
dead,
|
|
113
|
+
counters,
|
|
114
|
+
vm_registers,
|
|
115
|
+
queue,
|
|
116
|
+
queue_count,
|
|
117
|
+
warm_capacity,
|
|
118
|
+
capacity,
|
|
119
|
+
emitter_capacity,
|
|
120
|
+
schedule,
|
|
121
|
+
wide_registers,
|
|
122
|
+
frame,
|
|
123
|
+
}) {
|
|
124
|
+
assert.defined(graph, "graph");
|
|
125
|
+
assert.isPositiveInteger(queue_count, "queue_count");
|
|
126
|
+
assert.isPositiveInteger(warm_capacity, "warm_capacity");
|
|
127
|
+
assert.isPositiveInteger(schedule.ticks, "schedule.ticks");
|
|
128
|
+
|
|
129
|
+
const WORD = Uint32Array.BYTES_PER_ELEMENT;
|
|
130
|
+
const STORAGE = GPUBufferUsage.STORAGE;
|
|
131
|
+
|
|
132
|
+
const gr_queue = graph_import_buffer(graph, queue, "particles/warmup/queue");
|
|
133
|
+
|
|
134
|
+
// The transient population. Uncleared where the init pass writes every word that will be read
|
|
135
|
+
// (the free list), cleared where a word could be read before it is written (the counters, and
|
|
136
|
+
// the alive lists' tails are bounded by counts the passes wrote).
|
|
137
|
+
// Threaded like everything a pass writes: emit and advance both rename it, and the next reader
|
|
138
|
+
// must take the renamed handle or the graph's validator rejects the frame as reading a stale
|
|
139
|
+
// version.
|
|
140
|
+
let warm_pool = graph_create_buffer(graph, "particles/warmup/pool", BufferResourceDescriptor.from(
|
|
141
|
+
warm_capacity * PARTICLE_RECORD_WORD_COUNT * WORD, STORAGE,
|
|
142
|
+
));
|
|
143
|
+
const warm_alive = [
|
|
144
|
+
graph_create_buffer(graph, "particles/warmup/alive_a", BufferResourceDescriptor.from(warm_capacity * WORD, STORAGE)),
|
|
145
|
+
graph_create_buffer(graph, "particles/warmup/alive_b", BufferResourceDescriptor.from(warm_capacity * WORD, STORAGE)),
|
|
146
|
+
];
|
|
147
|
+
let warm_dead = graph_create_buffer(graph, "particles/warmup/dead", BufferResourceDescriptor.from(warm_capacity * WORD, STORAGE));
|
|
148
|
+
let warm_counters = graph_create_buffer(graph, "particles/warmup/counters", BufferResourceDescriptor.empty(
|
|
149
|
+
PARTICLE_COUNTER_COUNT * WORD, STORAGE | GPUBufferUsage.COPY_DST,
|
|
150
|
+
));
|
|
151
|
+
|
|
152
|
+
// Every slot onto the free list.
|
|
153
|
+
{
|
|
154
|
+
const out = graph_compute_pass({
|
|
155
|
+
graph,
|
|
156
|
+
shader: shader_particle_warmup_init,
|
|
157
|
+
bindings: { dead: warm_dead, counters: warm_counters, u_capacity: warm_capacity },
|
|
158
|
+
group_count: [Math.ceil(warm_capacity / PARTICLE_WARMUP_WORKGROUP_SIZE), 1, 1],
|
|
159
|
+
});
|
|
160
|
+
warm_dead = out.dead;
|
|
161
|
+
warm_counters = out.counters;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
const count_words = PREFIX_SCAN_CSDLDF_HEADER_WORDS + align_4(Math.max(1, emitter_capacity));
|
|
165
|
+
const count_bytes = count_words * WORD;
|
|
166
|
+
|
|
167
|
+
let gr_queue_rw = gr_queue;
|
|
168
|
+
|
|
169
|
+
for (let tick = 0; tick < schedule.ticks; tick++) {
|
|
170
|
+
const remaining = warmup_remaining(schedule, tick);
|
|
171
|
+
// The clock at the start of this tick: the frame's, less what is still to run.
|
|
172
|
+
const time = frame.time - remaining;
|
|
173
|
+
// Distinct per tick, and unlike any frame index the main emit will seed with, so a warmed
|
|
174
|
+
// particle's random stream is not a later particle's in the same slot.
|
|
175
|
+
const frame_index = (frame.index ^ Math.imul(tick + 1, 0x9e3779b9)) >>> 0;
|
|
176
|
+
|
|
177
|
+
// Last tick's survivors are this tick's input; this tick appends to the other list.
|
|
178
|
+
const alive_in = warm_alive[(tick + 1) % 2];
|
|
179
|
+
let alive_this = warm_alive[tick % 2];
|
|
180
|
+
|
|
181
|
+
// 1. Roll the counters: alive -> alive_in, alive = 0, budget = dead.
|
|
182
|
+
warm_counters = graph_compute_pass({
|
|
183
|
+
graph,
|
|
184
|
+
shader: shader_particle_warmup_reset,
|
|
185
|
+
bindings: { counters: warm_counters },
|
|
186
|
+
group_count: [1, 1, 1],
|
|
187
|
+
}).counters;
|
|
188
|
+
|
|
189
|
+
// 2. The spawn decision, per queued emitter, into a count list as long as the emitter table.
|
|
190
|
+
// Cleared whole: the tick writes only the queued rows.
|
|
191
|
+
let spawn_counts = graph_create_buffer(graph, "particles/warmup/spawn_counts", BufferResourceDescriptor.from(
|
|
192
|
+
count_bytes, STORAGE, 0, count_bytes,
|
|
193
|
+
));
|
|
194
|
+
|
|
195
|
+
{
|
|
196
|
+
const out = graph_compute_pass({
|
|
197
|
+
graph,
|
|
198
|
+
shader: shader_particle_warmup_tick,
|
|
199
|
+
bindings: {
|
|
200
|
+
queue: gr_queue_rw,
|
|
201
|
+
emitter_database,
|
|
202
|
+
counters: warm_counters,
|
|
203
|
+
spawn_counts,
|
|
204
|
+
settings: {
|
|
205
|
+
u_dt: schedule.dt,
|
|
206
|
+
u_remaining: remaining,
|
|
207
|
+
u_capacity: warm_capacity,
|
|
208
|
+
u_emitter_capacity: emitter_capacity,
|
|
209
|
+
u_count: queue_count,
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
group_count: [Math.ceil(queue_count / PARTICLE_WARMUP_WORKGROUP_SIZE), 1, 1],
|
|
213
|
+
});
|
|
214
|
+
gr_queue_rw = out.queue;
|
|
215
|
+
emitter_database = out.emitter_database;
|
|
216
|
+
warm_counters = out.counters;
|
|
217
|
+
spawn_counts = out.spawn_counts;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// 3. Scan the counts; the last sum is the tick's newborn count.
|
|
221
|
+
const spawn_prefix = graph_prefix_scan_csdldf({
|
|
222
|
+
graph,
|
|
223
|
+
input: spawn_counts,
|
|
224
|
+
output: graph_create_buffer(graph, "particles/warmup/spawn_prefix",
|
|
225
|
+
prefix_scan_csdldf_output_descriptor(Math.max(1, emitter_capacity))),
|
|
226
|
+
element_max_count: Math.max(1, emitter_capacity),
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
// 4. That total as the emit dispatch — for the fast emit; the wide one reads the total as a
|
|
230
|
+
// loop bound instead, as it does in the main frame.
|
|
231
|
+
const emit_command = graph_compute_pass({
|
|
232
|
+
graph,
|
|
233
|
+
shader: shader_prefix_sum_to_command,
|
|
234
|
+
bindings: {
|
|
235
|
+
prefix_sums: spawn_prefix,
|
|
236
|
+
command: graph_create_buffer(graph, "particles/warmup/emit_command", INDIRECT_COMPUTE_COMMAND_DESCRIPTOR),
|
|
237
|
+
},
|
|
238
|
+
group_count: [1, 1, 1],
|
|
239
|
+
}).command;
|
|
240
|
+
|
|
241
|
+
// 5. Emit — the main pass, unchanged, over the warm-up's buffers. It finds each newborn's
|
|
242
|
+
// emitter in the scan, reads the record and the age off the main database, pops the
|
|
243
|
+
// transient free list and appends to the transient alive list.
|
|
244
|
+
{
|
|
245
|
+
const bindings = {
|
|
246
|
+
scene_database,
|
|
247
|
+
emitter_database,
|
|
248
|
+
program,
|
|
249
|
+
spawn_prefix,
|
|
250
|
+
pool: warm_pool, alive_out: alive_this, dead: warm_dead, counters: warm_counters,
|
|
251
|
+
settings: { u_dt: schedule.dt, u_time: time, u_frame: frame_index, u_capacity: warm_capacity },
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
const out = wide_registers
|
|
255
|
+
? graph_compute_pass({
|
|
256
|
+
graph,
|
|
257
|
+
shader: shader_particle_emit_wide,
|
|
258
|
+
bindings: { ...bindings, vm_registers },
|
|
259
|
+
group_count: [PARTICLE_EMIT_WIDE_WORKGROUP_COUNT, 1, 1],
|
|
260
|
+
})
|
|
261
|
+
: graph_compute_indirect_pass({
|
|
262
|
+
graph,
|
|
263
|
+
shader: shader_particle_emit,
|
|
264
|
+
bindings,
|
|
265
|
+
command: emit_command,
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
warm_pool = out.pool;
|
|
269
|
+
alive_this = out.alive_out;
|
|
270
|
+
warm_dead = out.dead;
|
|
271
|
+
warm_counters = out.counters;
|
|
272
|
+
|
|
273
|
+
if (wide_registers) { vm_registers = out.vm_registers; }
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
// 6. Advance last tick's survivors by one tick, into the same list the newborns went to.
|
|
277
|
+
{
|
|
278
|
+
const bindings = {
|
|
279
|
+
scene_database,
|
|
280
|
+
emitter_database,
|
|
281
|
+
program,
|
|
282
|
+
pool: warm_pool, alive_in, alive_out: alive_this, dead: warm_dead, counters: warm_counters,
|
|
283
|
+
settings: { u_dt: schedule.dt, u_time: time, u_frame: frame_index },
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
const out = wide_registers
|
|
287
|
+
? graph_compute_pass({
|
|
288
|
+
graph,
|
|
289
|
+
shader: shader_particle_warmup_advance_wide,
|
|
290
|
+
bindings: { ...bindings, vm_registers },
|
|
291
|
+
group_count: [PARTICLE_WARMUP_WORKGROUP_COUNT, 1, 1],
|
|
292
|
+
})
|
|
293
|
+
: graph_compute_pass({
|
|
294
|
+
graph,
|
|
295
|
+
shader: shader_particle_warmup_advance,
|
|
296
|
+
bindings,
|
|
297
|
+
group_count: [PARTICLE_WARMUP_WORKGROUP_COUNT, 1, 1],
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
warm_pool = out.pool;
|
|
301
|
+
alive_this = out.alive_out;
|
|
302
|
+
warm_dead = out.dead;
|
|
303
|
+
warm_counters = out.counters;
|
|
304
|
+
|
|
305
|
+
if (wide_registers) { vm_registers = out.vm_registers; }
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
warm_alive[tick % 2] = alive_this;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
// 7. The population is the scene's: every survivor into a main-pool slot, onto the main alive
|
|
312
|
+
// list.
|
|
313
|
+
{
|
|
314
|
+
const out = graph_compute_pass({
|
|
315
|
+
graph,
|
|
316
|
+
shader: shader_particle_warmup_migrate,
|
|
317
|
+
bindings: {
|
|
318
|
+
warm_pool,
|
|
319
|
+
warm_alive: warm_alive[(schedule.ticks - 1) % 2],
|
|
320
|
+
warm_counters,
|
|
321
|
+
pool, alive_out, dead, counters,
|
|
322
|
+
u_capacity: capacity,
|
|
323
|
+
},
|
|
324
|
+
group_count: [PARTICLE_WARMUP_WORKGROUP_COUNT, 1, 1],
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
pool = out.pool;
|
|
328
|
+
alive_out = out.alive_out;
|
|
329
|
+
dead = out.dead;
|
|
330
|
+
counters = out.counters;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
return { pool, alive_out, dead, counters, emitter_database, vm_registers };
|
|
334
|
+
}
|