@adatechnology/game-weapons-three 0.26.0 → 0.26.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.
- package/dist/index.global.js +233 -72
- package/dist/index.global.js.map +1 -1
- package/package.json +10 -10
package/dist/index.global.js
CHANGED
|
@@ -28523,6 +28523,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
28523
28523
|
return reach2;
|
|
28524
28524
|
};
|
|
28525
28525
|
let blastTntPerJoule = TNT_PER_JOULE;
|
|
28526
|
+
let blastHasCharge = false;
|
|
28526
28527
|
let blastFireball = chargeFireball(0);
|
|
28527
28528
|
const burstFuel = (p) => {
|
|
28528
28529
|
const c = p.spec.contains;
|
|
@@ -28627,7 +28628,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
28627
28628
|
}
|
|
28628
28629
|
for (const im of [...impls.values()]) {
|
|
28629
28630
|
if (!implInRange(im, point, radius)) continue;
|
|
28630
|
-
out.push(implHit(im, { type: "explosive", point, energy, radius, fireball: blastFireball, tnt: energy * blastTntPerJoule, ...lethal !== void 0 ? { lethalRadius: lethal } : {}, ...src !== void 0 ? { source: src } : {} }));
|
|
28631
|
+
out.push(implHit(im, { type: "explosive", point, energy, radius, fireball: blastFireball, tnt: energy * blastTntPerJoule, ...blastHasCharge ? { hasCharge: true } : {}, ...lethal !== void 0 ? { lethalRadius: lethal } : {}, ...src !== void 0 ? { source: src } : {} }));
|
|
28631
28632
|
yield "part";
|
|
28632
28633
|
}
|
|
28633
28634
|
return out;
|
|
@@ -28752,7 +28753,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
28752
28753
|
den += f;
|
|
28753
28754
|
}
|
|
28754
28755
|
const k = den > 0 ? num3 / den : 1;
|
|
28755
|
-
const res = implHit(im, { type: "explosive", point, energy: E * k, radius, fireball: blastFireball, tnt: energy * blastTntPerJoule * k, ...lethal !== void 0 ? { lethalRadius: lethal } : {}, ...shelter ? { shelter: k } : {}, ...src !== void 0 ? { source: src } : {} });
|
|
28756
|
+
const res = implHit(im, { type: "explosive", point, energy: E * k, radius, fireball: blastFireball, tnt: energy * blastTntPerJoule * k, ...blastHasCharge ? { hasCharge: true } : {}, ...lethal !== void 0 ? { lethalRadius: lethal } : {}, ...shelter ? { shelter: k } : {}, ...src !== void 0 ? { source: src } : {} });
|
|
28756
28757
|
results.set(im, res);
|
|
28757
28758
|
report(im).shelter = k;
|
|
28758
28759
|
}
|
|
@@ -29094,13 +29095,16 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
29094
29095
|
const fireball = charge2?.fuel ? fuelFireball(charge2.fuel) : chargeFireball(energy * tntPerJoule);
|
|
29095
29096
|
const inBlast = (fn) => {
|
|
29096
29097
|
const outer = blastTntPerJoule;
|
|
29098
|
+
const outerHasCharge = blastHasCharge;
|
|
29097
29099
|
const outerFireball = blastFireball;
|
|
29098
29100
|
blastTntPerJoule = tntPerJoule;
|
|
29101
|
+
blastHasCharge = charge2?.tnt !== void 0;
|
|
29099
29102
|
blastFireball = fireball;
|
|
29100
29103
|
try {
|
|
29101
29104
|
return fn();
|
|
29102
29105
|
} finally {
|
|
29103
29106
|
blastTntPerJoule = outer;
|
|
29107
|
+
blastHasCharge = outerHasCharge;
|
|
29104
29108
|
blastFireball = outerFireball;
|
|
29105
29109
|
}
|
|
29106
29110
|
};
|
|
@@ -54895,7 +54899,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
54895
54899
|
}
|
|
54896
54900
|
var residentialTower = residentialTowerTemplate();
|
|
54897
54901
|
|
|
54898
|
-
// ../game-floorplan-three/dist/chunk-
|
|
54902
|
+
// ../game-floorplan-three/dist/chunk-EYIWURKO.js
|
|
54899
54903
|
var __defProp4 = Object.defineProperty;
|
|
54900
54904
|
var __defNormalProp2 = (obj, key2, value) => key2 in obj ? __defProp4(obj, key2, { enumerable: true, configurable: true, writable: true, value }) : obj[key2] = value;
|
|
54901
54905
|
var __publicField2 = (obj, key2, value) => __defNormalProp2(obj, typeof key2 !== "symbol" ? key2 + "" : key2, value);
|
|
@@ -56943,7 +56947,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
56943
56947
|
}
|
|
56944
56948
|
function paths() {
|
|
56945
56949
|
const lt2 = shared3.ctx.r.lot;
|
|
56946
|
-
if (!lt2 || !lt2.paths) return;
|
|
56950
|
+
if (!lt2 || !lt2.paths || shared3.ctx.noGroundSurfaces) return;
|
|
56947
56951
|
cursor.group = "lot";
|
|
56948
56952
|
for (const c of lt2.paths) {
|
|
56949
56953
|
if (c.type === "vehicle" && c.id !== "cargo_path") continue;
|
|
@@ -58237,6 +58241,18 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58237
58241
|
__publicField2(this, "positions", []);
|
|
58238
58242
|
__publicField2(this, "normals", []);
|
|
58239
58243
|
__publicField2(this, "indices", []);
|
|
58244
|
+
__publicField2(this, "ranges", []);
|
|
58245
|
+
}
|
|
58246
|
+
/** What is added from here on, up to the next call, is the piece `id` (null: no piece). */
|
|
58247
|
+
piece(id) {
|
|
58248
|
+
const v = this.positions.length / 3, i = this.indices.length;
|
|
58249
|
+
const last = this.ranges[this.ranges.length - 1];
|
|
58250
|
+
if (last && last.v1 < 0) {
|
|
58251
|
+
last.v1 = v;
|
|
58252
|
+
last.i1 = i;
|
|
58253
|
+
if (last.v1 === last.v0) this.ranges.pop();
|
|
58254
|
+
}
|
|
58255
|
+
if (id !== null) this.ranges.push({ id, v0: v, v1: -1, i0: i, i1: -1 });
|
|
58240
58256
|
}
|
|
58241
58257
|
get count() {
|
|
58242
58258
|
return this.indices.length / 36;
|
|
@@ -58257,12 +58273,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58257
58273
|
}
|
|
58258
58274
|
/**
|
|
58259
58275
|
* A six-faced solid from its eight corners: four at the start (in turn around the section) and the same four at the end, for a timber laid on a slope. Each
|
|
58260
|
-
* face is wound to look out of the solid.
|
|
58276
|
+
* face is wound to look out of the solid. `open`: the start or end face is left out (a stretch of a timber cut into pieces, against the next one).
|
|
58261
58277
|
*/
|
|
58262
|
-
addHexahedron(corners) {
|
|
58278
|
+
addHexahedron(corners, open = {}) {
|
|
58263
58279
|
if (corners.length !== 8) return;
|
|
58264
58280
|
const centre = [0, 1, 2].map((k) => corners.reduce((sum2, c) => sum2 + c[k], 0) / 8);
|
|
58265
58281
|
for (const quad of HEXAHEDRON_FACES) {
|
|
58282
|
+
if (open.start && quad === HEXAHEDRON_FACES[0] || open.end && quad === HEXAHEDRON_FACES[1]) continue;
|
|
58266
58283
|
const a = corners[quad[0]], b = corners[quad[1]], c = corners[quad[2]], d = corners[quad[3]];
|
|
58267
58284
|
const e1 = [b[0] - a[0], b[1] - a[1], b[2] - a[2]], e2 = [d[0] - a[0], d[1] - a[1], d[2] - a[2]];
|
|
58268
58285
|
let n = [e1[1] * e2[2] - e1[2] * e2[1], e1[2] * e2[0] - e1[0] * e2[2], e1[0] * e2[1] - e1[1] * e2[0]];
|
|
@@ -58297,6 +58314,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58297
58314
|
/** The mesh of everything added, or null when nothing was. */
|
|
58298
58315
|
mesh(THREE, material, name) {
|
|
58299
58316
|
if (!this.indices.length) return null;
|
|
58317
|
+
this.piece(null);
|
|
58300
58318
|
const geometry = new THREE.BufferGeometry();
|
|
58301
58319
|
geometry.setAttribute("position", new THREE.Float32BufferAttribute(this.positions, 3));
|
|
58302
58320
|
geometry.setAttribute("normal", new THREE.Float32BufferAttribute(this.normals, 3));
|
|
@@ -58307,6 +58325,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58307
58325
|
mesh3.name = name;
|
|
58308
58326
|
mesh3.castShadow = true;
|
|
58309
58327
|
mesh3.receiveShadow = true;
|
|
58328
|
+
if (this.ranges.length) mesh3.userData.ranges = this.ranges.map((range3) => ({ ...range3 }));
|
|
58310
58329
|
return mesh3;
|
|
58311
58330
|
}
|
|
58312
58331
|
};
|
|
@@ -58315,7 +58334,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58315
58334
|
var FEED_Y = -0.6;
|
|
58316
58335
|
var FEED_EXIT_Y = -0.15;
|
|
58317
58336
|
var FEED_BOX_OFFSET = 0.25;
|
|
58318
|
-
|
|
58337
|
+
function chaseDepth(diameter = CHASE_DIAMETER) {
|
|
58338
|
+
return PLASTER_PER_FACE + CHASE_CLEAR + diameter;
|
|
58339
|
+
}
|
|
58340
|
+
var CHASE_DIAMETER = 0.025;
|
|
58341
|
+
var CHASE_CLEAR = 6e-3;
|
|
58319
58342
|
var SLAB_MIDDLE = 0.065;
|
|
58320
58343
|
var CEILING_SLAB = 0.5;
|
|
58321
58344
|
var PASSING_END_CLEAR = { water: 0.335, conduit: 0.485 };
|
|
@@ -58372,7 +58395,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58372
58395
|
const inward = (alongU ? (box5[1] + box5[3]) / 2 : (box5[0] + box5[2]) / 2) - line;
|
|
58373
58396
|
const side = Math.abs(across2) > 1e-3 ? Math.sign(across2) : inward >= 0 ? 1 : -1;
|
|
58374
58397
|
const half = (wall.thickness ?? DEFAULT_THICKNESS) / 2;
|
|
58375
|
-
const offset = options.surface ? half + (options.diameter ?? 0.02) / 2 : half -
|
|
58398
|
+
const offset = options.surface ? half + (options.diameter ?? 0.02) / 2 : half - chaseDepth(options.diameter);
|
|
58376
58399
|
const at4 = line + side * offset;
|
|
58377
58400
|
return { u: alongU ? along2 : at4, v: alongU ? at4 : along2, wall };
|
|
58378
58401
|
}
|
|
@@ -59048,6 +59071,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
59048
59071
|
}
|
|
59049
59072
|
var PIPE_WALL_FILL = 0.3;
|
|
59050
59073
|
var WALL_PIPE_MASS = 3;
|
|
59074
|
+
var UNDER_SINK_RISER_OFF_WALL = 0.08;
|
|
59075
|
+
var UNDER_SINK_VALVE_RISE = 0.1;
|
|
59051
59076
|
var pipeMass = (diameter, length2) => DENSITY.plastic * Math.PI * (diameter / 2) ** 2 * length2 * PIPE_WALL_FILL;
|
|
59052
59077
|
function installUtilitiesWater(K, shared3) {
|
|
59053
59078
|
const { THREE, _Y, _q, cursor, cylBase, part, pieceRecord, put } = K;
|
|
@@ -59247,7 +59272,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
59247
59272
|
}
|
|
59248
59273
|
}
|
|
59249
59274
|
function underSink(tr) {
|
|
59250
|
-
const H = shared3.ctx.r.utilities?.plumbing, nA = shared3.ctx.r.floors.length, pt = H && H.points.find((p) => p.id === tr.to),
|
|
59275
|
+
const H = shared3.ctx.r.utilities?.plumbing, nA = shared3.ctx.r.floors.length, pt = H && H.points.find((p) => p.id === tr.to), d = tr.diameter || 0.025;
|
|
59276
|
+
const pts = riserUnderBack(tr.points.map((p) => [p[0], p[2], p[1]]));
|
|
59251
59277
|
const stage2 = cursor.stage;
|
|
59252
59278
|
if (shared3.ctx.constructionStages) cursor.stage = "furniture";
|
|
59253
59279
|
cursor.group = pt && pt.floor >= 0 ? "f" + Math.min(pt.floor, nA - 1) : "lot";
|
|
@@ -59259,6 +59285,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
59259
59285
|
cursor.pc = null;
|
|
59260
59286
|
cursor.stage = stage2;
|
|
59261
59287
|
}
|
|
59288
|
+
function riserUnderBack(pts) {
|
|
59289
|
+
if (pts.length < 3 || shared3.ctx.visorScene) return pts;
|
|
59290
|
+
const wall = pts[0], mid = pts[1], dx = mid[0] - wall[0], dz = mid[2] - wall[2], L = Math.hypot(dx, dz);
|
|
59291
|
+
if (L <= UNDER_SINK_RISER_OFF_WALL) return pts;
|
|
59292
|
+
const x = wall[0] + dx / L * UNDER_SINK_RISER_OFF_WALL, z = wall[2] + dz / L * UNDER_SINK_RISER_OFF_WALL;
|
|
59293
|
+
const top = mid[1] + UNDER_SINK_VALVE_RISE;
|
|
59294
|
+
return [wall, ...pts.slice(1).map((p) => [x, Math.min(p[1], top), z])];
|
|
59295
|
+
}
|
|
59262
59296
|
const defined = { createWater, PIPE_COLOR, pipe, _v3, waterPipes };
|
|
59263
59297
|
Object.assign(K, defined);
|
|
59264
59298
|
}
|
|
@@ -59605,15 +59639,15 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
59605
59639
|
const aabb = wall.alongU ? [solid2.aabb[0], line - width / 2, solid2.aabb[2], line + width / 2] : [line - width / 2, solid2.aabb[1], line + width / 2, solid2.aabb[3]];
|
|
59606
59640
|
return { ...solid2, aabb };
|
|
59607
59641
|
}
|
|
59608
|
-
var
|
|
59642
|
+
var CHASE_CLEAR2 = 3e-3;
|
|
59609
59643
|
function chasesIn(wall, core, runs) {
|
|
59610
59644
|
const out = [];
|
|
59611
59645
|
for (const r of runs) {
|
|
59612
59646
|
const along2 = wall.alongU ? r.u : r.v, across2 = (wall.alongU ? r.v : r.u) - core.line;
|
|
59613
|
-
if (along2 + r.radius +
|
|
59647
|
+
if (along2 + r.radius + CHASE_CLEAR2 < wall.a0 || along2 - r.radius - CHASE_CLEAR2 > wall.a1 || r.y1 <= core.y0 || r.y0 >= core.y1) continue;
|
|
59614
59648
|
if (Math.abs(across2) > wall.thickness / 2 + 1e-6) continue;
|
|
59615
|
-
const back = Math.abs(across2) - (r.depth ?? r.radius) -
|
|
59616
|
-
out.push({ a0: along2 - r.radius -
|
|
59649
|
+
const back = Math.abs(across2) - (r.depth ?? r.radius) - CHASE_CLEAR2;
|
|
59650
|
+
out.push({ a0: along2 - r.radius - CHASE_CLEAR2, a1: along2 + r.radius + CHASE_CLEAR2, y0: Math.max(core.y0, r.y0), y1: Math.min(core.y1, r.y1), side: across2 >= 0 ? 1 : -1, back, ...r.box ? { box: true } : {} });
|
|
59617
59651
|
}
|
|
59618
59652
|
return out;
|
|
59619
59653
|
}
|
|
@@ -61143,7 +61177,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
61143
61177
|
alias("tv", "flat_tv");
|
|
61144
61178
|
alias("tv_large", "flat_tv");
|
|
61145
61179
|
mine("coffee_table", (M, A) => FURNITURE.table(M, A, { noChairs: true }));
|
|
61146
|
-
mine("coffee_table_round", (M, A) => FURNITURE.table(M, A, {
|
|
61180
|
+
mine("coffee_table_round", (M, A) => FURNITURE.table(M, A, { noChairs: true, round: true }));
|
|
61147
61181
|
mine("rug", FURNITURE.rug);
|
|
61148
61182
|
mine("rug_small", FURNITURE.rug, "game (rug)");
|
|
61149
61183
|
mine("shelf_unit", FURNITURE.shelf);
|
|
@@ -61872,17 +61906,23 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
61872
61906
|
}
|
|
61873
61907
|
var POTTED_PLANT_TYPES = /* @__PURE__ */ new Set(["floor_plant", "floor_plant_tall", "floor_plant_low", "plant_tall", "plant_short", "outdoor_pot", "table_plant"]);
|
|
61874
61908
|
var PLANT_CLEAR = 0.04;
|
|
61875
|
-
var PLANT_MIN_REACH = 0.
|
|
61909
|
+
var PLANT_MIN_REACH = 0.12;
|
|
61876
61910
|
var PLANT_SPAN = [0.03, 2.4];
|
|
61911
|
+
var PLANT_HEIGHT_MARGIN = 1.5;
|
|
61877
61912
|
function footprintOf(m) {
|
|
61878
61913
|
const c = Math.abs(Math.cos(m.ry || 0)), s = Math.abs(Math.sin(m.ry || 0)), hx = ((m.w || 0) * c + (m.d || 0) * s) / 2, hz2 = ((m.w || 0) * s + (m.d || 0) * c) / 2;
|
|
61879
61914
|
return [m.x - hx, m.z - hz2, m.x + hx, m.z + hz2];
|
|
61880
61915
|
}
|
|
61881
61916
|
var reachTo = (x, z, x0, z0, x1, z1) => Math.hypot(Math.max(x0 - x, 0, x - x1), Math.max(z0 - z, 0, z - z1));
|
|
61882
61917
|
function freeReachOf(p) {
|
|
61883
|
-
const
|
|
61918
|
+
const tall = p.self.h != null && p.self.h > 0 ? Math.min(PLANT_SPAN[1], p.self.h * PLANT_HEIGHT_MARGIN) : PLANT_SPAN[1];
|
|
61919
|
+
const y0 = p.y + PLANT_SPAN[0], y1 = p.y + tall;
|
|
61884
61920
|
let reach2 = Number.POSITIVE_INFINITY;
|
|
61885
|
-
for (const b of p.boxes)
|
|
61921
|
+
for (const b of p.boxes) {
|
|
61922
|
+
if (b[1] >= y1 || b[4] <= y0) continue;
|
|
61923
|
+
if (b[1] > p.y && p.x >= b[0] && p.x <= b[3] && p.z >= b[2] && p.z <= b[5]) continue;
|
|
61924
|
+
reach2 = Math.min(reach2, reachTo(p.x, p.z, b[0], b[2], b[3], b[5]));
|
|
61925
|
+
}
|
|
61886
61926
|
for (const m of p.items) {
|
|
61887
61927
|
if (m === p.self || m.id === p.self.id || m.floor !== p.self.floor || m.flat || m.category === "ground_cover" || m.w == null || m.d == null) continue;
|
|
61888
61928
|
const bottom = p.base + (m.y || 0), top = bottom + (m.h || 0);
|
|
@@ -61946,7 +61986,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
61946
61986
|
const covers = [];
|
|
61947
61987
|
for (const m of ordered) {
|
|
61948
61988
|
if (m.type === "stairs") continue;
|
|
61949
|
-
const exterior = m.outdoor || m.floor < 0
|
|
61989
|
+
const exterior = m.outdoor || m.floor < 0;
|
|
61990
|
+
if (exterior && m.category === "ground_cover" && shared3.ctx.noGroundSurfaces) continue;
|
|
61991
|
+
const f = exterior ? -1 : Math.min(m.floor, R.floors.length - 1);
|
|
61950
61992
|
cursor.group = exterior && !(m.type === "cooking_gas_cylinder" && m.shelter && !shared3.ctx.visorScene) ? "lot" : "f" + Math.max(f, 0);
|
|
61951
61993
|
const com = m.room != null ? shared3.ctx.roomById[m.room] : void 0, lift = !exterior && f === 0 && shared3.ctx.constructionStages && !shared3.ctx.visorScene && !com?.outbuilding ? FLOOR_OVER_GROUND : 0, base = exterior ? 0 : Y0(f) + lift;
|
|
61952
61994
|
const M = { visorScene: shared3.ctx.visorScene, x: m.x, z: m.z, ry: m.ry || 0, w: m.w, d: m.d, h: m.h, y: m.y || 0, base, floor: exterior ? -1 : f, palette: shared3.ctx.colors, color: m.category === "ground_cover" ? void 0 : colorOf(m.color) ?? void 0, seed: m.id, room: m.room, typeWith: com ? com.type : null, ceiling: com ? com.ceiling : 2.9, on: shared3.ctx.night, light: shared3.ctx.night, lit: shared3.ctx.night, open: !!m.doorOpen, overhead: m.overhead, assembly: m.assembly, hose: m.hose, shelter: m.shelter, pipe: m.pipe };
|
|
@@ -62992,6 +63034,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
62992
63034
|
const defined = { targetOf };
|
|
62993
63035
|
Object.assign(K, defined);
|
|
62994
63036
|
}
|
|
63037
|
+
var CORD_RADIUS = 6e-3;
|
|
62995
63038
|
function installInteractablesBridge(K, shared3) {
|
|
62996
63039
|
const { t, THREE, invalidate, invalidateShadow, cfg, DOC, LIGHT_TYPES, _Y, _q, _v3, accFor, applyLight, cursor, hashString, hudMessage, lightBase, pieceRecord, rgbOf, wallBlocks } = K;
|
|
62997
63040
|
const enter = (...a) => K.enter(...a);
|
|
@@ -63137,9 +63180,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
63137
63180
|
const spec = ik.A.household.build(type, loc, mesh3.api);
|
|
63138
63181
|
const out = mesh3.finish(spec);
|
|
63139
63182
|
for (const l of out.lights) l.removeFromParent();
|
|
63140
|
-
const group = ivGroup(ent), g0 = cursor.group, stage0 = cursor.stage, root = new THREE.Group();
|
|
63183
|
+
const group = type === "gas_bottle" && item.shelter && !shared3.ctx.visorScene ? "f0" : ivGroup(ent), g0 = cursor.group, stage0 = cursor.stage, root = new THREE.Group();
|
|
63141
63184
|
root.name = "iv:" + ent.id;
|
|
63142
|
-
const isInst = type === "electrical_panel" || type === "power_meter" || type === "service_entrance"
|
|
63185
|
+
const isInst = type === "electrical_panel" || type === "power_meter" || type === "service_entrance";
|
|
63143
63186
|
const isPlate = type === "wall_switch" || type === "wall_socket";
|
|
63144
63187
|
const ivStage = shared3.ctx.constructionStages ? isInst ? "installations" : isPlate ? "finishes" : "furniture" : void 0;
|
|
63145
63188
|
if (ivStage) root.userData.constructionStage = ivStage;
|
|
@@ -63195,6 +63238,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
63195
63238
|
if (root.children.length) IV.roots.push(E);
|
|
63196
63239
|
return spec;
|
|
63197
63240
|
}
|
|
63241
|
+
const floorFinishOf = (floor2) => shared3.ctx.constructionStages && !shared3.ctx.visorScene && floor2 === 0 ? FLOOR_OVER_GROUND : 0;
|
|
63198
63242
|
function ivCords(IV) {
|
|
63199
63243
|
const ik = IV.k, w = IV.world, wl = (o, p) => ik.GI.localToWorld(o.transform, p), g0 = cursor.group;
|
|
63200
63244
|
const tube2 = (pts, radius, color2, ox, oy, oz, ry) => {
|
|
@@ -63221,15 +63265,16 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
63221
63265
|
if (!so || !sk) continue;
|
|
63222
63266
|
const sp = wl(so, sk.pos), dir = [Math.sin(so.transform.ry), Math.cos(so.transform.ry)], last = pts[pts.length - 1];
|
|
63223
63267
|
if (last[1] < 0.3 + E.pos[1]) {
|
|
63224
|
-
const
|
|
63225
|
-
|
|
63268
|
+
const lie = E.pos[1] + floorFinishOf(E.floor) + CORD_RADIUS + 1e-3;
|
|
63269
|
+
const foot = [sp[0] + dir[0] * 0.035, lie, sp[2] + dir[1] * 0.035];
|
|
63270
|
+
pts.push([last[0] + (foot[0] - last[0]) * 0.4, lie, last[2] + (foot[2] - last[2]) * 0.4], [last[0] + (foot[0] - last[0]) * 0.75, lie, last[2] + (foot[2] - last[2]) * 0.75], foot, [foot[0], Math.max(E.pos[1] + 0.1, sp[1] - 0.04), foot[2]], [sp[0] + dir[0] * 0.012, sp[1] - 0.01, sp[2] + dir[1] * 0.012]);
|
|
63226
63271
|
} else {
|
|
63227
63272
|
const hang = ik.gfx.catenary(last, [sp[0] + dir[0] * 0.012, sp[1] - 0.01, sp[2] + dir[1] * 0.012], 0.1, 8);
|
|
63228
63273
|
hang.shift();
|
|
63229
63274
|
for (const p of hang) pts.push(p);
|
|
63230
63275
|
}
|
|
63231
63276
|
shared3.ctx.cordPaths?.push({ object: E.id, device: d.id, points: pts.map((p) => [p[0], p[1], p[2]]) });
|
|
63232
|
-
tube2(pts,
|
|
63277
|
+
tube2(pts, CORD_RADIUS, IV_WIRE.cord, 0, 0, 0, 0);
|
|
63233
63278
|
}
|
|
63234
63279
|
}
|
|
63235
63280
|
} finally {
|
|
@@ -66078,6 +66123,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
66078
66123
|
return level >= STAGE_LEVEL.openings;
|
|
66079
66124
|
case "roof":
|
|
66080
66125
|
return level >= STAGE_LEVEL.roof && opts.roofLayer !== false;
|
|
66126
|
+
// the timber of the roof (its stage group is shown by name, `groupVisible`): a stretch of it broken off the frame keeps the frame's stage
|
|
66127
|
+
case "roofFraming":
|
|
66128
|
+
return level >= STAGE_LEVEL.roofFraming && opts.roofLayer !== false;
|
|
66081
66129
|
case "furniture":
|
|
66082
66130
|
return level >= STAGE_LEVEL.last;
|
|
66083
66131
|
// the protective sidewalk round the house: the last of the work outside
|
|
@@ -66143,6 +66191,50 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
66143
66191
|
}
|
|
66144
66192
|
return level;
|
|
66145
66193
|
}
|
|
66194
|
+
function partStagesOf(house) {
|
|
66195
|
+
const stages = /* @__PURE__ */ new Map();
|
|
66196
|
+
const walk = (o, inherited) => {
|
|
66197
|
+
const own = typeof o.userData?.constructionStage === "string" ? o.userData.constructionStage : inherited;
|
|
66198
|
+
const part = o.userData?.destructionPart;
|
|
66199
|
+
if (own && typeof part === "string" && !stages.has(part)) stages.set(part, own);
|
|
66200
|
+
const ranges = o.userData?.ranges;
|
|
66201
|
+
if (own && Array.isArray(ranges)) {
|
|
66202
|
+
for (const range3 of ranges) if (!stages.has(range3.id)) stages.set(range3.id, own);
|
|
66203
|
+
}
|
|
66204
|
+
for (const c of o.children) walk(c, own);
|
|
66205
|
+
};
|
|
66206
|
+
walk(house, void 0);
|
|
66207
|
+
return stages;
|
|
66208
|
+
}
|
|
66209
|
+
function stageOfPiece(piece2, stages) {
|
|
66210
|
+
let found;
|
|
66211
|
+
piece2.root.traverse((o) => {
|
|
66212
|
+
if (found) return;
|
|
66213
|
+
const part = o.userData?.destructionPart;
|
|
66214
|
+
if (typeof part === "string") found = stages.get(part);
|
|
66215
|
+
});
|
|
66216
|
+
return found;
|
|
66217
|
+
}
|
|
66218
|
+
function stageLoosePieces(pieces, stages, level, opts, held) {
|
|
66219
|
+
let hidden = 0;
|
|
66220
|
+
for (const piece2 of pieces) {
|
|
66221
|
+
const stage2 = stageOfPiece(piece2, stages);
|
|
66222
|
+
if (!stage2) continue;
|
|
66223
|
+
const shown2 = stageVisible(stage2, level, opts);
|
|
66224
|
+
piece2.root.visible = shown2;
|
|
66225
|
+
if (!shown2) {
|
|
66226
|
+
hidden++;
|
|
66227
|
+
if (!piece2.held) {
|
|
66228
|
+
piece2.held = true;
|
|
66229
|
+
held.add(piece2);
|
|
66230
|
+
}
|
|
66231
|
+
} else if (held.has(piece2)) {
|
|
66232
|
+
piece2.held = false;
|
|
66233
|
+
held.delete(piece2);
|
|
66234
|
+
}
|
|
66235
|
+
}
|
|
66236
|
+
return hidden;
|
|
66237
|
+
}
|
|
66146
66238
|
var INSTALLATIONS_STAGE = "stage:4:installations";
|
|
66147
66239
|
function toWorld2(THREE, object2, x, z) {
|
|
66148
66240
|
return new THREE.Vector3(x, 0, z).applyMatrix4(object2.matrixWorld);
|
|
@@ -66174,24 +66266,53 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
66174
66266
|
hip: { top: 0.065, width: 0.06, height: 0.14 },
|
|
66175
66267
|
post: { side: 0.07, spacing: 2 }
|
|
66176
66268
|
};
|
|
66269
|
+
var along = (p0, p1, f) => [p0[0] + (p1[0] - p0[0]) * f, p0[1] + (p1[1] - p0[1]) * f, p0[2] + (p1[2] - p0[2]) * f];
|
|
66177
66270
|
var EDGE2 = 0.04;
|
|
66178
|
-
|
|
66271
|
+
var ROOF_TIMBER_STRETCH = 1.2;
|
|
66272
|
+
var ROOF_TIMBER_MATERIAL = "wood_hard";
|
|
66273
|
+
var TIMBER_DENSITY = 750;
|
|
66274
|
+
var TimberLog = class {
|
|
66275
|
+
constructor(prefix, onPiece) {
|
|
66276
|
+
__publicField2(this, "prefix", prefix);
|
|
66277
|
+
__publicField2(this, "onPiece", onPiece);
|
|
66278
|
+
__publicField2(this, "count", 0);
|
|
66279
|
+
}
|
|
66280
|
+
next(kind, mass, chain) {
|
|
66281
|
+
const id = `${this.prefix}:${this.count++}`;
|
|
66282
|
+
this.onPiece({ id, kind, mass, chain });
|
|
66283
|
+
return id;
|
|
66284
|
+
}
|
|
66285
|
+
};
|
|
66286
|
+
var LOGS = /* @__PURE__ */ new WeakMap();
|
|
66287
|
+
function addTimber(batch, top0, top1, width, height, kind) {
|
|
66179
66288
|
const dx = top1[0] - top0[0], dz = top1[2] - top0[2];
|
|
66180
66289
|
const flat2 = Math.hypot(dx, dz);
|
|
66181
66290
|
if (flat2 < 1e-4 && Math.abs(top1[1] - top0[1]) < 1e-4) return;
|
|
66182
66291
|
const sx = flat2 < 1e-4 ? width / 2 : -dz / flat2 * (width / 2);
|
|
66183
66292
|
const sz = flat2 < 1e-4 ? 0 : dx / flat2 * (width / 2);
|
|
66184
66293
|
const corner = (p, side, down2) => [p[0] + sx * side, p[1] - down2, p[2] + sz * side];
|
|
66185
|
-
|
|
66186
|
-
|
|
66187
|
-
|
|
66188
|
-
|
|
66189
|
-
|
|
66190
|
-
|
|
66191
|
-
|
|
66192
|
-
|
|
66193
|
-
|
|
66194
|
-
|
|
66294
|
+
const log = LOGS.get(batch);
|
|
66295
|
+
const length2 = Math.hypot(dx, top1[1] - top0[1], dz);
|
|
66296
|
+
const stretches = log ? Math.max(1, Math.ceil(length2 / ROOF_TIMBER_STRETCH)) : 1;
|
|
66297
|
+
let before = null;
|
|
66298
|
+
for (let k = 0; k < stretches; k++) {
|
|
66299
|
+
const a = along(top0, top1, k / stretches), b = along(top0, top1, (k + 1) / stretches);
|
|
66300
|
+
if (log) {
|
|
66301
|
+
before = log.next(kind, TIMBER_DENSITY * width * height * (length2 / stretches), before ? [before] : []);
|
|
66302
|
+
batch.piece(before);
|
|
66303
|
+
}
|
|
66304
|
+
batch.addHexahedron([
|
|
66305
|
+
corner(a, -1, height),
|
|
66306
|
+
corner(a, 1, height),
|
|
66307
|
+
corner(a, 1, 0),
|
|
66308
|
+
corner(a, -1, 0),
|
|
66309
|
+
corner(b, -1, height),
|
|
66310
|
+
corner(b, 1, height),
|
|
66311
|
+
corner(b, 1, 0),
|
|
66312
|
+
corner(b, -1, 0)
|
|
66313
|
+
], { start: k > 0, end: k < stretches - 1 });
|
|
66314
|
+
}
|
|
66315
|
+
if (log) batch.piece(null);
|
|
66195
66316
|
}
|
|
66196
66317
|
var KEEP_OUT_GAP = 0.03;
|
|
66197
66318
|
function clearStretches(top0, top1, width, height, keepOut) {
|
|
@@ -66215,16 +66336,15 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
66215
66336
|
}
|
|
66216
66337
|
return stretches;
|
|
66217
66338
|
}
|
|
66218
|
-
|
|
66219
|
-
function addTimberAround(batch, top0, top1, width, height, keepOut, onCut) {
|
|
66339
|
+
function addTimberAround(batch, top0, top1, width, height, kind, keepOut, onCut) {
|
|
66220
66340
|
if (!keepOut.length) {
|
|
66221
|
-
addTimber(batch, top0, top1, width, height);
|
|
66341
|
+
addTimber(batch, top0, top1, width, height, kind);
|
|
66222
66342
|
return;
|
|
66223
66343
|
}
|
|
66224
66344
|
const length2 = Math.hypot(top1[0] - top0[0], top1[1] - top0[1], top1[2] - top0[2]);
|
|
66225
66345
|
for (const [f0, f1] of clearStretches(top0, top1, width, height, keepOut)) {
|
|
66226
66346
|
if ((f1 - f0) * length2 < 0.05) continue;
|
|
66227
|
-
addTimber(batch, along(top0, top1, f0), along(top0, top1, f1), width, height);
|
|
66347
|
+
addTimber(batch, along(top0, top1, f0), along(top0, top1, f1), width, height, kind);
|
|
66228
66348
|
const inset = TIMBER.post.side / 2 / Math.max(length2, 1e-6);
|
|
66229
66349
|
if (f0 > 0) onCut?.(along(top0, top1, Math.min(f1, f0 + inset)));
|
|
66230
66350
|
if (f1 < 1) onCut?.(along(top0, top1, Math.max(f0, f1 - inset)));
|
|
@@ -66233,7 +66353,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
66233
66353
|
var postBlocked = (x, z, keepOut) => keepOut.some((b) => x > b[0] - TIMBER.post.side / 2 - KEEP_OUT_GAP && x < b[3] + TIMBER.post.side / 2 + KEEP_OUT_GAP && z > b[2] - TIMBER.post.side / 2 - KEEP_OUT_GAP && z < b[5] + TIMBER.post.side / 2 + KEEP_OUT_GAP);
|
|
66234
66354
|
function addPost(batch, x, z, y0, y1) {
|
|
66235
66355
|
const h = TIMBER.post.side / 2;
|
|
66236
|
-
if (y1 - y0
|
|
66356
|
+
if (y1 - y0 <= 0.02) return;
|
|
66357
|
+
const log = LOGS.get(batch);
|
|
66358
|
+
if (log) batch.piece(log.next("post", TIMBER_DENSITY * TIMBER.post.side * TIMBER.post.side * (y1 - y0), []));
|
|
66359
|
+
batch.add([x - h, y0, z - h, x + h, y1, z + h], true);
|
|
66360
|
+
if (log) batch.piece(null);
|
|
66237
66361
|
}
|
|
66238
66362
|
function slopesOf(rect) {
|
|
66239
66363
|
const [x0, z0, x1, z1] = rect.exterior;
|
|
@@ -66291,7 +66415,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
66291
66415
|
const a = a0 + BATTEN_SHORT, b = b0 - BATTEN_SHORT;
|
|
66292
66416
|
if (b - a <= 0.05) continue;
|
|
66293
66417
|
const at4 = battenClearOfSolids(slope, s, [a, b], solids2);
|
|
66294
|
-
addTimberAround(batches.battens, down(slope.point(at4, a), batten.top), down(slope.point(at4, b), batten.top), batten.width, batten.height, keepOut);
|
|
66418
|
+
addTimberAround(batches.battens, down(slope.point(at4, a), batten.top), down(slope.point(at4, b), batten.top), batten.width, batten.height, "batten", keepOut);
|
|
66295
66419
|
}
|
|
66296
66420
|
const t0 = slope.t0 + EDGE2, t1 = slope.t1 - EDGE2;
|
|
66297
66421
|
const count = Math.max(1, Math.round((t1 - t0) / rafter.spacing));
|
|
@@ -66301,7 +66425,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
66301
66425
|
if (end3 < 0.1) continue;
|
|
66302
66426
|
const axis2 = slope.point(0, 1)[0] - slope.point(0, 0)[0] !== 0 ? 0 : 2;
|
|
66303
66427
|
const t = clearOfSolids(at4, rafter.width, down(slope.point(EDGE2, at4), rafter.top), down(slope.point(end3, at4), rafter.top), axis2, solids2);
|
|
66304
|
-
addTimberAround(batches.timber, down(slope.point(EDGE2, t), rafter.top), down(slope.point(end3, t), rafter.top), rafter.width, rafter.height, keepOut);
|
|
66428
|
+
addTimberAround(batches.timber, down(slope.point(EDGE2, t), rafter.top), down(slope.point(end3, t), rafter.top), rafter.width, rafter.height, "rafter", keepOut);
|
|
66305
66429
|
}
|
|
66306
66430
|
const lines = [slope.wall, slope.wall + (slope.run - slope.wall) / 3, slope.wall + (slope.run - slope.wall) * 2 / 3];
|
|
66307
66431
|
lines.forEach((s, k) => {
|
|
@@ -66311,7 +66435,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
66311
66435
|
const p0 = down(slope.point(s, a), top), p1 = down(slope.point(s, b), top);
|
|
66312
66436
|
const depth = Math.min(purlin.height, p0[1] - slabTop - 3e-3);
|
|
66313
66437
|
if (depth < 0.02) return;
|
|
66314
|
-
addTimberAround(batches.timber, p0, p1, k === 0 ? purlin.width - PLATE_NARROWER : purlin.width, depth, keepOut, k === 0 ? void 0 : (end3) => addPost(batches.timber, end3[0], end3[2], slabTop, end3[1] - purlin.height));
|
|
66438
|
+
addTimberAround(batches.timber, p0, p1, k === 0 ? purlin.width - PLATE_NARROWER : purlin.width, depth, "purlin", keepOut, k === 0 ? void 0 : (end3) => addPost(batches.timber, end3[0], end3[2], slabTop, end3[1] - purlin.height));
|
|
66315
66439
|
if (k === 0) return;
|
|
66316
66440
|
const posts = Math.max(1, Math.ceil((b - a) / TIMBER.post.spacing));
|
|
66317
66441
|
for (let j = 0; j <= posts; j++) {
|
|
@@ -66343,10 +66467,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
66343
66467
|
}
|
|
66344
66468
|
return out;
|
|
66345
66469
|
}
|
|
66346
|
-
function buildRoofFramingStage(THREE, roofRects, material, solids2 = [], keepOut = []) {
|
|
66470
|
+
function buildRoofFramingStage(THREE, roofRects, material, solids2 = [], keepOut = [], onPiece) {
|
|
66347
66471
|
const group = new THREE.Group();
|
|
66348
66472
|
group.name = "stage:7:roof_framing";
|
|
66349
66473
|
const timber = new BoxBatch(), battens = new BoxBatch();
|
|
66474
|
+
if (onPiece) {
|
|
66475
|
+
LOGS.set(timber, new TimberLog("roof_timber", onPiece));
|
|
66476
|
+
LOGS.set(battens, new TimberLog("roof_batten", onPiece));
|
|
66477
|
+
}
|
|
66350
66478
|
for (const rr of roofRects) {
|
|
66351
66479
|
if (rr.slab || rr.yb === void 0 || rr.tp === void 0 || !rr.exterior || rr.rm === void 0 || rr.alongX === void 0) continue;
|
|
66352
66480
|
const rect = { yb: rr.yb, tp: rr.tp, exterior: rr.exterior, rm: rr.rm, alongX: rr.alongX, r: rr.r, gable: !!rr.gable };
|
|
@@ -66357,7 +66485,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
66357
66485
|
const xm = (x0 + x1) / 2, zm = (z0 + z1) / 2;
|
|
66358
66486
|
const ends = rr.alongX ? [[rr.gable ? x0 + EDGE2 : x0 + rr.rm, ridgeY, zm], [rr.gable ? x1 - EDGE2 : x1 - rr.rm, ridgeY, zm]] : [[xm, ridgeY, rr.gable ? z0 + EDGE2 : z0 + rr.rm], [xm, ridgeY, rr.gable ? z1 - EDGE2 : z1 - rr.rm]];
|
|
66359
66487
|
const ridgeTop = TIMBER.purlin.top;
|
|
66360
|
-
addTimberAround(timber, down(ends[0], ridgeTop), down(ends[1], ridgeTop), TIMBER.purlin.width, TIMBER.purlin.height, keepOut, (end3) => addPost(timber, end3[0], end3[2], slabTop, end3[1] - TIMBER.purlin.height));
|
|
66488
|
+
addTimberAround(timber, down(ends[0], ridgeTop), down(ends[1], ridgeTop), TIMBER.purlin.width, TIMBER.purlin.height, "purlin", keepOut, (end3) => addPost(timber, end3[0], end3[2], slabTop, end3[1] - TIMBER.purlin.height));
|
|
66361
66489
|
const along2 = Math.hypot(ends[1][0] - ends[0][0], ends[1][2] - ends[0][2]);
|
|
66362
66490
|
const posts = Math.max(1, Math.ceil(along2 / TIMBER.post.spacing));
|
|
66363
66491
|
for (let j = 0; j <= posts; j++) {
|
|
@@ -66373,12 +66501,17 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
66373
66501
|
const corners = [[x0 + e, h, z0 + e], [x1 - e, h, z0 + e], [x0 + e, h, z1 - e], [x1 - e, h, z1 - e]];
|
|
66374
66502
|
for (const c of corners) {
|
|
66375
66503
|
const end3 = Math.hypot(c[0] - ends[0][0], c[2] - ends[0][2]) <= Math.hypot(c[0] - ends[1][0], c[2] - ends[1][2]) ? ends[0] : ends[1];
|
|
66376
|
-
addTimberAround(timber, down(c, TIMBER.hip.top), down(end3, TIMBER.hip.top), TIMBER.hip.width, TIMBER.hip.height, keepOut);
|
|
66504
|
+
addTimberAround(timber, down(c, TIMBER.hip.top), down(end3, TIMBER.hip.top), TIMBER.hip.width, TIMBER.hip.height, "hip", keepOut);
|
|
66377
66505
|
}
|
|
66378
66506
|
}
|
|
66379
66507
|
}
|
|
66380
66508
|
const wood = material ?? new THREE.MeshStandardMaterial({ color: 11042380, roughness: 0.82 });
|
|
66381
|
-
for (const mesh3 of [timber.mesh(THREE, wood, "roof_framing:timber"), battens.mesh(THREE, wood, "roof_framing:battens")])
|
|
66509
|
+
for (const mesh3 of [timber.mesh(THREE, wood, "roof_framing:timber"), battens.mesh(THREE, wood, "roof_framing:battens")]) {
|
|
66510
|
+
if (!mesh3) continue;
|
|
66511
|
+
mesh3.userData.constructionStage = "roofFraming";
|
|
66512
|
+
if (onPiece) mesh3.userData.destructionMaterial = ROOF_TIMBER_MATERIAL;
|
|
66513
|
+
group.add(mesh3);
|
|
66514
|
+
}
|
|
66382
66515
|
return group;
|
|
66383
66516
|
}
|
|
66384
66517
|
var HOUSE_SHADOW_BUDGET_MS = 2;
|
|
@@ -66421,6 +66554,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
66421
66554
|
}
|
|
66422
66555
|
};
|
|
66423
66556
|
}
|
|
66557
|
+
var ROOF_TIMBER_REACH = 3;
|
|
66424
66558
|
function withLaidConduits(r, stages) {
|
|
66425
66559
|
const E = r.utilities?.electrical;
|
|
66426
66560
|
if (!stages || !E || !E.conduits?.length) return r;
|
|
@@ -66478,7 +66612,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
66478
66612
|
return { u: P.u - Math.sign(P.frontU || 0) * PANEL_RECESS, v: P.v - Math.sign(P.frontV || 0) * PANEL_RECESS, y0: P.y - h / 2 + PANEL_LIFT - BOX_CHASE_CLEAR, y1: P.y + h / 2 + PANEL_LIFT + BOX_CHASE_CLEAR, radius: w / 2, depth: 0 };
|
|
66479
66613
|
}
|
|
66480
66614
|
function installBuildBuild(K, shared3) {
|
|
66481
|
-
const { THREE, cfg, rectsOf: rectsOf2, invalidateShadow, colliderChanged, VERSION: VERSION2, CARS, EPS: EPS42, LIGHTS, MIRRORS, Y0, animateClotheslines, animateDoors, animateInteractive, applyLeaf, applyOutbuildings, applyPart, applyPiece, assembleInteractive, baseboardAndSidewalk, buildStairs, building, carModel, chooseMirror, closeScene, collideAt, createWater, cursor, doorText, doors, electricalStructure, elevator, floorsAndSlabs, gatesInteractive, houseItems, ivAssemble, ivBuild, ivDispose, ivParts, ivPublish, ivUpdate, lightOn, linkDoorLeaves, mailboxInteractive, newInteractiveState, newMirrorState, outbuildings, paths, perimeter, placeSwitches, roofs, roomAt, solar, targetOf, terrain, toggleDoor, toggleLight, walls, waterPipes, drainPipes, windows, props, TYPES, IVK, VEG, vegMaterials, markGroups, assembleStructure, createHouseDestruction, newState, enter, tagDamage } = K;
|
|
66615
|
+
const { THREE, cfg, rectsOf: rectsOf2, invalidateShadow, colliderChanged, VERSION: VERSION2, CARS, EPS: EPS42, LIGHTS, MIRRORS, Y0, animateClotheslines, animateDoors, animateInteractive, applyLeaf, applyOutbuildings, applyPart, applyPiece, assembleInteractive, baseboardAndSidewalk, buildStairs, building, carModel, chooseMirror, closeScene, collideAt, createWater, cursor, doorText, doors, electricalStructure, elevator, floorsAndSlabs, gatesInteractive, houseItems, ivAssemble, ivBuild, ivDispose, ivParts, ivPublish, ivUpdate, lightOn, linkDoorLeaves, mailboxInteractive, newInteractiveState, newMirrorState, outbuildings, paths, perimeter, placeSwitches, roofs, roomAt, solar, targetOf, terrain, toggleDoor, toggleLight, walls, waterPipes, drainPipes, windows, props, TYPES, IVK, VEG, vegMaterials, markGroups, assembleStructure, pieceRecord, createHouseDestruction, newState, enter, tagDamage } = K;
|
|
66482
66616
|
function build(r0, options) {
|
|
66483
66617
|
const opts = options || {};
|
|
66484
66618
|
const r = withLaidConduits(applyOutbuildings(r0), !!(opts.constructionStages || opts.constructionLevel != null));
|
|
@@ -66496,6 +66630,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
66496
66630
|
shared3.ctx.colliders = [];
|
|
66497
66631
|
shared3.ctx.stairs = [];
|
|
66498
66632
|
shared3.ctx.noTerrain = opts.terrain === false;
|
|
66633
|
+
shared3.ctx.noGroundSurfaces = opts.groundSurfaces === false;
|
|
66499
66634
|
shared3.ctx.serviceFrom = opts.serviceFrom ?? null;
|
|
66500
66635
|
shared3.ctx.roomById = {};
|
|
66501
66636
|
for (const c of r.rooms) shared3.ctx.roomById[c.id] = c;
|
|
@@ -66647,6 +66782,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
66647
66782
|
(k === "floor" || k === "building" ? root : house).add(g);
|
|
66648
66783
|
}
|
|
66649
66784
|
let currentConstructionLevel = CONSTRUCTION_LEVEL_MAX;
|
|
66785
|
+
let partStages = null, stageOptsNow = {}, piecesStaged = -1;
|
|
66786
|
+
const stageHeld = /* @__PURE__ */ new Set();
|
|
66650
66787
|
h.groups = gs;
|
|
66651
66788
|
h.root = root;
|
|
66652
66789
|
h.house = house;
|
|
@@ -66827,22 +66964,34 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
66827
66964
|
return house.localToWorld(localCenter.clone());
|
|
66828
66965
|
};
|
|
66829
66966
|
const distance4 = (focus) => center().distanceTo(focus instanceof THREE.Vector3 ? focus : new THREE.Vector3(focus.x, focus.y, focus.z));
|
|
66830
|
-
markGroups(r, root, parts2);
|
|
66831
|
-
const structure = assembleStructure(r0, root), destruction = createHouseDestruction(root, house, structure, parts2, colliders, water);
|
|
66832
|
-
h.destruction = destruction;
|
|
66833
|
-
destruction.breach.setLod(h.lodCurrent);
|
|
66834
66967
|
if (cs) {
|
|
66835
66968
|
const bp = buildBlueprintStage(THREE, K.DOC, r, rectsOf2);
|
|
66836
66969
|
const stGroups = buildStructuralStageGroups(THREE, r0.structure, r.outbuildings || [], [...embeddedRunsOf(house), ...wallBoxRunsOf(r, shared3.ctx.wallBoxShifts)], shared3.ctx.blockLaid ?? []);
|
|
66837
66970
|
const instGroup = buildInstallationsStage(THREE, r, shared3.ctx.gutterInfo?.drains ?? [], shared3.ctx.paving ?? []);
|
|
66838
|
-
const roofFraming = buildRoofFramingStage(THREE, shared3.ctx.roofRects || [], void 0, [...shared3.ctx.occupied ?? [], ...bareBoxesOf(THREE, [stGroups.frame, stGroups.masonry])], [...atticKeepOut(THREE, house, Object.values(parts2)), ...gutterKeepOut(shared3.ctx.gutterInfo?.gutters ?? [])])
|
|
66971
|
+
const roofFraming = buildRoofFramingStage(THREE, shared3.ctx.roofRects || [], void 0, [...shared3.ctx.occupied ?? [], ...bareBoxesOf(THREE, [stGroups.frame, stGroups.masonry])], [...atticKeepOut(THREE, house, Object.values(parts2)), ...gutterKeepOut(shared3.ctx.gutterInfo?.gutters ?? [])], (t) => {
|
|
66972
|
+
pieceRecord(t.id, ROOF_TIMBER_MATERIAL, null, { holdOn: t.kind === "post" ? "floor" : "wall", holdReach: ROOF_TIMBER_REACH, holdJoint: "nail", mass: t.mass, tags: ["roof_timber", t.kind], ...t.chain.length ? { chain: t.chain } : {} });
|
|
66973
|
+
});
|
|
66839
66974
|
const yardBoxes = instGroup.userData.yardBoxes;
|
|
66840
66975
|
for (const sg of [bp, stGroups.foundation, stGroups.starterBars, stGroups.frame, stGroups.masonry, instGroup, ...yardBoxes ? [yardBoxes] : [], roofFraming]) {
|
|
66841
66976
|
gs[sg.name] = sg;
|
|
66842
66977
|
house.add(sg);
|
|
66843
66978
|
}
|
|
66844
|
-
currentConstructionLevel = applyConstructionLevel(house, opts.constructionLevel ?? CONSTRUCTION_LEVEL_MAX);
|
|
66845
66979
|
}
|
|
66980
|
+
markGroups(r, root, parts2);
|
|
66981
|
+
const structure = assembleStructure(r0, root), destruction = createHouseDestruction(root, house, structure, parts2, colliders, water);
|
|
66982
|
+
h.destruction = destruction;
|
|
66983
|
+
destruction.breach.setLod(h.lodCurrent);
|
|
66984
|
+
if (cs) {
|
|
66985
|
+
currentConstructionLevel = applyConstructionLevel(house, opts.constructionLevel ?? CONSTRUCTION_LEVEL_MAX);
|
|
66986
|
+
partStages = partStagesOf(house);
|
|
66987
|
+
}
|
|
66988
|
+
const stagePieces = () => {
|
|
66989
|
+
const R = destruction.renderer;
|
|
66990
|
+
if (!partStages || !R?.pieces) return;
|
|
66991
|
+
const list2 = R.pieces();
|
|
66992
|
+
piecesStaged = list2.length;
|
|
66993
|
+
stageLoosePieces(list2, partStages, currentConstructionLevel, stageOptsNow, stageHeld);
|
|
66994
|
+
};
|
|
66846
66995
|
const strikePiece = (id, point, type, amount, d, before) => {
|
|
66847
66996
|
if (!destruction.world) return;
|
|
66848
66997
|
const pid = id && structure.byId.has(id) ? id : parts2[id] && parts2[id].type === "water_tank" && structure.byId.has("water_tank") ? "water_tank" : null;
|
|
@@ -66924,6 +67073,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
66924
67073
|
// per frame: doors, parts, wind-blown laundry and (with a focus) distance LOD; dt in seconds, time in ms (rAF); focus = {x,y,z} in world coordinates
|
|
66925
67074
|
update(dt, time, focus) {
|
|
66926
67075
|
enter(h);
|
|
67076
|
+
if (partStages && currentConstructionLevel < CONSTRUCTION_LEVEL_MAX && destruction.renderer?.pieces && destruction.renderer.pieces().length !== piecesStaged) stagePieces();
|
|
66927
67077
|
animateDoors(dt);
|
|
66928
67078
|
animateInteractive(dt);
|
|
66929
67079
|
water.step(dt);
|
|
@@ -66957,12 +67107,16 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
66957
67107
|
g.visible = v;
|
|
66958
67108
|
}
|
|
66959
67109
|
if (cs && currentConstructionLevel < CONSTRUCTION_LEVEL_MAX) {
|
|
66960
|
-
|
|
67110
|
+
stageOptsNow = { roofLayer: !cut && sel < 0, lotLayer: o.lot !== false };
|
|
67111
|
+
applyConstructionLevel(house, currentConstructionLevel, stageOptsNow);
|
|
67112
|
+
stagePieces();
|
|
66961
67113
|
}
|
|
66962
67114
|
},
|
|
66963
67115
|
setConstructionLevel(level, stageOpts) {
|
|
66964
67116
|
enter(h);
|
|
67117
|
+
stageOptsNow = stageOpts ?? {};
|
|
66965
67118
|
currentConstructionLevel = applyConstructionLevel(house, level, stageOpts);
|
|
67119
|
+
stagePieces();
|
|
66966
67120
|
invalidateShadow();
|
|
66967
67121
|
return currentConstructionLevel;
|
|
66968
67122
|
},
|
|
@@ -98067,7 +98221,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
98067
98221
|
}
|
|
98068
98222
|
var DEGREES = 180 / Math.PI;
|
|
98069
98223
|
|
|
98070
|
-
// ../game-vfx-three/dist/chunk-
|
|
98224
|
+
// ../game-vfx-three/dist/chunk-EE6XER4D.js
|
|
98071
98225
|
var GLOW_VERTEX = `attribute vec4 aP;attribute vec4 aC;varying vec2 vU;varying vec4 vC;
|
|
98072
98226
|
void main(){vec3 R=vec3(viewMatrix[0][0],viewMatrix[1][0],viewMatrix[2][0]);vec3 Up=vec3(viewMatrix[0][1],viewMatrix[1][1],viewMatrix[2][1]);
|
|
98073
98227
|
vec3 wp=aP.xyz+(R*position.x+Up*position.y)*aP.w;vU=position.xy;vC=aC;gl_Position=projectionMatrix*viewMatrix*vec4(wp,1.);}`;
|
|
@@ -98083,21 +98237,22 @@ float vn(vec3 x){vec3 i=floor(x),f=fract(x);f=f*f*(3.-2.*f);
|
|
|
98083
98237
|
`;
|
|
98084
98238
|
var PUFF_VERTEX = `${GL_NOISE}
|
|
98085
98239
|
attribute vec4 aP;attribute vec4 aD;attribute vec3 aC;
|
|
98086
|
-
varying vec3 vWP;varying vec3 vL;varying vec4 vD;varying vec3 vC;
|
|
98240
|
+
varying vec3 vWP;varying vec3 vL;varying vec4 vD;varying vec3 vC;varying vec3 vN;
|
|
98087
98241
|
void main(){
|
|
98088
98242
|
vec3 p=position;
|
|
98243
|
+
vec3 q=normalize(position);
|
|
98089
98244
|
float s=aD.z;
|
|
98090
98245
|
float n=vn(p*1.6+vec3(s*11.0,s*7.0,s*3.0));
|
|
98091
98246
|
p*=0.78+0.5*n;
|
|
98092
|
-
float a=s*6.2831;float c=cos(a),si=sin(a);p.xz=mat2(c,-si,si,c)*p.xz;
|
|
98093
|
-
vL=p;
|
|
98247
|
+
float a=s*6.2831;float c=cos(a),si=sin(a);p.xz=mat2(c,-si,si,c)*p.xz;q.xz=mat2(c,-si,si,c)*q.xz;
|
|
98248
|
+
vL=p;vN=q;
|
|
98094
98249
|
vec3 wp=aP.xyz+p*aP.w;
|
|
98095
98250
|
vWP=wp;vD=aD;vC=aC;
|
|
98096
98251
|
gl_Position=projectionMatrix*viewMatrix*vec4(wp,1.0);
|
|
98097
98252
|
}`;
|
|
98098
98253
|
var PUFF_FRAGMENT = `${GL_NOISE}
|
|
98099
98254
|
uniform vec3 uLight;uniform vec3 uSky;uniform vec3 uGround;uniform vec3 uGlowPos;uniform vec3 uGlowCol;uniform float uGlowI;
|
|
98100
|
-
varying vec3 vWP;varying vec3 vL;varying vec4 vD;varying vec3 vC;
|
|
98255
|
+
varying vec3 vWP;varying vec3 vL;varying vec4 vD;varying vec3 vC;varying vec3 vN;
|
|
98101
98256
|
vec3 L(vec3 c){return pow(c,vec3(2.2));}
|
|
98102
98257
|
vec3 ramp(float h){
|
|
98103
98258
|
vec3 c0=L(vec3(.36,.07,.03)),c1=L(vec3(.76,.21,.1)),c2=L(vec3(1.,.54,.16)),c3=L(vec3(1.,.83,.42)),c4=L(vec3(1.,.96,.84));
|
|
@@ -98107,30 +98262,35 @@ vec3 ramp(float h){
|
|
|
98107
98262
|
return mix(c3,c4,clamp((h-.8)/.4,0.,1.));
|
|
98108
98263
|
}
|
|
98109
98264
|
void main(){
|
|
98110
|
-
vec3 N=normalize(cross(dFdx(vWP),dFdy(vWP)));
|
|
98111
98265
|
float age=vD.x,heat=vD.y,kind=vD.w;
|
|
98112
98266
|
float n=vn(vL*2.4+vD.z*13.0);
|
|
98113
|
-
|
|
98114
|
-
|
|
98267
|
+
// the sphere's own normal, roughened by the noise: a billowing cloud, never facets
|
|
98268
|
+
vec3 g=vec3(vn(vL*3.1+vD.z*5.0),vn(vL*3.1+vD.z*5.0+7.3),vn(vL*3.1+vD.z*5.0+13.7))-.5;
|
|
98269
|
+
vec3 N=normalize(normalize(vN)+g*.9);
|
|
98270
|
+
vec3 V=normalize(cameraPosition-vWP);
|
|
98115
98271
|
float lam=max(dot(N,uLight),0.);
|
|
98116
|
-
float
|
|
98117
|
-
// soot: a dark smoke still scatters some light, so it never goes flat black, and its rim takes the sky so its volume reads (only the dark puffs; the rest as the Lab)
|
|
98272
|
+
float light=.42+.62*smoothstep(-.1,.9,lam);
|
|
98118
98273
|
float dark=1.-smoothstep(.02,.12,dot(vC,vec3(.2126,.7152,.0722)));
|
|
98119
98274
|
vec3 alb=max(vC,vec3(.055)*dark);
|
|
98120
|
-
vec3 col=alb*(vec3(.5,.56,.7)*
|
|
98121
|
-
float rim=pow(1.-clamp(abs(dot(
|
|
98275
|
+
vec3 col=alb*(vec3(.5,.56,.7)*light*1.05+vec3(.2,.19,.18)+uGround*(.4-.4*N.y));
|
|
98276
|
+
float rim=pow(1.-clamp(abs(dot(normalize(vN),V)),0.,1.),2.);
|
|
98122
98277
|
col+=dark*rim*(uSky*.9+alb);
|
|
98123
98278
|
vec3 tg=uGlowPos-vWP;float dg=length(tg)+.001;
|
|
98124
98279
|
float gi=uGlowI/(1.+dg*dg*.05)*(.3+.7*max(dot(N,tg/dg),0.));
|
|
98125
98280
|
col+=uGlowCol*gi*alb*1.6;
|
|
98281
|
+
// seen through: thin where the camera grazes the puff, thicker where the noise is, thinning out with age
|
|
98282
|
+
float facing=abs(dot(normalize(vN),V));
|
|
98283
|
+
float alpha=smoothstep(.0,.75,facing)*(.35+.65*smoothstep(.2,.8,n))*(1.-smoothstep(.3,1.,age))*.78;
|
|
98126
98284
|
float h=heat*(.72+.56*n)+heat*(-N.y)*.18;
|
|
98127
98285
|
if(h>.05){
|
|
98128
|
-
|
|
98129
|
-
|
|
98130
|
-
col=mix(col,fc,
|
|
98286
|
+
vec3 fc=ramp(clamp(h,0.,1.2))*(1.1+3.1*h);
|
|
98287
|
+
float hot=smoothstep(.04,.2,h);
|
|
98288
|
+
col=mix(col,fc,hot);
|
|
98289
|
+
alpha=max(alpha,hot*smoothstep(.0,.45,facing)*(1.-smoothstep(.5,1.,age)));
|
|
98131
98290
|
}
|
|
98132
98291
|
if(kind>2.5&&kind<3.5){col+=vec3(.02,.025,.03);}
|
|
98133
|
-
|
|
98292
|
+
if(alpha<.01)discard;
|
|
98293
|
+
gl_FragColor=vec4(col,alpha);
|
|
98134
98294
|
#include <tonemapping_fragment>
|
|
98135
98295
|
#include <colorspace_fragment>
|
|
98136
98296
|
}`;
|
|
@@ -98165,10 +98325,11 @@ void main(){
|
|
|
98165
98325
|
function dynamic(THREE, array, size) {
|
|
98166
98326
|
return new THREE.InstancedBufferAttribute(array, size).setUsage(THREE.DynamicDrawUsage);
|
|
98167
98327
|
}
|
|
98328
|
+
var PUFF_DETAIL = 2;
|
|
98168
98329
|
function createPuffLayer(THREE, pool, uniforms) {
|
|
98169
98330
|
const capacity = pool.capacity;
|
|
98170
98331
|
const geometry = new THREE.InstancedBufferGeometry();
|
|
98171
|
-
geometry.setAttribute("position", new THREE.IcosahedronGeometry(1,
|
|
98332
|
+
geometry.setAttribute("position", new THREE.IcosahedronGeometry(1, PUFF_DETAIL).getAttribute("position"));
|
|
98172
98333
|
const a = new Float32Array(capacity * 4);
|
|
98173
98334
|
const d = new Float32Array(capacity * 4);
|
|
98174
98335
|
const c = new Float32Array(capacity * 3);
|
|
@@ -98177,7 +98338,7 @@ void main(){
|
|
|
98177
98338
|
geometry.setAttribute("aD", attributes[1]);
|
|
98178
98339
|
geometry.setAttribute("aC", attributes[2]);
|
|
98179
98340
|
geometry.instanceCount = 0;
|
|
98180
|
-
const material = new THREE.ShaderMaterial({ uniforms, vertexShader: PUFF_VERTEX, fragmentShader: PUFF_FRAGMENT });
|
|
98341
|
+
const material = new THREE.ShaderMaterial({ uniforms, vertexShader: PUFF_VERTEX, fragmentShader: PUFF_FRAGMENT, transparent: true, depthWrite: false });
|
|
98181
98342
|
const mesh3 = new THREE.Mesh(geometry, material);
|
|
98182
98343
|
mesh3.name = "vfx-puffs";
|
|
98183
98344
|
mesh3.frustumCulled = false;
|