@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.d.ts CHANGED
@@ -821,6 +821,11 @@ declare class DecalPool {
821
821
  constructor(context: WorkshopContext);
822
822
  add(x: number, y: number, z: number, size: number, color: number, options?: DecalOptions): void;
823
823
  clear(): void;
824
+ /**
825
+ * 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
826
+ * world axes). The surface they were on is gone (a brick came out of a wall with its bullet holes). Returns how many went.
827
+ */
828
+ clearInside(center: Vec3Tuple, half: Vec3Tuple, rotation?: readonly [number, number, number, number]): number;
824
829
  update(dt: number): void;
825
830
  }
826
831
 
@@ -6659,6 +6659,24 @@ var GameVfx = (() => {
6659
6659
  for (const decal2 of this.decals) decal2.on = false;
6660
6660
  this.count = 0;
6661
6661
  }
6662
+ /**
6663
+ * 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
6664
+ * world axes). The surface they were on is gone (a brick came out of a wall with its bullet holes). Returns how many went.
6665
+ */
6666
+ clearInside(center, half, rotation = [0, 0, 0, 1]) {
6667
+ const qx = -rotation[0], qy = -rotation[1], qz = -rotation[2], qw = rotation[3];
6668
+ let gone = 0;
6669
+ for (const decal2 of this.decals) {
6670
+ if (!decal2.on) continue;
6671
+ const vx2 = decal2.x - center[0], vy2 = decal2.y - center[1], vz2 = decal2.z - center[2];
6672
+ const tx = 2 * (qy * vz2 - qz * vy2), ty = 2 * (qz * vx2 - qx * vz2), tz = 2 * (qx * vy2 - qy * vx2);
6673
+ 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);
6674
+ if (Math.abs(lx) > half[0] || Math.abs(ly) > half[1] || Math.abs(lz) > half[2]) continue;
6675
+ decal2.on = false;
6676
+ gone++;
6677
+ }
6678
+ return gone;
6679
+ }
6662
6680
  update(dt) {
6663
6681
  this.count = 0;
6664
6682
  for (const decal2 of this.decals) {