@adatechnology/game-weapons-three 0.18.1 → 0.19.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/assets/weapon-svg/generated/ak_47.svg +1 -1
- package/assets/weapon-svg/generated/ak_74.svg +1 -1
- package/assets/weapon-svg/generated/akm.svg +1 -1
- package/assets/weapon-svg/generated/aks_74u.svg +1 -1
- package/assets/weapon-svg/generated/desert_eagle_mark_xix.svg +1 -1
- package/assets/weapon-svg/generated/hunting_rifle_30_06.svg +1 -1
- package/assets/weapon-svg/generated/m24_sws.svg +1 -1
- package/assets/weapon-svg/generated/remington_700.svg +1 -1
- package/assets/weapon-svg/generated/remington_700_300wm.svg +1 -1
- package/assets/weapon-svg/generated/rifle_7_62x39.svg +1 -1
- package/assets/weapon-svg/generated/rpk.svg +1 -1
- package/assets/weapon-svg/generated/steyr_ssg_69.svg +1 -1
- package/assets/weapon-svg/generated/svd_dragunov.svg +1 -1
- package/dist/{chunk-4HWHC6US.js → chunk-SWR4BJMK.js} +423 -82
- package/dist/chunk-SWR4BJMK.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.global.js +992 -581
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/{testing-I8H8oNSD.d.ts → testing-CyfMbH0P.d.ts} +9 -0
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +1 -1
- package/package.json +9 -9
- package/dist/chunk-4HWHC6US.js.map +0 -1
package/dist/index.global.js
CHANGED
|
@@ -119,6 +119,13 @@ var GameWeaponsThree = (() => {
|
|
|
119
119
|
const scaled2 = 0.067 * Math.sqrt(1 + (z / 0.23) ** 4) / (z * z * Math.cbrt(1 + (z / 1.55) ** 3));
|
|
120
120
|
return scaled2 * w3 * 100;
|
|
121
121
|
}
|
|
122
|
+
var ATMOSPHERE = 101325;
|
|
123
|
+
function sideOnOverpressure(tnt, distance3) {
|
|
124
|
+
if (!(tnt > 0)) return 0;
|
|
125
|
+
const z = Math.max(distance3, NEAREST) / Math.cbrt(tnt);
|
|
126
|
+
const ratio = 808 * (1 + (z / 4.5) ** 2) / (Math.sqrt(1 + (z / 0.048) ** 2) * Math.sqrt(1 + (z / 0.32) ** 2) * Math.sqrt(1 + (z / 1.35) ** 2));
|
|
127
|
+
return ratio * ATMOSPHERE;
|
|
128
|
+
}
|
|
122
129
|
function bodyImpulse(tnt, distance3) {
|
|
123
130
|
if (!(tnt > 0)) return 0;
|
|
124
131
|
const z = Math.max(distance3, NEAREST) / Math.cbrt(tnt);
|
|
@@ -24609,9 +24616,15 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
24609
24616
|
var BREACH_AREA = 0.25;
|
|
24610
24617
|
var BREACH_BLAST_REACH = 0.12;
|
|
24611
24618
|
var MEMBER_CUT_REACH = 0.5;
|
|
24619
|
+
var FAR_MEMBER_HP_FLOOR = 0.25;
|
|
24612
24620
|
var BLAST_REFERENCE_RESISTANCE = 200 * 1900 * 0.13;
|
|
24613
24621
|
var BLAST_EDGE_RAGGED = 0.3;
|
|
24614
24622
|
var BLAST_EDGE_LOOSE = 1.35;
|
|
24623
|
+
var PANEL_PRESSURE = 7e4;
|
|
24624
|
+
var PANEL_IMPULSE = 150;
|
|
24625
|
+
var PANEL_PI = 6e6;
|
|
24626
|
+
var PANEL_POINTS = [[0, 0], [-0.3, 0], [0.3, 0], [0, -0.3], [0, 0.3]];
|
|
24627
|
+
var PANEL_POINTS_LOADED = 4;
|
|
24615
24628
|
var BLAST_EDGE_WEAR = 0.6;
|
|
24616
24629
|
var RESIDUAL_CAPACITY = 0.15;
|
|
24617
24630
|
var SEVER_BAND = 0.1;
|
|
@@ -26205,7 +26218,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26205
26218
|
return BREACH_BLAST_REACH * Math.cbrt(Math.max(0, energy) / 1e3) * clamp2(Math.cbrt(BLAST_REFERENCE_RESISTANCE / resistance), 0.3, 2);
|
|
26206
26219
|
};
|
|
26207
26220
|
const blastUnits = (o, p, wp, energy, dist2, src) => {
|
|
26208
|
-
var _a
|
|
26221
|
+
var _a;
|
|
26209
26222
|
if (!p.staged || p.st.stripped || isLost(p) || chipEnergy <= 0) return false;
|
|
26210
26223
|
const reach = blastReachOf(p, energy);
|
|
26211
26224
|
if (dist2 >= reach) return false;
|
|
@@ -26235,6 +26248,62 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26235
26248
|
}
|
|
26236
26249
|
}
|
|
26237
26250
|
if (out.length === 0) return false;
|
|
26251
|
+
return knockOutUnits(o, p, wp, energy, out, src);
|
|
26252
|
+
};
|
|
26253
|
+
const blastPanel = (o, p, point, energy, src) => {
|
|
26254
|
+
var _a;
|
|
26255
|
+
if (!p.staged || p.st.stripped || isLost(p) || !p.spec.units || p.spec.units.mortar === p.spec.material || p.spec.reinforcement) return false;
|
|
26256
|
+
const [u, v] = planeAxes(p.thin);
|
|
26257
|
+
const lp = toLocal(p.pos, p.q, objLocal(o, point));
|
|
26258
|
+
const half = p.dims[u] / 2;
|
|
26259
|
+
const posts = [];
|
|
26260
|
+
for (const m of o.parts) {
|
|
26261
|
+
if (m === p || !m.spec.reinforcement || isLost(m) || m.spec.shape.kind !== "box") continue;
|
|
26262
|
+
const mp = toLocal(p.pos, p.q, m.pos);
|
|
26263
|
+
if (Math.abs(mp[p.thin]) > p.dims[p.thin] + 0.15 || Math.abs(mp[u]) > half + 0.15 || m.dims[v] < p.dims[v] * 0.5) continue;
|
|
26264
|
+
posts.push(mp[u]);
|
|
26265
|
+
}
|
|
26266
|
+
let from = -half, to = half;
|
|
26267
|
+
for (const x of posts) {
|
|
26268
|
+
if (x <= lp[u] && x > from) from = x;
|
|
26269
|
+
if (x >= lp[u] && x < to) to = x;
|
|
26270
|
+
}
|
|
26271
|
+
if (to - from < 0.2) return false;
|
|
26272
|
+
const tnt = energy * DEFAULT_BLAST_IMPULSE.tntPerJoule;
|
|
26273
|
+
const centre = objLocal(o, point);
|
|
26274
|
+
const span = to - from, height = p.dims[v];
|
|
26275
|
+
let loaded = 0;
|
|
26276
|
+
for (const [fu, fv] of PANEL_POINTS) {
|
|
26277
|
+
const at4 = [0, 0, 0];
|
|
26278
|
+
at4[u] = (from + to) / 2 + fu * span;
|
|
26279
|
+
at4[v] = fv * height;
|
|
26280
|
+
at4[p.thin] = Math.sign(lp[p.thin]) * p.dims[p.thin] / 2;
|
|
26281
|
+
const r = vec.distance(toWorld(p.pos, p.q, at4), centre);
|
|
26282
|
+
const side = sideOnOverpressure(tnt, r);
|
|
26283
|
+
const reflected = 2 * side + 6 * side * side / (side + 7 * 101325);
|
|
26284
|
+
const impulse = bodyImpulse(tnt, r);
|
|
26285
|
+
if (reflected > PANEL_PRESSURE && impulse > PANEL_IMPULSE && (reflected - PANEL_PRESSURE) * (impulse - PANEL_IMPULSE) >= PANEL_PI) loaded++;
|
|
26286
|
+
}
|
|
26287
|
+
if (loaded < PANEL_POINTS_LOADED) return false;
|
|
26288
|
+
const grid = gridOf(p);
|
|
26289
|
+
const worn = (_a = p.rt).chips ?? (_a.chips = {});
|
|
26290
|
+
const out = [];
|
|
26291
|
+
for (let i = 0; i < grid.length; i++) {
|
|
26292
|
+
const cell = grid[i];
|
|
26293
|
+
if (worn[i] === -1) continue;
|
|
26294
|
+
if (cell.center[u] - cell.size[u] / 2 >= from - 1e-6 && cell.center[u] + cell.size[u] / 2 <= to + 1e-6) out.push(i);
|
|
26295
|
+
}
|
|
26296
|
+
if (out.length === 0) return false;
|
|
26297
|
+
for (const i of out) worn[i] = -1;
|
|
26298
|
+
return knockOutUnits(o, p, point, energy, out, src);
|
|
26299
|
+
};
|
|
26300
|
+
const knockOutUnits = (o, p, wp, energy, out, src) => {
|
|
26301
|
+
var _a, _b;
|
|
26302
|
+
const [u, v] = planeAxes(p.thin);
|
|
26303
|
+
const op = p.st.opening ? toLocal(p.pos, p.q, p.st.opening.center) : null;
|
|
26304
|
+
const grid = gridOf(p);
|
|
26305
|
+
const worn = (_a = p.rt).chips ?? (_a.chips = {});
|
|
26306
|
+
for (const i of out) worn[i] = -1;
|
|
26238
26307
|
const loose = unsupportedCells(grid, p.thin, p.dims, (i) => worn[i] !== -1 && !(op && p.st.opening && Math.hypot(grid[i].center[u] - op[u], grid[i].center[v] - op[v]) <= p.st.opening.radius));
|
|
26239
26308
|
for (const i of loose) worn[i] = -1;
|
|
26240
26309
|
const blown = out.map((i) => grid[i]), fallen = loose.map((i) => grid[i]);
|
|
@@ -26717,12 +26786,15 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26717
26786
|
return reach;
|
|
26718
26787
|
}
|
|
26719
26788
|
if (Ein > 20 && p.layers.length > 0) spallOuter(o, p, wp, faceOf(o, p, wn), wn, clamp2(0.05 + Math.sqrt(Ein) * 2e-3, 0.05, 0.4), src);
|
|
26720
|
-
const
|
|
26789
|
+
const breachReach = BREACH_BLAST_REACH * Math.cbrt(Math.max(0, energy) / 1e3);
|
|
26790
|
+
const farMember = Boolean(p.spec.reinforcement && p.spec.units) && dist2 > MEMBER_CUT_REACH * breachReach;
|
|
26791
|
+
const dealt = farMember ? applyDamage(o, p, Math.min(amount, Math.max(0, p.st.hp - p.st.maxHp * FAR_MEMBER_HP_FLOOR)), "explosive", null, null, Ein * 0.3, 40, src) : applyDamage(o, p, amount, "explosive", point, null, Ein * 0.3, 40, src);
|
|
26721
26792
|
res.damage += dealt;
|
|
26722
26793
|
if (p.bend && flexure.enabled) bendByBlast(o, p, point, energy, radius, reach, src);
|
|
26723
|
-
|
|
26724
|
-
|
|
26725
|
-
|
|
26794
|
+
if (p.spec.units && p.spec.units.mortar !== p.spec.material) {
|
|
26795
|
+
blastPanel(o, p, point, energy, src);
|
|
26796
|
+
if (!isLost(p)) blastUnits(o, p, wp, energy, dist2, src);
|
|
26797
|
+
} else if (farMember) blastUnits(o, p, wp, energy, dist2, src);
|
|
26726
26798
|
else if (dist2 <= breachReach) addBreach(o, p, wp, breachAreaOf(p, dealt, true), Ein, null, src);
|
|
26727
26799
|
return reach;
|
|
26728
26800
|
};
|
|
@@ -28833,27 +28905,27 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
28833
28905
|
});
|
|
28834
28906
|
return changed ? { parts, supports: input.supports } : input;
|
|
28835
28907
|
}
|
|
28836
|
-
function supportBondBeam(context,
|
|
28908
|
+
function supportBondBeam(context, plate3) {
|
|
28837
28909
|
const { options } = context;
|
|
28838
|
-
const dir =
|
|
28839
|
-
const line = lineOf(
|
|
28840
|
-
const width = dir === "u" ?
|
|
28910
|
+
const dir = plate3.aabb[2] - plate3.aabb[0] >= plate3.aabb[3] - plate3.aabb[1] ? "u" : "v";
|
|
28911
|
+
const line = lineOf(plate3.aabb, dir);
|
|
28912
|
+
const width = dir === "u" ? plate3.aabb[3] - plate3.aabb[1] : plate3.aabb[2] - plate3.aabb[0];
|
|
28841
28913
|
const dist2 = distancesOf(context);
|
|
28842
|
-
const floor2 =
|
|
28843
|
-
const props = propsUnder(context, dist2,
|
|
28914
|
+
const floor2 = plate3.floor;
|
|
28915
|
+
const props = propsUnder(context, dist2, plate3.y0, plate3.y1, floor2);
|
|
28844
28916
|
const storey = { floor: floor2, below: floor2 >= 1 ? `slab_${floor2}` : void 0, bottom: context.structure.levels[floor2] ?? 0 };
|
|
28845
28917
|
const spots = [];
|
|
28846
28918
|
const near = props.length ? Math.min(...props.map((p) => p.dist)) : pillarDist(context, dist2, storey);
|
|
28847
28919
|
const held = pillarsFor(line, width, props, spots, near, options, false);
|
|
28848
28920
|
const span = beamSpan(line.to - line.from, held).span;
|
|
28849
28921
|
if (span > 1.5) {
|
|
28850
|
-
const depth = Math.max(
|
|
28851
|
-
|
|
28852
|
-
|
|
28922
|
+
const depth = Math.max(plate3.y1 - plate3.y0, beamDepthFor(Math.min(span, options.maxSpan), options));
|
|
28923
|
+
plate3.y0 = round2(plate3.y1 - depth);
|
|
28924
|
+
plate3.mass = Math.max(1, Math.round((plate3.aabb[2] - plate3.aabb[0]) * (plate3.aabb[3] - plate3.aabb[1]) * depth * densityOf(plate3.material)));
|
|
28853
28925
|
}
|
|
28854
28926
|
for (const spot of spots) {
|
|
28855
|
-
const pillar = addPillar(context, spot, storey.bottom,
|
|
28856
|
-
rest(context, pillar,
|
|
28927
|
+
const pillar = addPillar(context, spot, storey.bottom, plate3.y0 + PLAN_TOLERANCE, floor2, storey.below, plate3.id);
|
|
28928
|
+
rest(context, pillar, plate3, "rebar");
|
|
28857
28929
|
}
|
|
28858
28930
|
}
|
|
28859
28931
|
function applySlabPanels(input, structure, options) {
|
|
@@ -29757,7 +29829,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
29757
29829
|
const tributary = bay[0] * bay[1];
|
|
29758
29830
|
const load = COLUMN_SHARE * tributary * storeys * (o.superimposed + slab * 2500);
|
|
29759
29831
|
const columnSize = o.columnSize ?? Math.max(TOWER_DEFAULTS.columnSize, round23(ceilTo2(Math.sqrt(load / COLUMN_KG_M2), 0.1)));
|
|
29760
|
-
const
|
|
29832
|
+
const plate3 = [round23(span[0] + columnSize + 0.2), round23(span[1] + columnSize + 0.2)];
|
|
29761
29833
|
const mech = o.mechanicalEvery === false ? void 0 : o.mechanicalEvery;
|
|
29762
29834
|
const relays = o.mechanical === false ? [] : mechanicalStoreys(storeys, o.mechanical === void 0 ? mech : o.mechanical.every ?? mech);
|
|
29763
29835
|
const mechanical = o.mechanical === false ? [] : [...relays, storeys - 1];
|
|
@@ -29771,11 +29843,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
29771
29843
|
const shaft = given2.shaft ?? CORE_DEFAULTS.shaft;
|
|
29772
29844
|
const fit = Math.max(1, Math.floor((bay[1] - 2 * CORE_CLEARANCE - 0.2 - 2 * wallThickness + ti) / (shaft + ti)));
|
|
29773
29845
|
const probe = coreSize({ ...given2, wallThickness, elevators: 2 });
|
|
29774
|
-
const wanted = given2.elevators ?? Math.max(2, Math.ceil((o.coreRatio *
|
|
29846
|
+
const wanted = given2.elevators ?? Math.max(2, Math.ceil((o.coreRatio * plate3[0] * plate3[1] / probe[0] - 2 * wallThickness + ti) / (shaft + ti)));
|
|
29775
29847
|
const elevators = Math.max(1, Math.min(wanted, fit));
|
|
29776
29848
|
const narrow = coreSize({ ...given2, wallThickness, elevators });
|
|
29777
29849
|
const room = bay[0] - columnSize - 2 * CORE_CLEARANCE - narrow[0];
|
|
29778
|
-
const extra = given2.shaftDepth !== void 0 ? 0 : Math.max(0, Math.min(room, o.coreRatio *
|
|
29850
|
+
const extra = given2.shaftDepth !== void 0 ? 0 : Math.max(0, Math.min(room, o.coreRatio * plate3[0] * plate3[1] / narrow[1] - narrow[0]));
|
|
29779
29851
|
const xs = Array.from({ length: bays[0] + 1 }, (_, i) => -span[0] / 2 + i * bay[0]);
|
|
29780
29852
|
const middle = Math.floor(bays[0] / 2);
|
|
29781
29853
|
const center = given2.center ?? [bays[0] % 2 === 1 ? (xs[middle] + xs[middle + 1]) / 2 : xs[middle] + bay[0] / 2, 0];
|
|
@@ -29819,9 +29891,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
29819
29891
|
columnsZ: bays[1] + 1,
|
|
29820
29892
|
columnSize,
|
|
29821
29893
|
beamHeight,
|
|
29822
|
-
plate:
|
|
29894
|
+
plate: plate3,
|
|
29823
29895
|
core: coreLayout,
|
|
29824
|
-
coreRatio: coreLayout ? coreLayout.size[0] * coreLayout.size[1] / (
|
|
29896
|
+
coreRatio: coreLayout ? coreLayout.size[0] * coreLayout.size[1] / (plate3[0] * plate3[1]) : 0,
|
|
29825
29897
|
facade: o.facade,
|
|
29826
29898
|
mechanical,
|
|
29827
29899
|
damper: damperOn,
|
|
@@ -29879,7 +29951,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
29879
29951
|
}
|
|
29880
29952
|
var storeyKinds = (layout) => Array.from({ length: layout.storeys }, (_, f) => f === 0 ? "ground" : layout.mechanical.includes(f) ? "mechanical" : "typical");
|
|
29881
29953
|
var EDGE = 1e-6;
|
|
29882
|
-
function exteriorWindows(id, rect,
|
|
29954
|
+
function exteriorWindows(id, rect, plate3, ceiling, o = {}) {
|
|
29883
29955
|
const [u0, v0, u1, v1] = rect;
|
|
29884
29956
|
const spacing = o.spacing ?? 3;
|
|
29885
29957
|
const out = [];
|
|
@@ -29888,9 +29960,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
29888
29960
|
out.push({ room: id, side, n, width: Math.min(o.width ?? 2.4, length2 / n * 0.8), y0: o.y0 ?? 0.3, y1: o.y1 ?? r2(ceiling - 0.5) });
|
|
29889
29961
|
};
|
|
29890
29962
|
if (Math.abs(v0) < EDGE) add2("front", u1 - u0);
|
|
29891
|
-
if (Math.abs(v1 -
|
|
29963
|
+
if (Math.abs(v1 - plate3.d) < EDGE) add2("back", u1 - u0);
|
|
29892
29964
|
if (Math.abs(u0) < EDGE) add2("left", v1 - v0);
|
|
29893
|
-
if (Math.abs(u1 -
|
|
29965
|
+
if (Math.abs(u1 - plate3.w) < EDGE) add2("right", v1 - v0);
|
|
29894
29966
|
return out;
|
|
29895
29967
|
}
|
|
29896
29968
|
var stripDoor = (id, strip, floor2, width = 1) => ({ a: id, b: `${strip.circulation}_${floor2}`, width, opensTo: id });
|
|
@@ -29898,33 +29970,33 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
29898
29970
|
const id = `plant_${floor2}_${strip.id}`;
|
|
29899
29971
|
return { rooms: [{ id, type: "storage", label: "plant_room", rect: [...strip.rect] }], doors: [stripDoor(id, strip, floor2, 1.2)], windows: [] };
|
|
29900
29972
|
};
|
|
29901
|
-
function coreRooms(
|
|
29973
|
+
function coreRooms(plate3, floor2, storeys) {
|
|
29902
29974
|
const id = (name) => `${name}_${floor2}`;
|
|
29903
29975
|
const link = floor2 < storeys - 1 ? [floor2, floor2 + 1] : [floor2 - 1, floor2];
|
|
29904
29976
|
const rooms = [
|
|
29905
|
-
{ id: id("stairs"), type: "stairs", label: "stairs", rect: [...
|
|
29906
|
-
...
|
|
29907
|
-
...
|
|
29908
|
-
{ id: id("lobby"), type: "hall", label: "elevator_lobby", rect: [...
|
|
29909
|
-
{ id: id("corridor_w"), type: "corridor", label: "corridor", rect: [...
|
|
29910
|
-
{ id: id("corridor_s"), type: "corridor", label: "corridor", rect: [...
|
|
29911
|
-
{ id: id("corridor_n"), type: "corridor", label: "corridor", rect: [...
|
|
29977
|
+
{ id: id("stairs"), type: "stairs", label: "stairs", rect: [...plate3.stairs], link },
|
|
29978
|
+
...plate3.service ? [{ id: id("service"), type: "storage", label: "service_shaft", rect: [...plate3.service] }] : [],
|
|
29979
|
+
...plate3.shafts.map((rect, k) => ({ id: id(`elevator_${k}`), type: "elevator", label: "elevator", rect: [...rect] })),
|
|
29980
|
+
{ id: id("lobby"), type: "hall", label: "elevator_lobby", rect: [...plate3.lobby] },
|
|
29981
|
+
{ id: id("corridor_w"), type: "corridor", label: "corridor", rect: [...plate3.corridors.w] },
|
|
29982
|
+
{ id: id("corridor_s"), type: "corridor", label: "corridor", rect: [...plate3.corridors.s] },
|
|
29983
|
+
{ id: id("corridor_n"), type: "corridor", label: "corridor", rect: [...plate3.corridors.n] }
|
|
29912
29984
|
];
|
|
29913
29985
|
const doors = [
|
|
29914
29986
|
{ a: id("stairs"), b: id("corridor_w"), width: 1, opensTo: id("corridor_w") },
|
|
29915
|
-
...
|
|
29916
|
-
...
|
|
29987
|
+
...plate3.service ? [{ a: id("service"), b: id("corridor_w"), width: 0.8, opensTo: id("service") }] : [],
|
|
29988
|
+
...plate3.shafts.map((_, k) => ({ a: id(`elevator_${k}`), b: id("lobby"), width: 1.2, opensTo: id("lobby") }))
|
|
29917
29989
|
];
|
|
29918
29990
|
const openPairs = [[id("lobby"), id("corridor_s")], [id("lobby"), id("corridor_n")], [id("corridor_w"), id("corridor_s")], [id("corridor_w"), id("corridor_n")]];
|
|
29919
29991
|
return { rooms, doors, openPairs };
|
|
29920
29992
|
}
|
|
29921
29993
|
function towerFloors(layout, plan) {
|
|
29922
|
-
const
|
|
29994
|
+
const plate3 = towerPlate(layout, plan);
|
|
29923
29995
|
const fillers = { ground: plan.ground ?? plan.typical, typical: plan.typical, mechanical: plan.mechanical ?? plantRooms };
|
|
29924
29996
|
return storeyKinds(layout).map((kind, floor2) => {
|
|
29925
|
-
const context = { floor: floor2, kind, layout, plate:
|
|
29926
|
-
const fills =
|
|
29927
|
-
const core = coreRooms(
|
|
29997
|
+
const context = { floor: floor2, kind, layout, plate: plate3, ceiling: layout.pitch };
|
|
29998
|
+
const fills = plate3.strips.map((strip) => fillers[kind](strip, context));
|
|
29999
|
+
const core = coreRooms(plate3, floor2, layout.storeys);
|
|
29928
30000
|
return {
|
|
29929
30001
|
label: kind === "ground" ? "ground_floor" : kind === "mechanical" ? "mechanical_floor" : "typical_floor",
|
|
29930
30002
|
ceiling: layout.pitch,
|
|
@@ -30002,7 +30074,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
30002
30074
|
var OPEN_ROOM_TYPES2 = /* @__PURE__ */ new Set(["balcony", "terrace", "veranda", "balcony_gourmet"]);
|
|
30003
30075
|
var rectsOf = (c) => c.parts && c.parts.length ? c.parts : [[c.u0, c.v0, c.u1, c.v1]];
|
|
30004
30076
|
var isOpenArea = (c) => OPEN_ROOM_TYPES2.has(c.type) || c.outdoor === true;
|
|
30005
|
-
function installKernelGeometry(K,
|
|
30077
|
+
function installKernelGeometry(K, shared3) {
|
|
30006
30078
|
const { THREE } = K;
|
|
30007
30079
|
const GEO = {};
|
|
30008
30080
|
{
|
|
@@ -30075,9 +30147,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
30075
30147
|
const cursor = { group: "lot", accs: /* @__PURE__ */ new Map(), rot: [], org: [0, 0, 0], ry: 0 };
|
|
30076
30148
|
const PARTS = [];
|
|
30077
30149
|
const MIRRORS = [];
|
|
30078
|
-
|
|
30150
|
+
shared3.partCount = 0;
|
|
30079
30151
|
function part(type, pos, fn, meta = {}, parent, ry = 0) {
|
|
30080
|
-
const gA = cursor.group, oA = cursor.org, rA = cursor.ry, pieceA = cursor.pc, name = "part:" + (meta.id || type) + ":" +
|
|
30152
|
+
const gA = cursor.group, oA = cursor.org, rA = cursor.ry, pieceA = cursor.pc, name = "part:" + (meta.id || type) + ":" + shared3.partCount++;
|
|
30081
30153
|
PARTS.push({ name, parent: parent || gA, pos: pos.slice(), type, meta, ry });
|
|
30082
30154
|
cursor.group = name;
|
|
30083
30155
|
cursor.org = pos;
|
|
@@ -30113,7 +30185,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
30113
30185
|
}
|
|
30114
30186
|
const _Y = new THREE.Vector3(0, 1, 0), _qa = new THREE.Quaternion(), _qb = new THREE.Quaternion();
|
|
30115
30187
|
function pieceRecord(id, mat, role, extra) {
|
|
30116
|
-
const M =
|
|
30188
|
+
const M = shared3.ctx.pieces;
|
|
30117
30189
|
let p = M.get(id);
|
|
30118
30190
|
if (!p) {
|
|
30119
30191
|
p = Object.assign({ id, mat, role: role || null }, extra);
|
|
@@ -30122,7 +30194,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
30122
30194
|
return p;
|
|
30123
30195
|
}
|
|
30124
30196
|
const structurePiece = (id) => {
|
|
30125
|
-
const e =
|
|
30197
|
+
const e = shared3.ctx.structureIndex && shared3.ctx.structureIndex[id];
|
|
30126
30198
|
return e ? pieceRecord(id, e.material, e.role, { floor: e.floor }) : null;
|
|
30127
30199
|
};
|
|
30128
30200
|
function accFor(mat) {
|
|
@@ -30580,14 +30652,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
30580
30652
|
const defined = { createMaterials: createMaterials2, antiTile, dirtMaterial, CLOTHES_UNIFORMS, clothesMaterial, ORDER: ORDER2, NO_SHADOW };
|
|
30581
30653
|
Object.assign(K, defined);
|
|
30582
30654
|
}
|
|
30583
|
-
function installKernelCloseScene(K,
|
|
30655
|
+
function installKernelCloseScene(K, shared3) {
|
|
30584
30656
|
const { THREE, NO_SHADOW, ORDER: ORDER2, PARTS, applyPart, cursor } = K;
|
|
30585
30657
|
const assembleCars = (...a) => K.assembleCars(...a);
|
|
30586
30658
|
const assembleMirrors = (...a) => K.assembleMirrors(...a);
|
|
30587
30659
|
const assembleVegetation = (...a) => K.assembleVegetation(...a);
|
|
30588
30660
|
function markMesh(m, A) {
|
|
30589
30661
|
const L = A.lim, fx = [];
|
|
30590
|
-
const pieces =
|
|
30662
|
+
const pieces = shared3.ctx.pieces;
|
|
30591
30663
|
for (let k = 0; k < L.length; k++) {
|
|
30592
30664
|
const lim = L[k], pc = lim.pc;
|
|
30593
30665
|
if (!pc) continue;
|
|
@@ -30649,7 +30721,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
30649
30721
|
if (P.meta.t0) applyPart(g, P.meta.t0);
|
|
30650
30722
|
}
|
|
30651
30723
|
(groups[P.parent] || (groups[P.parent] = new THREE.Group())).add(g);
|
|
30652
|
-
if (P.meta.id) (
|
|
30724
|
+
if (P.meta.id) (shared3.ctx.parts || (shared3.ctx.parts = {}))[P.meta.id] = g;
|
|
30653
30725
|
}
|
|
30654
30726
|
PARTS.length = 0;
|
|
30655
30727
|
assembleMirrors(groups);
|
|
@@ -30660,20 +30732,20 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
30660
30732
|
const defined = { markMesh, closeScene };
|
|
30661
30733
|
Object.assign(K, defined);
|
|
30662
30734
|
}
|
|
30663
|
-
function installHouseHelpers(K,
|
|
30664
|
-
|
|
30735
|
+
function installHouseHelpers(K, shared3) {
|
|
30736
|
+
shared3.ctx = {};
|
|
30665
30737
|
const OPEN_ROOM_TYPES22 = /* @__PURE__ */ new Set(["balcony", "terrace", "veranda", "balcony_gourmet"]);
|
|
30666
30738
|
const NO_CEILING = OPEN_ROOM_TYPES22;
|
|
30667
30739
|
const OPEN_AREA = (c) => OPEN_ROOM_TYPES22.has(c.type) || c.outdoor === true;
|
|
30668
30740
|
const EPS6 = 1e-3;
|
|
30669
30741
|
const Y0 = (f) => {
|
|
30670
|
-
const A =
|
|
30742
|
+
const A = shared3.ctx.r.floors;
|
|
30671
30743
|
return A[Math.max(0, Math.min(A.length - 1, f))].y0;
|
|
30672
30744
|
};
|
|
30673
|
-
const colorOf = (v) => typeof v === "number" ? v : typeof v === "string" &&
|
|
30745
|
+
const colorOf = (v) => typeof v === "number" ? v : typeof v === "string" && shared3.ctx.colors[v] != null ? shared3.ctx.colors[v] : null;
|
|
30674
30746
|
const rectsOf2 = (c) => c.parts && c.parts.length ? c.parts : [[c.u0, c.v0, c.u1, c.v1]];
|
|
30675
30747
|
function roomAt(f, u, v) {
|
|
30676
|
-
for (const c of
|
|
30748
|
+
for (const c of shared3.ctx.r.rooms) if (c.floor === f) {
|
|
30677
30749
|
for (const [a, b, c2, d] of rectsOf2(c)) if (u > a + EPS6 && u < c2 - EPS6 && v > b + EPS6 && v < d - EPS6) return c;
|
|
30678
30750
|
}
|
|
30679
30751
|
return null;
|
|
@@ -30707,7 +30779,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
30707
30779
|
return [Math.min(...pts.map((p) => p[0])), Math.min(...pts.map((p) => p[1])), Math.max(...pts.map((p) => p[0])), Math.max(...pts.map((p) => p[1]))];
|
|
30708
30780
|
}
|
|
30709
30781
|
function effectiveHeight(f, h) {
|
|
30710
|
-
const A =
|
|
30782
|
+
const A = shared3.ctx.r.floors;
|
|
30711
30783
|
if (f + 1 >= A.length) return h;
|
|
30712
30784
|
const pitch = A[f + 1].y0 - A[f].y0;
|
|
30713
30785
|
return h > pitch && h - pitch <= 0.45 ? pitch : h;
|
|
@@ -30715,7 +30787,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
30715
30787
|
const defined = { OPEN_ROOM_TYPES: OPEN_ROOM_TYPES22, NO_CEILING, OPEN_AREA, EPS: EPS6, Y0, colorOf, rectsOf: rectsOf2, roomAt, subRect, subRects, wallColor, floorColor, stairFootprint, effectiveHeight };
|
|
30716
30788
|
Object.assign(K, defined);
|
|
30717
30789
|
}
|
|
30718
|
-
function installHouseWalls(K,
|
|
30790
|
+
function installHouseWalls(K, shared3) {
|
|
30719
30791
|
const { EPS: EPS6, Y0, boxC, bx, cursor, effectiveHeight, pieceRecord, structurePiece, wallColor } = K;
|
|
30720
30792
|
const sh = (...a) => K.sh(...a);
|
|
30721
30793
|
function wallBox(alongU, L, a, b, ya, yb, th, cL, cH, mL, mH) {
|
|
@@ -30729,10 +30801,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
30729
30801
|
}
|
|
30730
30802
|
}
|
|
30731
30803
|
function sideOf(id, frontLine) {
|
|
30732
|
-
const R =
|
|
30733
|
-
if (id === "outside" || !
|
|
30804
|
+
const R = shared3.ctx.r, F = R.facade;
|
|
30805
|
+
if (id === "outside" || !shared3.ctx.roomById[id]) {
|
|
30734
30806
|
const ac = F.finish;
|
|
30735
|
-
let mat = "plaster", color2 =
|
|
30807
|
+
let mat = "plaster", color2 = shared3.ctx.colors.facade;
|
|
30736
30808
|
if (ac === "roughcast") mat = "roughcast";
|
|
30737
30809
|
else if (ac === "exposed_block") {
|
|
30738
30810
|
mat = "block";
|
|
@@ -30743,12 +30815,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
30743
30815
|
}
|
|
30744
30816
|
return { color: color2, mat, exterior: true };
|
|
30745
30817
|
}
|
|
30746
|
-
return { color: wallColor(
|
|
30818
|
+
return { color: wallColor(shared3.ctx.roomById[id]), mat: "plaster", exterior: false };
|
|
30747
30819
|
}
|
|
30748
30820
|
const pieceOf = (w) => !w.id ? null : structurePiece(w.id) || pieceRecord(w.id, w.material || "brick", w.role || "partition", { floor: w.floor });
|
|
30749
30821
|
function nearestWall(f, axis2, L, c) {
|
|
30750
30822
|
let m = null, md = 1e9;
|
|
30751
|
-
for (const w of
|
|
30823
|
+
for (const w of shared3.ctx.r.walls) {
|
|
30752
30824
|
if (w.floor !== f || w.axis !== axis2 || w.type !== "wall" || Math.abs((axis2 === "u" ? w.v0 : w.u0) - L) > EPS6) continue;
|
|
30753
30825
|
const a = Math.min(axis2 === "u" ? w.u0 : w.v0, axis2 === "u" ? w.u1 : w.v1), b = Math.max(axis2 === "u" ? w.u0 : w.v0, axis2 === "u" ? w.u1 : w.v1), d = c < a ? a - c : c > b ? c - b : 0;
|
|
30754
30826
|
if (d < md) {
|
|
@@ -30759,11 +30831,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
30759
30831
|
return m;
|
|
30760
30832
|
}
|
|
30761
30833
|
function walls() {
|
|
30762
|
-
const R =
|
|
30834
|
+
const R = shared3.ctx.r, cut = shared3.ctx.cut, nA = R.floors.length, vMin = Math.min(...R.walls.map((w) => w.axis === "u" ? w.v0 : Math.min(w.v0, w.v1)));
|
|
30763
30835
|
const corners = /* @__PURE__ */ new Map();
|
|
30764
30836
|
const looks = /* @__PURE__ */ new Map();
|
|
30765
30837
|
for (const w of R.walls) {
|
|
30766
|
-
const f = w.floor, colliders =
|
|
30838
|
+
const f = w.floor, colliders = shared3.ctx.colliders;
|
|
30767
30839
|
cursor.group = "f" + f;
|
|
30768
30840
|
cursor.pc = pieceOf(w);
|
|
30769
30841
|
const y0 = Y0(f), pitch = f + 1 < nA ? Y0(f + 1) - y0 : Infinity, th = w.thickness || 0.15, alongU = w.axis === "u";
|
|
@@ -30777,7 +30849,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
30777
30849
|
}
|
|
30778
30850
|
colliders.push({ type: "wall", piece: w.id, f, x0: alongU ? s0 : L - th / 2, z0: alongU ? L - th / 2 : s0, x1: alongU ? s1 : L + th / 2, z1: alongU ? L + th / 2 : s1 });
|
|
30779
30851
|
if (w.type === "railing") {
|
|
30780
|
-
const c0 =
|
|
30852
|
+
const c0 = shared3.ctx.colors.metal != null ? shared3.ctx.colors.metal : 9080466;
|
|
30781
30853
|
const sx = alongU ? 1 : 0, sz = alongU ? 0 : 1, len = s1 - s0, n = Math.max(1, Math.round(len / 1.4));
|
|
30782
30854
|
const cx_ = alongU ? (s0 + s1) / 2 : L, cz_ = alongU ? L : (s0 + s1) / 2;
|
|
30783
30855
|
boxC("glass", cx_, y0 + 0.55, cz_, alongU ? len : 0.02, 0.85, alongU ? 0.02 : len, 16777215);
|
|
@@ -30821,7 +30893,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
30821
30893
|
cursor.group = "f" + e.f;
|
|
30822
30894
|
bx(e.color.mat, e.pu - e.th / 2, e.y0, e.pv - e.th / 2, e.pu + e.th / 2, e.y0 + e.hh, e.pv + e.th / 2, e.color.color);
|
|
30823
30895
|
}
|
|
30824
|
-
if (
|
|
30896
|
+
if (shared3.ctx.showPillars) wallPillars(looks);
|
|
30825
30897
|
}
|
|
30826
30898
|
const PILLAR_IN_WALL = /^(wall_column_|column_\d|jamb_column_)/;
|
|
30827
30899
|
const wallOf = (pillar, parts) => {
|
|
@@ -30829,7 +30901,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
30829
30901
|
return parts.find((q) => (q.role === "wall" || q.role === "partition") && q.assembly !== void 0 && q.floor === pillar.floor && u >= q.aabb[0] - 1e-3 && u <= q.aabb[2] + 1e-3 && v >= q.aabb[1] - 1e-3 && v <= q.aabb[3] + 1e-3);
|
|
30830
30902
|
};
|
|
30831
30903
|
function wallPillars(looks) {
|
|
30832
|
-
const parts = Object.values(
|
|
30904
|
+
const parts = Object.values(shared3.ctx.structureIndex);
|
|
30833
30905
|
for (const e of parts) {
|
|
30834
30906
|
if (e.role !== "column" || !PILLAR_IN_WALL.test(e.id)) continue;
|
|
30835
30907
|
const host = wallOf(e, parts);
|
|
@@ -30844,7 +30916,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
30844
30916
|
const defined = { wallBox, sideOf, pieceOf, nearestWall, walls, wallPillars };
|
|
30845
30917
|
Object.assign(K, defined);
|
|
30846
30918
|
}
|
|
30847
|
-
function installHouseDoors(K,
|
|
30919
|
+
function installHouseDoors(K, shared3) {
|
|
30848
30920
|
const seedKey = (id) => K.seedKey(id);
|
|
30849
30921
|
const { EPS: EPS6, Y0, boxC, bx, cursor, effectiveHeight, nearestWall, part, pieceOf, pieceRecord, roomAt, sideOf, wallBox } = K;
|
|
30850
30922
|
const SEED = (...a) => K.SEED(...a);
|
|
@@ -30852,15 +30924,15 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
30852
30924
|
const rngString = (...a) => K.rngString(...a);
|
|
30853
30925
|
const sh = (...a) => K.sh(...a);
|
|
30854
30926
|
function doorLineSides(p) {
|
|
30855
|
-
const R =
|
|
30927
|
+
const R = shared3.ctx.r, alongU = p.axis === "u", a = p.at - p.width / 2, b = p.at + p.width / 2;
|
|
30856
30928
|
const w = R.walls.find((w2) => w2.floor === p.floor && w2.axis === p.axis && Math.abs((alongU ? w2.v0 : w2.u0) - p.pos) < EPS6 && w2.type === "wall" && (Math.abs((alongU ? w2.u1 : w2.v1) - a) < 0.02 || Math.abs((alongU ? w2.u0 : w2.v0) - b) < 0.02));
|
|
30857
30929
|
const sides = w ? w.sides : [p.a, p.b];
|
|
30858
30930
|
return [sideOf(sides[0], false), sideOf(sides[1], false)];
|
|
30859
30931
|
}
|
|
30860
|
-
|
|
30932
|
+
shared3.doorState = /* @__PURE__ */ new Map();
|
|
30861
30933
|
function doors() {
|
|
30862
|
-
const leaves =
|
|
30863
|
-
const R =
|
|
30934
|
+
const leaves = shared3.ctx.leaves = [], doorState = shared3.doorState, colliders = shared3.ctx.colliders;
|
|
30935
|
+
const R = shared3.ctx.r, cut = shared3.ctx.cut, C = shared3.ctx.colors, wood = C.wood != null ? C.wood : 8016948, frame2 = sh(wood, 0.55);
|
|
30864
30936
|
for (const p of R.doors) {
|
|
30865
30937
|
const f = p.floor;
|
|
30866
30938
|
cursor.group = "f" + f;
|
|
@@ -30990,12 +31062,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
30990
31062
|
const defined = { doorLineSides, doors };
|
|
30991
31063
|
Object.assign(K, defined);
|
|
30992
31064
|
}
|
|
30993
|
-
function installHouseWindows(K,
|
|
31065
|
+
function installHouseWindows(K, shared3) {
|
|
30994
31066
|
const { EPS: EPS6, Y0, boxC, bx, cursor, pieceRecord, roomAt } = K;
|
|
30995
31067
|
const FRAME_COLORS = { budget: 15856110, mid: 12830924, high: 2829875, commercial: 11844287 };
|
|
30996
31068
|
const SILL_COLORS = { budget: 15131870, mid: 14277076, high: 3816770, commercial: 13225166 };
|
|
30997
31069
|
function windows() {
|
|
30998
|
-
const R =
|
|
31070
|
+
const R = shared3.ctx.r, cut = shared3.ctx.cut, C = shared3.ctx.colors, structure = R.style, fr = FRAME_COLORS[structure] || FRAME_COLORS.budget, pe_ = SILL_COLORS[structure] || SILL_COLORS.budget;
|
|
30999
31071
|
const boardItems = new Set(R.stateItems.filter((e) => e.type === "window_boards" && e.window).map((e) => e.window));
|
|
31000
31072
|
for (const j of R.windows) {
|
|
31001
31073
|
const f = j.floor;
|
|
@@ -31049,11 +31121,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
31049
31121
|
const defined = { FRAME_COLORS, SILL_COLORS, windows };
|
|
31050
31122
|
Object.assign(K, defined);
|
|
31051
31123
|
}
|
|
31052
|
-
function installHouseFloors(K,
|
|
31124
|
+
function installHouseFloors(K, shared3) {
|
|
31053
31125
|
const { rectsOf: rectsOf2, EPS: EPS6, OPEN_AREA, Y0, bx, cursor, floorColor, stairFootprint, structurePiece, subRects } = K;
|
|
31054
31126
|
function flights() {
|
|
31055
|
-
if (
|
|
31056
|
-
const R =
|
|
31127
|
+
if (shared3.ctx._flights && shared3.ctx._flights.r === shared3.ctx.r) return shared3.ctx._flights.l;
|
|
31128
|
+
const R = shared3.ctx.r, mp = /* @__PURE__ */ new Map();
|
|
31057
31129
|
for (const m of R.items) {
|
|
31058
31130
|
if (m.type !== "stairs" || !m.link || typeof m.link !== "object") continue;
|
|
31059
31131
|
const k = [m.link.from, m.link.to, m.x.toFixed(2), m.z.toFixed(2), (m.ry || 0).toFixed(2)].join("|");
|
|
@@ -31069,12 +31141,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
31069
31141
|
v.LP = LP;
|
|
31070
31142
|
v.top = stairFootprint({ x: m.x + lz * Math.sin(m.ry), z: m.z + lz * Math.cos(m.ry), ry: m.ry, w: m.w, d: LP });
|
|
31071
31143
|
}
|
|
31072
|
-
|
|
31144
|
+
shared3.ctx._flights = { r: R, l };
|
|
31073
31145
|
return l;
|
|
31074
31146
|
}
|
|
31075
31147
|
const panelRects = (p) => p.footprint && p.footprint.length ? p.footprint : [p.aabb];
|
|
31076
31148
|
function tilesOf(parent, rc) {
|
|
31077
|
-
const ps = parent ?
|
|
31149
|
+
const ps = parent ? shared3.ctx.panelsOf && shared3.ctx.panelsOf.get(parent) : void 0;
|
|
31078
31150
|
if (!ps) return [[parent ? structurePiece(parent) : null, rc]];
|
|
31079
31151
|
const out = [], taken = [];
|
|
31080
31152
|
for (const p of ps) for (const q of panelRects(p)) {
|
|
@@ -31088,14 +31160,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
31088
31160
|
return out;
|
|
31089
31161
|
}
|
|
31090
31162
|
function panelAt(parent, x, z) {
|
|
31091
|
-
const ps =
|
|
31163
|
+
const ps = shared3.ctx.panelsOf && shared3.ctx.panelsOf.get(parent);
|
|
31092
31164
|
if (!ps) return structurePiece(parent);
|
|
31093
31165
|
for (const p of ps) for (const q of panelRects(p)) if (x >= q[0] - EPS6 && x <= q[2] + EPS6 && z >= q[1] - EPS6 && z <= q[3] + EPS6) return structurePiece(p.id);
|
|
31094
31166
|
return null;
|
|
31095
31167
|
}
|
|
31096
|
-
const hasSlab = (id) => !!(
|
|
31168
|
+
const hasSlab = (id) => !!(shared3.ctx.structureIndex[id] || shared3.ctx.panelsOf && shared3.ctx.panelsOf.has(id));
|
|
31097
31169
|
function floorsAndSlabs() {
|
|
31098
|
-
const R =
|
|
31170
|
+
const R = shared3.ctx.r, nA = R.floors.length, C = shared3.ctx.colors;
|
|
31099
31171
|
const V3 = flights(), holes = (f) => V3.filter((v) => v.to === f).flatMap((v) => {
|
|
31100
31172
|
let rs = [v.rect];
|
|
31101
31173
|
if (v.top) rs = subRects(rs, [v.top]);
|
|
@@ -31132,17 +31204,17 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
31132
31204
|
}
|
|
31133
31205
|
Object.assign(K, { flights, floorsAndSlabs, tilesOf, panelAt });
|
|
31134
31206
|
}
|
|
31135
|
-
function installHouseStairs(K,
|
|
31207
|
+
function installHouseStairs(K, shared3) {
|
|
31136
31208
|
const { rectsOf: rectsOf2, Y0, boxC, bx, cursor, flights, stairFootprint, structurePiece } = K;
|
|
31137
31209
|
const sh = (...a) => K.sh(...a);
|
|
31138
31210
|
function buildStairs() {
|
|
31139
|
-
const R =
|
|
31211
|
+
const R = shared3.ctx.r, stairs = shared3.ctx.stairs = [];
|
|
31140
31212
|
for (const vo of flights()) {
|
|
31141
31213
|
const m = vo.m, f = vo.from, Dr = m.d - (vo.LP || 0);
|
|
31142
31214
|
cursor.group = "f" + f;
|
|
31143
31215
|
cursor.pc = structurePiece("stairs_" + vo.from + "_" + vo.to);
|
|
31144
31216
|
const y0 = Y0(f), H = Y0(vo.to) - y0, n = Math.max(8, Math.round(H / 0.18)), c = Math.cos(m.ry), s = Math.sin(m.ry);
|
|
31145
|
-
const wood =
|
|
31217
|
+
const wood = shared3.ctx.colors.wood != null ? shared3.ctx.colors.wood : 9071176, under = sh(wood, 0.7);
|
|
31146
31218
|
const P = (lx, lz) => [m.x + lx * c + lz * s, m.z - lx * s + lz * c];
|
|
31147
31219
|
const boxL = (mat, lx, y, lz, w, h, d, color2, rx = 0) => {
|
|
31148
31220
|
const [px, pz] = P(lx, lz);
|
|
@@ -31168,12 +31240,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
31168
31240
|
}
|
|
31169
31241
|
}
|
|
31170
31242
|
function elevator() {
|
|
31171
|
-
const R =
|
|
31243
|
+
const R = shared3.ctx.r;
|
|
31172
31244
|
for (const c of R.rooms.filter((c2) => c2.type === "elevator" && c2.floor === 0)) {
|
|
31173
31245
|
cursor.group = "f0";
|
|
31174
31246
|
const [u0, v0, u1, v1] = rectsOf2(c)[0], y0 = Y0(0);
|
|
31175
31247
|
bx("metal", u0 + 0.15, y0 + 0.05, v0 + 0.15, u1 - 0.15, y0 + 2.3, v1 - 0.15, 10133670);
|
|
31176
|
-
bx("emissive", u0 + 0.3, y0 + 2.28, v0 + 0.3, u1 - 0.3, y0 + 2.3, v1 - 0.3,
|
|
31248
|
+
bx("emissive", u0 + 0.3, y0 + 2.28, v0 + 0.3, u1 - 0.3, y0 + 2.3, v1 - 0.3, shared3.ctx.night ? 16773320 : 13619924);
|
|
31177
31249
|
for (const f of R.floors) {
|
|
31178
31250
|
const yy = Y0(f.index);
|
|
31179
31251
|
cursor.group = "f" + f.index;
|
|
@@ -31184,7 +31256,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
31184
31256
|
const defined = { buildStairs, elevator };
|
|
31185
31257
|
Object.assign(K, defined);
|
|
31186
31258
|
}
|
|
31187
|
-
function installLightsFixtures(K,
|
|
31259
|
+
function installLightsFixtures(K, shared3) {
|
|
31188
31260
|
const seedKey = (id) => K.seedKey(id);
|
|
31189
31261
|
const { cursor, part, polyFace } = K;
|
|
31190
31262
|
const makeApi = (...a) => K.makeApi(...a);
|
|
@@ -31202,9 +31274,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
31202
31274
|
return ((t ^ t >>> 14) >>> 0) / 4294967296;
|
|
31203
31275
|
};
|
|
31204
31276
|
}
|
|
31205
|
-
const SEED = () =>
|
|
31206
|
-
const STYLE = () =>
|
|
31207
|
-
|
|
31277
|
+
const SEED = () => shared3.ctx.r && shared3.ctx.r.seed || 0;
|
|
31278
|
+
const STYLE = () => shared3.ctx.r && shared3.ctx.r.style || "budget";
|
|
31279
|
+
shared3.api0 = null;
|
|
31208
31280
|
function kit2(M, A, y0 = M.y || 0) {
|
|
31209
31281
|
const c = Math.cos(M.ry), s = Math.sin(M.ry);
|
|
31210
31282
|
let api = A;
|
|
@@ -31237,7 +31309,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
31237
31309
|
return null;
|
|
31238
31310
|
}
|
|
31239
31311
|
const a0 = api;
|
|
31240
|
-
api =
|
|
31312
|
+
api = shared3.api0 || (shared3.api0 = makeApi());
|
|
31241
31313
|
try {
|
|
31242
31314
|
return part(type, W(lx, ly, lz), fn, meta || {}, void 0, M.ry);
|
|
31243
31315
|
} finally {
|
|
@@ -31331,7 +31403,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
31331
31403
|
yLight = yc - 0.3;
|
|
31332
31404
|
range3 = 6.5;
|
|
31333
31405
|
} else if (type === "chandelier") {
|
|
31334
|
-
const yc = t - 0.5, gold =
|
|
31406
|
+
const yc = t - 0.5, gold = shared3.ctx.colors && shared3.ctx.colors.metal != null ? shared3.ctx.colors.metal : 9075290, N = 6;
|
|
31335
31407
|
K2.c("metal", 0, yc, 0, 0.012, 0.5, gold);
|
|
31336
31408
|
K2.e("metal", 0, yc - 0.03, 0, 0.055, 0.08, gold);
|
|
31337
31409
|
K2.c("metal", 0, yc - 0.06, 0, 0.14, 0.015, gold);
|
|
@@ -31410,24 +31482,24 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
31410
31482
|
const defined = { hashString, rngString, SEED, STYLE, kit2, arcPoints, TEMP_WARM, TEMP_NEUTRAL, TEMP_COOL, colorTemperature, lightStyle, ceilingLamp, tableLamp, floorLamp, sconce, outdoorLamp, lightSwitch };
|
|
31411
31483
|
Object.assign(K, defined);
|
|
31412
31484
|
}
|
|
31413
|
-
function installLightsDecor(K,
|
|
31485
|
+
function installLightsDecor(K, shared3) {
|
|
31414
31486
|
const { EPS: EPS6, OPEN_AREA, SEED, Y0, cursor, rngString, roomAt, stairFootprint } = K;
|
|
31415
31487
|
const lightItem = (...a) => K.lightItem(...a);
|
|
31416
31488
|
function decorLights(api) {
|
|
31417
|
-
const R =
|
|
31489
|
+
const R = shared3.ctx.r, T2 = shared3.ctx.types, structure = R.style, chance = structure === "budget" ? 0.35 : structure === "mid" ? 0.75 : 1, rnd2 = rngString(SEED() + "|decorluz");
|
|
31418
31490
|
const itemsF = (f) => R.items.filter((m) => (m.outdoor ? -1 : m.floor) === f && m.type !== "stairs");
|
|
31419
31491
|
const rectsF = (f) => itemsF(f).filter((m) => (m.h || 0) > 0.3 && !/rug|floor|concrete|dirt|lawn|ceiling_light|curtain|blinds|picture|mirror|pendant|chandelier|spot/.test(m.type)).map((m) => stairFootprint(m));
|
|
31420
31492
|
const free = (f, x, z, margin) => {
|
|
31421
31493
|
if (!roomAt(f, x, z)) return false;
|
|
31422
|
-
for (const c of
|
|
31494
|
+
for (const c of shared3.ctx.colliders) if (c.f === f && x > c.x0 - margin && x < c.x1 + margin && z > c.z0 - margin && z < c.z1 + margin) return false;
|
|
31423
31495
|
for (const r of rectsF(f)) if (x > r[0] - margin && x < r[2] + margin && z > r[1] - margin && z < r[3] + margin) return false;
|
|
31424
31496
|
return true;
|
|
31425
31497
|
};
|
|
31426
31498
|
const puts = (f, type, m0, extra) => {
|
|
31427
31499
|
const ent = T2[type];
|
|
31428
31500
|
if (!ent) return;
|
|
31429
|
-
const com =
|
|
31430
|
-
const M = Object.assign({ x: m0.x, z: m0.z, ry: m0.ry || 0, w: m0.w || 0.3, d: m0.d || 0.3, h: m0.h || 0.3, y: 0, base, floor: f, colors:
|
|
31501
|
+
const com = shared3.ctx.roomById[m0.room], g = "f" + f, base = Y0(f);
|
|
31502
|
+
const M = Object.assign({ x: m0.x, z: m0.z, ry: m0.ry || 0, w: m0.w || 0.3, d: m0.d || 0.3, h: m0.h || 0.3, y: 0, base, floor: f, colors: shared3.ctx.colors, seed: m0.id, room: m0.room, typeWith: com ? com.type : null, ceiling: com ? com.ceiling : 2.8, on: shared3.ctx.night, light: shared3.ctx.night, lit: shared3.ctx.night }, extra || {});
|
|
31431
31503
|
cursor.group = g;
|
|
31432
31504
|
lightItem({ id: m0.id, room: m0.room }, M, ent, api, g);
|
|
31433
31505
|
};
|
|
@@ -31476,18 +31548,18 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
31476
31548
|
const defined = { decorLights };
|
|
31477
31549
|
Object.assign(K, defined);
|
|
31478
31550
|
}
|
|
31479
|
-
function installLotTerrain(K,
|
|
31551
|
+
function installLotTerrain(K, shared3) {
|
|
31480
31552
|
const { rectsOf: rectsOf2, MIRRORS, PARTS, bx, cursor } = K;
|
|
31481
31553
|
function terrain() {
|
|
31482
31554
|
PARTS.length = 0;
|
|
31483
31555
|
MIRRORS.length = 0;
|
|
31484
31556
|
K.CARS.length = 0;
|
|
31485
|
-
|
|
31486
|
-
|
|
31487
|
-
|
|
31488
|
-
|
|
31489
|
-
if (
|
|
31490
|
-
const R =
|
|
31557
|
+
shared3.partCount = 0;
|
|
31558
|
+
shared3.ctx.parts = {};
|
|
31559
|
+
shared3.tapCount = 0;
|
|
31560
|
+
shared3.ctx.clotheslines = [];
|
|
31561
|
+
if (shared3.ctx.noTerrain) return;
|
|
31562
|
+
const R = shared3.ctx.r, lt2 = R.lot, C = shared3.ctx.colors;
|
|
31491
31563
|
cursor.group = "floor";
|
|
31492
31564
|
const light = (c, f) => {
|
|
31493
31565
|
const m = (k) => Math.round((c >> k & 255) * (1 - f) + 255 * f);
|
|
@@ -31501,13 +31573,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
31501
31573
|
bx("sidewalk", u0 - 40, -0.06, v0 - 1.8, u1 + 40, 0.02, v0, 14999766);
|
|
31502
31574
|
for (let x = u0 - 38; x < u1 + 40; x += 6) bx("plaster", x, 0, v0 - 5.6, x + 2.6, 5e-3, v0 - 5.4, 15262904);
|
|
31503
31575
|
} else {
|
|
31504
|
-
const b =
|
|
31576
|
+
const b = shared3.ctx.limits;
|
|
31505
31577
|
bx("sidewalk", b.x0 - 6, -0.09, b.z0 - 6, b.x1 + 6, -0.03, b.z1 + 6, 14605010);
|
|
31506
31578
|
}
|
|
31507
31579
|
}
|
|
31508
31580
|
function freeSpans(alongU, L, a, b) {
|
|
31509
31581
|
const blocks = [];
|
|
31510
|
-
for (const c of
|
|
31582
|
+
for (const c of shared3.ctx.r.rooms) {
|
|
31511
31583
|
if (c.type === "void" || c.floor < 0) continue;
|
|
31512
31584
|
for (const [u0, v0, u1, v1] of rectsOf2(c)) {
|
|
31513
31585
|
const c0 = alongU ? v0 : u0, c1 = alongU ? v1 : u1, lo = alongU ? u0 : v0, hi = alongU ? u1 : v1;
|
|
@@ -31528,12 +31600,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
31528
31600
|
const defined = { terrain, freeSpans };
|
|
31529
31601
|
Object.assign(K, defined);
|
|
31530
31602
|
}
|
|
31531
|
-
function installLotPerimeter(K,
|
|
31603
|
+
function installLotPerimeter(K, shared3) {
|
|
31532
31604
|
const { EPS: EPS6, boxC, bx, colorOf, cursor, freeSpans, pieceRecord } = K;
|
|
31533
31605
|
const makeApi = (...a) => K.makeApi(...a);
|
|
31534
31606
|
const sh = (...a) => K.sh(...a);
|
|
31535
31607
|
function perimeter() {
|
|
31536
|
-
const R =
|
|
31608
|
+
const R = shared3.ctx.r, lt2 = R.lot, C = shared3.ctx.colors;
|
|
31537
31609
|
if (!lt2) return;
|
|
31538
31610
|
cursor.group = "lot";
|
|
31539
31611
|
const rnd2 = /* @__PURE__ */ (() => {
|
|
@@ -31547,7 +31619,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
31547
31619
|
const th = s.thickness || 0.15, h = s.height, color2 = colorOf(s.color) ?? (C.wall || 12104874), len = b - a;
|
|
31548
31620
|
const B = (mat, u0, y0, u1, y1, t, c, off = 0) => alongU ? bx(mat, u0, y0, L + off - t / 2, u1, y1, L + off + t / 2, c) : bx(mat, L + off - t / 2, y0, u0, L + off + t / 2, y1, u1, c);
|
|
31549
31621
|
const col = { type: "lot_wall", f: -1, x0: alongU ? a : L - th / 2, z0: alongU ? L - th / 2 : a, x1: alongU ? b : L + th / 2, z1: alongU ? L + th / 2 : b };
|
|
31550
|
-
|
|
31622
|
+
shared3.ctx.colliders.push(col);
|
|
31551
31623
|
if (s.type === "wall") {
|
|
31552
31624
|
B("plaster", a, 0, b, h, th, color2);
|
|
31553
31625
|
B("plaster", a, h, b, h + 0.05, th + 0.06, sh(color2, 1.15));
|
|
@@ -31586,7 +31658,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
31586
31658
|
const w2 = x1 - x0, cm = (x0 + x1) / 2;
|
|
31587
31659
|
const M = top === "razor_wire" ? { x: alongU ? cm : L, z: alongU ? L : cm, ry: alongU ? 0 : K.PE, w: w2, d: 0.4, h: 0.4, y: ym, base: 0, floor: -1, colors: C, seed: s.id } : { x: alongU ? cm : L, z: alongU ? L : cm, ry: alongU ? 0 : K.PE, w: w2, d: 0.1, h: 0.3, y: 0, base: ym, floor: -1, colors: C, seed: s.id };
|
|
31588
31660
|
try {
|
|
31589
|
-
|
|
31661
|
+
shared3.ctx.mv.builders[top](M, api);
|
|
31590
31662
|
} catch (e) {
|
|
31591
31663
|
console.warn(e);
|
|
31592
31664
|
}
|
|
@@ -31607,7 +31679,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
31607
31679
|
}
|
|
31608
31680
|
}
|
|
31609
31681
|
function paths() {
|
|
31610
|
-
const lt2 =
|
|
31682
|
+
const lt2 = shared3.ctx.r.lot;
|
|
31611
31683
|
if (!lt2 || !lt2.paths) return;
|
|
31612
31684
|
cursor.group = "lot";
|
|
31613
31685
|
for (const c of lt2.paths) {
|
|
@@ -31621,14 +31693,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
31621
31693
|
const defined = { perimeter, paths };
|
|
31622
31694
|
Object.assign(K, defined);
|
|
31623
31695
|
}
|
|
31624
|
-
function installLotGates(K,
|
|
31696
|
+
function installLotGates(K, shared3) {
|
|
31625
31697
|
const { bx, colorOf, cursor, cylBase } = K;
|
|
31626
31698
|
const sh = (...a) => K.sh(...a);
|
|
31627
31699
|
function slideDirection(g, lt2) {
|
|
31628
31700
|
return g.u + g.width / 2 + g.width + 1.2 <= lt2.rect[2] ? 1 : -1;
|
|
31629
31701
|
}
|
|
31630
31702
|
function gates() {
|
|
31631
|
-
const R =
|
|
31703
|
+
const R = shared3.ctx.r, lt2 = R.lot, C = shared3.ctx.colors;
|
|
31632
31704
|
if (!lt2) return;
|
|
31633
31705
|
cursor.group = "lot";
|
|
31634
31706
|
const structure = R.style, auto = structure !== "budget", wall = colorOf("wall") || 12104874, cu = (lt2.rect[0] + lt2.rect[2]) / 2, cz = (lt2.rect[1] + lt2.rect[3]) / 2;
|
|
@@ -31702,13 +31774,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
31702
31774
|
bx("emissive", mx + 0.1, 0.28, zc + sd * 0.452, mx + 0.14, 0.31, zc + sd * 0.455, 6479994);
|
|
31703
31775
|
}
|
|
31704
31776
|
}
|
|
31705
|
-
if (!g.open || ped)
|
|
31777
|
+
if (!g.open || ped) shared3.ctx.colliders.push({ type: "gate", f: -1, x0: a, z0: v - 0.1, x1: b, z1: v + 0.1 });
|
|
31706
31778
|
}
|
|
31707
31779
|
}
|
|
31708
31780
|
const defined = { slideDirection, gates };
|
|
31709
31781
|
Object.assign(K, defined);
|
|
31710
31782
|
}
|
|
31711
|
-
function installRoofRoofs(K,
|
|
31783
|
+
function installRoofRoofs(K, shared3) {
|
|
31712
31784
|
const { rectsOf: rectsOf2, EPS: EPS6, OPEN_AREA, Y0, bx, cursor } = K;
|
|
31713
31785
|
const gutter = (...a) => K.gutter(...a);
|
|
31714
31786
|
const gutterConfig = (...a) => K.gutterConfig(...a);
|
|
@@ -31716,14 +31788,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
31716
31788
|
const sh = (...a) => K.sh(...a);
|
|
31717
31789
|
const slabs = (...a) => K.slabs(...a);
|
|
31718
31790
|
function roofs() {
|
|
31719
|
-
const R =
|
|
31791
|
+
const R = shared3.ctx.r, F = R.facade, C = shared3.ctx.colors, nA = R.floors.length, type = F.roof;
|
|
31720
31792
|
cursor.group = "roof";
|
|
31721
|
-
const roofRects =
|
|
31722
|
-
const G =
|
|
31793
|
+
const roofRects = shared3.ctx.roofRects = [];
|
|
31794
|
+
const G = shared3.ctx.gutter = gutterConfig();
|
|
31723
31795
|
G.ncond = 0;
|
|
31724
31796
|
G.nbuz = 0;
|
|
31725
31797
|
G.bz = /* @__PURE__ */ new Set();
|
|
31726
|
-
|
|
31798
|
+
shared3.ctx.gutterInfo = { gutters: [], downpipes: [], drains: [] };
|
|
31727
31799
|
const roofColor = C.roof != null ? C.roof : 11031610, gable = (Number(R.seed) | 0) % 2 === 0;
|
|
31728
31800
|
for (let f = 0; f < nA; f++) {
|
|
31729
31801
|
const rs = R.rooms.filter((c) => c.floor === f && c.type !== "void" && !c.outbuilding && !OPEN_AREA(c)).flatMap(rectsOf2), up = R.rooms.filter((c) => c.floor === f + 1 && c.type !== "void").flatMap(rectsOf2);
|
|
@@ -31776,7 +31848,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
31776
31848
|
if (G.on) gutter(type, f, x0, z0, x1, z1, ybq, touchesU);
|
|
31777
31849
|
}
|
|
31778
31850
|
}
|
|
31779
|
-
for (const e of
|
|
31851
|
+
for (const e of shared3.ctx.outbuildingList || []) {
|
|
31780
31852
|
const [x0, z0, x1, z1] = e.aabb, yb = Y0(0) + (e.ceiling || 2.6) + 0.2;
|
|
31781
31853
|
roofRects.push({ f: 0, r: [x0, z0, x1, z1], outbuilding: e.id });
|
|
31782
31854
|
if (type === "slab") {
|
|
@@ -31785,10 +31857,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
31785
31857
|
for (const [a, b, c2, d] of [[x0 - 0.08, z0 - 0.08, x1 + 0.08, z0 - 0.04], [x0 - 0.08, z1 + 0.04, x1 + 0.08, z1 + 0.08], [x0 - 0.08, z0 - 0.08, x0 - 0.04, z1 + 0.08], [x1 + 0.04, z0 - 0.08, x1 + 0.08, z1 + 0.08]]) bx("plaster", a, yb, b, c2, yb + 0.4, d, c);
|
|
31786
31858
|
continue;
|
|
31787
31859
|
}
|
|
31788
|
-
|
|
31860
|
+
shared3.ctx.noPiece = true;
|
|
31789
31861
|
roofRect(type, x0, z0, x1, z1, yb, roofColor, true, F, [0, 0, 0, 0]);
|
|
31790
31862
|
cursor.pc = null;
|
|
31791
|
-
|
|
31863
|
+
shared3.ctx.noPiece = false;
|
|
31792
31864
|
if (G.on) gutter(type, 0, x0, z0, x1, z1, yb, [0, 0, 0, 0]);
|
|
31793
31865
|
}
|
|
31794
31866
|
}
|
|
@@ -31796,11 +31868,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
31796
31868
|
Object.assign(K, defined);
|
|
31797
31869
|
}
|
|
31798
31870
|
var paletteMeta = (colors) => colors.meta;
|
|
31799
|
-
function installRoofGutters(K,
|
|
31871
|
+
function installRoofGutters(K, shared3) {
|
|
31800
31872
|
const { boxC, bx, cursor, roomAt } = K;
|
|
31801
31873
|
const sh = (...a) => K.sh(...a);
|
|
31802
31874
|
function gutterConfig() {
|
|
31803
|
-
const R =
|
|
31875
|
+
const R = shared3.ctx.r, structure = R.style, high = structure === "high" || structure === "luxury", p = high || structure === "mid" ? 0.6 : 0.3;
|
|
31804
31876
|
let h = 2166136261;
|
|
31805
31877
|
for (const ch of String(R.seed) + "|" + K.seedKey(R.template) + "|calha") h = Math.imul(h ^ ch.charCodeAt(0), 16777619);
|
|
31806
31878
|
const rnd2 = () => {
|
|
@@ -31812,10 +31884,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
31812
31884
|
const draw2 = rnd2() < p, light = rnd2() < 0.6;
|
|
31813
31885
|
void draw2;
|
|
31814
31886
|
const on = true;
|
|
31815
|
-
return { on, rnd: rnd2, color: high ? 3816770 : light ? 15527921 : 10857392, bad: paletteMeta(
|
|
31887
|
+
return { on, rnd: rnd2, color: high ? 3816770 : light ? 15527921 : 10857392, bad: paletteMeta(shared3.ctx.colors)?.state === "abandoned" || R.state === "abandoned", fallback: false };
|
|
31816
31888
|
}
|
|
31817
31889
|
function gutter(type, f, X0, Z0, X1, Z1, yb, touchesU) {
|
|
31818
|
-
const G =
|
|
31890
|
+
const G = shared3.ctx.gutter, o = type === "fiber_cement" ? 0.3 : 0.45, x0 = X0 - (touchesU[0] ? 0 : o), x1 = X1 + (touchesU[2] ? 0 : o), z0 = Z0 - (touchesU[1] ? 0 : o), z1 = Z1 + (touchesU[3] ? 0 : o), c = G.color, y = yb - 0.05;
|
|
31819
31891
|
const run = (ax, a, b, p, outside, breaks) => {
|
|
31820
31892
|
const seg2 = (u0, u1, tilt) => {
|
|
31821
31893
|
const L = u1 - u0, m = (u0 + u1) / 2, dy = tilt ? -Math.abs(tilt) * L * 0.5 : 0;
|
|
@@ -31839,7 +31911,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
31839
31911
|
sides.forEach((l, i) => {
|
|
31840
31912
|
if (l[0]) run(l[1], l[2], l[3], l[4], l[5], G.bad && !G.fallback && i === larger && (G.fallback = true));
|
|
31841
31913
|
});
|
|
31842
|
-
const INF =
|
|
31914
|
+
const INF = shared3.ctx.gutterInfo || (shared3.ctx.gutterInfo = { gutters: [], downpipes: [], drains: [] });
|
|
31843
31915
|
sides.forEach((l, i) => {
|
|
31844
31916
|
if (l[0]) INF.gutters.push({ f, side: ["z0", "z1", "x0", "x1"][i], axis: l[1], a: l[2], b: l[3], p: l[4], y });
|
|
31845
31917
|
});
|
|
@@ -31902,7 +31974,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
31902
31974
|
const defined = { gutterConfig, gutter, drain };
|
|
31903
31975
|
Object.assign(K, defined);
|
|
31904
31976
|
}
|
|
31905
|
-
function installRoofSlabs(K,
|
|
31977
|
+
function installRoofSlabs(K, shared3) {
|
|
31906
31978
|
const { boxC, bx, cursor, drain, roomAt, structurePiece } = K;
|
|
31907
31979
|
const sh = (...a) => K.sh(...a);
|
|
31908
31980
|
function slabs(f, xs, zs, O, U, nx, nz, full, pe, C) {
|
|
@@ -31932,7 +32004,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
31932
32004
|
side(free(j, i + 1), x1 + o - t, z0 - ez0, x1 + o, z1 + ez1);
|
|
31933
32005
|
side(free(j - 1, i), x0 - ex0, z0 - o, x1 + ex1, z0 - o + t);
|
|
31934
32006
|
side(free(j + 1, i), x0 - ex0, z1 + o - t, x1 + ex1, z1 + o);
|
|
31935
|
-
const G =
|
|
32007
|
+
const G = shared3.ctx.gutter;
|
|
31936
32008
|
if (G && G.on && G.bz) for (const [ok, dx, dz] of [[free(j - 1, i), 0, -1], [free(j + 1, i), 0, 1], [free(j, i - 1), -1, 0], [free(j, i + 1), 1, 0]]) {
|
|
31937
32009
|
const kd = f + ":" + dx + ":" + dz;
|
|
31938
32010
|
if (!ok || G.bz.has(kd)) continue;
|
|
@@ -31954,8 +32026,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
31954
32026
|
boxC("plain", tx, 0.9, tz, 0.12, 0.04, 0.12, sh(cc, 0.8));
|
|
31955
32027
|
const rx = tx + dx * 0.24, rz = tz + dz * 0.24;
|
|
31956
32028
|
drain(rx, rz, tx, tz, cc);
|
|
31957
|
-
(
|
|
31958
|
-
|
|
32029
|
+
(shared3.ctx.gutterInfo || (shared3.ctx.gutterInfo = { gutters: [], downpipes: [], drains: [] })).downpipes.push({ f, x: tx, z: tz, y0: 0.045, y1: yb + 0.04, drain: [rx, rz], hornBox: true });
|
|
32030
|
+
shared3.ctx.gutterInfo.drains.push({ x: rx, z: rz });
|
|
31959
32031
|
}
|
|
31960
32032
|
}
|
|
31961
32033
|
}
|
|
@@ -31964,10 +32036,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
31964
32036
|
const defined = { slabs };
|
|
31965
32037
|
Object.assign(K, defined);
|
|
31966
32038
|
}
|
|
31967
|
-
function installRoofTiles(K,
|
|
32039
|
+
function installRoofTiles(K, shared3) {
|
|
31968
32040
|
const { UV_SCALE, _Y, _h2, _q, accFor, cursor, put, rgbOf, structurePiece } = K;
|
|
31969
32041
|
const sh = (...a) => K.sh(...a);
|
|
31970
|
-
const R_STYLE = () =>
|
|
32042
|
+
const R_STYLE = () => shared3.ctx.r && shared3.ctx.r.style || "budget";
|
|
31971
32043
|
function tileRelief(mat, pts, color2, type) {
|
|
31972
32044
|
const n = pts.length;
|
|
31973
32045
|
if (n < 3) return;
|
|
@@ -32008,7 +32080,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
32008
32080
|
S.push(rx * ex + ry * ey + rz * ez);
|
|
32009
32081
|
T2.push(rx * dx + ry * dy + rz * dz);
|
|
32010
32082
|
}
|
|
32011
|
-
const colonial = type !== "fiber_cement", P = colonial ? 0.2 : 0.177, A = colonial ? 0.032 : 0.0255, seg2 =
|
|
32083
|
+
const colonial = type !== "fiber_cement", P = colonial ? 0.2 : 0.177, A = colonial ? 0.032 : 0.0255, seg2 = shared3.quality === "game" ? colonial ? 4 : 4 : colonial ? 8 : 6, h = P / seg2;
|
|
32012
32084
|
const smin = Math.min(...S), smax = Math.max(...S);
|
|
32013
32085
|
if (smax - smin < 1e-4) return;
|
|
32014
32086
|
const xs = new Set(S.map((v) => +v.toFixed(5)));
|
|
@@ -32080,9 +32152,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
32080
32152
|
}
|
|
32081
32153
|
}
|
|
32082
32154
|
function pieceOfPane(x, z) {
|
|
32083
|
-
if (
|
|
32155
|
+
if (shared3.ctx.noPiece || !shared3.ctx.panes.length) return null;
|
|
32084
32156
|
let m = null, md = 1e9;
|
|
32085
|
-
for (const a of
|
|
32157
|
+
for (const a of shared3.ctx.panes) {
|
|
32086
32158
|
const b = a.aabb;
|
|
32087
32159
|
if (!b) continue;
|
|
32088
32160
|
const dx = x < b[0] ? b[0] - x : x > b[2] ? x - b[2] : 0, dz = z < b[1] ? b[1] - z : z > b[3] ? z - b[3] : 0, d = Math.hypot(dx, dz) * 1e3 + (b[2] - b[0]) * (b[3] - b[1]) * 1e-3;
|
|
@@ -32096,11 +32168,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
32096
32168
|
const defined = { R_STYLE, tileRelief, ridge, pieceOfPane };
|
|
32097
32169
|
Object.assign(K, defined);
|
|
32098
32170
|
}
|
|
32099
|
-
function installRoofRect(K,
|
|
32171
|
+
function installRoofRect(K, shared3) {
|
|
32100
32172
|
const { R_STYLE, bx, cursor, pieceOfPane, polyFace, ridge, tileRelief } = K;
|
|
32101
32173
|
const sh = (...a) => K.sh(...a);
|
|
32102
32174
|
function roofRect(type, X0, Z0, X1, Z1, yb, roofColor, gable, F, touchesU = [0, 0, 0, 0]) {
|
|
32103
|
-
const C =
|
|
32175
|
+
const C = shared3.ctx.colors, o = type === "fiber_cement" ? 0.3 : 0.45, x0 = X0 - (touchesU[0] ? 0 : o), x1 = X1 + (touchesU[2] ? 0 : o), z0 = Z0 - (touchesU[1] ? 0 : o), z1 = Z1 + (touchesU[3] ? 0 : o), dx = x1 - x0, dz = z1 - z0, xm = (x0 + x1) / 2, zm = (z0 + z1) / 2;
|
|
32104
32176
|
const mat = type === "fiber_cement" ? "fiber_cement" : "tile", tp = type === "fiber_cement" ? 0.2 : 0.5, alongX = dx >= dz, up = [0, 1, 0];
|
|
32105
32177
|
const Q = (pts) => {
|
|
32106
32178
|
let cx = 0, cz = 0;
|
|
@@ -32138,7 +32210,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
32138
32210
|
}
|
|
32139
32211
|
const rm = alongX ? dz / 2 : dx / 2;
|
|
32140
32212
|
{
|
|
32141
|
-
const roofRects =
|
|
32213
|
+
const roofRects = shared3.ctx.roofRects, rr = roofRects[roofRects.length - 1];
|
|
32142
32214
|
if (rr && !rr.yb) Object.assign(rr, { yb, tp, gable: !!gable, alongX, exterior: [x0, z0, x1, z1], rm });
|
|
32143
32215
|
}
|
|
32144
32216
|
if (gable) {
|
|
@@ -32178,12 +32250,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
32178
32250
|
const defined = { roofRect };
|
|
32179
32251
|
Object.assign(K, defined);
|
|
32180
32252
|
}
|
|
32181
|
-
function installMirrors(K,
|
|
32253
|
+
function installMirrors(K, shared3) {
|
|
32182
32254
|
const { DOC, THREE, Reflector, MIRRORS, Y0, _Y, roomAt } = K;
|
|
32183
|
-
|
|
32184
|
-
|
|
32255
|
+
shared3.mirrorEnv = null;
|
|
32256
|
+
shared3.mirrorMat = null;
|
|
32185
32257
|
function mirrorEnv() {
|
|
32186
|
-
if (
|
|
32258
|
+
if (shared3.mirrorEnv) return shared3.mirrorEnv;
|
|
32187
32259
|
const mk = (f) => {
|
|
32188
32260
|
if (!DOC) throw new Error("game-floorplan-three: the mirrors need a document (options.document)");
|
|
32189
32261
|
const c = DOC.createElement("canvas");
|
|
@@ -32221,18 +32293,18 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
32221
32293
|
const t = new THREE.CubeTexture(faces);
|
|
32222
32294
|
t.colorSpace = THREE.SRGBColorSpace;
|
|
32223
32295
|
t.needsUpdate = true;
|
|
32224
|
-
|
|
32225
|
-
|
|
32296
|
+
shared3.mirrorEnv = t;
|
|
32297
|
+
shared3.mirrorMat = new THREE.MeshStandardMaterial({ color: 16054008, metalness: 1, roughness: 0.06, envMap: t, envMapIntensity: 1 });
|
|
32226
32298
|
return t;
|
|
32227
32299
|
}
|
|
32228
32300
|
const newMirrorState = () => ({ list: [], active: null, tmp: new THREE.Vector3(), house: null });
|
|
32229
|
-
|
|
32301
|
+
shared3.mirrors = newMirrorState();
|
|
32230
32302
|
function assembleMirrors(groups) {
|
|
32231
|
-
|
|
32232
|
-
|
|
32303
|
+
shared3.mirrors.list.length = 0;
|
|
32304
|
+
shared3.mirrors.active = null;
|
|
32233
32305
|
if (!MIRRORS.length) return;
|
|
32234
32306
|
mirrorEnv();
|
|
32235
|
-
if (
|
|
32307
|
+
if (shared3.quality === "game" || !Reflector) {
|
|
32236
32308
|
const by = /* @__PURE__ */ new Map(), m4 = new THREE.Matrix4(), qy = new THREE.Quaternion(), um = new THREE.Vector3(1, 1, 1), ps = new THREE.Vector3(), nm = new THREE.Matrix3(), v = new THREE.Vector3();
|
|
32237
32309
|
for (const E of MIRRORS) {
|
|
32238
32310
|
const geo = new THREE.PlaneGeometry(E.w, E.h);
|
|
@@ -32259,7 +32331,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
32259
32331
|
g.setAttribute("uv", new THREE.Float32BufferAttribute(B.U, 2));
|
|
32260
32332
|
g.setIndex(B.I);
|
|
32261
32333
|
g.computeBoundingSphere();
|
|
32262
|
-
const m = new THREE.Mesh(g,
|
|
32334
|
+
const m = new THREE.Mesh(g, shared3.mirrorMat);
|
|
32263
32335
|
m.name = "mirror/environment";
|
|
32264
32336
|
m.userData.part = "mirror";
|
|
32265
32337
|
(groups[parent] || (groups[parent] = new THREE.Group())).add(m);
|
|
@@ -32274,7 +32346,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
32274
32346
|
g.userData.part = "mirror";
|
|
32275
32347
|
g.userData.room = E.room;
|
|
32276
32348
|
const geo = new THREE.PlaneGeometry(E.w, E.h);
|
|
32277
|
-
const fake = new THREE.Mesh(geo,
|
|
32349
|
+
const fake = new THREE.Mesh(geo, shared3.mirrorMat);
|
|
32278
32350
|
fake.userData.part = "mirror";
|
|
32279
32351
|
fake.name = "mirror/environment";
|
|
32280
32352
|
g.add(fake);
|
|
@@ -32290,27 +32362,27 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
32290
32362
|
console.warn("mirror real", e);
|
|
32291
32363
|
}
|
|
32292
32364
|
(groups[E.parent] || (groups[E.parent] = new THREE.Group())).add(g);
|
|
32293
|
-
|
|
32365
|
+
shared3.mirrors.list.push({ E, g, fake, real });
|
|
32294
32366
|
}
|
|
32295
32367
|
}
|
|
32296
32368
|
function floorAtY(y) {
|
|
32297
|
-
const A =
|
|
32369
|
+
const A = shared3.ctx.r.floors;
|
|
32298
32370
|
let f = 0;
|
|
32299
32371
|
for (let i = 0; i < A.length; i++) if (y >= A[i].y0 - 0.2) f = i;
|
|
32300
32372
|
return f;
|
|
32301
32373
|
}
|
|
32302
32374
|
function chooseMirror(camera2) {
|
|
32303
|
-
if (!
|
|
32375
|
+
if (!shared3.mirrors.list.length) return;
|
|
32304
32376
|
let target = null;
|
|
32305
|
-
if (
|
|
32306
|
-
|
|
32307
|
-
|
|
32308
|
-
const f = floorAtY(
|
|
32309
|
-
if (c &&
|
|
32377
|
+
if (shared3.mirrors.house && shared3.ctx.r) {
|
|
32378
|
+
shared3.mirrors.tmp.copy(camera2.position);
|
|
32379
|
+
shared3.mirrors.house.worldToLocal(shared3.mirrors.tmp);
|
|
32380
|
+
const f = floorAtY(shared3.mirrors.tmp.y), c = roomAt(f, shared3.mirrors.tmp.x, shared3.mirrors.tmp.z);
|
|
32381
|
+
if (c && shared3.mirrors.tmp.y > Y0(f) && shared3.mirrors.tmp.y < Y0(f) + 4) {
|
|
32310
32382
|
let best = 1e9;
|
|
32311
|
-
for (const m of
|
|
32383
|
+
for (const m of shared3.mirrors.list) {
|
|
32312
32384
|
if (m.E.room !== c.id || m.E.floor !== f || !m.g.parent || !m.g.parent.visible) continue;
|
|
32313
|
-
const d = Math.hypot(m.E.x -
|
|
32385
|
+
const d = Math.hypot(m.E.x - shared3.mirrors.tmp.x, m.E.z - shared3.mirrors.tmp.z);
|
|
32314
32386
|
if (d < best) {
|
|
32315
32387
|
best = d;
|
|
32316
32388
|
target = m;
|
|
@@ -32318,9 +32390,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
32318
32390
|
}
|
|
32319
32391
|
}
|
|
32320
32392
|
}
|
|
32321
|
-
if (target ===
|
|
32322
|
-
|
|
32323
|
-
for (const m of
|
|
32393
|
+
if (target === shared3.mirrors.active) return;
|
|
32394
|
+
shared3.mirrors.active = target;
|
|
32395
|
+
for (const m of shared3.mirrors.list) {
|
|
32324
32396
|
const on = m === target && !!m.real;
|
|
32325
32397
|
if (m.real) m.real.visible = on;
|
|
32326
32398
|
m.fake.visible = !on;
|
|
@@ -32329,7 +32401,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
32329
32401
|
const defined = { mirrorEnv, newMirrorState, assembleMirrors, floorAtY, chooseMirror };
|
|
32330
32402
|
Object.assign(K, defined);
|
|
32331
32403
|
}
|
|
32332
|
-
function installCars(K,
|
|
32404
|
+
function installCars(K, shared3) {
|
|
32333
32405
|
const { THREE, FLEET, _Y } = K;
|
|
32334
32406
|
const CARS = [];
|
|
32335
32407
|
const CAR_BY_STYLE = Object.assign({
|
|
@@ -32358,12 +32430,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
32358
32430
|
return b;
|
|
32359
32431
|
}
|
|
32360
32432
|
function carModel(k, seed) {
|
|
32361
|
-
const kc = k + "|" +
|
|
32433
|
+
const kc = k + "|" + shared3.quality + "|" + (seed || 0);
|
|
32362
32434
|
if (CAR_CACHE.has(kc)) return CAR_CACHE.get(kc) ?? null;
|
|
32363
32435
|
if (!FLEET) return null;
|
|
32364
32436
|
let res = null;
|
|
32365
32437
|
try {
|
|
32366
|
-
const v0 = FLEET.build(k, { quality:
|
|
32438
|
+
const v0 = FLEET.build(k, { quality: shared3.quality, seed: seed || 0 }), c = { root: v0.group, g: v0.group };
|
|
32367
32439
|
c.root.updateMatrixWorld(true);
|
|
32368
32440
|
const inv = new THREE.Matrix4();
|
|
32369
32441
|
const byMaterial = /* @__PURE__ */ new Map(), tmp = new THREE.Matrix4(), v = new THREE.Vector3(), nm = new THREE.Matrix3(), bb = new THREE.Box3();
|
|
@@ -32485,7 +32557,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
32485
32557
|
return g;
|
|
32486
32558
|
}
|
|
32487
32559
|
function assembleCars(groups) {
|
|
32488
|
-
if (
|
|
32560
|
+
if (shared3.quality === "game") {
|
|
32489
32561
|
assembleMergedCars(groups);
|
|
32490
32562
|
return;
|
|
32491
32563
|
}
|
|
@@ -32542,10 +32614,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
32542
32614
|
const defined = { CARS, CAR_BY_STYLE, CAR_CACHE, materialSignature, BUCKETS, bucketMaterial, carModel, carGroup, assembleCars, assembleMergedCars };
|
|
32543
32615
|
Object.assign(K, defined);
|
|
32544
32616
|
}
|
|
32545
|
-
function installHouseBuilding(K,
|
|
32617
|
+
function installHouseBuilding(K, shared3) {
|
|
32546
32618
|
const { bx, cursor } = K;
|
|
32547
32619
|
function building() {
|
|
32548
|
-
const R =
|
|
32620
|
+
const R = shared3.ctx.r, P = R.building, C = shared3.ctx.colors, N = shared3.ctx.pa, uf = shared3.ctx.pf, pe = P.ceilingHeight, fa = C.facade != null ? C.facade : 14209216;
|
|
32549
32621
|
cursor.group = "building";
|
|
32550
32622
|
const uw = P.unit.w, ud = P.unit.d, un = P.units;
|
|
32551
32623
|
const unitBox = (u) => {
|
|
@@ -32553,7 +32625,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
32553
32625
|
return [x[0], z[0], x[1], z[1]];
|
|
32554
32626
|
};
|
|
32555
32627
|
const un0 = unitBox(un[0]), color2 = P.corridor, hall = P.hall, el = P.elevator.rect, es = P.stairs.rect;
|
|
32556
|
-
const sel = un[
|
|
32628
|
+
const sel = un[shared3.ctx.pu] || un[0], selR = unitBox(sel);
|
|
32557
32629
|
const shell = (rc, y0, y1, thickness = 0.15) => {
|
|
32558
32630
|
const [a, b, c, d] = rc;
|
|
32559
32631
|
bx("building", a, y0, b, c, y1, b + thickness, fa);
|
|
@@ -32592,12 +32664,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
32592
32664
|
}
|
|
32593
32665
|
const ytop = N * pe - 0.2;
|
|
32594
32666
|
bx("plaster", Math.min(hall[0] - 3, color2[0]), ytop, Math.min(un[1] ? unitBox(un[1])[1] : 0, el[1]), Math.max(color2[2], un0[2]), ytop + 0.2, Math.max(un0[3], un[1] ? unitBox(un[1])[3] : 0), 11841704);
|
|
32595
|
-
|
|
32667
|
+
shared3.ctx.limits = { x0: Math.min(hall[0] - 3, color2[0]), z0: Math.min(el[1], un[1] ? unitBox(un[1])[1] : 0), x1: Math.max(color2[2], un0[2]), z1: Math.max(un0[3], un[1] ? unitBox(un[1])[3] : 0) };
|
|
32596
32668
|
}
|
|
32597
32669
|
const defined = { building };
|
|
32598
32670
|
Object.assign(K, defined);
|
|
32599
32671
|
}
|
|
32600
|
-
function installUtilitiesWater(K,
|
|
32672
|
+
function installUtilitiesWater(K, shared3) {
|
|
32601
32673
|
const { THREE, _Y, _q, cursor, cylBase, part, pieceRecord, put } = K;
|
|
32602
32674
|
function createWater(r, state) {
|
|
32603
32675
|
const H = r.utilities?.plumbing, cap = H ? +H.capacityL || 0 : 0, ls = { dry: [], full: [] }, points = {}, itemPoint = {};
|
|
@@ -32689,14 +32761,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
32689
32761
|
}
|
|
32690
32762
|
const _v3 = new THREE.Vector3();
|
|
32691
32763
|
function waterPipes() {
|
|
32692
|
-
const H =
|
|
32764
|
+
const H = shared3.ctx.r.utilities?.plumbing;
|
|
32693
32765
|
if (!H || !H.visibleRuns) return;
|
|
32694
|
-
const nA =
|
|
32766
|
+
const nA = shared3.ctx.r.floors.length;
|
|
32695
32767
|
const groupOf = (c) => c && c.floor >= 0 ? "f" + Math.min(c.floor, nA - 1) : "lot", xyz = (p) => [p[0], p[2], p[1]];
|
|
32696
32768
|
for (const tr of H.visibleRuns) {
|
|
32697
32769
|
const pts = tr.points.map(xyz), d = tr.diameter || 0.025;
|
|
32698
32770
|
if (tr.exposed === "wall") {
|
|
32699
|
-
const pt = H.points.find((p) => p.run === tr.id), com = tr.to != null ?
|
|
32771
|
+
const pt = H.points.find((p) => p.run === tr.id), com = tr.to != null ? shared3.ctx.roomById[tr.to] : void 0, g2 = groupOf(com || pt && { floor: pt.floor });
|
|
32700
32772
|
part("wall_pipe", [0, 0, 0], () => {
|
|
32701
32773
|
for (let i = 0; i + 1 < pts.length; i++) pipe(pts[i], pts[i + 1], d, PIPE_COLOR);
|
|
32702
32774
|
for (const p of pts) cylBase("plain", p[0], p[1] - d, p[2], d * 0.7, d * 2, PIPE_COLOR);
|
|
@@ -32704,7 +32776,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
32704
32776
|
continue;
|
|
32705
32777
|
}
|
|
32706
32778
|
let g;
|
|
32707
|
-
if (tr.exposed === "tank_outlet") g =
|
|
32779
|
+
if (tr.exposed === "tank_outlet") g = shared3.ctx.waterTankPos && shared3.ctx.waterTankPos.group || "f0";
|
|
32708
32780
|
else {
|
|
32709
32781
|
const pt = H.points.find((p) => p.id === tr.to);
|
|
32710
32782
|
g = groupOf(pt);
|
|
@@ -32721,15 +32793,15 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
32721
32793
|
const defined = { createWater, PIPE_COLOR, pipe, _v3, waterPipes };
|
|
32722
32794
|
Object.assign(K, defined);
|
|
32723
32795
|
}
|
|
32724
|
-
function installUtilitiesElectrical(K,
|
|
32796
|
+
function installUtilitiesElectrical(K, shared3) {
|
|
32725
32797
|
const { _Y, _q, _v3, bx, cursor, cylBase, pieceRecord, put } = K;
|
|
32726
32798
|
const sh = (...a) => K.sh(...a);
|
|
32727
32799
|
function electricalStructure() {
|
|
32728
|
-
const R =
|
|
32729
|
-
|
|
32800
|
+
const R = shared3.ctx.r, E = R.utilities?.electrical;
|
|
32801
|
+
shared3.ctx.electricalInfo = null;
|
|
32730
32802
|
if (!E) return;
|
|
32731
32803
|
const nA = R.floors.length, lotGroup = R.lot ? "lot" : "f0", concreteColor = 11973547, iron = 4869200, wireRun = 1842206, info = { pole: null, meter: null, panel: null, conduits: [], outlets: [], switches: [], circuits: E.circuits || [], exposed: !!E.exposed };
|
|
32732
|
-
const en22 = E.serviceEntrance, KV =
|
|
32804
|
+
const en22 = E.serviceEntrance, KV = shared3.ctx.iv ? shared3.ctx.iv.plane : null;
|
|
32733
32805
|
const wireL = (a, b, r_ = 8e-3) => {
|
|
32734
32806
|
const L = Math.hypot(b[0] - a[0], b[1] - a[1], b[2] - a[2]);
|
|
32735
32807
|
if (L < 1e-3) return;
|
|
@@ -32807,7 +32879,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
32807
32879
|
info.conduits.push(t.id);
|
|
32808
32880
|
continue;
|
|
32809
32881
|
}
|
|
32810
|
-
const c = circ[t.circuit], com = c &&
|
|
32882
|
+
const c = circ[t.circuit], com = c && shared3.ctx.roomById[c.room];
|
|
32811
32883
|
cursor.group = "f" + Math.max(0, Math.min(nA - 1, com ? com.floor : 0));
|
|
32812
32884
|
const d = t.diameter || 0.02, P = t.points.map((p) => [p[0], p[2], p[1]]), seg2 = [];
|
|
32813
32885
|
for (let i = 0; i + 1 < P.length; i++) {
|
|
@@ -32825,7 +32897,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
32825
32897
|
}
|
|
32826
32898
|
for (const t of E.outlets || []) info.outlets.push({ id: t.id, pos: [t.u, t.y, t.v], normal: [t.frontU || 0, 0, t.frontV || 0], room: t.room, floor: t.floor, type: t.type, voltage: t.voltage });
|
|
32827
32899
|
for (const t of E.switches || []) info.switches.push({ id: t.id, pos: [t.u, t.y, t.v], normal: [t.frontU || 0, 0, t.frontV || 0], room: t.room, floor: t.floor, controls: t.controls });
|
|
32828
|
-
|
|
32900
|
+
shared3.ctx.electricalInfo = info;
|
|
32829
32901
|
}
|
|
32830
32902
|
function pipe2(a, b, diameter, color2) {
|
|
32831
32903
|
const dx = b[0] - a[0], dy = b[1] - a[1], dz = b[2] - a[2], L = Math.hypot(dx, dy, dz);
|
|
@@ -32838,11 +32910,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
32838
32910
|
}
|
|
32839
32911
|
var BASEBOARD_TILES = { length: 0.6, joint: 3e-3, material: "ceramic", density: 2300 };
|
|
32840
32912
|
var SIDEWALK_SLABS = { length: 1.2, joint: 0.01, material: "concrete", density: 2400 };
|
|
32841
|
-
function installHouseBaseboard(K,
|
|
32913
|
+
function installHouseBaseboard(K, shared3) {
|
|
32842
32914
|
const { Y0, bx, cursor, pieceRecord, sideOf } = K;
|
|
32843
32915
|
const sh = (...a) => K.sh(...a);
|
|
32844
32916
|
function baseboardAndSidewalk() {
|
|
32845
|
-
const R =
|
|
32917
|
+
const R = shared3.ctx.r, W = 0.6, t = 0.012, ht = 0.35, color2 = sh(shared3.ctx.colors.facade != null ? shared3.ctx.colors.facade : 14209216, 0.62), y0 = Y0(0), cal = 13947078;
|
|
32846
32918
|
const ws = R.walls.filter((w) => w.floor === 0 && w.type === "wall").map((w) => {
|
|
32847
32919
|
const au = w.axis === "u";
|
|
32848
32920
|
return { w, au, L: au ? w.v0 : w.u0, a: Math.min(au ? w.u0 : w.v0, au ? w.u1 : w.v1), b: Math.max(au ? w.u0 : w.v0, au ? w.u1 : w.v1), th: w.thickness || 0.15 };
|
|
@@ -32875,7 +32947,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
32875
32947
|
box5(a, b);
|
|
32876
32948
|
};
|
|
32877
32949
|
if (!piece2) box5(s0, s1);
|
|
32878
|
-
else if (
|
|
32950
|
+
else if (shared3.ctx.baseboardBand) tile(piece2, s0, s1);
|
|
32879
32951
|
else {
|
|
32880
32952
|
const n = Math.max(1, Math.round((s1 - s0) / laid.length)), w = (s1 - s0) / n, j = laid.joint / 2;
|
|
32881
32953
|
for (let i = 0; i < n; i++) tile(`${piece2}:${i}`, s0 + i * w + (i > 0 ? j : 0), s0 + (i + 1) * w - (i < n - 1 ? j : 0));
|
|
@@ -32889,11 +32961,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
32889
32961
|
const defined = { baseboardAndSidewalk };
|
|
32890
32962
|
Object.assign(K, defined);
|
|
32891
32963
|
}
|
|
32892
|
-
function installUtilitiesSolar(K,
|
|
32964
|
+
function installUtilitiesSolar(K, shared3) {
|
|
32893
32965
|
const { Y0, boxC, bx, cursor, cylBase } = K;
|
|
32894
32966
|
function roofHeightAt(u, v, f) {
|
|
32895
32967
|
let y = null;
|
|
32896
|
-
for (const rr of
|
|
32968
|
+
for (const rr of shared3.ctx.roofRects || []) {
|
|
32897
32969
|
if (rr.yb == null || f != null && rr.f !== f) continue;
|
|
32898
32970
|
if (rr.slab) {
|
|
32899
32971
|
const [a, b, c, d] = rr.r;
|
|
@@ -32909,8 +32981,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
32909
32981
|
return y;
|
|
32910
32982
|
}
|
|
32911
32983
|
function solar() {
|
|
32912
|
-
const R =
|
|
32913
|
-
|
|
32984
|
+
const R = shared3.ctx.r, S = R.utilities?.solar;
|
|
32985
|
+
shared3.ctx.solarInfo = null;
|
|
32914
32986
|
if (!S || !S.panels || !S.panels.length) return;
|
|
32915
32987
|
cursor.group = "roof";
|
|
32916
32988
|
const silver = 13225426, blue = 1780302, line = 9279142, sv = S.north === "front" ? -1 : 1, info = { type: S.type, panels: [], inverter: null }, onRack = S.type === "slab_rack";
|
|
@@ -32952,16 +33024,16 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
32952
33024
|
bx("plain", iv.u - W * 0.6, y0 + 0.05, iv.v + fa0, iv.u + W * 0.6, y0 + 0.17, iv.v + fa1, 2106924);
|
|
32953
33025
|
bx("emissive", iv.u - 0.03, y0 - 0.12, iv.v + fa0, iv.u + 0.03, y0 - 0.09, iv.v + fa1, 6479994);
|
|
32954
33026
|
}
|
|
32955
|
-
const top = Math.max(...(
|
|
33027
|
+
const top = Math.max(...(shared3.ctx.roofRects || []).flatMap((t2) => t2.yb != null ? [t2.yb] : []), Y0(fa) + 2.8);
|
|
32956
33028
|
cylBase("plain", iv.u, y0 + h / 2, iv.v, 0.016, Math.max(0.2, top - 0.2 - (y0 + h / 2)), 15262936);
|
|
32957
33029
|
info.inverter = { id: iv.id, pos: [iv.u, y0, iv.v], side: iv.side, link: iv.link };
|
|
32958
33030
|
}
|
|
32959
|
-
|
|
33031
|
+
shared3.ctx.solarInfo = info;
|
|
32960
33032
|
}
|
|
32961
33033
|
const defined = { roofHeightAt, solar };
|
|
32962
33034
|
Object.assign(K, defined);
|
|
32963
33035
|
}
|
|
32964
|
-
function installHouseOutbuildings(K,
|
|
33036
|
+
function installHouseOutbuildings(K, shared3) {
|
|
32965
33037
|
const { t, bx, cursor, floorColor } = K;
|
|
32966
33038
|
const sh = (...a) => K.sh(...a);
|
|
32967
33039
|
const OUTBUILDING_USE = { guest_room: ["bedroom", "bedroom", t("outbuilding.guest_room")], office: ["office", "office", t("outbuilding.office")], storage: ["stockroom", "stockroom", t("outbuilding.storage")], gourmet: ["living", "gourmet", t("outbuilding.gourmet")] };
|
|
@@ -33008,17 +33080,17 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
33008
33080
|
return Object.assign({}, r, { rooms, walls, doors, windows, items });
|
|
33009
33081
|
}
|
|
33010
33082
|
function outbuildings() {
|
|
33011
|
-
const E = (
|
|
33012
|
-
|
|
33083
|
+
const E = (shared3.ctx.r.outbuildings || []).filter((e) => shared3.ctx.roomById[e.id] && shared3.ctx.roomById[e.id].outbuilding);
|
|
33084
|
+
shared3.ctx.outbuildingList = E;
|
|
33013
33085
|
if (!E.length) return;
|
|
33014
33086
|
cursor.group = "f0";
|
|
33015
33087
|
for (const e of E) {
|
|
33016
|
-
const c =
|
|
33088
|
+
const c = shared3.ctx.roomById[e.id], col = floorColor(c);
|
|
33017
33089
|
for (const [a, b, c2, d] of e.interior) bx("plaster", a - 0.075, 0, b - 0.075, c2 + 0.075, 0.04, d + 0.075, col);
|
|
33018
33090
|
for (const p of e.doors || []) {
|
|
33019
33091
|
const alongU = p.axis === "u", th = e.thickness || 0.15;
|
|
33020
|
-
if (alongU) bx("plaster", p.at - p.width / 2, 0, p.pos - th / 2 - 0.12, p.at + p.width / 2, 0.03, p.pos + th / 2 + 0.12, sh(
|
|
33021
|
-
else bx("plaster", p.pos - th / 2 - 0.12, 0, p.at - p.width / 2, p.pos + th / 2 + 0.12, 0.03, p.at + p.width / 2, sh(
|
|
33092
|
+
if (alongU) bx("plaster", p.at - p.width / 2, 0, p.pos - th / 2 - 0.12, p.at + p.width / 2, 0.03, p.pos + th / 2 + 0.12, sh(shared3.ctx.colors.facade || 14209216, 0.8));
|
|
33093
|
+
else bx("plaster", p.pos - th / 2 - 0.12, 0, p.at - p.width / 2, p.pos + th / 2 + 0.12, 0.03, p.at + p.width / 2, sh(shared3.ctx.colors.facade || 14209216, 0.8));
|
|
33022
33094
|
}
|
|
33023
33095
|
}
|
|
33024
33096
|
}
|
|
@@ -33757,10 +33829,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
33757
33829
|
const defined = { typeTable };
|
|
33758
33830
|
Object.assign(K, defined);
|
|
33759
33831
|
}
|
|
33760
|
-
function installFurnitureTaps(K,
|
|
33761
|
-
|
|
33832
|
+
function installFurnitureTaps(K, shared3) {
|
|
33833
|
+
shared3.tapCount = 0;
|
|
33762
33834
|
function counterTap(K2, x, y, z, reach, back, meta = {}) {
|
|
33763
|
-
const cr = 12896460, id = "tap_" + (K2.M.seed || "") + "_" +
|
|
33835
|
+
const cr = 12896460, id = "tap_" + (K2.M.seed || "") + "_" + shared3.tapCount++;
|
|
33764
33836
|
K2.c("metal", x, y, z, 0.028, 0.012, cr);
|
|
33765
33837
|
K2.c("metal", x, y + 0.012, z, 0.014, 0.12, cr);
|
|
33766
33838
|
const pts = [];
|
|
@@ -33791,7 +33863,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
33791
33863
|
return id;
|
|
33792
33864
|
}
|
|
33793
33865
|
function wallTap(K2, x, y, zw, direction, back, meta = {}) {
|
|
33794
|
-
const cr = 12896460, id = "tap_" + (K2.M.seed || "") + "_" +
|
|
33866
|
+
const cr = 12896460, id = "tap_" + (K2.M.seed || "") + "_" + shared3.tapCount++, s = direction || 1;
|
|
33795
33867
|
K2.t("metal", [x, y, zw], [x, y, zw + s * 0.025], 0.03, cr);
|
|
33796
33868
|
K2.t("metal", [x, y, zw + s * 0.02], [x, y, zw + s * 0.1], 0.016, cr);
|
|
33797
33869
|
K2.e("metal", x, y, zw + s * 0.105, 0.019, 0.04, cr);
|
|
@@ -34043,7 +34115,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
34043
34115
|
const defined = { GREENS: GREENS2, FLOWERS, blobs, potModel, arcLeaf, tuft, palm_tree, treeModel, shrubModel, potPlant, tablePot, planterModel };
|
|
34044
34116
|
Object.assign(K, defined);
|
|
34045
34117
|
}
|
|
34046
|
-
function installFurnitureYard(K,
|
|
34118
|
+
function installFurnitureYard(K, shared3) {
|
|
34047
34119
|
const seedKey = (id) => K.seedKey(id);
|
|
34048
34120
|
const { FURNITURE, SEED, STYLE, kit2, rngString, sh, wallTap } = K;
|
|
34049
34121
|
FURNITURE.laundry_tub = function(M, A) {
|
|
@@ -34133,7 +34205,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
34133
34205
|
}
|
|
34134
34206
|
}
|
|
34135
34207
|
}, { id: "laundry_" + M.seed, swing: true, room: "yard" });
|
|
34136
|
-
(
|
|
34208
|
+
(shared3.ctx.clotheslines || (shared3.ctx.clotheslines = [])).push(M.seed);
|
|
34137
34209
|
};
|
|
34138
34210
|
FURNITURE.water_tank = function(M, A) {
|
|
34139
34211
|
const K2 = kit2(M, A), w = M.w || 1, d = M.d || 1, onGround = !M.onSlab && (M.y || 0) < 0.5, color2 = M.palette && M.palette.tank_water != null ? M.palette.tank_water : 3107496, r = Math.min(w, d) * 0.46, rc = 11841700;
|
|
@@ -34277,13 +34349,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
34277
34349
|
const defined = { extraTypes };
|
|
34278
34350
|
Object.assign(K, defined);
|
|
34279
34351
|
}
|
|
34280
|
-
function installFurniturePlaceItems(K,
|
|
34352
|
+
function installFurniturePlaceItems(K, shared3) {
|
|
34281
34353
|
const { THREE, Y0, _col, boxC, colorOf, cursor, decorLights, makeApi, structurePiece } = K;
|
|
34282
34354
|
const buildItem2 = (...a) => K.buildItem(...a);
|
|
34283
34355
|
const registerCollision = (...a) => K.registerCollision(...a);
|
|
34284
34356
|
const vegItem = (...a) => K.vegItem(...a);
|
|
34285
34357
|
function houseItems() {
|
|
34286
|
-
const R =
|
|
34358
|
+
const R = shared3.ctx.r, T2 = shared3.ctx.types, api = makeApi(), noModel = /* @__PURE__ */ new Map();
|
|
34287
34359
|
const list2 = R.items.concat(R.stateItems.filter((e) => e.w != null && e.d != null && e.type !== "razor_wire" && e.type !== "barbed_wire"));
|
|
34288
34360
|
const rect = (poly) => {
|
|
34289
34361
|
let a = 0;
|
|
@@ -34295,8 +34367,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
34295
34367
|
if (m.type === "stairs") continue;
|
|
34296
34368
|
const exterior = m.outdoor || m.floor < 0, f = exterior ? -1 : Math.min(m.floor, R.floors.length - 1);
|
|
34297
34369
|
cursor.group = exterior ? "lot" : "f" + f;
|
|
34298
|
-
const com = m.room != null ?
|
|
34299
|
-
const M = { 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:
|
|
34370
|
+
const com = m.room != null ? shared3.ctx.roomById[m.room] : void 0, base = exterior ? 0 : Y0(f);
|
|
34371
|
+
const M = { 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 };
|
|
34300
34372
|
if (m.category === "ground_cover" && m.polygon) {
|
|
34301
34373
|
const xs = m.polygon.map((p) => p[0]), zs = m.polygon.map((p) => p[1]);
|
|
34302
34374
|
M.x = (Math.min(...xs) + Math.max(...xs)) / 2;
|
|
@@ -34306,8 +34378,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
34306
34378
|
M.ry = 0;
|
|
34307
34379
|
if (!rect(m.polygon)) M.poly = m.polygon.map((p) => [p[0] - M.x, p[1] - M.z]);
|
|
34308
34380
|
}
|
|
34309
|
-
if (
|
|
34310
|
-
if (
|
|
34381
|
+
if (shared3.ctx.veg && vegItem(m, M, exterior ? "lot" : "f" + f)) continue;
|
|
34382
|
+
if (shared3.ctx.iv && shared3.ctx.iv.replace.has(m.id)) {
|
|
34311
34383
|
registerCollision(m, M);
|
|
34312
34384
|
continue;
|
|
34313
34385
|
}
|
|
@@ -34339,13 +34411,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
34339
34411
|
return noModel;
|
|
34340
34412
|
}
|
|
34341
34413
|
function waterTankOfHouse(api) {
|
|
34342
|
-
const cd =
|
|
34343
|
-
if (!cd || !
|
|
34344
|
-
const lc = cd.place === "raised_slab" && cd.platform, slab = cd.place === "slab" || !!lc, nA =
|
|
34345
|
-
const base = lc ? cd.platform.topY : cd.y + (
|
|
34414
|
+
const cd = shared3.ctx.r.waterTank;
|
|
34415
|
+
if (!cd || !shared3.ctx.types.water_tank) return;
|
|
34416
|
+
const lc = cd.place === "raised_slab" && cd.platform, slab = cd.place === "slab" || !!lc, nA = shared3.ctx.r.floors.length, f = Math.max(0, Math.min(nA - 1, cd.floor));
|
|
34417
|
+
const base = lc ? cd.platform.topY : cd.y + (shared3.ctx.r.rooms.some((c) => c.id === cd.room && c.type === "terrace") ? 0 : 0.2 + (slab ? 0.03 : 0));
|
|
34346
34418
|
cursor.group = slab ? "f" + f : "attic_tank";
|
|
34347
34419
|
if (lc) {
|
|
34348
|
-
const P = cd.platform, [x0, z0, x1, z1] = P.aabb, e = P.thickness, color2 =
|
|
34420
|
+
const P = cd.platform, [x0, z0, x1, z1] = P.aabb, e = P.thickness, color2 = shared3.ctx.colors.slab != null ? shared3.ctx.colors.slab : 12170668;
|
|
34349
34421
|
cursor.pc = structurePiece("tank_slab");
|
|
34350
34422
|
boxC("plain", (x0 + x1) / 2, P.topY - e / 2, (z0 + z1) / 2, x1 - x0, e, z1 - z0, color2, 0, 0, 0);
|
|
34351
34423
|
P.pillars.forEach((p, k) => {
|
|
@@ -34355,13 +34427,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
34355
34427
|
cursor.pc = null;
|
|
34356
34428
|
}
|
|
34357
34429
|
if (!slab) {
|
|
34358
|
-
const color2 =
|
|
34430
|
+
const color2 = shared3.ctx.colors.slab != null ? shared3.ctx.colors.slab : 12170668, yp = Y0(f), hw = cd.w / 2 + 0.1, hd = cd.d / 2 + 0.1;
|
|
34359
34431
|
boxC("plain", cd.u, base - 0.06, cd.v, hw * 2, 0.12, hd * 2, color2);
|
|
34360
34432
|
for (const sx of [-1, 1]) for (const sz of [-1, 1]) boxC("plain", cd.u + sx * (hw - 0.07), (yp + base - 0.12) / 2, cd.v + sz * (hd - 0.07), 0.1, base - 0.12 - yp, 0.1, color2);
|
|
34361
34433
|
}
|
|
34362
|
-
const M = { x: cd.u, z: cd.v, ry: 0, w: cd.w, d: cd.d, h: cd.h + 0.12, y: 0, base, floor: f, colors:
|
|
34363
|
-
|
|
34364
|
-
|
|
34434
|
+
const M = { x: cd.u, z: cd.v, ry: 0, w: cd.w, d: cd.d, h: cd.h + 0.12, y: 0, base, floor: f, colors: shared3.ctx.colors, seed: "water_tank", room: cd.room, onSlab: true, ceiling: 2.9 };
|
|
34435
|
+
shared3.ctx.waterTankPos = { x: cd.u, z: cd.v, y: base, group: cursor.group };
|
|
34436
|
+
shared3.ctx.types.water_tank.f(M, api);
|
|
34365
34437
|
}
|
|
34366
34438
|
function hashColor(s) {
|
|
34367
34439
|
let h = 7;
|
|
@@ -34371,12 +34443,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
34371
34443
|
function labeledBox(m, M, group) {
|
|
34372
34444
|
const color2 = M.color != null ? M.color : hashColor(m.category || m.type), h = Math.max(0.05, m.h || 0.5);
|
|
34373
34445
|
boxC("plain", m.x, M.base + (m.y || 0) + h / 2, m.z, m.w, h, m.d, color2, 0, m.ry || 0, 0);
|
|
34374
|
-
|
|
34446
|
+
shared3.ctx.labels.push({ pos: new THREE.Vector3(m.x, M.base + (m.y || 0) + h + 0.15, m.z), text: m.type, group, type: "no_model" });
|
|
34375
34447
|
}
|
|
34376
34448
|
const defined = { houseItems, waterTankOfHouse, hashColor, labeledBox };
|
|
34377
34449
|
Object.assign(K, defined);
|
|
34378
34450
|
}
|
|
34379
|
-
function installVegetationBridge(K,
|
|
34451
|
+
function installVegetationBridge(K, shared3) {
|
|
34380
34452
|
const seedKey = (id) => K.seedKey(id);
|
|
34381
34453
|
const { THREE, SEED, rngString } = K;
|
|
34382
34454
|
const VEG_POT = ["potted_areca", "potted_snake_plant", "potted_fern"], VEG_CACTUS = { cactus_mandacaru: "mandacaru", cactus_palm: "prickly_pear", cactus_crown: "crown_cactus", cactus_xique: "xique_xique", cactus_pot: "potted_cactus" };
|
|
@@ -34402,7 +34474,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
34402
34474
|
for (const k of Object.keys(VEG_CACTUS)) VEG_MAP[k] = [VEG_CACTUS[k]];
|
|
34403
34475
|
const VEG_PLANTER = { planter_bed: ["rose_bush_red", "rose_bush_pink", "rose_bush_white", "marigold", "periwinkle_pink", "periwinkle_white", "daisy"], planter_bed_small: ["rose_bush_red", "marigold", "periwinkle_pink", "daisy"], garden_bed: ["lawn_tuft", "wild_flowers"] };
|
|
34404
34476
|
function vegItem(m, M, group) {
|
|
34405
|
-
const V3 =
|
|
34477
|
+
const V3 = shared3.ctx.veg;
|
|
34406
34478
|
if (!V3) return false;
|
|
34407
34479
|
const ids = VEG_MAP[m.type], can2 = VEG_PLANTER[m.type];
|
|
34408
34480
|
if (!ids && !can2) return false;
|
|
@@ -34443,7 +34515,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
34443
34515
|
return true;
|
|
34444
34516
|
}
|
|
34445
34517
|
function assembleVegetation(groups) {
|
|
34446
|
-
const V3 =
|
|
34518
|
+
const V3 = shared3.ctx.veg;
|
|
34447
34519
|
if (!V3) return;
|
|
34448
34520
|
let pl = 0, tri = 0;
|
|
34449
34521
|
const col = [], lod = [0, 0, 0], mats = V3.mats();
|
|
@@ -34466,18 +34538,18 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
34466
34538
|
for (const c of lot.colliders) col.push(Object.assign({ y: G.y, group: G.group }, c));
|
|
34467
34539
|
for (let i = 0; i < 3; i++) lod[i] += lot.lodCounts[i];
|
|
34468
34540
|
}
|
|
34469
|
-
|
|
34541
|
+
shared3.ctx.vegInfo = { plants: pl, triangles: tri, colliders: col, lodCounts: lod, materials: mats };
|
|
34470
34542
|
}
|
|
34471
34543
|
const defined = { VEG_POT, VEG_CACTUS, VEG_MAP, VEG_PLANTER, vegItem, assembleVegetation };
|
|
34472
34544
|
Object.assign(K, defined);
|
|
34473
34545
|
}
|
|
34474
|
-
function installInteractionState(K,
|
|
34546
|
+
function installInteractionState(K, shared3) {
|
|
34475
34547
|
const { THREE, cfg, colliderChanged, invalidateShadow, invalidate, UV_SCALE, applyPart, texture } = K;
|
|
34476
34548
|
const ivRoomEffective = (...a) => K.ivRoomEffective(...a);
|
|
34477
34549
|
const ivRoomLight = (...a) => K.ivRoomLight(...a);
|
|
34478
|
-
|
|
34550
|
+
shared3.partState = /* @__PURE__ */ new Map();
|
|
34479
34551
|
const newInteractiveState = () => ({ defs: /* @__PURE__ */ new Map(), items: [], pieces: [], lights: /* @__PURE__ */ new Map(), litRooms: /* @__PURE__ */ new Set(), objs: [], anim: /* @__PURE__ */ new Set(), msg: null, target: null });
|
|
34480
|
-
|
|
34552
|
+
shared3.inter = newInteractiveState();
|
|
34481
34553
|
const MESSAGE_MS = 2200;
|
|
34482
34554
|
UV_SCALE.doorWood = 1;
|
|
34483
34555
|
UV_SCALE.doorPaint = 1;
|
|
@@ -34532,15 +34604,15 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
34532
34604
|
}
|
|
34533
34605
|
const _EY = new THREE.Vector3(0, 1, 0), _UM3 = new THREE.Vector3(1, 1, 1);
|
|
34534
34606
|
const hudMessage = (text) => {
|
|
34535
|
-
|
|
34607
|
+
shared3.inter.msg = { text, until: performance.now() + MESSAGE_MS };
|
|
34536
34608
|
if (cfg.onMessage) cfg.onMessage(text);
|
|
34537
34609
|
};
|
|
34538
|
-
const I = () =>
|
|
34610
|
+
const I = () => shared3.inter;
|
|
34539
34611
|
function definePiece(name, definition) {
|
|
34540
34612
|
const def = definition;
|
|
34541
34613
|
def.name = name;
|
|
34542
34614
|
def.meshes = [];
|
|
34543
|
-
def.t = def.target =
|
|
34615
|
+
def.t = def.target = shared3.partState.has(name) ? shared3.partState.get(name) : def.t0 || 0;
|
|
34544
34616
|
I().defs.set(name, def);
|
|
34545
34617
|
I().pieces.push(def);
|
|
34546
34618
|
return def;
|
|
@@ -34641,20 +34713,20 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
34641
34713
|
}
|
|
34642
34714
|
function togglePiece(p) {
|
|
34643
34715
|
p.target = p.target > 0.5 ? 0 : 1;
|
|
34644
|
-
|
|
34716
|
+
shared3.partState.set(p.name, p.target);
|
|
34645
34717
|
if (p.col && p.col.off !== p.target > 0.5) {
|
|
34646
34718
|
p.col.off = p.target > 0.5;
|
|
34647
34719
|
colliderChanged(p.col);
|
|
34648
34720
|
}
|
|
34649
34721
|
I().anim.add(p);
|
|
34650
34722
|
}
|
|
34651
|
-
const lightBase = (roomId) => roomId == null ? true :
|
|
34723
|
+
const lightBase = (roomId) => roomId == null ? true : shared3.partState.has("light:" + roomId) ? !!shared3.partState.get("light:" + roomId) : !!shared3.ctx.night;
|
|
34652
34724
|
const lightOn = (roomId) => {
|
|
34653
|
-
const S = roomId != null &&
|
|
34725
|
+
const S = roomId != null && shared3.ctx.iv && shared3.ctx.iv.roomStates.get(roomId);
|
|
34654
34726
|
return S ? S.ef : lightBase(roomId);
|
|
34655
34727
|
};
|
|
34656
34728
|
function applyLight(roomId) {
|
|
34657
|
-
const on = lightOn(roomId), inter = I(), mats =
|
|
34729
|
+
const on = lightOn(roomId), inter = I(), mats = shared3.mats;
|
|
34658
34730
|
for (const d of inter.lights.get(roomId) || []) for (const m of d.meshes) if (m.name.endsWith("/emissive")) m.material = on ? mats.emissive : mats.off;
|
|
34659
34731
|
const sw = inter.defs.get("ix:int:" + roomId);
|
|
34660
34732
|
if (sw) {
|
|
@@ -34664,9 +34736,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
34664
34736
|
invalidate();
|
|
34665
34737
|
}
|
|
34666
34738
|
function toggleLight(roomId) {
|
|
34667
|
-
const S =
|
|
34739
|
+
const S = shared3.ctx.iv && shared3.ctx.iv.roomStates.get(roomId);
|
|
34668
34740
|
if (S) {
|
|
34669
|
-
const IV =
|
|
34741
|
+
const IV = shared3.ctx.iv;
|
|
34670
34742
|
ivRoomLight(IV, roomId, !S.ef);
|
|
34671
34743
|
const ef = ivRoomEffective(IV, S);
|
|
34672
34744
|
if (ef !== S.ef) {
|
|
@@ -34676,15 +34748,15 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
34676
34748
|
}
|
|
34677
34749
|
return;
|
|
34678
34750
|
}
|
|
34679
|
-
|
|
34751
|
+
shared3.partState.set("light:" + roomId, !lightOn(roomId));
|
|
34680
34752
|
applyLight(roomId);
|
|
34681
34753
|
if (cfg.onLight) cfg.onLight(roomId, lightOn(roomId));
|
|
34682
34754
|
}
|
|
34683
34755
|
const defined = { newInteractiveState, MESSAGE_MS, createInteractiveMaterials, _EY, _UM3, hudMessage, definePiece, localOf, visibleChain, assembleInteractive, applyPiece, DURATION, animateInteractive, togglePiece, lightBase, lightOn, applyLight, toggleLight };
|
|
34684
34756
|
Object.assign(K, defined);
|
|
34685
34757
|
}
|
|
34686
|
-
function installInteractionCollision(K,
|
|
34687
|
-
const inter = () =>
|
|
34758
|
+
function installInteractionCollision(K, shared3) {
|
|
34759
|
+
const inter = () => shared3.inter;
|
|
34688
34760
|
const NO_COLLIDE = /(^|_)(rug|floor|concrete|dirt|lawn|deck|ceiling_light|pendant|chandelier|spot|picture|curtain|blinds|wall_shelving|plank_shelf|wall_ac|ac_condenser|pool|soaking_tub|pergola|stairs|mirror)/;
|
|
34689
34761
|
function registerCollision(m, M) {
|
|
34690
34762
|
const h = m.h || 0, y = M.y || 0;
|
|
@@ -34712,7 +34784,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
34712
34784
|
function collideAt(x, z, floor2, opt) {
|
|
34713
34785
|
opt = opt || {};
|
|
34714
34786
|
const R = opt.radius != null ? opt.radius : 0.24;
|
|
34715
|
-
for (const c of
|
|
34787
|
+
for (const c of shared3.ctx.colliders) {
|
|
34716
34788
|
if (c.off) continue;
|
|
34717
34789
|
if (c.f !== -1 && c.f !== floor2) continue;
|
|
34718
34790
|
if (c.f === -1 && floor2 !== 0) continue;
|
|
@@ -34725,12 +34797,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
34725
34797
|
const defined = { NO_COLLIDE, registerCollision, objectDistance, collideObject, collideAt };
|
|
34726
34798
|
Object.assign(K, defined);
|
|
34727
34799
|
}
|
|
34728
|
-
function installInteractionItems(K,
|
|
34800
|
+
function installInteractionItems(K, shared3) {
|
|
34729
34801
|
const { t, LIGHTS, cursor, definePiece, localOf, registerCollision, togglePiece } = K;
|
|
34730
34802
|
const DOOR_ITEM = /^(tv_unit|tv_unit_small|tv_unit_large|sideboard|china_cabinet|filing_cabinet|pantry|laundry_cabinet|wardrobe|wardrobe_small|wardrobe_large|closet_wardrobe|kitchen_cabinet|kitchen_cabinet_large|kitchen_cabinet_small|fridge|fridge_large|display_fridge_medium|display_fridge)$/;
|
|
34731
34803
|
const DRAWER_ITEM = /^(console_table|dresser|nightstand|vanity_table)$/;
|
|
34732
34804
|
const LIGHT_TYPES = /* @__PURE__ */ new Set(["ceiling_light", "pendant", "chandelier", "track_spot", "hanging_plant"]);
|
|
34733
|
-
const I = () =>
|
|
34805
|
+
const I = () => shared3.inter;
|
|
34734
34806
|
function objectName(type, drawer) {
|
|
34735
34807
|
return drawer ? "drawer" : /^wardrobe/.test(type) ? "wardrobe" : /fridge|refrig|freezer/.test(type) ? "fridge" : /pantry/.test(type) ? "pantry" : "cabinet";
|
|
34736
34808
|
}
|
|
@@ -34751,7 +34823,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
34751
34823
|
}
|
|
34752
34824
|
function lightItem(m, M, ent, api, parent) {
|
|
34753
34825
|
M.on = M.light = M.lit = true;
|
|
34754
|
-
const n0 = LIGHTS.length, name =
|
|
34826
|
+
const n0 = LIGHTS.length, name = shared3.quality === "game" ? "ix:light:" + m.room + "@" + parent : "ix:light:" + m.id;
|
|
34755
34827
|
cursor.group = name;
|
|
34756
34828
|
try {
|
|
34757
34829
|
ent.f(M, api);
|
|
@@ -34793,7 +34865,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
34793
34865
|
const al = first.target > 0.5 ? 0 : 1;
|
|
34794
34866
|
for (const p of parts) {
|
|
34795
34867
|
p.target = al;
|
|
34796
|
-
|
|
34868
|
+
shared3.partState.set(p.name, al);
|
|
34797
34869
|
I().anim.add(p);
|
|
34798
34870
|
}
|
|
34799
34871
|
} });
|
|
@@ -34883,10 +34955,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
34883
34955
|
const defined = { DOOR_ITEM, DRAWER_ITEM, LIGHT_TYPES, objectName, recordApi, buildItem: buildItem2, lightItem, curtainItem, furnitureItem };
|
|
34884
34956
|
Object.assign(K, defined);
|
|
34885
34957
|
}
|
|
34886
|
-
function installInteractionFittings(K,
|
|
34958
|
+
function installInteractionFittings(K, shared3) {
|
|
34887
34959
|
const { t, EPS: EPS6, OPEN_AREA, Y0, applyPiece, bx, cursor, definePiece, gates, lightOn, roomAt, slideDirection, toggleLight, togglePiece } = K;
|
|
34888
|
-
const I = () =>
|
|
34889
|
-
const house = () =>
|
|
34960
|
+
const I = () => shared3.inter;
|
|
34961
|
+
const house = () => shared3.ctx.r;
|
|
34890
34962
|
function gatesInteractive() {
|
|
34891
34963
|
const lt2 = house().lot;
|
|
34892
34964
|
if (!lt2) return;
|
|
@@ -34910,7 +34982,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
34910
34982
|
}
|
|
34911
34983
|
orig(mat, x0, y0, z0, x1, y1, z1, color2);
|
|
34912
34984
|
});
|
|
34913
|
-
const colliders =
|
|
34985
|
+
const colliders = shared3.ctx.colliders, n0 = colliders.length;
|
|
34914
34986
|
try {
|
|
34915
34987
|
gs.forEach((g) => {
|
|
34916
34988
|
g.open = false;
|
|
@@ -34937,7 +35009,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
34937
35009
|
function mailboxInteractive() {
|
|
34938
35010
|
for (const m of house().items) {
|
|
34939
35011
|
if (m.type !== "mailbox") continue;
|
|
34940
|
-
const g =
|
|
35012
|
+
const g = shared3.ctx.parts && shared3.ctx.parts["mailbox_" + m.id];
|
|
34941
35013
|
if (!g) continue;
|
|
34942
35014
|
const name = "ix:correio:" + m.id, def = definePiece(name, { kind: "part", pivot: [0, 0, 0], ry: 0, parent: "lot" });
|
|
34943
35015
|
def.inner = g;
|
|
@@ -34949,7 +35021,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
34949
35021
|
function placeSwitches() {
|
|
34950
35022
|
const R = house(), used = /* @__PURE__ */ new Set();
|
|
34951
35023
|
for (const c of R.rooms) {
|
|
34952
|
-
if (c.type === "void" || OPEN_AREA(c) || !I().litRooms.has(c.id) || used.has(c.id) ||
|
|
35024
|
+
if (c.type === "void" || OPEN_AREA(c) || !I().litRooms.has(c.id) || used.has(c.id) || shared3.ctx.iv && shared3.ctx.iv.switchRooms.has(c.id)) continue;
|
|
34953
35025
|
const doors = R.doors.filter((p) => p.floor === c.floor && (p.a === c.id || p.b === c.id));
|
|
34954
35026
|
doors.sort((p, q) => ((q.exterior ? 1 : 0) - (p.exterior ? 1 : 0)) * (c.type === "living" ? 1 : -1));
|
|
34955
35027
|
for (const p of doors) if (putSwitch(c, p)) {
|
|
@@ -34994,11 +35066,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
34994
35066
|
const defined = { gatesInteractive, mailboxInteractive, placeSwitches, putSwitch };
|
|
34995
35067
|
Object.assign(K, defined);
|
|
34996
35068
|
}
|
|
34997
|
-
function installInteractionDoors(K,
|
|
35069
|
+
function installInteractionDoors(K, shared3) {
|
|
34998
35070
|
const { t, colliderChanged, invalidateShadow, applyPiece, hudMessage } = K;
|
|
34999
|
-
const leaves = () =>
|
|
35071
|
+
const leaves = () => shared3.ctx.leaves;
|
|
35000
35072
|
function linkDoorLeaves() {
|
|
35001
|
-
const I =
|
|
35073
|
+
const I = shared3.inter;
|
|
35002
35074
|
for (const fo of leaves()) fo.handles = (fo.handleNames || []).map((n) => I.defs.get(n)).filter((d) => !!d);
|
|
35003
35075
|
}
|
|
35004
35076
|
function handleApply(fo) {
|
|
@@ -35012,7 +35084,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
35012
35084
|
const col = fo.col;
|
|
35013
35085
|
if (fo.phase === "handle" || fo.phase === "swing") {
|
|
35014
35086
|
fo.open = !fo.open;
|
|
35015
|
-
|
|
35087
|
+
shared3.doorState.set(fo.id, fo.open);
|
|
35016
35088
|
col.off = fo.open;
|
|
35017
35089
|
colliderChanged(col);
|
|
35018
35090
|
fo.anim = true;
|
|
@@ -35022,23 +35094,23 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
35022
35094
|
if (fo.blockedFlag || fo.locked) {
|
|
35023
35095
|
fo.phase = "rattle";
|
|
35024
35096
|
fo.jig = 0.7;
|
|
35025
|
-
|
|
35097
|
+
shared3.ctx.animateDoorsOn = true;
|
|
35026
35098
|
hudMessage(t(fo.blockedFlag ? "message.boarded" : "message.locked"));
|
|
35027
35099
|
return;
|
|
35028
35100
|
}
|
|
35029
35101
|
fo.open = !fo.open;
|
|
35030
|
-
|
|
35102
|
+
shared3.doorState.set(fo.id, fo.open);
|
|
35031
35103
|
col.off = fo.open;
|
|
35032
35104
|
colliderChanged(col);
|
|
35033
35105
|
fo.anim = true;
|
|
35034
|
-
|
|
35106
|
+
shared3.ctx.animateDoorsOn = true;
|
|
35035
35107
|
if (fo.handles && fo.handles.length) {
|
|
35036
35108
|
fo.phase = "handle";
|
|
35037
35109
|
fo.hT = fo.hT || 0;
|
|
35038
35110
|
} else fo.phase = "swing";
|
|
35039
35111
|
}
|
|
35040
35112
|
function animateDoors(dt) {
|
|
35041
|
-
if (!
|
|
35113
|
+
if (!shared3.ctx.animateDoorsOn) return;
|
|
35042
35114
|
let active = false;
|
|
35043
35115
|
for (const fo of leaves()) {
|
|
35044
35116
|
if (!fo.phase) continue;
|
|
@@ -35070,11 +35142,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
35070
35142
|
}
|
|
35071
35143
|
}
|
|
35072
35144
|
}
|
|
35073
|
-
|
|
35145
|
+
shared3.ctx.animateDoorsOn = active;
|
|
35074
35146
|
invalidateShadow();
|
|
35075
35147
|
}
|
|
35076
35148
|
function wallBlocks(ex, ez, ax, az, floor2) {
|
|
35077
|
-
const n =
|
|
35149
|
+
const n = shared3.ctx.wallColliders != null ? shared3.ctx.wallColliders : 0, colliders = shared3.ctx.colliders;
|
|
35078
35150
|
for (let i = 0; i < n; i++) {
|
|
35079
35151
|
const c = colliders[i];
|
|
35080
35152
|
if (c.f !== floor2 && !(c.f === -1 && floor2 === 0)) continue;
|
|
@@ -35109,19 +35181,19 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
35109
35181
|
const defined = { linkDoorLeaves, handleApply, toggleDoor, animateDoors, wallBlocks, doorText, applyLeaf };
|
|
35110
35182
|
Object.assign(K, defined);
|
|
35111
35183
|
}
|
|
35112
|
-
function installInteractionTarget(K,
|
|
35184
|
+
function installInteractionTarget(K, shared3) {
|
|
35113
35185
|
const { doorText, toggleDoor, visibleChain, wallBlocks } = K;
|
|
35114
35186
|
const ivTarget = (...a) => K.ivTarget(...a);
|
|
35115
35187
|
function targetOf(o, opt) {
|
|
35116
35188
|
if (!o) return null;
|
|
35117
35189
|
opt = opt || {};
|
|
35118
|
-
const I =
|
|
35190
|
+
const I = shared3.inter;
|
|
35119
35191
|
const ex = o.x, ey = o.y, ez = o.z, floor2 = o.floor, cp = Math.cos(o.pitch || 0), vx2 = Math.sin(o.yaw) * cp, vy2 = Math.sin(o.pitch || 0), vz2 = Math.cos(o.yaw) * cp;
|
|
35120
35192
|
let best = null;
|
|
35121
35193
|
const tries = (score, text, action, target) => {
|
|
35122
35194
|
if (!best || score < best.score) best = { score, text, action, target };
|
|
35123
35195
|
};
|
|
35124
|
-
for (const fo of
|
|
35196
|
+
for (const fo of shared3.ctx.leaves) {
|
|
35125
35197
|
if (fo.floor !== floor2) continue;
|
|
35126
35198
|
const d = Math.hypot(fo.cx - ex, fo.cz - ez);
|
|
35127
35199
|
if (d > 1.7) continue;
|
|
@@ -35130,7 +35202,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
35130
35202
|
tries(angle * 1.6 + d * 0.5 + (angle < 0.25 ? 0 : 0.6), doorText(fo), () => toggleDoor(fo), fo);
|
|
35131
35203
|
}
|
|
35132
35204
|
const vis = I.pieces.flatMap((p) => p.meshes).filter(visibleChain), hit = vis.length && opt.strike ? opt.strike(vis) : null;
|
|
35133
|
-
const kitA =
|
|
35205
|
+
const kitA = shared3.ctx.iv ? ivTarget(shared3.ctx.iv, o, opt && opt.interactives) : null;
|
|
35134
35206
|
const nearKit = kitA && hit && Math.hypot(kitA.target.pos[0] - ex, kitA.target.pos[1] - ey, kitA.target.pos[2] - ez) < hit.distance + 0.1;
|
|
35135
35207
|
const pieceHit = hit && !nearKit && hit.object.userData.piece;
|
|
35136
35208
|
for (const it of I.items) {
|
|
@@ -35149,14 +35221,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
35149
35221
|
const defined = { targetOf };
|
|
35150
35222
|
Object.assign(K, defined);
|
|
35151
35223
|
}
|
|
35152
|
-
function installInteractablesBridge(K,
|
|
35224
|
+
function installInteractablesBridge(K, shared3) {
|
|
35153
35225
|
const { t, THREE, invalidate, invalidateShadow, cfg, DOC, LIGHT_TYPES, _Y, _q, _v3, accFor, applyLight, cursor, hashString, hudMessage, lightBase, pieceRecord, put, rgbOf, sh, wallBlocks } = K;
|
|
35154
35226
|
const enter = (...a) => K.enter(...a);
|
|
35155
35227
|
const roomLightMask = (...a) => K.roomLightMask(...a);
|
|
35156
35228
|
const IV_MATERIAL = { plain: "plain", metal: "metal", wood: "wood", glass: "glass", fabric: "fabric", plant: "plant", water: "water", emissive: "emissive", atlas_picture: "picture", atlas_floor: "floor" };
|
|
35157
35229
|
const IV_WIRE = { conduit: 13618628, cable: 2762532, drop: 1381653, cord: 1776413, earth: 3111482, hose: 11556124 };
|
|
35158
35230
|
const IV_DOOR = /^(door|drawer)/;
|
|
35159
|
-
const ivGroup = (e) => e.floor < 0 ? "lot" : "f" + Math.min(e.floor,
|
|
35231
|
+
const ivGroup = (e) => e.floor < 0 ? "lot" : "f" + Math.min(e.floor, shared3.ctx.r.floors.length - 1);
|
|
35160
35232
|
function ivAccumulate(mat, g, ox, oy, oz, ry, color2) {
|
|
35161
35233
|
const P = g.attributes.position, N = g.attributes.normal, C = color2 == null ? g.attributes.color : null, U = g.attributes.uv, I = g.index, nv = P.count, ni = I ? I.count : nv;
|
|
35162
35234
|
const A = accFor(mat);
|
|
@@ -35200,7 +35272,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
35200
35272
|
A.ni += ni;
|
|
35201
35273
|
}
|
|
35202
35274
|
function ivBuild(h, water) {
|
|
35203
|
-
const ik = K.IVK, r =
|
|
35275
|
+
const ik = K.IVK, r = shared3.ctx.r, A = ik.A, world0 = null;
|
|
35204
35276
|
void world0;
|
|
35205
35277
|
const source = r;
|
|
35206
35278
|
const plane2 = A.plan(source, { seed: r.seed });
|
|
@@ -35222,8 +35294,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
35222
35294
|
const wants = (roomId) => lightBase(roomId);
|
|
35223
35295
|
const entById = new Map(plane2.items.map((e) => [e.id, e]));
|
|
35224
35296
|
const entByItem = new Map(plane2.items.map((e) => [e.item, e]));
|
|
35225
|
-
const mats =
|
|
35226
|
-
IV.mats = { plain: mats.plain, metal:
|
|
35297
|
+
const mats = shared3.mats;
|
|
35298
|
+
IV.mats = { plain: mats.plain, metal: shared3.mats.metal, wood: shared3.mats.wood, glass: shared3.mats.glass, fabric: shared3.mats.fabric, plant: shared3.mats.plant, water: shared3.mats.water, emissive: shared3.mats.emissive, atlas_picture: shared3.mats.picture, atlas_floor: shared3.mats.floor };
|
|
35227
35299
|
const ev = (e) => ivEvent(h, e);
|
|
35228
35300
|
const world = IV.world = A.createWorld(source, { water, seed: r.seed, onEvent: ev });
|
|
35229
35301
|
const add0 = world.add;
|
|
@@ -35231,7 +35303,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
35231
35303
|
const e = entById.get(id);
|
|
35232
35304
|
if (e && e.type === "lamp") {
|
|
35233
35305
|
const roomId = IV.lampRoom.get(id);
|
|
35234
|
-
spec.devices[0].on = roomId ? wants(roomId) : !!
|
|
35306
|
+
spec.devices[0].on = roomId ? wants(roomId) : !!shared3.ctx.night;
|
|
35235
35307
|
spec.parts = (spec.parts || []).concat([{ id: "_x", pivot: [0, 0, 0], motion: { kind: "slide", axis: [0, 1, 0], distance: 1e-3 }, label: "" }]);
|
|
35236
35308
|
spec.interactions = [{ id: "device.lamp", pos: [0, 0, 0], action: { do: "toggle_device", device: "lamp" }, label: "", requires: { object: id, part: "_x" } }];
|
|
35237
35309
|
} else if (e && e.type === "wall_switch") {
|
|
@@ -35257,7 +35329,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
35257
35329
|
}
|
|
35258
35330
|
if (e.type === "lamp" && o.devices && o.devices.lamp) {
|
|
35259
35331
|
const roomId = IV.lampRoom.get(id);
|
|
35260
|
-
o.devices.lamp.on = roomId ? wants(roomId) : !!
|
|
35332
|
+
o.devices.lamp.on = roomId ? wants(roomId) : !!shared3.ctx.night;
|
|
35261
35333
|
} else if (e.type === "wall_switch" && o.parts && o.parts.rocker !== void 0) {
|
|
35262
35334
|
const l = (e.connections.controls || [])[0], roomId = l && IV.lampRoom.get(l);
|
|
35263
35335
|
if (roomId) o.parts.rocker = wants(roomId) ? 1 : 0;
|
|
@@ -35350,7 +35422,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
35350
35422
|
const ik = IV.k, w = IV.world, wl = (o, p) => ik.GI.localToWorld(o.transform, p), g0 = cursor.group;
|
|
35351
35423
|
const tube2 = (pts, radius, color2, ox, oy, oz, ry) => {
|
|
35352
35424
|
try {
|
|
35353
|
-
const m = ik.gfx.createCord(pts, radius,
|
|
35425
|
+
const m = ik.gfx.createCord(pts, radius, shared3.mats.plain);
|
|
35354
35426
|
ivAccumulate("plain", m.geometry, ox, oy, oz, ry, color2);
|
|
35355
35427
|
m.geometry.dispose();
|
|
35356
35428
|
} catch (e) {
|
|
@@ -35393,7 +35465,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
35393
35465
|
for (const E of IV.roots) {
|
|
35394
35466
|
(gs[E.group] || (gs[E.group] = new THREE.Group())).add(E.root);
|
|
35395
35467
|
}
|
|
35396
|
-
for (const [roomId] of IV.roomStates) if (!
|
|
35468
|
+
for (const [roomId] of IV.roomStates) if (!shared3.inter.litRooms.has(roomId)) IV.roomStates.delete(roomId);
|
|
35397
35469
|
for (const E of IV.entries.values()) if (E.parts && Object.keys(E.parts).length) IV.k.gfx.syncObject(IV.world, E.id, E.parts, { time: 0 });
|
|
35398
35470
|
for (const E of IV.entries.values()) if (E.screen) ivScreen(IV, E);
|
|
35399
35471
|
}
|
|
@@ -35425,7 +35497,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
35425
35497
|
break;
|
|
35426
35498
|
case "device": {
|
|
35427
35499
|
const roomId = IV.lampRoom.get(e.object);
|
|
35428
|
-
if (roomId)
|
|
35500
|
+
if (roomId) shared3.partState.set("light:" + roomId, !!e.on);
|
|
35429
35501
|
invalidate();
|
|
35430
35502
|
break;
|
|
35431
35503
|
}
|
|
@@ -35581,7 +35653,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
35581
35653
|
gm.setIndex(new THREE.BufferAttribute(A.i.slice(0, A.ni), 1));
|
|
35582
35654
|
gm.computeBoundingSphere();
|
|
35583
35655
|
if (!IV.items) {
|
|
35584
|
-
const mesh3 = new THREE.Mesh(gm,
|
|
35656
|
+
const mesh3 = new THREE.Mesh(gm, shared3.mats.plain);
|
|
35585
35657
|
IV.items = mesh3;
|
|
35586
35658
|
mesh3.name = "iv-items";
|
|
35587
35659
|
mesh3.castShadow = false;
|
|
@@ -35724,17 +35796,17 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
35724
35796
|
const defined = { IV_MATERIAL, IV_WIRE, IV_DOOR, ivGroup, ivAccumulate, ivBuild, ivRoomEffective, ivDraw, ivCords, ivAssemble, ivScreen, ivEvent, ivSeat, ivUpdate, IV_SHAPE, ivItems, ivTarget, ivRoomLight, ivParts, ivDispose, ivPublish };
|
|
35725
35797
|
Object.assign(K, defined);
|
|
35726
35798
|
}
|
|
35727
|
-
function installAnimationClotheslines(K,
|
|
35799
|
+
function installAnimationClotheslines(K, shared3) {
|
|
35728
35800
|
const { invalidate, CLOTHES_UNIFORMS } = K;
|
|
35729
35801
|
const WIND = { t0: performance.now(), last: 0, base: 0.55 };
|
|
35730
35802
|
function animateClotheslines(now) {
|
|
35731
|
-
if (!
|
|
35803
|
+
if (!shared3.ctx.clotheslines || !shared3.ctx.clotheslines.length) return;
|
|
35732
35804
|
if (now - WIND.last < 33) return;
|
|
35733
35805
|
WIND.last = now;
|
|
35734
35806
|
const t = (now - WIND.t0) / 1e3;
|
|
35735
35807
|
CLOTHES_UNIFORMS.uTime.value = t;
|
|
35736
35808
|
CLOTHES_UNIFORMS.uVento.value = WIND.base + 0.45 * Math.sin(t * 0.23) * Math.sin(t * 0.11 + 1.3) + 0.25 * Math.max(0, Math.sin(t * 0.57));
|
|
35737
|
-
const g =
|
|
35809
|
+
const g = shared3.ctx.parts && shared3.ctx.parts["laundry_" + shared3.ctx.clotheslines[0]];
|
|
35738
35810
|
if (g) {
|
|
35739
35811
|
let vis = true;
|
|
35740
35812
|
for (let n = g; n; n = n.parent) if (!n.visible) {
|
|
@@ -35748,31 +35820,31 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
35748
35820
|
const defined = { WIND, animateClotheslines };
|
|
35749
35821
|
Object.assign(K, defined);
|
|
35750
35822
|
}
|
|
35751
|
-
function installBuildInstance(K,
|
|
35823
|
+
function installBuildInstance(K, shared3) {
|
|
35752
35824
|
const { PROPS, THREE, DOC, cfg, HP, createInteractiveMaterials, createMaterials: createMaterials2, typeTable } = K;
|
|
35753
35825
|
const props = PROPS.create(THREE, { document: DOC, emit: () => {
|
|
35754
35826
|
} });
|
|
35755
35827
|
const TYPES = typeTable(props);
|
|
35756
|
-
|
|
35757
|
-
createInteractiveMaterials(
|
|
35828
|
+
shared3.mats = createMaterials2(props);
|
|
35829
|
+
createInteractiveMaterials(shared3.mats);
|
|
35758
35830
|
if (cfg.materials) for (const k of Object.keys(cfg.materials)) {
|
|
35759
35831
|
const v = cfg.materials[k];
|
|
35760
|
-
|
|
35832
|
+
shared3.mats[k] = typeof v === "function" ? v(shared3.mats[k], k) || shared3.mats[k] : v;
|
|
35761
35833
|
}
|
|
35762
35834
|
const newState = () => ({ doors: /* @__PURE__ */ new Map(), inter: /* @__PURE__ */ new Map(), water: null, iv: null });
|
|
35763
35835
|
function enter(h) {
|
|
35764
|
-
|
|
35765
|
-
|
|
35766
|
-
|
|
35767
|
-
|
|
35768
|
-
|
|
35769
|
-
|
|
35836
|
+
shared3.ctx = h.ctx;
|
|
35837
|
+
shared3.inter = h.inter;
|
|
35838
|
+
shared3.doorState = h.state.doors;
|
|
35839
|
+
shared3.partState = h.state.inter;
|
|
35840
|
+
shared3.mirrors = h.mirrors;
|
|
35841
|
+
shared3.quality = h.quality;
|
|
35770
35842
|
}
|
|
35771
35843
|
const tagDamage = (type) => ({ type, hp: HP[type], hpMax: HP[type] });
|
|
35772
35844
|
const defined = { props, TYPES, newState, enter, tagDamage };
|
|
35773
35845
|
Object.assign(K, defined);
|
|
35774
35846
|
}
|
|
35775
|
-
function installInteractablesKit(K,
|
|
35847
|
+
function installInteractablesKit(K, shared3) {
|
|
35776
35848
|
const { t, THREE, DOC, cfg, Reflector } = K;
|
|
35777
35849
|
const roomLightMask = (...a) => K.roomLightMask(...a);
|
|
35778
35850
|
const IVK = (() => {
|
|
@@ -35790,8 +35862,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
35790
35862
|
const l = cfg.vegetation || null, G = l && (l.GameVegetation || (l.buildLot ? l : null)), S = l && (l.GameVegetationSpecies || (l.toSpec ? l : null));
|
|
35791
35863
|
return G && S && G.buildLot && S.toSpec ? { G, S } : null;
|
|
35792
35864
|
})();
|
|
35793
|
-
|
|
35794
|
-
const vegMaterials = () =>
|
|
35865
|
+
shared3.vegMaterials = null;
|
|
35866
|
+
const vegMaterials = () => shared3.vegMaterials || (shared3.vegMaterials = (() => {
|
|
35795
35867
|
const m = VEG.G.createVegetationMaterials(THREE);
|
|
35796
35868
|
for (const k of ["wood", "foliage", "flowers", "fruit", "spines"]) roomLightMask(m[k]);
|
|
35797
35869
|
return m;
|
|
@@ -35800,7 +35872,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
35800
35872
|
Object.assign(K, defined);
|
|
35801
35873
|
}
|
|
35802
35874
|
var newGroup = (k, house, exterior) => ({ k, house, ls: [], exterior, pos: [0, 0, 0], color: 0, n: 0, range: 0, rects: [], y: [0, 0], exclusion: null, lumens: 0, dist: 0, decay: 0, floor: 0, roomId: null, dm: 0, d: 0 });
|
|
35803
|
-
function installLightsRoomLight(K,
|
|
35875
|
+
function installLightsRoomLight(K, shared3) {
|
|
35804
35876
|
const { THREE, rectsOf: rectsOf2, cfg } = K;
|
|
35805
35877
|
const MAX_LIGHTS = 12, EMPTY = [1e9, 1e9, -1e9, -1e9];
|
|
35806
35878
|
const LZU = { uRB0: { value: new Float32Array(MAX_LIGHTS * 4) }, uRB1: { value: new Float32Array(MAX_LIGHTS * 4) }, uRB2: { value: new Float32Array(MAX_LIGHTS * 4) }, uRBY: { value: new Float32Array(MAX_LIGHTS * 2) }, uREx: { value: new Float32Array(MAX_LIGHTS * 4) }, uIndK: { value: 0.06 } };
|
|
@@ -35840,7 +35912,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
35840
35912
|
function lighting(options) {
|
|
35841
35913
|
const o = options || {};
|
|
35842
35914
|
const scene = o.scene, N = Math.max(1, Math.min(MAX_LIGHTS, o.n || 6)), NS = Math.max(0, Math.min(N, o.shadows != null ? o.shadows : 2)), size = o.shadowSize || 512, MAX_EXTERNAL = o.external != null ? o.external : 2;
|
|
35843
|
-
const mats =
|
|
35915
|
+
const mats = shared3.mats;
|
|
35844
35916
|
for (const k of Object.keys(mats)) roomLightMask(mats[k]);
|
|
35845
35917
|
const budget = o.budget, lease = budget ? budget.lease({ owner: "floorplan.rooms", point: N, shadows: NS }) : null;
|
|
35846
35918
|
if (budget && !lease) throw new Error("lighting: the LightBudget has no " + N + " free point slots (" + NS + " with shadow) for the rooms");
|
|
@@ -36166,9 +36238,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
36166
36238
|
}
|
|
36167
36239
|
return view;
|
|
36168
36240
|
}
|
|
36169
|
-
function installDestructionPieces(K,
|
|
36241
|
+
function installDestructionPieces(K, shared3) {
|
|
36170
36242
|
const { THREE, floorAtY, pieceRecord } = K;
|
|
36171
|
-
|
|
36243
|
+
shared3.destructionSeq = 0;
|
|
36172
36244
|
const FRAGMENT_COLOR = { brick: 11031866, concrete: 10132118, plaster: 14210248, ceramic: 11821630, glass: 11456472, tempered_glass: 11456472, wood_soft: 11569752, wood_hard: 8016948, plywood: 12098154, mdf: 12098154, steel: 9080466, aluminium: 12106944, plastic: 3107496, copper: 12088115, stone: 9079428, fabric: 13616296 };
|
|
36173
36245
|
const FRAGMENT_GEO = new THREE.BoxGeometry(1, 1, 1), FRAGMENT_MAT = {};
|
|
36174
36246
|
const fragmentMaterial = (m) => FRAGMENT_MAT[m] || (FRAGMENT_MAT[m] = new THREE.MeshLambertMaterial({ color: FRAGMENT_COLOR[m] != null ? FRAGMENT_COLOR[m] : 9079428 }));
|
|
@@ -36177,7 +36249,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
36177
36249
|
objs = objs.filter(Boolean);
|
|
36178
36250
|
if (!objs.length) return;
|
|
36179
36251
|
const pc = pieceRecord(id, mat, role, extra);
|
|
36180
|
-
|
|
36252
|
+
shared3.ctx.pieceObjects.set(id, objs);
|
|
36181
36253
|
for (const o of objs) o.traverse((m) => {
|
|
36182
36254
|
if (!m.isMesh) return;
|
|
36183
36255
|
const u = m.userData;
|
|
@@ -36188,22 +36260,22 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
36188
36260
|
if (pc.explodes) u.destructionExplodes = pc.explodes;
|
|
36189
36261
|
});
|
|
36190
36262
|
};
|
|
36191
|
-
for (const fo of
|
|
36263
|
+
for (const fo of shared3.ctx.leaves) {
|
|
36192
36264
|
const pr = r.doors.find((p) => p.id === fo.id);
|
|
36193
36265
|
tagObject("door:" + fo.id, fo.gs, fo.type === "steel" ? "steel" : pr && pr.exterior ? "wood_hard" : "mdf", null, { floor: fo.floor, mass: fo.type === "steel" ? 60 : 18, tags: ["door"] });
|
|
36194
36266
|
}
|
|
36195
36267
|
const cap = r.utilities.plumbing ? +r.utilities.plumbing.capacityL || 0 : 0;
|
|
36196
|
-
for (const [id, g] of Object.entries(
|
|
36268
|
+
for (const [id, g] of Object.entries(shared3.ctx.parts || {})) {
|
|
36197
36269
|
const tp = g.userData.part;
|
|
36198
36270
|
if (tp === "water_tank") {
|
|
36199
|
-
const e =
|
|
36271
|
+
const e = shared3.ctx.structureIndex.water_tank, L = cap || (g.userData.volume ? Math.round(g.userData.volume * 1e3) : 0);
|
|
36200
36272
|
tagObject("water_tank", [g], "plastic", e ? e.role : null, { floor: e ? e.floor : 0, contains: L ? { fluid: "water", liters: L } : void 0, mass: e ? e.mass : 25, thickness: 4e-3, fill: 0.05, tags: ["tank"] });
|
|
36201
36273
|
} else if (tp === "gas_cylinder") tagObject(id, [g], "steel", null, { mass: 11, form: "cylinder", thickness: 3e-3, fill: 0.03, contains: { fluid: "gas", liters: 13, pressurized: true }, explodes: { energy: 12e4, radius: 5, atC: 300 }, tags: ["gas_bottle"] });
|
|
36202
36274
|
else if (tp === "wall_pipe") tagObject(id, [g], "plastic", null, { mass: 3, tags: ["pipe"] });
|
|
36203
36275
|
else if (tp === "shower_door") tagObject(id, [g], "tempered_glass", null, { mass: 25 });
|
|
36204
36276
|
else if (tp === "gate_leaf" || tp === "mailbox_door") tagObject(id, [g], "steel", null, { mass: 30 });
|
|
36205
36277
|
}
|
|
36206
|
-
for (const def of
|
|
36278
|
+
for (const def of shared3.inter.defs.values()) {
|
|
36207
36279
|
if (!def.outer) continue;
|
|
36208
36280
|
if (/^gate/.test(def.kind)) tagObject(def.name, [def.outer], "steel", null, { mass: 80, tags: ["gate"] });
|
|
36209
36281
|
else if (def.kind === "swing" || def.kind === "drawer") tagObject(def.name, [def.outer], "mdf", null, { mass: 6 });
|
|
@@ -36223,13 +36295,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
36223
36295
|
for (const f of o.userData.ranges) add2(f.id, { mesh: o, v0: f.v0, v1: f.v1, i0: f.i0, i1: f.i1, whole: f.v0 === 0 && f.v1 === nv });
|
|
36224
36296
|
}
|
|
36225
36297
|
});
|
|
36226
|
-
for (const [id, objs] of
|
|
36298
|
+
for (const [id, objs] of shared3.ctx.pieceObjects) for (const o of objs) add2(id, { obj: o });
|
|
36227
36299
|
const box32 = (id) => {
|
|
36228
36300
|
const b = new THREE.Box3(), v = new THREE.Vector3();
|
|
36229
36301
|
for (const it of meshes.get(id) || []) {
|
|
36230
36302
|
if (it.obj) {
|
|
36231
36303
|
const bb = new THREE.Box3().setFromObject(it.obj);
|
|
36232
|
-
if (!bb.isEmpty()) for (const x of [bb.min.x, bb.max.x]) for (const y of [bb.min.y, bb.max.y]) for (const z of [bb.min.z, bb.max.z]) b.expandByPoint(v.set(x, y, z).applyMatrix4(
|
|
36304
|
+
if (!bb.isEmpty()) for (const x of [bb.min.x, bb.max.x]) for (const y of [bb.min.y, bb.max.y]) for (const z of [bb.min.z, bb.max.z]) b.expandByPoint(v.set(x, y, z).applyMatrix4(shared3.ctx.unitInverse));
|
|
36233
36305
|
} else {
|
|
36234
36306
|
const P = it.mesh.geometry.attributes.position.array;
|
|
36235
36307
|
for (let k = it.v0; k < it.v1; k++) b.expandByPoint(v.set(P[k * 3], P[k * 3 + 1], P[k * 3 + 2]));
|
|
@@ -36239,15 +36311,15 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
36239
36311
|
};
|
|
36240
36312
|
const parts = [], byId = /* @__PURE__ */ new Map(), supports = E0.supports.map((a) => Object.assign({}, a));
|
|
36241
36313
|
for (const e of E0.parts) {
|
|
36242
|
-
const p = Object.assign({}, e, { meshes: (meshes.get(e.id) || []).length, extra: false }), pc =
|
|
36314
|
+
const p = Object.assign({}, e, { meshes: (meshes.get(e.id) || []).length, extra: false }), pc = shared3.ctx.pieces.get(e.id);
|
|
36243
36315
|
if (pc) {
|
|
36244
36316
|
for (const k of ["contains", "explodes", "tags", "form", "thickness", "fill"]) if (pc[k] != null && p[k] == null) p[k] = pc[k];
|
|
36245
36317
|
}
|
|
36246
36318
|
parts.push(p);
|
|
36247
36319
|
byId.set(p.id, p);
|
|
36248
36320
|
}
|
|
36249
|
-
const base = parts.length, view =
|
|
36250
|
-
for (const [id, pc] of
|
|
36321
|
+
const base = parts.length, view = shared3.ctx.panelView || panelViewOf(null, false), panelIds = new Set(view.panels.map((e) => e.id));
|
|
36322
|
+
for (const [id, pc] of shared3.ctx.pieces) {
|
|
36251
36323
|
if (byId.has(id) || panelIds.has(id) || !meshes.has(id)) continue;
|
|
36252
36324
|
const b = box32(id);
|
|
36253
36325
|
if (!b) continue;
|
|
@@ -36285,7 +36357,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
36285
36357
|
parts.splice(0, parts.length, ...parts.filter((p) => !gone.has(p.id)));
|
|
36286
36358
|
for (const id of gone) byId.delete(id);
|
|
36287
36359
|
for (const e of view.panels) {
|
|
36288
|
-
const p = Object.assign({}, e, { meshes: (meshes.get(e.id) || []).length, extra: false }), pc =
|
|
36360
|
+
const p = Object.assign({}, e, { meshes: (meshes.get(e.id) || []).length, extra: false }), pc = shared3.ctx.pieces.get(e.id);
|
|
36289
36361
|
if (pc) {
|
|
36290
36362
|
for (const k of ["contains", "explodes", "tags", "form", "thickness", "fill"]) if (pc[k] != null && p[k] == null) p[k] = pc[k];
|
|
36291
36363
|
}
|
|
@@ -36948,7 +37020,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
36948
37020
|
Object.assign(K, { createBreachView, breachPaintQueue: paintQueue });
|
|
36949
37021
|
}
|
|
36950
37022
|
var FOLLOW_FLUSH_FALLBACK_MS = 100;
|
|
36951
|
-
function installDestructionWorld(K,
|
|
37023
|
+
function installDestructionWorld(K, shared3) {
|
|
36952
37024
|
const { THREE, cfg, invalidateShadow, invalidate, rngString, FRAGMENT_GEO, fragmentMaterial, createBreachView } = K;
|
|
36953
37025
|
function createHouseDestruction(root, house, structure, parts, colliders, water) {
|
|
36954
37026
|
const D = { world: cfg.destruction || null, id: null, active: false }, hiddenPieces = /* @__PURE__ */ new Set(), bodies = /* @__PURE__ */ new Map(), frags = [], facets = /* @__PURE__ */ new Map();
|
|
@@ -37184,7 +37256,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
37184
37256
|
house.matrixWorld.decompose(p, q, sc);
|
|
37185
37257
|
D.specOptions = specOptions || null;
|
|
37186
37258
|
D.spec = structure.spec(specOptions);
|
|
37187
|
-
D.id = D.world.add(D.spec, { id: "house3d:" + ++
|
|
37259
|
+
D.id = D.world.add(D.spec, { id: "house3d:" + ++shared3.destructionSeq, position: [p.x, p.y, p.z], rotation: [q.x, q.y, q.z, q.w] });
|
|
37188
37260
|
breach.claim();
|
|
37189
37261
|
if (R) R.bind(D.id, house, { parts: rangesOf(), onFrame: () => breach.flush() });
|
|
37190
37262
|
off = D.world.on("*", handleEvent);
|
|
@@ -37332,7 +37404,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
37332
37404
|
}
|
|
37333
37405
|
Object.assign(K, { createHouseDestruction });
|
|
37334
37406
|
}
|
|
37335
|
-
function installBuildBuild(K,
|
|
37407
|
+
function installBuildBuild(K, shared3) {
|
|
37336
37408
|
const { THREE, cfg, rectsOf: rectsOf2, invalidateShadow, colliderChanged, VERSION: VERSION2, CARS, EPS: EPS6, 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, windows, props, TYPES, IVK, VEG, vegMaterials, markGroups, assembleStructure, createHouseDestruction, newState, enter, tagDamage } = K;
|
|
37337
37409
|
function build(r0, options) {
|
|
37338
37410
|
const opts = options || {};
|
|
@@ -37343,45 +37415,45 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
37343
37415
|
cursor.accs.clear();
|
|
37344
37416
|
LIGHTS.length = 0;
|
|
37345
37417
|
const pr = opts.building || {};
|
|
37346
|
-
|
|
37347
|
-
|
|
37348
|
-
|
|
37349
|
-
|
|
37350
|
-
|
|
37351
|
-
|
|
37352
|
-
|
|
37353
|
-
|
|
37354
|
-
|
|
37355
|
-
for (const c of r.rooms)
|
|
37356
|
-
|
|
37357
|
-
|
|
37358
|
-
|
|
37359
|
-
for (const e of r0.structure?.parts || [])
|
|
37418
|
+
shared3.ctx.r = r;
|
|
37419
|
+
shared3.ctx.colors = r.colors;
|
|
37420
|
+
shared3.ctx.cut = !!opts.cut;
|
|
37421
|
+
shared3.ctx.night = !!opts.night;
|
|
37422
|
+
shared3.ctx.labels = [];
|
|
37423
|
+
shared3.ctx.colliders = [];
|
|
37424
|
+
shared3.ctx.stairs = [];
|
|
37425
|
+
shared3.ctx.noTerrain = opts.terrain === false;
|
|
37426
|
+
shared3.ctx.roomById = {};
|
|
37427
|
+
for (const c of r.rooms) shared3.ctx.roomById[c.id] = c;
|
|
37428
|
+
shared3.ctx.pieces = /* @__PURE__ */ new Map();
|
|
37429
|
+
shared3.ctx.pieceObjects = /* @__PURE__ */ new Map();
|
|
37430
|
+
shared3.ctx.structureIndex = {};
|
|
37431
|
+
for (const e of r0.structure?.parts || []) shared3.ctx.structureIndex[e.id] = e;
|
|
37360
37432
|
{
|
|
37361
|
-
const view =
|
|
37362
|
-
|
|
37363
|
-
for (const id of view.replaced) delete
|
|
37433
|
+
const view = shared3.ctx.panelView = panelViewOf(r0.structure, !!cfg.destruction);
|
|
37434
|
+
shared3.ctx.panelsOf = /* @__PURE__ */ new Map();
|
|
37435
|
+
for (const id of view.replaced) delete shared3.ctx.structureIndex[id];
|
|
37364
37436
|
for (const e of view.panels) {
|
|
37365
|
-
|
|
37366
|
-
const l =
|
|
37437
|
+
shared3.ctx.structureIndex[e.id] = e;
|
|
37438
|
+
const l = shared3.ctx.panelsOf.get(e.slab);
|
|
37367
37439
|
if (l) l.push(e);
|
|
37368
|
-
else
|
|
37440
|
+
else shared3.ctx.panelsOf.set(e.slab, [e]);
|
|
37369
37441
|
}
|
|
37370
37442
|
}
|
|
37371
|
-
|
|
37372
|
-
|
|
37443
|
+
shared3.ctx.panes = r0.roof?.panes || [];
|
|
37444
|
+
shared3.ctx.noPiece = false;
|
|
37373
37445
|
cursor.separate = opts.pieces === "meshes";
|
|
37374
37446
|
cursor.pc = null;
|
|
37375
|
-
|
|
37376
|
-
|
|
37377
|
-
|
|
37378
|
-
|
|
37379
|
-
|
|
37380
|
-
|
|
37381
|
-
|
|
37382
|
-
|
|
37383
|
-
|
|
37384
|
-
|
|
37447
|
+
shared3.ctx.showPillars = opts.pillars !== "hidden";
|
|
37448
|
+
shared3.ctx.baseboardBand = opts.baseboard === "band";
|
|
37449
|
+
shared3.ctx.apartment = r.template === "apartment_modern";
|
|
37450
|
+
shared3.ctx.pa = Math.max(3, Math.min(20, pr.floors != null ? pr.floors : 5));
|
|
37451
|
+
shared3.ctx.pf = Math.max(1, Math.min(shared3.ctx.pa, pr.floor != null ? pr.floor : 3));
|
|
37452
|
+
shared3.ctx.pu = Math.max(0, pr.unit != null ? pr.unit : 0);
|
|
37453
|
+
shared3.ctx.showBuilding = shared3.ctx.apartment && (pr.showIt == null ? true : !!pr.showIt);
|
|
37454
|
+
shared3.ctx.limits = { x0: -2, z0: -2, x1: r.w + 2, z1: r.d + 2 };
|
|
37455
|
+
shared3.ctx.veg = VEG ? { G: VEG.G, S: VEG.S, mats: vegMaterials, groups: /* @__PURE__ */ new Map(), ok: /* @__PURE__ */ new Map(), opts: shared3.quality === "game" ? { quality: "game" } : { quality: "high", lod: 0, triangleBudget: 6e4 } } : null;
|
|
37456
|
+
shared3.ctx.vegInfo = null;
|
|
37385
37457
|
terrain();
|
|
37386
37458
|
if (r.lot) {
|
|
37387
37459
|
if (!opts.noPerimeter) {
|
|
@@ -37392,7 +37464,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
37392
37464
|
}
|
|
37393
37465
|
walls();
|
|
37394
37466
|
baseboardAndSidewalk();
|
|
37395
|
-
|
|
37467
|
+
shared3.ctx.wallColliders = shared3.ctx.colliders.length;
|
|
37396
37468
|
doors();
|
|
37397
37469
|
windows();
|
|
37398
37470
|
floorsAndSlabs();
|
|
@@ -37400,14 +37472,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
37400
37472
|
buildStairs();
|
|
37401
37473
|
elevator();
|
|
37402
37474
|
const water = createWater(r, h.state);
|
|
37403
|
-
|
|
37475
|
+
shared3.ctx.iv = null;
|
|
37404
37476
|
h.IV = null;
|
|
37405
37477
|
if (IVK) {
|
|
37406
37478
|
try {
|
|
37407
|
-
h.IV =
|
|
37479
|
+
h.IV = shared3.ctx.iv = ivBuild(h, water);
|
|
37408
37480
|
} catch (e) {
|
|
37409
37481
|
console.warn("interactables", e);
|
|
37410
|
-
|
|
37482
|
+
shared3.ctx.iv = h.IV = null;
|
|
37411
37483
|
}
|
|
37412
37484
|
}
|
|
37413
37485
|
const noModel = houseItems();
|
|
@@ -37416,14 +37488,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
37416
37488
|
electricalStructure();
|
|
37417
37489
|
roofs();
|
|
37418
37490
|
solar();
|
|
37419
|
-
if (
|
|
37491
|
+
if (shared3.ctx.showBuilding) building();
|
|
37420
37492
|
for (const c of r.rooms) {
|
|
37421
37493
|
if (c.type === "void") continue;
|
|
37422
37494
|
const [a, b, c2, d] = rectsOf2(c)[0];
|
|
37423
|
-
|
|
37495
|
+
shared3.ctx.labels.push({ pos: new THREE.Vector3((a + c2) / 2, Y0(c.floor) + 1.1, (b + d) / 2), text: c.name, group: "f" + c.floor, type: "room", floor: c.floor });
|
|
37424
37496
|
}
|
|
37425
|
-
const mirrorsCopy = MIRRORS.map((E, i) => Object.assign({ i }, E)), gs = closeScene(
|
|
37426
|
-
for (const fo of
|
|
37497
|
+
const mirrorsCopy = MIRRORS.map((E, i) => Object.assign({ i }, E)), gs = closeScene(shared3.mats);
|
|
37498
|
+
for (const fo of shared3.ctx.leaves) {
|
|
37427
37499
|
const parent = gs["f" + fo.floor] || (gs["f" + fo.floor] = new THREE.Group());
|
|
37428
37500
|
fo.gs = [];
|
|
37429
37501
|
for (const gd of fo.groups) {
|
|
@@ -37436,22 +37508,22 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
37436
37508
|
}
|
|
37437
37509
|
applyLeaf(fo);
|
|
37438
37510
|
}
|
|
37439
|
-
if (
|
|
37511
|
+
if (shared3.ctx.iv) ivAssemble(shared3.ctx.iv, gs);
|
|
37440
37512
|
assembleInteractive(gs);
|
|
37441
37513
|
linkDoorLeaves();
|
|
37442
37514
|
mailboxInteractive();
|
|
37443
37515
|
const root = markKitOrigin(new THREE.Group(), { owner: "game-floorplan-three", kind: "structure", id: r.template }), house = new THREE.Group();
|
|
37444
37516
|
root.name = "house3d";
|
|
37445
37517
|
root.add(house);
|
|
37446
|
-
|
|
37447
|
-
if (
|
|
37448
|
-
const units = r.building.units, u = units[Math.min(
|
|
37449
|
-
house.position.set(u.u,
|
|
37518
|
+
shared3.mirrors.house = house;
|
|
37519
|
+
if (shared3.ctx.apartment) {
|
|
37520
|
+
const units = r.building.units, u = units[Math.min(shared3.ctx.pu, units.length - 1)];
|
|
37521
|
+
house.position.set(u.u, shared3.ctx.showBuilding ? 0 : -r.floors[0].y0, u.v);
|
|
37450
37522
|
house.rotation.y = u.ry;
|
|
37451
|
-
|
|
37523
|
+
shared3.ctx.unitRy = u.ry;
|
|
37452
37524
|
}
|
|
37453
37525
|
house.updateMatrixWorld(true);
|
|
37454
|
-
|
|
37526
|
+
shared3.ctx.unitInverse = house.matrixWorld.clone().invert();
|
|
37455
37527
|
for (const [k, g] of Object.entries(gs)) {
|
|
37456
37528
|
g.name = k;
|
|
37457
37529
|
(k === "floor" || k === "building" ? root : house).add(g);
|
|
@@ -37460,31 +37532,31 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
37460
37532
|
h.root = root;
|
|
37461
37533
|
h.house = house;
|
|
37462
37534
|
h.houseGroup = house;
|
|
37463
|
-
|
|
37464
|
-
|
|
37465
|
-
|
|
37466
|
-
for (const c of
|
|
37535
|
+
shared3.ctx.noModel = noModel;
|
|
37536
|
+
shared3.ctx.lights = LIGHTS.filter((l) => l.type !== "lantern" && l.type !== "candles" || shared3.ctx.night).map((l) => ({ ...l }));
|
|
37537
|
+
shared3.ctx.animateDoorsOn = shared3.ctx.animateDoorsOn || false;
|
|
37538
|
+
for (const c of shared3.ctx.colliders) {
|
|
37467
37539
|
c.aabb = [c.x0, c.z0, c.x1, c.z1];
|
|
37468
37540
|
if (c.type === "wall") c.damageable = tagDamage("masonry");
|
|
37469
37541
|
}
|
|
37470
|
-
const colliders =
|
|
37542
|
+
const colliders = shared3.ctx.colliders.concat(shared3.inter.objs.map((o) => ({ type: "furniture", f: o.f, obb: { cx: o.cx, cz: o.cz, hw: o.hw, hd: o.hd, c: o.c, s: o.s }, item: o.type, off: false })));
|
|
37471
37543
|
const parts = {}, setOpen = (def, t) => {
|
|
37472
37544
|
def.target = t;
|
|
37473
37545
|
def.t = t;
|
|
37474
|
-
|
|
37546
|
+
shared3.partState.set(def.name, t);
|
|
37475
37547
|
if (def.col) {
|
|
37476
37548
|
def.col.off = t > 0.5;
|
|
37477
37549
|
colliderChanged(def.col);
|
|
37478
37550
|
}
|
|
37479
37551
|
applyPiece(def);
|
|
37480
|
-
|
|
37552
|
+
shared3.inter.anim.delete(def);
|
|
37481
37553
|
invalidateShadow();
|
|
37482
37554
|
};
|
|
37483
37555
|
const mark = (o, id) => {
|
|
37484
37556
|
if (o) o.userData.partId = id;
|
|
37485
37557
|
};
|
|
37486
37558
|
const PART_DAMAGE = { water_tank: "water", shower_door: "glass", gate_leaf: "metal", mailbox_door: "metal", mirror: "glass", cooking_gas_cylinder: "gas" };
|
|
37487
|
-
for (const [id, g] of Object.entries(
|
|
37559
|
+
for (const [id, g] of Object.entries(shared3.ctx.parts || {})) {
|
|
37488
37560
|
const tp = g.userData.part, dn = PART_DAMAGE[tp];
|
|
37489
37561
|
if (dn) g.userData.damageable = tagDamage(dn);
|
|
37490
37562
|
mark(g, id);
|
|
@@ -37504,7 +37576,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
37504
37576
|
return g.userData.t || 0;
|
|
37505
37577
|
}, meta: g.userData };
|
|
37506
37578
|
}
|
|
37507
|
-
for (const fo of
|
|
37579
|
+
for (const fo of shared3.ctx.leaves) {
|
|
37508
37580
|
const id = "door:" + fo.id, dn = tagDamage(fo.type === "steel" ? "metal" : "wood");
|
|
37509
37581
|
fo.damageable = dn;
|
|
37510
37582
|
for (const g of fo.gs) mark(g, id);
|
|
@@ -37516,14 +37588,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
37516
37588
|
fo.col.off = fo.open;
|
|
37517
37589
|
colliderChanged(fo.col);
|
|
37518
37590
|
}
|
|
37519
|
-
|
|
37591
|
+
shared3.doorState.set(fo.id, fo.open);
|
|
37520
37592
|
applyLeaf(fo);
|
|
37521
37593
|
invalidateShadow();
|
|
37522
37594
|
}, get t() {
|
|
37523
37595
|
return fo.t;
|
|
37524
37596
|
}, leaf: fo };
|
|
37525
37597
|
}
|
|
37526
|
-
for (const def of
|
|
37598
|
+
for (const def of shared3.inter.defs.values()) {
|
|
37527
37599
|
if (!def.outer) continue;
|
|
37528
37600
|
const cab = def.kind === "swing" || def.kind === "drawer", gate = /^gate/.test(def.kind);
|
|
37529
37601
|
const dn = cab ? tagDamage("wood") : gate ? tagDamage("metal") : null;
|
|
@@ -37533,7 +37605,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
37533
37605
|
return def.t;
|
|
37534
37606
|
}, def };
|
|
37535
37607
|
}
|
|
37536
|
-
if (
|
|
37608
|
+
if (shared3.ctx.iv) ivParts(shared3.ctx.iv, parts, tagDamage);
|
|
37537
37609
|
const cars = [];
|
|
37538
37610
|
CARS.forEach((C, i) => {
|
|
37539
37611
|
const mod2 = carModel(C.k, C.seed);
|
|
@@ -37574,18 +37646,18 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
37574
37646
|
const actOn = (e, a) => {
|
|
37575
37647
|
enter(h);
|
|
37576
37648
|
if (cfg.onInteract && cfg.onInteract(e, a) === false) return false;
|
|
37577
|
-
|
|
37649
|
+
shared3.inter.target = a || { target: e.ref, text: e.label, action: e._action };
|
|
37578
37650
|
e._action();
|
|
37579
37651
|
return true;
|
|
37580
37652
|
};
|
|
37581
|
-
for (const fo of
|
|
37653
|
+
for (const fo of shared3.ctx.leaves) {
|
|
37582
37654
|
const e = { id: "door:" + fo.id, type: fo.type === "steel" ? "garage_door" : "door", floor: fo.floor, pos: [fo.cx, Y0(fo.floor) + 1, fo.cz], radius: 1.7, get label() {
|
|
37583
37655
|
return doorText(fo);
|
|
37584
37656
|
}, ref: fo, _action: () => toggleDoor(fo) };
|
|
37585
37657
|
e.act = () => actOn(e);
|
|
37586
37658
|
interactables.push(e);
|
|
37587
37659
|
}
|
|
37588
|
-
for (const it of
|
|
37660
|
+
for (const it of shared3.inter.items) {
|
|
37589
37661
|
const k = it.type + ":" + it.id, n = usedMap.get(k) || 0;
|
|
37590
37662
|
usedMap.set(k, n + 1);
|
|
37591
37663
|
const e = { id: n ? k + "#" + n : k, type: it.type, floor: it.floor, pos: it.anchor.slice(), radius: it.range, angle: it.angle, get label() {
|
|
@@ -37595,12 +37667,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
37595
37667
|
interactables.push(e);
|
|
37596
37668
|
it.pub = e;
|
|
37597
37669
|
}
|
|
37598
|
-
for (const fo of
|
|
37670
|
+
for (const fo of shared3.ctx.leaves) fo.pub = interactables.find((e) => e.ref === fo);
|
|
37599
37671
|
const lodObjects = [];
|
|
37600
|
-
for (const def of
|
|
37601
|
-
for (const [id, g] of Object.entries(
|
|
37602
|
-
if (
|
|
37603
|
-
for (const E of
|
|
37672
|
+
for (const def of shared3.inter.defs.values()) if (def.outer && /^(light|drawer|swing|curtain|light_switch|handle)$/.test(def.kind)) lodObjects.push(def.outer);
|
|
37673
|
+
for (const [id, g] of Object.entries(shared3.ctx.parts || {})) if (/^(handle|shower_door)$/.test(g.userData.part) && g.visible !== false) lodObjects.push(g);
|
|
37674
|
+
if (shared3.ctx.iv) {
|
|
37675
|
+
for (const E of shared3.ctx.iv.roots) lodObjects.push(E.root);
|
|
37604
37676
|
}
|
|
37605
37677
|
const countDraw = () => {
|
|
37606
37678
|
let n = 0, t = 0;
|
|
@@ -37618,7 +37690,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
37618
37690
|
for (const o of lodObjects) o.visible = true;
|
|
37619
37691
|
const budget = opts.drawCallBudget != null ? opts.drawCallBudget : cfg.drawCallBudget;
|
|
37620
37692
|
const stats2 = { quality: h.quality, drawCalls: s0.n, drawCallsLOD1: s1.n, triangles: s0.t, trianglesLod1: s1.t, budget: budget || null, overBudget: !!budget && s0.n > budget, tBuild: performance.now() - t0 };
|
|
37621
|
-
|
|
37693
|
+
shared3.ctx.tBuild = stats2.tBuild;
|
|
37622
37694
|
const applyLod = (level) => {
|
|
37623
37695
|
const n = Math.max(0, Math.min(2, level | 0));
|
|
37624
37696
|
if (n === h.lodCurrent) return;
|
|
@@ -37684,39 +37756,39 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
37684
37756
|
building: gs.building || null,
|
|
37685
37757
|
waterTank: r.waterTank ? (() => {
|
|
37686
37758
|
const pt = Object.values(parts).find((p) => p.type === "water_tank") || null;
|
|
37687
|
-
return { part: pt, group: pt ? pt.group : null, pos:
|
|
37759
|
+
return { part: pt, group: pt ? pt.group : null, pos: shared3.ctx.waterTankPos || null, plant: r.waterTank };
|
|
37688
37760
|
})() : null,
|
|
37689
37761
|
colliders,
|
|
37690
37762
|
parts,
|
|
37691
37763
|
cars,
|
|
37692
37764
|
interactables,
|
|
37693
|
-
doors:
|
|
37694
|
-
stairs:
|
|
37695
|
-
labels:
|
|
37765
|
+
doors: shared3.ctx.leaves,
|
|
37766
|
+
stairs: shared3.ctx.stairs,
|
|
37767
|
+
labels: shared3.ctx.labels,
|
|
37696
37768
|
noModel,
|
|
37697
37769
|
lights: (() => {
|
|
37698
37770
|
const by = {};
|
|
37699
|
-
for (const l of
|
|
37771
|
+
for (const l of shared3.ctx.lights) {
|
|
37700
37772
|
const k = String(l.roomId != null ? l.roomId : l.room);
|
|
37701
37773
|
(by[k] || (by[k] = [])).push(l);
|
|
37702
37774
|
}
|
|
37703
|
-
return { list:
|
|
37775
|
+
return { list: shared3.ctx.lights, byRoom: by };
|
|
37704
37776
|
})(),
|
|
37705
|
-
limits:
|
|
37706
|
-
apartment:
|
|
37707
|
-
showBuilding:
|
|
37708
|
-
buildingConfig: { floors:
|
|
37709
|
-
unitRy:
|
|
37710
|
-
night:
|
|
37711
|
-
cut:
|
|
37777
|
+
limits: shared3.ctx.limits,
|
|
37778
|
+
apartment: shared3.ctx.apartment,
|
|
37779
|
+
showBuilding: shared3.ctx.showBuilding,
|
|
37780
|
+
buildingConfig: { floors: shared3.ctx.pa, floor: shared3.ctx.pf, unit: shared3.ctx.pu },
|
|
37781
|
+
unitRy: shared3.ctx.unitRy || 0,
|
|
37782
|
+
night: shared3.ctx.night,
|
|
37783
|
+
cut: shared3.ctx.cut,
|
|
37712
37784
|
interactives: h.IV ? ivPublish(h) : null,
|
|
37713
37785
|
state: h.state,
|
|
37714
37786
|
stats: stats2,
|
|
37715
|
-
vegetation:
|
|
37716
|
-
solar:
|
|
37787
|
+
vegetation: shared3.ctx.vegInfo || null,
|
|
37788
|
+
solar: shared3.ctx.solarInfo || null,
|
|
37717
37789
|
water,
|
|
37718
|
-
electrical:
|
|
37719
|
-
gutters:
|
|
37790
|
+
electrical: shared3.ctx.electricalInfo || null,
|
|
37791
|
+
gutters: shared3.ctx.gutterInfo || null,
|
|
37720
37792
|
// 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
|
|
37721
37793
|
update(dt, time, focus) {
|
|
37722
37794
|
enter(h);
|
|
@@ -37726,9 +37798,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
37726
37798
|
if (destruction.active || destruction.statistics().falling || destruction.statistics().fragments) destruction.animate(dt);
|
|
37727
37799
|
if (h.IV) ivUpdate(h, dt, time, focus);
|
|
37728
37800
|
if (time != null) animateClotheslines(time);
|
|
37729
|
-
if (
|
|
37730
|
-
|
|
37731
|
-
|
|
37801
|
+
if (shared3.vegMaterials) {
|
|
37802
|
+
shared3.vegMaterials.update((time != null ? time : performance.now()) / 1e3);
|
|
37803
|
+
shared3.vegMaterials.setActors(focus ? [{ x: focus.x, y: focus.y, z: focus.z, radius: 0.9 }] : []);
|
|
37732
37804
|
}
|
|
37733
37805
|
if (focus && cfg.lod !== false) {
|
|
37734
37806
|
const L = Object.assign({ interior: 45, hide: 220 }, cfg.lod), d = distance3(focus), at4 = h.lodCurrent;
|
|
@@ -37740,12 +37812,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
37740
37812
|
show(options2) {
|
|
37741
37813
|
enter(h);
|
|
37742
37814
|
const o = options2 || {};
|
|
37743
|
-
const rr =
|
|
37815
|
+
const rr = shared3.ctx.r, nA = rr.floors.length, a = o.floor == null ? -1 : o.floor, sel = a >= nA ? -1 : a, cut = !!o.cut;
|
|
37744
37816
|
for (const [k, g] of Object.entries(gs)) {
|
|
37745
37817
|
let v = true;
|
|
37746
37818
|
if (k[0] === "f") v = sel < 0 || +k.slice(1) <= sel;
|
|
37747
37819
|
else if (k[0] === "t") v = !cut && (sel < 0 || +k.slice(1) < sel);
|
|
37748
|
-
else if (k === "roof") v = !cut && sel < 0 && (!
|
|
37820
|
+
else if (k === "roof") v = !cut && sel < 0 && (!shared3.ctx.apartment || !shared3.ctx.showBuilding || shared3.ctx.pf === shared3.ctx.pa);
|
|
37749
37821
|
else if (k === "attic_tank") v = (cut || sel >= 0) && (sel < 0 || nA - 1 <= sel);
|
|
37750
37822
|
else if (k === "lot") v = o.lot == null ? true : !!o.lot;
|
|
37751
37823
|
g.visible = v;
|
|
@@ -37762,11 +37834,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
37762
37834
|
return actOn(a.target && a.target.pub ? a.target.pub : { id: a.target && a.target.id || a.text, type: a.target && a.target.kit ? a.target.type : "door", label: a.text, ref: a.target, _action: a.action, floor: 0, pos: [], radius: 0 }, a);
|
|
37763
37835
|
},
|
|
37764
37836
|
message() {
|
|
37765
|
-
return
|
|
37837
|
+
return shared3.inter.msg && performance.now() < shared3.inter.msg.until ? shared3.inter.msg.text : null;
|
|
37766
37838
|
},
|
|
37767
37839
|
toggleDoor(fo) {
|
|
37768
37840
|
enter(h);
|
|
37769
|
-
toggleDoor(typeof fo === "string" ?
|
|
37841
|
+
toggleDoor(typeof fo === "string" ? shared3.ctx.leaves.find((f) => f.id === fo) : fo);
|
|
37770
37842
|
},
|
|
37771
37843
|
lightOn(roomId) {
|
|
37772
37844
|
enter(h);
|
|
@@ -37838,14 +37910,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
37838
37910
|
});
|
|
37839
37911
|
root.removeFromParent();
|
|
37840
37912
|
},
|
|
37841
|
-
internal: { h, ctx:
|
|
37913
|
+
internal: { h, ctx: shared3.ctx, inter: shared3.inter, partState: shared3.partState, doorState: shared3.doorState, mirrors: shared3.mirrors }
|
|
37842
37914
|
};
|
|
37843
37915
|
return res;
|
|
37844
37916
|
}
|
|
37845
37917
|
const defined = { build };
|
|
37846
37918
|
Object.assign(K, defined);
|
|
37847
37919
|
}
|
|
37848
|
-
function buildApi(K,
|
|
37920
|
+
function buildApi(K, shared3) {
|
|
37849
37921
|
const { cfg, VERSION: VERSION2, ATLAS, TEX, applyPart, carGroup, carModel, props, TYPES, roomLightMask, lighting, effectLights, newState, build } = K;
|
|
37850
37922
|
return {
|
|
37851
37923
|
version: VERSION2,
|
|
@@ -37855,15 +37927,15 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
37855
37927
|
mv: props,
|
|
37856
37928
|
applyPart,
|
|
37857
37929
|
// the kernel and the shared state, for recorders that run the team's builders into something else than the house (`furnitureSpec`, `tapSpec`): not a stable api
|
|
37858
|
-
internals: { K, shared:
|
|
37930
|
+
internals: { K, shared: shared3 },
|
|
37859
37931
|
get materials() {
|
|
37860
|
-
return
|
|
37932
|
+
return shared3.mats;
|
|
37861
37933
|
},
|
|
37862
37934
|
roomLightMask,
|
|
37863
37935
|
lighting,
|
|
37864
37936
|
effectLights,
|
|
37865
37937
|
setNight(n) {
|
|
37866
|
-
const glass =
|
|
37938
|
+
const glass = shared3.mats.glass;
|
|
37867
37939
|
glass.emissive.set(n ? 9067040 : 0);
|
|
37868
37940
|
glass.opacity = n ? 0.4 : 0.24;
|
|
37869
37941
|
},
|
|
@@ -37875,11 +37947,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
37875
37947
|
return m && { parts: m.parts.length, tris: m.tris, L: m.L, W: m.W, H: m.H };
|
|
37876
37948
|
} },
|
|
37877
37949
|
dispose() {
|
|
37878
|
-
if (
|
|
37879
|
-
|
|
37880
|
-
|
|
37950
|
+
if (shared3.vegMaterials) {
|
|
37951
|
+
shared3.vegMaterials.dispose();
|
|
37952
|
+
shared3.vegMaterials = null;
|
|
37881
37953
|
}
|
|
37882
|
-
for (const m of Object.values(
|
|
37954
|
+
for (const m of Object.values(shared3.mats)) {
|
|
37883
37955
|
if (m && m.dispose) m.dispose();
|
|
37884
37956
|
}
|
|
37885
37957
|
for (const [k, t] of Object.entries(TEX)) if (t && t.dispose && !(cfg.textures && cfg.textures[k])) t.dispose();
|
|
@@ -37904,7 +37976,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
37904
37976
|
const colliderChanged = (c) => {
|
|
37905
37977
|
if (c && cfg.onCollider) cfg.onCollider(c);
|
|
37906
37978
|
};
|
|
37907
|
-
const
|
|
37979
|
+
const shared3 = { mats: null, quality: cfg.quality === "game" ? "game" : "high" };
|
|
37908
37980
|
const seedKey = (id) => {
|
|
37909
37981
|
if (cfg.seedKey && id != null) {
|
|
37910
37982
|
const k = cfg.seedKey(String(id));
|
|
@@ -37913,61 +37985,61 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
37913
37985
|
return id;
|
|
37914
37986
|
};
|
|
37915
37987
|
const K = { t: createTranslator2(cfg.locale), seedKey, THREE: shapeGeometries(THREE), cfg, DOC, PROPS, Reflector, FLEET, HP, invalidate, invalidateShadow, colliderChanged, VERSION, rectsOf, isOpenArea, OPEN_ROOM_TYPES: OPEN_ROOM_TYPES2 };
|
|
37916
|
-
installKernelGeometry(K,
|
|
37917
|
-
installKernelNoise(K,
|
|
37918
|
-
installMaterialsTextures(K,
|
|
37919
|
-
installMaterialsMaterials(K,
|
|
37920
|
-
installKernelCloseScene(K,
|
|
37921
|
-
installHouseHelpers(K,
|
|
37922
|
-
installHouseWalls(K,
|
|
37923
|
-
installHouseDoors(K,
|
|
37924
|
-
installHouseWindows(K,
|
|
37925
|
-
installHouseFloors(K,
|
|
37926
|
-
installHouseStairs(K,
|
|
37927
|
-
installLightsFixtures(K,
|
|
37928
|
-
installLightsDecor(K,
|
|
37929
|
-
installLotTerrain(K,
|
|
37930
|
-
installLotPerimeter(K,
|
|
37931
|
-
installLotGates(K,
|
|
37932
|
-
installRoofRoofs(K,
|
|
37933
|
-
installRoofGutters(K,
|
|
37934
|
-
installRoofSlabs(K,
|
|
37935
|
-
installRoofTiles(K,
|
|
37936
|
-
installRoofRect(K,
|
|
37937
|
-
installMirrors(K,
|
|
37938
|
-
installCars(K,
|
|
37939
|
-
installHouseBuilding(K,
|
|
37940
|
-
installUtilitiesWater(K,
|
|
37941
|
-
installUtilitiesElectrical(K,
|
|
37942
|
-
installHouseBaseboard(K,
|
|
37943
|
-
installUtilitiesSolar(K,
|
|
37944
|
-
installHouseOutbuildings(K,
|
|
37945
|
-
installFurnitureApi(K,
|
|
37946
|
-
installFurnitureBuilders(K,
|
|
37947
|
-
installFurnitureTypeTable(K,
|
|
37948
|
-
installFurnitureTaps(K,
|
|
37949
|
-
installFurnitureFixtures(K,
|
|
37950
|
-
installFurniturePlants(K,
|
|
37951
|
-
installFurnitureYard(K,
|
|
37952
|
-
installFurnitureExtraTypes(K,
|
|
37953
|
-
installFurniturePlaceItems(K,
|
|
37954
|
-
installVegetationBridge(K,
|
|
37955
|
-
installInteractionState(K,
|
|
37956
|
-
installInteractionCollision(K,
|
|
37957
|
-
installInteractionItems(K,
|
|
37958
|
-
installInteractionFittings(K,
|
|
37959
|
-
installInteractionDoors(K,
|
|
37960
|
-
installInteractionTarget(K,
|
|
37961
|
-
installInteractablesBridge(K,
|
|
37962
|
-
installAnimationClotheslines(K,
|
|
37963
|
-
installBuildInstance(K,
|
|
37964
|
-
installInteractablesKit(K,
|
|
37965
|
-
installLightsRoomLight(K,
|
|
37966
|
-
installDestructionPieces(K,
|
|
37967
|
-
installDestructionBreach(K,
|
|
37968
|
-
installDestructionWorld(K,
|
|
37969
|
-
installBuildBuild(K,
|
|
37970
|
-
return buildApi(K,
|
|
37988
|
+
installKernelGeometry(K, shared3);
|
|
37989
|
+
installKernelNoise(K, shared3);
|
|
37990
|
+
installMaterialsTextures(K, shared3);
|
|
37991
|
+
installMaterialsMaterials(K, shared3);
|
|
37992
|
+
installKernelCloseScene(K, shared3);
|
|
37993
|
+
installHouseHelpers(K, shared3);
|
|
37994
|
+
installHouseWalls(K, shared3);
|
|
37995
|
+
installHouseDoors(K, shared3);
|
|
37996
|
+
installHouseWindows(K, shared3);
|
|
37997
|
+
installHouseFloors(K, shared3);
|
|
37998
|
+
installHouseStairs(K, shared3);
|
|
37999
|
+
installLightsFixtures(K, shared3);
|
|
38000
|
+
installLightsDecor(K, shared3);
|
|
38001
|
+
installLotTerrain(K, shared3);
|
|
38002
|
+
installLotPerimeter(K, shared3);
|
|
38003
|
+
installLotGates(K, shared3);
|
|
38004
|
+
installRoofRoofs(K, shared3);
|
|
38005
|
+
installRoofGutters(K, shared3);
|
|
38006
|
+
installRoofSlabs(K, shared3);
|
|
38007
|
+
installRoofTiles(K, shared3);
|
|
38008
|
+
installRoofRect(K, shared3);
|
|
38009
|
+
installMirrors(K, shared3);
|
|
38010
|
+
installCars(K, shared3);
|
|
38011
|
+
installHouseBuilding(K, shared3);
|
|
38012
|
+
installUtilitiesWater(K, shared3);
|
|
38013
|
+
installUtilitiesElectrical(K, shared3);
|
|
38014
|
+
installHouseBaseboard(K, shared3);
|
|
38015
|
+
installUtilitiesSolar(K, shared3);
|
|
38016
|
+
installHouseOutbuildings(K, shared3);
|
|
38017
|
+
installFurnitureApi(K, shared3);
|
|
38018
|
+
installFurnitureBuilders(K, shared3);
|
|
38019
|
+
installFurnitureTypeTable(K, shared3);
|
|
38020
|
+
installFurnitureTaps(K, shared3);
|
|
38021
|
+
installFurnitureFixtures(K, shared3);
|
|
38022
|
+
installFurniturePlants(K, shared3);
|
|
38023
|
+
installFurnitureYard(K, shared3);
|
|
38024
|
+
installFurnitureExtraTypes(K, shared3);
|
|
38025
|
+
installFurniturePlaceItems(K, shared3);
|
|
38026
|
+
installVegetationBridge(K, shared3);
|
|
38027
|
+
installInteractionState(K, shared3);
|
|
38028
|
+
installInteractionCollision(K, shared3);
|
|
38029
|
+
installInteractionItems(K, shared3);
|
|
38030
|
+
installInteractionFittings(K, shared3);
|
|
38031
|
+
installInteractionDoors(K, shared3);
|
|
38032
|
+
installInteractionTarget(K, shared3);
|
|
38033
|
+
installInteractablesBridge(K, shared3);
|
|
38034
|
+
installAnimationClotheslines(K, shared3);
|
|
38035
|
+
installBuildInstance(K, shared3);
|
|
38036
|
+
installInteractablesKit(K, shared3);
|
|
38037
|
+
installLightsRoomLight(K, shared3);
|
|
38038
|
+
installDestructionPieces(K, shared3);
|
|
38039
|
+
installDestructionBreach(K, shared3);
|
|
38040
|
+
installDestructionWorld(K, shared3);
|
|
38041
|
+
installBuildBuild(K, shared3);
|
|
38042
|
+
return buildApi(K, shared3);
|
|
37971
38043
|
}
|
|
37972
38044
|
|
|
37973
38045
|
// ../game-floorplan-residential/dist/index.js
|
|
@@ -39067,7 +39139,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
39067
39139
|
if (strip.alongU) return strip.side === "front" ? [r22(u0 + a0), r22(v0 + b0), r22(u0 + a1), r22(v0 + b1)] : [r22(u0 + a0), r22(v1 - b1), r22(u0 + a1), r22(v1 - b0)];
|
|
39068
39140
|
return strip.side === "left" ? [r22(u0 + b0), r22(v0 + a0), r22(u0 + b1), r22(v0 + a1)] : [r22(u1 - b1), r22(v0 + a0), r22(u1 - b0), r22(v0 + a1)];
|
|
39069
39141
|
};
|
|
39070
|
-
function apartment(strip, floor2, k, from, to,
|
|
39142
|
+
function apartment(strip, floor2, k, from, to, plate3, ceiling, win) {
|
|
39071
39143
|
const wide2 = to - from, depth = strip.depth, facade = r22(depth * 0.56);
|
|
39072
39144
|
const id = (name) => `apt_${floor2}_${strip.id}_${k}_${name}`;
|
|
39073
39145
|
const at4 = (f0, f1, b0, b1) => boxOf2(strip, r22(from + wide2 * f0), r22(from + wide2 * f1), b0, b1);
|
|
@@ -39085,7 +39157,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
39085
39157
|
{ a: id("hall"), b: id("bedroom"), width: 0.85, opensTo: id("bedroom") },
|
|
39086
39158
|
{ a: id("hall"), b: id("bath"), width: 0.8, opensTo: id("bath") }
|
|
39087
39159
|
];
|
|
39088
|
-
const windows = rooms.filter((r) => r.type === "living" || r.type === "bedroom").flatMap((r) => exteriorWindows(r.id, r.rect,
|
|
39160
|
+
const windows = rooms.filter((r) => r.type === "living" || r.type === "bedroom").flatMap((r) => exteriorWindows(r.id, r.rect, plate3, ceiling, { ...win, width: 2.2, spacing: 4.5 }));
|
|
39089
39161
|
if (strip.side === "back") {
|
|
39090
39162
|
const [u0, , u1, v1] = rooms[0].rect;
|
|
39091
39163
|
rooms.push({ id: id("balcony"), type: "balcony", label: "balcony", library: "balcony", rect: [r22(u0 + 0.6), v1, r22(u1 - 0.6), r22(v1 + 1.6)] });
|
|
@@ -39095,19 +39167,19 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
39095
39167
|
return { rooms, doors, windows };
|
|
39096
39168
|
}
|
|
39097
39169
|
var SHARED_ROOMS = { west: { type: "laundry", label: "laundry_room" }, east: { type: "storage", label: "storage_room" } };
|
|
39098
|
-
var apartments = (plan) => (strip, { floor: floor2, plate:
|
|
39170
|
+
var apartments = (plan) => (strip, { floor: floor2, plate: plate3, ceiling }) => {
|
|
39099
39171
|
if (strip.length < plan.apartmentMin) {
|
|
39100
|
-
const
|
|
39101
|
-
const id = `${
|
|
39102
|
-
return { rooms: [{ id, type:
|
|
39172
|
+
const shared3 = SHARED_ROOMS[strip.id] ?? SHARED_ROOMS.east;
|
|
39173
|
+
const id = `${shared3.label}_${floor2}_${strip.id}`;
|
|
39174
|
+
return { rooms: [{ id, type: shared3.type, label: shared3.label, rect: [...strip.rect] }], doors: [stripDoor(id, strip, floor2, 0.9)], windows: exteriorWindows(id, strip.rect, plate3, ceiling, { ...plan.window, width: 1.2 }) };
|
|
39103
39175
|
}
|
|
39104
39176
|
const count = Math.max(1, Math.round(strip.length / plan.apartment)), wide2 = strip.length / count;
|
|
39105
|
-
const parts = Array.from({ length: count }, (_, k) => apartment(strip, floor2, k, r22(k * wide2), r22((k + 1) * wide2),
|
|
39177
|
+
const parts = Array.from({ length: count }, (_, k) => apartment(strip, floor2, k, r22(k * wide2), r22((k + 1) * wide2), plate3, ceiling, plan.window));
|
|
39106
39178
|
return { rooms: parts.flatMap((p) => p.rooms), doors: parts.flatMap((p) => p.doors), windows: parts.flatMap((p) => p.windows) };
|
|
39107
39179
|
};
|
|
39108
39180
|
var groundFiller = (plan) => (strip, context) => {
|
|
39109
39181
|
if (strip.id !== "south") return apartments(plan)(strip, context);
|
|
39110
|
-
const { floor: floor2, plate:
|
|
39182
|
+
const { floor: floor2, plate: plate3, ceiling } = context;
|
|
39111
39183
|
const lobby = `lobby_${floor2}_entrance`, concierge = `concierge_${floor2}`, bikes = `bike_room_${floor2}`;
|
|
39112
39184
|
const at4 = (f0, f1) => boxOf2(strip, r22(strip.length * f0), r22(strip.length * f1), 0, strip.depth);
|
|
39113
39185
|
const [left, middle, right] = [at4(0, 0.3), at4(0.3, 0.7), at4(0.7, 1)];
|
|
@@ -39122,7 +39194,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
39122
39194
|
{ a: concierge, b: lobby, width: 1.2, opensTo: concierge },
|
|
39123
39195
|
{ a: bikes, b: lobby, width: 1.2, opensTo: bikes }
|
|
39124
39196
|
];
|
|
39125
|
-
return { rooms, doors, windows: exteriorWindows(concierge, left,
|
|
39197
|
+
return { rooms, doors, windows: exteriorWindows(concierge, left, plate3, ceiling, plan.window) };
|
|
39126
39198
|
};
|
|
39127
39199
|
var summary = (l) => ({ storeys: l.storeys, height: l.height, slab: l.slab, pitch: l.pitch, total: l.total, bay: l.bay, plate: l.plate, mechanical: l.mechanical, facade: l.facade, damper: l.damper });
|
|
39128
39200
|
function residentialTowerTemplate(preset = RESIDENTIAL_TOWER_DEFAULTS, planOptions = {}) {
|
|
@@ -39373,21 +39445,21 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
39373
39445
|
const seed = Math.round(opts.seed ?? 1);
|
|
39374
39446
|
const plain2 = SHELVING.test(type) ? "paper" : "plastic";
|
|
39375
39447
|
const root = { x: seed, z: 0, ry: 0, w, d, h, y: 0, base: 0, palette: o.palette, seed: `furniture_${type}_${seed}` };
|
|
39376
|
-
const { K, shared:
|
|
39448
|
+
const { K, shared: shared3 } = renderer.internals;
|
|
39377
39449
|
const before = K.PARTS.length;
|
|
39378
39450
|
const made = recordSpec(
|
|
39379
39451
|
THREE,
|
|
39380
39452
|
type,
|
|
39381
39453
|
root,
|
|
39382
39454
|
(A) => {
|
|
39383
|
-
const saved = { api0:
|
|
39384
|
-
|
|
39385
|
-
|
|
39455
|
+
const saved = { api0: shared3.api0, ctx: shared3.ctx };
|
|
39456
|
+
shared3.api0 = A;
|
|
39457
|
+
shared3.ctx = shared3.ctx ?? {};
|
|
39386
39458
|
try {
|
|
39387
39459
|
ent.f(root, A);
|
|
39388
39460
|
} finally {
|
|
39389
|
-
|
|
39390
|
-
|
|
39461
|
+
shared3.api0 = saved.api0;
|
|
39462
|
+
shared3.ctx = saved.ctx;
|
|
39391
39463
|
}
|
|
39392
39464
|
},
|
|
39393
39465
|
{ materials: { plain: plain2, ...o.materials }, chairs: o.chairs, carcass: SHELVING.test(type) }
|
|
@@ -41255,8 +41327,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
41255
41327
|
h: 0.04,
|
|
41256
41328
|
gl: 0.125,
|
|
41257
41329
|
deagle: 1,
|
|
41258
|
-
|
|
41259
|
-
|
|
41330
|
+
rel: 1.8,
|
|
41331
|
+
chrome: 1
|
|
41260
41332
|
}
|
|
41261
41333
|
},
|
|
41262
41334
|
taurus_82: {
|
|
@@ -41583,7 +41655,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
41583
41655
|
barrel: 415,
|
|
41584
41656
|
options: {
|
|
41585
41657
|
wood: 1,
|
|
41586
|
-
stock: "
|
|
41658
|
+
stock: "ak",
|
|
41587
41659
|
mag: "curved",
|
|
41588
41660
|
hg: "wood",
|
|
41589
41661
|
hgFrac: 0.42,
|
|
@@ -41593,7 +41665,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
41593
41665
|
rod: 1,
|
|
41594
41666
|
bayo: 1,
|
|
41595
41667
|
rpm: 600,
|
|
41596
|
-
rel: 0.4
|
|
41668
|
+
rel: 0.4,
|
|
41669
|
+
kalashnikov: 1
|
|
41597
41670
|
}
|
|
41598
41671
|
},
|
|
41599
41672
|
akm: {
|
|
@@ -41603,7 +41676,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
41603
41676
|
barrel: 415,
|
|
41604
41677
|
options: {
|
|
41605
41678
|
wood: 1,
|
|
41606
|
-
stock: "
|
|
41679
|
+
stock: "ak",
|
|
41607
41680
|
mag: "curved",
|
|
41608
41681
|
hg: "wood",
|
|
41609
41682
|
hgFrac: 0.42,
|
|
@@ -41613,7 +41686,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
41613
41686
|
rod: 1,
|
|
41614
41687
|
rpm: 600,
|
|
41615
41688
|
magMat: "bakelite",
|
|
41616
|
-
rel: 0.45
|
|
41689
|
+
rel: 0.45,
|
|
41690
|
+
kalashnikov: 1
|
|
41617
41691
|
}
|
|
41618
41692
|
},
|
|
41619
41693
|
ak_74: {
|
|
@@ -41622,7 +41696,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
41622
41696
|
length: 943,
|
|
41623
41697
|
barrel: 415,
|
|
41624
41698
|
options: {
|
|
41625
|
-
stock: "
|
|
41699
|
+
stock: "ak",
|
|
41626
41700
|
mag: "curved",
|
|
41627
41701
|
hg: "poly",
|
|
41628
41702
|
hgFrac: 0.42,
|
|
@@ -41632,7 +41706,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
41632
41706
|
ak: 1,
|
|
41633
41707
|
rod: 1,
|
|
41634
41708
|
rpm: 650,
|
|
41635
|
-
magMat: "bakelite"
|
|
41709
|
+
magMat: "bakelite",
|
|
41710
|
+
kalashnikov: 1,
|
|
41711
|
+
wood: 1
|
|
41636
41712
|
}
|
|
41637
41713
|
},
|
|
41638
41714
|
ak_12: {
|
|
@@ -41827,7 +41903,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
41827
41903
|
barrel: 620,
|
|
41828
41904
|
options: {
|
|
41829
41905
|
wood: 1,
|
|
41830
|
-
stock: "
|
|
41906
|
+
stock: "svd",
|
|
41831
41907
|
stockLen: 0.32,
|
|
41832
41908
|
mag: "box",
|
|
41833
41909
|
curve: 0.09,
|
|
@@ -41837,7 +41913,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
41837
41913
|
scope: 4,
|
|
41838
41914
|
brake: 1,
|
|
41839
41915
|
ak: 1,
|
|
41840
|
-
charge: 1
|
|
41916
|
+
charge: 1,
|
|
41917
|
+
svd: 1
|
|
41841
41918
|
}
|
|
41842
41919
|
},
|
|
41843
41920
|
fn_scar_h: {
|
|
@@ -41902,7 +41979,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
41902
41979
|
barrel: 650,
|
|
41903
41980
|
options: {
|
|
41904
41981
|
olive: 1,
|
|
41905
|
-
stock: "
|
|
41982
|
+
stock: "sporter",
|
|
41906
41983
|
mag: "internal",
|
|
41907
41984
|
scope: 3,
|
|
41908
41985
|
bolt: 1,
|
|
@@ -41958,7 +42035,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
41958
42035
|
barrel: 610,
|
|
41959
42036
|
options: {
|
|
41960
42037
|
wood: 1,
|
|
41961
|
-
stock: "
|
|
42038
|
+
stock: "sporter",
|
|
41962
42039
|
mag: "internal",
|
|
41963
42040
|
scope: 3,
|
|
41964
42041
|
bolt: 1,
|
|
@@ -41972,7 +42049,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
41972
42049
|
barrel: 610,
|
|
41973
42050
|
options: {
|
|
41974
42051
|
olive: 1,
|
|
41975
|
-
stock: "
|
|
42052
|
+
stock: "sporter",
|
|
41976
42053
|
mag: "internal",
|
|
41977
42054
|
scope: 3,
|
|
41978
42055
|
bolt: 1,
|
|
@@ -42136,7 +42213,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
42136
42213
|
barrel: 560,
|
|
42137
42214
|
options: {
|
|
42138
42215
|
wood: 1,
|
|
42139
|
-
stock: "
|
|
42216
|
+
stock: "sporter",
|
|
42140
42217
|
mag: "internal",
|
|
42141
42218
|
scope: 3,
|
|
42142
42219
|
bolt: 1,
|
|
@@ -42265,13 +42342,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
42265
42342
|
barrel: 610,
|
|
42266
42343
|
options: {
|
|
42267
42344
|
wood: 1,
|
|
42268
|
-
stock: "
|
|
42345
|
+
stock: "sporter",
|
|
42269
42346
|
mag: "internal",
|
|
42270
42347
|
scope: 3,
|
|
42271
42348
|
bolt: 1,
|
|
42272
42349
|
round: 1
|
|
42273
|
-
}
|
|
42274
|
-
variantOf: "remington_700"
|
|
42350
|
+
}
|
|
42275
42351
|
},
|
|
42276
42352
|
hk_mp5sd3: {
|
|
42277
42353
|
builder: "rifle",
|
|
@@ -42568,7 +42644,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
42568
42644
|
barrel: 590,
|
|
42569
42645
|
options: {
|
|
42570
42646
|
wood: 1,
|
|
42571
|
-
stock: "
|
|
42647
|
+
stock: "ak",
|
|
42572
42648
|
mag: "curved",
|
|
42573
42649
|
hg: "wood",
|
|
42574
42650
|
hgFrac: 0.42,
|
|
@@ -42580,9 +42656,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
42580
42656
|
rpm: 600,
|
|
42581
42657
|
rel: 0.4,
|
|
42582
42658
|
bipod: 1,
|
|
42583
|
-
magLen: 1.4
|
|
42584
|
-
|
|
42585
|
-
|
|
42659
|
+
magLen: 1.4,
|
|
42660
|
+
kalashnikov: 1
|
|
42661
|
+
}
|
|
42586
42662
|
},
|
|
42587
42663
|
sig_mpx: {
|
|
42588
42664
|
builder: "rifle",
|
|
@@ -42682,9 +42758,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
42682
42758
|
rod: 1,
|
|
42683
42759
|
rpm: 700,
|
|
42684
42760
|
magMat: "bakelite",
|
|
42685
|
-
stockLen: 0.22
|
|
42686
|
-
|
|
42687
|
-
|
|
42761
|
+
stockLen: 0.22,
|
|
42762
|
+
kalashnikov: 1
|
|
42763
|
+
}
|
|
42688
42764
|
},
|
|
42689
42765
|
fn_scar_l: {
|
|
42690
42766
|
builder: "rifle",
|
|
@@ -43041,6 +43117,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
43041
43117
|
metal: standard(3422010, 0.42, 0.75),
|
|
43042
43118
|
steel: standard(7106418, 0.32, 0.85),
|
|
43043
43119
|
steelL: standard(9080208, 0.28, 0.9),
|
|
43120
|
+
// polished steel: bright and glossy under plain lights too (the rooms have no environment map for a fully metallic surface to mirror)
|
|
43121
|
+
chrome: standard(13949148, 0.16, 0.5),
|
|
43044
43122
|
dark: standard(1711133, 0.55, 0.5),
|
|
43045
43123
|
poly: standard(2369058, 0.8, 0.05),
|
|
43046
43124
|
olive: standard(4936241, 0.8, 0.05),
|
|
@@ -43420,6 +43498,107 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
43420
43498
|
for (let i = 0; i < 9; i++) kit.cylinderX(parts.mag, 45e-4, 0.042, kit.M.brass, 2e-3 + i * 1e-3, -0.01 - i * 0.0115, i % 2 ? 4e-3 : -4e-3, 8);
|
|
43421
43499
|
}
|
|
43422
43500
|
|
|
43501
|
+
// src/models/wood-profile.ts
|
|
43502
|
+
var SLICE_LENGTH = 0.02;
|
|
43503
|
+
var at2 = (points, x) => {
|
|
43504
|
+
const last = points[points.length - 1];
|
|
43505
|
+
if (x >= last[0]) return [last[1], last[2]];
|
|
43506
|
+
const nextIndex = points.findIndex((point) => point[0] >= x);
|
|
43507
|
+
const next = points[Math.max(nextIndex, 1)];
|
|
43508
|
+
const previous = points[Math.max(nextIndex, 1) - 1];
|
|
43509
|
+
const fraction = (x - previous[0]) / (next[0] - previous[0]);
|
|
43510
|
+
return [previous[1] + (next[1] - previous[1]) * fraction, previous[2] + (next[2] - previous[2]) * fraction];
|
|
43511
|
+
};
|
|
43512
|
+
function profileBlock(kit, parent, points, width, material) {
|
|
43513
|
+
const first = points[0];
|
|
43514
|
+
const last = points[points.length - 1];
|
|
43515
|
+
const count = Math.max(1, Math.ceil((last[0] - first[0]) / SLICE_LENGTH));
|
|
43516
|
+
const step = (last[0] - first[0]) / count;
|
|
43517
|
+
for (let index = 0; index < count; index++) {
|
|
43518
|
+
const [rearTop, rearBottom] = at2(points, first[0] + step * index);
|
|
43519
|
+
const [frontTop, frontBottom] = at2(points, first[0] + step * (index + 1));
|
|
43520
|
+
const rise = (frontTop + frontBottom - rearTop - rearBottom) / 2;
|
|
43521
|
+
const height = (frontTop - frontBottom + rearTop - rearBottom) / 2;
|
|
43522
|
+
const centre = (rearTop + rearBottom + frontTop + frontBottom) / 4;
|
|
43523
|
+
kit.box(parent, Math.hypot(step, rise) * 1.12, height, width, material, first[0] + step * (index + 0.5), centre, 0, Math.atan2(rise, step));
|
|
43524
|
+
}
|
|
43525
|
+
}
|
|
43526
|
+
var BEVEL2 = 25e-4;
|
|
43527
|
+
var solids = /* @__PURE__ */ new WeakMap();
|
|
43528
|
+
function profileSolid(kit, parent, points, width, material, hole) {
|
|
43529
|
+
const key2 = JSON.stringify([points, width, hole ?? null]);
|
|
43530
|
+
const cache = solids.get(kit) ?? /* @__PURE__ */ new Map();
|
|
43531
|
+
solids.set(kit, cache);
|
|
43532
|
+
let geometry = cache.get(key2);
|
|
43533
|
+
if (!geometry) {
|
|
43534
|
+
geometry = buildSolid(kit, points, width, hole);
|
|
43535
|
+
markShared(geometry);
|
|
43536
|
+
cache.set(key2, geometry);
|
|
43537
|
+
}
|
|
43538
|
+
const { THREE } = kit;
|
|
43539
|
+
const mesh3 = new THREE.Mesh(geometry, material);
|
|
43540
|
+
mesh3.castShadow = true;
|
|
43541
|
+
mesh3.receiveShadow = true;
|
|
43542
|
+
parent.add(mesh3);
|
|
43543
|
+
return mesh3;
|
|
43544
|
+
}
|
|
43545
|
+
function buildSolid(kit, points, width, hole) {
|
|
43546
|
+
const { THREE } = kit;
|
|
43547
|
+
const top = points.map(([x, y]) => new THREE.Vector2(x, y));
|
|
43548
|
+
const bottom = [...points].reverse().map(([x, , y]) => new THREE.Vector2(x, y));
|
|
43549
|
+
const first = top[0];
|
|
43550
|
+
const shape = new THREE.Shape();
|
|
43551
|
+
shape.moveTo(first.x, first.y);
|
|
43552
|
+
shape.splineThru(top.slice(1));
|
|
43553
|
+
shape.lineTo(bottom[0].x, bottom[0].y);
|
|
43554
|
+
shape.splineThru(bottom.slice(1));
|
|
43555
|
+
shape.closePath();
|
|
43556
|
+
if (hole) {
|
|
43557
|
+
const loop = hole.map(([x, y]) => new THREE.Vector2(x, y));
|
|
43558
|
+
const path = new THREE.Path();
|
|
43559
|
+
path.moveTo(loop[0].x, loop[0].y);
|
|
43560
|
+
path.splineThru([...loop.slice(1), loop[0]]);
|
|
43561
|
+
shape.holes.push(path);
|
|
43562
|
+
}
|
|
43563
|
+
const depth = Math.max(2e-3, width - BEVEL2 * 2);
|
|
43564
|
+
const geometry = new THREE.ExtrudeGeometry(shape, { depth, curveSegments: 16, bevelEnabled: true, bevelThickness: BEVEL2, bevelSize: BEVEL2, bevelSegments: 2 });
|
|
43565
|
+
geometry.translate(0, 0, -depth / 2);
|
|
43566
|
+
return geometry;
|
|
43567
|
+
}
|
|
43568
|
+
|
|
43569
|
+
// src/models/rifle-svd.ts
|
|
43570
|
+
function buildSvdStock(context) {
|
|
43571
|
+
const { kit, group, furniture: furn, stockLength: S } = context;
|
|
43572
|
+
const width = 0.034;
|
|
43573
|
+
profileSolid(
|
|
43574
|
+
kit,
|
|
43575
|
+
group,
|
|
43576
|
+
[
|
|
43577
|
+
[6e-3, 0.02, -0.142],
|
|
43578
|
+
[0.07, 0.022, -0.13],
|
|
43579
|
+
[0.16, 0.024, -0.122],
|
|
43580
|
+
[S - 0.03, 0.027, -0.124],
|
|
43581
|
+
[S + 6e-3, 0.028, -0.128],
|
|
43582
|
+
[S + 0.035, -0.02, -0.13]
|
|
43583
|
+
],
|
|
43584
|
+
width,
|
|
43585
|
+
furn,
|
|
43586
|
+
[[0.125, -0.02], [0.2, -0.018], [S - 0.01, -0.022], [S + 0.012, -0.05], [S - 0.01, -0.094], [0.2, -0.095], [0.125, -0.09], [0.112, -0.055]]
|
|
43587
|
+
);
|
|
43588
|
+
profileSolid(kit, group, [[0.06, 0.044, 0.016], [0.11, 0.05, 0.016], [0.2, 0.046, 0.016]], width * 0.9, furn);
|
|
43589
|
+
buttpad(kit, group, 3e-3, -0.06, 0.16, width);
|
|
43590
|
+
}
|
|
43591
|
+
function buildSvdHandguard(context) {
|
|
43592
|
+
const { kit, group, furniture: furn, receiverEnd: x1, receiverWidth: wR, barrelRadius: r, barrelY: by } = context;
|
|
43593
|
+
const { M, box: box5, cylinderX } = kit;
|
|
43594
|
+
const length2 = 0.27;
|
|
43595
|
+
profileSolid(kit, group, [[x1, by + 0.024, by - 0.03], [x1 + 0.06, by + 0.026, by - 0.03], [x1 + length2, by + 0.02, by - 0.024]], wR * 1.12, furn);
|
|
43596
|
+
for (let i = 0; i < 3; i++) for (const side of [-1, 1]) box5(group, 0.028, 8e-3, 2e-3, M.hole, x1 + 0.07 + i * 0.06, by + 4e-3, side * wR * 0.57);
|
|
43597
|
+
cylinderX(group, wR * 0.5, 0.012, M.metal, x1 + length2 + 6e-3, by, 0, 16);
|
|
43598
|
+
cylinderX(group, r * 1.2, 0.05, M.metal, x1 + length2 + 0.035, by + r * 2.4, 0, 12);
|
|
43599
|
+
box5(group, 0.016, r * 3.4, wR * 0.5, M.metal, x1 + length2 + 0.05, by + r * 1.2, 0);
|
|
43600
|
+
}
|
|
43601
|
+
|
|
43423
43602
|
// src/models/rifle-forend.ts
|
|
43424
43603
|
var PI4 = Math.PI;
|
|
43425
43604
|
function buildForend(context) {
|
|
@@ -43429,6 +43608,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
43429
43608
|
buildG36Handguard(context);
|
|
43430
43609
|
return;
|
|
43431
43610
|
}
|
|
43611
|
+
if (o.svd) {
|
|
43612
|
+
buildSvdHandguard(context);
|
|
43613
|
+
return;
|
|
43614
|
+
}
|
|
43432
43615
|
const hasLongScope = (o.scope ?? 0) >= 3;
|
|
43433
43616
|
if (!context.isTraditional && o.hg !== "none") {
|
|
43434
43617
|
const handguardLength = (L - x1) * (o.hgFrac || 0.5);
|
|
@@ -43509,6 +43692,82 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
43509
43692
|
return x;
|
|
43510
43693
|
}
|
|
43511
43694
|
|
|
43695
|
+
// src/models/geometry-cache.ts
|
|
43696
|
+
var shared2 = /* @__PURE__ */ new WeakMap();
|
|
43697
|
+
function sharedGeometry(kit, key2, build) {
|
|
43698
|
+
const cache = shared2.get(kit) ?? /* @__PURE__ */ new Map();
|
|
43699
|
+
shared2.set(kit, cache);
|
|
43700
|
+
let geometry = cache.get(key2);
|
|
43701
|
+
if (!geometry) {
|
|
43702
|
+
geometry = build();
|
|
43703
|
+
markShared(geometry);
|
|
43704
|
+
cache.set(key2, geometry);
|
|
43705
|
+
}
|
|
43706
|
+
return geometry;
|
|
43707
|
+
}
|
|
43708
|
+
|
|
43709
|
+
// src/models/rifle-kalashnikov.ts
|
|
43710
|
+
function buildKalashnikovReceiver(context) {
|
|
43711
|
+
const { kit, group, receiverStart: x0, receiverEnd: x1, receiverWidth: wR, receiverLength: RL, receiverHeight: hR, barrelY: by } = context;
|
|
43712
|
+
const { M, box: box5, cylinderZ } = kit;
|
|
43713
|
+
const bottom = -hR / 2;
|
|
43714
|
+
profileSolid(kit, group, [[x0, 0.015, bottom + 0.012], [x0 + 0.035, 0.015, bottom], [x1, 0.015, bottom]], wR * 0.9, M.metal);
|
|
43715
|
+
profileSolid(kit, group, [[x0 + 2e-3, 0.021, 0.012], [x0 + RL * 0.5, 0.027, 0.012], [x1 - 4e-3, 0.031, 0.012]], wR * 0.8, M.metal);
|
|
43716
|
+
for (let i = 0; i < 4; i++) box5(group, 4e-3, 3e-3, wR * 0.6, M.dark, x0 + 0.03 + i * 0.012, 0.024 + i * 6e-4, 0);
|
|
43717
|
+
box5(group, 8e-3, 8e-3, 0.01, M.metal, x0 + 4e-3, 0.02, 0);
|
|
43718
|
+
profileSolid(kit, group, [[x1 - 8e-3, 0.034, by - 0.012], [x1 + 0.02, 0.031, by - 0.012], [x1 + 0.046, 0.024, by - 8e-3]], wR * 0.7, M.metal);
|
|
43719
|
+
box5(group, 0.036, 4e-3, wR * 0.5, M.dark, x1 + 0.018, 0.037, 0, -0.04);
|
|
43720
|
+
box5(group, 6e-3, 8e-3, wR * 0.5, M.dark, x1 + 2e-3, 0.039, 0);
|
|
43721
|
+
box5(group, RL * 0.48, 0.011, 3e-3, M.metal, x0 + RL * 0.36, 4e-3, wR * 0.46 + 15e-4, -0.05);
|
|
43722
|
+
box5(group, 0.012, 0.016, 3e-3, M.metal, x0 + RL * 0.62, -6e-3, wR * 0.46 + 15e-4, -0.3);
|
|
43723
|
+
for (const [x, y] of [[x0 + 0.012, -0.012], [x0 + 0.026, -0.012], [x1 - 0.03, -0.014], [x1 - 0.016, -0.014], [x1 - 0.03, 2e-3]]) {
|
|
43724
|
+
cylinderZ(group, 2e-3, wR * 0.9 + 2e-3, M.dark, x, y, 0, 8);
|
|
43725
|
+
}
|
|
43726
|
+
}
|
|
43727
|
+
var arcBand = (kit, parent, centre, radii, angles, depth, material) => {
|
|
43728
|
+
const { THREE } = kit;
|
|
43729
|
+
const geometry = sharedGeometry(kit, `arc:${JSON.stringify([centre, radii, angles, depth])}`, () => {
|
|
43730
|
+
const [inner, outer] = radii;
|
|
43731
|
+
const [start, end3] = angles;
|
|
43732
|
+
const shape = new THREE.Shape();
|
|
43733
|
+
shape.absarc(centre[0], centre[1], outer, start, end3, false);
|
|
43734
|
+
shape.absarc(centre[0], centre[1], inner, end3, start, true);
|
|
43735
|
+
shape.closePath();
|
|
43736
|
+
const bevel = Math.min(12e-4, depth / 6);
|
|
43737
|
+
const extruded = new THREE.ExtrudeGeometry(shape, { depth: depth - bevel * 2, curveSegments: 24, bevelEnabled: true, bevelThickness: bevel, bevelSize: bevel, bevelSegments: 1 });
|
|
43738
|
+
extruded.translate(0, 0, -(depth - bevel * 2) / 2);
|
|
43739
|
+
return extruded;
|
|
43740
|
+
});
|
|
43741
|
+
const mesh3 = new THREE.Mesh(geometry, material);
|
|
43742
|
+
mesh3.castShadow = true;
|
|
43743
|
+
mesh3.receiveShadow = true;
|
|
43744
|
+
parent.add(mesh3);
|
|
43745
|
+
return mesh3;
|
|
43746
|
+
};
|
|
43747
|
+
var CURVE_RADIUS = 0.33;
|
|
43748
|
+
var MAGAZINE_DEPTH2 = 0.052;
|
|
43749
|
+
var MAGAZINE_WIDTH = 0.024;
|
|
43750
|
+
var LENGTH_PER_SCALE = 0.2;
|
|
43751
|
+
function buildBananaMagazine(kit, magazine, material, scale) {
|
|
43752
|
+
const { M, box: box5 } = kit;
|
|
43753
|
+
const length2 = LENGTH_PER_SCALE * scale;
|
|
43754
|
+
const span = length2 / CURVE_RADIUS;
|
|
43755
|
+
const centre = [CURVE_RADIUS, 0];
|
|
43756
|
+
const start = Math.PI;
|
|
43757
|
+
const end3 = Math.PI + span;
|
|
43758
|
+
const half = MAGAZINE_DEPTH2 / 2;
|
|
43759
|
+
arcBand(kit, magazine, centre, [CURVE_RADIUS - half, CURVE_RADIUS + half], [start, end3], MAGAZINE_WIDTH, material);
|
|
43760
|
+
for (const radius of [CURVE_RADIUS - half * 0.45, CURVE_RADIUS + half * 0.45]) {
|
|
43761
|
+
arcBand(kit, magazine, centre, [radius - 25e-4, radius + 25e-4], [start + span * 0.08, end3 - span * 0.06], MAGAZINE_WIDTH + 3e-3, material);
|
|
43762
|
+
}
|
|
43763
|
+
box5(magazine, 0.01, 8e-3, MAGAZINE_WIDTH * 0.7, M.metal, half - 2e-3, 2e-3, 0);
|
|
43764
|
+
const bottom = [centre[0] + CURVE_RADIUS * Math.cos(end3), centre[1] + CURVE_RADIUS * Math.sin(end3)];
|
|
43765
|
+
const plate3 = box5(magazine, MAGAZINE_DEPTH2 + 6e-3, 6e-3, MAGAZINE_WIDTH + 4e-3, material, bottom[0], bottom[1], 0, span);
|
|
43766
|
+
plate3.position.x += Math.sin(span) * 2e-3;
|
|
43767
|
+
plate3.position.y -= Math.cos(span) * 2e-3;
|
|
43768
|
+
return length2 + 0.04;
|
|
43769
|
+
}
|
|
43770
|
+
|
|
43512
43771
|
// src/models/rifle-controls.ts
|
|
43513
43772
|
function buildGrip(context) {
|
|
43514
43773
|
const { kit, group, parts, options: o, furniture: furn, receiverStart: x0, receiverHeight: hR, receiverWidth: wR } = context;
|
|
@@ -43537,7 +43796,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
43537
43796
|
const magazine = kit.pivot(group, mx, -hR / 2, 0);
|
|
43538
43797
|
parts.mag = magazine;
|
|
43539
43798
|
const finish = o.magMat === "bakelite" ? M.bakelite : o.magMat === "poly" ? M.polyMag : o.magMat === "smoke" ? M.smoke : void 0;
|
|
43540
|
-
if (o.mag === "curved") {
|
|
43799
|
+
if (o.mag === "curved" && o.kalashnikov) {
|
|
43800
|
+
parts.magDrop = buildBananaMagazine(kit, magazine, finish ?? M.metal, scale);
|
|
43801
|
+
} else if (o.mag === "curved") {
|
|
43541
43802
|
let px = 0;
|
|
43542
43803
|
let py = 0;
|
|
43543
43804
|
const material = finish ?? M.metal;
|
|
@@ -43660,10 +43921,56 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
43660
43921
|
return { group, parts };
|
|
43661
43922
|
}
|
|
43662
43923
|
|
|
43924
|
+
// src/models/rifle-sporter.ts
|
|
43925
|
+
function buildSporterStock(context, magazineX) {
|
|
43926
|
+
const { kit, group, furniture: furn, length: L, stockLength: S, receiverEnd: x1, receiverHeight: hR } = context;
|
|
43927
|
+
const { M, box: box5 } = kit;
|
|
43928
|
+
const forendTip = x1 + (L - x1) * (context.options.fore ?? 0.5);
|
|
43929
|
+
const bottom = -hR / 2;
|
|
43930
|
+
const bedTop = context.options.round ? context.barrelY - hR * 0.36 + 3e-3 : bottom + 0.012;
|
|
43931
|
+
profileSolid(
|
|
43932
|
+
kit,
|
|
43933
|
+
group,
|
|
43934
|
+
[
|
|
43935
|
+
[6e-3, -0.016, -0.15],
|
|
43936
|
+
[0.14, -0.012, -0.118],
|
|
43937
|
+
[S - 0.11, -0.016, -0.084],
|
|
43938
|
+
[S - 0.05, -0.018, -0.114],
|
|
43939
|
+
[S - 0.01, -0.016, -0.09],
|
|
43940
|
+
[S + 0.03, bedTop, bottom - 0.03],
|
|
43941
|
+
[x1, bedTop, bottom - 0.026],
|
|
43942
|
+
[x1 + 0.08, bedTop, bottom - 0.024],
|
|
43943
|
+
[forendTip, bottom + 0.02, bottom - 0.012]
|
|
43944
|
+
],
|
|
43945
|
+
0.04,
|
|
43946
|
+
furn
|
|
43947
|
+
);
|
|
43948
|
+
buttpad(kit, group, 0, -0.083, 0.136, 0.04);
|
|
43949
|
+
box5(group, 0.024, 6e-3, 0.03, M.dark, S - 0.05, -0.116, 0, -0.5);
|
|
43950
|
+
const guard = kit.torus(group, new kit.THREE.TorusGeometry(0.024, 25e-4, 6, 16, Math.PI), M.metal, S + 0.075, bottom - 0.022, 0);
|
|
43951
|
+
guard.rotation.z = Math.PI;
|
|
43952
|
+
box5(group, 0.07, 4e-3, 0.03, M.metal, magazineX, bottom - 0.03, 0);
|
|
43953
|
+
swivel(kit, group, 0.12, -0.12);
|
|
43954
|
+
swivel(kit, group, forendTip - 0.05, bottom - 0.02);
|
|
43955
|
+
}
|
|
43956
|
+
function buildKalashnikovStock(context) {
|
|
43957
|
+
const { kit, group, furniture: furn, stockLength: S, receiverHeight: hR } = context;
|
|
43958
|
+
const { M, box: box5 } = kit;
|
|
43959
|
+
profileSolid(kit, group, [[8e-3, -0.034, -0.15], [S * 0.5, -0.014, -0.1], [S + 4e-3, hR * 0.2, -hR / 2 - 2e-3]], 0.036, furn);
|
|
43960
|
+
box5(group, 8e-3, 0.118, 0.038, M.metal, 4e-3, -0.092, 0, -0.06);
|
|
43961
|
+
const loopX = 0.1;
|
|
43962
|
+
const belly = -0.15 + (loopX - 8e-3) / (S * 0.5 - 8e-3) * 0.05;
|
|
43963
|
+
box5(group, 0.03, 6e-3, 6e-3, M.metal, loopX, belly + 0.032, -0.019, 0.3);
|
|
43964
|
+
}
|
|
43965
|
+
|
|
43663
43966
|
// src/models/rifle-stock.ts
|
|
43664
43967
|
function buildStock(context, magazineX) {
|
|
43665
43968
|
const { kit, group, options: o, furniture: furn, length: L, stockLength: S, receiverStart: x0, receiverEnd: x1, receiverHeight: hR } = context;
|
|
43666
43969
|
const { M, box: box5, cylinderX } = kit;
|
|
43970
|
+
if (o.stock === "sporter") {
|
|
43971
|
+
buildSporterStock(context, magazineX);
|
|
43972
|
+
return;
|
|
43973
|
+
}
|
|
43667
43974
|
if (context.isTraditional) {
|
|
43668
43975
|
buttpad(kit, group, 6e-3, -0.04, 0.13, 0.038);
|
|
43669
43976
|
box5(group, 0.03, 0.13, 0.038, furn, 0.024, -0.04, 0);
|
|
@@ -43695,6 +44002,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
43695
44002
|
buttpad(kit, group, 3e-3, -0.025, 0.11, 0.036);
|
|
43696
44003
|
} else if (o.stock === "g36") {
|
|
43697
44004
|
buildG36Stock(context);
|
|
44005
|
+
} else if (o.stock === "ak") {
|
|
44006
|
+
buildKalashnikovStock(context);
|
|
44007
|
+
} else if (o.stock === "svd") {
|
|
44008
|
+
buildSvdStock(context);
|
|
43698
44009
|
} else if (o.stock === "fold") {
|
|
43699
44010
|
box5(group, S, 6e-3, 6e-3, M.metal, S / 2, 0.01, 0.012);
|
|
43700
44011
|
box5(group, S, 6e-3, 6e-3, M.metal, S / 2, -0.04, 0.012, -0.12);
|
|
@@ -43710,6 +44021,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
43710
44021
|
const receiverMaterial = o.tan ? M.tan : M.metal;
|
|
43711
44022
|
const middle = (x0 + x1) / 2;
|
|
43712
44023
|
if (o.g36) buildG36Receiver(context);
|
|
44024
|
+
else if (o.kalashnikov) buildKalashnikovReceiver(context);
|
|
43713
44025
|
else if (o.round) {
|
|
43714
44026
|
cylinderX(group, hR * 0.36, RL, M.steel, middle, by, 0, 20);
|
|
43715
44027
|
cylinderX(group, hR * 0.32, 0.05, M.steel, x0 - 0.01, by, 0, 18);
|
|
@@ -43722,7 +44034,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
43722
44034
|
box5(group, 0.03, 8e-3, 0.012, M.dark, x0 + 0.02, hR / 2 + 4e-3, 0);
|
|
43723
44035
|
box5(group, 0.012, 6e-3, 4e-3, M.dark, x0 + RL * 0.55, -hR * 0.15, -wR / 2 - 2e-3);
|
|
43724
44036
|
} else box5(group, RL, hR, wR, receiverMaterial, middle, 0, 0);
|
|
43725
|
-
if (o.ak) {
|
|
44037
|
+
if (o.ak && !o.kalashnikov) {
|
|
43726
44038
|
box5(group, RL * 0.86, hR * 0.28, wR * 0.95, M.metal, middle - 8e-3, hR / 2 + 4e-3, 0);
|
|
43727
44039
|
for (let i = 0; i < 3; i++) box5(group, 4e-3, hR * 0.3, wR * 0.97, M.dark, x0 + RL * 0.25 + i * 0.02, hR / 2 + 4e-3, 0);
|
|
43728
44040
|
box5(group, RL * 0.5, 0.012, 3e-3, M.metal, x0 + RL * 0.55, -hR * 0.02, wR / 2 + 15e-4, -0.05);
|
|
@@ -43785,7 +44097,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
43785
44097
|
const parts = { family: "rifle", glow: [] };
|
|
43786
44098
|
const length2 = (options.L ?? 0) / 1e3;
|
|
43787
44099
|
const barrelLength = (options.B ?? 0) / 1e3;
|
|
43788
|
-
const isTraditional = options.stock === "trad" || options.stock === "straight";
|
|
44100
|
+
const isTraditional = options.stock === "trad" || options.stock === "straight" || options.stock === "sporter";
|
|
43789
44101
|
const stockLength = options.stock === "none" ? 0 : options.stockLen || Math.min(0.36, Math.max(0.2, 0.3 * length2));
|
|
43790
44102
|
const receiverStart = stockLength;
|
|
43791
44103
|
const receiverEnd = Math.max(receiverStart + 0.12, length2 - barrelLength * 0.92);
|
|
@@ -44718,7 +45030,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
44718
45030
|
|
|
44719
45031
|
// src/models/ps90.ts
|
|
44720
45032
|
var WIDTH = 0.046;
|
|
44721
|
-
var
|
|
45033
|
+
var BEVEL3 = 5e-3;
|
|
44722
45034
|
var BODY_OUTLINE = [
|
|
44723
45035
|
[0.017, -0.078],
|
|
44724
45036
|
[0.03, -0.09],
|
|
@@ -44760,8 +45072,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
44760
45072
|
const toVector = ([x, y]) => new THREE.Vector2(x, y);
|
|
44761
45073
|
const shape = new THREE.Shape(outline.map(toVector));
|
|
44762
45074
|
for (const hole of holes) shape.holes.push(new THREE.Path(hole.map(toVector)));
|
|
44763
|
-
const geometry = new THREE.ExtrudeGeometry(shape, { depth: width - 2 *
|
|
44764
|
-
geometry.translate(0, 0, -(width - 2 *
|
|
45075
|
+
const geometry = new THREE.ExtrudeGeometry(shape, { depth: width - 2 * BEVEL3, bevelEnabled: true, bevelThickness: BEVEL3, bevelSize: BEVEL3, bevelSegments: 2 });
|
|
45076
|
+
geometry.translate(0, 0, -(width - 2 * BEVEL3) / 2);
|
|
44765
45077
|
const mesh3 = new THREE.Mesh(geometry, material);
|
|
44766
45078
|
mesh3.castShadow = true;
|
|
44767
45079
|
mesh3.receiveShadow = true;
|
|
@@ -45034,6 +45346,135 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
45034
45346
|
return { group, parts };
|
|
45035
45347
|
}
|
|
45036
45348
|
|
|
45349
|
+
// src/models/pistol-deagle.ts
|
|
45350
|
+
var SLIDE_HEIGHT = 0.036;
|
|
45351
|
+
var WIDTH2 = 0.032;
|
|
45352
|
+
var FRAME_HEIGHT = 0.015;
|
|
45353
|
+
var FRAME_BOTTOM = -SLIDE_HEIGHT / 2 - FRAME_HEIGHT;
|
|
45354
|
+
var GRIP = { angle: -0.314, depth: 0.052, width: 0.034, length: 0.1, rearX: 0.014 };
|
|
45355
|
+
var GUARD = { drop: 0.038, front: 0.064, bar: 65e-4, depth: 0.011 };
|
|
45356
|
+
var SLIDE_SHARE = 0.55;
|
|
45357
|
+
var plate = (kit, parent, outline, hole, depth, material) => {
|
|
45358
|
+
const { THREE } = kit;
|
|
45359
|
+
const geometry = sharedGeometry(kit, `plate:${JSON.stringify([outline, hole, depth])}`, () => {
|
|
45360
|
+
const shape = new THREE.Shape(outline.map(([x, y]) => new THREE.Vector2(x, y)));
|
|
45361
|
+
if (hole) shape.holes.push(new THREE.Path(hole.map(([x, y]) => new THREE.Vector2(x, y))));
|
|
45362
|
+
const extruded = new THREE.ExtrudeGeometry(shape, { depth, bevelEnabled: true, bevelThickness: 8e-4, bevelSize: 8e-4, bevelSegments: 1 });
|
|
45363
|
+
extruded.translate(0, 0, -depth / 2);
|
|
45364
|
+
return extruded;
|
|
45365
|
+
});
|
|
45366
|
+
const mesh3 = new THREE.Mesh(geometry, material);
|
|
45367
|
+
mesh3.castShadow = true;
|
|
45368
|
+
mesh3.receiveShadow = true;
|
|
45369
|
+
parent.add(mesh3);
|
|
45370
|
+
return mesh3;
|
|
45371
|
+
};
|
|
45372
|
+
var buildUpper = (kit, group, slide2, parts, length2, metal2) => {
|
|
45373
|
+
const { M, box: box5, cylinderX } = kit;
|
|
45374
|
+
const slideLength = length2 * SLIDE_SHARE;
|
|
45375
|
+
const barrelLength = length2 - slideLength;
|
|
45376
|
+
kit.roundness = 0.06;
|
|
45377
|
+
box5(slide2, slideLength, SLIDE_HEIGHT, WIDTH2, metal2, slideLength / 2, 0, 0);
|
|
45378
|
+
const barrel = heatify(parts.glow ?? [], box5(group, barrelLength, SLIDE_HEIGHT, WIDTH2, metal2, slideLength + barrelLength / 2, 0, 0));
|
|
45379
|
+
barrel.name = "barrel";
|
|
45380
|
+
kit.roundness = null;
|
|
45381
|
+
box5(group, 12e-4, SLIDE_HEIGHT * 0.9, WIDTH2 + 4e-4, M.dark, slideLength, 0, 0);
|
|
45382
|
+
for (let i = 0; i < 9; i++) box5(slide2, 22e-4, SLIDE_HEIGHT * 0.66, WIDTH2 + 12e-4, M.dark, 8e-3 + i * 48e-4, -3e-3, 0);
|
|
45383
|
+
box5(slide2, length2 * 0.08, 3e-3, WIDTH2 * 0.5, M.hole, length2 * 0.42, SLIDE_HEIGHT / 2, WIDTH2 * 0.12);
|
|
45384
|
+
box5(slide2, 7e-3, 6e-3, 0.014, M.dark, 8e-3, SLIDE_HEIGHT / 2 + 3e-3, 0);
|
|
45385
|
+
box5(slide2, 3e-3, 2e-3, 4e-3, M.hole, 8e-3, SLIDE_HEIGHT / 2 + 5e-3, 0);
|
|
45386
|
+
box5(group, barrelLength * 0.9, 4e-3, WIDTH2 * 0.42, metal2, slideLength + barrelLength * 0.5, SLIDE_HEIGHT / 2 + 2e-3, 0);
|
|
45387
|
+
for (let i = 0; i < 7; i++) box5(group, 4e-3, 15e-4, WIDTH2 * 0.43, M.hole, slideLength + 0.01 + i * 0.013, SLIDE_HEIGHT / 2 + 4e-3, 0);
|
|
45388
|
+
box5(group, 4e-3, 6e-3, 4e-3, M.dark, length2 - 6e-3, SLIDE_HEIGHT / 2 + 6e-3, 0);
|
|
45389
|
+
const nose = plate(kit, group, [[-WIDTH2 / 2, -SLIDE_HEIGHT / 2 + 2e-3], [WIDTH2 / 2, -SLIDE_HEIGHT / 2 + 2e-3], [WIDTH2 * 0.16, SLIDE_HEIGHT / 2 - 2e-3], [-WIDTH2 * 0.16, SLIDE_HEIGHT / 2 - 2e-3]], null, 3e-3, metal2);
|
|
45390
|
+
nose.rotation.y = Math.PI / 2;
|
|
45391
|
+
nose.position.set(length2 + 15e-4, 0, 0);
|
|
45392
|
+
const boreY = -SLIDE_HEIGHT * 0.12;
|
|
45393
|
+
cylinderX(group, 64e-4, 4e-3, M.hole, length2 + 3e-3, boreY, 0, 14);
|
|
45394
|
+
return boreY;
|
|
45395
|
+
};
|
|
45396
|
+
var buildGrip2 = (kit, group, parts, metal2) => {
|
|
45397
|
+
const { M, box: box5 } = kit;
|
|
45398
|
+
const { angle, depth, width, length: length2 } = GRIP;
|
|
45399
|
+
const sin2 = Math.sin(angle);
|
|
45400
|
+
const cos2 = Math.cos(angle);
|
|
45401
|
+
const topY = FRAME_BOTTOM + 6e-3;
|
|
45402
|
+
const centerX = GRIP.rearX + depth / 2 * cos2 + length2 / 2 * sin2;
|
|
45403
|
+
const centerY = topY - length2 / 2 * cos2 + depth / 2 * sin2;
|
|
45404
|
+
const grip = kit.pivot(group, centerX, centerY, 0);
|
|
45405
|
+
grip.rotation.z = angle;
|
|
45406
|
+
parts.grip = grip;
|
|
45407
|
+
kit.roundness = 0.22;
|
|
45408
|
+
box5(grip, depth, length2, width * 0.86, metal2, 0, 0, 0);
|
|
45409
|
+
box5(grip, depth * 0.86, length2 * 0.84, width, M.rubber, -2e-3, 2e-3, 0);
|
|
45410
|
+
kit.roundness = null;
|
|
45411
|
+
for (let i = 0; i < 8; i++) box5(grip, depth * 0.66, 2e-3, width + 12e-4, M.dark, -3e-3, -length2 * 0.36 + i * 0.0105, 0);
|
|
45412
|
+
const magazine = kit.pivot(grip);
|
|
45413
|
+
parts.mag = magazine;
|
|
45414
|
+
parts.magDrop = length2 * 1.15;
|
|
45415
|
+
box5(magazine, depth * 0.62, length2 * 0.94, width * 0.66, M.dark, 2e-3, -4e-3, 0);
|
|
45416
|
+
box5(magazine, depth * 0.98, 6e-3, width * 0.9, metal2, 0, -length2 / 2 + 3e-3, 0);
|
|
45417
|
+
const frontTopX = centerX + depth / 2 * cos2 - length2 / 2 * sin2;
|
|
45418
|
+
const frontTopY = centerY + depth / 2 * sin2 + length2 / 2 * cos2;
|
|
45419
|
+
return (y) => frontTopX + (frontTopY - y) * Math.tan(angle);
|
|
45420
|
+
};
|
|
45421
|
+
var buildGuard = (kit, group, frontStrapAt, metal2) => {
|
|
45422
|
+
const top = FRAME_BOTTOM + 2e-3;
|
|
45423
|
+
const bottom = FRAME_BOTTOM - GUARD.drop;
|
|
45424
|
+
const backTop = frontStrapAt(top) - 4e-3;
|
|
45425
|
+
const backBottom = frontStrapAt(bottom) - 4e-3;
|
|
45426
|
+
const front = backTop + GUARD.front;
|
|
45427
|
+
const bar2 = GUARD.bar;
|
|
45428
|
+
const corner = 8e-3;
|
|
45429
|
+
const outline = [
|
|
45430
|
+
[backTop, top],
|
|
45431
|
+
[backBottom, bottom],
|
|
45432
|
+
[front - corner, bottom],
|
|
45433
|
+
[front, bottom + corner],
|
|
45434
|
+
[front + 2e-3, top]
|
|
45435
|
+
];
|
|
45436
|
+
const hole = [
|
|
45437
|
+
[backTop + bar2 + 2e-3, top - 2e-3],
|
|
45438
|
+
[front - bar2 + 1e-3, top - 2e-3],
|
|
45439
|
+
[front - bar2, bottom + bar2 + corner * 0.6],
|
|
45440
|
+
[front - bar2 - corner * 0.6, bottom + bar2],
|
|
45441
|
+
[backBottom + bar2 + 4e-3, bottom + bar2]
|
|
45442
|
+
];
|
|
45443
|
+
plate(kit, group, outline, hole, GUARD.depth, metal2);
|
|
45444
|
+
return bottom;
|
|
45445
|
+
};
|
|
45446
|
+
function buildDeagle(kit, options) {
|
|
45447
|
+
const { M, box: box5, torus: torus2, THREE } = kit;
|
|
45448
|
+
const length2 = (options.L ?? 0) / 1e3 * 0.97;
|
|
45449
|
+
const metal2 = options.chrome ? M.chrome : options.steel ? M.steel : options.stain ? M.steelL : M.metal;
|
|
45450
|
+
const group = kit.group();
|
|
45451
|
+
const parts = { family: "pistol", kick: 1.8, glow: [] };
|
|
45452
|
+
const slide2 = kit.pivot(group);
|
|
45453
|
+
parts.slide = slide2;
|
|
45454
|
+
parts.stroke = length2 * 0.12;
|
|
45455
|
+
const boreY = buildUpper(kit, group, slide2, parts, length2, metal2);
|
|
45456
|
+
kit.roundness = 0.1;
|
|
45457
|
+
box5(group, length2 * 0.95, FRAME_HEIGHT, WIDTH2 * 0.94, metal2, length2 * 0.5 - 2e-3, -SLIDE_HEIGHT / 2 - FRAME_HEIGHT / 2, 0);
|
|
45458
|
+
kit.roundness = null;
|
|
45459
|
+
box5(group, length2 * 0.3, 3e-3, WIDTH2 * 0.94 + 1e-3, M.dark, length2 * 0.72, -SLIDE_HEIGHT / 2 - FRAME_HEIGHT * 0.6, 0);
|
|
45460
|
+
box5(group, 0.026, 9e-3, WIDTH2 * 0.9, metal2, -2e-3, FRAME_BOTTOM + 4e-3, 0, 0.3);
|
|
45461
|
+
box5(group, 0.016, 5e-3, 4e-3, M.dark, length2 * 0.36, -SLIDE_HEIGHT / 2 - 5e-3, -WIDTH2 / 2 - 14e-4);
|
|
45462
|
+
const frontStrapAt = buildGrip2(kit, group, parts, metal2);
|
|
45463
|
+
buildGuard(kit, group, frontStrapAt, metal2);
|
|
45464
|
+
const triggerX = frontStrapAt(FRAME_BOTTOM) + 0.02;
|
|
45465
|
+
parts.trigger = box5(group, 6e-3, 0.026, 7e-3, M.steel, triggerX, FRAME_BOTTOM - 8e-3, 0, 0.28);
|
|
45466
|
+
const hammer2 = kit.pivot(group, 2e-3, SLIDE_HEIGHT * 0.05, 0);
|
|
45467
|
+
parts.hammer = hammer2;
|
|
45468
|
+
box5(hammer2, 0.012, 0.02, 0.01, M.dark, -4e-3, 4e-3, 0, 0.35);
|
|
45469
|
+
const ring3 = torus2(hammer2, new THREE.TorusGeometry(68e-4, 24e-4, 8, 16), M.dark, -0.01, 0.014, 0);
|
|
45470
|
+
ring3.scale.z = 2;
|
|
45471
|
+
parts.safety = box5(slide2, 0.014, 8e-3, 4e-3, M.dark, 0.02, SLIDE_HEIGHT * 0.1, -WIDTH2 / 2 - 2e-3, 0.2);
|
|
45472
|
+
box5(slide2, 0.014, 8e-3, 4e-3, M.dark, 0.02, SLIDE_HEIGHT * 0.1, WIDTH2 / 2 + 2e-3, 0.2);
|
|
45473
|
+
parts.muzzle = kit.mark(group, length2 + 6e-3, boreY, 0);
|
|
45474
|
+
parts.eject = kit.mark(group, length2 * 0.42, SLIDE_HEIGHT / 2, WIDTH2 * 0.25);
|
|
45475
|
+
return { group, parts };
|
|
45476
|
+
}
|
|
45477
|
+
|
|
45037
45478
|
// src/models/pistol-slide.ts
|
|
45038
45479
|
var PI9 = Math.PI;
|
|
45039
45480
|
function buildSlide(kit, slide2, parts, options, style, size, metal2) {
|
|
@@ -45186,6 +45627,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
45186
45627
|
}
|
|
45187
45628
|
function buildPistol(kit, options) {
|
|
45188
45629
|
if (options.design && isDesignName(options.design)) return buildDesignedPistol(kit, options, options.design);
|
|
45630
|
+
if (options.st === "deagle") return buildDeagle(kit, options);
|
|
45189
45631
|
const { M, box: box5 } = kit;
|
|
45190
45632
|
const style = { ...STYLES[options.st ?? "glock"] };
|
|
45191
45633
|
const group = kit.group();
|
|
@@ -45358,32 +45800,6 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
45358
45800
|
return { group, parts };
|
|
45359
45801
|
}
|
|
45360
45802
|
|
|
45361
|
-
// src/models/wood-profile.ts
|
|
45362
|
-
var SLICE_LENGTH = 0.02;
|
|
45363
|
-
var at2 = (points, x) => {
|
|
45364
|
-
const last = points[points.length - 1];
|
|
45365
|
-
if (x >= last[0]) return [last[1], last[2]];
|
|
45366
|
-
const nextIndex = points.findIndex((point) => point[0] >= x);
|
|
45367
|
-
const next = points[Math.max(nextIndex, 1)];
|
|
45368
|
-
const previous = points[Math.max(nextIndex, 1) - 1];
|
|
45369
|
-
const fraction = (x - previous[0]) / (next[0] - previous[0]);
|
|
45370
|
-
return [previous[1] + (next[1] - previous[1]) * fraction, previous[2] + (next[2] - previous[2]) * fraction];
|
|
45371
|
-
};
|
|
45372
|
-
function profileBlock(kit, parent, points, width, material) {
|
|
45373
|
-
const first = points[0];
|
|
45374
|
-
const last = points[points.length - 1];
|
|
45375
|
-
const count = Math.max(1, Math.ceil((last[0] - first[0]) / SLICE_LENGTH));
|
|
45376
|
-
const step = (last[0] - first[0]) / count;
|
|
45377
|
-
for (let index = 0; index < count; index++) {
|
|
45378
|
-
const [rearTop, rearBottom] = at2(points, first[0] + step * index);
|
|
45379
|
-
const [frontTop, frontBottom] = at2(points, first[0] + step * (index + 1));
|
|
45380
|
-
const rise = (frontTop + frontBottom - rearTop - rearBottom) / 2;
|
|
45381
|
-
const height = (frontTop - frontBottom + rearTop - rearBottom) / 2;
|
|
45382
|
-
const centre = (rearTop + rearBottom + frontTop + frontBottom) / 4;
|
|
45383
|
-
kit.box(parent, Math.hypot(step, rise) * 1.12, height, width, material, first[0] + step * (index + 0.5), centre, 0, Math.atan2(rise, step));
|
|
45384
|
-
}
|
|
45385
|
-
}
|
|
45386
|
-
|
|
45387
45803
|
// src/models/rifle-kar98.ts
|
|
45388
45804
|
var RECEIVER_START3 = 0.29;
|
|
45389
45805
|
var RECEIVER_END3 = 0.5;
|
|
@@ -45926,14 +46342,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
45926
46342
|
movable: false
|
|
45927
46343
|
};
|
|
45928
46344
|
}
|
|
45929
|
-
function
|
|
45930
|
-
const name = arsenal.name(weapon);
|
|
46345
|
+
function showcasePhoto(arsenal, text, weapon) {
|
|
45931
46346
|
const photo2 = PHOTOS[weapon];
|
|
45932
|
-
if (!photo2) return
|
|
45933
|
-
return {
|
|
46347
|
+
if (!photo2) return void 0;
|
|
46348
|
+
return { url: photo2.url, alt: fill(text.alt, { weapon: arsenal.name(weapon) }), credit: `${photo2.author} \xB7 ${photo2.license}`, page: photo2.page };
|
|
45934
46349
|
}
|
|
45935
46350
|
function createWeaponShowcase(options) {
|
|
45936
|
-
const { arsenal, host, text } = options;
|
|
46351
|
+
const { arsenal, host, text, referencePhotos = false } = options;
|
|
45937
46352
|
const THREE = host.THREE;
|
|
45938
46353
|
const scene = host.scene;
|
|
45939
46354
|
const centre = [SHOWCASE.at[0], SHOWCASE.height + SHOWCASE.lift, SHOWCASE.at[2]];
|
|
@@ -45943,7 +46358,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
45943
46358
|
if (!shown) return;
|
|
45944
46359
|
discardObject3D(shown.root);
|
|
45945
46360
|
shown = null;
|
|
45946
|
-
host.
|
|
46361
|
+
if (referencePhotos) host.cornerImage?.(null);
|
|
45947
46362
|
};
|
|
45948
46363
|
const look = () => host.bench?.look([centre[0] + SHOWCASE.eye[0], centre[1] + SHOWCASE.eye[1], centre[2] + SHOWCASE.eye[2]], centre);
|
|
45949
46364
|
const show = (weapon) => {
|
|
@@ -45957,7 +46372,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
45957
46372
|
holder.position.set(...centre);
|
|
45958
46373
|
scene.add(holder);
|
|
45959
46374
|
shown = { id: weapon, root: holder };
|
|
45960
|
-
host.
|
|
46375
|
+
if (referencePhotos) host.cornerImage?.(showcasePhoto(arsenal, text, weapon) ?? null);
|
|
45961
46376
|
host.log(fill(text.shown, { weapon: arsenal.name(weapon) }), { weapon, photo: weapon in PHOTOS });
|
|
45962
46377
|
look();
|
|
45963
46378
|
};
|
|
@@ -45990,26 +46405,22 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
45990
46405
|
en: {
|
|
45991
46406
|
pedestal: "Weapon showcase",
|
|
45992
46407
|
weapon: "Showcase",
|
|
45993
|
-
weaponHint: "Puts the weapon on the pedestal, turning slowly, takes the camera to it
|
|
46408
|
+
weaponHint: "Puts the weapon on the pedestal, turning slowly, and takes the camera to it",
|
|
45994
46409
|
none: "None",
|
|
45995
46410
|
spin: "Turn the weapon",
|
|
45996
46411
|
look: "Look at the showcase",
|
|
45997
|
-
kicker: "The real weapon",
|
|
45998
46412
|
alt: "Photo of a real {weapon}",
|
|
45999
|
-
shown: "{weapon} on the showcase"
|
|
46000
|
-
noPhoto: "No free photo of this exact model was found: it is listed in missing of assets/weapon-references.json."
|
|
46413
|
+
shown: "{weapon} on the showcase"
|
|
46001
46414
|
},
|
|
46002
46415
|
"pt-BR": {
|
|
46003
46416
|
pedestal: "Vitrine de armas",
|
|
46004
46417
|
weapon: "Vitrine",
|
|
46005
|
-
weaponHint: "P\xF5e a arma no pedestal, girando devagar, leva a c\xE2mera at\xE9 ela
|
|
46418
|
+
weaponHint: "P\xF5e a arma no pedestal, girando devagar, e leva a c\xE2mera at\xE9 ela",
|
|
46006
46419
|
none: "Nenhuma",
|
|
46007
46420
|
spin: "Girar a arma",
|
|
46008
46421
|
look: "Olhar a vitrine",
|
|
46009
|
-
kicker: "A arma real",
|
|
46010
46422
|
alt: "Foto de um(a) {weapon} real",
|
|
46011
|
-
shown: "{weapon} na vitrine"
|
|
46012
|
-
noPhoto: "N\xE3o h\xE1 foto livre deste modelo exato: ele est\xE1 em missing de assets/weapon-references.json."
|
|
46423
|
+
shown: "{weapon} na vitrine"
|
|
46013
46424
|
}
|
|
46014
46425
|
};
|
|
46015
46426
|
var showcaseTextOf = (locale) => TEXT[locale] ?? TEXT.en;
|
|
@@ -47943,7 +48354,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
47943
48354
|
const registry = createSoundRegistry(options.banks);
|
|
47944
48355
|
const voices = createVoiceManager({ ...options.groups ? { groups: options.groups } : {}, ...options.maxVoices === void 0 ? {} : { maxVoices: options.maxVoices } });
|
|
47945
48356
|
const engineRandom = createRng3(seed);
|
|
47946
|
-
const
|
|
48357
|
+
const shared3 = createNoiseStore(engineRandom);
|
|
47947
48358
|
const busSettings = /* @__PURE__ */ new Map();
|
|
47948
48359
|
const busNodes = /* @__PURE__ */ new Map();
|
|
47949
48360
|
const meters = /* @__PURE__ */ new Map();
|
|
@@ -48019,7 +48430,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
48019
48430
|
if (!created) return null;
|
|
48020
48431
|
context = created;
|
|
48021
48432
|
chain = buildChain(created, mix3, engineRandom);
|
|
48022
|
-
if (mix3.noise.create === "eager") noiseBuffer(
|
|
48433
|
+
if (mix3.noise.create === "eager") noiseBuffer(shared3, created, mix3.noise.seconds);
|
|
48023
48434
|
for (const [bus, setting] of Object.entries(mix3.buses ?? {})) {
|
|
48024
48435
|
busSettings.set(bus, { ...setting, ...busSettings.get(bus) });
|
|
48025
48436
|
}
|
|
@@ -48245,8 +48656,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
48245
48656
|
const loopHost = {
|
|
48246
48657
|
ready,
|
|
48247
48658
|
output: outputFor,
|
|
48248
|
-
prepareNoise: () => context && prepareNoise(
|
|
48249
|
-
noise: () => noiseBuffer(
|
|
48659
|
+
prepareNoise: () => context && prepareNoise(shared3, context, mix3.noise.seconds),
|
|
48660
|
+
noise: () => noiseBuffer(shared3, context, mix3.noise.seconds),
|
|
48250
48661
|
register: (loop) => void loops.add(loop),
|
|
48251
48662
|
unregister: (loop) => void loops.delete(loop),
|
|
48252
48663
|
listener: () => listener,
|
|
@@ -48291,7 +48702,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
48291
48702
|
watchers.add(listener2);
|
|
48292
48703
|
return () => void watchers.delete(listener2);
|
|
48293
48704
|
},
|
|
48294
|
-
play: (id, playOptions = {}) => playWith(id, playOptions, randomFor(playOptions),
|
|
48705
|
+
play: (id, playOptions = {}) => playWith(id, playOptions, randomFor(playOptions), shared3),
|
|
48295
48706
|
playPlan(plan, playOptions = {}) {
|
|
48296
48707
|
const audio = ready();
|
|
48297
48708
|
if (!audio) return null;
|
|
@@ -48299,8 +48710,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
48299
48710
|
const recipe2 = { id: plan.id, bus: plan.bus, layers: [], sources: [], priority: plan.priority, ...plan.group ? { group: plan.group } : {} };
|
|
48300
48711
|
const voiceId = plan.silent ? void 0 : admit(recipe2, plan.level, plan.distance);
|
|
48301
48712
|
if (voiceId === null) return null;
|
|
48302
|
-
if (planUsesNoise(plan)) prepareNoise(
|
|
48303
|
-
return start(plan,
|
|
48713
|
+
if (planUsesNoise(plan)) prepareNoise(shared3, audio, mix3.noise.seconds);
|
|
48714
|
+
return start(plan, shared3, voiceId, playOptions.delay);
|
|
48304
48715
|
},
|
|
48305
48716
|
loop(id, loopOptions = {}) {
|
|
48306
48717
|
const sample = registry.sample(id);
|
|
@@ -48326,7 +48737,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
48326
48737
|
},
|
|
48327
48738
|
channel(channelOptions) {
|
|
48328
48739
|
const random = channelOptions.random ?? (channelOptions.seed === void 0 ? engineRandom : createRng3(channelOptions.seed));
|
|
48329
|
-
const store = channelOptions.ownNoise ? createNoiseStore(random) :
|
|
48740
|
+
const store = channelOptions.ownNoise ? createNoiseStore(random) : shared3;
|
|
48330
48741
|
return {
|
|
48331
48742
|
random,
|
|
48332
48743
|
play: (id, playOptions = {}) => playWith(id, playOptions, random, store),
|
|
@@ -48348,7 +48759,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
48348
48759
|
if (!context || !chain) return;
|
|
48349
48760
|
const old = chain;
|
|
48350
48761
|
chain = buildChain(context, mix3, engineRandom);
|
|
48351
|
-
if (mix3.noise.seconds !== previous.noise.seconds)
|
|
48762
|
+
if (mix3.noise.seconds !== previous.noise.seconds) shared3.reset();
|
|
48352
48763
|
for (const node of busNodes.values()) {
|
|
48353
48764
|
node.disconnect();
|
|
48354
48765
|
node.connect(chain.master);
|
|
@@ -48367,7 +48778,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
48367
48778
|
warmUp() {
|
|
48368
48779
|
const audio = ready();
|
|
48369
48780
|
if (!audio) return false;
|
|
48370
|
-
noiseBuffer(
|
|
48781
|
+
noiseBuffer(shared3, audio, mix3.noise.seconds);
|
|
48371
48782
|
return true;
|
|
48372
48783
|
},
|
|
48373
48784
|
level(bus) {
|
|
@@ -48403,7 +48814,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
48403
48814
|
chain = null;
|
|
48404
48815
|
busNodes.clear();
|
|
48405
48816
|
meters.clear();
|
|
48406
|
-
|
|
48817
|
+
shared3.reset();
|
|
48407
48818
|
sampleStore.clear();
|
|
48408
48819
|
memory.clear();
|
|
48409
48820
|
sampleLimiters.clear();
|
|
@@ -51649,15 +52060,15 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
51649
52060
|
const distanceCurve = { ...GAME_DISTANCE_CURVE, ...options.distance };
|
|
51650
52061
|
const mechanicalTable = { ...MECHANICAL_SOUNDS, ...options.mechanical };
|
|
51651
52062
|
const cueTable = { ...RELOAD_CUES, ...options.reloadCues };
|
|
51652
|
-
const
|
|
51653
|
-
if (!
|
|
51654
|
-
const engine =
|
|
52063
|
+
const shared3 = options.engine;
|
|
52064
|
+
if (!shared3) warnOnce("game-weapons-three.own-audio-engine", "game-weapons-three made an audio engine of its own because the host lent none (options.engine); pass the host engine so the sounds share one mix and one voice limit");
|
|
52065
|
+
const engine = shared3 ?? createAudioEngine({
|
|
51655
52066
|
seed,
|
|
51656
52067
|
mix: { ...MIX_PROFILES.game, master: volume, noise: { seconds: NOISE_SECONDS, create: "eager" } },
|
|
51657
52068
|
maxVoices: Number.POSITIVE_INFINITY,
|
|
51658
52069
|
...options.createContext ? { createContext: options.createContext } : {}
|
|
51659
52070
|
});
|
|
51660
|
-
const channel =
|
|
52071
|
+
const channel = shared3 && options.seed !== void 0 ? shared3.channel({ seed }) : engine.channel({});
|
|
51661
52072
|
engine.register({ id: `weapons_three@${classBurstId(distanceCurve)}`, sounds: weaponRecipes(distanceCurve) });
|
|
51662
52073
|
const classBurst = classBurstId(distanceCurve);
|
|
51663
52074
|
const sampleBank = options.samples ? weaponSampleBank(options.samples) : null;
|
|
@@ -51860,11 +52271,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
51860
52271
|
},
|
|
51861
52272
|
setVolume(next) {
|
|
51862
52273
|
const level = Math.max(0, Math.min(1, next));
|
|
51863
|
-
if (
|
|
52274
|
+
if (shared3) shared3.setBus("weapons", { gain: level });
|
|
51864
52275
|
else engine.setMaster(level);
|
|
51865
52276
|
},
|
|
51866
52277
|
dispose() {
|
|
51867
|
-
if (!
|
|
52278
|
+
if (!shared3) engine.dispose();
|
|
51868
52279
|
}
|
|
51869
52280
|
};
|
|
51870
52281
|
}
|
|
@@ -57567,7 +57978,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
57567
57978
|
var ballisticVest = ({ mesh: mesh3, bx, G, cloth: cloth2, metal: metal2, plastic }) => {
|
|
57568
57979
|
const shell = cloth2(4936761);
|
|
57569
57980
|
const strap = cloth2(3817776);
|
|
57570
|
-
const
|
|
57981
|
+
const plate3 = plastic(2764074);
|
|
57571
57982
|
const buckle = metal2(9080208);
|
|
57572
57983
|
return G(
|
|
57573
57984
|
mesh3(bx(0.34, 0.045, 0.34), shell, [0, 0.0225, 0.055]),
|
|
@@ -57575,7 +57986,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
57575
57986
|
mesh3(bx(0.08, 0.022, 0.1), strap, [0.1, 0.011, -0.175]),
|
|
57576
57987
|
mesh3(bx(0.03, 0.04, 0.22), strap, [-0.185, 0.02, 0.1]),
|
|
57577
57988
|
mesh3(bx(0.03, 0.04, 0.22), strap, [0.185, 0.02, 0.1]),
|
|
57578
|
-
mesh3(bx(0.24, 0.025, 0.24),
|
|
57989
|
+
mesh3(bx(0.24, 0.025, 0.24), plate3, [0, 0.0575, 0.03]),
|
|
57579
57990
|
mesh3(bx(0.07, 0.02, 0.05), strap, [-0.1, 0.055, 0.19]),
|
|
57580
57991
|
mesh3(bx(0.07, 0.02, 0.05), strap, [0, 0.055, 0.19]),
|
|
57581
57992
|
mesh3(bx(0.07, 0.02, 0.05), strap, [0.1, 0.055, 0.19]),
|
|
@@ -59468,7 +59879,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
59468
59879
|
|
|
59469
59880
|
// src/models/melee.ts
|
|
59470
59881
|
var QUARTER = Math.PI / 2;
|
|
59471
|
-
var
|
|
59882
|
+
var plate2 = (kit, parent, profile, thickness, y, material) => {
|
|
59472
59883
|
const shape = new kit.THREE.Shape();
|
|
59473
59884
|
profile.forEach(([x, z], index) => index === 0 ? shape.moveTo(x, -z) : shape.lineTo(x, -z));
|
|
59474
59885
|
const mesh3 = new kit.THREE.Mesh(new kit.THREE.ExtrudeGeometry(shape, { depth: thickness, bevelEnabled: false }), material);
|
|
@@ -59487,7 +59898,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
59487
59898
|
box5(group, 7e-3, 0.012, 0.052, M.metal, 0.1325, axis2, 0);
|
|
59488
59899
|
box5(group, 0.012, 0.012, 4e-3, M.metal, 0.136, axis2, 0.026);
|
|
59489
59900
|
box5(group, 0.012, 0.012, 4e-3, M.metal, 0.136, axis2, -0.026);
|
|
59490
|
-
|
|
59901
|
+
plate2(kit, group, [[0.136, -0.0165], [0.248, -0.0165], [0.272, -0.0135], [0.2995, -6e-3], [0.3, -1e-3], [0.282, 8e-3], [0.255, 0.0165], [0.136, 0.0165]], 45e-4, axis2 - 225e-5, M.metal);
|
|
59491
59902
|
box5(group, 0.095, 16e-4, 45e-4, M.dark, 0.19, axis2 + 23e-4, 6e-3);
|
|
59492
59903
|
return { handle: [0.07, axis2, 0] };
|
|
59493
59904
|
};
|
|
@@ -59522,7 +59933,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
59522
59933
|
spine.push([x, bow(t) + halfWidth(t)]);
|
|
59523
59934
|
}
|
|
59524
59935
|
const tip = [KATANA_TIP, bow(1) + 4e-3];
|
|
59525
|
-
|
|
59936
|
+
plate2(kit, group, [...edge, tip, ...spine.reverse()], 55e-4, axis2 - 275e-5, M.steelL);
|
|
59526
59937
|
return { handle: [0.2, axis2, 0], support: [0.07, axis2, 0] };
|
|
59527
59938
|
};
|
|
59528
59939
|
var RING_Z = [-0.0455, -0.0155, 0.0155, 0.0455];
|
|
@@ -65876,12 +66287,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
65876
66287
|
}
|
|
65877
66288
|
function drawing(entry2, action) {
|
|
65878
66289
|
const context = engine.context;
|
|
65879
|
-
const
|
|
66290
|
+
const shared3 = context.random;
|
|
65880
66291
|
if (entry2.random) context.random = entry2.random;
|
|
65881
66292
|
try {
|
|
65882
66293
|
action();
|
|
65883
66294
|
} finally {
|
|
65884
|
-
context.random =
|
|
66295
|
+
context.random = shared3;
|
|
65885
66296
|
}
|
|
65886
66297
|
}
|
|
65887
66298
|
return {
|
|
@@ -66088,7 +66499,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
66088
66499
|
const size = random.between(0.12, 0.26) * Math.min(1.6, 0.6 + radius * 0.4);
|
|
66089
66500
|
const px = x + Math.cos(angle) * distance3;
|
|
66090
66501
|
const pz = z + Math.sin(angle) * distance3;
|
|
66091
|
-
const
|
|
66502
|
+
const plate3 = random.next() < 0.6;
|
|
66092
66503
|
const color2 = RIM_COLORS[random.next() < 0.5 ? 0 : 1];
|
|
66093
66504
|
const tiltX = random.between(-0.5, 0.5);
|
|
66094
66505
|
const tiltZ = random.between(-0.6, 0.2);
|
|
@@ -66099,7 +66510,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
66099
66510
|
z: pz,
|
|
66100
66511
|
scale: [size * 2, size * 0.35, size * 1.4],
|
|
66101
66512
|
rotation: [tiltX, angle, tiltZ],
|
|
66102
|
-
plate:
|
|
66513
|
+
plate: plate3,
|
|
66103
66514
|
color: color2
|
|
66104
66515
|
});
|
|
66105
66516
|
}
|
|
@@ -66406,8 +66817,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
66406
66817
|
if (direction) normalize2(addScaled(d, direction, 0.8));
|
|
66407
66818
|
const speed = random.between(4, 11) * (chunks.speed ?? 1);
|
|
66408
66819
|
const s = random.between(0.07, 0.2) * (chunks.size ?? 1);
|
|
66409
|
-
const
|
|
66410
|
-
const sy =
|
|
66820
|
+
const plate3 = chunks.plate ? random.next() < 0.6 : random.next() < 0.15;
|
|
66821
|
+
const sy = plate3 ? s * 0.3 : s * random.between(0.6, 1);
|
|
66411
66822
|
const color2 = hexToRgb2(chunks.colors.length > 0 ? pick22(random, chunks.colors) : DEFAULT_CHUNK_COLOR);
|
|
66412
66823
|
const hot = random.next() < chunks.hot;
|
|
66413
66824
|
addChunk(core, random, {
|
|
@@ -66417,11 +66828,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
66417
66828
|
vx: d.x * speed,
|
|
66418
66829
|
vy: d.y * speed + 2,
|
|
66419
66830
|
vz: d.z * speed,
|
|
66420
|
-
sx:
|
|
66831
|
+
sx: plate3 ? s * 1.6 : s,
|
|
66421
66832
|
sy,
|
|
66422
|
-
sz:
|
|
66833
|
+
sz: plate3 ? s * 1.1 : s,
|
|
66423
66834
|
color: color2,
|
|
66424
|
-
plate:
|
|
66835
|
+
plate: plate3,
|
|
66425
66836
|
hot
|
|
66426
66837
|
});
|
|
66427
66838
|
}
|
|
@@ -72994,7 +73405,7 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
|
|
|
72994
73405
|
fx = created;
|
|
72995
73406
|
const camera2 = lent.camera;
|
|
72996
73407
|
const accessories = createAccessoryBench({ arsenal, host: lent, text: accessoryText });
|
|
72997
|
-
const showcase = createWeaponShowcase({ arsenal, host: lent, text: showcaseText });
|
|
73408
|
+
const showcase = createWeaponShowcase({ arsenal, host: lent, text: showcaseText, referencePhotos: options.referencePhotos === true });
|
|
72998
73409
|
const offBench = lent.bench?.onChange((change) => {
|
|
72999
73410
|
if (accessories.handleChange(change) || showcase.handleChange(change)) return;
|
|
73000
73411
|
if (change.kind === "layer") {
|