@woosh/meep-engine 3.44.0 → 3.45.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/bundle-worker-terrain.js +1 -1
- package/package.json +1 -1
- package/src/core/collection/array/array_sort_insertion_ascending.d.ts +19 -0
- package/src/core/collection/array/array_sort_insertion_ascending.d.ts.map +1 -0
- package/src/core/collection/array/array_sort_insertion_ascending.js +31 -0
- package/src/core/geom/3d/aabb/aabb3_array_round_outward_f32.d.ts +27 -0
- package/src/core/geom/3d/aabb/aabb3_array_round_outward_f32.d.ts.map +1 -0
- package/src/core/geom/3d/aabb/aabb3_array_round_outward_f32.js +39 -0
- package/src/core/geom/3d/aabb/aabb3_from_v3_array.d.ts.map +1 -1
- package/src/core/geom/3d/aabb/aabb3_from_v3_array.js +4 -1
- package/src/core/geom/3d/aabb/aabb3_transform_oriented.d.ts +2 -2
- package/src/core/geom/3d/aabb/aabb3_transform_oriented.d.ts.map +1 -1
- package/src/core/geom/3d/aabb/aabb3_transform_oriented.js +1 -1
- package/src/core/geom/3d/pose/pose3_apply_inverse_point_array.d.ts +21 -0
- package/src/core/geom/3d/pose/pose3_apply_inverse_point_array.d.ts.map +1 -0
- package/src/core/geom/3d/pose/pose3_apply_inverse_point_array.js +36 -0
- package/src/core/geom/3d/pose/pose3_apply_point_array.d.ts +25 -0
- package/src/core/geom/3d/pose/pose3_apply_point_array.d.ts.map +1 -0
- package/src/core/geom/3d/pose/pose3_apply_point_array.js +40 -0
- package/src/core/geom/3d/pose/pose3_compose_array.d.ts +28 -0
- package/src/core/geom/3d/pose/pose3_compose_array.d.ts.map +1 -0
- package/src/core/geom/3d/pose/pose3_compose_array.js +41 -0
- package/src/core/geom/3d/pose/pose3_to_local_array.d.ts +29 -0
- package/src/core/geom/3d/pose/pose3_to_local_array.d.ts.map +1 -0
- package/src/core/geom/3d/pose/pose3_to_local_array.js +42 -0
- package/src/core/geom/3d/quaternion/quat3_clamp_angle_array.d.ts +28 -0
- package/src/core/geom/3d/quaternion/quat3_clamp_angle_array.d.ts.map +1 -0
- package/src/core/geom/3d/quaternion/quat3_clamp_angle_array.js +66 -0
- package/src/core/geom/3d/quaternion/quat3_multiply_conjugate_left_array.d.ts +22 -0
- package/src/core/geom/3d/quaternion/quat3_multiply_conjugate_left_array.d.ts.map +1 -0
- package/src/core/geom/3d/quaternion/quat3_multiply_conjugate_left_array.js +30 -0
- package/src/core/geom/3d/quaternion/quat3_multiply_conjugate_right_array.d.ts +23 -0
- package/src/core/geom/3d/quaternion/quat3_multiply_conjugate_right_array.d.ts.map +1 -0
- package/src/core/geom/3d/quaternion/quat3_multiply_conjugate_right_array.js +31 -0
- package/src/core/geom/3d/triangle/tri3_compute_normal_area_weighted_array.d.ts +26 -0
- package/src/core/geom/3d/triangle/tri3_compute_normal_area_weighted_array.d.ts.map +1 -0
- package/src/core/geom/3d/triangle/tri3_compute_normal_area_weighted_array.js +46 -0
- package/src/core/geom/vec3/v3_distance_array.d.ts +11 -0
- package/src/core/geom/vec3/v3_distance_array.d.ts.map +1 -0
- package/src/core/geom/vec3/v3_distance_array.js +19 -0
- package/src/core/geom/vec3/v3_normalize_array_checked.d.ts +23 -0
- package/src/core/geom/vec3/v3_normalize_array_checked.d.ts.map +1 -0
- package/src/core/geom/vec3/v3_normalize_array_checked.js +49 -0
- package/src/core/geom/vec3/v3_reject_array.d.ts +15 -0
- package/src/core/geom/vec3/v3_reject_array.d.ts.map +1 -0
- package/src/core/geom/vec3/v3_reject_array.js +32 -0
- package/src/core/graph/csr/csr_build_incidence.d.ts +26 -0
- package/src/core/graph/csr/csr_build_incidence.d.ts.map +1 -0
- package/src/core/graph/csr/csr_build_incidence.js +71 -0
- package/src/core/graph/csr/csr_graph_color_greedy.d.ts +25 -0
- package/src/core/graph/csr/csr_graph_color_greedy.d.ts.map +1 -0
- package/src/core/graph/csr/csr_graph_color_greedy.js +83 -0
- package/src/core/graph/csr/csr_graph_validate_coloring.d.ts +15 -0
- package/src/core/graph/csr/csr_graph_validate_coloring.d.ts.map +1 -0
- package/src/core/graph/csr/csr_graph_validate_coloring.js +33 -0
- package/src/core/math/linalg/matrix_symmetric_3x3_solve_ldlt.d.ts +26 -0
- package/src/core/math/linalg/matrix_symmetric_3x3_solve_ldlt.d.ts.map +1 -0
- package/src/core/math/linalg/matrix_symmetric_3x3_solve_ldlt.js +71 -0
- package/src/core/math/max2_exact.d.ts +15 -0
- package/src/core/math/max2_exact.d.ts.map +1 -0
- package/src/core/math/max2_exact.js +30 -0
- package/src/core/math/min2_exact.d.ts +20 -0
- package/src/core/math/min2_exact.d.ts.map +1 -0
- package/src/core/math/min2_exact.js +35 -0
- package/src/engine/ecs/ik/IKGoalSystem.d.ts.map +1 -1
- package/src/engine/ecs/ik/IKGoalSystem.js +3 -19
- package/src/engine/ecs/parent/parent_entity_model_of.d.ts +17 -0
- package/src/engine/ecs/parent/parent_entity_model_of.d.ts.map +1 -0
- package/src/engine/ecs/parent/parent_entity_model_of.js +26 -0
- package/src/engine/ecs/transform/t64_read_pose_array.d.ts +15 -0
- package/src/engine/ecs/transform/t64_read_pose_array.d.ts.map +1 -0
- package/src/engine/ecs/transform/t64_read_pose_array.js +24 -0
- package/src/engine/graphics/geometry/geometry_construct_triangle_normal_area_weighted.d.ts +2 -0
- package/src/engine/graphics/geometry/geometry_construct_triangle_normal_area_weighted.d.ts.map +1 -1
- package/src/engine/graphics/geometry/geometry_construct_triangle_normal_area_weighted.js +10 -21
- package/src/engine/graphics3/AnimationGraphSystem.d.ts +5 -0
- package/src/engine/graphics3/AnimationGraphSystem.d.ts.map +1 -1
- package/src/engine/graphics3/AnimationGraphSystem.js +48 -2
- package/src/engine/graphics3/AnimationSystem.d.ts +5 -0
- package/src/engine/graphics3/AnimationSystem.d.ts.map +1 -1
- package/src/engine/graphics3/AnimationSystem.js +47 -2
- package/src/engine/graphics3/register_clips.d.ts +29 -0
- package/src/engine/graphics3/register_clips.d.ts.map +1 -1
- package/src/engine/graphics3/register_clips.js +52 -0
- package/src/engine/physics/broadphase/compute_fat_world_aabb.d.ts +9 -0
- package/src/engine/physics/broadphase/compute_fat_world_aabb.d.ts.map +1 -1
- package/src/engine/physics/broadphase/compute_fat_world_aabb.js +3 -1
- package/src/engine/physics/cloth/PLAN.md +10 -8
- 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 -1
- package/src/engine/physics/cloth/build/cloth_bind_in_frame.js +51 -19
- 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 +16 -2
- package/src/engine/physics/cloth/build/cloth_proxy_from_mesh.d.ts.map +1 -1
- package/src/engine/physics/cloth/build/cloth_proxy_from_mesh.js +19 -24
- package/src/engine/physics/cloth/collider/ClothColliderIndex.d.ts +7 -0
- package/src/engine/physics/cloth/collider/ClothColliderIndex.d.ts.map +1 -1
- package/src/engine/physics/cloth/collider/ClothColliderIndex.js +85 -67
- package/src/engine/physics/cloth/collider/cloth_collider_bounds.d.ts.map +1 -1
- package/src/engine/physics/cloth/collider/cloth_collider_bounds.js +19 -101
- package/src/engine/physics/cloth/collider/cloth_collider_pack.d.ts +2 -5
- package/src/engine/physics/cloth/collider/cloth_collider_pack.d.ts.map +1 -1
- package/src/engine/physics/cloth/collider/cloth_collider_pack.js +7 -15
- package/src/engine/physics/cloth/collider/cloth_collider_sdf.d.ts.map +1 -1
- package/src/engine/physics/cloth/collider/cloth_collider_sdf.js +16 -61
- package/src/engine/physics/cloth/ecs/ClothColliderFlags.d.ts +0 -1
- package/src/engine/physics/cloth/ecs/ClothColliderFlags.js +6 -19
- package/src/engine/physics/cloth/ecs/ClothColliderSystem.d.ts +1 -2
- package/src/engine/physics/cloth/ecs/ClothColliderSystem.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/ClothColliderSystem.js +3 -12
- package/src/engine/physics/cloth/ecs/ClothWorld.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/ClothWorld.js +40 -130
- package/src/engine/physics/cloth/ecs/cloth_build_rows.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/cloth_build_rows.js +17 -58
- package/src/engine/physics/cloth/ecs/cloth_dynamics_map.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/cloth_dynamics_map.js +3 -3
- package/src/engine/physics/cloth/ecs/cloth_gather_colliders.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/cloth_gather_colliders.js +44 -104
- package/src/engine/physics/cloth/ecs/cloth_geodesic.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/cloth_geodesic.js +6 -13
- package/src/engine/physics/cloth/ecs/cloth_holds.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/cloth_holds.js +15 -40
- package/src/engine/physics/cloth/ecs/cloth_reconstruct_pose.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/cloth_reconstruct_pose.js +45 -79
- package/src/engine/physics/cloth/ecs/cloth_seed_subtree.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/cloth_seed_subtree.js +7 -27
- package/src/engine/physics/cloth/ecs/cloth_write_back.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/cloth_write_back.js +30 -62
- package/src/engine/physics/cloth/playground/cloth_playground_build.d.ts.map +1 -1
- package/src/engine/physics/cloth/playground/cloth_playground_build.js +2 -3
- package/src/engine/physics/cloth/playground/collide_main.js +2 -28
- package/src/engine/physics/cloth/playground/garment_main.js +4 -19
- package/src/engine/physics/cloth/playground/main.js +6 -48
- package/src/engine/physics/cloth/playground/rig_main.js +947 -955
- package/src/engine/physics/cloth/playground/wind_main.js +8 -7
- package/src/engine/physics/cloth/solver/ClothState.d.ts.map +1 -1
- package/src/engine/physics/cloth/solver/ClothState.js +16 -76
- package/src/engine/physics/cloth/solver/cloth_color_particles.d.ts +10 -8
- package/src/engine/physics/cloth/solver/cloth_color_particles.d.ts.map +1 -1
- package/src/engine/physics/cloth/solver/cloth_color_particles.js +30 -102
- package/src/engine/physics/cloth/solver/cloth_contact_find.d.ts.map +1 -1
- package/src/engine/physics/cloth/solver/cloth_contact_find.js +3 -2
- package/src/engine/physics/cloth/solver/cloth_hold_line.d.ts.map +1 -1
- package/src/engine/physics/cloth/solver/cloth_hold_line.js +2 -14
- package/src/engine/physics/cloth/solver/cloth_kinetic_energy.d.ts +21 -0
- package/src/engine/physics/cloth/solver/cloth_kinetic_energy.d.ts.map +1 -0
- package/src/engine/physics/cloth/solver/cloth_kinetic_energy.js +45 -0
- package/src/engine/physics/cloth/solver/cloth_particle_coupling.d.ts +32 -0
- package/src/engine/physics/cloth/solver/cloth_particle_coupling.d.ts.map +1 -0
- package/src/engine/physics/cloth/solver/cloth_particle_coupling.js +133 -0
- package/src/engine/physics/cloth/solver/cloth_particle_of_source.d.ts +16 -0
- package/src/engine/physics/cloth/solver/cloth_particle_of_source.d.ts.map +1 -0
- package/src/engine/physics/cloth/solver/cloth_particle_of_source.js +19 -0
- package/src/engine/physics/cloth/solver/cloth_self_find.d.ts.map +1 -1
- package/src/engine/physics/cloth/solver/cloth_self_find.js +6 -55
- package/src/engine/physics/cloth/solver/cloth_solve_vertex.d.ts.map +1 -1
- package/src/engine/physics/cloth/solver/cloth_solve_vertex.js +30 -65
- package/src/engine/physics/cloth/solver/cloth_step.d.ts.map +1 -1
- package/src/engine/physics/cloth/solver/cloth_step.js +6 -28
- package/src/engine/physics/cloth/solver/cloth_step_instance.d.ts.map +1 -1
- package/src/engine/physics/cloth/solver/cloth_step_instance.js +2 -3
- package/src/engine/physics/cloth/solver/cloth_stretch_residual.d.ts +21 -0
- package/src/engine/physics/cloth/solver/cloth_stretch_residual.d.ts.map +1 -0
- package/src/engine/physics/cloth/solver/cloth_stretch_residual.js +54 -0
- package/src/engine/physics/cloth/solver/cloth_vertex_accumulator.d.ts +15 -0
- package/src/engine/physics/cloth/solver/cloth_vertex_accumulator.d.ts.map +1 -1
- package/src/engine/physics/cloth/solver/cloth_vertex_accumulator.js +28 -0
- package/src/engine/physics/cloth/solver/cloth_worst_tether_ratio.d.ts +30 -0
- package/src/engine/physics/cloth/solver/cloth_worst_tether_ratio.d.ts.map +1 -0
- package/src/engine/physics/cloth/solver/cloth_worst_tether_ratio.js +56 -0
- package/src/engine/physics/cloth/solver/constraint/cloth_contact_row.d.ts.map +1 -1
- package/src/engine/physics/cloth/solver/constraint/cloth_contact_row.js +3 -17
- package/src/engine/physics/cloth/wind/ClothFluidWind.d.ts +2 -1
- package/src/engine/physics/cloth/wind/ClothFluidWind.d.ts.map +1 -1
- package/src/engine/physics/cloth/wind/ClothFluidWind.js +7 -25
- package/src/engine/physics/cloth/wind/cloth_sample_air.d.ts +3 -1
- package/src/engine/physics/cloth/wind/cloth_sample_air.d.ts.map +1 -1
- package/src/engine/physics/cloth/wind/cloth_sample_air.js +40 -62
- package/src/engine/physics/ecs/ContactProbeSystem.d.ts.map +1 -1
- package/src/engine/physics/ecs/ContactProbeSystem.js +2 -18
- package/src/engine/physics/ecs/PhysicsSystem.d.ts.map +1 -1
- package/src/engine/physics/ecs/PhysicsSystem.js +9 -50
- package/src/engine/physics/fluid/ecs/fluid_sample_domain_bounds.d.ts +24 -0
- package/src/engine/physics/fluid/ecs/fluid_sample_domain_bounds.d.ts.map +1 -0
- package/src/engine/physics/fluid/ecs/fluid_sample_domain_bounds.js +42 -0
- package/src/engine/physics/fluid/ecs/fluid_sample_velocity_world_mps.d.ts +25 -0
- package/src/engine/physics/fluid/ecs/fluid_sample_velocity_world_mps.d.ts.map +1 -0
- package/src/engine/physics/fluid/ecs/fluid_sample_velocity_world_mps.js +40 -0
- package/src/engine/physics/inverse_kinematics/frame_fabrik/frame_fabrik_solve.d.ts.map +1 -1
- package/src/engine/physics/inverse_kinematics/frame_fabrik/frame_fabrik_solve.js +40 -90
- package/src/engine/physics/narrowphase/capsule_contacts.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/capsule_contacts.js +3 -5
- package/src/engine/physics/narrowphase/decomposition/mesh_enumerate_triangles.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/decomposition/mesh_enumerate_triangles.js +2 -14
- package/src/engine/physics/narrowphase/hull_sphere_contact.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/hull_sphere_contact.js +2 -5
- package/src/engine/physics/narrowphase/narrowphase_step.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/narrowphase_step.js +13 -32
- package/src/engine/physics/narrowphase/sphere_box_contact.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/sphere_box_contact.js +2 -5
- package/src/format/texture/basis/transcode/etc1s_to_astc.d.ts.map +1 -1
- package/src/format/texture/basis/transcode/etc1s_to_astc.js +2 -1
- package/src/shade/playground/image_decode_bench/main.js +2 -1
- package/src/shade/playground/skinned_blas_refit/diff_traced_against_rasterized.d.ts.map +1 -1
- package/src/shade/playground/skinned_blas_refit/diff_traced_against_rasterized.js +2 -1
- package/src/shade/playground/skinned_mesh_soup/verify_clone_vertices.d.ts.map +1 -1
- package/src/shade/playground/skinned_mesh_soup/verify_clone_vertices.js +2 -1
- package/src/shade/playground/ssr_variance/statistics.d.ts.map +1 -1
- package/src/shade/playground/ssr_variance/statistics.js +2 -1
- package/src/shade/playground/texture_encode/main.d.ts.map +1 -1
- package/src/shade/playground/texture_encode/main.js +2 -1
- package/src/shade/playground/volumetrics_froxel/measure.d.ts.map +1 -1
- package/src/shade/playground/volumetrics_froxel/measure.js +2 -1
- package/src/shade/renderer/buffer/table/gpu_database_check_links.d.ts.map +1 -1
- package/src/shade/renderer/buffer/table/gpu_database_check_links.js +2 -1
- package/src/shade/renderer/geometry/virtual/build/level/vgeo_build_group_step.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/build/level/vgeo_build_group_step.js +3 -2
- package/src/shade/renderer/geometry/virtual/build/level/vgeo_build_leaf_frontier.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/build/level/vgeo_build_leaf_frontier.js +2 -1
- package/src/shade/renderer/geometry/virtual/build/level/vgeo_partition_into_groups.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/build/level/vgeo_partition_into_groups.js +2 -1
- package/src/shade/renderer/geometry/virtual/build/level/vgeo_run_round.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/build/level/vgeo_run_round.js +2 -1
- package/src/shade/renderer/geometry/virtual/build/level/vgeo_try_repack.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/build/level/vgeo_try_repack.js +3 -2
- package/src/shade/renderer/geometry/virtual/build/partition/vgeo_graph_components.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/build/partition/vgeo_graph_components.js +2 -1
- package/src/shade/renderer/geometry/virtual/build/partition/vgeo_split_face_set_packed.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/build/partition/vgeo_split_face_set_packed.js +2 -1
- package/src/shade/renderer/geometry/virtual/format/vgeo_write_container.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/format/vgeo_write_container.js +3 -2
- package/src/shade/renderer/particles/optimizer/dag/particle_vector_extract.d.ts.map +1 -1
- package/src/shade/renderer/particles/optimizer/dag/particle_vector_extract.js +3 -2
|
@@ -8,26 +8,13 @@
|
|
|
8
8
|
* @copyright Company Named Limited (c) 2026
|
|
9
9
|
*/
|
|
10
10
|
export const ClothColliderFlags = {
|
|
11
|
-
None: 0
|
|
11
|
+
None: 0
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
* refitting the swept bounds is the per-collider, per-step cost of that. A
|
|
19
|
-
* ground plane, a wall, a rock pays it for nothing, and a large static
|
|
20
|
-
* collider pays the most because its bounds are the biggest thing the
|
|
21
|
-
* broadphase tests against.
|
|
22
|
-
*
|
|
23
|
-
* Set this and the pose is written once, at link, into **both** slots, so
|
|
24
|
-
* the sweep degenerates to the pose it already had. Move the entity anyway
|
|
25
|
-
* and the cloth will not notice: that is the trade, and it is why this is
|
|
26
|
-
* an author's assertion rather than something derived from a pose that
|
|
27
|
-
* happens not to have changed yet. An explicit TRANSFORM64_EVENT_PLACED
|
|
28
|
-
* (including PhysicsSystem.setPose) does re-place a static proxy.
|
|
29
|
-
*/
|
|
30
|
-
Static: 1
|
|
13
|
+
// Bit 0 was `Static`: "this collider never moves, so place it once and
|
|
14
|
+
// never sweep it". It is retired rather than reused, because saves carry
|
|
15
|
+
// it. The index skips the refit of a collider whose pose did not change,
|
|
16
|
+
// which is the saving the flag bought, observed rather than promised — and
|
|
17
|
+
// a "static" collider that moves anyway is swept like any other.
|
|
31
18
|
};
|
|
32
19
|
|
|
33
20
|
Object.freeze(ClothColliderFlags);
|
|
@@ -100,8 +100,7 @@ export class ClothColliderSystem extends System<any> {
|
|
|
100
100
|
*/
|
|
101
101
|
refreshSurface(entity: number): void;
|
|
102
102
|
/**
|
|
103
|
-
* Reset motion history at an explicitly published placement
|
|
104
|
-
* static proxies. The next refresh can still sweep any subsequent motion.
|
|
103
|
+
* Reset motion history at an explicitly published placement. The next refresh can still sweep any subsequent motion.
|
|
105
104
|
* @param {number} handle
|
|
106
105
|
* @param {Transform64} transform
|
|
107
106
|
* @private
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClothColliderSystem.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/physics/cloth/ecs/ClothColliderSystem.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ClothColliderSystem.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/physics/cloth/ecs/ClothColliderSystem.js"],"names":[],"mappings":"AAaA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH;;IAEI,8EAAsD;IAEtD,wKAIE;IAEF;;OAEG;IACH,OAFU,kBAAkB,CAEK;IAEjC;;;;;;OAMG;IACH,kBAAsB;IAEtB;;;;;;;;OAQG;IACH,iBAAc;IAEd;;;;;OAKG;IACH,qBALW,aAAa,YACb,QAAQ,aACR,WAAW,UACX,MAAM,QAoChB;IAED;;;;;OAKG;IACH,uBALW,aAAa,YACb,QAAQ,aACR,WAAW,UACX,MAAM,QAqBhB;IAED;;;;;;OAMG;IACH,WAFa,IAAI,CA2BhB;IAED;;;;;;;;OAQG;IACH,uBAHW,MAAM,GACJ,IAAI,CAyBhB;IAED;;;;;OAKG;IACH,gBAWC;IAED;;;OAGG;IACH,iBAHW,MAAM,GACJ,MAAM,CAIlB;CACJ;uBA5PsB,wBAAwB;4BAMxC,uCAAuC;yBACrB,uBAAuB;8BAElB,oBAAoB;4CAVN,uDAAuD;mCAShE,mCAAmC"}
|
|
@@ -10,7 +10,6 @@ import {
|
|
|
10
10
|
import { Collider } from "../../ecs/Collider.js";
|
|
11
11
|
import { ClothColliderIndex } from "../collider/ClothColliderIndex.js";
|
|
12
12
|
import { ClothCollider } from "./ClothCollider.js";
|
|
13
|
-
import { ClothColliderFlags } from "./ClothColliderFlags.js";
|
|
14
13
|
|
|
15
14
|
/**
|
|
16
15
|
* # The index's owner
|
|
@@ -176,15 +175,8 @@ export class ClothColliderSystem extends System {
|
|
|
176
175
|
for (let i = 0; i < linked.length; i++) {
|
|
177
176
|
const entry = linked[i];
|
|
178
177
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
if ((cloth_collider.flags & ClothColliderFlags.Static) !== 0) {
|
|
182
|
-
// Placed once at link and never swept. `advance` has just made
|
|
183
|
-
// its previous pose equal to its current one, which is exactly
|
|
184
|
-
// the state a static collider wants and costs nothing to leave.
|
|
185
|
-
continue;
|
|
186
|
-
}
|
|
187
|
-
|
|
178
|
+
// A collider that has not moved since the last step is a pose equal
|
|
179
|
+
// to the one the index holds, which it does not refit.
|
|
188
180
|
const transform = entry.transform;
|
|
189
181
|
|
|
190
182
|
index.setPose(
|
|
@@ -235,8 +227,7 @@ export class ClothColliderSystem extends System {
|
|
|
235
227
|
}
|
|
236
228
|
|
|
237
229
|
/**
|
|
238
|
-
* Reset motion history at an explicitly published placement
|
|
239
|
-
* static proxies. The next refresh can still sweep any subsequent motion.
|
|
230
|
+
* Reset motion history at an explicitly published placement. The next refresh can still sweep any subsequent motion.
|
|
240
231
|
* @param {number} handle
|
|
241
232
|
* @param {Transform64} transform
|
|
242
233
|
* @private
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClothWorld.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/physics/cloth/ecs/ClothWorld.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ClothWorld.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/physics/cloth/ecs/ClothWorld.js"],"names":[],"mappings":"AAyEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgGG;AACH;IAEI;;;OAGG;IACH,SAFU,YAAY,CAEoB;IAE1C;;;;;;;;;;;;OAYG;IACH,WAFU,aAAa,EAAE,CAEV;IAEf;;OAEG;IACH,eAFU,gBAAc,IAAI,CAEP;IAErB;;OAEG;IACH,aAFU,yBAAyB,GAAC,IAAI,CAErB;IAEnB;;;;;;OAMG;IACH,WAFU,mBAAmB,GAAC,IAAI,CAEjB;IAEjB;;;;;;;;;;;;;;;;;;OAkBG;IACH,MAFU,oBAAkB,IAAI,CAEpB;IAEZ;;;;;;;;;;;;;;;;;;;OAmBG;IACH,MAFU,MAAM,CAEP;IAET;;;;;OAKG;IACH,uBAAmB;IAEnB;;;;;OAKG;IACH,cAFU,OAAO,CAEI;IAErB;;;OAGG;IACH,oBAAwB;IAExB;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,uBAKE;IAEF;;;;;;OAMG;IACH,uBAKE;IA0BF;;;;;OAKG;IACH,2CAaC;IAED;;;;;OAKG;IACH,YALW,KAAK,aACL,WAAW,UACX,MAAM,GACJ,aAAa,CAczB;IAED;;;;;;;;OAQG;IACH,iDAFa,IAAI,CAehB;IAED;;;OAGG;IACH,iDAFa,IAAI,CAOhB;IAmXD;;;OAGG;IACH,eAHW,MAAM,GACJ,aAAa,GAAC,SAAS,CA0BnC;IAyED;;;;;;;;;;;OAWG;IACH,eAHW,MAAM,GACJ,aAAa,GAAC,SAAS,CAuBnC;IAED;;;;;;;;OAQG;IACH,aAHW,MAAM,GACJ,IAAI,CAShB;IAED;;;OAGG;IACH,mBAHW,MAAM,GACJ,aAAa,GAAC,SAAS,CAInC;IAED;;;;;;;;;;;;OAYG;IACH,mBALW,MAAM,UACN,MAAM,GACJ,MAAM,CAmBlB;IAED;;;;;OAKG;IACH,uCAFW,MAAM,QAgBhB;IAED;;;;;;;;;OASG;IACH,wBANW,aAAa,mCAEb,MAAM,GACJ,OAAO,CA8BnB;IAED;;;;;;;OAOG;IACH,iBAJW,aAAa,gCAEX,IAAI,CA4ChB;IAyFD;;;;;;;;;;;;OAYG;IACH,kBAPW,aAAa,MACb,MAAM,UACN,YAAY,UACZ,MAAM,GACJ,OAAO,CA6TnB;;CA0GJ;8BAtiD6B,oBAAoB;0CApB3C,gEAAgE;oCAgBnC,0BAA0B;sBA+BxC,YAAY;4BA1C3B,uCAAuC"}
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import { assert } from "../../../../core/assert.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { array_range_equal_strict } from "../../../../core/collection/array/array_range_equal_strict.js";
|
|
3
|
+
import { pose3_apply_point_array } from "../../../../core/geom/3d/pose/pose3_apply_point_array.js";
|
|
4
|
+
import { pose3_to_local_array } from "../../../../core/geom/3d/pose/pose3_to_local_array.js";
|
|
5
|
+
import { quat3_clamp_angle_array } from "../../../../core/geom/3d/quaternion/quat3_clamp_angle_array.js";
|
|
6
|
+
import {
|
|
7
|
+
quat3_multiply_conjugate_right_array
|
|
8
|
+
} from "../../../../core/geom/3d/quaternion/quat3_multiply_conjugate_right_array.js";
|
|
4
9
|
import { v3_quaternion_apply_array } from "../../../../core/geom/vec3/v3_quaternion_apply.js";
|
|
5
10
|
import { v3_quaternion_apply_inverse_array } from "../../../../core/geom/vec3/v3_quaternion_apply_inverse.js";
|
|
6
11
|
import { EntityObserver } from "../../../ecs/EntityObserver.js";
|
|
7
12
|
import { EventType } from "../../../ecs/EventType.js";
|
|
8
13
|
import { GPUStateAuthorityFlags } from "../../../ecs/gpu/GPUStateAuthorityFlags.js";
|
|
9
14
|
import { gpu_authority_has } from "../../../ecs/gpu/gpu_authority_has.js";
|
|
10
|
-
import {
|
|
15
|
+
import { parent_entity_model_of } from "../../../ecs/parent/parent_entity_model_of.js";
|
|
11
16
|
import {
|
|
12
|
-
|
|
13
|
-
} from "../../../ecs/transform-attachment/
|
|
17
|
+
transform_attachment_parent_of
|
|
18
|
+
} from "../../../ecs/transform-attachment/transform_attachment_parent_of.js";
|
|
14
19
|
import {
|
|
15
20
|
TransformAttachmentSystem
|
|
16
21
|
} from "../../../ecs/transform-attachment/TransformAttachmentSystem.js";
|
|
@@ -20,6 +25,7 @@ import {
|
|
|
20
25
|
Transform64
|
|
21
26
|
} from "../../../ecs/transform/Transform64.js";
|
|
22
27
|
import { t64_evaluate_world } from "../../../ecs/transform/t64_evaluate_world.js";
|
|
28
|
+
import { t64_read_pose_array } from "../../../ecs/transform/t64_read_pose_array.js";
|
|
23
29
|
import {
|
|
24
30
|
collect_entity_playbacks
|
|
25
31
|
} from "../../../graphics3/pose/collect_entity_playbacks.js";
|
|
@@ -551,9 +557,7 @@ export class ClothWorld {
|
|
|
551
557
|
return `entity ${hold.holder} holds cloth ${instance.entity} and hangs from entity ${entity}, which that cloth moves`;
|
|
552
558
|
}
|
|
553
559
|
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
entity = attachment === undefined ? -1 : attachment.parent;
|
|
560
|
+
entity = transform_attachment_parent_of(ecd, entity);
|
|
557
561
|
}
|
|
558
562
|
|
|
559
563
|
const particles = hold.pin.particles;
|
|
@@ -695,18 +699,7 @@ export class ClothWorld {
|
|
|
695
699
|
const pose = hold.pose;
|
|
696
700
|
|
|
697
701
|
// in the frame: q_f⁻¹ · (t − t_f), q_f⁻¹ ⊗ q
|
|
698
|
-
|
|
699
|
-
HOLD_SCRATCH[1] = world[1] - frame_translation[1];
|
|
700
|
-
HOLD_SCRATCH[2] = world[2] - frame_translation[2];
|
|
701
|
-
|
|
702
|
-
v3_quaternion_apply_inverse_array(pose, 0, HOLD_SCRATCH, 0, frame_rotation, 0);
|
|
703
|
-
|
|
704
|
-
FRAME_CONJUGATE[0] = -frame_rotation[0];
|
|
705
|
-
FRAME_CONJUGATE[1] = -frame_rotation[1];
|
|
706
|
-
FRAME_CONJUGATE[2] = -frame_rotation[2];
|
|
707
|
-
FRAME_CONJUGATE[3] = frame_rotation[3];
|
|
708
|
-
|
|
709
|
-
quat3_multiply_array(pose, 3, FRAME_CONJUGATE, 0, world, 3);
|
|
702
|
+
pose3_to_local_array(pose, 0, pose, 3, frame_translation, 0, frame_rotation, 0, world, 0, world, 3);
|
|
710
703
|
|
|
711
704
|
if (!hold.has_previous) {
|
|
712
705
|
moved = true;
|
|
@@ -714,14 +707,8 @@ export class ClothWorld {
|
|
|
714
707
|
continue;
|
|
715
708
|
}
|
|
716
709
|
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
for (let i = 0; i < 7; i++) {
|
|
720
|
-
if (world[i] !== before[i]) {
|
|
721
|
-
moved = true;
|
|
722
|
-
|
|
723
|
-
break;
|
|
724
|
-
}
|
|
710
|
+
if (!array_range_equal_strict(world, 0, hold.world_previous, 0, 7)) {
|
|
711
|
+
moved = true;
|
|
725
712
|
}
|
|
726
713
|
}
|
|
727
714
|
|
|
@@ -776,8 +763,7 @@ export class ClothWorld {
|
|
|
776
763
|
return false;
|
|
777
764
|
}
|
|
778
765
|
|
|
779
|
-
const
|
|
780
|
-
const model = owner === undefined || owner === null ? e : owner.entity;
|
|
766
|
+
const model = parent_entity_model_of(ecd, e);
|
|
781
767
|
|
|
782
768
|
if (MODELS.indexOf(model) === -1) {
|
|
783
769
|
MODELS.push(model);
|
|
@@ -785,9 +771,7 @@ export class ClothWorld {
|
|
|
785
771
|
collect_entity_playbacks(playbacks, this.entityManager, model);
|
|
786
772
|
}
|
|
787
773
|
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
e = attachment === undefined ? -1 : attachment.parent;
|
|
774
|
+
e = transform_attachment_parent_of(ecd, e);
|
|
791
775
|
}
|
|
792
776
|
|
|
793
777
|
t64_evaluate_world(EVALUATED, ecd, entity, playbacks);
|
|
@@ -797,13 +781,7 @@ export class ClothWorld {
|
|
|
797
781
|
source = EVALUATED;
|
|
798
782
|
}
|
|
799
783
|
|
|
800
|
-
out
|
|
801
|
-
out[1] = source[TRANSFORM64_TRANSLATION_OFFSET + 1];
|
|
802
|
-
out[2] = source[TRANSFORM64_TRANSLATION_OFFSET + 2];
|
|
803
|
-
out[3] = source[TRANSFORM64_ROTATION_OFFSET];
|
|
804
|
-
out[4] = source[TRANSFORM64_ROTATION_OFFSET + 1];
|
|
805
|
-
out[5] = source[TRANSFORM64_ROTATION_OFFSET + 2];
|
|
806
|
-
out[6] = source[TRANSFORM64_ROTATION_OFFSET + 3];
|
|
784
|
+
t64_read_pose_array(out, 0, source);
|
|
807
785
|
|
|
808
786
|
return true;
|
|
809
787
|
}
|
|
@@ -1389,17 +1367,7 @@ export class ClothWorld {
|
|
|
1389
1367
|
reset = true;
|
|
1390
1368
|
}
|
|
1391
1369
|
} else if (moved) {
|
|
1392
|
-
|
|
1393
|
-
// wherever the call was not inlined
|
|
1394
|
-
FRAME_POSE[0] = tx;
|
|
1395
|
-
FRAME_POSE[1] = ty;
|
|
1396
|
-
FRAME_POSE[2] = tz;
|
|
1397
|
-
FRAME_POSE[3] = qx;
|
|
1398
|
-
FRAME_POSE[4] = qy;
|
|
1399
|
-
FRAME_POSE[5] = qz;
|
|
1400
|
-
FRAME_POSE[6] = qw;
|
|
1401
|
-
|
|
1402
|
-
move_local_frame(instance, FRAME_POSE, previous_translation, previous_rotation);
|
|
1370
|
+
move_local_frame(instance, FRAME_TRANSLATION, FRAME_ROTATION, previous_translation, previous_rotation);
|
|
1403
1371
|
}
|
|
1404
1372
|
|
|
1405
1373
|
previous_translation[0] = tx;
|
|
@@ -1585,18 +1553,14 @@ export class ClothWorld {
|
|
|
1585
1553
|
|
|
1586
1554
|
const b = node * 7;
|
|
1587
1555
|
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
FRAME_CONJUGATE[2] = -frame[TRANSFORM64_ROTATION_OFFSET + 2];
|
|
1597
|
-
FRAME_CONJUGATE[3] = frame[TRANSFORM64_ROTATION_OFFSET + 3];
|
|
1598
|
-
|
|
1599
|
-
quat3_multiply_array(boundary, b + 3, FRAME_CONJUGATE, 0, EVALUATED, TRANSFORM64_ROTATION_OFFSET);
|
|
1556
|
+
pose3_to_local_array(
|
|
1557
|
+
boundary, b,
|
|
1558
|
+
boundary, b + 3,
|
|
1559
|
+
frame, TRANSFORM64_TRANSLATION_OFFSET,
|
|
1560
|
+
frame, TRANSFORM64_ROTATION_OFFSET,
|
|
1561
|
+
EVALUATED, TRANSFORM64_TRANSLATION_OFFSET,
|
|
1562
|
+
EVALUATED, TRANSFORM64_ROTATION_OFFSET
|
|
1563
|
+
);
|
|
1600
1564
|
}
|
|
1601
1565
|
|
|
1602
1566
|
playbacks.length = 0;
|
|
@@ -1671,14 +1635,8 @@ const LOCAL_GRAVITY = new Float64Array(3);
|
|
|
1671
1635
|
const FRAME = new Float64Array(8);
|
|
1672
1636
|
|
|
1673
1637
|
/**
|
|
1674
|
-
* The frame's
|
|
1675
|
-
*
|
|
1676
|
-
* @private
|
|
1677
|
-
*/
|
|
1678
|
-
const FRAME_POSE = new Float64Array(7);
|
|
1679
|
-
|
|
1680
|
-
/**
|
|
1681
|
-
* The frame's translation and rotation this step, apart, as the holds take them.
|
|
1638
|
+
* The frame's translation and rotation this step, apart, as the holds and {@link move_local_frame}
|
|
1639
|
+
* take them: the transform read once, before anything this step could write it.
|
|
1682
1640
|
* @type {Float64Array}
|
|
1683
1641
|
* @private
|
|
1684
1642
|
*/
|
|
@@ -1690,18 +1648,6 @@ const FRAME_TRANSLATION = new Float64Array(3);
|
|
|
1690
1648
|
*/
|
|
1691
1649
|
const FRAME_ROTATION = new Float64Array(4);
|
|
1692
1650
|
|
|
1693
|
-
/**
|
|
1694
|
-
* @type {Float64Array}
|
|
1695
|
-
* @private
|
|
1696
|
-
*/
|
|
1697
|
-
const FRAME_CONJUGATE = new Float64Array(4);
|
|
1698
|
-
|
|
1699
|
-
/**
|
|
1700
|
-
* @type {Float64Array}
|
|
1701
|
-
* @private
|
|
1702
|
-
*/
|
|
1703
|
-
const HOLD_SCRATCH = new Float64Array(4);
|
|
1704
|
-
|
|
1705
1651
|
/**
|
|
1706
1652
|
* An exactly evaluated world pose: a holder a clip drives, a bone a garment
|
|
1707
1653
|
* hangs from.
|
|
@@ -1717,21 +1663,6 @@ const EVALUATED = new Transform64();
|
|
|
1717
1663
|
*/
|
|
1718
1664
|
const MODELS = [];
|
|
1719
1665
|
|
|
1720
|
-
/**
|
|
1721
|
-
* {@link move_local_frame}'s `q_now⁻¹`, `[-qx, -qy, -qz, qw]`.
|
|
1722
|
-
* @type {Float64Array}
|
|
1723
|
-
* @private
|
|
1724
|
-
*/
|
|
1725
|
-
const POSE_CONJUGATE = new Float64Array(4);
|
|
1726
|
-
|
|
1727
|
-
/**
|
|
1728
|
-
* The identity rotation, `[0, 0, 0, 1]`, which {@link move_local_frame} limits a turn towards. Never
|
|
1729
|
-
* written.
|
|
1730
|
-
* @type {Float64Array}
|
|
1731
|
-
* @private
|
|
1732
|
-
*/
|
|
1733
|
-
const IDENTITY_ROTATION = new Float64Array([0, 0, 0, 1]);
|
|
1734
|
-
|
|
1735
1666
|
/**
|
|
1736
1667
|
* Carry the free particles across a change of frame pose, by however much of it the
|
|
1737
1668
|
* fabric is willing to feel. §7 P7.
|
|
@@ -1753,12 +1684,13 @@ const IDENTITY_ROTATION = new Float64Array([0, 0, 0, 1]);
|
|
|
1753
1684
|
* is every call, twice per particle per step of a moving frame.
|
|
1754
1685
|
*
|
|
1755
1686
|
* @param {ClothInstance} instance
|
|
1756
|
-
* @param {Float64Array}
|
|
1687
|
+
* @param {Float64Array} translation the frame's translation now
|
|
1688
|
+
* @param {Float64Array} rotation the frame's rotation now
|
|
1757
1689
|
* @param {Float64Array} previous_translation
|
|
1758
1690
|
* @param {Float64Array} previous_rotation
|
|
1759
1691
|
* @private
|
|
1760
1692
|
*/
|
|
1761
|
-
function move_local_frame(instance,
|
|
1693
|
+
function move_local_frame(instance, translation, rotation, previous_translation, previous_rotation) {
|
|
1762
1694
|
let inertia = instance.cloth.dynamics.inertia;
|
|
1763
1695
|
|
|
1764
1696
|
if (inertia <= 0) {
|
|
@@ -1769,11 +1701,8 @@ function move_local_frame(instance, pose, previous_translation, previous_rotatio
|
|
|
1769
1701
|
inertia = 1;
|
|
1770
1702
|
}
|
|
1771
1703
|
|
|
1772
|
-
|
|
1773
|
-
FRAME
|
|
1774
|
-
FRAME[2] = previous_translation[2] - pose[2];
|
|
1775
|
-
|
|
1776
|
-
v3_quaternion_apply_inverse_array(FRAME, 0, FRAME, 0, pose, 3);
|
|
1704
|
+
// the previous pose in the frame now: D and Q
|
|
1705
|
+
pose3_to_local_array(FRAME, 0, FRAME, 4, translation, 0, rotation, 0, previous_translation, 0, previous_rotation, 0);
|
|
1777
1706
|
|
|
1778
1707
|
const travel_limit = CLOTH_FRAME_TRAVEL_REACH * instance.reach;
|
|
1779
1708
|
|
|
@@ -1787,21 +1716,10 @@ function move_local_frame(instance, pose, previous_translation, previous_rotatio
|
|
|
1787
1716
|
FRAME[2] *= scale;
|
|
1788
1717
|
}
|
|
1789
1718
|
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
quat3_multiply_array(FRAME, 4, POSE_CONJUGATE, 0, previous_rotation, 0);
|
|
1796
|
-
|
|
1797
|
-
// `|w|` is `cos(θ/2)`, so this is the angle test without an `acos`.
|
|
1798
|
-
const half_angle_cos = FRAME[7] < 0 ? -FRAME[7] : FRAME[7];
|
|
1799
|
-
|
|
1800
|
-
if (half_angle_cos < Math.cos(CLOTH_FRAME_ROTATION_LIMIT * 0.5)) {
|
|
1801
|
-
const angle = 2 * Math.acos(half_angle_cos > 1 ? 1 : half_angle_cos);
|
|
1802
|
-
|
|
1803
|
-
quat3_nlerp_array(FRAME, 4, IDENTITY_ROTATION, 0, FRAME, 4, CLOTH_FRAME_ROTATION_LIMIT / angle);
|
|
1804
|
-
}
|
|
1719
|
+
// Exactly the limit about the same axis. An nlerp from the identity by `limit / θ` follows the
|
|
1720
|
+
// chord and turned less than the limit the further past it the frame spun: three quarters of it
|
|
1721
|
+
// at a half turn.
|
|
1722
|
+
quat3_clamp_angle_array(FRAME, 4, FRAME, 4, CLOTH_FRAME_ROTATION_LIMIT);
|
|
1805
1723
|
|
|
1806
1724
|
const state = instance.state;
|
|
1807
1725
|
|
|
@@ -1857,11 +1775,7 @@ function carry_with_holder(instance, h) {
|
|
|
1857
1775
|
const before = hold.pose_previous;
|
|
1858
1776
|
|
|
1859
1777
|
// the jump's rotation, q_now ⊗ q_before⁻¹
|
|
1860
|
-
|
|
1861
|
-
JUMP, 0,
|
|
1862
|
-
now[3], now[4], now[5], now[6],
|
|
1863
|
-
-before[3], -before[4], -before[5], before[6]
|
|
1864
|
-
);
|
|
1778
|
+
quat3_multiply_conjugate_right_array(JUMP, 0, now, 3, before, 3);
|
|
1865
1779
|
|
|
1866
1780
|
const state = instance.state;
|
|
1867
1781
|
const position = state.position;
|
|
@@ -1884,11 +1798,7 @@ function carry_with_holder(instance, h) {
|
|
|
1884
1798
|
CARRIED[1] = position[p + 1] - before[1];
|
|
1885
1799
|
CARRIED[2] = position[p + 2] - before[2];
|
|
1886
1800
|
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
position[p] += now[0];
|
|
1890
|
-
position[p + 1] += now[1];
|
|
1891
|
-
position[p + 2] += now[2];
|
|
1801
|
+
pose3_apply_point_array(position, p, now, 0, JUMP, 0, CARRIED, 0);
|
|
1892
1802
|
|
|
1893
1803
|
v3_quaternion_apply_array(velocity, p, velocity, p, JUMP, 0);
|
|
1894
1804
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloth_build_rows.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/physics/cloth/ecs/cloth_build_rows.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cloth_build_rows.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/physics/cloth/ecs/cloth_build_rows.js"],"names":[],"mappings":"AAqEA;;;;GAIG;AACH,+DAFa,IAAI,CAsBhB;AAED;;;;;;;;;;GAUG;AACH,2DAFa,IAAI,CA6BhB;AAED;;;;;;;;GAQG;AACH,8DAFa,IAAI,CAgDhB;AAED;;;;;;;;;;;;;;GAcG;AACH,4CAJW,YAAY,SACZ,MAAM,GACJ,MAAM,CAYlB;AAED;;;;;;;;;;;;;GAaG;AACH,8DAHW,MAAM,GACJ,IAAI,CAkOhB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,kEAHW,MAAM,GACJ,IAAI,CAiEhB;AAED;;;;;;;;;;;GAWG;AACH,iGAFa,OAAO,CAkBnB;AA/iBD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH;;;;GAIG;AACH,kCAFU,MAAM,CAEwB;AAIxC;;;;;;;;;;;;;;;;;GAiBG;AACH,gCAFU,MAAM,CAEmB"}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
import { v3_distance_array } from "../../../../core/geom/vec3/v3_distance_array.js";
|
|
2
|
+
import { clamp01 } from "../../../../core/math/clamp01.js";
|
|
3
|
+
import { csr_build_incidence } from "../../../../core/graph/csr/csr_build_incidence.js";
|
|
1
4
|
import { ClothState } from "../solver/ClothState.js";
|
|
2
5
|
import { ClothDynamicsFlags } from "./ClothDynamicsFlags.js";
|
|
3
6
|
import { cloth_self_closest_free_pair, cloth_self_exclusions } from "../solver/cloth_self_find.js";
|
|
4
7
|
import { cloth_bend_ratio, cloth_strain_allowance } from "./cloth_dynamics_map.js";
|
|
5
8
|
import { cloth_edge_incidence } from "./cloth_geodesic.js";
|
|
6
9
|
import { cloth_bend_stencil_weights } from "../solver/constraint/cloth_bend_row.js";
|
|
10
|
+
import { cloth_particle_of_source } from "../solver/cloth_particle_of_source.js";
|
|
7
11
|
|
|
8
12
|
/**
|
|
9
13
|
* # The rows, and everything that is a number rather than a walk
|
|
@@ -72,26 +76,19 @@ export function cloth_build_children(instance) {
|
|
|
72
76
|
const node_count = instance.node_count;
|
|
73
77
|
const parent = instance.node_parent;
|
|
74
78
|
|
|
75
|
-
|
|
79
|
+
let child_count = 0;
|
|
76
80
|
|
|
77
81
|
for (let node = 0; node < node_count; node++) {
|
|
78
82
|
if (parent[node] >= 0) {
|
|
79
|
-
|
|
83
|
+
child_count++;
|
|
80
84
|
}
|
|
81
85
|
}
|
|
82
86
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
const child = new Int32Array(offset[node_count]);
|
|
88
|
-
const cursor = offset.slice(0, node_count);
|
|
87
|
+
const offset = new Int32Array(node_count + 1);
|
|
88
|
+
const child = new Int32Array(child_count);
|
|
89
89
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
child[cursor[parent[node]]++] = node;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
90
|
+
// a root's parent is −1, which is in no bucket
|
|
91
|
+
csr_build_incidence(offset, child, parent, node_count, node_count);
|
|
95
92
|
|
|
96
93
|
instance.node_child_offset = offset;
|
|
97
94
|
instance.node_child = child;
|
|
@@ -161,24 +158,13 @@ export function cloth_build_surface(instance) {
|
|
|
161
158
|
}
|
|
162
159
|
|
|
163
160
|
const offset = new Int32Array(node_count + 1);
|
|
164
|
-
|
|
165
|
-
for (let i = 0; i < triangle_count * 3; i++) {
|
|
166
|
-
offset[triangle[i] + 1]++;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
for (let node = 0; node < node_count; node++) {
|
|
170
|
-
offset[node + 1] += offset[node];
|
|
171
|
-
}
|
|
172
|
-
|
|
173
161
|
const surface = new Int32Array(triangle_count * 3);
|
|
174
|
-
const cursor = offset.slice(0, node_count);
|
|
175
162
|
|
|
176
|
-
|
|
177
|
-
for (let k = 0; k < 3; k++) {
|
|
178
|
-
const node = triangle[t * 3 + k];
|
|
163
|
+
csr_build_incidence(offset, surface, triangle, triangle_count * 3, node_count);
|
|
179
164
|
|
|
180
|
-
|
|
181
|
-
|
|
165
|
+
// a corner's flat index `t·3 + k` to its triangle `t`
|
|
166
|
+
for (let i = 0; i < triangle_count * 3; i++) {
|
|
167
|
+
surface[i] = (surface[i] / 3) | 0;
|
|
182
168
|
}
|
|
183
169
|
|
|
184
170
|
// the first edge each node has: fixed for the life of the seed, which is all
|
|
@@ -232,22 +218,6 @@ export function cloth_hinge_inertia(weight, hinge) {
|
|
|
232
218
|
return sum > 0 ? CLOTH_PARTICLE_MASS / sum : 0;
|
|
233
219
|
}
|
|
234
220
|
|
|
235
|
-
/**
|
|
236
|
-
* Distance between two nodes of the rest pose.
|
|
237
|
-
* @param {Float32Array} rest
|
|
238
|
-
* @param {number} a
|
|
239
|
-
* @param {number} b
|
|
240
|
-
* @returns {number}
|
|
241
|
-
* @private
|
|
242
|
-
*/
|
|
243
|
-
function rest_distance(rest, a, b) {
|
|
244
|
-
return Math.hypot(
|
|
245
|
-
rest[b * 3] - rest[a * 3],
|
|
246
|
-
rest[b * 3 + 1] - rest[a * 3 + 1],
|
|
247
|
-
rest[b * 3 + 2] - rest[a * 3 + 2]
|
|
248
|
-
);
|
|
249
|
-
}
|
|
250
|
-
|
|
251
221
|
/**
|
|
252
222
|
* Rows and the `ClothState` itself, from a seeded rest pose and the graph over
|
|
253
223
|
* it.
|
|
@@ -300,7 +270,7 @@ export function cloth_build_rows(instance, dt) {
|
|
|
300
270
|
const a = edge[e * 2];
|
|
301
271
|
const b = edge[e * 2 + 1];
|
|
302
272
|
|
|
303
|
-
const length =
|
|
273
|
+
const length = v3_distance_array(rest, a * 3, rest, b * 3);
|
|
304
274
|
|
|
305
275
|
edge_length[e] = length;
|
|
306
276
|
|
|
@@ -347,7 +317,7 @@ export function cloth_build_rows(instance, dt) {
|
|
|
347
317
|
// Soft, bilateral: the bending model. Its rest length is read from
|
|
348
318
|
// the authored pose, so a chain authored with a curve holds it.
|
|
349
319
|
stretch_particle.push(a, b);
|
|
350
|
-
stretch_rest.push(
|
|
320
|
+
stretch_rest.push(v3_distance_array(rest, a * 3, rest, b * 3));
|
|
351
321
|
stretch_stiffness.push(bend_stiffness);
|
|
352
322
|
stretch_force_min.push(-Infinity);
|
|
353
323
|
stretch_force_max.push(Infinity);
|
|
@@ -452,9 +422,7 @@ export function cloth_build_rows(instance, dt) {
|
|
|
452
422
|
|
|
453
423
|
const particle_of_node = new Int32Array(node_count);
|
|
454
424
|
|
|
455
|
-
|
|
456
|
-
particle_of_node[state.source_of_particle[particle]] = particle;
|
|
457
|
-
}
|
|
425
|
+
cloth_particle_of_source(particle_of_node, state.source_of_particle, node_count);
|
|
458
426
|
|
|
459
427
|
// Everything derived from the rows, derived again — and from the bind pose,
|
|
460
428
|
// which is what `closest_free_pair` has to be measured in: the answer is a
|
|
@@ -490,15 +458,6 @@ export function cloth_build_rows(instance, dt) {
|
|
|
490
458
|
instance.seeded = true;
|
|
491
459
|
}
|
|
492
460
|
|
|
493
|
-
/**
|
|
494
|
-
* @param {number} v
|
|
495
|
-
* @returns {number}
|
|
496
|
-
* @private
|
|
497
|
-
*/
|
|
498
|
-
function clamp01(v) {
|
|
499
|
-
return v < 0 ? 0 : (v > 1 ? 1 : v);
|
|
500
|
-
}
|
|
501
|
-
|
|
502
461
|
/**
|
|
503
462
|
* Re-parameterise the rows of an already-seeded cloth from its current
|
|
504
463
|
* {@link ClothDynamics}, without walking the subtree again.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloth_dynamics_map.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/physics/cloth/ecs/cloth_dynamics_map.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cloth_dynamics_map.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/physics/cloth/ecs/cloth_dynamics_map.js"],"names":[],"mappings":"AAuQA;;;;;;;;GAQG;AACH,gDAHW,MAAM,GACJ,MAAM,CAIlB;AAED;;;;;;;;GAQG;AACH,uCAHW,MAAM,GACJ,MAAM,CAUlB;AAED;;;;;;;;;;;GAWG;AACH,mDAPW,MAAM,YAEN,MAAM,cACN,MAAM,MACN,MAAM,GACJ,MAAM,CAIlB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,0CAJW,MAAM,MACN,MAAM,GACJ,MAAM,CAYlB;AAED;;;;;;;;GAQG;AACH,kDAJW,MAAM,MACN,MAAM,GACJ,MAAM,CAQlB;AA7WD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH;;;;;GAKG;AACH,+BAFU,MAAM,CAEqB;AAErC;;;;;GAKG;AACH,+BAFU,MAAM,CAEqB;AAErC;;;;;;;;;;;GAWG;AACH,mCAFU,MAAM,CAEsB;AAEtC;;;;;GAKG;AACH,mCAFU,MAAM,CAEyB;AAEzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,+CAFU,MAAM,CAEkC;AAElD;;;;;;;;GAQG;AACH,iCAFU,MAAM,CAEqB;AAErC;;;;;;;;;;;;;;GAcG;AACH,uCAFU,MAAM,CAE4B;AAE5C;;;;;;;;GAQG;AACH,yCAFU,MAAM,CAE8B;AAE9C;;;;;;;;;GASG;AACH,mCAFU,MAAM,CAEsB;AAEtC;;;;;;;;GAQG;AACH,mCAFU,MAAM,CAEsB;AAEtC;;;;;;;GAOG;AACH,oCAFU,MAAM,CAEwB;AAExC;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,kCAFU,MAAM,CAEsB;AAEtC;;;;;;;GAOG;AACH,sCAFU,MAAM,CAE4B;AAE5C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,6CAFU,MAAM,CAEmC;AAEnD;;;;;GAKG;AACH,gCAFU,MAAM,CAEoB"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { clamp01 } from "../../../../core/math/clamp01.js";
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* # Normalised coordinates → row parameters
|
|
3
5
|
*
|
|
@@ -269,9 +271,7 @@ export const CLOTH_SLEEP_STEPS = 30;
|
|
|
269
271
|
* @returns {number} strain, `L_max = L₀·(1 + ε)`
|
|
270
272
|
*/
|
|
271
273
|
export function cloth_strain_allowance(stretch) {
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
return CLOTH_STRAIN_MAX * Math.pow(CLOTH_STRAIN_MIN / CLOTH_STRAIN_MAX, t);
|
|
274
|
+
return CLOTH_STRAIN_MAX * Math.pow(CLOTH_STRAIN_MIN / CLOTH_STRAIN_MAX, clamp01(stretch));
|
|
275
275
|
}
|
|
276
276
|
|
|
277
277
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloth_gather_colliders.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/physics/cloth/ecs/cloth_gather_colliders.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cloth_gather_colliders.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/physics/cloth/ecs/cloth_gather_colliders.js"],"names":[],"mappings":"AAiCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,qFAHW,MAAM,GACJ,MAAM,CAsBlB;AA2HD;;;;;;GAMG;AACH,kGAHW,MAAM,GACJ,MAAM,CAmBlB;AA2ED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,2FAFa,OAAO,CAkBnB;AAED;;;;;;;;GAQG;AACH,yEAHW,MAAM,GACJ,IAAI,CAgBhB"}
|