@perplexdotgg/bounce 1.5.0 → 1.5.2
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/bounce.d.ts +2350 -2336
- package/build/bounce.js +264 -238
- package/package.json +6 -6
package/build/bounce.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createClass, ChildType, NumberType, LazyReferenceListType, BooleanType, LazyReferenceType, ReferenceListType, ReferenceType } from "monomorph";
|
|
2
2
|
const mat3Keys = ["e0", "e1", "e2", "e3", "e4", "e5", "e6", "e7", "e8"];
|
|
3
|
-
const mat3Props =
|
|
3
|
+
const mat3Props = {
|
|
4
4
|
e0: 0,
|
|
5
5
|
e1: 0,
|
|
6
6
|
e2: 0,
|
|
@@ -10,8 +10,8 @@ const mat3Props = props({
|
|
|
10
10
|
e6: 0,
|
|
11
11
|
e7: 0,
|
|
12
12
|
e8: 0
|
|
13
|
-
}
|
|
14
|
-
class Mat3 extends createClass(
|
|
13
|
+
};
|
|
14
|
+
class Mat3 extends createClass(mat3Props) {
|
|
15
15
|
adjointMatrix(a3) {
|
|
16
16
|
let a00 = a3.e0, a01 = a3.e1, a02 = a3.e2;
|
|
17
17
|
let a10 = a3.e3, a11 = a3.e4, a12 = a3.e5;
|
|
@@ -420,12 +420,12 @@ function squaredDistance(a3, b3) {
|
|
|
420
420
|
let z = b3.z - a3.z;
|
|
421
421
|
return x2 * x2 + y4 * y4 + z * z;
|
|
422
422
|
}
|
|
423
|
-
const vec3Props =
|
|
423
|
+
const vec3Props = {
|
|
424
424
|
x: 0,
|
|
425
425
|
y: 0,
|
|
426
426
|
z: 0
|
|
427
|
-
}
|
|
428
|
-
class Vec3 extends createClass(
|
|
427
|
+
};
|
|
428
|
+
class Vec3 extends createClass(vec3Props) {
|
|
429
429
|
constructor(data, index, pool) {
|
|
430
430
|
if (Array.isArray(data)) {
|
|
431
431
|
data = {
|
|
@@ -923,24 +923,24 @@ const rb = /* @__PURE__ */ Vec3.create();
|
|
|
923
923
|
const temp = /* @__PURE__ */ Vec3.create();
|
|
924
924
|
const rotatedVector = /* @__PURE__ */ Vec3.create();
|
|
925
925
|
const rotationMatrix$3 = /* @__PURE__ */ Mat3.create();
|
|
926
|
-
const lineProps =
|
|
926
|
+
const lineProps = {
|
|
927
927
|
a: Vec3,
|
|
928
928
|
b: Vec3
|
|
929
|
-
}
|
|
930
|
-
class Line extends createClass(
|
|
929
|
+
};
|
|
930
|
+
class Line extends createClass(lineProps) {
|
|
931
931
|
setFromPointAndDirection(point2, direction2, length) {
|
|
932
932
|
this.a.copy(point2);
|
|
933
933
|
this.b.addScaledToVector(point2, direction2, length);
|
|
934
934
|
}
|
|
935
935
|
}
|
|
936
936
|
const quatKeys = ["x", "y", "z", "w"];
|
|
937
|
-
const quatProps =
|
|
937
|
+
const quatProps = {
|
|
938
938
|
x: 0,
|
|
939
939
|
y: 0,
|
|
940
940
|
z: 0,
|
|
941
941
|
w: 1
|
|
942
|
-
}
|
|
943
|
-
class Quat extends createClass(
|
|
942
|
+
};
|
|
943
|
+
class Quat extends createClass(quatProps) {
|
|
944
944
|
constructor(data, index, pool) {
|
|
945
945
|
if (Array.isArray(data)) {
|
|
946
946
|
if (data.length && data.length < 4) {
|
|
@@ -1160,7 +1160,7 @@ const rotationMatrix$2 = /* @__PURE__ */ Mat3.create();
|
|
|
1160
1160
|
const scaling = /* @__PURE__ */ Vec3.create();
|
|
1161
1161
|
const conjugatedRotation = /* @__PURE__ */ Quat.create();
|
|
1162
1162
|
const rotatedTranslation = /* @__PURE__ */ Vec3.create();
|
|
1163
|
-
const mat4Props =
|
|
1163
|
+
const mat4Props = {
|
|
1164
1164
|
e0: 0,
|
|
1165
1165
|
e1: 0,
|
|
1166
1166
|
e2: 0,
|
|
@@ -1177,8 +1177,8 @@ const mat4Props = props({
|
|
|
1177
1177
|
e13: 0,
|
|
1178
1178
|
e14: 0,
|
|
1179
1179
|
e15: 0
|
|
1180
|
-
}
|
|
1181
|
-
class Mat4 extends createClass(
|
|
1180
|
+
};
|
|
1181
|
+
class Mat4 extends createClass(mat4Props) {
|
|
1182
1182
|
multiply3x3(out, a3) {
|
|
1183
1183
|
const x2 = a3.x;
|
|
1184
1184
|
const y4 = a3.y;
|
|
@@ -1730,11 +1730,11 @@ class Mat4 extends createClass()(mat4Props) {
|
|
|
1730
1730
|
}
|
|
1731
1731
|
const rotation$3 = /* @__PURE__ */ Quat.create();
|
|
1732
1732
|
const cross_bn_cn = /* @__PURE__ */ Vec3.create();
|
|
1733
|
-
const planeProps =
|
|
1733
|
+
const planeProps = {
|
|
1734
1734
|
normal: Vec3,
|
|
1735
1735
|
constant: 0
|
|
1736
|
-
}
|
|
1737
|
-
class Plane extends createClass(
|
|
1736
|
+
};
|
|
1737
|
+
class Plane extends createClass(planeProps) {
|
|
1738
1738
|
toObject() {
|
|
1739
1739
|
return {
|
|
1740
1740
|
normal: this.normal.toObject(),
|
|
@@ -1802,11 +1802,11 @@ class Plane extends createClass()(planeProps) {
|
|
|
1802
1802
|
return fraction;
|
|
1803
1803
|
}
|
|
1804
1804
|
}
|
|
1805
|
-
const segmentProps =
|
|
1805
|
+
const segmentProps = {
|
|
1806
1806
|
pointA: Vec3,
|
|
1807
1807
|
pointB: Vec3
|
|
1808
|
-
}
|
|
1809
|
-
class Segment extends createClass(
|
|
1808
|
+
};
|
|
1809
|
+
class Segment extends createClass(segmentProps) {
|
|
1810
1810
|
computeCenter(out) {
|
|
1811
1811
|
out.addVectors(this.pointA, this.pointB);
|
|
1812
1812
|
out.scaleVector(out, 0.5);
|
|
@@ -1826,12 +1826,12 @@ const newMax = /* @__PURE__ */ Vec3.create();
|
|
|
1826
1826
|
const col = /* @__PURE__ */ Vec3.create();
|
|
1827
1827
|
const a$2 = /* @__PURE__ */ Vec3.create();
|
|
1828
1828
|
const b$1 = /* @__PURE__ */ Vec3.create();
|
|
1829
|
-
const aabbProps =
|
|
1829
|
+
const aabbProps = {
|
|
1830
1830
|
min: Vec3,
|
|
1831
1831
|
max: Vec3,
|
|
1832
1832
|
centroid: ChildType(Vec3, void 0, true)
|
|
1833
|
-
}
|
|
1834
|
-
class Aabb extends createClass(
|
|
1833
|
+
};
|
|
1834
|
+
class Aabb extends createClass(aabbProps) {
|
|
1835
1835
|
computeSupport(out, direction2) {
|
|
1836
1836
|
out.x = direction2.x < 0 ? this.min.x : this.max.x;
|
|
1837
1837
|
out.y = direction2.y < 0 ? this.min.y : this.max.y;
|
|
@@ -2105,7 +2105,7 @@ const aabbCenter = /* @__PURE__ */ Vec3.create();
|
|
|
2105
2105
|
const aabbHalfExtents = /* @__PURE__ */ Vec3.create();
|
|
2106
2106
|
const segmentCenter = /* @__PURE__ */ Vec3.create();
|
|
2107
2107
|
const segmentHalfExtents = /* @__PURE__ */ Vec3.create();
|
|
2108
|
-
const triangleProps$1 =
|
|
2108
|
+
const triangleProps$1 = {
|
|
2109
2109
|
computedBounds: ChildType(Aabb, void 0, true),
|
|
2110
2110
|
normal: ChildType(Vec3, void 0, true),
|
|
2111
2111
|
a: Vec3,
|
|
@@ -2116,10 +2116,10 @@ const triangleProps$1 = props({
|
|
|
2116
2116
|
// aabb: { struct: Aabb, readOnly: true },
|
|
2117
2117
|
// activeEdges: { struct: Uint32, optional: true },
|
|
2118
2118
|
// translation: { struct: Vec3, optional: true },
|
|
2119
|
-
}
|
|
2119
|
+
};
|
|
2120
2120
|
const ab$5 = /* @__PURE__ */ Vec3.create();
|
|
2121
2121
|
const ac$3 = /* @__PURE__ */ Vec3.create();
|
|
2122
|
-
let Triangle$1 = class Triangle extends createClass(
|
|
2122
|
+
let Triangle$1 = class Triangle extends createClass(triangleProps$1) {
|
|
2123
2123
|
// type: ShapeType.triangle = ShapeType.triangle;
|
|
2124
2124
|
computeNormal(out) {
|
|
2125
2125
|
ab$5.subtractVectors(this.b, this.a);
|
|
@@ -2192,13 +2192,13 @@ let Triangle$1 = class Triangle extends createClass()(triangleProps$1) {
|
|
|
2192
2192
|
out.transform(centerOfMassTransform2);
|
|
2193
2193
|
}
|
|
2194
2194
|
};
|
|
2195
|
-
const faceProps =
|
|
2195
|
+
const faceProps = {
|
|
2196
2196
|
numVertices: 0,
|
|
2197
2197
|
buffer: LazyReferenceListType(() => Vec3)
|
|
2198
|
-
}
|
|
2198
|
+
};
|
|
2199
2199
|
const triangle$1 = /* @__PURE__ */ Triangle$1.create();
|
|
2200
2200
|
const tempVertex = /* @__PURE__ */ Vec3.create();
|
|
2201
|
-
class Face extends createClass(
|
|
2201
|
+
class Face extends createClass(faceProps) {
|
|
2202
2202
|
clear() {
|
|
2203
2203
|
this.numVertices = 0;
|
|
2204
2204
|
}
|
|
@@ -2294,7 +2294,7 @@ var ConstraintType = /* @__PURE__ */ ((ConstraintType2) => {
|
|
|
2294
2294
|
ConstraintType2[ConstraintType2["hingeConstraint"] = 3] = "hingeConstraint";
|
|
2295
2295
|
return ConstraintType2;
|
|
2296
2296
|
})(ConstraintType || {});
|
|
2297
|
-
const baseConstraintProps =
|
|
2297
|
+
const baseConstraintProps = {
|
|
2298
2298
|
// unless we use require here, this file will be imported after it is needed
|
|
2299
2299
|
bodyA: LazyReferenceType((() => Body)),
|
|
2300
2300
|
bodyB: LazyReferenceType((() => Body)),
|
|
@@ -2304,10 +2304,10 @@ const baseConstraintProps = props({
|
|
|
2304
2304
|
/* local */
|
|
2305
2305
|
),
|
|
2306
2306
|
isEnabled: BooleanType(true)
|
|
2307
|
-
}
|
|
2307
|
+
};
|
|
2308
2308
|
const localToWorldTransformA$1 = /* @__PURE__ */ Mat4.create();
|
|
2309
2309
|
const point$1 = /* @__PURE__ */ Vec3.create();
|
|
2310
|
-
const contactManifoldProps =
|
|
2310
|
+
const contactManifoldProps = {
|
|
2311
2311
|
// meta data
|
|
2312
2312
|
bodyA: LazyReferenceType((() => Body)),
|
|
2313
2313
|
bodyB: LazyReferenceType((() => Body)),
|
|
@@ -2323,8 +2323,8 @@ const contactManifoldProps = props({
|
|
|
2323
2323
|
contactPointsA: ReferenceListType(Vec3),
|
|
2324
2324
|
contactPointsB: ReferenceListType(Vec3),
|
|
2325
2325
|
lambdas: ReferenceListType(Vec3)
|
|
2326
|
-
}
|
|
2327
|
-
class ContactManifold extends createClass(
|
|
2326
|
+
};
|
|
2327
|
+
class ContactManifold extends createClass(contactManifoldProps) {
|
|
2328
2328
|
get maxContacts() {
|
|
2329
2329
|
return this.contactPointsA.maxLength;
|
|
2330
2330
|
}
|
|
@@ -2444,14 +2444,14 @@ class ContactManifoldPool {
|
|
|
2444
2444
|
return manifold;
|
|
2445
2445
|
}
|
|
2446
2446
|
}
|
|
2447
|
-
const contactPairProps =
|
|
2447
|
+
const contactPairProps = {
|
|
2448
2448
|
bodyA: LazyReferenceType((() => Body)),
|
|
2449
2449
|
bodyB: LazyReferenceType((() => Body)),
|
|
2450
2450
|
firstContactManifold: ReferenceType(ContactManifold),
|
|
2451
2451
|
translationAB: Vec3,
|
|
2452
2452
|
rotationAB: Quat
|
|
2453
|
-
}
|
|
2454
|
-
class ContactPair extends createClass(
|
|
2453
|
+
};
|
|
2454
|
+
class ContactPair extends createClass(contactPairProps) {
|
|
2455
2455
|
get key() {
|
|
2456
2456
|
return createContactPairKey(this.bodyA, this.bodyB);
|
|
2457
2457
|
}
|
|
@@ -2468,7 +2468,7 @@ const angularVelocityA = /* @__PURE__ */ Vec3.create();
|
|
|
2468
2468
|
const angularVelocityB = /* @__PURE__ */ Vec3.create();
|
|
2469
2469
|
const inverseInertiaA$2 = /* @__PURE__ */ Mat3.create();
|
|
2470
2470
|
const inverseInertiaB$2 = /* @__PURE__ */ Mat3.create();
|
|
2471
|
-
const directionalConstraintProps =
|
|
2471
|
+
const directionalConstraintProps = {
|
|
2472
2472
|
mR1PlusUxAxis: Vec3,
|
|
2473
2473
|
mR2xAxis: Vec3,
|
|
2474
2474
|
mInvI1_R1PlusUxAxis: Vec3,
|
|
@@ -2477,8 +2477,10 @@ const directionalConstraintProps = props({
|
|
|
2477
2477
|
bias: 0,
|
|
2478
2478
|
softness: 0,
|
|
2479
2479
|
totalLambda: 0
|
|
2480
|
-
}
|
|
2481
|
-
class DirectionalConstraint extends createClass(
|
|
2480
|
+
};
|
|
2481
|
+
class DirectionalConstraint extends createClass(
|
|
2482
|
+
directionalConstraintProps
|
|
2483
|
+
) {
|
|
2482
2484
|
isSpringActive() {
|
|
2483
2485
|
return this.softness !== 0;
|
|
2484
2486
|
}
|
|
@@ -2608,14 +2610,16 @@ class DirectionalConstraint extends createClass()(directionalConstraintProps) {
|
|
|
2608
2610
|
}
|
|
2609
2611
|
}
|
|
2610
2612
|
}
|
|
2611
|
-
const contactConstraintProps =
|
|
2613
|
+
const contactConstraintProps = {
|
|
2612
2614
|
normalConstraint: DirectionalConstraint,
|
|
2613
2615
|
tangentConstraint: DirectionalConstraint,
|
|
2614
2616
|
bitangentConstraint: DirectionalConstraint,
|
|
2615
2617
|
localPositionA: Vec3,
|
|
2616
2618
|
localPositionB: Vec3
|
|
2617
|
-
}
|
|
2618
|
-
class ContactConstraint extends createClass(
|
|
2619
|
+
};
|
|
2620
|
+
class ContactConstraint extends createClass(
|
|
2621
|
+
contactConstraintProps
|
|
2622
|
+
) {
|
|
2619
2623
|
getLambda(out, index) {
|
|
2620
2624
|
out.x = this.normalConstraint.totalLambda;
|
|
2621
2625
|
out.y = this.tangentConstraint.totalLambda;
|
|
@@ -2637,7 +2641,7 @@ class ContactConstraint extends createClass()(contactConstraintProps) {
|
|
|
2637
2641
|
this.normalConstraint.warmStart(bodyA, bodyB, inverseMassA, inverseMassB, normal4);
|
|
2638
2642
|
}
|
|
2639
2643
|
}
|
|
2640
|
-
const manifoldConstraintProps =
|
|
2644
|
+
const manifoldConstraintProps = {
|
|
2641
2645
|
bodyA: LazyReferenceType((() => Body)),
|
|
2642
2646
|
bodyB: LazyReferenceType((() => Body)),
|
|
2643
2647
|
subShapeIdA: 0,
|
|
@@ -2651,8 +2655,10 @@ const manifoldConstraintProps = props({
|
|
|
2651
2655
|
inverseMassB: 0,
|
|
2652
2656
|
contactConstraints: ReferenceListType(ContactConstraint),
|
|
2653
2657
|
numContacts: 0
|
|
2654
|
-
}
|
|
2655
|
-
class ManifoldConstraint extends createClass(
|
|
2658
|
+
};
|
|
2659
|
+
class ManifoldConstraint extends createClass(
|
|
2660
|
+
manifoldConstraintProps
|
|
2661
|
+
) {
|
|
2656
2662
|
updateTangentDirections() {
|
|
2657
2663
|
this.worldSpaceTangent.computeNormalizedPerpendicular(this.worldSpaceNormal);
|
|
2658
2664
|
this.worldSpaceBitangent.crossVectors(this.worldSpaceNormal, this.worldSpaceTangent);
|
|
@@ -2752,14 +2758,14 @@ function computeClosestPowersOfTwo(n2) {
|
|
|
2752
2758
|
const next = 1 << Math.ceil(Math.log2(n2));
|
|
2753
2759
|
return { previous, next };
|
|
2754
2760
|
}
|
|
2755
|
-
const isometryProps =
|
|
2761
|
+
const isometryProps = {
|
|
2756
2762
|
matrix: Mat4
|
|
2757
|
-
}
|
|
2763
|
+
};
|
|
2758
2764
|
const tempTranslation = /* @__PURE__ */ Vec3.create();
|
|
2759
2765
|
const tempRotation = /* @__PURE__ */ Quat.create();
|
|
2760
2766
|
const rotation$2 = /* @__PURE__ */ Mat3.create();
|
|
2761
2767
|
const inverseMatrix = /* @__PURE__ */ Mat4.create();
|
|
2762
|
-
class Isometry extends createClass(
|
|
2768
|
+
class Isometry extends createClass(isometryProps) {
|
|
2763
2769
|
fromRotationAndTranslation(rotation2, translation) {
|
|
2764
2770
|
if (rotation2) {
|
|
2765
2771
|
tempRotation.copy(rotation2);
|
|
@@ -3307,11 +3313,11 @@ class TransformedConvexObject {
|
|
|
3307
3313
|
out.transformFromMat4(this.transform.matrix);
|
|
3308
3314
|
}
|
|
3309
3315
|
}
|
|
3310
|
-
const transformedConvexShapeProps =
|
|
3316
|
+
const transformedConvexShapeProps = {
|
|
3311
3317
|
transform: Isometry
|
|
3312
|
-
}
|
|
3318
|
+
};
|
|
3313
3319
|
const direction = /* @__PURE__ */ Vec3.create();
|
|
3314
|
-
class TransformedConvexShape extends createClass(
|
|
3320
|
+
class TransformedConvexShape extends createClass(
|
|
3315
3321
|
transformedConvexShapeProps
|
|
3316
3322
|
) {
|
|
3317
3323
|
constructor() {
|
|
@@ -3325,10 +3331,12 @@ class TransformedConvexShape extends createClass()(
|
|
|
3325
3331
|
out.transformByMat4(this.transform.matrix);
|
|
3326
3332
|
}
|
|
3327
3333
|
}
|
|
3328
|
-
const convexRadiusObjectProps =
|
|
3334
|
+
const convexRadiusObjectProps = {
|
|
3329
3335
|
radius: 0
|
|
3330
|
-
}
|
|
3331
|
-
class ConvexRadiusObject extends createClass(
|
|
3336
|
+
};
|
|
3337
|
+
class ConvexRadiusObject extends createClass(
|
|
3338
|
+
convexRadiusObjectProps
|
|
3339
|
+
) {
|
|
3332
3340
|
constructor() {
|
|
3333
3341
|
super();
|
|
3334
3342
|
this.convexShape = null;
|
|
@@ -3375,10 +3383,10 @@ var ShapeType = /* @__PURE__ */ ((ShapeType2) => {
|
|
|
3375
3383
|
ShapeType2[ShapeType2["triangleMesh"] = 7] = "triangleMesh";
|
|
3376
3384
|
return ShapeType2;
|
|
3377
3385
|
})(ShapeType || {});
|
|
3378
|
-
const sphereNoConvexProps =
|
|
3386
|
+
const sphereNoConvexProps = {
|
|
3379
3387
|
radius: 0
|
|
3380
|
-
}
|
|
3381
|
-
class SphereNoConvex extends createClass(
|
|
3388
|
+
};
|
|
3389
|
+
class SphereNoConvex extends createClass(sphereNoConvexProps) {
|
|
3382
3390
|
getConvexRadius() {
|
|
3383
3391
|
return this.radius;
|
|
3384
3392
|
}
|
|
@@ -3386,10 +3394,10 @@ class SphereNoConvex extends createClass()(sphereNoConvexProps) {
|
|
|
3386
3394
|
out.zero();
|
|
3387
3395
|
}
|
|
3388
3396
|
}
|
|
3389
|
-
const sphereWithConvexProps =
|
|
3397
|
+
const sphereWithConvexProps = {
|
|
3390
3398
|
radius: 0
|
|
3391
|
-
}
|
|
3392
|
-
class SphereWithConvex extends createClass(
|
|
3399
|
+
};
|
|
3400
|
+
class SphereWithConvex extends createClass(sphereWithConvexProps) {
|
|
3393
3401
|
getConvexRadius() {
|
|
3394
3402
|
return 0;
|
|
3395
3403
|
}
|
|
@@ -3402,7 +3410,7 @@ class SphereWithConvex extends createClass()(sphereWithConvexProps) {
|
|
|
3402
3410
|
}
|
|
3403
3411
|
}
|
|
3404
3412
|
}
|
|
3405
|
-
const sphereProps =
|
|
3413
|
+
const sphereProps = {
|
|
3406
3414
|
computedCenterOfMass: ChildType(Vec3, void 0, true),
|
|
3407
3415
|
computedVolume: NumberType(0, true),
|
|
3408
3416
|
computedAabb: ChildType(Aabb, void 0, true),
|
|
@@ -3410,11 +3418,11 @@ const sphereProps = props({
|
|
|
3410
3418
|
copyForDiff: LazyReferenceType((() => Sphere)),
|
|
3411
3419
|
sphereNoConvex: ChildType(SphereNoConvex, void 0, true),
|
|
3412
3420
|
sphereWithConvex: ChildType(SphereWithConvex, void 0, true)
|
|
3413
|
-
}
|
|
3421
|
+
};
|
|
3414
3422
|
const afterConstructorCode$a = `
|
|
3415
3423
|
this.world = null;
|
|
3416
3424
|
`;
|
|
3417
|
-
class Sphere extends createClass({ afterConstructorCode: afterConstructorCode$a })
|
|
3425
|
+
class Sphere extends createClass(sphereProps, { afterConstructorCode: afterConstructorCode$a }) {
|
|
3418
3426
|
constructor() {
|
|
3419
3427
|
super(...arguments);
|
|
3420
3428
|
this.type = ShapeType.sphere;
|
|
@@ -3510,12 +3518,12 @@ const isometry$8 = /* @__PURE__ */ Isometry.create();
|
|
|
3510
3518
|
const absLocalSurfacePosition = /* @__PURE__ */ Vec3.create();
|
|
3511
3519
|
const tempVector$4 = /* @__PURE__ */ Vec3.create();
|
|
3512
3520
|
const defaultConvexRadius = 0.05;
|
|
3513
|
-
const boxSupportProps =
|
|
3521
|
+
const boxSupportProps = {
|
|
3514
3522
|
convexRadius: 0,
|
|
3515
3523
|
// TODO: cannot used undefined default for this, possibly due to it being used as a deeply nested prop
|
|
3516
3524
|
computedAabb: ChildType(Aabb, {}, true)
|
|
3517
|
-
}
|
|
3518
|
-
class BoxSupport extends createClass(
|
|
3525
|
+
};
|
|
3526
|
+
class BoxSupport extends createClass(boxSupportProps) {
|
|
3519
3527
|
computeSupport(out, direction2) {
|
|
3520
3528
|
this.computedAabb.computeSupport(out, direction2);
|
|
3521
3529
|
}
|
|
@@ -3523,7 +3531,7 @@ class BoxSupport extends createClass()(boxSupportProps) {
|
|
|
3523
3531
|
return this.convexRadius;
|
|
3524
3532
|
}
|
|
3525
3533
|
}
|
|
3526
|
-
const boxProps =
|
|
3534
|
+
const boxProps = {
|
|
3527
3535
|
computedCenterOfMass: ChildType(Vec3, void 0, true),
|
|
3528
3536
|
computedVolume: NumberType(0, true),
|
|
3529
3537
|
computedAabb: ChildType(Aabb, void 0, true),
|
|
@@ -3533,11 +3541,11 @@ const boxProps = props({
|
|
|
3533
3541
|
depth: 0,
|
|
3534
3542
|
boxSupport: ChildType(BoxSupport, void 0, true),
|
|
3535
3543
|
copyForDiff: LazyReferenceType((() => Box))
|
|
3536
|
-
}
|
|
3544
|
+
};
|
|
3537
3545
|
const afterConstructorCode$9 = `
|
|
3538
3546
|
this.world = null;
|
|
3539
3547
|
`;
|
|
3540
|
-
class Box extends createClass({ afterConstructorCode: afterConstructorCode$9 })
|
|
3548
|
+
class Box extends createClass(boxProps, { afterConstructorCode: afterConstructorCode$9 }) {
|
|
3541
3549
|
constructor() {
|
|
3542
3550
|
super(...arguments);
|
|
3543
3551
|
this.type = ShapeType.box;
|
|
@@ -3654,23 +3662,23 @@ function updateShape$6(shape) {
|
|
|
3654
3662
|
updateVolume$4(shape);
|
|
3655
3663
|
updateLocalBounds$6(shape);
|
|
3656
3664
|
}
|
|
3657
|
-
const bodyPairNodeProps =
|
|
3665
|
+
const bodyPairNodeProps = {
|
|
3658
3666
|
bodyA: LazyReferenceType((() => Body)),
|
|
3659
3667
|
bodyB: LazyReferenceType((() => Body)),
|
|
3660
3668
|
edgeA: LazyReferenceType((() => BodyPairEdge)),
|
|
3661
3669
|
edgeB: LazyReferenceType((() => BodyPairEdge))
|
|
3662
|
-
}
|
|
3663
|
-
class BodyPairNode extends createClass(
|
|
3670
|
+
};
|
|
3671
|
+
class BodyPairNode extends createClass(bodyPairNodeProps) {
|
|
3664
3672
|
containsStaticBody() {
|
|
3665
3673
|
return this.bodyA.type === BodyType.static || this.bodyB.type === BodyType.static;
|
|
3666
3674
|
}
|
|
3667
3675
|
}
|
|
3668
|
-
const bodyPairEdgeProps =
|
|
3676
|
+
const bodyPairEdgeProps = {
|
|
3669
3677
|
node: LazyReferenceType((() => BodyPairNode)),
|
|
3670
3678
|
next: LazyReferenceType((() => BodyPairEdge)),
|
|
3671
3679
|
prev: LazyReferenceType((() => BodyPairEdge))
|
|
3672
|
-
}
|
|
3673
|
-
class BodyPairEdge extends createClass(
|
|
3680
|
+
};
|
|
3681
|
+
class BodyPairEdge extends createClass(bodyPairEdgeProps) {
|
|
3674
3682
|
}
|
|
3675
3683
|
class BodyPairsModule {
|
|
3676
3684
|
constructor(bodyPool, nodesPool, edgesPool) {
|
|
@@ -3909,12 +3917,12 @@ class BodyPairsModule {
|
|
|
3909
3917
|
}
|
|
3910
3918
|
}
|
|
3911
3919
|
}
|
|
3912
|
-
const rayProps =
|
|
3920
|
+
const rayProps = {
|
|
3913
3921
|
origin: Vec3,
|
|
3914
3922
|
direction: Vec3,
|
|
3915
3923
|
length: 0
|
|
3916
|
-
}
|
|
3917
|
-
class Ray extends createClass(
|
|
3924
|
+
};
|
|
3925
|
+
class Ray extends createClass(rayProps) {
|
|
3918
3926
|
intersectsAabb(aabb) {
|
|
3919
3927
|
return aabb.intersectsRay(this);
|
|
3920
3928
|
}
|
|
@@ -4028,15 +4036,15 @@ const ray$4 = /* @__PURE__ */ Ray.create();
|
|
|
4028
4036
|
const halfExtents$2 = /* @__PURE__ */ Vec3.create();
|
|
4029
4037
|
const nodeBounds$1 = /* @__PURE__ */ Aabb.create();
|
|
4030
4038
|
const bodyBounds$1 = /* @__PURE__ */ Aabb.create();
|
|
4031
|
-
const bvhNodeProps$1 =
|
|
4039
|
+
const bvhNodeProps$1 = {
|
|
4032
4040
|
parent: LazyReferenceType((() => BvhNode)),
|
|
4033
4041
|
left: LazyReferenceType((() => BvhNode)),
|
|
4034
4042
|
right: LazyReferenceType((() => BvhNode)),
|
|
4035
4043
|
computedBounds: ChildType(Aabb, void 0, true),
|
|
4036
4044
|
height: 0,
|
|
4037
4045
|
objects: LazyReferenceListType((() => Body))
|
|
4038
|
-
}
|
|
4039
|
-
class BvhNode extends createClass(
|
|
4046
|
+
};
|
|
4047
|
+
class BvhNode extends createClass(bvhNodeProps$1) {
|
|
4040
4048
|
// objects: Body[] = [];
|
|
4041
4049
|
isLeaf() {
|
|
4042
4050
|
return this.left === null && this.right === null;
|
|
@@ -4560,20 +4568,20 @@ class BvhTree {
|
|
|
4560
4568
|
}
|
|
4561
4569
|
}
|
|
4562
4570
|
}
|
|
4563
|
-
const basicTransformProps =
|
|
4571
|
+
const basicTransformProps = {
|
|
4564
4572
|
position: Vec3,
|
|
4565
4573
|
rotation: Quat,
|
|
4566
4574
|
scale: 1
|
|
4567
|
-
}
|
|
4568
|
-
class BasicTransform extends createClass(
|
|
4575
|
+
};
|
|
4576
|
+
class BasicTransform extends createClass(basicTransformProps) {
|
|
4569
4577
|
equals(other, tolerance = 1e-6) {
|
|
4570
4578
|
return this.position.equals(other.position, tolerance) && this.rotation.equals(other.rotation, tolerance) && Math.abs(this.scale - other.scale) < tolerance;
|
|
4571
4579
|
}
|
|
4572
4580
|
}
|
|
4573
|
-
const numberValueProps =
|
|
4581
|
+
const numberValueProps = {
|
|
4574
4582
|
value: 0
|
|
4575
|
-
}
|
|
4576
|
-
class NumberValue extends createClass(
|
|
4583
|
+
};
|
|
4584
|
+
class NumberValue extends createClass(numberValueProps) {
|
|
4577
4585
|
toObject() {
|
|
4578
4586
|
return {
|
|
4579
4587
|
value: this.value
|
|
@@ -4635,12 +4643,12 @@ class ConvexHullWithConvex {
|
|
|
4635
4643
|
throw new Error("Method not implemented.");
|
|
4636
4644
|
}
|
|
4637
4645
|
}
|
|
4638
|
-
const convexHullPointProps =
|
|
4646
|
+
const convexHullPointProps = {
|
|
4639
4647
|
position: Vec3,
|
|
4640
4648
|
numFaces: 0,
|
|
4641
4649
|
faces: Vec3
|
|
4642
|
-
}
|
|
4643
|
-
class ConvexHullPoint extends createClass(
|
|
4650
|
+
};
|
|
4651
|
+
class ConvexHullPoint extends createClass(convexHullPointProps) {
|
|
4644
4652
|
toObject() {
|
|
4645
4653
|
return {
|
|
4646
4654
|
position: this.position.toObject(),
|
|
@@ -4649,11 +4657,11 @@ class ConvexHullPoint extends createClass()(convexHullPointProps) {
|
|
|
4649
4657
|
};
|
|
4650
4658
|
}
|
|
4651
4659
|
}
|
|
4652
|
-
const convexHullFaceProps =
|
|
4660
|
+
const convexHullFaceProps = {
|
|
4653
4661
|
firstVertex: 0,
|
|
4654
4662
|
numVertices: 0
|
|
4655
|
-
}
|
|
4656
|
-
class ConvexHullFace extends createClass(
|
|
4663
|
+
};
|
|
4664
|
+
class ConvexHullFace extends createClass(convexHullFaceProps) {
|
|
4657
4665
|
toObject() {
|
|
4658
4666
|
return {
|
|
4659
4667
|
firstVertex: this.firstVertex,
|
|
@@ -4661,7 +4669,7 @@ class ConvexHullFace extends createClass()(convexHullFaceProps) {
|
|
|
4661
4669
|
};
|
|
4662
4670
|
}
|
|
4663
4671
|
}
|
|
4664
|
-
const convexHullProps =
|
|
4672
|
+
const convexHullProps = {
|
|
4665
4673
|
computedCenterOfMass: ChildType(Vec3, void 0, true),
|
|
4666
4674
|
computedVolume: NumberType(0, true),
|
|
4667
4675
|
computedAabb: ChildType(Aabb, void 0, true),
|
|
@@ -4680,14 +4688,14 @@ const convexHullProps = props({
|
|
|
4680
4688
|
// { array: Float64Array(f), itemMaxCount: f / 3, itemSize: 3 } [Vec3], transformed points used by ConvexHullNoConvex
|
|
4681
4689
|
translation: ChildType(Vec3, { x: 0, y: 0, z: 0 }),
|
|
4682
4690
|
copyForDiff: LazyReferenceType((() => ConvexHull))
|
|
4683
|
-
}
|
|
4691
|
+
};
|
|
4684
4692
|
const afterConstructorCode$8 = `
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4693
|
+
this.world = null;
|
|
4694
|
+
this.shapeNoConvex = null;
|
|
4695
|
+
this.shapeWithConvex = null;
|
|
4696
|
+
this.type = ${ShapeType.convexHull};
|
|
4689
4697
|
`;
|
|
4690
|
-
class ConvexHull extends createClass({ afterConstructorCode: afterConstructorCode$8 })
|
|
4698
|
+
class ConvexHull extends createClass(convexHullProps, { afterConstructorCode: afterConstructorCode$8 }) {
|
|
4691
4699
|
computeSupportShape(inMode, inScale) {
|
|
4692
4700
|
if (this.convexRadius === 0) {
|
|
4693
4701
|
this.shapeWithConvex.shape = this;
|
|
@@ -4872,12 +4880,14 @@ const vertex = /* @__PURE__ */ Vec3.create();
|
|
|
4872
4880
|
const multiplier = /* @__PURE__ */ Vec3.create();
|
|
4873
4881
|
const transform$1 = /* @__PURE__ */ Mat4.create();
|
|
4874
4882
|
const isometry$6 = /* @__PURE__ */ Isometry.create();
|
|
4875
|
-
const cylinderSupportShapeProps =
|
|
4883
|
+
const cylinderSupportShapeProps = {
|
|
4876
4884
|
halfHeight: 0,
|
|
4877
4885
|
radius: 0,
|
|
4878
4886
|
convexRadius: 0
|
|
4879
|
-
}
|
|
4880
|
-
class CylinderSupportShape extends createClass(
|
|
4887
|
+
};
|
|
4888
|
+
class CylinderSupportShape extends createClass(
|
|
4889
|
+
cylinderSupportShapeProps
|
|
4890
|
+
) {
|
|
4881
4891
|
getConvexRadius() {
|
|
4882
4892
|
return this.convexRadius;
|
|
4883
4893
|
}
|
|
@@ -4900,7 +4910,7 @@ class CylinderSupportShape extends createClass()(cylinderSupportShapeProps) {
|
|
|
4900
4910
|
throw new Error("Method not implemented.");
|
|
4901
4911
|
}
|
|
4902
4912
|
}
|
|
4903
|
-
const cylinderProps =
|
|
4913
|
+
const cylinderProps = {
|
|
4904
4914
|
computedCenterOfMass: ChildType(Vec3, void 0, true),
|
|
4905
4915
|
computedVolume: NumberType(0, true),
|
|
4906
4916
|
computedAabb: ChildType(Aabb, void 0, true),
|
|
@@ -4910,11 +4920,11 @@ const cylinderProps = props({
|
|
|
4910
4920
|
translation: ChildType(Vec3, void 0, true),
|
|
4911
4921
|
supportShape: ChildType(CylinderSupportShape, void 0, true),
|
|
4912
4922
|
copyForDiff: LazyReferenceType((() => Cylinder))
|
|
4913
|
-
}
|
|
4923
|
+
};
|
|
4914
4924
|
const afterConstructorCode$7 = `
|
|
4915
4925
|
this.world = null;
|
|
4916
4926
|
`;
|
|
4917
|
-
class Cylinder extends createClass({ afterConstructorCode: afterConstructorCode$7 })
|
|
4927
|
+
class Cylinder extends createClass(cylinderProps, { afterConstructorCode: afterConstructorCode$7 }) {
|
|
4918
4928
|
constructor() {
|
|
4919
4929
|
super(...arguments);
|
|
4920
4930
|
this.type = ShapeType.cylinder;
|
|
@@ -5070,11 +5080,11 @@ const support = /* @__PURE__ */ Vec3.create();
|
|
|
5070
5080
|
const supportTop = /* @__PURE__ */ Vec3.create();
|
|
5071
5081
|
const negatedScaledHalfHeightOfCylinder = /* @__PURE__ */ Vec3.create();
|
|
5072
5082
|
const supportBottom = /* @__PURE__ */ Vec3.create();
|
|
5073
|
-
const capsuleNoConvexProps =
|
|
5083
|
+
const capsuleNoConvexProps = {
|
|
5074
5084
|
halfHeightOfCylinder: Vec3,
|
|
5075
5085
|
convexRadius: 0
|
|
5076
|
-
}
|
|
5077
|
-
class CapsuleNoConvex extends createClass(
|
|
5086
|
+
};
|
|
5087
|
+
class CapsuleNoConvex extends createClass(capsuleNoConvexProps) {
|
|
5078
5088
|
computeSupport(out, direction2) {
|
|
5079
5089
|
if (direction2.y > 0) {
|
|
5080
5090
|
out.copy(this.halfHeightOfCylinder);
|
|
@@ -5089,11 +5099,13 @@ class CapsuleNoConvex extends createClass()(capsuleNoConvexProps) {
|
|
|
5089
5099
|
throw new Error("Method not implemented.");
|
|
5090
5100
|
}
|
|
5091
5101
|
}
|
|
5092
|
-
const capsuleWithConvexProps =
|
|
5102
|
+
const capsuleWithConvexProps = {
|
|
5093
5103
|
halfHeightOfCylinder: Vec3,
|
|
5094
5104
|
radius: 0
|
|
5095
|
-
}
|
|
5096
|
-
class CapsuleWithConvex extends createClass(
|
|
5105
|
+
};
|
|
5106
|
+
class CapsuleWithConvex extends createClass(
|
|
5107
|
+
capsuleWithConvexProps
|
|
5108
|
+
) {
|
|
5097
5109
|
computeSupport(out, direction2) {
|
|
5098
5110
|
const len = direction2.length();
|
|
5099
5111
|
if (len > 0) {
|
|
@@ -5114,7 +5126,7 @@ class CapsuleWithConvex extends createClass()(capsuleWithConvexProps) {
|
|
|
5114
5126
|
throw new Error("Method not implemented.");
|
|
5115
5127
|
}
|
|
5116
5128
|
}
|
|
5117
|
-
const capsuleProps =
|
|
5129
|
+
const capsuleProps = {
|
|
5118
5130
|
computedCenterOfMass: ChildType(Vec3, void 0, true),
|
|
5119
5131
|
computedVolume: NumberType(0, true),
|
|
5120
5132
|
computedAabb: ChildType(Aabb, void 0, true),
|
|
@@ -5123,11 +5135,11 @@ const capsuleProps = props({
|
|
|
5123
5135
|
copyForDiff: LazyReferenceType((() => Capsule)),
|
|
5124
5136
|
capsuleNoConvex: ChildType(CapsuleNoConvex, void 0, true),
|
|
5125
5137
|
capsuleWithConvex: ChildType(CapsuleWithConvex, void 0, true)
|
|
5126
|
-
}
|
|
5138
|
+
};
|
|
5127
5139
|
const afterConstructorCode$6 = `
|
|
5128
5140
|
this.world = null;
|
|
5129
5141
|
`;
|
|
5130
|
-
class Capsule extends createClass({ afterConstructorCode: afterConstructorCode$6 })
|
|
5142
|
+
class Capsule extends createClass(capsuleProps, { afterConstructorCode: afterConstructorCode$6 }) {
|
|
5131
5143
|
constructor() {
|
|
5132
5144
|
super(...arguments);
|
|
5133
5145
|
this.type = ShapeType.capsule;
|
|
@@ -5272,7 +5284,7 @@ function updateShape$3(shape) {
|
|
|
5272
5284
|
updateVolume$2(shape);
|
|
5273
5285
|
updateLocalBounds$3(shape);
|
|
5274
5286
|
}
|
|
5275
|
-
const transformedShapeProps =
|
|
5287
|
+
const transformedShapeProps = {
|
|
5276
5288
|
shapeType: NumberType(ShapeType.box),
|
|
5277
5289
|
// we need to do "as 'shape' ..." otherwise they are just 'string' and not the actual specific keys
|
|
5278
5290
|
["shape" + ShapeType.box]: ReferenceType(Box, void 0, true),
|
|
@@ -5284,11 +5296,14 @@ const transformedShapeProps = props({
|
|
|
5284
5296
|
["shape" + ShapeType.sphere]: ReferenceType(Sphere, void 0, true),
|
|
5285
5297
|
// triangleMesh not supported
|
|
5286
5298
|
transform: BasicTransform
|
|
5287
|
-
}
|
|
5299
|
+
};
|
|
5288
5300
|
const afterConstructorCode$5 = `
|
|
5289
5301
|
this.world = null;
|
|
5290
5302
|
`;
|
|
5291
|
-
class TransformedShape extends createClass(
|
|
5303
|
+
class TransformedShape extends createClass(
|
|
5304
|
+
transformedShapeProps,
|
|
5305
|
+
{ afterConstructorCode: afterConstructorCode$5 }
|
|
5306
|
+
) {
|
|
5292
5307
|
get shape() {
|
|
5293
5308
|
return this["shape" + this.shapeType];
|
|
5294
5309
|
}
|
|
@@ -5310,18 +5325,18 @@ const transformedCenterOfMass = /* @__PURE__ */ Vec3.create();
|
|
|
5310
5325
|
const transformSubshapeToCompound = /* @__PURE__ */ Isometry.create();
|
|
5311
5326
|
const subShapeDirection = /* @__PURE__ */ Vec3.create();
|
|
5312
5327
|
const subShapeToWorld = /* @__PURE__ */ Isometry.create();
|
|
5313
|
-
const compoundShapeProps =
|
|
5328
|
+
const compoundShapeProps = {
|
|
5314
5329
|
computedCenterOfMass: ChildType(Vec3, {}, true),
|
|
5315
5330
|
computedVolume: NumberType(0, true),
|
|
5316
5331
|
computedAabb: ChildType(Aabb, {}, true),
|
|
5317
5332
|
copyForDiff: LazyReferenceType((() => CompoundShape)),
|
|
5318
5333
|
shapes: ReferenceListType(TransformedShape)
|
|
5319
|
-
}
|
|
5334
|
+
};
|
|
5320
5335
|
const afterConstructorCode$4 = `
|
|
5321
5336
|
this.world = null;
|
|
5322
5337
|
`;
|
|
5323
5338
|
const tempTransform = /* @__PURE__ */ BasicTransform.create();
|
|
5324
|
-
class CompoundShape extends createClass({ afterConstructorCode: afterConstructorCode$4 })
|
|
5339
|
+
class CompoundShape extends createClass(compoundShapeProps, { afterConstructorCode: afterConstructorCode$4 }) {
|
|
5325
5340
|
constructor() {
|
|
5326
5341
|
super(...arguments);
|
|
5327
5342
|
this.type = ShapeType.compoundShape;
|
|
@@ -5525,7 +5540,7 @@ const d = /* @__PURE__ */ Vec3.create();
|
|
|
5525
5540
|
const scale$1 = /* @__PURE__ */ Vec3.create();
|
|
5526
5541
|
const blockAabb = /* @__PURE__ */ Aabb.create();
|
|
5527
5542
|
const normal$1 = /* @__PURE__ */ Vec3.create();
|
|
5528
|
-
const heightMapProps =
|
|
5543
|
+
const heightMapProps = {
|
|
5529
5544
|
computedCenterOfMass: ChildType(Vec3, void 0, true),
|
|
5530
5545
|
computedVolume: NumberType(0, true),
|
|
5531
5546
|
computedAabb: ChildType(Aabb, {}, true),
|
|
@@ -5538,18 +5553,18 @@ const heightMapProps = props({
|
|
|
5538
5553
|
// maxHeights: PoolReferenceType(Vec1),
|
|
5539
5554
|
// levels: PoolReferenceType(Vec1),
|
|
5540
5555
|
// activeEdges: PoolReferenceType(Vec1),
|
|
5541
|
-
}
|
|
5556
|
+
};
|
|
5542
5557
|
const afterConstructorCode$3 = `
|
|
5543
|
-
|
|
5544
|
-
|
|
5545
|
-
|
|
5546
|
-
|
|
5547
|
-
|
|
5548
|
-
|
|
5549
|
-
|
|
5550
|
-
|
|
5558
|
+
this.world = null;
|
|
5559
|
+
this.heights = [];
|
|
5560
|
+
this.minHeights = [];
|
|
5561
|
+
this.maxHeights = [];
|
|
5562
|
+
this.levels = [];
|
|
5563
|
+
this.activeEdges = [];
|
|
5564
|
+
this.stack = [];
|
|
5565
|
+
this.children = [0, 0, 0, 0];
|
|
5551
5566
|
`;
|
|
5552
|
-
class HeightMap extends createClass({ afterConstructorCode: afterConstructorCode$3 })
|
|
5567
|
+
class HeightMap extends createClass(heightMapProps, { afterConstructorCode: afterConstructorCode$3 }) {
|
|
5553
5568
|
constructor() {
|
|
5554
5569
|
super(...arguments);
|
|
5555
5570
|
this.type = ShapeType.heightMap;
|
|
@@ -5676,8 +5691,8 @@ class HeightMap extends createClass({ afterConstructorCode: afterConstructorCode
|
|
|
5676
5691
|
}
|
|
5677
5692
|
}
|
|
5678
5693
|
/**
|
|
5679
|
-
|
|
5680
|
-
|
|
5694
|
+
* this function visits every block and triangle of the heightMap. take care when using it on high resolution heightMaps. it is intended to generate a debug visualization of the heightMap.
|
|
5695
|
+
*/
|
|
5681
5696
|
createTriangulatedVerticesAndNormalsArray() {
|
|
5682
5697
|
const vertices = [];
|
|
5683
5698
|
const normals = [];
|
|
@@ -5780,15 +5795,15 @@ function updateShape$1(shape) {
|
|
|
5780
5795
|
updateVolume(shape);
|
|
5781
5796
|
updateLocalBounds$1(shape);
|
|
5782
5797
|
}
|
|
5783
|
-
const bvhNodeProps =
|
|
5798
|
+
const bvhNodeProps = {
|
|
5784
5799
|
parent: LazyReferenceType((() => TriangleMeshBvhNode)),
|
|
5785
5800
|
left: LazyReferenceType((() => TriangleMeshBvhNode)),
|
|
5786
5801
|
right: LazyReferenceType((() => TriangleMeshBvhNode)),
|
|
5787
5802
|
computedBounds: ChildType(Aabb, void 0, true),
|
|
5788
5803
|
depth: NumberType(0, true),
|
|
5789
5804
|
objects: LazyReferenceListType((() => Triangle$1))
|
|
5790
|
-
}
|
|
5791
|
-
class TriangleMeshBvhNode extends createClass(
|
|
5805
|
+
};
|
|
5806
|
+
class TriangleMeshBvhNode extends createClass(bvhNodeProps) {
|
|
5792
5807
|
/**
|
|
5793
5808
|
* if bvh node is an internal node, this will be an empty list
|
|
5794
5809
|
* if bvh node is a leaf node, this will contain refs to the objects in the leaf
|
|
@@ -5843,10 +5858,12 @@ function splitObjects(objects) {
|
|
|
5843
5858
|
const rightObjects = objects.slice(mid);
|
|
5844
5859
|
return [leftObjects, rightObjects];
|
|
5845
5860
|
}
|
|
5846
|
-
const triangleMeshBvhTreeProps =
|
|
5861
|
+
const triangleMeshBvhTreeProps = {
|
|
5847
5862
|
nodes: ReferenceListType(TriangleMeshBvhNode)
|
|
5848
|
-
}
|
|
5849
|
-
class TriangleMeshBvhTree extends createClass(
|
|
5863
|
+
};
|
|
5864
|
+
class TriangleMeshBvhTree extends createClass(
|
|
5865
|
+
triangleMeshBvhTreeProps
|
|
5866
|
+
) {
|
|
5850
5867
|
constructor() {
|
|
5851
5868
|
super(...arguments);
|
|
5852
5869
|
this.intersectStack = [];
|
|
@@ -6041,7 +6058,7 @@ const halfExtents$1 = /* @__PURE__ */ Vec3.create();
|
|
|
6041
6058
|
const nodeBounds = /* @__PURE__ */ Aabb.create();
|
|
6042
6059
|
const bodyBounds = /* @__PURE__ */ Aabb.create();
|
|
6043
6060
|
const isometry$2 = /* @__PURE__ */ Isometry.create();
|
|
6044
|
-
const triangleMeshProps =
|
|
6061
|
+
const triangleMeshProps = {
|
|
6045
6062
|
computedCenterOfMass: ChildType(Vec3, void 0, true),
|
|
6046
6063
|
computedVolume: NumberType(0, true),
|
|
6047
6064
|
computedAabb: ChildType(Aabb, void 0, true),
|
|
@@ -6052,11 +6069,11 @@ const triangleMeshProps = props({
|
|
|
6052
6069
|
triangles: ReferenceListType(Triangle$1),
|
|
6053
6070
|
copyForDiff: LazyReferenceType((() => TriangleMesh)),
|
|
6054
6071
|
bvh: LazyReferenceType((() => TriangleMeshBvhTree))
|
|
6055
|
-
}
|
|
6072
|
+
};
|
|
6056
6073
|
const afterConstructorCode$2 = `
|
|
6057
6074
|
this.world = null;
|
|
6058
6075
|
`;
|
|
6059
|
-
class TriangleMesh extends createClass({ afterConstructorCode: afterConstructorCode$2 })
|
|
6076
|
+
class TriangleMesh extends createClass(triangleMeshProps, { afterConstructorCode: afterConstructorCode$2 }) {
|
|
6060
6077
|
constructor() {
|
|
6061
6078
|
super(...arguments);
|
|
6062
6079
|
this.type = ShapeType.triangleMesh;
|
|
@@ -6144,7 +6161,7 @@ function updateShape(shape) {
|
|
|
6144
6161
|
updateCopyForDiff(shape);
|
|
6145
6162
|
updateLocalBounds(shape);
|
|
6146
6163
|
}
|
|
6147
|
-
const constraintOptionsProps =
|
|
6164
|
+
const constraintOptionsProps = {
|
|
6148
6165
|
/**
|
|
6149
6166
|
* Value used to scale the amount of position error to correct per solve iteration. Expected to be in the interval [0, 1]
|
|
6150
6167
|
*/
|
|
@@ -6157,10 +6174,12 @@ const constraintOptionsProps = props({
|
|
|
6157
6174
|
* Value used to scale the strength of the constraint. recommend to tune in the interval of [0, 1], with 0 being no correction, 1 being full correction
|
|
6158
6175
|
*/
|
|
6159
6176
|
strength: 1
|
|
6160
|
-
}
|
|
6161
|
-
class ConstraintOptions extends createClass(
|
|
6177
|
+
};
|
|
6178
|
+
class ConstraintOptions extends createClass(
|
|
6179
|
+
constraintOptionsProps
|
|
6180
|
+
) {
|
|
6162
6181
|
}
|
|
6163
|
-
const pointConstraintComponentProps =
|
|
6182
|
+
const pointConstraintComponentProps = {
|
|
6164
6183
|
bodyA: LazyReferenceType((() => Body)),
|
|
6165
6184
|
bodyB: LazyReferenceType((() => Body)),
|
|
6166
6185
|
options: ChildType(ConstraintOptions, {
|
|
@@ -6174,8 +6193,8 @@ const pointConstraintComponentProps = props({
|
|
|
6174
6193
|
effectiveInverseInertiaA: ChildType(Mat3, void 0, true),
|
|
6175
6194
|
effectiveInverseInertiaB: ChildType(Mat3, void 0, true),
|
|
6176
6195
|
totalLambda: ChildType(Vec3, void 0, true)
|
|
6177
|
-
}
|
|
6178
|
-
class PointConstraintComponent extends createClass(
|
|
6196
|
+
};
|
|
6197
|
+
class PointConstraintComponent extends createClass(pointConstraintComponentProps) {
|
|
6179
6198
|
deactivate() {
|
|
6180
6199
|
this.effectiveMass.zero();
|
|
6181
6200
|
this.totalLambda.zero();
|
|
@@ -6284,15 +6303,15 @@ const lambda$2 = /* @__PURE__ */ Vec3.create();
|
|
|
6284
6303
|
const transformWorldToLocalA$2 = /* @__PURE__ */ Isometry.create();
|
|
6285
6304
|
const transformWorldToLocalB$2 = /* @__PURE__ */ Isometry.create();
|
|
6286
6305
|
const transformLocalToWorld$3 = /* @__PURE__ */ Mat4.create();
|
|
6287
|
-
const pointConstraintProps =
|
|
6306
|
+
const pointConstraintProps = {
|
|
6288
6307
|
...baseConstraintProps,
|
|
6289
6308
|
positionA: Vec3,
|
|
6290
6309
|
positionB: Vec3,
|
|
6291
6310
|
localPositionA: ChildType(Vec3, void 0, true),
|
|
6292
6311
|
localPositionB: ChildType(Vec3, void 0, true),
|
|
6293
6312
|
translationComponent: PointConstraintComponent
|
|
6294
|
-
}
|
|
6295
|
-
class PointConstraint extends createClass(
|
|
6313
|
+
};
|
|
6314
|
+
class PointConstraint extends createClass(pointConstraintProps) {
|
|
6296
6315
|
constructor() {
|
|
6297
6316
|
super(...arguments);
|
|
6298
6317
|
this.type = ConstraintType.pointConstraint;
|
|
@@ -6361,7 +6380,7 @@ PointConstraint.create = function() {
|
|
|
6361
6380
|
constraint.world.sleepModule.wakeBodyUp(constraint.bodyB);
|
|
6362
6381
|
return constraint;
|
|
6363
6382
|
};
|
|
6364
|
-
const rotationEulerComponentProps =
|
|
6383
|
+
const rotationEulerComponentProps = {
|
|
6365
6384
|
bodyA: LazyReferenceType((() => Body)),
|
|
6366
6385
|
bodyB: LazyReferenceType((() => Body)),
|
|
6367
6386
|
options: ChildType(ConstraintOptions, {
|
|
@@ -6373,8 +6392,10 @@ const rotationEulerComponentProps = props({
|
|
|
6373
6392
|
mInvI2: ChildType(Mat3, void 0, true),
|
|
6374
6393
|
effectiveMassRotationComponent: ChildType(Mat3, void 0, true),
|
|
6375
6394
|
totalLambdaRotationComponent: ChildType(Vec3, void 0, true)
|
|
6376
|
-
}
|
|
6377
|
-
class RotationEulerComponent extends createClass(
|
|
6395
|
+
};
|
|
6396
|
+
class RotationEulerComponent extends createClass(
|
|
6397
|
+
rotationEulerComponentProps
|
|
6398
|
+
) {
|
|
6378
6399
|
deactivate() {
|
|
6379
6400
|
this.effectiveMassRotationComponent.zero();
|
|
6380
6401
|
this.totalLambdaRotationComponent.zero();
|
|
@@ -6466,7 +6487,7 @@ const anchor = /* @__PURE__ */ Vec3.create();
|
|
|
6466
6487
|
const transformWorldToLocalA$1 = /* @__PURE__ */ Mat4.create();
|
|
6467
6488
|
const transformWorldToLocalB$1 = /* @__PURE__ */ Mat4.create();
|
|
6468
6489
|
const inverseRotationB = /* @__PURE__ */ Quat.create();
|
|
6469
|
-
const fixedConstraintProps =
|
|
6490
|
+
const fixedConstraintProps = {
|
|
6470
6491
|
...baseConstraintProps,
|
|
6471
6492
|
positionA: ChildType(Vec3),
|
|
6472
6493
|
positionB: ChildType(Vec3),
|
|
@@ -6485,8 +6506,8 @@ const fixedConstraintProps = props({
|
|
|
6485
6506
|
inverseInitialRotationAToB: ChildType(Quat, void 0, true),
|
|
6486
6507
|
translationComponent: PointConstraintComponent,
|
|
6487
6508
|
rotationComponent: RotationEulerComponent
|
|
6488
|
-
}
|
|
6489
|
-
class FixedConstraint extends createClass(
|
|
6509
|
+
};
|
|
6510
|
+
class FixedConstraint extends createClass(fixedConstraintProps) {
|
|
6490
6511
|
constructor() {
|
|
6491
6512
|
super(...arguments);
|
|
6492
6513
|
this.type = ConstraintType.fixedConstraint;
|
|
@@ -6619,7 +6640,7 @@ var SpringMode = /* @__PURE__ */ ((SpringMode2) => {
|
|
|
6619
6640
|
SpringMode2[SpringMode2["UseStiffness"] = 1] = "UseStiffness";
|
|
6620
6641
|
return SpringMode2;
|
|
6621
6642
|
})(SpringMode || {});
|
|
6622
|
-
const springProps =
|
|
6643
|
+
const springProps = {
|
|
6623
6644
|
mode: NumberType(
|
|
6624
6645
|
0
|
|
6625
6646
|
/* UseFrequency */
|
|
@@ -6627,8 +6648,8 @@ const springProps = props({
|
|
|
6627
6648
|
damping: 0,
|
|
6628
6649
|
frequency: 0,
|
|
6629
6650
|
stiffness: 0
|
|
6630
|
-
}
|
|
6631
|
-
class Spring extends createClass(
|
|
6651
|
+
};
|
|
6652
|
+
class Spring extends createClass(springProps) {
|
|
6632
6653
|
hasStiffness() {
|
|
6633
6654
|
return this.frequency > 0;
|
|
6634
6655
|
}
|
|
@@ -6636,11 +6657,11 @@ class Spring extends createClass()(springProps) {
|
|
|
6636
6657
|
return this.frequency >= 0 && this.damping >= 0 && this.stiffness >= 0;
|
|
6637
6658
|
}
|
|
6638
6659
|
}
|
|
6639
|
-
const springComponentProps =
|
|
6660
|
+
const springComponentProps = {
|
|
6640
6661
|
bias: 0,
|
|
6641
6662
|
softness: 0
|
|
6642
|
-
}
|
|
6643
|
-
class SpringComponent extends createClass(
|
|
6663
|
+
};
|
|
6664
|
+
class SpringComponent extends createClass(springComponentProps) {
|
|
6644
6665
|
getBias(lambda2) {
|
|
6645
6666
|
return this.softness * lambda2 + this.bias;
|
|
6646
6667
|
}
|
|
@@ -6682,7 +6703,7 @@ const inverseInertiaA$1 = /* @__PURE__ */ Mat3.create();
|
|
|
6682
6703
|
const inverseInertiaB$1 = /* @__PURE__ */ Mat3.create();
|
|
6683
6704
|
const linearImpulse = /* @__PURE__ */ Vec3.create();
|
|
6684
6705
|
const angularImpulse = /* @__PURE__ */ Vec3.create();
|
|
6685
|
-
const axisComponentProps =
|
|
6706
|
+
const axisComponentProps = {
|
|
6686
6707
|
bodyA: LazyReferenceType((() => Body)),
|
|
6687
6708
|
bodyB: LazyReferenceType((() => Body)),
|
|
6688
6709
|
options: ChildType(ConstraintOptions, {
|
|
@@ -6697,8 +6718,8 @@ const axisComponentProps = props({
|
|
|
6697
6718
|
effectiveMass: 0,
|
|
6698
6719
|
totalLambda: 0,
|
|
6699
6720
|
springComponent: SpringComponent
|
|
6700
|
-
}
|
|
6701
|
-
class AxisComponent extends createClass(
|
|
6721
|
+
};
|
|
6722
|
+
class AxisComponent extends createClass(axisComponentProps) {
|
|
6702
6723
|
deactivate() {
|
|
6703
6724
|
this.effectiveMass = 0;
|
|
6704
6725
|
this.totalLambda = 0;
|
|
@@ -6853,7 +6874,7 @@ const localToWorldTransformB = /* @__PURE__ */ Mat4.create();
|
|
|
6853
6874
|
const armA = /* @__PURE__ */ Vec3.create();
|
|
6854
6875
|
const armB = /* @__PURE__ */ Vec3.create();
|
|
6855
6876
|
const vectorAB$5 = /* @__PURE__ */ Vec3.create();
|
|
6856
|
-
const distanceConstraintProps =
|
|
6877
|
+
const distanceConstraintProps = {
|
|
6857
6878
|
...baseConstraintProps,
|
|
6858
6879
|
positionA: ChildType(Vec3, { x: 0, y: 0, z: 0 }),
|
|
6859
6880
|
positionB: ChildType(Vec3, { x: 0, y: 0, z: 0 }),
|
|
@@ -6868,8 +6889,8 @@ const distanceConstraintProps = props({
|
|
|
6868
6889
|
worldNormal: ChildType(Vec3, void 0, true),
|
|
6869
6890
|
minLambda: NumberType(0, true),
|
|
6870
6891
|
maxLambda: NumberType(0, true)
|
|
6871
|
-
}
|
|
6872
|
-
class DistanceConstraint extends createClass(
|
|
6892
|
+
};
|
|
6893
|
+
class DistanceConstraint extends createClass(distanceConstraintProps) {
|
|
6873
6894
|
constructor() {
|
|
6874
6895
|
super(...arguments);
|
|
6875
6896
|
this.type = ConstraintType.distanceConstraint;
|
|
@@ -7016,7 +7037,7 @@ var MotorMode = /* @__PURE__ */ ((MotorMode2) => {
|
|
|
7016
7037
|
MotorMode2[MotorMode2["Velocity"] = 2] = "Velocity";
|
|
7017
7038
|
return MotorMode2;
|
|
7018
7039
|
})(MotorMode || {});
|
|
7019
|
-
const motorProps =
|
|
7040
|
+
const motorProps = {
|
|
7020
7041
|
spring: ChildType(Spring, { mode: SpringMode.UseFrequency, damping: 1, frequency: 2, stiffness: 2 }),
|
|
7021
7042
|
minForce: NumberType(-Infinity),
|
|
7022
7043
|
maxForce: NumberType(Infinity),
|
|
@@ -7026,8 +7047,8 @@ const motorProps = props({
|
|
|
7026
7047
|
0
|
|
7027
7048
|
/* Off */
|
|
7028
7049
|
)
|
|
7029
|
-
}
|
|
7030
|
-
class Motor extends createClass(
|
|
7050
|
+
};
|
|
7051
|
+
class Motor extends createClass(motorProps) {
|
|
7031
7052
|
isValid() {
|
|
7032
7053
|
return this.spring.isValid() && this.minForce <= this.maxForce && this.minTorque <= this.maxTorque;
|
|
7033
7054
|
}
|
|
@@ -7039,7 +7060,7 @@ const perpendicular$1 = /* @__PURE__ */ Vec3.create();
|
|
|
7039
7060
|
const summedInverseInertia = /* @__PURE__ */ Mat3.create();
|
|
7040
7061
|
const massBA = /* @__PURE__ */ Vec3.create();
|
|
7041
7062
|
const massCA = /* @__PURE__ */ Vec3.create();
|
|
7042
|
-
const hingeComponentProps =
|
|
7063
|
+
const hingeComponentProps = {
|
|
7043
7064
|
bodyA: LazyReferenceType((() => Body)),
|
|
7044
7065
|
bodyB: LazyReferenceType((() => Body)),
|
|
7045
7066
|
options: ChildType(ConstraintOptions, {
|
|
@@ -7060,7 +7081,7 @@ const hingeComponentProps = props({
|
|
|
7060
7081
|
inverseInertiaB: ChildType(Mat3, void 0, true),
|
|
7061
7082
|
totalLambdaA: NumberType(0, true),
|
|
7062
7083
|
totalLambdaB: NumberType(0, true)
|
|
7063
|
-
}
|
|
7084
|
+
};
|
|
7064
7085
|
function getOrthogonalVector(out, a3) {
|
|
7065
7086
|
if (Math.abs(a3.x) > Math.abs(a3.y)) {
|
|
7066
7087
|
out.fromArray([a3.z, 0, -a3.x]);
|
|
@@ -7068,7 +7089,7 @@ function getOrthogonalVector(out, a3) {
|
|
|
7068
7089
|
out.fromArray([0, a3.z, -a3.y]);
|
|
7069
7090
|
}
|
|
7070
7091
|
}
|
|
7071
|
-
class HingeComponent extends createClass(
|
|
7092
|
+
class HingeComponent extends createClass(hingeComponentProps) {
|
|
7072
7093
|
deactivate() {
|
|
7073
7094
|
this.effectiveMass00 = 0;
|
|
7074
7095
|
this.effectiveMass01 = 0;
|
|
@@ -7186,7 +7207,7 @@ class HingeComponent extends createClass()(hingeComponentProps) {
|
|
|
7186
7207
|
const spinBA = /* @__PURE__ */ Vec3.create();
|
|
7187
7208
|
const deltaSpin$1 = /* @__PURE__ */ Vec3.create();
|
|
7188
7209
|
const inverseEffectiveMass = /* @__PURE__ */ Vec3.create();
|
|
7189
|
-
const angleComponentProps =
|
|
7210
|
+
const angleComponentProps = {
|
|
7190
7211
|
bodyA: LazyReferenceType((() => Body)),
|
|
7191
7212
|
bodyB: LazyReferenceType((() => Body)),
|
|
7192
7213
|
options: ChildType(ConstraintOptions, {
|
|
@@ -7199,8 +7220,8 @@ const angleComponentProps = props({
|
|
|
7199
7220
|
effectiveInverseInertiaA: ChildType(Vec3, void 0, true),
|
|
7200
7221
|
effectiveInverseInertiaB: ChildType(Vec3, void 0, true),
|
|
7201
7222
|
totalLambda: NumberType(0, true)
|
|
7202
|
-
}
|
|
7203
|
-
class AngleComponent extends createClass(
|
|
7223
|
+
};
|
|
7224
|
+
class AngleComponent extends createClass(angleComponentProps) {
|
|
7204
7225
|
deactivate() {
|
|
7205
7226
|
this.effectiveMass = 0;
|
|
7206
7227
|
this.totalLambda = 0;
|
|
@@ -7353,7 +7374,7 @@ const rotateLocalToWorldB = /* @__PURE__ */ Mat3.create();
|
|
|
7353
7374
|
const worldHingeA = /* @__PURE__ */ Vec3.create();
|
|
7354
7375
|
const worldHingeB = /* @__PURE__ */ Vec3.create();
|
|
7355
7376
|
const transformLocalToWorld = /* @__PURE__ */ Mat4.create();
|
|
7356
|
-
const hingeConstraintProps =
|
|
7377
|
+
const hingeConstraintProps = {
|
|
7357
7378
|
...baseConstraintProps,
|
|
7358
7379
|
// init data
|
|
7359
7380
|
pointA: ChildType(Vec3, { x: 0, y: 0, z: 0 }),
|
|
@@ -7385,8 +7406,8 @@ const hingeConstraintProps = props({
|
|
|
7385
7406
|
rotationConstraintPart: HingeComponent,
|
|
7386
7407
|
rotationLimitsConstraintPart: AngleComponent,
|
|
7387
7408
|
motorConstraintPart: AngleComponent
|
|
7388
|
-
}
|
|
7389
|
-
class HingeConstraint extends createClass(
|
|
7409
|
+
};
|
|
7410
|
+
class HingeConstraint extends createClass(hingeConstraintProps) {
|
|
7390
7411
|
constructor() {
|
|
7391
7412
|
super(...arguments);
|
|
7392
7413
|
this.type = ConstraintType.hingeConstraint;
|
|
@@ -7689,7 +7710,7 @@ HingeConstraint.create = function() {
|
|
|
7689
7710
|
constraint.world.sleepModule.wakeBodyUp(constraint.bodyB);
|
|
7690
7711
|
return constraint;
|
|
7691
7712
|
};
|
|
7692
|
-
const constraintPairNodeProps =
|
|
7713
|
+
const constraintPairNodeProps = {
|
|
7693
7714
|
bodyA: LazyReferenceType((() => Body)),
|
|
7694
7715
|
bodyB: LazyReferenceType((() => Body)),
|
|
7695
7716
|
edgeA: LazyReferenceType((() => ConstraintPairEdge)),
|
|
@@ -7699,13 +7720,14 @@ const constraintPairNodeProps = props({
|
|
|
7699
7720
|
constraintFixed: LazyReferenceType((() => FixedConstraint)),
|
|
7700
7721
|
constraintDistance: LazyReferenceType((() => DistanceConstraint)),
|
|
7701
7722
|
constraintHinge: LazyReferenceType((() => HingeConstraint))
|
|
7702
|
-
}
|
|
7723
|
+
};
|
|
7703
7724
|
const afterConstructorCode$1 = `
|
|
7704
7725
|
this.world = null;
|
|
7705
7726
|
this.constraints = [null, null, null, null];
|
|
7706
7727
|
`;
|
|
7707
|
-
class ConstraintPairNode extends createClass(
|
|
7708
|
-
constraintPairNodeProps
|
|
7728
|
+
class ConstraintPairNode extends createClass(
|
|
7729
|
+
constraintPairNodeProps,
|
|
7730
|
+
{ afterConstructorCode: afterConstructorCode$1 }
|
|
7709
7731
|
) {
|
|
7710
7732
|
containsStaticBody() {
|
|
7711
7733
|
return this.bodyA.type === BodyType.static || this.bodyB.type === BodyType.static;
|
|
@@ -7723,12 +7745,14 @@ class ConstraintPairNode extends createClass({ afterConstructorCode: afterConstr
|
|
|
7723
7745
|
this.constraintType = value.type;
|
|
7724
7746
|
}
|
|
7725
7747
|
}
|
|
7726
|
-
const constraintPairEdgeProps =
|
|
7748
|
+
const constraintPairEdgeProps = {
|
|
7727
7749
|
node: LazyReferenceType((() => ConstraintPairNode)),
|
|
7728
7750
|
next: LazyReferenceType((() => ConstraintPairEdge)),
|
|
7729
7751
|
prev: LazyReferenceType((() => ConstraintPairEdge))
|
|
7730
|
-
}
|
|
7731
|
-
class ConstraintPairEdge extends createClass(
|
|
7752
|
+
};
|
|
7753
|
+
class ConstraintPairEdge extends createClass(
|
|
7754
|
+
constraintPairEdgeProps
|
|
7755
|
+
) {
|
|
7732
7756
|
}
|
|
7733
7757
|
class ConstraintPairsModule {
|
|
7734
7758
|
constructor(constraintPairNodePool, constraintPairEdgePool) {
|
|
@@ -7969,7 +7993,7 @@ var ColliderType = /* @__PURE__ */ ((ColliderType2) => {
|
|
|
7969
7993
|
ColliderType2[ColliderType2["attractor"] = 3] = "attractor";
|
|
7970
7994
|
return ColliderType2;
|
|
7971
7995
|
})(ColliderType || {});
|
|
7972
|
-
const bodyProps =
|
|
7996
|
+
const bodyProps = {
|
|
7973
7997
|
type: NumberType(
|
|
7974
7998
|
0
|
|
7975
7999
|
/* dynamic */
|
|
@@ -8023,11 +8047,11 @@ const bodyProps = props({
|
|
|
8023
8047
|
(() => ConstraintPairEdge)
|
|
8024
8048
|
),
|
|
8025
8049
|
visitGeneration: NumberType(0, true)
|
|
8026
|
-
}
|
|
8050
|
+
};
|
|
8027
8051
|
const afterConstructorCode = `
|
|
8028
8052
|
this.world = null;
|
|
8029
8053
|
`;
|
|
8030
|
-
class Body extends createClass({ afterConstructorCode })
|
|
8054
|
+
class Body extends createClass(bodyProps, { afterConstructorCode }) {
|
|
8031
8055
|
get shape() {
|
|
8032
8056
|
return this["shape" + this.shapeType];
|
|
8033
8057
|
}
|
|
@@ -8382,7 +8406,7 @@ function updateBody(body2, updateBroadphase = true) {
|
|
|
8382
8406
|
body2.markBodyAsDirty();
|
|
8383
8407
|
}
|
|
8384
8408
|
}
|
|
8385
|
-
const castResultProps =
|
|
8409
|
+
const castResultProps = {
|
|
8386
8410
|
status: NumberType(
|
|
8387
8411
|
2
|
|
8388
8412
|
/* Indeterminate */
|
|
@@ -8406,8 +8430,8 @@ const castResultProps = props({
|
|
|
8406
8430
|
faceB: Face,
|
|
8407
8431
|
fraction: 0,
|
|
8408
8432
|
isBackFaceHit: BooleanType(false)
|
|
8409
|
-
}
|
|
8410
|
-
class CastResult extends createClass(
|
|
8433
|
+
};
|
|
8434
|
+
class CastResult extends createClass(castResultProps) {
|
|
8411
8435
|
/**
|
|
8412
8436
|
* swaps the A and B data
|
|
8413
8437
|
*/
|
|
@@ -8483,21 +8507,21 @@ function computeBarycentricCoordinates2d(outBarycentric, a3, b3, squaredToleranc
|
|
|
8483
8507
|
}
|
|
8484
8508
|
outBarycentric.isValid = true;
|
|
8485
8509
|
}
|
|
8486
|
-
const closestPointResultProps =
|
|
8510
|
+
const closestPointResultProps = {
|
|
8487
8511
|
point: Vec3,
|
|
8488
8512
|
pointSet: 0
|
|
8489
|
-
}
|
|
8490
|
-
class ClosestPointResult extends createClass(
|
|
8513
|
+
};
|
|
8514
|
+
class ClosestPointResult extends createClass(
|
|
8515
|
+
closestPointResultProps
|
|
8516
|
+
) {
|
|
8491
8517
|
}
|
|
8492
|
-
const barycentricCoordinatesResultProps =
|
|
8518
|
+
const barycentricCoordinatesResultProps = {
|
|
8493
8519
|
u: 0,
|
|
8494
8520
|
v: 0,
|
|
8495
8521
|
w: 0,
|
|
8496
8522
|
isValid: BooleanType(false)
|
|
8497
|
-
}
|
|
8498
|
-
class BarycentricCoordinatesResult extends createClass()
|
|
8499
|
-
barycentricCoordinatesResultProps
|
|
8500
|
-
) {
|
|
8523
|
+
};
|
|
8524
|
+
class BarycentricCoordinatesResult extends createClass(barycentricCoordinatesResultProps) {
|
|
8501
8525
|
}
|
|
8502
8526
|
const ab$3 = /* @__PURE__ */ Vec3.create();
|
|
8503
8527
|
const ac$2 = /* @__PURE__ */ Vec3.create();
|
|
@@ -8708,13 +8732,13 @@ function computeClosestPointOnTriangle(outClosestPoint, inA, inB, inC, mustInclu
|
|
|
8708
8732
|
tempVector$2.addVectors(tempVector$2, c);
|
|
8709
8733
|
outClosestPoint.point.scaleVector(n$1, tempVector$2.dot(n$1) / (3 * normalLengthSquared));
|
|
8710
8734
|
}
|
|
8711
|
-
const vec4Props =
|
|
8735
|
+
const vec4Props = {
|
|
8712
8736
|
x: 0,
|
|
8713
8737
|
y: 0,
|
|
8714
8738
|
z: 0,
|
|
8715
8739
|
w: 0
|
|
8716
|
-
}
|
|
8717
|
-
class Vec4 extends createClass(
|
|
8740
|
+
};
|
|
8741
|
+
class Vec4 extends createClass(vec4Props) {
|
|
8718
8742
|
}
|
|
8719
8743
|
const ab$1 = /* @__PURE__ */ Vec3.create();
|
|
8720
8744
|
const ac = /* @__PURE__ */ Vec3.create();
|
|
@@ -8816,30 +8840,32 @@ function computeClosestPointOnTetrahedron(result2, inA, inB, inC, inD, mustInclu
|
|
|
8816
8840
|
}
|
|
8817
8841
|
}
|
|
8818
8842
|
}
|
|
8819
|
-
const closestPointToSimplexProps =
|
|
8843
|
+
const closestPointToSimplexProps = {
|
|
8820
8844
|
point: Vec3,
|
|
8821
8845
|
squaredDistance: 0,
|
|
8822
8846
|
pointSet: 0,
|
|
8823
8847
|
closestPointFound: BooleanType(false)
|
|
8824
|
-
}
|
|
8825
|
-
class ClosestPointToSimplex extends createClass(
|
|
8848
|
+
};
|
|
8849
|
+
class ClosestPointToSimplex extends createClass(
|
|
8850
|
+
closestPointToSimplexProps
|
|
8851
|
+
) {
|
|
8826
8852
|
}
|
|
8827
|
-
const gjkClosestPointsProps =
|
|
8853
|
+
const gjkClosestPointsProps = {
|
|
8828
8854
|
squaredDistance: 0,
|
|
8829
8855
|
penetrationAxis: Vec3,
|
|
8830
8856
|
pointA: Vec3,
|
|
8831
8857
|
pointB: Vec3
|
|
8832
|
-
}
|
|
8833
|
-
class GjkClosestPoints extends createClass(
|
|
8858
|
+
};
|
|
8859
|
+
class GjkClosestPoints extends createClass(gjkClosestPointsProps) {
|
|
8834
8860
|
}
|
|
8835
|
-
const gjkCastShapeResultProps =
|
|
8861
|
+
const gjkCastShapeResultProps = {
|
|
8836
8862
|
isHitFound: false,
|
|
8837
8863
|
lambda: 1,
|
|
8838
8864
|
separatingAxis: Vec3,
|
|
8839
8865
|
pointA: Vec3,
|
|
8840
8866
|
pointB: Vec3
|
|
8841
|
-
}
|
|
8842
|
-
class GjkCastShapeResult extends createClass(
|
|
8867
|
+
};
|
|
8868
|
+
class GjkCastShapeResult extends createClass(gjkCastShapeResultProps) {
|
|
8843
8869
|
}
|
|
8844
8870
|
const transformedConvexObject = /* @__PURE__ */ new TransformedConvexObject();
|
|
8845
8871
|
const y0 = /* @__PURE__ */ Vec3.create();
|
|
@@ -9328,7 +9354,7 @@ var CollisionStatus = /* @__PURE__ */ ((CollisionStatus2) => {
|
|
|
9328
9354
|
CollisionStatus2[CollisionStatus2["Indeterminate"] = 2] = "Indeterminate";
|
|
9329
9355
|
return CollisionStatus2;
|
|
9330
9356
|
})(CollisionStatus || {});
|
|
9331
|
-
const collisionResultProps =
|
|
9357
|
+
const collisionResultProps = {
|
|
9332
9358
|
status: NumberType(
|
|
9333
9359
|
2
|
|
9334
9360
|
/* Indeterminate */
|
|
@@ -9350,8 +9376,8 @@ const collisionResultProps = props({
|
|
|
9350
9376
|
isBackFace: BooleanType(false),
|
|
9351
9377
|
faceA: Face,
|
|
9352
9378
|
faceB: Face
|
|
9353
|
-
}
|
|
9354
|
-
class CollisionResult extends createClass(
|
|
9379
|
+
};
|
|
9380
|
+
class CollisionResult extends createClass(collisionResultProps) {
|
|
9355
9381
|
/**
|
|
9356
9382
|
* swaps the A and B data
|
|
9357
9383
|
*/
|
|
@@ -9410,15 +9436,15 @@ var BackFaceMode = /* @__PURE__ */ ((BackFaceMode2) => {
|
|
|
9410
9436
|
BackFaceMode2[BackFaceMode2["CollideWithBackFaces"] = 1] = "CollideWithBackFaces";
|
|
9411
9437
|
return BackFaceMode2;
|
|
9412
9438
|
})(BackFaceMode || {});
|
|
9413
|
-
const edgeProps =
|
|
9439
|
+
const edgeProps = {
|
|
9414
9440
|
neighbourTriangle: LazyReferenceType((() => Triangle2)),
|
|
9415
9441
|
neighbourEdge: 0,
|
|
9416
9442
|
startIndex: 0
|
|
9417
|
-
}
|
|
9418
|
-
class Edge extends createClass(
|
|
9443
|
+
};
|
|
9444
|
+
class Edge extends createClass(edgeProps) {
|
|
9419
9445
|
//
|
|
9420
9446
|
}
|
|
9421
|
-
const triangleProps =
|
|
9447
|
+
const triangleProps = {
|
|
9422
9448
|
edge0: Edge,
|
|
9423
9449
|
edge1: Edge,
|
|
9424
9450
|
edge2: Edge,
|
|
@@ -9432,7 +9458,7 @@ const triangleProps = props({
|
|
|
9432
9458
|
removed: BooleanType(false),
|
|
9433
9459
|
inQueue: BooleanType(false),
|
|
9434
9460
|
iteration: 0
|
|
9435
|
-
}
|
|
9461
|
+
};
|
|
9436
9462
|
const vectorAB$4 = /* @__PURE__ */ Vec3.create();
|
|
9437
9463
|
const y10 = /* @__PURE__ */ Vec3.create();
|
|
9438
9464
|
const y20 = /* @__PURE__ */ Vec3.create();
|
|
@@ -9511,7 +9537,7 @@ function initTriangle(m, inIdx0, inIdx1, inIdx2, inPositions, minTriangleArea, b
|
|
|
9511
9537
|
}
|
|
9512
9538
|
}
|
|
9513
9539
|
}
|
|
9514
|
-
class Triangle2 extends createClass(
|
|
9540
|
+
class Triangle2 extends createClass(triangleProps) {
|
|
9515
9541
|
isFacing(inPosition) {
|
|
9516
9542
|
vectorAB$4.subtractVectors(inPosition, this.centroid);
|
|
9517
9543
|
return this.normal.dot(vectorAB$4) > 0;
|
|
@@ -10021,13 +10047,15 @@ const p10 = /* @__PURE__ */ Vec3.create();
|
|
|
10021
10047
|
const p12 = /* @__PURE__ */ Vec3.create();
|
|
10022
10048
|
const q10 = /* @__PURE__ */ Vec3.create();
|
|
10023
10049
|
const q12 = /* @__PURE__ */ Vec3.create();
|
|
10024
|
-
const penetrationDepthProps =
|
|
10050
|
+
const penetrationDepthProps = {
|
|
10025
10051
|
status: 0,
|
|
10026
10052
|
penetrationAxis: Vec3,
|
|
10027
10053
|
pointA: Vec3,
|
|
10028
10054
|
pointB: Vec3
|
|
10029
|
-
}
|
|
10030
|
-
class PenetrationDepth extends createClass(
|
|
10055
|
+
};
|
|
10056
|
+
class PenetrationDepth extends createClass(
|
|
10057
|
+
penetrationDepthProps
|
|
10058
|
+
) {
|
|
10031
10059
|
}
|
|
10032
10060
|
const transformed_a = /* @__PURE__ */ new TransformedConvexObject();
|
|
10033
10061
|
const closest = /* @__PURE__ */ GjkClosestPoints.create();
|
|
@@ -11292,15 +11320,13 @@ class CollideShapesModule {
|
|
|
11292
11320
|
);
|
|
11293
11321
|
}
|
|
11294
11322
|
}
|
|
11295
|
-
const estimateCollisionResponseResultProps =
|
|
11323
|
+
const estimateCollisionResponseResultProps = {
|
|
11296
11324
|
deltaLinearVelocityA: Vec3,
|
|
11297
11325
|
deltaAngularVelocityA: Vec3,
|
|
11298
11326
|
deltaLinearVelocityB: Vec3,
|
|
11299
11327
|
deltaAngularVelocityB: Vec3
|
|
11300
|
-
}
|
|
11301
|
-
class EstimateCollisionResponseResult extends createClass()
|
|
11302
|
-
estimateCollisionResponseResultProps
|
|
11303
|
-
) {
|
|
11328
|
+
};
|
|
11329
|
+
class EstimateCollisionResponseResult extends createClass(estimateCollisionResponseResultProps) {
|
|
11304
11330
|
}
|
|
11305
11331
|
function estimateCollisionResponse(result2, manifold, timeStepSizeSeconds) {
|
|
11306
11332
|
result2.reset();
|
|
@@ -11967,11 +11993,11 @@ class ManifoldCache {
|
|
|
11967
11993
|
const contactPairCacheMaxDeltaPositionSquared = squared(1e-3);
|
|
11968
11994
|
const contactPairCacheCosMaxDeltaRotationDiv2 = Math.cos(degreesToRadians(2) / 2);
|
|
11969
11995
|
const negatedPenetrationAxis = /* @__PURE__ */ Vec3.create();
|
|
11970
|
-
const vec3BufferProps =
|
|
11996
|
+
const vec3BufferProps = {
|
|
11971
11997
|
numItems: 0,
|
|
11972
11998
|
vec3List: ReferenceListType(Vec3)
|
|
11973
|
-
}
|
|
11974
|
-
class Vec3Buffer extends createClass(
|
|
11999
|
+
};
|
|
12000
|
+
class Vec3Buffer extends createClass(vec3BufferProps) {
|
|
11975
12001
|
getVec3(out, index) {
|
|
11976
12002
|
out.copy(this.vec3List.getAtIndex(index));
|
|
11977
12003
|
}
|