@adatechnology/game-floorplan-three 0.4.1 → 0.4.2

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.
@@ -11232,6 +11232,23 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
11232
11232
  return angle === 0 ? q : quat.mul(q, quat.fromAxisAngle([0, 0, 1], angle));
11233
11233
  };
11234
11234
  var clamp = (v, a, b) => Math.max(a, Math.min(b, v));
11235
+ var tearStack = (inp, root, t, u, v, n, sheet) => {
11236
+ const { dims, rnd, maxFragments } = inp;
11237
+ const layers = clamp(Math.ceil(dims[t] / STACK_LAYER), 2, 4);
11238
+ const per = clamp(n, 3, Math.max(3, Math.floor(maxFragments / layers)));
11239
+ const out = [];
11240
+ for (let k = 0; k < layers; k++) {
11241
+ const off = -dims[t] / 2 + (k + 0.5) * dims[t] / layers;
11242
+ for (const b of bsp(root, per, [u, v], rnd)) {
11243
+ if (out.length >= maxFragments) return out;
11244
+ const c = [b.c[0], b.c[1], b.c[2]];
11245
+ c[t] = off;
11246
+ 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 });
11247
+ }
11248
+ }
11249
+ return out;
11250
+ };
11251
+ var STACK_LAYER = 0.012;
11235
11252
  var planFragments = (inp) => {
11236
11253
  const { style, dims, rnd, maxFragments } = inp;
11237
11254
  const [fmin, fmax] = inp.fragmentSize;
@@ -11274,6 +11291,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
11274
11291
  }
11275
11292
  if (style === "tear") {
11276
11293
  const n2 = clamp(Math.round(dims[u] * dims[v] / (mean * mean)), 3, maxFragments);
11294
+ const sheet = inp.sheet ?? 0;
11295
+ if (sheet > 0 && dims[t] > sheet * 4) return tearStack(inp, root, t, u, v, n2, sheet);
11277
11296
  const th2 = Math.min(inp.thickness, dims[t]);
11278
11297
  for (const b of bsp(root, n2, [u, v], rnd)) {
11279
11298
  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] });
@@ -12856,6 +12875,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
12856
12875
  0.03,
12857
12876
  0.15
12858
12877
  ],
12878
+ sheet: 1e-3,
12859
12879
  damageScale: {
12860
12880
  slash: 3
12861
12881
  },
@@ -12871,7 +12891,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
12871
12891
  smoke: "grey"
12872
12892
  },
12873
12893
  visual: {
12874
- charColor: 1709072
12894
+ charColor: 1709072,
12895
+ innerColor: 15524048
12875
12896
  },
12876
12897
  tags: [
12877
12898
  "fabric",
@@ -14584,7 +14605,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
14584
14605
  hit: hitLocal,
14585
14606
  fragmentSize: p.mat.fragmentSize ?? [0.04, 0.2],
14586
14607
  maxFragments,
14587
- rnd
14608
+ rnd,
14609
+ sheet: p.mat.sheet
14588
14610
  });
14589
14611
  const holes = p.st.holes.length > 0 ? localHolesOf(p) : [];
14590
14612
  const mass = p.st.mass;
@@ -14608,7 +14630,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
14608
14630
  velocity: [dv[0] * k, dv[1] * k + 0.5 * rnd(), dv[2] * k],
14609
14631
  angularVelocity: [(rnd() - 0.5) * 12, (rnd() - 0.5) * 12, (rnd() - 0.5) * 12],
14610
14632
  mass: mass * f.weight / totW,
14611
- ...marks.length > 0 ? { marks } : {}
14633
+ ...marks.length > 0 ? { marks } : {},
14634
+ ...f.inner ? { inner: true } : {}
14612
14635
  };
14613
14636
  });
14614
14637
  const reinforcement = p.spec.reinforcement;