@woosh/meep-engine 3.42.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 +91 -96
- 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/playground/vgeo_runtime/README.md +5 -4
- package/src/shade/renderer/Renderer.d.ts.map +1 -1
- package/src/shade/renderer/Renderer.js +6 -5
- 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/atmosphere/GPUSky.d.ts +12 -0
- package/src/shade/renderer/atmosphere/GPUSky.d.ts.map +1 -1
- package/src/shade/renderer/atmosphere/GPUSky.js +162 -147
- package/src/shade/renderer/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/lightmap/bake/shader_lightmap_denoise_sh.d.ts.map +1 -1
- package/src/shade/renderer/lightmap/bake/shader_lightmap_denoise_sh.js +10 -3
- package/src/shade/renderer/loader/gltf/tiny-gltf.d.ts +1 -1
- package/src/shade/renderer/particles/DESIGN.md +13 -9
- package/src/shade/renderer/particles/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/shaders/chunk_particle_lighting.d.ts +1 -1
- package/src/shade/renderer/particles/shaders/chunk_particle_lighting.js +1 -1
- 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/postprocess/nss/NSS.d.ts +1 -1
- 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/rasterize/native/avboit/AVBOITSideChannel.d.ts +3 -2
- package/src/shade/renderer/rasterize/native/avboit/AVBOITSideChannel.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/native/avboit/AVBOITSideChannel.js +3 -2
- package/src/shade/renderer/scene/GPUSceneContext.d.ts +9 -1
- package/src/shade/renderer/scene/GPUSceneContext.d.ts.map +1 -1
- package/src/shade/renderer/scene/GPUSceneContext.js +23 -1
- package/src/shade/renderer/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/volumetrics/GPUViewVolumetrics.d.ts +4 -1
- package/src/shade/renderer/volumetrics/GPUViewVolumetrics.d.ts.map +1 -1
- package/src/shade/renderer/volumetrics/GPUViewVolumetrics.js +74 -3
- package/src/shade/renderer/volumetrics/NOTES.md +1023 -957
- package/src/shade/renderer/volumetrics/chunk_volumetrics_irradiance_sh.d.ts +5 -4
- package/src/shade/renderer/volumetrics/chunk_volumetrics_irradiance_sh.d.ts.map +1 -1
- package/src/shade/renderer/volumetrics/chunk_volumetrics_irradiance_sh.js +5 -4
- package/src/shade/renderer/volumetrics/gi/chunk_volumetrics_gi.d.ts +1 -1
- package/src/shade/renderer/volumetrics/gi/chunk_volumetrics_gi.js +1 -1
- package/src/shade/renderer/volumetrics/gi/graph_build_froxel_gi.d.ts +1 -1
- package/src/shade/renderer/volumetrics/gi/graph_build_froxel_gi.js +1 -1
- package/src/shade/renderer/volumetrics/graph_build_froxel_irradiance.d.ts +41 -0
- package/src/shade/renderer/volumetrics/graph_build_froxel_irradiance.d.ts.map +1 -0
- package/src/shade/renderer/volumetrics/graph_build_froxel_irradiance.js +112 -0
- package/src/shade/renderer/volumetrics/graph_build_volumetrics.d.ts +9 -23
- package/src/shade/renderer/volumetrics/graph_build_volumetrics.d.ts.map +1 -1
- package/src/shade/renderer/volumetrics/graph_build_volumetrics.js +18 -126
- package/src/shade/renderer/volumetrics/shader_volumetrics_build_irradiance.d.ts +22 -0
- package/src/shade/renderer/volumetrics/shader_volumetrics_build_irradiance.d.ts.map +1 -0
- package/src/shade/renderer/volumetrics/shader_volumetrics_build_irradiance.js +228 -0
- package/src/shade/renderer/volumetrics/shader_volumetrics_build_lighting.d.ts.map +1 -1
- package/src/shade/renderer/volumetrics/shader_volumetrics_build_lighting.js +0 -53
- package/src/shade/renderer/water/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/chunk_water_surface_sample.d.ts +4 -3
- package/src/shade/renderer/water/surface/chunk_water_surface_sample.d.ts.map +1 -1
- package/src/shade/renderer/water/surface/chunk_water_surface_sample.js +17 -7
- 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 +93 -30
- package/src/shade/renderer/water/surface/particles/WATER_PARTICLE_STRUCT.d.ts.map +1 -1
- package/src/shade/renderer/water/surface/particles/WATER_PARTICLE_STRUCT.js +13 -5
- package/src/shade/renderer/water/surface/particles/chunk_water_particle.d.ts +29 -8
- package/src/shade/renderer/water/surface/particles/chunk_water_particle.d.ts.map +1 -1
- package/src/shade/renderer/water/surface/particles/chunk_water_particle.js +155 -30
- package/src/shade/renderer/water/surface/particles/chunk_water_particle_step.d.ts +6 -1
- package/src/shade/renderer/water/surface/particles/chunk_water_particle_step.d.ts.map +1 -1
- package/src/shade/renderer/water/surface/particles/chunk_water_particle_step.js +157 -39
- package/src/shade/renderer/water/surface/particles/shader_water_particles.d.ts +91 -21
- package/src/shade/renderer/water/surface/particles/shader_water_particles.d.ts.map +1 -1
- package/src/shade/renderer/water/surface/particles/shader_water_particles.js +442 -70
- package/src/shade/wgsl/emulator/WGSLJavaScriptCompiler.js +11 -3
- package/src/shade/wgsl/emulator/WGSLLanguageCore.d.ts.map +1 -1
- package/src/shade/wgsl/emulator/WGSLLanguageCore.js +3 -0
- 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,608 @@
|
|
|
1
|
+
import { quat3_multiply, quat3_multiply_array } from "../../../../core/geom/3d/quaternion/quat3_multiply.js";
|
|
2
|
+
import { v3_quaternion_apply_array } from "../../../../core/geom/vec3/v3_quaternion_apply.js";
|
|
3
|
+
import { v3_quaternion_apply_inverse_array } from "../../../../core/geom/vec3/v3_quaternion_apply_inverse.js";
|
|
4
|
+
import { CLOTH_PARTICLE_MASS, CLOTH_SLACK_REACH } from "./cloth_build_rows.js";
|
|
5
|
+
import { cloth_geodesic_field } from "./cloth_geodesic.js";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* # What holding a particle does to a cloth
|
|
9
|
+
*
|
|
10
|
+
* A {@link ClothPin} holds particles, and that one fact decides four things the
|
|
11
|
+
* rows depend on. This module is where they are decided, once per change in
|
|
12
|
+
* what is held ({@link cloth_apply_holds}) and once per step
|
|
13
|
+
* ({@link cloth_hold_step}):
|
|
14
|
+
*
|
|
15
|
+
* - **Who is kinematic.** A held particle has inverse mass zero and follows its
|
|
16
|
+
* holder: the solver carries it through the step towards
|
|
17
|
+
* `ClothState#kinematic_target`.
|
|
18
|
+
* - **What each free particle hangs from.** Its nearest held particle, along the
|
|
19
|
+
* fabric — one multi-source Dijkstra over the stretch edges, every held
|
|
20
|
+
* particle a source, so a path never runs through one held particle to reach
|
|
21
|
+
* another. Nothing held in reach means nothing to hang from.
|
|
22
|
+
* - **The tether and the slack**, §6's two leash rows, both measured from that
|
|
23
|
+
* particle (`ClothState#leash_source`), so that they follow it through the step
|
|
24
|
+
* rather than lag a step behind it. One tether per particle, to the nearest
|
|
25
|
+
* hold only: two hard tethers to two holders pulled apart are two bounds no
|
|
26
|
+
* position satisfies, and the fabric between them already says everything a
|
|
27
|
+
* second tether could.
|
|
28
|
+
* - **The animated pose**, which is the rest pose hung from that particle and
|
|
29
|
+
* turned by its holder — see `ClothInstance#animated_position`.
|
|
30
|
+
*
|
|
31
|
+
* A particle nothing held reaches gets a tether and a slack row of radius
|
|
32
|
+
* `Infinity`, which say nothing, and a cloth nothing holds is all such
|
|
33
|
+
* particles: there is no case here for it.
|
|
34
|
+
*
|
|
35
|
+
* ## The tether never pulls
|
|
36
|
+
*
|
|
37
|
+
* A hold that begins mid-run — a hand closing on a falling ribbon — begins
|
|
38
|
+
* wherever the fabric is, and a free configuration is routinely further from
|
|
39
|
+
* the new hold than the geodesic, because the fabric stretches and the tether
|
|
40
|
+
* only binds when something pulls. A tether switched on at its full tightness
|
|
41
|
+
* would snap the cloth onto the hold inside one step. So a tether's radius
|
|
42
|
+
* starts at the larger of `d_geo` and where the particle is, and each step comes
|
|
43
|
+
* down to wherever the particle has since come to, never below `d_geo`: it
|
|
44
|
+
* stops a particle going further than it has been since the hold began, and
|
|
45
|
+
* it never drags one in. A cloth seeded at rest is inside `d_geo` everywhere,
|
|
46
|
+
* so its tethers are `d_geo` from the first step, which is what they always
|
|
47
|
+
* were — and only a tether that began loose is looked at again, so a cloth
|
|
48
|
+
* whose holds have not changed pays nothing for it.
|
|
49
|
+
*
|
|
50
|
+
* @author Alex Goldring
|
|
51
|
+
* @copyright Company Named Limited (c) 2026
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Take a hold's offsets: each of its particles relative to the holder, in the
|
|
56
|
+
* holder's own frame, from where the particle is now.
|
|
57
|
+
*
|
|
58
|
+
* Done in world terms, because the particles are in the frame they were last
|
|
59
|
+
* stepped in and the holder is where it is this step; the two meet in the
|
|
60
|
+
* world. The holder's turn is then measured from its pose in this step's frame,
|
|
61
|
+
* {@link ClothHold#pose}, so a hold begins unturned.
|
|
62
|
+
*
|
|
63
|
+
* @param {ClothInstance} instance
|
|
64
|
+
* @param {ClothHold} hold with {@link ClothHold#world} and {@link ClothHold#pose}
|
|
65
|
+
* this step's
|
|
66
|
+
* @param {Float64Array} frame_translation the frame the particle positions are in
|
|
67
|
+
* @param {Float64Array} frame_rotation
|
|
68
|
+
* @returns {void}
|
|
69
|
+
*/
|
|
70
|
+
export function cloth_capture_hold(instance, hold, frame_translation, frame_rotation) {
|
|
71
|
+
const particles = hold.pin.particles;
|
|
72
|
+
const count = particles.length;
|
|
73
|
+
|
|
74
|
+
const state = instance.state;
|
|
75
|
+
const position = state.position;
|
|
76
|
+
const particle_of_node = instance.particle_of_node;
|
|
77
|
+
const node_count = instance.node_count;
|
|
78
|
+
|
|
79
|
+
const offset = new Float64Array(count * 3);
|
|
80
|
+
|
|
81
|
+
const world = hold.world;
|
|
82
|
+
|
|
83
|
+
for (let k = 0; k < count; k++) {
|
|
84
|
+
const node = particles[k];
|
|
85
|
+
|
|
86
|
+
if (node < 0 || node >= node_count) {
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const p = particle_of_node[node] * 3;
|
|
91
|
+
|
|
92
|
+
// the particle in the world
|
|
93
|
+
v3_quaternion_apply_array(SCRATCH, 0, position, p, frame_rotation, 0);
|
|
94
|
+
|
|
95
|
+
SCRATCH[0] += frame_translation[0] - world[0];
|
|
96
|
+
SCRATCH[1] += frame_translation[1] - world[1];
|
|
97
|
+
SCRATCH[2] += frame_translation[2] - world[2];
|
|
98
|
+
|
|
99
|
+
// relative to the holder, in its frame
|
|
100
|
+
v3_quaternion_apply_inverse_array(offset, k * 3, SCRATCH, 0, world, 3);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
hold.offset = offset;
|
|
104
|
+
|
|
105
|
+
const pose = hold.pose;
|
|
106
|
+
|
|
107
|
+
hold.rotation_at_hold[0] = pose[3];
|
|
108
|
+
hold.rotation_at_hold[1] = pose[4];
|
|
109
|
+
hold.rotation_at_hold[2] = pose[5];
|
|
110
|
+
hold.rotation_at_hold[3] = pose[6];
|
|
111
|
+
|
|
112
|
+
hold.captured = true;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Re-derive everything that depends on what is held: who is kinematic, what
|
|
117
|
+
* each free particle hangs from, the leash rows, and `reach`.
|
|
118
|
+
*
|
|
119
|
+
* Called once a seed and once per change in the set of holds — never per step.
|
|
120
|
+
* Writes into the instance's existing `ClothState`; nothing is re-built, so a
|
|
121
|
+
* worker that holds the buffer sees it on the next step without a second
|
|
122
|
+
* registration.
|
|
123
|
+
*
|
|
124
|
+
* @param {ClothInstance} instance
|
|
125
|
+
* @returns {void}
|
|
126
|
+
*/
|
|
127
|
+
export function cloth_apply_holds(instance) {
|
|
128
|
+
const node_count = instance.node_count;
|
|
129
|
+
|
|
130
|
+
const state = instance.state;
|
|
131
|
+
const particle_of_node = instance.particle_of_node;
|
|
132
|
+
|
|
133
|
+
const node_hold = instance.node_hold;
|
|
134
|
+
const node_hold_slot = instance.node_hold_slot;
|
|
135
|
+
|
|
136
|
+
node_hold.fill(-1);
|
|
137
|
+
node_hold_slot.fill(-1);
|
|
138
|
+
|
|
139
|
+
const holds = instance.holds;
|
|
140
|
+
|
|
141
|
+
const sources = [];
|
|
142
|
+
|
|
143
|
+
// In holder order, so a particle two pins name goes to the lower holder,
|
|
144
|
+
// every time — `ClothWorld` sorts them and says so once.
|
|
145
|
+
for (let h = 0; h < holds.length; h++) {
|
|
146
|
+
const hold = holds[h];
|
|
147
|
+
|
|
148
|
+
if (!hold.captured) {
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
const particles = hold.pin.particles;
|
|
153
|
+
|
|
154
|
+
for (let k = 0; k < particles.length; k++) {
|
|
155
|
+
const node = particles[k];
|
|
156
|
+
|
|
157
|
+
if (node < 0 || node >= node_count || node_hold[node] !== -1) {
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
node_hold[node] = h;
|
|
162
|
+
node_hold_slot[node] = k;
|
|
163
|
+
|
|
164
|
+
sources.push(node);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
const mass_inverse = state.mass_inverse;
|
|
169
|
+
|
|
170
|
+
for (let node = 0; node < node_count; node++) {
|
|
171
|
+
mass_inverse[particle_of_node[node]] = node_hold[node] === -1 ? 1 / CLOTH_PARTICLE_MASS : 0;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
const distance = SCRATCH_DISTANCE.length >= node_count ? SCRATCH_DISTANCE : (SCRATCH_DISTANCE = new Float64Array(node_count));
|
|
175
|
+
|
|
176
|
+
const nearest = instance.tether_source;
|
|
177
|
+
|
|
178
|
+
cloth_geodesic_field(
|
|
179
|
+
distance, nearest,
|
|
180
|
+
node_count, instance.edge, instance.edge_length, instance.edge_incidence,
|
|
181
|
+
sources, sources.length,
|
|
182
|
+
null
|
|
183
|
+
);
|
|
184
|
+
|
|
185
|
+
const geodesic = instance.geodesic;
|
|
186
|
+
|
|
187
|
+
let reach = 0;
|
|
188
|
+
|
|
189
|
+
const rest = instance.rest_position;
|
|
190
|
+
|
|
191
|
+
for (let node = 0; node < node_count; node++) {
|
|
192
|
+
const d = distance[node];
|
|
193
|
+
|
|
194
|
+
geodesic[node] = d;
|
|
195
|
+
|
|
196
|
+
// what this node hangs from: its hold, or — nothing reaching it — the frame
|
|
197
|
+
const hang = d < Infinity
|
|
198
|
+
? d
|
|
199
|
+
: Math.hypot(rest[node * 3], rest[node * 3 + 1], rest[node * 3 + 2]);
|
|
200
|
+
|
|
201
|
+
if (hang > reach) {
|
|
202
|
+
reach = hang;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
instance.reach = reach;
|
|
207
|
+
|
|
208
|
+
// The one length a cloth with no rows carries.
|
|
209
|
+
if (!(instance.shortest_row < Infinity)) {
|
|
210
|
+
instance.shortest_row = reach;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
const slack_scale = CLOTH_SLACK_REACH * clamp01(instance.cloth.dynamics.slack);
|
|
214
|
+
|
|
215
|
+
const position = state.position;
|
|
216
|
+
|
|
217
|
+
const leash_source = state.leash_source;
|
|
218
|
+
const leash_offset = state.leash_offset;
|
|
219
|
+
const leash_radius = state.leash_radius;
|
|
220
|
+
const leash_lambda = state.leash_lambda;
|
|
221
|
+
|
|
222
|
+
const loose = instance.tether_loose;
|
|
223
|
+
|
|
224
|
+
loose.fill(0);
|
|
225
|
+
|
|
226
|
+
let loose_count = 0;
|
|
227
|
+
|
|
228
|
+
for (let node = 0; node < node_count; node++) {
|
|
229
|
+
const tether = instance.tether_row[node];
|
|
230
|
+
const slack = instance.slack_row[node];
|
|
231
|
+
|
|
232
|
+
const source = node_hold[node] === -1 ? nearest[node] : -1;
|
|
233
|
+
|
|
234
|
+
const d = geodesic[node];
|
|
235
|
+
|
|
236
|
+
// A multiplier describes a force towards whatever the row was measured
|
|
237
|
+
// from, and that may have just changed.
|
|
238
|
+
leash_lambda[tether] = 0;
|
|
239
|
+
|
|
240
|
+
if (slack >= 0) {
|
|
241
|
+
leash_lambda[slack] = 0;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
if (source < 0) {
|
|
245
|
+
leash_source[tether] = -1;
|
|
246
|
+
leash_radius[tether] = Infinity;
|
|
247
|
+
|
|
248
|
+
if (slack >= 0) {
|
|
249
|
+
leash_source[slack] = -1;
|
|
250
|
+
leash_radius[slack] = Infinity;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
continue;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
const p = particle_of_node[node] * 3;
|
|
257
|
+
const q = particle_of_node[source] * 3;
|
|
258
|
+
|
|
259
|
+
leash_source[tether] = particle_of_node[source];
|
|
260
|
+
leash_offset[tether * 3] = 0;
|
|
261
|
+
leash_offset[tether * 3 + 1] = 0;
|
|
262
|
+
leash_offset[tether * 3 + 2] = 0;
|
|
263
|
+
|
|
264
|
+
// §7 P2's bound, from wherever the particle is if that is further — see
|
|
265
|
+
// the module docblock.
|
|
266
|
+
const current = Math.hypot(
|
|
267
|
+
position[p] - position[q],
|
|
268
|
+
position[p + 1] - position[q + 1],
|
|
269
|
+
position[p + 2] - position[q + 2]
|
|
270
|
+
);
|
|
271
|
+
|
|
272
|
+
if (current > d) {
|
|
273
|
+
leash_radius[tether] = current;
|
|
274
|
+
|
|
275
|
+
loose[node] = 1;
|
|
276
|
+
loose_count++;
|
|
277
|
+
} else {
|
|
278
|
+
leash_radius[tether] = d;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
if (slack >= 0) {
|
|
282
|
+
leash_source[slack] = particle_of_node[source];
|
|
283
|
+
leash_radius[slack] = slack_scale * d;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
instance.tether_loose_count = loose_count;
|
|
288
|
+
|
|
289
|
+
// everything the per-step pass derives is stale now
|
|
290
|
+
instance.holds_dirty = true;
|
|
291
|
+
|
|
292
|
+
if (instance.hold_turn.length < holds.length * 4) {
|
|
293
|
+
instance.hold_turn = new Float64Array(holds.length * 4);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Everything a hold changes per step: where each held particle is to be, the
|
|
299
|
+
* animated pose hung from them, the leash centres and the tethers' ratchet.
|
|
300
|
+
*
|
|
301
|
+
* Reads each hold's {@link ClothHold#pose} — the holder in this step's frame —
|
|
302
|
+
* and the particle positions as the frame carry left them.
|
|
303
|
+
*
|
|
304
|
+
* **Nothing is recomputed that cannot have changed.** Every quantity here
|
|
305
|
+
* except the ratchet is a function of the holds' poses in the frame, and a
|
|
306
|
+
* holder riding the frame — a rope's own top, a cape's shoulder in a cape riding
|
|
307
|
+
* that shoulder — has the same pose in it every step however the frame moves.
|
|
308
|
+
* So when no hold has moved in the frame since the last step, and nothing has
|
|
309
|
+
* rewritten the particles since ({@link ClothInstance#holds_dirty}), the
|
|
310
|
+
* targets, the animated pose and the leash offsets are left as they are: the
|
|
311
|
+
* question is a fact the step already has, not a kind of cloth.
|
|
312
|
+
*
|
|
313
|
+
* @param {ClothInstance} instance
|
|
314
|
+
* @returns {void}
|
|
315
|
+
*/
|
|
316
|
+
export function cloth_hold_step(instance) {
|
|
317
|
+
if (!instance.holds_dirty && holds_still(instance.holds)) {
|
|
318
|
+
// Every held particle arrived on its target at the end of the last step
|
|
319
|
+
// and nothing has moved it since, so none travels this one.
|
|
320
|
+
instance.kinematic_travel = 0;
|
|
321
|
+
|
|
322
|
+
cloth_tether_ratchet(instance);
|
|
323
|
+
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
instance.holds_dirty = false;
|
|
328
|
+
|
|
329
|
+
const node_count = instance.node_count;
|
|
330
|
+
|
|
331
|
+
const state = instance.state;
|
|
332
|
+
const position = state.position;
|
|
333
|
+
const particle_of_node = instance.particle_of_node;
|
|
334
|
+
|
|
335
|
+
const holds = instance.holds;
|
|
336
|
+
const node_hold = instance.node_hold;
|
|
337
|
+
const node_hold_slot = instance.node_hold_slot;
|
|
338
|
+
|
|
339
|
+
const turn = instance.hold_turn;
|
|
340
|
+
|
|
341
|
+
// Each holder's turn since its hold began, once per hold.
|
|
342
|
+
for (let h = 0; h < holds.length; h++) {
|
|
343
|
+
const hold = holds[h];
|
|
344
|
+
const at = hold.rotation_at_hold;
|
|
345
|
+
const pose = hold.pose;
|
|
346
|
+
|
|
347
|
+
quat3_multiply(
|
|
348
|
+
turn, h * 4,
|
|
349
|
+
pose[3], pose[4], pose[5], pose[6],
|
|
350
|
+
-at[0], -at[1], -at[2], at[3]
|
|
351
|
+
);
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
const target = instance.held_target;
|
|
355
|
+
const kinematic = state.kinematic_target;
|
|
356
|
+
|
|
357
|
+
let travel = 0;
|
|
358
|
+
|
|
359
|
+
for (let node = 0; node < node_count; node++) {
|
|
360
|
+
const h = node_hold[node];
|
|
361
|
+
|
|
362
|
+
if (h === -1) {
|
|
363
|
+
continue;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
const hold = holds[h];
|
|
367
|
+
const pose = hold.pose;
|
|
368
|
+
|
|
369
|
+
const n = node * 3;
|
|
370
|
+
|
|
371
|
+
v3_quaternion_apply_array(target, n, hold.offset, node_hold_slot[node] * 3, pose, 3);
|
|
372
|
+
|
|
373
|
+
target[n] += pose[0];
|
|
374
|
+
target[n + 1] += pose[1];
|
|
375
|
+
target[n + 2] += pose[2];
|
|
376
|
+
|
|
377
|
+
const p = particle_of_node[node] * 3;
|
|
378
|
+
|
|
379
|
+
kinematic[p] = target[n];
|
|
380
|
+
kinematic[p + 1] = target[n + 1];
|
|
381
|
+
kinematic[p + 2] = target[n + 2];
|
|
382
|
+
|
|
383
|
+
const moved = Math.hypot(target[n] - position[p], target[n + 1] - position[p + 1], target[n + 2] - position[p + 2]);
|
|
384
|
+
|
|
385
|
+
if (moved > travel) {
|
|
386
|
+
travel = moved;
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
instance.kinematic_travel = travel;
|
|
391
|
+
|
|
392
|
+
const rest = instance.rest_position;
|
|
393
|
+
const rest_rotation = instance.rest_rotation;
|
|
394
|
+
|
|
395
|
+
const animated = instance.animated_position;
|
|
396
|
+
const animated_rotation = instance.animated_rotation;
|
|
397
|
+
|
|
398
|
+
const source = instance.tether_source;
|
|
399
|
+
|
|
400
|
+
for (let node = 0; node < node_count; node++) {
|
|
401
|
+
const n = node * 3;
|
|
402
|
+
const r = node * 4;
|
|
403
|
+
|
|
404
|
+
const h = node_hold[node];
|
|
405
|
+
|
|
406
|
+
if (h !== -1) {
|
|
407
|
+
animated[n] = target[n];
|
|
408
|
+
animated[n + 1] = target[n + 1];
|
|
409
|
+
animated[n + 2] = target[n + 2];
|
|
410
|
+
|
|
411
|
+
quat3_multiply_array(animated_rotation, r, turn, h * 4, rest_rotation, r);
|
|
412
|
+
|
|
413
|
+
continue;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
const s = source[node];
|
|
417
|
+
|
|
418
|
+
if (s === -1) {
|
|
419
|
+
animated[n] = rest[n];
|
|
420
|
+
animated[n + 1] = rest[n + 1];
|
|
421
|
+
animated[n + 2] = rest[n + 2];
|
|
422
|
+
|
|
423
|
+
animated_rotation[r] = rest_rotation[r];
|
|
424
|
+
animated_rotation[r + 1] = rest_rotation[r + 1];
|
|
425
|
+
animated_rotation[r + 2] = rest_rotation[r + 2];
|
|
426
|
+
animated_rotation[r + 3] = rest_rotation[r + 3];
|
|
427
|
+
|
|
428
|
+
continue;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
// hung from its nearest held node, turned with that node's holder
|
|
432
|
+
const t = node_hold[s] * 4;
|
|
433
|
+
|
|
434
|
+
const m = s * 3;
|
|
435
|
+
|
|
436
|
+
SCRATCH[0] = rest[n] - rest[m];
|
|
437
|
+
SCRATCH[1] = rest[n + 1] - rest[m + 1];
|
|
438
|
+
SCRATCH[2] = rest[n + 2] - rest[m + 2];
|
|
439
|
+
|
|
440
|
+
v3_quaternion_apply_array(animated, n, SCRATCH, 0, turn, t);
|
|
441
|
+
|
|
442
|
+
animated[n] += target[m];
|
|
443
|
+
animated[n + 1] += target[m + 1];
|
|
444
|
+
animated[n + 2] += target[m + 2];
|
|
445
|
+
|
|
446
|
+
quat3_multiply_array(animated_rotation, r, turn, t, rest_rotation, r);
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
const leash_target = state.leash_target;
|
|
450
|
+
const leash_offset = state.leash_offset;
|
|
451
|
+
|
|
452
|
+
for (let node = 0; node < node_count; node++) {
|
|
453
|
+
const tether = instance.tether_row[node];
|
|
454
|
+
const slack = instance.slack_row[node];
|
|
455
|
+
|
|
456
|
+
const n = node * 3;
|
|
457
|
+
|
|
458
|
+
const s = node_hold[node] === -1 ? source[node] : -1;
|
|
459
|
+
|
|
460
|
+
if (s === -1) {
|
|
461
|
+
// Unbounded rows, measured from somewhere finite.
|
|
462
|
+
leash_target[tether * 3] = animated[n];
|
|
463
|
+
leash_target[tether * 3 + 1] = animated[n + 1];
|
|
464
|
+
leash_target[tether * 3 + 2] = animated[n + 2];
|
|
465
|
+
|
|
466
|
+
if (slack >= 0) {
|
|
467
|
+
leash_target[slack * 3] = animated[n];
|
|
468
|
+
leash_target[slack * 3 + 1] = animated[n + 1];
|
|
469
|
+
leash_target[slack * 3 + 2] = animated[n + 2];
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
continue;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
const m = s * 3;
|
|
476
|
+
|
|
477
|
+
if (slack >= 0) {
|
|
478
|
+
leash_offset[slack * 3] = animated[n] - target[m];
|
|
479
|
+
leash_offset[slack * 3 + 1] = animated[n + 1] - target[m + 1];
|
|
480
|
+
leash_offset[slack * 3 + 2] = animated[n + 2] - target[m + 2];
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
cloth_tether_ratchet(instance);
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
/**
|
|
488
|
+
* Whether every hold is where it was in the frame a step ago.
|
|
489
|
+
*
|
|
490
|
+
* @param {ClothHold[]} holds
|
|
491
|
+
* @returns {boolean}
|
|
492
|
+
* @private
|
|
493
|
+
*/
|
|
494
|
+
function holds_still(holds) {
|
|
495
|
+
for (let h = 0; h < holds.length; h++) {
|
|
496
|
+
const hold = holds[h];
|
|
497
|
+
|
|
498
|
+
if (!hold.has_previous) {
|
|
499
|
+
return false;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
const pose = hold.pose;
|
|
503
|
+
const before = hold.pose_previous;
|
|
504
|
+
|
|
505
|
+
for (let i = 0; i < 7; i++) {
|
|
506
|
+
if (pose[i] !== before[i]) {
|
|
507
|
+
return false;
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
return true;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
/**
|
|
516
|
+
* Bring every tether that began loose down to wherever its particle has come
|
|
517
|
+
* to, never below `d_geo` and never up — see the module docblock. A cloth with
|
|
518
|
+
* none loose pays for the test and nothing else.
|
|
519
|
+
*
|
|
520
|
+
* @param {ClothInstance} instance
|
|
521
|
+
* @private
|
|
522
|
+
*/
|
|
523
|
+
function cloth_tether_ratchet(instance) {
|
|
524
|
+
if (instance.tether_loose_count === 0) {
|
|
525
|
+
return;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
const node_count = instance.node_count;
|
|
529
|
+
|
|
530
|
+
const state = instance.state;
|
|
531
|
+
const position = state.position;
|
|
532
|
+
const leash_radius = state.leash_radius;
|
|
533
|
+
|
|
534
|
+
const particle_of_node = instance.particle_of_node;
|
|
535
|
+
const node_hold = instance.node_hold;
|
|
536
|
+
const source = instance.tether_source;
|
|
537
|
+
const geodesic = instance.geodesic;
|
|
538
|
+
const loose = instance.tether_loose;
|
|
539
|
+
|
|
540
|
+
for (let node = 0; node < node_count; node++) {
|
|
541
|
+
if (loose[node] === 0) {
|
|
542
|
+
continue;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
const s = node_hold[node] === -1 ? source[node] : -1;
|
|
546
|
+
|
|
547
|
+
if (s === -1) {
|
|
548
|
+
// held since, or cut off from every hold: nothing to bring in
|
|
549
|
+
loose[node] = 0;
|
|
550
|
+
|
|
551
|
+
instance.tether_loose_count--;
|
|
552
|
+
|
|
553
|
+
continue;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
const tether = instance.tether_row[node];
|
|
557
|
+
|
|
558
|
+
// The ratchet: down to wherever the particle has come to, never below
|
|
559
|
+
// d_geo, never up.
|
|
560
|
+
const p = particle_of_node[node] * 3;
|
|
561
|
+
const q = particle_of_node[s] * 3;
|
|
562
|
+
|
|
563
|
+
const current = Math.hypot(
|
|
564
|
+
position[p] - position[q],
|
|
565
|
+
position[p + 1] - position[q + 1],
|
|
566
|
+
position[p + 2] - position[q + 2]
|
|
567
|
+
);
|
|
568
|
+
|
|
569
|
+
const d = geodesic[node];
|
|
570
|
+
|
|
571
|
+
const radius = leash_radius[tether];
|
|
572
|
+
|
|
573
|
+
const tightened = current < radius ? current : radius;
|
|
574
|
+
|
|
575
|
+
if (tightened > d) {
|
|
576
|
+
leash_radius[tether] = tightened;
|
|
577
|
+
} else {
|
|
578
|
+
leash_radius[tether] = d;
|
|
579
|
+
|
|
580
|
+
loose[node] = 0;
|
|
581
|
+
|
|
582
|
+
instance.tether_loose_count--;
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
/**
|
|
588
|
+
* @param {number} v
|
|
589
|
+
* @returns {number}
|
|
590
|
+
* @private
|
|
591
|
+
*/
|
|
592
|
+
function clamp01(v) {
|
|
593
|
+
return v < 0 ? 0 : (v > 1 ? 1 : v);
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
/**
|
|
597
|
+
* @type {Float64Array}
|
|
598
|
+
* @private
|
|
599
|
+
*/
|
|
600
|
+
const SCRATCH = new Float64Array(3);
|
|
601
|
+
|
|
602
|
+
|
|
603
|
+
/**
|
|
604
|
+
* The geodesic field's distances, in double, grown to the largest cloth seen.
|
|
605
|
+
* @type {Float64Array}
|
|
606
|
+
* @private
|
|
607
|
+
*/
|
|
608
|
+
let SCRATCH_DISTANCE = new Float64Array(0);
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Both are in the **cloth's own frame**: the position is the particle lerped
|
|
5
5
|
* towards its animated one by `Cloth#blend`, and the rotation is the swing
|
|
6
|
-
* composed onto the animated orientation.
|
|
7
|
-
*
|
|
6
|
+
* composed onto the animated orientation. A root of the seeder's tree has no
|
|
7
|
+
* link above it and takes its children's swing alone.
|
|
8
8
|
*
|
|
9
9
|
* @param {ClothInstance} instance
|
|
10
10
|
* @returns {void}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloth_reconstruct_pose.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/physics/cloth/ecs/cloth_reconstruct_pose.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cloth_reconstruct_pose.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/physics/cloth/ecs/cloth_reconstruct_pose.js"],"names":[],"mappings":"AA6EA;;;;;;;;;;GAUG;AACH,iEAFa,IAAI,CAyEhB"}
|