@adatechnology/game-items-three 0.3.0 → 0.3.1

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.
@@ -12694,6 +12694,23 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
12694
12694
  return angle === 0 ? q : quat.mul(q, quat.fromAxisAngle([0, 0, 1], angle));
12695
12695
  };
12696
12696
  var clamp = (v, a, b) => Math.max(a, Math.min(b, v));
12697
+ var tearStack = (inp, root, t, u, v, n, sheet) => {
12698
+ const { dims, rnd, maxFragments } = inp;
12699
+ const layers = clamp(Math.ceil(dims[t] / STACK_LAYER), 2, 4);
12700
+ const per = clamp(n, 3, Math.max(3, Math.floor(maxFragments / layers)));
12701
+ const out = [];
12702
+ for (let k = 0; k < layers; k++) {
12703
+ const off = -dims[t] / 2 + (k + 0.5) * dims[t] / layers;
12704
+ for (const b of bsp(root, per, [u, v], rnd)) {
12705
+ if (out.length >= maxFragments) return out;
12706
+ const c = [b.c[0], b.c[1], b.c[2]];
12707
+ c[t] = off;
12708
+ out.push({ center: c, size: [b.s[u], b.s[v], sheet], q: frame(u, v, t, (rnd() - 0.5) * 0.8), shape: "scrap", weight: b.s[u] * b.s[v], inner: out.length % 4 !== 0 });
12709
+ }
12710
+ }
12711
+ return out;
12712
+ };
12713
+ var STACK_LAYER = 0.012;
12697
12714
  var planFragments = (inp) => {
12698
12715
  const { style, dims, rnd, maxFragments } = inp;
12699
12716
  const [fmin, fmax] = inp.fragmentSize;
@@ -12736,6 +12753,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
12736
12753
  }
12737
12754
  if (style === "tear") {
12738
12755
  const n2 = clamp(Math.round(dims[u] * dims[v] / (mean * mean)), 3, maxFragments);
12756
+ const sheet = inp.sheet ?? 0;
12757
+ if (sheet > 0 && dims[t] > sheet * 4) return tearStack(inp, root, t, u, v, n2, sheet);
12739
12758
  const th2 = Math.min(inp.thickness, dims[t]);
12740
12759
  for (const b of bsp(root, n2, [u, v], rnd)) {
12741
12760
  out.push({ center: [b.c[0], b.c[1], b.c[2]], size: [b.s[u], b.s[v], th2], q: frame(u, v, t), shape: "scrap", weight: b.s[u] * b.s[v] });
@@ -14318,6 +14337,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
14318
14337
  0.03,
14319
14338
  0.15
14320
14339
  ],
14340
+ sheet: 1e-3,
14321
14341
  damageScale: {
14322
14342
  slash: 3
14323
14343
  },
@@ -14333,7 +14353,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
14333
14353
  smoke: "grey"
14334
14354
  },
14335
14355
  visual: {
14336
- charColor: 1709072
14356
+ charColor: 1709072,
14357
+ innerColor: 15524048
14337
14358
  },
14338
14359
  tags: [
14339
14360
  "fabric",
@@ -16046,7 +16067,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
16046
16067
  hit: hitLocal,
16047
16068
  fragmentSize: p.mat.fragmentSize ?? [0.04, 0.2],
16048
16069
  maxFragments,
16049
- rnd
16070
+ rnd,
16071
+ sheet: p.mat.sheet
16050
16072
  });
16051
16073
  const holes = p.st.holes.length > 0 ? localHolesOf(p) : [];
16052
16074
  const mass = p.st.mass;
@@ -16070,7 +16092,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
16070
16092
  velocity: [dv[0] * k, dv[1] * k + 0.5 * rnd(), dv[2] * k],
16071
16093
  angularVelocity: [(rnd() - 0.5) * 12, (rnd() - 0.5) * 12, (rnd() - 0.5) * 12],
16072
16094
  mass: mass * f.weight / totW,
16073
- ...marks.length > 0 ? { marks } : {}
16095
+ ...marks.length > 0 ? { marks } : {},
16096
+ ...f.inner ? { inner: true } : {}
16074
16097
  };
16075
16098
  });
16076
16099
  const reinforcement = p.spec.reinforcement;