@adatechnology/game-items-three 0.8.3 → 0.8.4
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.global.js +136 -48
- package/dist/index.global.js.map +1 -1
- package/package.json +8 -8
package/dist/index.global.js
CHANGED
|
@@ -16161,9 +16161,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
16161
16161
|
var PANEL_POINTS_LOADED = 4;
|
|
16162
16162
|
var MEMBER_BAND = 0.1;
|
|
16163
16163
|
var MEMBER_CRATER_CALIBRES = 3.4;
|
|
16164
|
-
var MEMBER_BARED_MAX = 24;
|
|
16165
16164
|
var MEMBER_CUT_LOSS = 0.9;
|
|
16166
|
-
var MEMBER_UNIT_LOSS = 0.
|
|
16165
|
+
var MEMBER_UNIT_LOSS = 0.12;
|
|
16166
|
+
var JOINT_OPEN_SHARE = 0.6;
|
|
16167
16167
|
var BLAST_EDGE_WEAR = 0.6;
|
|
16168
16168
|
var RESIDUAL_CAPACITY = 0.15;
|
|
16169
16169
|
var SEVER_BAND = 0.1;
|
|
@@ -17898,7 +17898,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
17898
17898
|
if (partSphereMiss(lo, ld, p, maxDist)) continue;
|
|
17899
17899
|
const r = rayPart(o, p, origin, d);
|
|
17900
17900
|
if (!r || r.t0 < 0 || r.t0 > maxDist) continue;
|
|
17901
|
-
if (p.st.opening && insideOpening(o, p, vec.madd(origin, d, r.t0))) continue;
|
|
17901
|
+
if (p.st.opening && insideOpening(o, p, objLocal(o, vec.madd(origin, d, r.t0)))) continue;
|
|
17902
|
+
if (p.spec.apertures && throughAperture(p, objLocal(o, vec.madd(origin, d, r.t0)))) continue;
|
|
17902
17903
|
if (p.st.chipped && insideChip(p, objLocal(o, vec.madd(origin, d, r.t0)))) continue;
|
|
17903
17904
|
if (!best || r.t0 < best.distance) best = { object: o.id, part: p.spec.id, point: vec.madd(origin, d, r.t0), normal: r.n, distance: r.t0, pathLen: r.t1 - r.t0 };
|
|
17904
17905
|
}
|
|
@@ -18094,7 +18095,27 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
18094
18095
|
for (let k = 0; k < 3; k++) len = Math.max(len, Math.min(A.max[k], B.max[k]) - Math.max(A.min[k], B.min[k]));
|
|
18095
18096
|
return len;
|
|
18096
18097
|
};
|
|
18097
|
-
const
|
|
18098
|
+
const onFoundation = (o, j) => o.parts[j.ia].spec.structure?.role === "foundation" || o.parts[j.ib].spec.structure?.role === "foundation";
|
|
18099
|
+
const wornStretches = /* @__PURE__ */ new WeakMap();
|
|
18100
|
+
const wornShare = (o, j, point, span) => {
|
|
18101
|
+
const A = partWorldAabb(o, o.parts[j.ia]), B = partWorldAabb(o, o.parts[j.ib]);
|
|
18102
|
+
const lo = [0, 1, 2].map((k) => Math.max(A.min[k], B.min[k])), hi = [0, 1, 2].map((k) => Math.min(A.max[k], B.max[k]));
|
|
18103
|
+
const axis = [0, 1, 2].reduce((best, k) => hi[k] - lo[k] > hi[best] - lo[best] ? k : best, 0);
|
|
18104
|
+
const length = hi[axis] - lo[axis];
|
|
18105
|
+
if (length <= span) return 1;
|
|
18106
|
+
const at2 = clamp2(point[axis], lo[axis], hi[axis]);
|
|
18107
|
+
const from = Math.max(lo[axis], at2 - span / 2), to = Math.min(hi[axis], at2 + span / 2);
|
|
18108
|
+
const worn = [...wornStretches.get(j) ?? [], [from, to]].sort((x, y) => x[0] - y[0]);
|
|
18109
|
+
wornStretches.set(j, worn);
|
|
18110
|
+
let covered = 0, end = -Infinity;
|
|
18111
|
+
for (const [a, b] of worn) {
|
|
18112
|
+
covered += Math.max(0, b - Math.max(a, end));
|
|
18113
|
+
end = Math.max(end, b);
|
|
18114
|
+
}
|
|
18115
|
+
return covered / length;
|
|
18116
|
+
};
|
|
18117
|
+
const isTrim = (p) => (p.spec.structure?.role ?? "none") === "none";
|
|
18118
|
+
const wearJoints = (o, p, amount, near, radius = 0.06, src, split = false, span, blast) => {
|
|
18098
18119
|
if (amount <= 0) return;
|
|
18099
18120
|
const mine = (o.byPart.get(p.spec.id) ?? []).filter((j) => !j.st.open);
|
|
18100
18121
|
if (split && mine.length) amount /= mine.length;
|
|
@@ -18102,7 +18123,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
18102
18123
|
if (j.st.open) continue;
|
|
18103
18124
|
if (j.spec.kind === "rebar" && (isReinforced(o.parts[j.ia].spec) || isReinforced(o.parts[j.ib].spec))) continue;
|
|
18104
18125
|
if (near && jointReach(o, j, near) > Math.max(radius, jointReachLimit(o, j))) continue;
|
|
18126
|
+
if (blast && (isTrim(o.parts[j.ia]) || isTrim(o.parts[j.ib])) && jointReach(o, j, blast.point) > Math.max(blast.reach, jointReachLimit(o, j))) continue;
|
|
18105
18127
|
j.st.hp -= span === void 0 ? amount : Math.min(amount, j.st.maxHp) * Math.min(1, span / Math.max(jointLength(o, j), 1e-6));
|
|
18128
|
+
if (j.st.hp <= 0 && blast && span !== void 0 && onFoundation(o, j) && wornShare(o, j, blast.point, span) < JOINT_OPEN_SHARE) j.st.hp = Math.min(j.st.maxHp, 1);
|
|
18106
18129
|
if (j.st.hp <= 0) {
|
|
18107
18130
|
j.st.hp = 0;
|
|
18108
18131
|
j.st.open = true;
|
|
@@ -18148,6 +18171,18 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
18148
18171
|
const lc = toLocal(p.pos, p.q, op.center);
|
|
18149
18172
|
return Math.hypot(lp[u] - lc[u], lp[v] - lc[v]) <= op.radius;
|
|
18150
18173
|
};
|
|
18174
|
+
const throughAperture = (p, objectPoint) => {
|
|
18175
|
+
const [u, v] = planeAxes(p.thin);
|
|
18176
|
+
const lp = toLocal(p.pos, p.q, objectPoint);
|
|
18177
|
+
return (p.spec.apertures ?? []).some((ap) => {
|
|
18178
|
+
const du = lp[u] - (ap.offset?.[0] ?? 0);
|
|
18179
|
+
const dv = lp[v] - (ap.offset?.[1] ?? 0);
|
|
18180
|
+
if (Math.abs(du) > ap.size[0] / 2 || Math.abs(dv) > ap.size[1] / 2) return false;
|
|
18181
|
+
if (!ap.bars || ap.bars.spacing <= 0) return true;
|
|
18182
|
+
const along = ap.bars.axis === 0 ? du + ap.size[0] / 2 : dv + ap.size[1] / 2;
|
|
18183
|
+
return Math.abs(along - Math.round(along / ap.bars.spacing) * ap.bars.spacing) > ap.bars.width / 2;
|
|
18184
|
+
});
|
|
18185
|
+
};
|
|
18151
18186
|
const breachAreaOf = (p, damage, blast) => damage / (p.mat.hpPerKg * p.mat.density) / Math.max(p.thickness, 5e-3) * (blast ? breachBlastFactor : 1);
|
|
18152
18187
|
const localHolesOf = (p) => p.st.holes.map((h) => ({ point: toLocal(p.pos, p.q, h.point), normal: rotateVec(quat.conjugate(p.q), h.normal), diameter: h.diameter }));
|
|
18153
18188
|
const unitsOf2 = (p) => p.spec.units ?? { size: [p.mat.fragmentSize?.[1] ?? 0.2, p.mat.fragmentSize?.[1] ?? 0.2, p.thickness], bond: "stack" };
|
|
@@ -18268,8 +18303,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
18268
18303
|
}
|
|
18269
18304
|
return cells.some((c) => Math.abs(lp[u] - c.center[u]) <= c.size[u] / 2 && Math.abs(lp[v] - c.center[v]) <= c.size[v] / 2);
|
|
18270
18305
|
};
|
|
18306
|
+
const wornLocally = (p) => !!p.spec.reinforcement && !!p.spec.units && p.spec.units.mortar === p.spec.material && isMember(p.dims) && p.spec.shape.kind === "box";
|
|
18271
18307
|
const wearMember = (o, p, entry2, d, E, caliber, penMm, src) => {
|
|
18272
|
-
var _a, _b, _c
|
|
18308
|
+
var _a, _b, _c;
|
|
18273
18309
|
if (!p.spec.reinforcement || !p.spec.units || !isMember(p.dims) || p.st.stripped || isLost(p) || p.spec.shape.kind !== "box") return false;
|
|
18274
18310
|
const along = p.dims.indexOf(Math.max(...p.dims));
|
|
18275
18311
|
const lp = toLocal(p.pos, p.q, objLocal(o, entry2));
|
|
@@ -18291,24 +18327,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
18291
18327
|
worn[band] = after;
|
|
18292
18328
|
markDamaged(p);
|
|
18293
18329
|
const bandCenter = -p.dims[along] / 2 + (band + 0.5) * height;
|
|
18294
|
-
if (h > REBAR_COVER && after < MEMBER_CUT_LOSS) {
|
|
18295
|
-
const bared = (_b = p.rt).bared ?? (_b.bared = []);
|
|
18296
|
-
const center = [lp[0], lp[1], lp[2]];
|
|
18297
|
-
const size = [p.dims[0], p.dims[1], p.dims[2]];
|
|
18298
|
-
for (let a = 0; a < 3; a++) if (Math.abs(ld[a]) < 0.5) size[a] = 2 * r;
|
|
18299
|
-
if (bared.length < MEMBER_BARED_MAX && !bared.some((box4) => box4.center.every((x, a) => Math.abs(x - center[a]) < box4.size[a] / 4))) {
|
|
18300
|
-
bared.push({ center, size });
|
|
18301
|
-
exposeRebar(o, p, src);
|
|
18302
|
-
}
|
|
18303
|
-
}
|
|
18304
18330
|
const grid = gridOf(p);
|
|
18305
|
-
const gone = (
|
|
18331
|
+
const gone = (_b = p.rt).chips ?? (_b.chips = {});
|
|
18306
18332
|
if (before >= MEMBER_CUT_LOSS || after < MEMBER_CUT_LOSS) {
|
|
18307
18333
|
if (h <= REBAR_COVER) return true;
|
|
18308
18334
|
const [u, v] = planeAxes(p.thin);
|
|
18309
18335
|
const hit = grid.findIndex((cell2, i) => gone[i] !== -1 && Math.abs(lp[u] - cell2.center[u]) <= cell2.size[u] / 2 && Math.abs(lp[v] - cell2.center[v]) <= cell2.size[v] / 2);
|
|
18310
18336
|
if (hit < 0) return true;
|
|
18311
|
-
const wear = (
|
|
18337
|
+
const wear = (_c = p.rt).cellWear ?? (_c.cellWear = {});
|
|
18312
18338
|
const cell = grid[hit];
|
|
18313
18339
|
wear[hit] = (wear[hit] ?? 0) + volume;
|
|
18314
18340
|
if (wear[hit] >= MEMBER_UNIT_LOSS * cell.size[0] * cell.size[1] * cell.size[2]) knockOutUnits(o, p, entry2, E, [hit], src);
|
|
@@ -18908,6 +18934,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
18908
18934
|
const chained = trigger !== void 0 && chainDelayOf(p.spec, trigger) !== void 0;
|
|
18909
18935
|
if (chained && p.st.hp <= 0 && p.rt.chainDue === void 0) p.st.hp = Math.min(prev, 1);
|
|
18910
18936
|
if (p.st.hp <= 0 && p.mat.fracture === "none" && !p.spec.explodes) p.st.hp = Math.min(prev, 1);
|
|
18937
|
+
if (p.st.hp <= 0 && type === "ballistic" && wornLocally(p)) p.st.hp = Math.min(prev, 1);
|
|
18911
18938
|
const done = prev - p.st.hp;
|
|
18912
18939
|
if (done > 0) emit({ ...base(o, src), type: "damage", part: p.spec.id, amount: done, hp: Math.max(0, p.st.hp), damageType: type });
|
|
18913
18940
|
if (p.st.hp <= 0) failPart(o, p, origin, dir, fragEnergy, cap, src);
|
|
@@ -19117,7 +19144,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
19117
19144
|
checkIgnite(o, p, src);
|
|
19118
19145
|
}
|
|
19119
19146
|
}
|
|
19120
|
-
|
|
19147
|
+
const stretch = 2 * BREACH_BLAST_REACH * Math.cbrt(Math.max(0, energy) / 1e3);
|
|
19148
|
+
wearJoints(o, p, Ein * 0.5, void 0, 0, src, false, stretch, { point, reach: stretch });
|
|
19121
19149
|
const amount = Ein * DMG_PER_J * (mat.damageScale?.explosive ?? 1);
|
|
19122
19150
|
if (blastFrontSpeed > 0 && dist > 0 && mat.tags?.includes("glass")) {
|
|
19123
19151
|
frontQueue.push({ o, p, due: time + dist / blastFrontSpeed, amount, fragEnergy: Ein * 0.3, point, ...src !== void 0 ? { src } : {} });
|
|
@@ -19261,7 +19289,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
19261
19289
|
const path = Math.min(r.t1, L) - t0;
|
|
19262
19290
|
if (path < shelter.minPath) continue;
|
|
19263
19291
|
const mid = vec.madd(point, d, t0 + path / 2);
|
|
19264
|
-
const opening = p.st.opening && insideOpening(o, p, mid);
|
|
19292
|
+
const opening = p.st.opening && insideOpening(o, p, objLocal(o, mid));
|
|
19265
19293
|
if (opening && was & FLAG_OPEN) continue;
|
|
19266
19294
|
if (p.st.stripped && was & FLAG_OPEN) continue;
|
|
19267
19295
|
const resistance = p.mat.hpPerKg * p.mat.density * path * (p.mat.damageScale?.shelter ?? 1);
|
|
@@ -21572,6 +21600,42 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
21572
21600
|
}
|
|
21573
21601
|
return { ...next, capacities };
|
|
21574
21602
|
}
|
|
21603
|
+
var planeAxes2 = (thin) => thin === 1 ? [0, 2] : [thin === 0 ? 2 : 0, 1];
|
|
21604
|
+
function toPartFrame(part, point) {
|
|
21605
|
+
const dx = point[0] - part.position[0];
|
|
21606
|
+
const dz = point[2] - part.position[2];
|
|
21607
|
+
const angle = -(part.rotation?.[1] ?? 0);
|
|
21608
|
+
return [dx * Math.cos(angle) + dz * Math.sin(angle), point[1] - part.position[1], -dx * Math.sin(angle) + dz * Math.cos(angle)];
|
|
21609
|
+
}
|
|
21610
|
+
function wallApertures(part, windows) {
|
|
21611
|
+
if (part.shape.kind !== "box") return [];
|
|
21612
|
+
const size = part.shape.size;
|
|
21613
|
+
const thin = size.indexOf(Math.min(...size));
|
|
21614
|
+
if (thin === 1) return [];
|
|
21615
|
+
const [along] = planeAxes2(thin);
|
|
21616
|
+
const turn = part.rotation?.[1] ?? 0;
|
|
21617
|
+
const alongU = Math.abs(Math.cos(turn)) * size[0] + Math.abs(Math.sin(turn)) * size[2] >= Math.abs(Math.sin(turn)) * size[0] + Math.abs(Math.cos(turn)) * size[2];
|
|
21618
|
+
return windows.map((opening2) => {
|
|
21619
|
+
const middle = (opening2.from + opening2.to) / 2;
|
|
21620
|
+
const centre2 = alongU ? [middle, (opening2.y0 + opening2.y1) / 2, part.position[2]] : [part.position[0], (opening2.y0 + opening2.y1) / 2, middle];
|
|
21621
|
+
const local = toPartFrame(part, centre2);
|
|
21622
|
+
return { size: [opening2.to - opening2.from, opening2.y1 - opening2.y0], offset: [local[along], local[1]] };
|
|
21623
|
+
});
|
|
21624
|
+
}
|
|
21625
|
+
function withWindowApertures(spec, openings) {
|
|
21626
|
+
const byWall = /* @__PURE__ */ new Map();
|
|
21627
|
+
for (const opening2 of openings) if (opening2.kind === "window") byWall.set(opening2.wall, [...byWall.get(opening2.wall) ?? [], opening2]);
|
|
21628
|
+
if (!byWall.size) return spec;
|
|
21629
|
+
return {
|
|
21630
|
+
...spec,
|
|
21631
|
+
parts: spec.parts.map((part) => {
|
|
21632
|
+
const windows = byWall.get(part.id);
|
|
21633
|
+
if (!windows) return part;
|
|
21634
|
+
const apertures = wallApertures(part, windows);
|
|
21635
|
+
return apertures.length ? { ...part, apertures: [...part.apertures ?? [], ...apertures] } : part;
|
|
21636
|
+
})
|
|
21637
|
+
};
|
|
21638
|
+
}
|
|
21575
21639
|
var RAFT_THICKNESS = 0.25;
|
|
21576
21640
|
var PILE_AREA = 9;
|
|
21577
21641
|
var RAFT_MARGIN = 0.15;
|
|
@@ -21670,7 +21734,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
21670
21734
|
const infill = new Set(portico && slabOptions ? kept.filter((part) => part.role === "wall").map((part) => part.id) : []);
|
|
21671
21735
|
const beams = new Set(parts.filter((part) => part.role === "beam" && (part.beamKind === "bond_beam" || part.slab !== void 0)).map((part) => part.id));
|
|
21672
21736
|
const joints = supports.filter((s) => present.has(s.part) && present.has(s.on)).map((s) => ({ id: `${s.part}~${s.on}`, a: s.part, b: s.on, kind: s.joint, bears: s.bears === false || beams.has(s.part) && infill.has(s.on) ? false : "a_on_b" }));
|
|
21673
|
-
const
|
|
21737
|
+
const built = { name: options.name ?? "house", parts: specs, joints, tags: ["structure", "house"] };
|
|
21738
|
+
const spec = detail === "coarse" && options.windowApertures !== false ? withWindowApertures(built, structure.openings) : built;
|
|
21674
21739
|
return onSoil(withRebar(spec, structure, options, portico, slabOptions !== void 0), structure, options);
|
|
21675
21740
|
}
|
|
21676
21741
|
function withRebar(spec, structure, options, portico, panelled) {
|
|
@@ -23544,7 +23609,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
23544
23609
|
}
|
|
23545
23610
|
var residentialTower = residentialTowerTemplate();
|
|
23546
23611
|
|
|
23547
|
-
// ../game-floorplan-three/dist/chunk-
|
|
23612
|
+
// ../game-floorplan-three/dist/chunk-RZF4G6CY.js
|
|
23548
23613
|
var __defProp3 = Object.defineProperty;
|
|
23549
23614
|
var __defNormalProp = (obj, key2, value) => key2 in obj ? __defProp3(obj, key2, { enumerable: true, configurable: true, writable: true, value }) : obj[key2] = value;
|
|
23550
23615
|
var __publicField = (obj, key2, value) => __defNormalProp(obj, typeof key2 !== "symbol" ? key2 + "" : key2, value);
|
|
@@ -24600,6 +24665,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
24600
24665
|
function installHouseWindows(K, shared2) {
|
|
24601
24666
|
const { EPS: EPS3, Y0, boxC, bx, cursor, pieceRecord, roomAt } = K;
|
|
24602
24667
|
const FRAME_COLORS = { budget: 15856110, mid: 12830924, high: 2829875, commercial: 11844287 };
|
|
24668
|
+
const ALUMINIUM_PROFILE_KG_PER_M = 1.2, SILL_KG_PER_M = 6, STEEL_KG_PER_M3 = 7850, GRILLE_BAR = 0.016;
|
|
24603
24669
|
const SILL_COLORS = { budget: 15131870, mid: 14277076, high: 3816770, commercial: 13225166 };
|
|
24604
24670
|
function windows() {
|
|
24605
24671
|
const R = shared2.ctx.r, cut = shared2.ctx.cut, C = shared2.ctx.colors, structure = R.style, fr = FRAME_COLORS[structure] || FRAME_COLORS.budget, pe_ = SILL_COLORS[structure] || SILL_COLORS.budget;
|
|
@@ -24615,7 +24681,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
24615
24681
|
}
|
|
24616
24682
|
const wref = R.walls.find((w) => w.floor === f && w.axis === j.axis && Math.abs((alongU ? w.v0 : w.u0) - L) < EPS3), th = wref ? wref.thickness || 0.15 : 0.15, t = 0.05, tt = th + 0.02;
|
|
24617
24683
|
const bar2 = (u0, y_0, u1, y_1, mat, color2, tw = tt) => alongU ? bx(mat, u0, y0 + y_0, L - tw / 2, u1, y0 + y_1, L + tw / 2, color2) : bx(mat, L - tw / 2, y0 + y_0, u0, L + tw / 2, y0 + y_1, u1, color2);
|
|
24618
|
-
const
|
|
24684
|
+
const outside0 = !roomAt(f, alongU ? j.at : L + 0.4, alongU ? L + 0.4 : j.at) || !roomAt(f, alongU ? j.at : L - 0.4, alongU ? L - 0.4 : j.at);
|
|
24685
|
+
const frameMass = ALUMINIUM_PROFILE_KG_PER_M * (2 * (j.width + (yb - ya)) + j.width + (j.width > 0.9 ? yb - ya : 0)) + (outside0 ? SILL_KG_PER_M * (j.width + 0.1) : 0);
|
|
24686
|
+
const frame2 = pieceRecord("window_frame:" + j.id, "aluminium", null, { floor: f, mass: frameMass, aperture: { alongU, a: a + t, b: b - t, y0: y0 + ya + t, y1: y0 + yb - t } });
|
|
24619
24687
|
cursor.pc = frame2;
|
|
24620
24688
|
bar2(a, ya, a + t, yb, "metal", fr);
|
|
24621
24689
|
bar2(b - t, ya, b, yb, "metal", fr);
|
|
@@ -24634,7 +24702,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
24634
24702
|
if (alongU) bx("plaster", a - 0.05, y0 + ya - 0.04, L + (outside > 0 ? th / 2 : -th / 2 - 0.08), b + 0.05, y0 + ya, L + (outside > 0 ? th / 2 + 0.08 : -th / 2), pe_);
|
|
24635
24703
|
else bx("plaster", L + (outside > 0 ? th / 2 : -th / 2 - 0.08), y0 + ya - 0.04, a - 0.05, L + (outside > 0 ? th / 2 + 0.08 : -th / 2), y0 + ya, b + 0.05, pe_);
|
|
24636
24704
|
if (R.facade.grilles && !cut) {
|
|
24637
|
-
const g = C.gate != null ? C.gate : 2763310, go = outside * (th / 2 + 0.07), n = Math.max(3, Math.round(j.width / 0.12));
|
|
24705
|
+
const g = C.gate != null ? C.gate : 2763310, go = outside * (th / 2 + 0.07), n = Math.max(3, Math.round(j.width / 0.12)), spacing = (j.width - 0.06) / n;
|
|
24706
|
+
cursor.pc = pieceRecord("window_grille:" + j.id, "steel", null, { floor: f, mass: STEEL_KG_PER_M3 * ((n + 1) * (yb - ya + 0.06) * GRILLE_BAR * GRILLE_BAR + 3 * j.width * 0.025 * 0.024), aperture: { alongU, a: a + 0.03, b: a + 0.03 + n * spacing, y0: y0 + ya - 0.03, y1: y0 + yb + 0.03, bars: { spacing, width: GRILLE_BAR } } });
|
|
24638
24707
|
for (let k = 0; k <= n; k++) {
|
|
24639
24708
|
const u = a + 0.03 + k * (j.width - 0.06) / n;
|
|
24640
24709
|
if (alongU) bx("metal", u - 8e-3, y0 + ya - 0.03, L + go - 8e-3, u + 8e-3, y0 + yb + 0.03, L + go + 8e-3, g);
|
|
@@ -24644,6 +24713,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
24644
24713
|
if (alongU) bx("metal", a, y0 + y, L + go - 0.012, b, y0 + y + 0.025, L + go + 0.012, g);
|
|
24645
24714
|
else bx("metal", L + go - 0.012, y0 + y, a, L + go + 0.012, y0 + y + 0.025, b, g);
|
|
24646
24715
|
}
|
|
24716
|
+
cursor.pc = frame2;
|
|
24647
24717
|
}
|
|
24648
24718
|
cursor.pc = null;
|
|
24649
24719
|
}
|
|
@@ -29898,6 +29968,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
29898
29968
|
else if (def.kind === "swing" || def.kind === "drawer") tagObject(def.name, [def.outer], "mdf", null, { mass: 6 });
|
|
29899
29969
|
}
|
|
29900
29970
|
}
|
|
29971
|
+
function apertureOf(sp, ap) {
|
|
29972
|
+
if (!ap || sp.shape.kind !== "box") return null;
|
|
29973
|
+
const size = sp.shape.size, depth = ap.alongU ? 2 : 0;
|
|
29974
|
+
if (size[depth] > Math.min(size[ap.alongU ? 0 : 2], size[1])) return null;
|
|
29975
|
+
const out = { size: [ap.b - ap.a, ap.y1 - ap.y0], offset: [(ap.a + ap.b) / 2 - sp.position[ap.alongU ? 0 : 2], (ap.y0 + ap.y1) / 2 - sp.position[1]] };
|
|
29976
|
+
if (ap.bars) out.bars = { axis: 0, spacing: ap.bars.spacing, width: ap.bars.width };
|
|
29977
|
+
return out;
|
|
29978
|
+
}
|
|
29901
29979
|
function assembleStructure(r0, root) {
|
|
29902
29980
|
const E0 = r0.structure || { parts: [], supports: [], levels: [], elevation: 0 }, meshes = /* @__PURE__ */ new Map(), add = (id, it) => {
|
|
29903
29981
|
let l = meshes.get(id);
|
|
@@ -29942,7 +30020,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
29942
30020
|
if (!b) continue;
|
|
29943
30021
|
const vol = Math.max(1e-6, (b[3] - b[0]) * (b[4] - b[1]) * (b[5] - b[2]));
|
|
29944
30022
|
const p = { id, role: "none", material: pc.mat, aabb: [b[0], b[2], b[3], b[5]], y0: b[1], y1: b[4], floor: pc.floor != null ? pc.floor : floorAtY(b[1] + 0.1), mass: pc.mass != null ? pc.mass : Math.max(0.5, vol * (DENSITY[pc.mat] || 800) * (pc.fill != null ? pc.fill : 0.15)), meshes: meshes.get(id).length, extra: true };
|
|
29945
|
-
for (const k of ["contains", "explodes", "tags", "form", "thickness", "fill", "units"]) if (pc[k] != null) p[k] = pc[k];
|
|
30023
|
+
for (const k of ["contains", "explodes", "tags", "form", "thickness", "fill", "units", "aperture"]) if (pc[k] != null) p[k] = pc[k];
|
|
29946
30024
|
parts.push(p);
|
|
29947
30025
|
byId.set(id, p);
|
|
29948
30026
|
}
|
|
@@ -30015,6 +30093,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
30015
30093
|
if (!pc0) return sp;
|
|
30016
30094
|
const extra = {};
|
|
30017
30095
|
for (const k of ["contains", "explodes", "thickness", "fill", "tags"]) if (pc0[k] != null && sp[k] == null) extra[k] = pc0[k];
|
|
30096
|
+
const aperture = apertureOf(sp, pc0.aperture);
|
|
30097
|
+
if (aperture) extra.apertures = [aperture];
|
|
30018
30098
|
return Object.keys(extra).length ? { ...sp, ...extra } : sp;
|
|
30019
30099
|
});
|
|
30020
30100
|
spec.parts = spec.parts.map((sp) => {
|
|
@@ -30038,7 +30118,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
30038
30118
|
return sp;
|
|
30039
30119
|
}
|
|
30040
30120
|
});
|
|
30041
|
-
|
|
30121
|
+
const walls = new Set((E0.openings ?? []).map((op) => op.wall));
|
|
30122
|
+
return withWindowApertures({ ...spec, parts: spec.parts.map((sp) => walls.has(sp.id) && sp.apertures ? (({ apertures: _gone, ...rest2 }) => rest2)(sp) : sp) }, E0.openings ?? []);
|
|
30042
30123
|
}
|
|
30043
30124
|
};
|
|
30044
30125
|
return structure;
|
|
@@ -30084,11 +30165,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
30084
30165
|
var SPALL_RAGGED = 0.045;
|
|
30085
30166
|
var COVER2 = 0.015;
|
|
30086
30167
|
var LUMP_BAR_INSET = 0.035;
|
|
30087
|
-
var LUMPS_PER_BAR =
|
|
30088
|
-
var LUMP_CHANCE = 0.
|
|
30168
|
+
var LUMPS_PER_BAR = 1;
|
|
30169
|
+
var LUMP_CHANCE = 0.5;
|
|
30089
30170
|
var LUMP_MIN = 0.025;
|
|
30090
30171
|
var LUMP_MAX = 0.05;
|
|
30091
|
-
var EDGE_LUMPS =
|
|
30172
|
+
var EDGE_LUMPS = 2;
|
|
30092
30173
|
var EDGE_LUMP_MIN = 0.04;
|
|
30093
30174
|
var EDGE_LUMP_MAX = 0.08;
|
|
30094
30175
|
var MAX_FLAKES = 64;
|
|
@@ -30483,35 +30564,42 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
30483
30564
|
function stuckLumps(gone, mask, bounds2) {
|
|
30484
30565
|
const out = [];
|
|
30485
30566
|
const grey = fragmentMaterial("concrete").color.getHex();
|
|
30567
|
+
const stone = (s, y, d, size, r) => {
|
|
30568
|
+
const centre = mask.start + s;
|
|
30569
|
+
const unit = clipToBox({ x: mask.alongU ? centre : d, y, z: mask.alongU ? d : centre, sx: mask.alongU ? size[0] : size[2], sy: size[1], sz: mask.alongU ? size[2] : size[0], colour: tmp.c.setHex(grey).multiplyScalar(0.85 + 0.2 * r(7)).getHex() }, bounds2);
|
|
30570
|
+
if (unit) out.push(unit);
|
|
30571
|
+
};
|
|
30486
30572
|
for (const { c, part, thick, mid } of gone) {
|
|
30487
30573
|
const p0 = (mask.alongU ? part.aabb[0] : part.aabb[1]) - mask.start, p1 = (mask.alongU ? part.aabb[2] : part.aabb[3]) - mask.start;
|
|
30488
|
-
|
|
30489
|
-
|
|
30490
|
-
|
|
30491
|
-
|
|
30492
|
-
|
|
30493
|
-
|
|
30574
|
+
const lying = p1 - p0 > part.y1 - part.y0;
|
|
30575
|
+
const random = (seed) => (n) => {
|
|
30576
|
+
const x = Math.sin(seed + n * 3.3) * 43758.5453;
|
|
30577
|
+
return x - Math.floor(x);
|
|
30578
|
+
};
|
|
30579
|
+
const faces = lying ? [[c.a, 1], [c.b, 2]] : [[c.y0, 1], [c.y1, 2]];
|
|
30580
|
+
for (const [face, f] of faces) {
|
|
30581
|
+
const open = gone.some((g) => g.part === part && g.c !== c && (lying ? Math.abs((f === 1 ? g.c.b : g.c.a) - face) < 1e-4 && g.c.y1 > c.y0 + 1e-4 && g.c.y0 < c.y1 - 1e-4 : Math.abs((f === 1 ? g.c.y1 : g.c.y0) - face) < 1e-4 && g.c.b > c.a + 1e-4 && g.c.a < c.b - 1e-4));
|
|
30582
|
+
if (open) continue;
|
|
30583
|
+
for (let k = 0; k < EDGE_LUMPS; k++) {
|
|
30584
|
+
const r = random(c.a * 63.1 + c.y0 * 29.7 + mid * 17.3 + f * 11.1 + k * 5.3);
|
|
30494
30585
|
const size = EDGE_LUMP_MIN + (EDGE_LUMP_MAX - EDGE_LUMP_MIN) * r(1);
|
|
30495
|
-
const
|
|
30496
|
-
const
|
|
30497
|
-
|
|
30586
|
+
const d = mid + (r(3) - 0.5) * (thick - 2 * LUMP_BAR_INSET);
|
|
30587
|
+
const s = lying ? face : c.a + (0.1 + 0.8 * r(2)) * (c.b - c.a);
|
|
30588
|
+
const y = lying ? c.y0 + (0.1 + 0.8 * r(2)) * (c.y1 - c.y0) : face;
|
|
30589
|
+
stone(s, y, d, [size, size * (0.6 + 0.5 * r(4)), size], r);
|
|
30498
30590
|
}
|
|
30499
30591
|
}
|
|
30500
|
-
const bars = [p0 + LUMP_BAR_INSET, p1 - LUMP_BAR_INSET].filter((s) => s >= c.a - 1e-6 && s <= c.b + 1e-6);
|
|
30501
|
-
for (const
|
|
30592
|
+
const bars = lying ? [part.y0 + LUMP_BAR_INSET, part.y1 - LUMP_BAR_INSET].filter((y) => y >= c.y0 - 1e-6 && y <= c.y1 + 1e-6) : [p0 + LUMP_BAR_INSET, p1 - LUMP_BAR_INSET].filter((s) => s >= c.a - 1e-6 && s <= c.b + 1e-6);
|
|
30593
|
+
for (const bar2 of bars) {
|
|
30502
30594
|
for (const side of [-1, 1]) {
|
|
30503
30595
|
const d = mid + side * (thick / 2 - LUMP_BAR_INSET);
|
|
30504
30596
|
for (let k = 0; k < LUMPS_PER_BAR; k++) {
|
|
30505
|
-
const r = (
|
|
30506
|
-
const x = Math.sin(s * 91.7 + d * 47.3 + c.y0 * 113.1 + k * 7.9 + n * 3.3) * 43758.5453;
|
|
30507
|
-
return x - Math.floor(x);
|
|
30508
|
-
};
|
|
30597
|
+
const r = random(bar2 * 91.7 + d * 47.3 + c.y0 * 113.1 + c.a * 19.9 + k * 7.9);
|
|
30509
30598
|
if (r(1) > LUMP_CHANCE) continue;
|
|
30510
|
-
const
|
|
30511
|
-
const
|
|
30512
|
-
const
|
|
30513
|
-
|
|
30514
|
-
if (unit) out.push(unit);
|
|
30599
|
+
const at2 = 0.15 + 0.7 * r(2), jitter = (r(6) - 0.5) * 0.02;
|
|
30600
|
+
const s = lying ? c.a + at2 * (c.b - c.a) : bar2 + jitter;
|
|
30601
|
+
const y = lying ? bar2 + jitter : c.y0 + at2 * (c.y1 - c.y0);
|
|
30602
|
+
stone(s, y, d, [LUMP_MIN + (LUMP_MAX - LUMP_MIN) * r(3), LUMP_MIN + (LUMP_MAX - LUMP_MIN) * r(4), LUMP_MIN + (LUMP_MAX - LUMP_MIN) * r(5)], r);
|
|
30515
30603
|
}
|
|
30516
30604
|
}
|
|
30517
30605
|
}
|