@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
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
v3_quaternion_apply_inverse_array
|
|
5
|
-
} from "../../../../core/geom/vec3/v3_quaternion_apply_inverse.js";
|
|
1
|
+
import { pose3_compose_array } from "../../../../core/geom/3d/pose/pose3_compose_array.js";
|
|
2
|
+
import { pose3_to_local_array } from "../../../../core/geom/3d/pose/pose3_to_local_array.js";
|
|
6
3
|
import { t64_announce_change } from "../../../ecs/transform/t64_announce_change.js";
|
|
7
4
|
import {
|
|
8
5
|
TRANSFORM64_ROTATION_OFFSET,
|
|
@@ -86,12 +83,10 @@ export function cloth_write_back(instance, ecd) {
|
|
|
86
83
|
// transforms either way (§4.1) — but a **nested** cloth reads this pose as
|
|
87
84
|
// its own anchor, and then the two systems hand it different numbers.
|
|
88
85
|
// `MEASUREMENTS.md` §56.
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
// The rotations go in as arrays, read where they sit: handed over as seven and eight numbers,
|
|
94
|
-
// each was boxed into a heap object wherever the call was not inlined.
|
|
86
|
+
//
|
|
87
|
+
// The frame goes in as arrays, read where it sits: handed over as seven and eight numbers, each
|
|
88
|
+
// was boxed into a heap object wherever the call was not inlined.
|
|
89
|
+
const frame_translation = instance.frame_translation;
|
|
95
90
|
const frame_rotation = instance.frame_rotation;
|
|
96
91
|
|
|
97
92
|
const parent = instance.node_parent;
|
|
@@ -106,15 +101,14 @@ export function cloth_write_back(instance, ecd) {
|
|
|
106
101
|
|
|
107
102
|
const transform = instance.node_transform[node];
|
|
108
103
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
quat3_multiply_array(transform, TRANSFORM64_ROTATION_OFFSET, frame_rotation, 0, reconstructed, node * 4);
|
|
104
|
+
pose3_compose_array(
|
|
105
|
+
transform, TRANSFORM64_TRANSLATION_OFFSET,
|
|
106
|
+
transform, TRANSFORM64_ROTATION_OFFSET,
|
|
107
|
+
frame_translation, 0,
|
|
108
|
+
frame_rotation, 0,
|
|
109
|
+
blended, node * 3,
|
|
110
|
+
reconstructed, node * 4
|
|
111
|
+
);
|
|
118
112
|
|
|
119
113
|
transform.updateMatrix();
|
|
120
114
|
|
|
@@ -166,12 +160,6 @@ export function cloth_write_local_pose(local, instance, node, parent) {
|
|
|
166
160
|
const blended = instance.blended_position;
|
|
167
161
|
const rotation = instance.blended_rotation;
|
|
168
162
|
|
|
169
|
-
// Operands go in as arrays, the parent's rotation and the node's straight from the instance, the
|
|
170
|
-
// offset and the conjugate through scratch: handed over as seven and eight numbers, each was
|
|
171
|
-
// boxed into a heap object wherever the call was not inlined.
|
|
172
|
-
const offset = scratch_local_offset;
|
|
173
|
-
const conjugate = scratch_parent_conjugate;
|
|
174
|
-
|
|
175
163
|
if (parent < 0) {
|
|
176
164
|
// A joint hanging straight off the frame — every joint of a generated
|
|
177
165
|
// skin — is written in the frame, which is the identity in itself.
|
|
@@ -190,34 +178,28 @@ export function cloth_write_local_pose(local, instance, node, parent) {
|
|
|
190
178
|
}
|
|
191
179
|
|
|
192
180
|
if (instance.node_output[parent] !== 0) {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
conjugate[2] = -rotation[parent * 4 + 2];
|
|
202
|
-
conjugate[3] = rotation[parent * 4 + 3];
|
|
181
|
+
pose3_to_local_array(
|
|
182
|
+
local, TRANSFORM64_TRANSLATION_OFFSET,
|
|
183
|
+
local, TRANSFORM64_ROTATION_OFFSET,
|
|
184
|
+
blended, parent * 3,
|
|
185
|
+
rotation, parent * 4,
|
|
186
|
+
blended, node * 3,
|
|
187
|
+
rotation, node * 4
|
|
188
|
+
);
|
|
203
189
|
} else {
|
|
204
190
|
const boundary = instance.boundary_pose;
|
|
205
191
|
const b = parent * 7;
|
|
206
192
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
conjugate[2] = -boundary[b + 5];
|
|
216
|
-
conjugate[3] = boundary[b + 6];
|
|
193
|
+
pose3_to_local_array(
|
|
194
|
+
local, TRANSFORM64_TRANSLATION_OFFSET,
|
|
195
|
+
local, TRANSFORM64_ROTATION_OFFSET,
|
|
196
|
+
boundary, b,
|
|
197
|
+
boundary, b + 3,
|
|
198
|
+
blended, node * 3,
|
|
199
|
+
rotation, node * 4
|
|
200
|
+
);
|
|
217
201
|
}
|
|
218
202
|
|
|
219
|
-
quat3_multiply_array(local, TRANSFORM64_ROTATION_OFFSET, conjugate, 0, rotation, node * 4);
|
|
220
|
-
|
|
221
203
|
// `multiplyTransforms` reads the matrix, not the components, so a local
|
|
222
204
|
// transform that is not refreshed here composes the pose it had last time.
|
|
223
205
|
local.updateMatrix();
|
|
@@ -253,17 +235,3 @@ function pose_pruned(instance, ecd) {
|
|
|
253
235
|
t64_announce_change(ecd, instance.pruned_entity[i]);
|
|
254
236
|
}
|
|
255
237
|
}
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
* {@link cloth_write_local_pose}'s node position less its parent's, in the cloth's frame.
|
|
259
|
-
* @type {Float64Array}
|
|
260
|
-
* @private
|
|
261
|
-
*/
|
|
262
|
-
const scratch_local_offset = new Float64Array(3);
|
|
263
|
-
|
|
264
|
-
/**
|
|
265
|
-
* {@link cloth_write_local_pose}'s parent rotation, conjugated: `[-x, -y, -z, w]`.
|
|
266
|
-
* @type {Float64Array}
|
|
267
|
-
* @private
|
|
268
|
-
*/
|
|
269
|
-
const scratch_parent_conjugate = new Float64Array(4);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloth_playground_build.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/physics/cloth/playground/cloth_playground_build.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cloth_playground_build.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/physics/cloth/playground/cloth_playground_build.js"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;;GAKG;AAEH;;;;;;;;;;;;;GAaG;AACH;IAZoC,KAAK,EAA9B,OAAO,GAAC,OAAO;IACC,KAAK,EAArB,MAAM;IACU,MAAM,EAAtB,MAAM;IACU,OAAO,EAAvB,MAAM;IACU,IAAI,EAApB,MAAM;IACU,iBAAiB,EAAjC,MAAM;IACU,YAAY,EAA5B,MAAM;IACkC,MAAM,EAA9C,KAAK,GAAC,SAAS,GAAC,OAAO,GAAC,MAAM;IACb,IAAI,EAArB,OAAO;IAEL,oBAAoB,CAgBhC;;WAjCa,UAAU;;;;;cACV,UAAU;;2BAzBG,yBAAyB"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ClothState } from "../solver/ClothState.js";
|
|
2
2
|
import { cloth_bend_stencil_weights } from "../solver/constraint/cloth_bend_row.js";
|
|
3
|
+
import { cloth_particle_of_source } from "../solver/cloth_particle_of_source.js";
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* # Building the playground's cloth
|
|
@@ -289,9 +290,7 @@ function extract_edges_and_hinges(triangle) {
|
|
|
289
290
|
function permute_triangles(triangle, state) {
|
|
290
291
|
const particle_of_source = new Int32Array(state.particle_count);
|
|
291
292
|
|
|
292
|
-
|
|
293
|
-
particle_of_source[state.source_of_particle[i]] = i;
|
|
294
|
-
}
|
|
293
|
+
cloth_particle_of_source(particle_of_source, state.source_of_particle, state.particle_count);
|
|
295
294
|
|
|
296
295
|
const out = new Int32Array(triangle.length);
|
|
297
296
|
|
|
@@ -23,6 +23,7 @@ import { find_non_finite_cloth_state } from "../solver/find_non_finite_cloth_sta
|
|
|
23
23
|
import { build_cloth_playground_scene } from "./cloth_playground_build.js";
|
|
24
24
|
import { COLLIDER_SCENES, unsweep } from "./collide_build.js";
|
|
25
25
|
import { draw_cloth, PlaygroundCamera, project } from "./cloth_playground_draw.js";
|
|
26
|
+
import { cloth_kinetic_energy } from "../solver/cloth_kinetic_energy.js";
|
|
26
27
|
|
|
27
28
|
/**
|
|
28
29
|
* # Cloth collision playground — M2
|
|
@@ -227,33 +228,6 @@ function penetration() {
|
|
|
227
228
|
return worst;
|
|
228
229
|
}
|
|
229
230
|
|
|
230
|
-
/**
|
|
231
|
-
* @returns {number} kinetic energy, J
|
|
232
|
-
*/
|
|
233
|
-
function kinetic() {
|
|
234
|
-
const state = cloth.state;
|
|
235
|
-
|
|
236
|
-
let total = 0;
|
|
237
|
-
|
|
238
|
-
for (let i = 0; i < state.particle_count; i++) {
|
|
239
|
-
const w = state.mass_inverse[i];
|
|
240
|
-
|
|
241
|
-
if (w === 0) {
|
|
242
|
-
continue;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
const p = i * 3;
|
|
246
|
-
|
|
247
|
-
total += 0.5 * (
|
|
248
|
-
state.velocity[p] * state.velocity[p] +
|
|
249
|
-
state.velocity[p + 1] * state.velocity[p + 1] +
|
|
250
|
-
state.velocity[p + 2] * state.velocity[p + 2]
|
|
251
|
-
) / w;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
return total;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
231
|
// ------------------------------------------------------------------- draw
|
|
258
232
|
|
|
259
233
|
/**
|
|
@@ -464,7 +438,7 @@ function refresh_readout() {
|
|
|
464
438
|
element('r_contacts').textContent = String(contact_rows);
|
|
465
439
|
element('r_pen').textContent = `${(worst_penetration * 1000).toFixed(2)} mm`;
|
|
466
440
|
element('r_rest').textContent = `${(penetration() * 1000).toFixed(2)} mm`;
|
|
467
|
-
element('r_energy').textContent =
|
|
441
|
+
element('r_energy').textContent = cloth_kinetic_energy(cloth.state).toExponential(2);
|
|
468
442
|
|
|
469
443
|
const offender = find_non_finite_cloth_state(cloth.state);
|
|
470
444
|
|
|
@@ -5,6 +5,7 @@ import { GARMENT_PRESETS, build_garment, garment_sync_colliders } from "./garmen
|
|
|
5
5
|
import { TRANSFORM_ATTACHMENT_EVENT_CHANGE } from "../../../ecs/transform-attachment/TRANSFORM_ATTACHMENT_EVENT_CHANGE.js";
|
|
6
6
|
import { TransformAttachment } from "../../../ecs/transform-attachment/TransformAttachment.js";
|
|
7
7
|
import { Transform64 } from "../../../ecs/transform/Transform64.js";
|
|
8
|
+
import { cloth_worst_tether_ratio } from "../solver/cloth_worst_tether_ratio.js";
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* # Skinned garments playground — M3
|
|
@@ -417,25 +418,9 @@ function refresh_readout() {
|
|
|
417
418
|
element('r_self').textContent = String(instance.self_pairs);
|
|
418
419
|
element('r_step').textContent = `${step_ms.toFixed(3)} ms`;
|
|
419
420
|
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
for (let node = 1; node < instance.node_count; node++) {
|
|
425
|
-
const p = instance.particle_of_node[node] * 3;
|
|
426
|
-
|
|
427
|
-
const distance = Math.hypot(
|
|
428
|
-
state.position[p] - state.position[anchor],
|
|
429
|
-
state.position[p + 1] - state.position[anchor + 1],
|
|
430
|
-
state.position[p + 2] - state.position[anchor + 2]
|
|
431
|
-
);
|
|
432
|
-
|
|
433
|
-
const ratio = distance / instance.geodesic[node];
|
|
434
|
-
|
|
435
|
-
if (ratio > worst) {
|
|
436
|
-
worst = ratio;
|
|
437
|
-
}
|
|
438
|
-
}
|
|
421
|
+
const worst = cloth_worst_tether_ratio(
|
|
422
|
+
state.position, instance.particle_of_node, instance.geodesic, instance.node_count
|
|
423
|
+
);
|
|
439
424
|
|
|
440
425
|
const reach = element('r_reach');
|
|
441
426
|
|
|
@@ -10,6 +10,9 @@ import {
|
|
|
10
10
|
project,
|
|
11
11
|
unproject
|
|
12
12
|
} from "./cloth_playground_draw.js";
|
|
13
|
+
import { number_compare_ascending } from "../../../../core/primitives/numbers/number_compare_ascending.js";
|
|
14
|
+
import { cloth_kinetic_energy } from "../solver/cloth_kinetic_energy.js";
|
|
15
|
+
import { cloth_stretch_residual } from "../solver/cloth_stretch_residual.js";
|
|
13
16
|
|
|
14
17
|
/**
|
|
15
18
|
* # Cloth solver playground
|
|
@@ -239,7 +242,7 @@ function step_once() {
|
|
|
239
242
|
timing.shift();
|
|
240
243
|
}
|
|
241
244
|
|
|
242
|
-
energy_history.push(
|
|
245
|
+
energy_history.push(cloth_kinetic_energy(scene.state));
|
|
243
246
|
|
|
244
247
|
if (energy_history.length > ENERGY_WINDOW) {
|
|
245
248
|
energy_history.shift();
|
|
@@ -272,58 +275,13 @@ function frame() {
|
|
|
272
275
|
|
|
273
276
|
// ---------------------------------------------------------------- readouts
|
|
274
277
|
|
|
275
|
-
function kinetic_energy(state) {
|
|
276
|
-
let energy = 0;
|
|
277
|
-
|
|
278
|
-
for (let i = 0; i < state.particle_count; i++) {
|
|
279
|
-
const inverse_mass = state.mass_inverse[i];
|
|
280
|
-
|
|
281
|
-
if (inverse_mass === 0) {
|
|
282
|
-
continue;
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
const p = i * 3;
|
|
286
|
-
|
|
287
|
-
energy += 0.5 / inverse_mass * (
|
|
288
|
-
state.velocity[p] * state.velocity[p] +
|
|
289
|
-
state.velocity[p + 1] * state.velocity[p + 1] +
|
|
290
|
-
state.velocity[p + 2] * state.velocity[p + 2]
|
|
291
|
-
);
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
return energy;
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
function stretch_residual(state) {
|
|
298
|
-
let worst = 0;
|
|
299
|
-
|
|
300
|
-
for (let row = 0; row < state.stretch_count; row++) {
|
|
301
|
-
const a = state.stretch_particle[row * 2] * 3;
|
|
302
|
-
const b = state.stretch_particle[row * 2 + 1] * 3;
|
|
303
|
-
|
|
304
|
-
const length = Math.hypot(
|
|
305
|
-
state.position[a] - state.position[b],
|
|
306
|
-
state.position[a + 1] - state.position[b + 1],
|
|
307
|
-
state.position[a + 2] - state.position[b + 2]
|
|
308
|
-
);
|
|
309
|
-
|
|
310
|
-
const rest = state.stretch_rest[row];
|
|
311
|
-
|
|
312
|
-
if (rest > 0) {
|
|
313
|
-
worst = Math.max(worst, Math.abs(length - rest) / rest);
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
return worst;
|
|
318
|
-
}
|
|
319
|
-
|
|
320
278
|
function refresh_readout() {
|
|
321
279
|
const state = scene.state;
|
|
322
280
|
|
|
323
281
|
element('ms').textContent = last_ms.toFixed(3);
|
|
324
282
|
|
|
325
283
|
if (timing.length > 0) {
|
|
326
|
-
const sorted = timing.slice().sort(
|
|
284
|
+
const sorted = timing.slice().sort(number_compare_ascending);
|
|
327
285
|
|
|
328
286
|
element('ms_min').textContent = `(min ${sorted[0].toFixed(3)})`;
|
|
329
287
|
|
|
@@ -333,7 +291,7 @@ function refresh_readout() {
|
|
|
333
291
|
bar.classList.toggle('over', sorted[0] > BUDGET_MS);
|
|
334
292
|
}
|
|
335
293
|
|
|
336
|
-
element('residual').textContent = (
|
|
294
|
+
element('residual').textContent = (cloth_stretch_residual(state) * 100).toFixed(2) + '%';
|
|
337
295
|
|
|
338
296
|
const energy = energy_history.length > 0 ? energy_history[energy_history.length - 1] : 0;
|
|
339
297
|
|