@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
|
@@ -21,16 +21,25 @@ import { ClothDynamics } from "./ClothDynamics.js";
|
|
|
21
21
|
*
|
|
22
22
|
* ## The local frame
|
|
23
23
|
*
|
|
24
|
-
* Particle positions live in the **
|
|
24
|
+
* Particle positions live in the **cloth's own frame** — rigid, so translation
|
|
25
25
|
* and rotation but not scale, following the same convention the colliders use.
|
|
26
26
|
* That is what makes §7 P7's inertia model natural (a cloth that feels none of
|
|
27
|
-
* its
|
|
27
|
+
* its frame's motion is one whose local coordinates simply do not change) and,
|
|
28
28
|
* as a consequence rather than as a goal, what makes `Float32` positions ample:
|
|
29
29
|
* the coordinates are garment-sized rather than world-sized.
|
|
30
30
|
*
|
|
31
|
-
* The
|
|
32
|
-
*
|
|
33
|
-
*
|
|
31
|
+
* The frame is what the cloth **rides**: the entity carrying the `Cloth` for a
|
|
32
|
+
* subtree, the joint its proxy names for a rig. It is not what holds the cloth.
|
|
33
|
+
*
|
|
34
|
+
* ## What holds it
|
|
35
|
+
*
|
|
36
|
+
* Nothing, unless something says so. A {@link ClothPin} on any entity holds the
|
|
37
|
+
* particles it names, and a held particle is kinematic: it follows its holder
|
|
38
|
+
* at the offset it had when the hold began ({@link holds}). A cloth has as many
|
|
39
|
+
* holds as name it, and a cloth with none falls. Every quantity that used to be
|
|
40
|
+
* measured from "the anchor" — the tether, the slack profile, the animated pose
|
|
41
|
+
* the slack is measured against, `reach` — is measured from the nearest held
|
|
42
|
+
* particle instead, which for a rope hung from its own top is the same thing.
|
|
34
43
|
*
|
|
35
44
|
* @author Alex Goldring
|
|
36
45
|
* @copyright Company Named Limited (c) 2026
|
|
@@ -38,7 +47,8 @@ import { ClothDynamics } from "./ClothDynamics.js";
|
|
|
38
47
|
export class ClothInstance {
|
|
39
48
|
|
|
40
49
|
/**
|
|
41
|
-
* The entity carrying the {@link Cloth} component
|
|
50
|
+
* The entity carrying the {@link Cloth} component. For a subtree cloth it is
|
|
51
|
+
* the root of the walk, node 0, and the cloth's frame.
|
|
42
52
|
* @type {number}
|
|
43
53
|
*/
|
|
44
54
|
entity = -1;
|
|
@@ -49,11 +59,120 @@ export class ClothInstance {
|
|
|
49
59
|
cloth = null;
|
|
50
60
|
|
|
51
61
|
/**
|
|
52
|
-
* The
|
|
62
|
+
* The world transform of the entity carrying the {@link Cloth} — a subtree
|
|
63
|
+
* cloth's frame.
|
|
53
64
|
* @type {Transform64|null}
|
|
54
65
|
*/
|
|
55
66
|
transform = null;
|
|
56
67
|
|
|
68
|
+
/**
|
|
69
|
+
* The entity whose pose is the cloth's frame: {@link entity} for a subtree,
|
|
70
|
+
* the joint the proxy names for a rig.
|
|
71
|
+
* @type {number}
|
|
72
|
+
*/
|
|
73
|
+
frame_entity = -1;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Whether cloth writes each node's pose. `0` for a node that is an entity
|
|
77
|
+
* cloth only reads: a subtree's root, which is its frame, and the bones a
|
|
78
|
+
* rig hangs from. Such a node is still a particle — something can hold it,
|
|
79
|
+
* and links run from it — but its output is somebody else's.
|
|
80
|
+
* @type {Uint8Array|null}
|
|
81
|
+
*/
|
|
82
|
+
node_output = null;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* The pose, in the cloth's frame, of the entity behind each node with no
|
|
86
|
+
* output — translation then rotation, 7 per node, meaningless for the rest.
|
|
87
|
+
*
|
|
88
|
+
* A node's local transform is written against its parent **entity**, and
|
|
89
|
+
* when that parent is not cloth's to write, its pose is whatever its owner
|
|
90
|
+
* gave it, not where its particle happens to be. A subtree's root is the
|
|
91
|
+
* frame, so the identity; a rig's bone is evaluated each step, in
|
|
92
|
+
* `advance`, so that the write-back reads a snapshot taken at the same
|
|
93
|
+
* moment under either system.
|
|
94
|
+
* @type {Float64Array|null}
|
|
95
|
+
*/
|
|
96
|
+
boundary_pose = null;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Every hold on this cloth, by holder entity ascending, as
|
|
100
|
+
* {@link ClothWorld} applied them. Shared with the world's registry, so the
|
|
101
|
+
* offsets a hold captured outlive a re-seed.
|
|
102
|
+
* @type {ClothHold[]}
|
|
103
|
+
*/
|
|
104
|
+
holds = [];
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Which {@link holds} entry holds each node, `−1` for a free node.
|
|
108
|
+
* @type {Int32Array|null}
|
|
109
|
+
*/
|
|
110
|
+
node_hold = null;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Where in its hold's particle list each held node is, `−1` for a free node.
|
|
114
|
+
* @type {Int32Array|null}
|
|
115
|
+
*/
|
|
116
|
+
node_hold_slot = null;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* The registry version {@link holds} was built from. A different one is a
|
|
120
|
+
* hold added or let go, and the next step re-derives everything a hold
|
|
121
|
+
* decides.
|
|
122
|
+
* @type {number}
|
|
123
|
+
*/
|
|
124
|
+
holds_version = -1;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* The {@link holds_version} whose holds are written into {@link state}, or
|
|
128
|
+
* `−1` for a state that holds nothing yet — a fresh seed.
|
|
129
|
+
* @type {number}
|
|
130
|
+
*/
|
|
131
|
+
holds_applied = -1;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* The held node each node's tether and slack are measured from — the
|
|
135
|
+
* nearest, along the fabric — or `−1` where nothing held is reachable.
|
|
136
|
+
* @type {Int32Array|null}
|
|
137
|
+
*/
|
|
138
|
+
tether_source = null;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Where each held node is to be at the end of this step, in the cloth's
|
|
142
|
+
* frame, 3 per node. Written in `advance`.
|
|
143
|
+
* @type {Float64Array|null}
|
|
144
|
+
*/
|
|
145
|
+
held_target = null;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* `1` for a node whose tether began wider than `d_geo` — a hold taken
|
|
149
|
+
* where the fabric already was — and is still coming down to it.
|
|
150
|
+
* `cloth_holds.js` carries why a tether starts loose.
|
|
151
|
+
* @type {Uint8Array|null}
|
|
152
|
+
*/
|
|
153
|
+
tether_loose = null;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* How many {@link tether_loose} nodes are left.
|
|
157
|
+
* @type {number}
|
|
158
|
+
*/
|
|
159
|
+
tether_loose_count = 0;
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Whether what `cloth_hold_step` derives — the held targets, the animated
|
|
163
|
+
* pose, the leash offsets — has to be derived again even though no hold has
|
|
164
|
+
* moved in the frame: the holds have just changed, or the particles have
|
|
165
|
+
* just been put somewhere (a teleport).
|
|
166
|
+
* @type {boolean}
|
|
167
|
+
*/
|
|
168
|
+
holds_dirty = true;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* The furthest any held node is carried this step, metres.
|
|
172
|
+
* @type {number}
|
|
173
|
+
*/
|
|
174
|
+
kinematic_travel = 0;
|
|
175
|
+
|
|
57
176
|
/**
|
|
58
177
|
* `false` until the subtree has been walked. Seeding is deferred to the
|
|
59
178
|
* first step rather than done at link, because a rope's links arrive as
|
|
@@ -74,13 +193,18 @@ export class ClothInstance {
|
|
|
74
193
|
node_count = 0;
|
|
75
194
|
|
|
76
195
|
/**
|
|
77
|
-
* Entity per node, in walk order. Node 0 is the
|
|
196
|
+
* Entity per node, in walk order. Node 0 is the cloth's own entity.
|
|
78
197
|
* @type {Int32Array|null}
|
|
79
198
|
*/
|
|
80
199
|
node_entity = null;
|
|
81
200
|
|
|
82
201
|
/**
|
|
83
|
-
* Parent node index, `−1` for
|
|
202
|
+
* Parent node index, `−1` for a root: a subtree's node 0, a bone a rig
|
|
203
|
+
* hangs from.
|
|
204
|
+
*
|
|
205
|
+
* The seeder's **tree**, which is what the write-back reconstructs
|
|
206
|
+
* orientation along and expresses local transforms against. The rows are
|
|
207
|
+
* built from {@link edge}, {@link skip} and {@link hinge} instead.
|
|
84
208
|
* @type {Int32Array|null}
|
|
85
209
|
*/
|
|
86
210
|
node_parent = null;
|
|
@@ -105,8 +229,8 @@ export class ClothInstance {
|
|
|
105
229
|
node_transform = [];
|
|
106
230
|
|
|
107
231
|
/**
|
|
108
|
-
* The joint entity each node
|
|
109
|
-
*
|
|
232
|
+
* The joint entity of each node. **Rig path only**; a node with no
|
|
233
|
+
* {@link node_output} is a bone the garment hangs from, which cloth reads. A skinned model is a prefab spawned
|
|
110
234
|
* as entities, so a joint is an entity carrying a `TransformAttachment`,
|
|
111
235
|
* and that offset is the writable handle; {@link node_attachment} holds it.
|
|
112
236
|
* @type {Int32Array|number[]}
|
|
@@ -114,7 +238,7 @@ export class ClothInstance {
|
|
|
114
238
|
node_joint = [];
|
|
115
239
|
|
|
116
240
|
/**
|
|
117
|
-
* The
|
|
241
|
+
* The frame joint's **world** pose, evaluated on the CPU each step from the
|
|
118
242
|
* clips the entity is playing. **Rig path only.**
|
|
119
243
|
*
|
|
120
244
|
* Evaluated rather than read: a joint of an animated skeleton has granted
|
|
@@ -126,10 +250,10 @@ export class ClothInstance {
|
|
|
126
250
|
* scabbard hangs from.
|
|
127
251
|
* @type {Transform64}
|
|
128
252
|
*/
|
|
129
|
-
|
|
253
|
+
frame_pose = new Transform64();
|
|
130
254
|
|
|
131
255
|
/**
|
|
132
|
-
* Live `TransformAttachment` per node; `null` for
|
|
256
|
+
* Live `TransformAttachment` per node; `null` for a node with no output.
|
|
133
257
|
*
|
|
134
258
|
* **While a cloth is live this is its output, not its input.** The
|
|
135
259
|
* write-back writes the local transform as well as the world one, so that a
|
|
@@ -210,34 +334,55 @@ export class ClothInstance {
|
|
|
210
334
|
particle_of_node = null;
|
|
211
335
|
|
|
212
336
|
/**
|
|
213
|
-
* Geodesic distance from
|
|
214
|
-
* rest
|
|
337
|
+
* Geodesic distance from each node to the nearest held node, metres — the
|
|
338
|
+
* rest lengths along the shortest path through the fabric, not the
|
|
339
|
+
* straight-line distance — and `Infinity` where nothing held is reachable.
|
|
215
340
|
*
|
|
216
|
-
* This one array drives the tether radius
|
|
217
|
-
*
|
|
218
|
-
* makes it the fixed set without a second mechanism saying so.
|
|
341
|
+
* This one array drives the tether radius and the slack profile, so the two
|
|
342
|
+
* cannot disagree (§3.4). A held node's is zero.
|
|
219
343
|
* @type {Float32Array|null}
|
|
220
344
|
*/
|
|
221
345
|
geodesic = null;
|
|
222
346
|
|
|
223
347
|
/**
|
|
224
|
-
* The
|
|
225
|
-
*
|
|
226
|
-
*
|
|
227
|
-
* **Constant, and that is a property of the entity path rather than an
|
|
228
|
-
* optimisation.** The subtree's authored pose is rigid relative to its
|
|
229
|
-
* anchor, so expressed in the anchor's own frame it does not move; the only
|
|
230
|
-
* thing that changes step to step is where that frame is. A subtree whose
|
|
231
|
-
* links are themselves animated is not an M1 case — that is the rig path,
|
|
232
|
-
* where the animated pose comes from the skeleton (§11.2) and is live.
|
|
348
|
+
* The rest pose in the cloth's frame — position, 3 per node — as the seeder
|
|
349
|
+
* found it: the authored subtree composed down from its root, or a rig's
|
|
350
|
+
* bind pose. Constant; what the rows' rest lengths are read from.
|
|
233
351
|
* @type {Float32Array|null}
|
|
234
352
|
*/
|
|
235
|
-
|
|
353
|
+
rest_position = null;
|
|
236
354
|
|
|
237
355
|
/**
|
|
238
|
-
* The
|
|
356
|
+
* The rest pose's orientation in the cloth's frame, 4 per node.
|
|
239
357
|
* @type {Float32Array|null}
|
|
240
358
|
*/
|
|
359
|
+
rest_rotation = null;
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* The animated pose in the cloth's frame — position, 3 per node — which is
|
|
363
|
+
* the **rest pose hung from what holds it**, rebuilt every step:
|
|
364
|
+
*
|
|
365
|
+
* s_i = x_p + R_p · (r_i − r_p)
|
|
366
|
+
*
|
|
367
|
+
* with `p` the nearest held node ({@link tether_source}), `x_p` where it
|
|
368
|
+
* is held this step and `R_p` how far its holder has turned in the frame
|
|
369
|
+
* since the hold began. A held node's is where it is held; a node nothing
|
|
370
|
+
* held reaches hangs from the frame, `s_i = r_i`.
|
|
371
|
+
*
|
|
372
|
+
* It is what the slack row is a leash to, what `blend = 0` shows and what a
|
|
373
|
+
* teleport resets to. §3.4's bound survives it exactly: `|s_i − x_p|` is the
|
|
374
|
+
* rest distance `|r_i − r_p|`, which is no more than `d_geo`, so with the
|
|
375
|
+
* tether a particle is never more than `2·d_geo` from its centre and
|
|
376
|
+
* `slack = 1` is still no leash at all. A cloth whose holders ride its frame
|
|
377
|
+
* has `s_i = r_i` for ever, which is the constant pose this used to be.
|
|
378
|
+
* @type {Float64Array|null}
|
|
379
|
+
*/
|
|
380
|
+
animated_position = null;
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* The animated pose's orientation in the cloth's frame, 4 per node.
|
|
384
|
+
* @type {Float64Array|null}
|
|
385
|
+
*/
|
|
241
386
|
animated_rotation = null;
|
|
242
387
|
|
|
243
388
|
/**
|
|
@@ -267,41 +412,126 @@ export class ClothInstance {
|
|
|
267
412
|
|
|
268
413
|
/**
|
|
269
414
|
* Leash row enforcing the slack bound for each node, `−1` where there is
|
|
270
|
-
* none —
|
|
271
|
-
*
|
|
415
|
+
* none — a fabric whose `slack` reaches the bound at which the row is
|
|
416
|
+
* provably inactive. A node nothing holds has one of radius `Infinity`.
|
|
272
417
|
* @type {Int32Array|null}
|
|
273
418
|
*/
|
|
274
419
|
slack_row = null;
|
|
275
420
|
|
|
276
421
|
/**
|
|
277
|
-
* Leash row enforcing the tether bound for each node
|
|
422
|
+
* Leash row enforcing the tether bound for each node — every node has one,
|
|
423
|
+
* of radius `Infinity` while nothing it can reach is held.
|
|
278
424
|
* @type {Int32Array|null}
|
|
279
425
|
*/
|
|
280
426
|
tether_row = null;
|
|
281
427
|
|
|
282
428
|
/**
|
|
283
|
-
*
|
|
429
|
+
* The fabric: pairs of nodes joined by a hard stretch row, 2 per edge.
|
|
430
|
+
*
|
|
431
|
+
* **The particle graph, not the walk's tree.** A seeder hands over whatever
|
|
432
|
+
* joins its particles — a tree's parent links, a mesh's triangle edges — and
|
|
433
|
+
* `cloth_build_rows` builds the same rows from either. Nothing about the rows
|
|
434
|
+
* needs a parent, which is what lets a cloth be a sheet, or several pieces.
|
|
435
|
+
* @type {Int32Array|null}
|
|
436
|
+
*/
|
|
437
|
+
edge = null;
|
|
438
|
+
|
|
439
|
+
/**
|
|
440
|
+
* A chain's bending model: pairs of nodes two links apart, joined by a soft
|
|
441
|
+
* stretch row at their authored distance (`cloth_seed_subtree.js` carries
|
|
442
|
+
* why a chain bends this way and a sheet does not), 2 per pair.
|
|
443
|
+
* @type {Int32Array|null}
|
|
444
|
+
*/
|
|
445
|
+
skip = null;
|
|
446
|
+
|
|
447
|
+
/**
|
|
448
|
+
* A surface's bending model: four nodes per hinge — the shared edge, then
|
|
449
|
+
* the wing opposite it in each of its two triangles — which is
|
|
450
|
+
* `cloth_bend_row`'s stencil.
|
|
451
|
+
* @type {Int32Array|null}
|
|
452
|
+
*/
|
|
453
|
+
hinge = null;
|
|
454
|
+
|
|
455
|
+
/**
|
|
456
|
+
* Rest length of each {@link edge}, metres, in double — what the geodesics
|
|
457
|
+
* are summed from.
|
|
458
|
+
* @type {Float64Array|null}
|
|
459
|
+
*/
|
|
460
|
+
edge_length = null;
|
|
461
|
+
|
|
462
|
+
/**
|
|
463
|
+
* The edges touching each node, CSR — the geodesic search's adjacency.
|
|
464
|
+
* @type {{offset: Int32Array, edge: Int32Array}|null}
|
|
465
|
+
*/
|
|
466
|
+
edge_incidence = null;
|
|
467
|
+
|
|
468
|
+
/**
|
|
469
|
+
* Each hold's turn in the frame since it began, 4 per entry of {@link holds},
|
|
470
|
+
* rebuilt every step.
|
|
471
|
+
* @type {Float64Array}
|
|
472
|
+
*/
|
|
473
|
+
hold_turn = new Float64Array(0);
|
|
474
|
+
|
|
475
|
+
/**
|
|
476
|
+
* Triangles over the nodes, 3 each, for a cloth with a surface — what a
|
|
477
|
+
* joint's orientation is read off when it has no chain to swing along.
|
|
478
|
+
* Empty for a chain.
|
|
479
|
+
* @type {Int32Array|null}
|
|
480
|
+
*/
|
|
481
|
+
triangle = null;
|
|
482
|
+
|
|
483
|
+
/**
|
|
484
|
+
* CSR offsets into {@link surface_triangle}, `node_count + 1` entries, or
|
|
485
|
+
* `null` for a cloth with no triangles.
|
|
486
|
+
* @type {Int32Array|null}
|
|
487
|
+
*/
|
|
488
|
+
surface_offset = null;
|
|
489
|
+
|
|
490
|
+
/**
|
|
491
|
+
* The triangles around each node, as indices into {@link triangle}.
|
|
492
|
+
* @type {Int32Array|null}
|
|
493
|
+
*/
|
|
494
|
+
surface_triangle = null;
|
|
495
|
+
|
|
496
|
+
/**
|
|
497
|
+
* One neighbour per node, along an edge — the direction a surface node's
|
|
498
|
+
* twist is measured by.
|
|
499
|
+
* @type {Int32Array|null}
|
|
500
|
+
*/
|
|
501
|
+
surface_neighbour = null;
|
|
502
|
+
|
|
503
|
+
/**
|
|
504
|
+
* Each hinge's effective inertia, kg — what its stiffness is a ratio of
|
|
505
|
+
* (`cloth_hinge_inertia`). Bend row `h` is hinge `h`.
|
|
506
|
+
* @type {Float32Array|null}
|
|
507
|
+
*/
|
|
508
|
+
hinge_inertia = null;
|
|
509
|
+
|
|
510
|
+
/**
|
|
511
|
+
* Stretch row carrying each {@link edge}.
|
|
284
512
|
* @type {Int32Array|null}
|
|
285
513
|
*/
|
|
286
|
-
|
|
514
|
+
edge_row = null;
|
|
287
515
|
|
|
288
516
|
/**
|
|
289
|
-
* Strain-limit
|
|
517
|
+
* Strain-limit row on each {@link edge}, `−1` when the flag is clear.
|
|
290
518
|
* @type {Int32Array|null}
|
|
291
519
|
*/
|
|
292
520
|
strain_row = null;
|
|
293
521
|
|
|
294
522
|
/**
|
|
295
|
-
*
|
|
296
|
-
*
|
|
523
|
+
* Stretch row carrying each {@link skip} pair, `−1` when there is no bending
|
|
524
|
+
* to carry.
|
|
297
525
|
* @type {Int32Array|null}
|
|
298
526
|
*/
|
|
299
527
|
skip_row = null;
|
|
300
528
|
|
|
301
529
|
/**
|
|
302
|
-
*
|
|
303
|
-
*
|
|
304
|
-
*
|
|
530
|
+
* How far this cloth can reach from what it hangs from — the largest
|
|
531
|
+
* {@link geodesic}, with a node nothing held reaches counted at its rest
|
|
532
|
+
* distance from the frame's origin, which is what it hangs from instead —
|
|
533
|
+
* and the length scale the frame limits, the teleport threshold and the
|
|
534
|
+
* sleep window are derived from.
|
|
305
535
|
* @type {number}
|
|
306
536
|
*/
|
|
307
537
|
reach = 0;
|
|
@@ -319,24 +549,24 @@ export class ClothInstance {
|
|
|
319
549
|
shortest_row = 0;
|
|
320
550
|
|
|
321
551
|
/**
|
|
322
|
-
* The
|
|
552
|
+
* The frame's world translation as of the previous step, `[x, y, z]`.
|
|
323
553
|
* @type {Float64Array}
|
|
324
554
|
*/
|
|
325
|
-
|
|
555
|
+
frame_translation = new Float64Array(3);
|
|
326
556
|
|
|
327
557
|
/**
|
|
328
|
-
* The
|
|
558
|
+
* The frame's world rotation as of the previous step, `[x, y, z, w]`.
|
|
329
559
|
* @type {Float64Array}
|
|
330
560
|
*/
|
|
331
|
-
|
|
561
|
+
frame_rotation = new Float64Array([0, 0, 0, 1]);
|
|
332
562
|
|
|
333
563
|
/**
|
|
334
|
-
* `false` until the first step has recorded
|
|
564
|
+
* `false` until the first step has recorded a frame pose to compare
|
|
335
565
|
* against. The first step feels no inertia, which is correct: there is no
|
|
336
566
|
* motion yet, only a starting place.
|
|
337
567
|
* @type {boolean}
|
|
338
568
|
*/
|
|
339
|
-
|
|
569
|
+
frame_valid = false;
|
|
340
570
|
|
|
341
571
|
/**
|
|
342
572
|
* What {@link Cloth#dynamics} looked like when the rows were last
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* # This entity holds some of a cloth's particles
|
|
3
|
+
*
|
|
4
|
+
* Put it on whatever does the holding — a pole, a hook, a hand, a shoulder bone,
|
|
5
|
+
* the cloth's own entity — and the particles it names stop being simulated and
|
|
6
|
+
* follow it, each at the offset it had from this entity when the hold began.
|
|
7
|
+
*
|
|
8
|
+
* ```js
|
|
9
|
+
* pole.add(ClothPin.from({ cloth: flag, particles: flag_groups.hoist }));
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* A cloth has as many holders as name it, and none is a cloth nothing holds:
|
|
13
|
+
* there is no anchor, and nothing about a pinned particle is different from a
|
|
14
|
+
* free one except that something holds it. That is the whole of §3.4's fixed
|
|
15
|
+
* set, made into a component.
|
|
16
|
+
*
|
|
17
|
+
* - **The hold begins where the particle is.** On a cloth's first step that is
|
|
18
|
+
* its rest pose; added to a live cloth, it is wherever the fabric has got to,
|
|
19
|
+
* which is what grabbing it means.
|
|
20
|
+
* - **Removing the component lets go**, and so does destroying this entity. A
|
|
21
|
+
* particle let go carries the velocity its holder was giving it.
|
|
22
|
+
* - **The references are fixed while the component is attached**: remove it and
|
|
23
|
+
* add it back to change them, the contract `TransformAttachment#parent` and
|
|
24
|
+
* `IKGoal` carry.
|
|
25
|
+
* - **A particle has one holder.** When two pins name the same particle the one
|
|
26
|
+
* on the lower entity holds it, every time.
|
|
27
|
+
* - **A holder the cloth itself moves is refused** — a link of the same rope,
|
|
28
|
+
* or anything hanging below one — once, by name, because it would chase its
|
|
29
|
+
* own write-back. The cloth's own entity is fine: it is the frame, and cloth
|
|
30
|
+
* reads it.
|
|
31
|
+
*
|
|
32
|
+
* {@link particles} are indices in the cloth's own numbering: a `ClothProxy`'s
|
|
33
|
+
* particle order, which its builder hands back as groups, or — for a cloth
|
|
34
|
+
* over its own entity subtree — the breadth-first walk, where `0` is the entity
|
|
35
|
+
* carrying the `Cloth`.
|
|
36
|
+
*
|
|
37
|
+
* Saved with its entity (`ClothPinSerializationAdapter`): a scene's entities
|
|
38
|
+
* keep their ids across a save, and a rope saved without the pin that holds it
|
|
39
|
+
* would load as a rope that falls. A pin on a bone a model spawned goes with
|
|
40
|
+
* the bone, which is never saved, and is put back by whatever spawns the model.
|
|
41
|
+
*
|
|
42
|
+
* @author Alex Goldring
|
|
43
|
+
* @copyright Company Named Limited (c) 2026
|
|
44
|
+
*/
|
|
45
|
+
export class ClothPin {
|
|
46
|
+
/**
|
|
47
|
+
* @param {{cloth: number, particles: Int32Array|number[]}} options every field required
|
|
48
|
+
* @returns {ClothPin}
|
|
49
|
+
*/
|
|
50
|
+
static from({ cloth, particles }: {
|
|
51
|
+
cloth: number;
|
|
52
|
+
particles: Int32Array | number[];
|
|
53
|
+
}): ClothPin;
|
|
54
|
+
/**
|
|
55
|
+
* The entity carrying the {@link Cloth} whose particles this holds.
|
|
56
|
+
* @type {number}
|
|
57
|
+
*/
|
|
58
|
+
cloth: number;
|
|
59
|
+
/**
|
|
60
|
+
* The particles held, in the cloth's own numbering.
|
|
61
|
+
* @type {Int32Array}
|
|
62
|
+
*/
|
|
63
|
+
particles: Int32Array;
|
|
64
|
+
/**
|
|
65
|
+
* @readonly
|
|
66
|
+
* @type {boolean}
|
|
67
|
+
*/
|
|
68
|
+
readonly isClothPin: boolean;
|
|
69
|
+
}
|
|
70
|
+
export namespace ClothPin {
|
|
71
|
+
let typeName: string;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=ClothPin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClothPin.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/physics/cloth/ecs/ClothPin.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH;IAcI;;;OAGG;IACH,kCAHW;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,UAAU,GAAC,MAAM,EAAE,CAAA;KAAC,GAC7C,QAAQ,CAgBpB;IA9BD;;;OAGG;IACH,OAFU,MAAM,CAEL;IAEX;;;OAGG;IACH,WAFU,UAAU,CAEU;IAuBlC;;;OAGG;IACH,qBAFU,OAAO,CAEY;CAN5B;;kBAUS,MAAM"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { assert } from "../../../../core/assert.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* # This entity holds some of a cloth's particles
|
|
5
|
+
*
|
|
6
|
+
* Put it on whatever does the holding — a pole, a hook, a hand, a shoulder bone,
|
|
7
|
+
* the cloth's own entity — and the particles it names stop being simulated and
|
|
8
|
+
* follow it, each at the offset it had from this entity when the hold began.
|
|
9
|
+
*
|
|
10
|
+
* ```js
|
|
11
|
+
* pole.add(ClothPin.from({ cloth: flag, particles: flag_groups.hoist }));
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* A cloth has as many holders as name it, and none is a cloth nothing holds:
|
|
15
|
+
* there is no anchor, and nothing about a pinned particle is different from a
|
|
16
|
+
* free one except that something holds it. That is the whole of §3.4's fixed
|
|
17
|
+
* set, made into a component.
|
|
18
|
+
*
|
|
19
|
+
* - **The hold begins where the particle is.** On a cloth's first step that is
|
|
20
|
+
* its rest pose; added to a live cloth, it is wherever the fabric has got to,
|
|
21
|
+
* which is what grabbing it means.
|
|
22
|
+
* - **Removing the component lets go**, and so does destroying this entity. A
|
|
23
|
+
* particle let go carries the velocity its holder was giving it.
|
|
24
|
+
* - **The references are fixed while the component is attached**: remove it and
|
|
25
|
+
* add it back to change them, the contract `TransformAttachment#parent` and
|
|
26
|
+
* `IKGoal` carry.
|
|
27
|
+
* - **A particle has one holder.** When two pins name the same particle the one
|
|
28
|
+
* on the lower entity holds it, every time.
|
|
29
|
+
* - **A holder the cloth itself moves is refused** — a link of the same rope,
|
|
30
|
+
* or anything hanging below one — once, by name, because it would chase its
|
|
31
|
+
* own write-back. The cloth's own entity is fine: it is the frame, and cloth
|
|
32
|
+
* reads it.
|
|
33
|
+
*
|
|
34
|
+
* {@link particles} are indices in the cloth's own numbering: a `ClothProxy`'s
|
|
35
|
+
* particle order, which its builder hands back as groups, or — for a cloth
|
|
36
|
+
* over its own entity subtree — the breadth-first walk, where `0` is the entity
|
|
37
|
+
* carrying the `Cloth`.
|
|
38
|
+
*
|
|
39
|
+
* Saved with its entity (`ClothPinSerializationAdapter`): a scene's entities
|
|
40
|
+
* keep their ids across a save, and a rope saved without the pin that holds it
|
|
41
|
+
* would load as a rope that falls. A pin on a bone a model spawned goes with
|
|
42
|
+
* the bone, which is never saved, and is put back by whatever spawns the model.
|
|
43
|
+
*
|
|
44
|
+
* @author Alex Goldring
|
|
45
|
+
* @copyright Company Named Limited (c) 2026
|
|
46
|
+
*/
|
|
47
|
+
export class ClothPin {
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* The entity carrying the {@link Cloth} whose particles this holds.
|
|
51
|
+
* @type {number}
|
|
52
|
+
*/
|
|
53
|
+
cloth = -1;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* The particles held, in the cloth's own numbering.
|
|
57
|
+
* @type {Int32Array}
|
|
58
|
+
*/
|
|
59
|
+
particles = new Int32Array(0);
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* @param {{cloth: number, particles: Int32Array|number[]}} options every field required
|
|
63
|
+
* @returns {ClothPin}
|
|
64
|
+
*/
|
|
65
|
+
static from({ cloth, particles }) {
|
|
66
|
+
assert.isNonNegativeInteger(cloth, 'cloth');
|
|
67
|
+
assert.defined(particles, 'particles');
|
|
68
|
+
|
|
69
|
+
const pin = new ClothPin();
|
|
70
|
+
|
|
71
|
+
pin.cloth = cloth;
|
|
72
|
+
pin.particles = Int32Array.from(particles);
|
|
73
|
+
|
|
74
|
+
for (let i = 0; i < pin.particles.length; i++) {
|
|
75
|
+
assert.isNonNegativeInteger(pin.particles[i], `particles[${i}]`);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return pin;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* @readonly
|
|
84
|
+
* @type {boolean}
|
|
85
|
+
*/
|
|
86
|
+
ClothPin.prototype.isClothPin = true;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* @readonly
|
|
90
|
+
* @type {string}
|
|
91
|
+
*/
|
|
92
|
+
ClothPin.typeName = "ClothPin";
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* # Binary serialization for {@link ClothPin}
|
|
3
|
+
*
|
|
4
|
+
* The cloth's entity, then the particles. A rope is saved as its links and its
|
|
5
|
+
* `Cloth`; without its pin it would load as a rope nothing holds, and fall.
|
|
6
|
+
*
|
|
7
|
+
* The cloth is written as a raw entity id, the way `JointSerializationAdapter`
|
|
8
|
+
* writes its two: a scene's entities keep their ids across a save. A pin on an
|
|
9
|
+
* entity that is not saved — a bone a model spawned, which is transient — is
|
|
10
|
+
* not saved with it, and is put back by whatever spawns the model, as its
|
|
11
|
+
* `ClothRig` is.
|
|
12
|
+
*
|
|
13
|
+
* ## Version 0, and no upgrader
|
|
14
|
+
*
|
|
15
|
+
* A first version has no predecessor stream to upgrade from.
|
|
16
|
+
*
|
|
17
|
+
* @author Alex Goldring
|
|
18
|
+
* @copyright Company Named Limited (c) 2026
|
|
19
|
+
*/
|
|
20
|
+
export class ClothPinSerializationAdapter extends BinaryClassSerializationAdapter<any> {
|
|
21
|
+
constructor();
|
|
22
|
+
klass: typeof ClothPin;
|
|
23
|
+
/**
|
|
24
|
+
* @param {BinaryBuffer} buffer
|
|
25
|
+
* @param {ClothPin} value
|
|
26
|
+
*/
|
|
27
|
+
serialize(buffer: BinaryBuffer, value: ClothPin): void;
|
|
28
|
+
/**
|
|
29
|
+
* @param {BinaryBuffer} buffer
|
|
30
|
+
* @param {ClothPin} value
|
|
31
|
+
*/
|
|
32
|
+
deserialize(buffer: BinaryBuffer, value: ClothPin): void;
|
|
33
|
+
}
|
|
34
|
+
import { BinaryClassSerializationAdapter } from "../../../ecs/storage/binary/BinaryClassSerializationAdapter.js";
|
|
35
|
+
import { ClothPin } from "./ClothPin.js";
|
|
36
|
+
//# sourceMappingURL=ClothPinSerializationAdapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClothPinSerializationAdapter.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/physics/cloth/ecs/ClothPinSerializationAdapter.js"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;GAkBG;AACH;;IAEI,uBAAiB;IAGjB;;;OAGG;IACH,uCAFW,QAAQ,QAYlB;IAED;;;OAGG;IACH,yCAFW,QAAQ,QAclB;CACJ;gDA5D+C,gEAAgE;yBACvF,eAAe"}
|