@adatechnology/game-vfx-three 0.3.4 → 0.3.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.
@@ -6377,6 +6377,24 @@ var GameVfxThree = (() => {
6377
6377
  for (const decal2 of this.decals) decal2.on = false;
6378
6378
  this.count = 0;
6379
6379
  }
6380
+ /**
6381
+ * 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
6382
+ * world axes). The surface they were on is gone (a brick came out of a wall with its bullet holes). Returns how many went.
6383
+ */
6384
+ clearInside(center, half, rotation = [0, 0, 0, 1]) {
6385
+ const qx = -rotation[0], qy = -rotation[1], qz = -rotation[2], qw = rotation[3];
6386
+ let gone = 0;
6387
+ for (const decal2 of this.decals) {
6388
+ if (!decal2.on) continue;
6389
+ const vx2 = decal2.x - center[0], vy2 = decal2.y - center[1], vz2 = decal2.z - center[2];
6390
+ const tx = 2 * (qy * vz2 - qz * vy2), ty = 2 * (qz * vx2 - qx * vz2), tz = 2 * (qx * vy2 - qy * vx2);
6391
+ 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);
6392
+ if (Math.abs(lx) > half[0] || Math.abs(ly) > half[1] || Math.abs(lz) > half[2]) continue;
6393
+ decal2.on = false;
6394
+ gone++;
6395
+ }
6396
+ return gone;
6397
+ }
6380
6398
  update(dt) {
6381
6399
  this.count = 0;
6382
6400
  for (const decal2 of this.decals) {