@adatechnology/game-vfx 0.4.4 → 0.5.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/dist/index.js CHANGED
@@ -6584,6 +6584,24 @@ var DecalPool = class {
6584
6584
  for (const decal2 of this.decals) decal2.on = false;
6585
6585
  this.count = 0;
6586
6586
  }
6587
+ /**
6588
+ * 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
6589
+ * world axes). The surface they were on is gone (a brick came out of a wall with its bullet holes). Returns how many went.
6590
+ */
6591
+ clearInside(center, half, rotation = [0, 0, 0, 1]) {
6592
+ const qx = -rotation[0], qy = -rotation[1], qz = -rotation[2], qw = rotation[3];
6593
+ let gone = 0;
6594
+ for (const decal2 of this.decals) {
6595
+ if (!decal2.on) continue;
6596
+ const vx2 = decal2.x - center[0], vy2 = decal2.y - center[1], vz2 = decal2.z - center[2];
6597
+ const tx = 2 * (qy * vz2 - qz * vy2), ty = 2 * (qz * vx2 - qx * vz2), tz = 2 * (qx * vy2 - qy * vx2);
6598
+ 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);
6599
+ if (Math.abs(lx) > half[0] || Math.abs(ly) > half[1] || Math.abs(lz) > half[2]) continue;
6600
+ decal2.on = false;
6601
+ gone++;
6602
+ }
6603
+ return gone;
6604
+ }
6587
6605
  update(dt) {
6588
6606
  this.count = 0;
6589
6607
  for (const decal2 of this.decals) {