@adatechnology/game-fluids-three 0.4.4 → 0.4.5
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/dist/index.global.js +18 -0
- package/dist/index.global.js.map +1 -1
- package/package.json +5 -5
package/dist/index.global.js
CHANGED
|
@@ -6358,6 +6358,24 @@ var GameFluidsThree = (() => {
|
|
|
6358
6358
|
for (const decal2 of this.decals) decal2.on = false;
|
|
6359
6359
|
this.count = 0;
|
|
6360
6360
|
}
|
|
6361
|
+
/**
|
|
6362
|
+
* Takes away the marks inside a box: world `center`, `half` extents along the axes of the world `rotation` (a quaternion, x y z w; none means the
|
|
6363
|
+
* world axes). The surface they were on is gone (a brick came out of a wall with its bullet holes). Returns how many went.
|
|
6364
|
+
*/
|
|
6365
|
+
clearInside(center, half, rotation = [0, 0, 0, 1]) {
|
|
6366
|
+
const qx = -rotation[0], qy = -rotation[1], qz = -rotation[2], qw = rotation[3];
|
|
6367
|
+
let gone = 0;
|
|
6368
|
+
for (const decal2 of this.decals) {
|
|
6369
|
+
if (!decal2.on) continue;
|
|
6370
|
+
const vx2 = decal2.x - center[0], vy2 = decal2.y - center[1], vz2 = decal2.z - center[2];
|
|
6371
|
+
const tx = 2 * (qy * vz2 - qz * vy2), ty = 2 * (qz * vx2 - qx * vz2), tz = 2 * (qx * vy2 - qy * vx2);
|
|
6372
|
+
const lx = vx2 + qw * tx + (qy * tz - qz * ty), ly = vy2 + qw * ty + (qz * tx - qx * tz), lz = vz2 + qw * tz + (qx * ty - qy * tx);
|
|
6373
|
+
if (Math.abs(lx) > half[0] || Math.abs(ly) > half[1] || Math.abs(lz) > half[2]) continue;
|
|
6374
|
+
decal2.on = false;
|
|
6375
|
+
gone++;
|
|
6376
|
+
}
|
|
6377
|
+
return gone;
|
|
6378
|
+
}
|
|
6361
6379
|
update(dt) {
|
|
6362
6380
|
this.count = 0;
|
|
6363
6381
|
for (const decal2 of this.decals) {
|