@woosh/meep-engine 2.147.0 → 2.148.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/package.json +1 -1
- package/src/core/math/spline/spline3_hermite_intersection_spline3_hermite.d.ts +4 -4
- package/src/core/math/spline/spline3_hermite_intersection_spline3_hermite.d.ts.map +1 -1
- package/src/core/math/spline/spline3_hermite_intersection_spline3_hermite.js +48 -52
- package/src/core/math/spline/spline3_hermite_intersection_spline3_hermite_2d.d.ts +23 -21
- package/src/core/math/spline/spline3_hermite_intersection_spline3_hermite_2d.d.ts.map +1 -1
- package/src/core/math/spline/spline3_hermite_intersection_spline3_hermite_2d.js +41 -406
- package/src/core/math/spline/spline3_hermite_intersection_spline3_hermite_nd.d.ts +5 -4
- package/src/core/math/spline/spline3_hermite_intersection_spline3_hermite_nd.d.ts.map +1 -1
- package/src/core/math/spline/spline3_hermite_intersection_spline3_hermite_nd.js +400 -395
- package/src/engine/physics/body/SolverBodyState.d.ts +142 -0
- package/src/engine/physics/body/SolverBodyState.d.ts.map +1 -0
- package/src/engine/physics/body/SolverBodyState.js +251 -0
- package/src/engine/physics/broadphase/generate_pairs.d.ts +2 -1
- package/src/engine/physics/broadphase/generate_pairs.d.ts.map +1 -1
- package/src/engine/physics/broadphase/generate_pairs.js +5 -3
- package/src/engine/physics/constraint/solve_constraints.d.ts.map +1 -1
- package/src/engine/physics/constraint/solve_constraints.js +691 -673
- package/src/engine/physics/ecs/PhysicsSystem.d.ts +21 -18
- package/src/engine/physics/ecs/PhysicsSystem.d.ts.map +1 -1
- package/src/engine/physics/ecs/PhysicsSystem.js +223 -91
- package/src/engine/physics/inertia/world_inverse_inertia.d.ts +23 -0
- package/src/engine/physics/inertia/world_inverse_inertia.d.ts.map +1 -1
- package/src/engine/physics/inertia/world_inverse_inertia.js +116 -77
- package/src/engine/physics/integration/integrate_position.d.ts +11 -1
- package/src/engine/physics/integration/integrate_position.d.ts.map +1 -1
- package/src/engine/physics/integration/integrate_position.js +97 -79
- package/src/engine/physics/integration/integrate_velocity.d.ts +12 -3
- package/src/engine/physics/integration/integrate_velocity.d.ts.map +1 -1
- package/src/engine/physics/integration/integrate_velocity.js +201 -160
- package/src/engine/physics/narrowphase/box_box_manifold.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/box_box_manifold.js +750 -665
- package/src/engine/physics/narrowphase/box_triangle_contact.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/box_triangle_contact.js +4 -34
- package/src/engine/physics/narrowphase/clip_against_axis_uv.d.ts +16 -0
- package/src/engine/physics/narrowphase/clip_against_axis_uv.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/clip_against_axis_uv.js +49 -0
- package/src/engine/physics/narrowphase/narrowphase_step.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/narrowphase_step.js +24 -3
- package/src/engine/physics/queries/raycast.d.ts.map +1 -1
- package/src/engine/physics/queries/raycast.js +7 -4
- package/src/engine/physics/solver/solve_contacts.d.ts +2 -2
- package/src/engine/physics/solver/solve_contacts.d.ts.map +1 -1
- package/src/engine/physics/solver/solve_contacts.js +1341 -1173
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"box_triangle_contact.d.ts","sourceRoot":"","sources":["../../../../../src/engine/physics/narrowphase/box_triangle_contact.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"box_triangle_contact.d.ts","sourceRoot":"","sources":["../../../../../src/engine/physics/narrowphase/box_triangle_contact.js"],"names":[],"mappings":"AAyLA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,0CAtBW,MAAM,EAAE,GAAC,YAAY,OACrB,MAAM,OACN,MAAM,OACN,MAAM,OACN,MAAM,OACN,MAAM,OACN,MAAM,OACN,MAAM,OACN,MAAM,OACN,MAAM,OACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACJ,OAAO,CAuJnB;AAvSD;;;GAGG;AACH,sCAFU,MAAM,CAEyD"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
line3_closest_points_segment_segment
|
|
3
|
+
} from "../../../core/geom/3d/line/line3_closest_points_segment_segment.js";
|
|
2
4
|
import { quat3_to_matrix3 } from "../../../core/geom/3d/quaternion/quat3_to_matrix3.js";
|
|
5
|
+
import { clip_against_axis_uv } from "./clip_against_axis_uv.js";
|
|
3
6
|
|
|
4
7
|
/**
|
|
5
8
|
* Multi-point manifold construction for an oriented box vs. a triangle.
|
|
@@ -97,39 +100,6 @@ function projected_box_half_extent(axes, hx, hy, hz, ux, uy, uz) {
|
|
|
97
100
|
+ (pz < 0 ? -pz : pz) * hz;
|
|
98
101
|
}
|
|
99
102
|
|
|
100
|
-
/**
|
|
101
|
-
* Sutherland-Hodgman clip of `points_in` against the axis-aligned
|
|
102
|
-
* half-plane `coord_idx ≤ bound` (or `coord_idx ≥ bound` when
|
|
103
|
-
* `keep_below` is false). 2D stride 2; result to `points_out`.
|
|
104
|
-
* Returns surviving vertex count.
|
|
105
|
-
*/
|
|
106
|
-
function clip_against_axis_uv(points_in, point_count, points_out, coord_idx, bound, keep_below) {
|
|
107
|
-
let out_count = 0;
|
|
108
|
-
for (let i = 0; i < point_count; i++) {
|
|
109
|
-
const j = (i + 1) % point_count;
|
|
110
|
-
const ax = points_in[i * 2], ay = points_in[i * 2 + 1];
|
|
111
|
-
const bx = points_in[j * 2], by = points_in[j * 2 + 1];
|
|
112
|
-
const av = coord_idx === 0 ? ax : ay;
|
|
113
|
-
const bv = coord_idx === 0 ? bx : by;
|
|
114
|
-
const a_inside = keep_below ? (av <= bound) : (av >= bound);
|
|
115
|
-
const b_inside = keep_below ? (bv <= bound) : (bv >= bound);
|
|
116
|
-
|
|
117
|
-
if (a_inside) {
|
|
118
|
-
points_out[out_count * 2] = ax;
|
|
119
|
-
points_out[out_count * 2 + 1] = ay;
|
|
120
|
-
out_count++;
|
|
121
|
-
}
|
|
122
|
-
if (a_inside !== b_inside) {
|
|
123
|
-
const denom = bv - av;
|
|
124
|
-
const t = denom !== 0 ? (bound - av) / denom : 0;
|
|
125
|
-
points_out[out_count * 2] = ax + (bx - ax) * t;
|
|
126
|
-
points_out[out_count * 2 + 1] = ay + (by - ay) * t;
|
|
127
|
-
out_count++;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
return out_count;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
103
|
/**
|
|
134
104
|
* Sutherland-Hodgman clip of `points_in` against the general half-plane
|
|
135
105
|
* `(p - (line_ox, line_oy)) · (line_nx, line_ny) ≤ 0`. 2D stride 2;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sutherland-Hodgman clip of `points_in` against the axis-aligned
|
|
3
|
+
* half-plane `coord_idx ≤ bound` (or `coord_idx ≥ bound` when
|
|
4
|
+
* `keep_below` is false). 2D stride 2; result to `points_out`.
|
|
5
|
+
* Returns surviving vertex count.
|
|
6
|
+
*
|
|
7
|
+
* @param {Float64Array} points_in
|
|
8
|
+
* @param {number} point_count
|
|
9
|
+
* @param {Float64Array} points_out
|
|
10
|
+
* @param {number} coord_idx 0 = u, 1 = v
|
|
11
|
+
* @param {number} bound
|
|
12
|
+
* @param {boolean} keep_below true to keep points with coord ≤ bound
|
|
13
|
+
* @returns {number} surviving vertex count
|
|
14
|
+
*/
|
|
15
|
+
export function clip_against_axis_uv(points_in: Float64Array, point_count: number, points_out: Float64Array, coord_idx: number, bound: number, keep_below: boolean): number;
|
|
16
|
+
//# sourceMappingURL=clip_against_axis_uv.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clip_against_axis_uv.d.ts","sourceRoot":"","sources":["../../../../../src/engine/physics/narrowphase/clip_against_axis_uv.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,gDARW,YAAY,eACZ,MAAM,cACN,YAAY,aACZ,MAAM,SACN,MAAM,cACN,OAAO,GACL,MAAM,CAoClB"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sutherland-Hodgman clip of `points_in` against the axis-aligned
|
|
3
|
+
* half-plane `coord_idx ≤ bound` (or `coord_idx ≥ bound` when
|
|
4
|
+
* `keep_below` is false). 2D stride 2; result to `points_out`.
|
|
5
|
+
* Returns surviving vertex count.
|
|
6
|
+
*
|
|
7
|
+
* @param {Float64Array} points_in
|
|
8
|
+
* @param {number} point_count
|
|
9
|
+
* @param {Float64Array} points_out
|
|
10
|
+
* @param {number} coord_idx 0 = u, 1 = v
|
|
11
|
+
* @param {number} bound
|
|
12
|
+
* @param {boolean} keep_below true to keep points with coord ≤ bound
|
|
13
|
+
* @returns {number} surviving vertex count
|
|
14
|
+
*/
|
|
15
|
+
export function clip_against_axis_uv(points_in, point_count, points_out, coord_idx, bound, keep_below) {
|
|
16
|
+
let out_count = 0;
|
|
17
|
+
|
|
18
|
+
for (let i = 0; i < point_count; i++) {
|
|
19
|
+
const j = (i + 1) % point_count;
|
|
20
|
+
|
|
21
|
+
const ax = points_in[i * 2], ay = points_in[i * 2 + 1];
|
|
22
|
+
const bx = points_in[j * 2], by = points_in[j * 2 + 1];
|
|
23
|
+
|
|
24
|
+
const av = coord_idx === 0 ? ax : ay;
|
|
25
|
+
const bv = coord_idx === 0 ? bx : by;
|
|
26
|
+
|
|
27
|
+
const a_inside = keep_below ? (av <= bound) : (av >= bound);
|
|
28
|
+
const b_inside = keep_below ? (bv <= bound) : (bv >= bound);
|
|
29
|
+
|
|
30
|
+
if (a_inside) {
|
|
31
|
+
points_out[out_count * 2] = ax;
|
|
32
|
+
points_out[out_count * 2 + 1] = ay;
|
|
33
|
+
out_count++;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (a_inside !== b_inside) {
|
|
37
|
+
|
|
38
|
+
const denom = bv - av;
|
|
39
|
+
const t = denom !== 0 ? (bound - av) / denom : 0;
|
|
40
|
+
|
|
41
|
+
points_out[out_count * 2] = ax + (bx - ax) * t;
|
|
42
|
+
points_out[out_count * 2 + 1] = ay + (by - ay) * t;
|
|
43
|
+
|
|
44
|
+
out_count++;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return out_count;
|
|
49
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"narrowphase_step.d.ts","sourceRoot":"","sources":["../../../../../src/engine/physics/narrowphase/narrowphase_step.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"narrowphase_step.d.ts","sourceRoot":"","sources":["../../../../../src/engine/physics/narrowphase/narrowphase_step.js"],"names":[],"mappings":"AA8zCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,qDAVW,YAAY,GAAC,MAAM,EAAE,iCAGrB;IAAC,CAAC,EAAC,MAAM,CAAC;IAAA,CAAC,EAAC,MAAM,CAAC;IAAA,CAAC,EAAC,MAAM,CAAA;CAAC,QAC5B;IAAC,CAAC,EAAC,MAAM,CAAC;IAAA,CAAC,EAAC,MAAM,CAAC;IAAA,CAAC,EAAC,MAAM,CAAC;IAAA,CAAC,EAAC,MAAM,CAAA;CAAC,iCAErC;IAAC,CAAC,EAAC,MAAM,CAAC;IAAA,CAAC,EAAC,MAAM,CAAC;IAAA,CAAC,EAAC,MAAM,CAAA;CAAC,QAC5B;IAAC,CAAC,EAAC,MAAM,CAAC;IAAA,CAAC,EAAC,MAAM,CAAC;IAAA,CAAC,EAAC,MAAM,CAAC;IAAA,CAAC,EAAC,MAAM,CAAA;CAAC,GACnC,MAAM,CAyClB;AAED;;;;;;;;;;;GAWG;AACH,uFALW,MAAM,MAAM;IAAC,QAAQ,WAAW;IAAC,SAAS,YAAW;CAAC,CAAC,CAAC,QA4KlE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,uEAJW,MAAM,UACN,MAAM;IAAC,QAAQ,WAAW;IAAC,SAAS,YAAW;CAAC,CAAC,UACjD,MAAM;IAAC,QAAQ,WAAW;IAAC,SAAS,YAAW;CAAC,CAAC,QAkH3D"}
|
|
@@ -403,9 +403,12 @@ function dispatch_pair(count, colA, trA, colB, trB, gjk_axis_buf = null, gjk_axi
|
|
|
403
403
|
// `deepest_pair_penetration` query passes bare `{shape}` adapters with no
|
|
404
404
|
// material fields — it never writes to a manifold, so 0 is fine there.
|
|
405
405
|
const fa = colA.friction, fb = colB.friction;
|
|
406
|
+
|
|
406
407
|
if (fa !== undefined && fb !== undefined) {
|
|
408
|
+
|
|
407
409
|
g_pair_friction = combine_friction(fa, fb);
|
|
408
410
|
g_pair_restitution = combine_restitution(colA.restitution, colB.restitution);
|
|
411
|
+
|
|
409
412
|
} else {
|
|
410
413
|
g_pair_friction = 0;
|
|
411
414
|
g_pair_restitution = 0;
|
|
@@ -1429,22 +1432,29 @@ export function narrowphase_step(pair_list, manifolds, lists) {
|
|
|
1429
1432
|
for (let i = 0; i < count; i++) {
|
|
1430
1433
|
const idA = pair_list.get_a(i);
|
|
1431
1434
|
const idB = pair_list.get_b(i);
|
|
1435
|
+
|
|
1432
1436
|
const idxA = body_id_index(idA);
|
|
1433
1437
|
const idxB = body_id_index(idB);
|
|
1434
1438
|
|
|
1435
1439
|
const list_a = lists[idxA];
|
|
1436
1440
|
const list_b = lists[idxB];
|
|
1441
|
+
|
|
1437
1442
|
const slot = manifolds.find(idA, idB);
|
|
1438
1443
|
|
|
1439
1444
|
if (list_a === undefined || list_b === undefined
|
|
1440
|
-
|| list_a.length === 0 || list_b.length === 0
|
|
1445
|
+
|| list_a.length === 0 || list_b.length === 0
|
|
1446
|
+
) {
|
|
1447
|
+
|
|
1441
1448
|
manifolds.clear_contacts(slot);
|
|
1442
1449
|
continue;
|
|
1450
|
+
|
|
1443
1451
|
}
|
|
1444
1452
|
|
|
1445
1453
|
let cand_count = 0;
|
|
1454
|
+
|
|
1446
1455
|
const la_len = list_a.length;
|
|
1447
1456
|
const lb_len = list_b.length;
|
|
1457
|
+
|
|
1448
1458
|
// Per-manifold cached GJK separating-axis seed. Threaded into
|
|
1449
1459
|
// dispatch_pair for the GJK fallback paths. For single-collider
|
|
1450
1460
|
// bodies (the common case) there's no contention across the
|
|
@@ -1453,12 +1463,23 @@ export function narrowphase_step(pair_list, manifolds, lists) {
|
|
|
1453
1463
|
// seed (better than a cold (1, 0, 0) restart every frame).
|
|
1454
1464
|
const gjk_axis_buf = manifolds.slot_axis_buffer;
|
|
1455
1465
|
const gjk_axis_off = manifolds.slot_axis_offset(slot);
|
|
1466
|
+
|
|
1456
1467
|
for (let a = 0; a < la_len; a++) {
|
|
1457
1468
|
const ea = list_a[a];
|
|
1469
|
+
|
|
1458
1470
|
for (let b = 0; b < lb_len; b++) {
|
|
1459
1471
|
const eb = list_b[b];
|
|
1460
|
-
|
|
1461
|
-
|
|
1472
|
+
|
|
1473
|
+
cand_count = dispatch_pair(
|
|
1474
|
+
cand_count,
|
|
1475
|
+
ea.collider,
|
|
1476
|
+
ea.transform,
|
|
1477
|
+
eb.collider,
|
|
1478
|
+
eb.transform,
|
|
1479
|
+
gjk_axis_buf,
|
|
1480
|
+
gjk_axis_off
|
|
1481
|
+
);
|
|
1482
|
+
|
|
1462
1483
|
}
|
|
1463
1484
|
}
|
|
1464
1485
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"raycast.d.ts","sourceRoot":"","sources":["../../../../../src/engine/physics/queries/raycast.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"raycast.d.ts","sourceRoot":"","sources":["../../../../../src/engine/physics/queries/raycast.js"],"names":[],"mappings":"AA8IA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,yGAJmB,MAAM,yBAAsB,OAAO,GAEzC,OAAO,CAwCnB"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { SCRATCH_UINT32_TRAVERSAL_STACK } from "../../../core/collection/SCRATCH_UINT32_TRAVERSAL_STACK.js";
|
|
2
1
|
import {
|
|
3
2
|
COLUMN_CHILD_1,
|
|
4
3
|
COLUMN_CHILD_2,
|
|
@@ -6,9 +5,13 @@ import {
|
|
|
6
5
|
ELEMENT_WORD_COUNT,
|
|
7
6
|
NULL_NODE,
|
|
8
7
|
} from "../../../core/bvh2/bvh3/BVH.js";
|
|
8
|
+
import { SCRATCH_UINT32_TRAVERSAL_STACK } from "../../../core/collection/SCRATCH_UINT32_TRAVERSAL_STACK.js";
|
|
9
9
|
import { returnTrue } from "../../../core/function/returnTrue.js";
|
|
10
|
-
import {
|
|
11
|
-
|
|
10
|
+
import {
|
|
11
|
+
aabb3_near_distance_to_intersection_ray_segment
|
|
12
|
+
} from "../../../core/geom/3d/aabb/aabb3_near_distance_to_intersection_ray_segment.js";
|
|
13
|
+
import { body_id_index } from "../body/BodyStorage.js";
|
|
14
|
+
import { RAY_REFINE_UNSUPPORTED, refine_ray_hit } from "../narrowphase/refine_ray_hit.js";
|
|
12
15
|
|
|
13
16
|
const stack = SCRATCH_UINT32_TRAVERSAL_STACK;
|
|
14
17
|
|
|
@@ -104,7 +107,7 @@ function bvh_raycast_nearest(
|
|
|
104
107
|
const body_id = uint32[address + COLUMN_USER_DATA];
|
|
105
108
|
const entity = system.entityOf(body_id);
|
|
106
109
|
if (entity < 0) continue; // unlinked concurrently
|
|
107
|
-
const idx =
|
|
110
|
+
const idx = body_id_index(body_id);
|
|
108
111
|
const collider = system.__primary_collider(idx);
|
|
109
112
|
if (collider === null) continue;
|
|
110
113
|
if (!filter(entity, collider)) continue;
|
|
@@ -48,9 +48,9 @@ export function warm_start_contacts(manifolds: ManifoldStore, system: PhysicsSys
|
|
|
48
48
|
* for the small per-step rotation), so they are not recomputed here.
|
|
49
49
|
*
|
|
50
50
|
* @param {ManifoldStore} manifolds
|
|
51
|
-
* @param {
|
|
51
|
+
* @param {Transform[]} transforms
|
|
52
52
|
*/
|
|
53
|
-
export function refresh_contacts(manifolds: ManifoldStore,
|
|
53
|
+
export function refresh_contacts(manifolds: ManifoldStore, transforms: Transform[]): void;
|
|
54
54
|
/**
|
|
55
55
|
* Stage 2b (per substep) — the concave counterpart of {@link refresh_contacts}.
|
|
56
56
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"solve_contacts.d.ts","sourceRoot":"","sources":["../../../../../src/engine/physics/solver/solve_contacts.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"solve_contacts.d.ts","sourceRoot":"","sources":["../../../../../src/engine/physics/solver/solve_contacts.js"],"names":[],"mappings":"AA8fA;;;;;;;;;;;;;GAaG;AACH,0FAHW,MAAM,GACJ,MAAM,CA8LlB;AAED;;;;;;;;;;;;;;;GAeG;AACH,2FA0CC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,uEAFW,WAAW,QA4FrB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,iGAsGC;AAED;;;;;;;;GAQG;AACH,uFAFW,MAAM,QA8HhB;AAED;;;;;;;;;;;GAWG;AACH,yFAuDC;AAED;;;;;;;;;;;;;;GAcG;AACH,2FAFW,MAAM,QA2EhB;AAED;;;;;;;;;;;;;;;GAeG;AACH,oFAJW,MAAM,UACN,MAAM,cACN,MAAM,QAahB;AAnuCD;;;;;GAKG;AACH,0CAFU,MAAM,CAEuB;AAEvC;;;GAGG;AACH,0CAFU,MAAM,CAEsB"}
|