@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
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import("../Geometry.js").Geometry} Geometry
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* The axis runs along Y with the apex at the top, and the body is centred on the origin.
|
|
6
|
+
*
|
|
7
|
+
* A cone is a cylinder whose top radius is zero, exactly as three's `ConeGeometry` is, so this is
|
|
8
|
+
* {@link make_cylinder_geometry} under its own name; the apex handling lives there.
|
|
9
|
+
*
|
|
10
|
+
* @param {number} [radius] radius of the base
|
|
11
|
+
* @param {number} [height]
|
|
12
|
+
* @param {number} [radialSegments] segments around the axis
|
|
13
|
+
* @param {number} [heightSegments] segments along the axis
|
|
14
|
+
* @param {boolean} [openEnded] leave the base off, which makes the surface a hollow shell rather than a solid
|
|
15
|
+
* @param {number} [thetaStart]
|
|
16
|
+
* @param {number} [thetaLength] how much of the turn to build, in radians
|
|
17
|
+
* @returns {Geometry}
|
|
18
|
+
*/
|
|
19
|
+
export function make_cone_geometry(radius?: number, height?: number, radialSegments?: number, heightSegments?: number, openEnded?: boolean, thetaStart?: number, thetaLength?: number): Geometry;
|
|
20
|
+
export type Geometry = import("../Geometry.js").Geometry;
|
|
21
|
+
//# sourceMappingURL=make_cone_geometry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"make_cone_geometry.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/geometry/primitives/make_cone_geometry.js"],"names":[],"mappings":"AAEA;;GAEG;AAEH;;;;;;;;;;;;;;GAcG;AACH,4CATW,MAAM,WACN,MAAM,mBACN,MAAM,mBACN,MAAM,cACN,OAAO,eACP,MAAM,gBACN,MAAM,GACJ,QAAQ,CAgBpB;uBAhCY,OAAO,gBAAgB,EAAE,QAAQ"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { make_cylinder_geometry } from "./make_cylinder_geometry.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @typedef {import("../Geometry.js").Geometry} Geometry
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The axis runs along Y with the apex at the top, and the body is centred on the origin.
|
|
9
|
+
*
|
|
10
|
+
* A cone is a cylinder whose top radius is zero, exactly as three's `ConeGeometry` is, so this is
|
|
11
|
+
* {@link make_cylinder_geometry} under its own name; the apex handling lives there.
|
|
12
|
+
*
|
|
13
|
+
* @param {number} [radius] radius of the base
|
|
14
|
+
* @param {number} [height]
|
|
15
|
+
* @param {number} [radialSegments] segments around the axis
|
|
16
|
+
* @param {number} [heightSegments] segments along the axis
|
|
17
|
+
* @param {boolean} [openEnded] leave the base off, which makes the surface a hollow shell rather than a solid
|
|
18
|
+
* @param {number} [thetaStart]
|
|
19
|
+
* @param {number} [thetaLength] how much of the turn to build, in radians
|
|
20
|
+
* @returns {Geometry}
|
|
21
|
+
*/
|
|
22
|
+
export function make_cone_geometry(
|
|
23
|
+
radius = 1,
|
|
24
|
+
height = 1,
|
|
25
|
+
radialSegments = 8,
|
|
26
|
+
heightSegments = 1,
|
|
27
|
+
openEnded = false,
|
|
28
|
+
thetaStart = 0,
|
|
29
|
+
thetaLength = Math.PI * 2
|
|
30
|
+
) {
|
|
31
|
+
const geo = make_cylinder_geometry(0, radius, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength);
|
|
32
|
+
|
|
33
|
+
geo.name = "Cone";
|
|
34
|
+
|
|
35
|
+
return geo;
|
|
36
|
+
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* `Geometry` carries no multi-material groups, so the torso and the two caps are one index run
|
|
5
5
|
* rather than three; three's cylinder splits them only to address a material array.
|
|
6
6
|
*
|
|
7
|
-
* @param {number} [radiusTop]
|
|
7
|
+
* @param {number} [radiusTop] zero makes a cone, which is what `make_cone_geometry` does
|
|
8
8
|
* @param {number} [radiusBottom]
|
|
9
9
|
* @param {number} [height]
|
|
10
10
|
* @param {number} [radialSegments] segments around the axis
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"make_cylinder_geometry.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/geometry/primitives/make_cylinder_geometry.js"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;GAeG;AACH,mDAVW,MAAM,iBACN,MAAM,WACN,MAAM,mBACN,MAAM,mBACN,MAAM,cACN,OAAO,eACP,MAAM,gBACN,MAAM,GACJ,QAAQ,
|
|
1
|
+
{"version":3,"file":"make_cylinder_geometry.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/geometry/primitives/make_cylinder_geometry.js"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;GAeG;AACH,mDAVW,MAAM,iBACN,MAAM,WACN,MAAM,mBACN,MAAM,mBACN,MAAM,cACN,OAAO,eACP,MAAM,gBACN,MAAM,GACJ,QAAQ,CAgQpB;yBAjRwB,gBAAgB"}
|
|
@@ -8,7 +8,7 @@ import { StandardAttributes } from "../StandardAttributes.js";
|
|
|
8
8
|
* `Geometry` carries no multi-material groups, so the torso and the two caps are one index run
|
|
9
9
|
* rather than three; three's cylinder splits them only to address a material array.
|
|
10
10
|
*
|
|
11
|
-
* @param {number} [radiusTop]
|
|
11
|
+
* @param {number} [radiusTop] zero makes a cone, which is what `make_cone_geometry` does
|
|
12
12
|
* @param {number} [radiusBottom]
|
|
13
13
|
* @param {number} [height]
|
|
14
14
|
* @param {number} [radialSegments] segments around the axis
|
|
@@ -31,7 +31,8 @@ export function make_cylinder_geometry(
|
|
|
31
31
|
|
|
32
32
|
/*
|
|
33
33
|
A port of three's `CylinderGeometry` onto `Geometry`: the same parameterisation and the same
|
|
34
|
-
winding, writing meep attributes instead of three ones.
|
|
34
|
+
winding, writing meep attributes instead of three ones. It departs at a cone's apex, see
|
|
35
|
+
`generateTorso`.
|
|
35
36
|
|
|
36
37
|
Derived from three.js (https://github.com/mrdoob/three.js), Copyright (c) 2010-2024 three.js authors, MIT licence.
|
|
37
38
|
*/
|
|
@@ -56,6 +57,7 @@ export function make_cylinder_geometry(
|
|
|
56
57
|
|
|
57
58
|
let index = 0;
|
|
58
59
|
const indexArray = [];
|
|
60
|
+
const apexRows = [];
|
|
59
61
|
const halfHeight = height / 2;
|
|
60
62
|
|
|
61
63
|
// generate geometry
|
|
@@ -98,9 +100,21 @@ export function make_cylinder_geometry(
|
|
|
98
100
|
|
|
99
101
|
const radius = v * (radiusBottom - radiusTop) + radiusTop;
|
|
100
102
|
|
|
101
|
-
|
|
103
|
+
// A row of zero radius is a cone's apex, where three's grid would put two corners of
|
|
104
|
+
// every segment's upper triangle on the same point and lean the other one's apex normal
|
|
105
|
+
// toward one edge. Instead the apex holds one vertex per segment, turned to the middle of
|
|
106
|
+
// that segment, and each segment draws just the one triangle that has area. The `u` is
|
|
107
|
+
// offset the same way, as three's own sphere does at its poles.
|
|
108
|
+
const apex = radius === 0;
|
|
102
109
|
|
|
103
|
-
|
|
110
|
+
apexRows.push(apex);
|
|
111
|
+
|
|
112
|
+
const rowVertexCount = apex ? radialSegments : radialSegments + 1;
|
|
113
|
+
const uOffset = apex ? 0.5 : 0;
|
|
114
|
+
|
|
115
|
+
for (let x = 0; x < rowVertexCount; x++) {
|
|
116
|
+
|
|
117
|
+
const u = (x + uOffset) / radialSegments;
|
|
104
118
|
|
|
105
119
|
const theta = u * thetaLength + thetaStart;
|
|
106
120
|
|
|
@@ -143,13 +157,34 @@ export function make_cylinder_geometry(
|
|
|
143
157
|
|
|
144
158
|
const a = indexArray[y][x];
|
|
145
159
|
const b = indexArray[y + 1][x];
|
|
146
|
-
const c = indexArray[y + 1][x + 1];
|
|
147
|
-
const d = indexArray[y][x + 1];
|
|
148
160
|
|
|
149
|
-
|
|
161
|
+
if (apexRows[y] && apexRows[y + 1]) {
|
|
162
|
+
|
|
163
|
+
// both rows on the axis, so the band has no area
|
|
164
|
+
|
|
165
|
+
} else if (apexRows[y]) {
|
|
166
|
+
|
|
167
|
+
// `a` is the segment's apex vertex and stands in for `d` as well
|
|
168
|
+
|
|
169
|
+
indices.push(b, indexArray[y + 1][x + 1], a);
|
|
170
|
+
|
|
171
|
+
} else if (apexRows[y + 1]) {
|
|
172
|
+
|
|
173
|
+
// `b` is the segment's apex vertex and stands in for `c` as well
|
|
174
|
+
|
|
175
|
+
indices.push(a, b, indexArray[y][x + 1]);
|
|
176
|
+
|
|
177
|
+
} else {
|
|
178
|
+
|
|
179
|
+
const c = indexArray[y + 1][x + 1];
|
|
180
|
+
const d = indexArray[y][x + 1];
|
|
181
|
+
|
|
182
|
+
// faces
|
|
183
|
+
|
|
184
|
+
indices.push(a, b, d);
|
|
185
|
+
indices.push(b, c, d);
|
|
150
186
|
|
|
151
|
-
|
|
152
|
-
indices.push(b, c, d);
|
|
187
|
+
}
|
|
153
188
|
|
|
154
189
|
}
|
|
155
190
|
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A sphere of rings of latitude and meridians of longitude, centred on the origin with its poles on
|
|
3
|
+
* the Y axis. The texture coordinates are equirectangular: `u` runs once around the axis and `v`
|
|
4
|
+
* from the south pole (0) to the north pole (1).
|
|
5
|
+
*
|
|
6
|
+
* The two angular intervals cut a partial sphere: `phi` turns about the Y axis and `theta` runs
|
|
7
|
+
* down from the north pole, so a `thetaLength` of `Math.PI / 2` is a dome.
|
|
8
|
+
*
|
|
9
|
+
* @param {number} [radius]
|
|
10
|
+
* @param {number} [widthSegments] segments around the axis, at least 3
|
|
11
|
+
* @param {number} [heightSegments] segments from pole to pole, at least 2
|
|
12
|
+
* @param {number} [phiStart]
|
|
13
|
+
* @param {number} [phiLength] how much of the turn about the axis to build, in radians
|
|
14
|
+
* @param {number} [thetaStart] where to start, in radians down from the north pole
|
|
15
|
+
* @param {number} [thetaLength] how far toward the south pole to build, in radians; stops at the pole
|
|
16
|
+
* @returns {Geometry}
|
|
17
|
+
*/
|
|
18
|
+
export function make_uv_sphere_geometry(radius?: number, widthSegments?: number, heightSegments?: number, phiStart?: number, phiLength?: number, thetaStart?: number, thetaLength?: number): Geometry;
|
|
19
|
+
import { Geometry } from "../Geometry.js";
|
|
20
|
+
//# sourceMappingURL=make_uv_sphere_geometry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"make_uv_sphere_geometry.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/geometry/primitives/make_uv_sphere_geometry.js"],"names":[],"mappings":"AAYA;;;;;;;;;;;;;;;;GAgBG;AACH,iDATW,MAAM,kBACN,MAAM,mBACN,MAAM,aACN,MAAM,cACN,MAAM,eACN,MAAM,gBACN,MAAM,GACJ,QAAQ,CAkKpB;yBA5LwB,gBAAgB"}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { Attribute } from "../Attribute.js";
|
|
2
|
+
import { Geometry } from "../Geometry.js";
|
|
3
|
+
import { StandardAttributes } from "../StandardAttributes.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* How far short of `Math.PI`, in radians, a theta interval may end and still close at the south
|
|
7
|
+
* pole: four ulps of pi, room for the rounding of a sum of two or three rounded angles.
|
|
8
|
+
*
|
|
9
|
+
* @type {number}
|
|
10
|
+
*/
|
|
11
|
+
const SOUTH_POLE_TOLERANCE = 8 * Number.EPSILON;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* A sphere of rings of latitude and meridians of longitude, centred on the origin with its poles on
|
|
15
|
+
* the Y axis. The texture coordinates are equirectangular: `u` runs once around the axis and `v`
|
|
16
|
+
* from the south pole (0) to the north pole (1).
|
|
17
|
+
*
|
|
18
|
+
* The two angular intervals cut a partial sphere: `phi` turns about the Y axis and `theta` runs
|
|
19
|
+
* down from the north pole, so a `thetaLength` of `Math.PI / 2` is a dome.
|
|
20
|
+
*
|
|
21
|
+
* @param {number} [radius]
|
|
22
|
+
* @param {number} [widthSegments] segments around the axis, at least 3
|
|
23
|
+
* @param {number} [heightSegments] segments from pole to pole, at least 2
|
|
24
|
+
* @param {number} [phiStart]
|
|
25
|
+
* @param {number} [phiLength] how much of the turn about the axis to build, in radians
|
|
26
|
+
* @param {number} [thetaStart] where to start, in radians down from the north pole
|
|
27
|
+
* @param {number} [thetaLength] how far toward the south pole to build, in radians; stops at the pole
|
|
28
|
+
* @returns {Geometry}
|
|
29
|
+
*/
|
|
30
|
+
export function make_uv_sphere_geometry(
|
|
31
|
+
radius = 1,
|
|
32
|
+
widthSegments = 32,
|
|
33
|
+
heightSegments = 16,
|
|
34
|
+
phiStart = 0,
|
|
35
|
+
phiLength = Math.PI * 2,
|
|
36
|
+
thetaStart = 0,
|
|
37
|
+
thetaLength = Math.PI
|
|
38
|
+
) {
|
|
39
|
+
|
|
40
|
+
/*
|
|
41
|
+
A port of three's `SphereGeometry` onto `Geometry`: the same parameterisation and the same
|
|
42
|
+
winding, writing meep attributes instead of three ones. It departs at the poles, see below.
|
|
43
|
+
|
|
44
|
+
Derived from three.js (https://github.com/mrdoob/three.js), Copyright (c) 2010-2024 three.js authors, MIT licence.
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
const geo = new Geometry();
|
|
48
|
+
|
|
49
|
+
geo.name = "UVSphere";
|
|
50
|
+
|
|
51
|
+
// segments
|
|
52
|
+
|
|
53
|
+
widthSegments = Math.max(3, Math.floor(widthSegments));
|
|
54
|
+
heightSegments = Math.max(2, Math.floor(heightSegments));
|
|
55
|
+
|
|
56
|
+
// three clamps only its triangle selection to the south pole; clamping the rows too keeps a
|
|
57
|
+
// long `thetaLength` from folding the last band back over the sphere
|
|
58
|
+
let thetaEnd = Math.min(thetaStart + thetaLength, Math.PI);
|
|
59
|
+
|
|
60
|
+
// an interval meant to end at the pole is the sum of two rounded angles, and lands short of
|
|
61
|
+
// `Math.PI` often enough (`Math.PI / 6 + Math.PI / 6 * 5` is an ulp short) that within a few
|
|
62
|
+
// ulps it is taken to mean the pole
|
|
63
|
+
if (Math.PI - thetaEnd <= SOUTH_POLE_TOLERANCE) {
|
|
64
|
+
thetaEnd = Math.PI;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// A ring at a pole is a single point. Three's grid still gives it a vertex per meridian, which
|
|
68
|
+
// puts two corners of every polar triangle on the same point. Here a pole holds one vertex per
|
|
69
|
+
// segment, turned to the middle of that segment, and each segment draws just the one triangle
|
|
70
|
+
// that has area. A pole's normal is the axis whichever way it is turned, so only its `u` moves.
|
|
71
|
+
const northPole = thetaStart === 0;
|
|
72
|
+
const southPole = thetaEnd === Math.PI;
|
|
73
|
+
|
|
74
|
+
// buffers
|
|
75
|
+
|
|
76
|
+
const indices = [];
|
|
77
|
+
const vertices = [];
|
|
78
|
+
const normals = [];
|
|
79
|
+
const uvs = [];
|
|
80
|
+
|
|
81
|
+
// helper variables
|
|
82
|
+
|
|
83
|
+
let index = 0;
|
|
84
|
+
const grid = [];
|
|
85
|
+
|
|
86
|
+
// generate vertices, normals and uvs
|
|
87
|
+
|
|
88
|
+
for (let iy = 0; iy <= heightSegments; iy++) {
|
|
89
|
+
|
|
90
|
+
const verticesRow = [];
|
|
91
|
+
|
|
92
|
+
const v = iy / heightSegments;
|
|
93
|
+
|
|
94
|
+
const atNorthPole = iy === 0 && northPole;
|
|
95
|
+
const atSouthPole = iy === heightSegments && southPole;
|
|
96
|
+
const pole = atNorthPole || atSouthPole;
|
|
97
|
+
|
|
98
|
+
// `Math.sin(Math.PI)` is not zero, so a pole is put on the axis rather than computed onto it
|
|
99
|
+
|
|
100
|
+
const theta = thetaStart + v * (thetaEnd - thetaStart);
|
|
101
|
+
|
|
102
|
+
const sinTheta = pole ? 0 : Math.sin(theta);
|
|
103
|
+
const cosTheta = atNorthPole ? 1 : (atSouthPole ? -1 : Math.cos(theta));
|
|
104
|
+
|
|
105
|
+
const rowVertexCount = pole ? widthSegments : widthSegments + 1;
|
|
106
|
+
const uOffset = pole ? 0.5 : 0;
|
|
107
|
+
|
|
108
|
+
for (let ix = 0; ix < rowVertexCount; ix++) {
|
|
109
|
+
|
|
110
|
+
const u = (ix + uOffset) / widthSegments;
|
|
111
|
+
|
|
112
|
+
const phi = phiStart + u * phiLength;
|
|
113
|
+
|
|
114
|
+
// normal, the direction from the centre, which is what the vertex is scaled from; taking
|
|
115
|
+
// it from the angles rather than normalising the vertex keeps it defined at radius zero
|
|
116
|
+
|
|
117
|
+
const normal_x = -Math.cos(phi) * sinTheta;
|
|
118
|
+
const normal_y = cosTheta;
|
|
119
|
+
const normal_z = Math.sin(phi) * sinTheta;
|
|
120
|
+
|
|
121
|
+
normals.push(normal_x, normal_y, normal_z);
|
|
122
|
+
|
|
123
|
+
// vertex
|
|
124
|
+
|
|
125
|
+
vertices.push(radius * normal_x, radius * normal_y, radius * normal_z);
|
|
126
|
+
|
|
127
|
+
// uv
|
|
128
|
+
|
|
129
|
+
uvs.push(u, 1 - v);
|
|
130
|
+
|
|
131
|
+
verticesRow.push(index++);
|
|
132
|
+
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
grid.push(verticesRow);
|
|
136
|
+
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// indices
|
|
140
|
+
|
|
141
|
+
for (let iy = 0; iy < heightSegments; iy++) {
|
|
142
|
+
|
|
143
|
+
const upper = grid[iy];
|
|
144
|
+
const lower = grid[iy + 1];
|
|
145
|
+
|
|
146
|
+
// at least two segments from pole to pole, so a band never has a pole on both sides
|
|
147
|
+
const upperIsPole = iy === 0 && northPole;
|
|
148
|
+
const lowerIsPole = iy + 1 === heightSegments && southPole;
|
|
149
|
+
|
|
150
|
+
for (let ix = 0; ix < widthSegments; ix++) {
|
|
151
|
+
|
|
152
|
+
if (upperIsPole) {
|
|
153
|
+
|
|
154
|
+
// the segment's pole vertex stands in for both upper corners
|
|
155
|
+
|
|
156
|
+
indices.push(upper[ix], lower[ix], lower[ix + 1]);
|
|
157
|
+
|
|
158
|
+
} else if (lowerIsPole) {
|
|
159
|
+
|
|
160
|
+
// the segment's pole vertex stands in for both lower corners
|
|
161
|
+
|
|
162
|
+
indices.push(upper[ix + 1], upper[ix], lower[ix]);
|
|
163
|
+
|
|
164
|
+
} else {
|
|
165
|
+
|
|
166
|
+
const a = upper[ix + 1];
|
|
167
|
+
const b = upper[ix];
|
|
168
|
+
const c = lower[ix];
|
|
169
|
+
const d = lower[ix + 1];
|
|
170
|
+
|
|
171
|
+
// faces
|
|
172
|
+
|
|
173
|
+
indices.push(a, b, d);
|
|
174
|
+
indices.push(b, c, d);
|
|
175
|
+
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// build geometry
|
|
183
|
+
|
|
184
|
+
geo.index = Attribute.from(new Uint32Array(indices), 1, 'index');
|
|
185
|
+
geo.addAttribute(Attribute.from(new Float32Array(vertices), 3, StandardAttributes.Position));
|
|
186
|
+
geo.addAttribute(Attribute.from(new Float32Array(normals), 3, StandardAttributes.Normal));
|
|
187
|
+
geo.addAttribute(Attribute.from(new Float32Array(uvs), 2, StandardAttributes.TextureCoordinates0));
|
|
188
|
+
|
|
189
|
+
return geo;
|
|
190
|
+
}
|
package/src/shade/renderer/geometry/virtual/runtime/graph_vgeo_expand_instances_to_meshlets.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph_vgeo_expand_instances_to_meshlets.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/geometry/virtual/runtime/graph_vgeo_expand_instances_to_meshlets.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"graph_vgeo_expand_instances_to_meshlets.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/geometry/virtual/runtime/graph_vgeo_expand_instances_to_meshlets.js"],"names":[],"mappings":"AAsBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH;IAX+B,KAAK;IACT,YAAY,EAA5B,MAAM;IACU,eAAe,EAA/B,MAAM;IACkB,IAAI;IACO,OAAO;IACb,MAAM;IACjC,MAAM,CA6TlB"}
|
package/src/shade/renderer/geometry/virtual/runtime/graph_vgeo_expand_instances_to_meshlets.js
CHANGED
|
@@ -5,8 +5,12 @@ import {
|
|
|
5
5
|
graph_build_indirect_dispatch_command,
|
|
6
6
|
INDIRECT_COMPUTE_COMMAND_DESCRIPTOR
|
|
7
7
|
} from "../../../gpu_primitive/indirect/IndirectComputeCommandBuildPass.js";
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
graph_prefix_scan_csdldf,
|
|
10
|
+
prefix_scan_csdldf_output_descriptor
|
|
11
|
+
} from "../../../gpu_primitive/prefix_sum/v1/graph_prefix_scan_csdldf.js";
|
|
9
12
|
import { RasterizationCollectionType } from "../../../rasterize/expand/RasterizationCollectionType.js";
|
|
13
|
+
import { graph_create_buffer } from "../../../shader/graph/graph_create_buffer.js";
|
|
10
14
|
import { shader_vgeo_cut_collect } from "./cut/shader_vgeo_cut_collect.js";
|
|
11
15
|
import { shader_vgeo_cut_queue_prepare } from "./cut/shader_vgeo_cut_queue_prepare.js";
|
|
12
16
|
import { shader_vgeo_cut_queue_remainder } from "./cut/shader_vgeo_cut_queue_remainder.js";
|
|
@@ -186,7 +190,8 @@ export function graph_vgeo_expand_instances_to_meshlets({
|
|
|
186
190
|
*/
|
|
187
191
|
const prefix_sums = graph_prefix_scan_csdldf({
|
|
188
192
|
graph,
|
|
189
|
-
|
|
193
|
+
input: collect_data.claim_widths,
|
|
194
|
+
output: graph_create_buffer(graph, "vg claim offsets", prefix_scan_csdldf_output_descriptor(instance_capacity)),
|
|
190
195
|
element_max_count: instance_capacity,
|
|
191
196
|
});
|
|
192
197
|
|
|
@@ -1,25 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A transient {@link graph_prefix_scan_csdldf} output for up to `element_max_count` elements: the count, padded to 16
|
|
3
|
+
* bytes, then the sums in whole vec4 blocks. The scan writes the count itself, so nothing needs clearing.
|
|
4
|
+
*
|
|
5
|
+
* @param {number} element_max_count
|
|
6
|
+
* @returns {BufferResourceDescriptor}
|
|
7
|
+
*/
|
|
8
|
+
export function prefix_scan_csdldf_output_descriptor(element_max_count: number): BufferResourceDescriptor;
|
|
1
9
|
/**
|
|
2
10
|
* Indirect pass.
|
|
3
|
-
*
|
|
11
|
+
* Inclusive prefix sums of `input` into `output`.
|
|
12
|
+
* Both are expected in the form:
|
|
4
13
|
* ```wgsl
|
|
5
14
|
* struct InputData{
|
|
6
15
|
* count:u32,
|
|
7
16
|
* elements: array<u32> // counts: [count0, count1, count2, ... countN-1]
|
|
8
17
|
* }
|
|
9
18
|
* ```
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
19
|
+
* `output` receives the input's count and, for each of its elements, the sum of the elements up to and including it.
|
|
20
|
+
* `input` is never written: the scan's fallback re-reads a tile's inputs while other tiles are writing their sums, so
|
|
21
|
+
* the two cannot be one buffer.
|
|
22
|
+
*
|
|
23
|
+
* The work follows the input's count, read on the device; `element_max_count` sizes only the memory — the spine, and
|
|
24
|
+
* what `output` must hold — so make it at least the most elements the input can carry, otherwise an incomplete scan will
|
|
25
|
+
* be performed. Where a count records demand and runs past a soft limit — a culled collection does — that is what the
|
|
26
|
+
* buffer holds, not the limit. The penalty for `element_max_count` being too big is fairly small: a larger spine to clear.
|
|
13
27
|
*
|
|
14
28
|
* @param {Object} options
|
|
15
29
|
* @param {FrameGraph} options.graph
|
|
16
|
-
* @param {number} options.
|
|
30
|
+
* @param {number} options.input buffer resource ID, array<u32> first position must be "count". The buffer must be 16-byte aligned.
|
|
31
|
+
* @param {number} options.output buffer resource ID of the same layout, at least `16 + ⌈element_max_count / 4⌉ · 16` bytes;
|
|
32
|
+
* see {@link prefix_scan_csdldf_output_descriptor}
|
|
17
33
|
* @param {number} [options.element_max_count=1,048,576] how many elements might be in the input, this is a limit
|
|
18
|
-
* @returns {number} buffer resource ID
|
|
34
|
+
* @returns {number} buffer resource ID of the written output
|
|
19
35
|
*/
|
|
20
|
-
export function graph_prefix_scan_csdldf({ graph,
|
|
36
|
+
export function graph_prefix_scan_csdldf({ graph, input, output, element_max_count, }: {
|
|
21
37
|
graph: FrameGraph;
|
|
22
|
-
|
|
38
|
+
input: number;
|
|
39
|
+
output: number;
|
|
23
40
|
element_max_count?: number;
|
|
24
41
|
}): number;
|
|
42
|
+
import { BufferResourceDescriptor } from "../../../../device/graph/BufferResourceDescriptor.js";
|
|
25
43
|
//# sourceMappingURL=graph_prefix_scan_csdldf.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph_prefix_scan_csdldf.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/gpu_primitive/prefix_sum/v1/graph_prefix_scan_csdldf.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"graph_prefix_scan_csdldf.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/gpu_primitive/prefix_sum/v1/graph_prefix_scan_csdldf.js"],"names":[],"mappings":"AAeA;;;;;;GAMG;AACH,wEAHW,MAAM,GACJ,wBAAwB,CAMpC;AAGD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH;IAP+B,KAAK;IACT,KAAK,EAArB,MAAM;IACU,MAAM,EAAtB,MAAM;IAEW,iBAAiB,GAAlC,MAAM;IACJ,MAAM,CAwElB;yCA3HwC,sDAAsD"}
|
|
@@ -3,51 +3,74 @@ import { round_up } from "../../../../../core/math/round_up.js";
|
|
|
3
3
|
import { warn_limited } from "../../../../util/warn_limited.js";
|
|
4
4
|
import { BufferResourceDescriptor } from "../../../../device/graph/BufferResourceDescriptor.js";
|
|
5
5
|
import { u32 } from "../../../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
|
|
6
|
+
import { INDIRECT_COMPUTE_COMMAND_DESCRIPTOR } from "../../indirect/IndirectComputeCommandBuildPass.js";
|
|
6
7
|
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
WEBGPU_GUARANTEED_MAX_COMPUTE_WORKGROUPS_PER_DIMENSION
|
|
9
|
+
} from "../../indirect/WEBGPU_GUARANTEED_MAX_COMPUTE_WORKGROUPS_PER_DIMENSION.js";
|
|
10
|
+
import {
|
|
11
|
+
PREFIX_SCAN_CSDLDF_PARTITION_SIZE,
|
|
12
|
+
shader_prefix_scan_csdldf,
|
|
13
|
+
shader_prefix_scan_csdldf_prepare
|
|
14
|
+
} from "./shader_prefix_scan_csdldf.js";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* A transient {@link graph_prefix_scan_csdldf} output for up to `element_max_count` elements: the count, padded to 16
|
|
18
|
+
* bytes, then the sums in whole vec4 blocks. The scan writes the count itself, so nothing needs clearing.
|
|
19
|
+
*
|
|
20
|
+
* @param {number} element_max_count
|
|
21
|
+
* @returns {BufferResourceDescriptor}
|
|
22
|
+
*/
|
|
23
|
+
export function prefix_scan_csdldf_output_descriptor(element_max_count) {
|
|
24
|
+
assert.isNonNegativeInteger(element_max_count, 'element_max_count');
|
|
25
|
+
|
|
26
|
+
return BufferResourceDescriptor.from(16 + Math.max(1, Math.ceil(element_max_count / 4)) * 16, GPUBufferUsage.STORAGE);
|
|
27
|
+
}
|
|
11
28
|
|
|
12
29
|
|
|
13
30
|
/**
|
|
14
31
|
* Indirect pass.
|
|
15
|
-
*
|
|
32
|
+
* Inclusive prefix sums of `input` into `output`.
|
|
33
|
+
* Both are expected in the form:
|
|
16
34
|
* ```wgsl
|
|
17
35
|
* struct InputData{
|
|
18
36
|
* count:u32,
|
|
19
37
|
* elements: array<u32> // counts: [count0, count1, count2, ... countN-1]
|
|
20
38
|
* }
|
|
21
39
|
* ```
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
40
|
+
* `output` receives the input's count and, for each of its elements, the sum of the elements up to and including it.
|
|
41
|
+
* `input` is never written: the scan's fallback re-reads a tile's inputs while other tiles are writing their sums, so
|
|
42
|
+
* the two cannot be one buffer.
|
|
43
|
+
*
|
|
44
|
+
* The work follows the input's count, read on the device; `element_max_count` sizes only the memory — the spine, and
|
|
45
|
+
* what `output` must hold — so make it at least the most elements the input can carry, otherwise an incomplete scan will
|
|
46
|
+
* be performed. Where a count records demand and runs past a soft limit — a culled collection does — that is what the
|
|
47
|
+
* buffer holds, not the limit. The penalty for `element_max_count` being too big is fairly small: a larger spine to clear.
|
|
25
48
|
*
|
|
26
49
|
* @param {Object} options
|
|
27
50
|
* @param {FrameGraph} options.graph
|
|
28
|
-
* @param {number} options.
|
|
51
|
+
* @param {number} options.input buffer resource ID, array<u32> first position must be "count". The buffer must be 16-byte aligned.
|
|
52
|
+
* @param {number} options.output buffer resource ID of the same layout, at least `16 + ⌈element_max_count / 4⌉ · 16` bytes;
|
|
53
|
+
* see {@link prefix_scan_csdldf_output_descriptor}
|
|
29
54
|
* @param {number} [options.element_max_count=1,048,576] how many elements might be in the input, this is a limit
|
|
30
|
-
* @returns {number} buffer resource ID
|
|
55
|
+
* @returns {number} buffer resource ID of the written output
|
|
31
56
|
*/
|
|
32
57
|
export function graph_prefix_scan_csdldf({
|
|
33
58
|
graph,
|
|
34
|
-
|
|
59
|
+
input,
|
|
60
|
+
output,
|
|
35
61
|
element_max_count = 1048576,
|
|
36
62
|
}) {
|
|
37
63
|
|
|
38
64
|
assert.isNonNegativeInteger(element_max_count, 'element_max_count');
|
|
39
65
|
|
|
40
|
-
if (element_max_count <= 0) {
|
|
41
|
-
console.warn("element_max_count <= 0, returning input");
|
|
42
|
-
|
|
43
|
-
return data;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
66
|
// TODO run a special prefix scan if element_max_count fits into a single group
|
|
47
67
|
|
|
48
|
-
|
|
49
68
|
const group_count = Math.ceil(element_max_count / PREFIX_SCAN_CSDLDF_PARTITION_SIZE);
|
|
50
69
|
|
|
70
|
+
if (group_count > WEBGPU_GUARANTEED_MAX_COMPUTE_WORKGROUPS_PER_DIMENSION) {
|
|
71
|
+
warn_limited(`group_count(=${group_count} > MAX_DISPATCH_SIZE(=${WEBGPU_GUARANTEED_MAX_COMPUTE_WORKGROUPS_PER_DIMENSION}). Prefix scan likely incomplete`);
|
|
72
|
+
}
|
|
73
|
+
|
|
51
74
|
const pass_data = {};
|
|
52
75
|
|
|
53
76
|
/**
|
|
@@ -58,41 +81,35 @@ export function graph_prefix_scan_csdldf({
|
|
|
58
81
|
*/
|
|
59
82
|
function execute(pass_data, resources, context) {
|
|
60
83
|
|
|
61
|
-
const data = resources.get(pass_data.data);
|
|
62
|
-
const partition_descriptor_buffer = resources.get(pass_data.partition_descriptor_buffer);
|
|
63
|
-
const command = resources.get(pass_data.command);
|
|
64
|
-
|
|
65
84
|
const encoder = context.encoder;
|
|
66
85
|
|
|
67
|
-
const
|
|
86
|
+
const scan_in = resources.get(pass_data.input);
|
|
87
|
+
const scan_out = resources.get(pass_data.output);
|
|
88
|
+
const command = resources.get(pass_data.command);
|
|
68
89
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
90
|
+
assert.notEqual(scan_in, scan_out, 'input and output must be different buffers');
|
|
91
|
+
assert.greaterThanOrEqual(scan_out.size, 16 + Math.ceil(element_max_count / 4) * 16, 'output is too small for element_max_count');
|
|
72
92
|
|
|
73
|
-
|
|
74
|
-
PREFIX_SCAN_CSDLDF_PARTITION_SIZE,
|
|
93
|
+
shader_prefix_scan_csdldf_prepare.dispatch({
|
|
75
94
|
encoder,
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
command,
|
|
79
|
-
0,
|
|
80
|
-
);
|
|
95
|
+
bindings: { scan_in, scan_out, command },
|
|
96
|
+
});
|
|
81
97
|
|
|
82
98
|
shader_prefix_scan_csdldf.dispatchIndirect({
|
|
83
99
|
encoder,
|
|
84
100
|
command,
|
|
85
101
|
bindings: {
|
|
86
|
-
scan_in
|
|
87
|
-
|
|
102
|
+
scan_in,
|
|
103
|
+
scan_out,
|
|
104
|
+
spine: resources.get(pass_data.partition_descriptor_buffer),
|
|
88
105
|
}
|
|
89
106
|
});
|
|
90
107
|
}
|
|
91
108
|
|
|
92
109
|
const pass = graph.add("prefix sum", pass_data, execute);
|
|
93
110
|
|
|
94
|
-
pass.read(
|
|
95
|
-
pass_data.
|
|
111
|
+
pass_data.input = pass.read(input);
|
|
112
|
+
pass_data.output = pass.write(pass.read(output));
|
|
96
113
|
|
|
97
114
|
pass_data.command = pass.create("command", INDIRECT_COMPUTE_COMMAND_DESCRIPTOR);
|
|
98
115
|
|
|
@@ -106,5 +123,5 @@ export function graph_prefix_scan_csdldf({
|
|
|
106
123
|
)
|
|
107
124
|
);
|
|
108
125
|
|
|
109
|
-
return pass_data.
|
|
110
|
-
}
|
|
126
|
+
return pass_data.output;
|
|
127
|
+
}
|
|
@@ -23,5 +23,12 @@ export const PREFIX_SCAN_CSDLDF_HEADER_WORDS: number;
|
|
|
23
23
|
* @type {ComputeShader}
|
|
24
24
|
*/
|
|
25
25
|
export const shader_prefix_scan_csdldf: ComputeShader;
|
|
26
|
+
/**
|
|
27
|
+
* One thread ahead of {@link shader_prefix_scan_csdldf}: the scan's dispatch, a workgroup per partition of the input's
|
|
28
|
+
* count, and the output's count. The output gets its count here rather than from the scan's first tile because an input
|
|
29
|
+
* of no elements dispatches no tile at all.
|
|
30
|
+
* @type {ComputeShader}
|
|
31
|
+
*/
|
|
32
|
+
export const shader_prefix_scan_csdldf_prepare: ComputeShader;
|
|
26
33
|
import { ComputeShader } from "../../../shader/ComputeShader.js";
|
|
27
34
|
//# sourceMappingURL=shader_prefix_scan_csdldf.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shader_prefix_scan_csdldf.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/gpu_primitive/prefix_sum/v1/shader_prefix_scan_csdldf.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"shader_prefix_scan_csdldf.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/gpu_primitive/prefix_sum/v1/shader_prefix_scan_csdldf.js"],"names":[],"mappings":"AAYA;;;;GAIG;AACH,gDAFU,MAAM,CAEsC;AAOtD;;;;;;;;;;GAUG;AACH,8CAFU,MAAM,CAE6E;AAmT7F;;;;;GAKG;AACH,wCAFU,aAAa,CAMpB;AAQH;;;;;GAKG;AACH,gDAFU,aAAa,CAkBpB;8BArX2B,kCAAkC"}
|