@adatechnology/game-items-three 0.9.0 → 0.10.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/dist/index.d.ts +14 -1
- package/dist/index.global.js +659 -213
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -1
- package/package.json +12 -10
package/dist/index.global.js
CHANGED
|
@@ -51,6 +51,7 @@ var GameItemsThree = (() => {
|
|
|
51
51
|
composeThumbnailScene: () => composeThumbnailScene,
|
|
52
52
|
countDrawCalls: () => countDrawCalls,
|
|
53
53
|
countTriangles: () => countTriangles,
|
|
54
|
+
createContainedItemModel: () => createContainedItemModel,
|
|
54
55
|
createItemKit: () => createItemKit,
|
|
55
56
|
createItemModels: () => createItemModels,
|
|
56
57
|
createItemsTestModule: () => createItemsTestModule,
|
|
@@ -10105,6 +10106,19 @@ var GameItemsThree = (() => {
|
|
|
10105
10106
|
return { root, kind, ...shape ? { shape } : {}, size: item.size, materials };
|
|
10106
10107
|
}
|
|
10107
10108
|
|
|
10109
|
+
// src/contained.ts
|
|
10110
|
+
function createContainedItemModel(items, options = {}) {
|
|
10111
|
+
const byId = /* @__PURE__ */ new Map();
|
|
10112
|
+
for (const item of items) byId.set(item.id, item);
|
|
10113
|
+
return (stack, T2) => {
|
|
10114
|
+
const item = byId.get(stack.type);
|
|
10115
|
+
if (!item) return null;
|
|
10116
|
+
const model = buildItem(T2, item, options);
|
|
10117
|
+
model.root.userData.item = { id: item.id, kind: model.kind };
|
|
10118
|
+
return model.root;
|
|
10119
|
+
};
|
|
10120
|
+
}
|
|
10121
|
+
|
|
10108
10122
|
// src/item-models.ts
|
|
10109
10123
|
var itemModels = { has: hasItemModel, build: buildItem };
|
|
10110
10124
|
|
|
@@ -17506,7 +17520,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
17506
17520
|
const dz = Math.max(box4.min[2] - loss.z, 0, loss.z - box4.max[2]);
|
|
17507
17521
|
return Math.hypot(dx, dz) < loss.radius + loss.depth * groundCfg.spread;
|
|
17508
17522
|
};
|
|
17509
|
-
const
|
|
17523
|
+
const footprintOf2 = (o, b, loss) => {
|
|
17510
17524
|
const box4 = aabbOf(b.p.spec.shape, b.p.pos, b.p.q);
|
|
17511
17525
|
const long = box4.max[0] - box4.min[0] >= box4.max[2] - box4.min[2] ? 0 : 2;
|
|
17512
17526
|
const across2 = long === 0 ? 2 : 0;
|
|
@@ -17949,7 +17963,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
17949
17963
|
const opened = [];
|
|
17950
17964
|
const settled = [];
|
|
17951
17965
|
let lost = false;
|
|
17952
|
-
const touched = bearersOf(o).filter((b) => nearLoss(o, b.p, loss)).map((b) => ({ b, fp:
|
|
17966
|
+
const touched = bearersOf(o).filter((b) => nearLoss(o, b.p, loss)).map((b) => ({ b, fp: footprintOf2(o, b, loss) })).filter(({ fp }) => fp.share > 0 || fp.drop >= SUBSIDE_MIN);
|
|
17953
17967
|
const bearers = bearersOf(o);
|
|
17954
17968
|
const pillarFirst = (b) => b.p.spec.structure?.role === "column" ? 0 : 1;
|
|
17955
17969
|
const order2 = [...touched].sort((x, y) => pillarFirst(x.b) - pillarFirst(y.b));
|
|
@@ -21168,6 +21182,25 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
21168
21182
|
return j.st.progress;
|
|
21169
21183
|
}).value;
|
|
21170
21184
|
},
|
|
21185
|
+
take(objectId, partId) {
|
|
21186
|
+
if (impls.has(objectId)) return null;
|
|
21187
|
+
const o = getObj(objectId);
|
|
21188
|
+
const part = o.byId.get(partId);
|
|
21189
|
+
const hands = part?.spec.hands;
|
|
21190
|
+
if (!part || !hands || isLost(part)) return null;
|
|
21191
|
+
const holding = (o.byPart.get(partId) ?? []).filter((j) => !j.st.open);
|
|
21192
|
+
if (holding.length === 0 || holding.some((j) => !j.spec.tools.includes("hand"))) return null;
|
|
21193
|
+
run(() => {
|
|
21194
|
+
for (const j of holding) {
|
|
21195
|
+
j.st.progress = 1;
|
|
21196
|
+
j.st.open = true;
|
|
21197
|
+
j.st.openedBy = "tool";
|
|
21198
|
+
}
|
|
21199
|
+
loosened(o, holding, "tool");
|
|
21200
|
+
collapseCheck(o);
|
|
21201
|
+
});
|
|
21202
|
+
return hands;
|
|
21203
|
+
},
|
|
21171
21204
|
workableJoints(objectId, tool2) {
|
|
21172
21205
|
const im = impls.get(objectId);
|
|
21173
21206
|
if (im) {
|
|
@@ -22059,6 +22092,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
22059
22092
|
outdoor_bin: TRASH,
|
|
22060
22093
|
china_cabinet: [entry("china_plates", 3, 6, "utensil", false, 3), entry("wine_glasses", 2, 5, "utensil", false, 2)]
|
|
22061
22094
|
};
|
|
22095
|
+
var NETWORK_POST = { h: 6, anchor: 5.7, half: 0.07, bracket: 0.06, conduitOff: 0.025 };
|
|
22062
22096
|
var DEFAULT_LAMP_TYPE = "bulb_e27";
|
|
22063
22097
|
var OUTBUILDING_ROOM_TYPE = { guest_room: "bedroom", office: "office", storage: "stockroom", gourmet: "living" };
|
|
22064
22098
|
var CEILING_LIGHT = 0.35;
|
|
@@ -22190,8 +22224,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
22190
22224
|
const twoWay = Math.max(width, depth) < 2 * Math.min(width, depth) && Math.max(width, depth) <= options.twoWayMaxSpan + options.lineTolerance;
|
|
22191
22225
|
if (Math.min(width, depth) > options.maxSpan + options.lineTolerance && !twoWay) {
|
|
22192
22226
|
const longer = width >= depth ? "v" : "u";
|
|
22193
|
-
const
|
|
22194
|
-
const pool = candidates.filter((c) => c.coverage >= PARTIAL_WALL && (
|
|
22227
|
+
const square2 = Math.abs(width - depth) <= options.lineTolerance;
|
|
22228
|
+
const pool = candidates.filter((c) => c.coverage >= PARTIAL_WALL && (square2 || c.dir === longer));
|
|
22195
22229
|
if (pool.length) {
|
|
22196
22230
|
const best2 = pool.reduce((a, b) => b.coverage - 0.25 * b.skew > a.coverage - 0.25 * a.skew ? b : a);
|
|
22197
22231
|
return { dir: best2.dir, at: round(best2.at) };
|
|
@@ -23820,6 +23854,17 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
23820
23854
|
});
|
|
23821
23855
|
}
|
|
23822
23856
|
var towerLocales = { en: { labels: en_default.labels }, "pt-BR": { labels: pt_BR_default.labels } };
|
|
23857
|
+
var MAST_PIPE_RADIUS = 0.021;
|
|
23858
|
+
var WEATHERHEAD = { bend: 0.08, capRadius: 0.032, capLength: 0.06, segments: 8 };
|
|
23859
|
+
var round32 = (value) => Math.round(value * 1e3) / 1e3;
|
|
23860
|
+
function mastPathOf(mast) {
|
|
23861
|
+
const { bend, segments } = WEATHERHEAD;
|
|
23862
|
+
const arc = Array.from({ length: segments }, (_, index) => {
|
|
23863
|
+
const angle = Math.PI * (index + 1) / segments;
|
|
23864
|
+
return [mast.u, round32(mast.v - bend + bend * Math.cos(angle)), round32(mast.y1 + bend * Math.sin(angle))];
|
|
23865
|
+
});
|
|
23866
|
+
return [[mast.u, mast.v, mast.y0], [mast.u, mast.v, mast.y1], ...arc];
|
|
23867
|
+
}
|
|
23823
23868
|
|
|
23824
23869
|
// ../game-interactables/dist/index.js
|
|
23825
23870
|
function hashString(text) {
|
|
@@ -42770,6 +42815,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
42770
42815
|
wall_switch: { body: { material: "plastic", joint: "screw" }, parts: [["rocker", { material: "plastic", joint: "clip", piece: "rocker" }]] },
|
|
42771
42816
|
service_entrance: { body: { material: "steel", joint: "bolt" }, parts: [["meter_door", door("steel")]] },
|
|
42772
42817
|
conduit_run: { body: { material: "plastic", joint: "clip" }, parts: [] },
|
|
42818
|
+
service_mast: { body: { material: "steel", joint: "clip" }, parts: [] },
|
|
42773
42819
|
electrical_panel: {
|
|
42774
42820
|
body: { material: "steel", joint: "screw" },
|
|
42775
42821
|
parts: [[/^breaker/, { material: "plastic", joint: "clip", piece: "breaker" }], ["door", door("steel")]]
|
|
@@ -42844,6 +42890,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
42844
42890
|
"type.wall_socket": "Wall socket",
|
|
42845
42891
|
"type.wall_switch": "Light switch",
|
|
42846
42892
|
"type.service_entrance": "Service entrance pole",
|
|
42893
|
+
"type.service_mast": "Service mast (pontalete)",
|
|
42847
42894
|
"type.conduit_run": "Conduit run",
|
|
42848
42895
|
"type.tv": "Television",
|
|
42849
42896
|
"type.microwave": "Microwave",
|
|
@@ -43086,6 +43133,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
43086
43133
|
"type.wall_socket": "Tomada",
|
|
43087
43134
|
"type.wall_switch": "Interruptor",
|
|
43088
43135
|
"type.service_entrance": "Poste de entrada de energia",
|
|
43136
|
+
"type.service_mast": "Pontalete de entrada de energia",
|
|
43089
43137
|
"type.conduit_run": "Eletroduto",
|
|
43090
43138
|
"type.tv": "Televis\xE3o",
|
|
43091
43139
|
"type.microwave": "Micro-ondas",
|
|
@@ -43586,6 +43634,17 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
43586
43634
|
solid: true,
|
|
43587
43635
|
massKg: 60
|
|
43588
43636
|
},
|
|
43637
|
+
{
|
|
43638
|
+
id: "service_mast",
|
|
43639
|
+
group: "electrical",
|
|
43640
|
+
w: 0.1,
|
|
43641
|
+
d: 0.25,
|
|
43642
|
+
h: 4.4,
|
|
43643
|
+
y: 0,
|
|
43644
|
+
solid: true,
|
|
43645
|
+
massKg: 14,
|
|
43646
|
+
fixed: true
|
|
43647
|
+
},
|
|
43589
43648
|
{
|
|
43590
43649
|
id: "electrical_panel",
|
|
43591
43650
|
group: "electrical",
|
|
@@ -44439,6 +44498,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
44439
44498
|
// was `maquina`
|
|
44440
44499
|
});
|
|
44441
44500
|
var OWN_TYPES = Object.freeze({ lamp: true, gas_piped: true });
|
|
44501
|
+
var KITCHEN_SINK_WORKTOP = 0.9;
|
|
44442
44502
|
var sourceOf = (result) => result;
|
|
44443
44503
|
var ADAPTER_VERSION = "0.3.0";
|
|
44444
44504
|
var r3 = (n) => Math.round(n * 1e3) / 1e3;
|
|
@@ -44829,7 +44889,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
44829
44889
|
list2.push(sink);
|
|
44830
44890
|
let cabinet2 = null;
|
|
44831
44891
|
if (rest2 >= 0.35) {
|
|
44832
|
-
cabinet2 = part(m.id + "#cabinet", "kitchen_cabinet_base", rest2, m.d, m.h, 0, left ? width / 2 - rest2 / 2 : -(width / 2) + rest2 / 2, 0);
|
|
44892
|
+
cabinet2 = part(m.id + "#cabinet", "kitchen_cabinet_base", rest2, m.d, opts.visor ? m.h : KITCHEN_SINK_WORKTOP, 0, left ? width / 2 - rest2 / 2 : -(width / 2) + rest2 / 2, 0);
|
|
44833
44893
|
list2.push(cabinet2);
|
|
44834
44894
|
}
|
|
44835
44895
|
if (contents[m.id]) store(cabinet2 ? [["kitchen_cabinet_base", cabinet2.item], ["sink_kitchen", sink.item]] : [["sink_kitchen", sink.item]], contents[m.id]);
|
|
@@ -44999,11 +45059,21 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
44999
45059
|
house: [r3(K.x(end[0]) - px), end[2], r3(K.z(end[1]) - pz)]
|
|
45000
45060
|
};
|
|
45001
45061
|
if (ee.tap || electrical.mode === "tap") item.variant = "gato";
|
|
45062
|
+
else if (ee.street === "network") item.variant = "network";
|
|
45002
45063
|
const e = entry2("service_entrance", "service_entrance", item, "service_entrance", -1);
|
|
45003
45064
|
push(e);
|
|
45004
45065
|
result.serviceEntrance = e.id;
|
|
45005
45066
|
}
|
|
45006
|
-
if (ee && ee.
|
|
45067
|
+
if (ee && ee.mast && onFloor(-1, true)) {
|
|
45068
|
+
const path = mastPathOf(ee.mast);
|
|
45069
|
+
const x0 = K.x(ee.mast.u);
|
|
45070
|
+
const z0 = K.z(ee.mast.v);
|
|
45071
|
+
const item = { x: x0, z: z0, ry: 0, seed: seedOf2("service_mast"), points: path.map((p) => [r3(K.x(p[0]) - x0), p[2], r3(K.z(p[1]) - z0)]) };
|
|
45072
|
+
const e = entry2("service_mast", "service_mast", item, "service_mast", -1);
|
|
45073
|
+
e.floorY = o.base;
|
|
45074
|
+
push(e);
|
|
45075
|
+
result.serviceMast = e.id;
|
|
45076
|
+
} else if (ee && ee.descent && ee.descent.length > 1 && onFloor(-1, true)) conduit("conduit_descent", ee.descent, -1);
|
|
45007
45077
|
const q = electrical.panel;
|
|
45008
45078
|
if (q && onFloor(q.floor, false)) {
|
|
45009
45079
|
const hdq = 0.06;
|
|
@@ -45333,9 +45403,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
45333
45403
|
{ type: "sofa_3seat", category: "sofa", w: 2.1, d: 0.9, h: 0.85, color: { role: "fabric_main" } },
|
|
45334
45404
|
{ type: "sofa_2seat", category: "sofa", w: 1.6, d: 0.85, h: 0.85, color: { role: "fabric_main" } },
|
|
45335
45405
|
{ type: "sofa_l", category: "sofa", w: 2.4, d: 0.95, h: 0.85, color: { role: "fabric_main" } },
|
|
45336
|
-
{ type: "tv_unit", category: "tv_unit", w: 1.6, d: 0.45, h: 0.55 },
|
|
45337
|
-
{ type: "tv_unit_small", category: "tv_unit", w: 1.2, d: 0.4, h: 0.5 },
|
|
45338
|
-
{ type: "tv_unit_large", category: "tv_unit", w: 1.9, d: 0.45, h: 0.6 },
|
|
45406
|
+
{ type: "tv_unit", category: "tv_unit", w: 1.6, d: 0.45, h: 0.55, opening: 0.4 },
|
|
45407
|
+
{ type: "tv_unit_small", category: "tv_unit", w: 1.2, d: 0.4, h: 0.5, opening: 0.4 },
|
|
45408
|
+
{ type: "tv_unit_large", category: "tv_unit", w: 1.9, d: 0.45, h: 0.6, opening: 0.4 },
|
|
45339
45409
|
{ type: "tv", category: "tv", w: 0.9, d: 0.1, h: 0.55 },
|
|
45340
45410
|
{ type: "tv_large", category: "tv", w: 1.2, d: 0.1, h: 0.7 },
|
|
45341
45411
|
{ type: "coffee_table", category: "coffee_table", w: 0.9, d: 0.55, h: 0.42 },
|
|
@@ -45347,33 +45417,33 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
45347
45417
|
{ type: "shelf_unit", category: "shelf_unit", w: 1.4, d: 0.4, h: 1.8 },
|
|
45348
45418
|
{ type: "shelf_unit_small", category: "shelf_unit", w: 1, d: 0.35, h: 1.5 },
|
|
45349
45419
|
{ type: "floor_lamp", category: "lamp", w: 0.3, d: 0.3, h: 1.5 },
|
|
45350
|
-
{ type: "sideboard", category: "sideboard", w: 1.2, d: 0.4, h: 0.85 },
|
|
45420
|
+
{ type: "sideboard", category: "sideboard", w: 1.2, d: 0.4, h: 0.85, opening: 0.4 },
|
|
45351
45421
|
{ type: "console_table", category: "console_table", w: 0.9, d: 0.3, h: 0.85 },
|
|
45352
45422
|
{ type: "bench", category: "bench", w: 1, d: 0.35, h: 0.45 },
|
|
45353
45423
|
{ type: "workbench", category: "workbench", w: 1.2, d: 0.6, h: 0.95 },
|
|
45354
45424
|
{ type: "floor_mirror", category: "mirror", w: 0.5, d: 0.12, h: 1.8 },
|
|
45355
|
-
{ type: "fridge", category: "fridge", w: 0.7, d: 0.68, h: 1.8, color: { role: "metal" } },
|
|
45356
|
-
{ type: "fridge_large", category: "fridge", w: 0.8, d: 0.72, h: 1.85, color: { role: "metal" } },
|
|
45357
|
-
{ type: "stove", category: "stove", w: 0.62, d: 0.6, h: 0.95, color: { role: "metal" } },
|
|
45358
|
-
{ type: "stove_4burner", category: "stove", w: 0.7, d: 0.62, h: 0.95, color: { role: "metal" } },
|
|
45359
|
-
{ type: "kitchen_cabinet", category: "kitchen_cabinet", overhead: true, w: 1.6, d: 0.6, h: 0.95, color: { role: "metal" } },
|
|
45360
|
-
{ type: "kitchen_cabinet_large", category: "kitchen_cabinet", overhead: true, w: 2, d: 0.6, h: 0.95, color: { role: "metal" } },
|
|
45361
|
-
{ type: "kitchen_cabinet_small", category: "kitchen_cabinet", overhead: true, w: 1.2, d: 0.6, h: 0.95, color: { role: "metal" } },
|
|
45425
|
+
{ type: "fridge", category: "fridge", w: 0.7, d: 0.68, h: 1.8, opening: 0.6, color: { role: "metal" } },
|
|
45426
|
+
{ type: "fridge_large", category: "fridge", w: 0.8, d: 0.72, h: 1.85, opening: 0.6, color: { role: "metal" } },
|
|
45427
|
+
{ type: "stove", category: "stove", w: 0.62, d: 0.6, h: 0.95, opening: 0.5, color: { role: "metal" } },
|
|
45428
|
+
{ type: "stove_4burner", category: "stove", w: 0.7, d: 0.62, h: 0.95, opening: 0.5, color: { role: "metal" } },
|
|
45429
|
+
{ type: "kitchen_cabinet", category: "kitchen_cabinet", overhead: true, w: 1.6, d: 0.6, h: 0.95, opening: 0.5, color: { role: "metal" } },
|
|
45430
|
+
{ type: "kitchen_cabinet_large", category: "kitchen_cabinet", overhead: true, w: 2, d: 0.6, h: 0.95, opening: 0.5, color: { role: "metal" } },
|
|
45431
|
+
{ type: "kitchen_cabinet_small", category: "kitchen_cabinet", overhead: true, w: 1.2, d: 0.6, h: 0.95, opening: 0.5, color: { role: "metal" } },
|
|
45362
45432
|
{ type: "dining_table", category: "dining_table", w: 1.1, d: 0.8, h: 0.78 },
|
|
45363
45433
|
{ type: "dining_table_small", category: "dining_table", w: 0.9, d: 0.7, h: 0.75 },
|
|
45364
45434
|
{ type: "dining_table_round", category: "dining_table", w: 0.9, d: 0.9, h: 0.75 },
|
|
45365
45435
|
{ type: "microwave", category: "appliance", w: 0.5, d: 0.4, h: 0.3, color: { role: "metal" } },
|
|
45366
45436
|
{ type: "trash_bin", category: "trash_bin", w: 0.3, d: 0.3, h: 0.6 },
|
|
45367
|
-
{ type: "pantry", category: "pantry", w: 1.2, d: 0.4, h: 2 },
|
|
45437
|
+
{ type: "pantry", category: "pantry", w: 1.2, d: 0.4, h: 2, opening: 0.5 },
|
|
45368
45438
|
{ type: "double_bed", category: "bed", w: 1.6, d: 2.05, h: 0.62, color: { role: "fabric_main" } },
|
|
45369
45439
|
{ type: "queen_bed", category: "bed", w: 1.8, d: 2.1, h: 0.62, color: { role: "fabric_main" } },
|
|
45370
45440
|
{ type: "single_bed", category: "bed", w: 0.95, d: 2, h: 0.55, color: { role: "fabric_main" } },
|
|
45371
45441
|
{ type: "king_bed", category: "bed_king", w: 2, d: 2.15, h: 0.65, color: { role: "fabric_main" } },
|
|
45372
|
-
{ type: "nightstand", category: "nightstand", w: 0.45, d: 0.42, h: 0.6 },
|
|
45373
|
-
{ type: "wardrobe", category: "wardrobe", w: 1.6, d: 0.6, h: 2 },
|
|
45374
|
-
{ type: "wardrobe_small", category: "wardrobe", w: 1, d: 0.55, h: 1.9 },
|
|
45375
|
-
{ type: "wardrobe_large", category: "wardrobe_large", w: 2.4, d: 0.65, h: 2.1 },
|
|
45376
|
-
{ type: "dresser", category: "dresser", w: 1, d: 0.45, h: 0.85 },
|
|
45442
|
+
{ type: "nightstand", category: "nightstand", w: 0.45, d: 0.42, h: 0.6, opening: 0.45 },
|
|
45443
|
+
{ type: "wardrobe", category: "wardrobe", w: 1.6, d: 0.6, h: 2, opening: 0.5 },
|
|
45444
|
+
{ type: "wardrobe_small", category: "wardrobe", w: 1, d: 0.55, h: 1.9, opening: 0.5 },
|
|
45445
|
+
{ type: "wardrobe_large", category: "wardrobe_large", w: 2.4, d: 0.65, h: 2.1, opening: 0.5 },
|
|
45446
|
+
{ type: "dresser", category: "dresser", w: 1, d: 0.45, h: 0.85, opening: 0.5 },
|
|
45377
45447
|
{ type: "desk", category: "desk", w: 1.1, d: 0.6, h: 0.75 },
|
|
45378
45448
|
{ type: "vanity_table", category: "vanity_table", w: 1, d: 0.5, h: 0.8 },
|
|
45379
45449
|
{ type: "toilet", category: "toilet", w: 0.4, d: 0.62, h: 0.75, color: { role: "ceiling" } },
|
|
@@ -45383,8 +45453,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
45383
45453
|
{ type: "shower_large", category: "shower", windowHeight: 1.95, w: 1.1, d: 1.1, h: 0.1, color: { role: "ceiling" } },
|
|
45384
45454
|
{ type: "hamper", category: "hamper", w: 0.35, d: 0.3, h: 0.5 },
|
|
45385
45455
|
{ type: "laundry_tub", category: "laundry_tub", w: 0.6, d: 0.55, h: 0.9, color: { role: "metal" } },
|
|
45386
|
-
{ type: "washing_machine", category: "washing_machine", w: 0.6, d: 0.65, h: 0.9, color: { role: "metal" } },
|
|
45387
|
-
{ type: "laundry_cabinet", category: "laundry_cabinet", w: 0.8, d: 0.4, h: 1.8 },
|
|
45456
|
+
{ type: "washing_machine", category: "washing_machine", w: 0.6, d: 0.65, h: 0.9, opening: 0.5, color: { role: "metal" } },
|
|
45457
|
+
{ type: "laundry_cabinet", category: "laundry_cabinet", w: 0.8, d: 0.4, h: 1.8, opening: 0.45 },
|
|
45388
45458
|
{ type: "laundry_shelf", category: "laundry_shelf", w: 1, d: 0.35, h: 1.6 },
|
|
45389
45459
|
{ type: "car", category: "car", w: 1.85, d: 4.3, h: 1.5, color: { pick: [1842206, 15263974, 10132897, 8003359, 2046559, 4016698, 12103834] } },
|
|
45390
45460
|
{ type: "car_small", category: "car", w: 1.7, d: 3.8, h: 1.45, color: { pick: [1842206, 15263974, 10132897, 8003359, 2046559, 4016698, 12103834] } },
|
|
@@ -45394,10 +45464,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
45394
45464
|
{ type: "office_desk", category: "office_desk", w: 1.4, d: 0.7, h: 0.75 },
|
|
45395
45465
|
{ type: "office_desk_large", category: "office_desk", w: 1.6, d: 0.8, h: 0.75 },
|
|
45396
45466
|
{ type: "bookcase", category: "bookcase", w: 1.2, d: 0.35, h: 2 },
|
|
45397
|
-
{ type: "filing_cabinet", category: "filing_cabinet", w: 0.5, d: 0.6, h: 1.3 },
|
|
45467
|
+
{ type: "filing_cabinet", category: "filing_cabinet", w: 0.5, d: 0.6, h: 1.3, opening: 0.5 },
|
|
45398
45468
|
{ type: "dining_table_large", category: "dining_table_large", w: 2.4, d: 1.1, h: 0.78 },
|
|
45399
|
-
{ type: "buffet", category: "buffet", w: 1.6, d: 0.5, h: 0.9 },
|
|
45400
|
-
{ type: "china_cabinet", category: "china_cabinet", w: 1.2, d: 0.45, h: 2 },
|
|
45469
|
+
{ type: "buffet", category: "buffet", w: 1.6, d: 0.5, h: 0.9, opening: 0.45 },
|
|
45470
|
+
{ type: "china_cabinet", category: "china_cabinet", w: 1.2, d: 0.45, h: 2, opening: 0.45 },
|
|
45401
45471
|
{ type: "stairs", category: "stairs", w: 1, d: 3.2, h: 2.8 },
|
|
45402
45472
|
{ type: "planter_bed", category: "planter_bed", w: 3, d: 0.7, h: 0.4, color: { role: "dirt" } },
|
|
45403
45473
|
{ type: "planter_bed_small", category: "planter_bed", w: 1.8, d: 0.6, h: 0.4, color: { role: "dirt" } },
|
|
@@ -45437,7 +45507,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
45437
45507
|
{ type: "breakfast_bar", category: "breakfast_bar", w: 2, d: 0.55, h: 1, window: true },
|
|
45438
45508
|
{ type: "sauna", category: "sauna", w: 2, d: 2, h: 2.1 },
|
|
45439
45509
|
{ type: "soaking_tub", category: "soaking_tub", w: 1.6, d: 1.6, h: 0.8 },
|
|
45440
|
-
{ type: "closet_wardrobe", category: "wardrobe_large", w: 2, d: 0.6, h: 2.2 },
|
|
45510
|
+
{ type: "closet_wardrobe", category: "wardrobe_large", w: 2, d: 0.6, h: 2.2, opening: 0.5 },
|
|
45441
45511
|
{ type: "sofa_xl", category: "sofa", w: 3, d: 1, h: 0.85, color: { role: "fabric_main" } },
|
|
45442
45512
|
{ type: "gourmet_counter", category: "gourmet", w: 3, d: 0.7, h: 1, window: true, equip: ["bbq_grill", "kitchen_cabinet"] },
|
|
45443
45513
|
{ type: "gourmet_counter_small", category: "gourmet", w: 1.8, d: 0.65, h: 1, window: true, equip: ["bbq_grill", "kitchen_cabinet"] },
|
|
@@ -46514,7 +46584,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
46514
46584
|
}
|
|
46515
46585
|
var residentialTower = residentialTowerTemplate();
|
|
46516
46586
|
|
|
46517
|
-
// ../game-floorplan-three/dist/chunk-
|
|
46587
|
+
// ../game-floorplan-three/dist/chunk-6GFCK5NZ.js
|
|
46518
46588
|
var __defProp3 = Object.defineProperty;
|
|
46519
46589
|
var __defNormalProp = (obj, key2, value) => key2 in obj ? __defProp3(obj, key2, { enumerable: true, configurable: true, writable: true, value }) : obj[key2] = value;
|
|
46520
46590
|
var __publicField = (obj, key2, value) => __defNormalProp(obj, typeof key2 !== "symbol" ? key2 + "" : key2, value);
|
|
@@ -48263,10 +48333,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
48263
48333
|
}
|
|
48264
48334
|
function floorLamp(M, A) {
|
|
48265
48335
|
const K2 = kit2(M, A, M.y || 0), color2 = colorTemperature(M), id = "lamp_pe_" + M.seed, h = Math.min(1.6, M.h || 1.5), meta = { id, room: M.room, on: !!M.on, color: color2, lightType: "floor", hidden: !M.on };
|
|
48266
|
-
|
|
48336
|
+
const shade3 = M.visorScene ? 0.17 : Math.min(0.17, Math.min(M.w || 0.34, M.d || 0.34) / 2 - 6e-3);
|
|
48337
|
+
K2.c("metal", 0, 0, 0, Math.min(0.13, shade3), 0.025, 2763308);
|
|
48267
48338
|
K2.c("metal", 0, 0.025, 0, 0.011, h - 0.3, 2763308);
|
|
48268
|
-
K2.c("plain", 0, h - 0.28, 0,
|
|
48269
|
-
K2.part("lamp", 0, h - 0.28, 0, () => K2.c("emissive", 0, h - 0.28, 0,
|
|
48339
|
+
K2.c("plain", 0, h - 0.28, 0, shade3, 0.26, 15656656);
|
|
48340
|
+
K2.part("lamp", 0, h - 0.28, 0, () => K2.c("emissive", 0, h - 0.28, 0, shade3 + 3e-3, 0.262, color2), meta);
|
|
48270
48341
|
if (M.on && A.light) A.light(Object.assign({}, M, { lampId: id }), 0, h - 0.15, 0, color2, 5, "floor");
|
|
48271
48342
|
}
|
|
48272
48343
|
function sconce(M, A) {
|
|
@@ -49934,7 +50005,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
49934
50005
|
var FEED_EXIT_Y = -0.15;
|
|
49935
50006
|
var FEED_BOX_OFFSET = 0.25;
|
|
49936
50007
|
var BRICK_FACE_INSET = 0.014;
|
|
50008
|
+
var SLAB_MIDDLE = 0.065;
|
|
50009
|
+
var CEILING_SLAB = 0.5;
|
|
50010
|
+
var PASSING_END_CLEAR = { water: 0.335, conduit: 0.485 };
|
|
50011
|
+
var SLAB_LIFT = { water: -0.02, conduit: 0.015 };
|
|
49937
50012
|
var OPENING_CLEARANCE = 0.12;
|
|
50013
|
+
var DEFAULT_END_CLEAR = 0.1;
|
|
49938
50014
|
var DEFAULT_THICKNESS = 0.15;
|
|
49939
50015
|
function atticFloor(plan) {
|
|
49940
50016
|
const top = plan.floors[plan.floors.length - 1];
|
|
@@ -49947,18 +50023,23 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
49947
50023
|
return [Math.min(...walls.map((w) => w.u0)), Math.min(...walls.map((w) => w.v0)), Math.max(...walls.map((w) => w.u1)), Math.max(...walls.map((w) => w.v1))];
|
|
49948
50024
|
}
|
|
49949
50025
|
var inside2 = (box4, u, v, margin) => u >= box4[0] - margin && u <= box4[2] + margin && v >= box4[1] - margin && v <= box4[3] + margin;
|
|
49950
|
-
function
|
|
50026
|
+
function reaches(plan, opening, floor) {
|
|
50027
|
+
if (opening.floor === floor) return true;
|
|
50028
|
+
if (opening.floor > floor || opening.y1 === void 0) return false;
|
|
50029
|
+
return (plan.floors[opening.floor]?.y0 ?? 0) + opening.y1 > (plan.floors[floor]?.y0 ?? 0);
|
|
50030
|
+
}
|
|
50031
|
+
function clearOfOpenings(plan, wall, along2, endClear = DEFAULT_END_CLEAR) {
|
|
49951
50032
|
const line = wall.axis === "u" ? wall.v0 : wall.u0;
|
|
49952
50033
|
const a0 = wall.axis === "u" ? wall.u0 : wall.v0, a1 = wall.axis === "u" ? wall.u1 : wall.v1;
|
|
49953
|
-
let at2 = along2;
|
|
50034
|
+
let at2 = endClear > DEFAULT_END_CLEAR ? Math.max(a0 + endClear, Math.min(a1 - endClear, along2)) : along2;
|
|
49954
50035
|
for (const o of plan.openings) {
|
|
49955
|
-
if (o.
|
|
50036
|
+
if (o.axis !== wall.axis || Math.abs(o.pos - line) > 0.05 || !reaches(plan, o, wall.floor)) continue;
|
|
49956
50037
|
const lo = o.at - o.width / 2 - OPENING_CLEARANCE, hi = o.at + o.width / 2 + OPENING_CLEARANCE;
|
|
49957
50038
|
if (at2 <= lo || at2 >= hi) continue;
|
|
49958
50039
|
const toLo = at2 - lo, toHi = hi - at2;
|
|
49959
50040
|
at2 = toLo <= toHi && lo >= a0 + 0.1 || hi > a1 - 0.1 ? lo : hi;
|
|
49960
50041
|
}
|
|
49961
|
-
return Math.max(a0 +
|
|
50042
|
+
return Math.max(a0 + DEFAULT_END_CLEAR, Math.min(a1 - DEFAULT_END_CLEAR, at2));
|
|
49962
50043
|
}
|
|
49963
50044
|
function wallDrop(plan, floor, u, v, options = {}) {
|
|
49964
50045
|
let best = null;
|
|
@@ -49972,7 +50053,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
49972
50053
|
if (!best) return null;
|
|
49973
50054
|
const { wall } = best;
|
|
49974
50055
|
const alongU = wall.axis === "u";
|
|
49975
|
-
const along2 = clearOfOpenings(plan, wall, best.along);
|
|
50056
|
+
const along2 = clearOfOpenings(plan, wall, best.along, options.endClear);
|
|
49976
50057
|
const line = alongU ? wall.v0 : wall.u0;
|
|
49977
50058
|
const [ru, rv] = options.toward ?? [u, v];
|
|
49978
50059
|
const across2 = alongU ? rv - line : ru - line;
|
|
@@ -50061,6 +50142,31 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
50061
50142
|
}
|
|
50062
50143
|
return true;
|
|
50063
50144
|
}
|
|
50145
|
+
var DOOR_HEAD = 2.1;
|
|
50146
|
+
function crossesOpening(plan, a, b, y) {
|
|
50147
|
+
return plan.openings.some((o) => {
|
|
50148
|
+
const base = plan.floors[o.floor]?.y0 ?? 0;
|
|
50149
|
+
if (y <= base + (o.y0 ?? 0) || y >= base + (o.y1 ?? DOOR_HEAD)) return false;
|
|
50150
|
+
const [p0, p1, q0, q1] = o.axis === "u" ? [a[1], b[1], a[0], b[0]] : [a[0], b[0], a[1], b[1]];
|
|
50151
|
+
const across2 = Math.min(p0, p1) <= o.pos + 0.1 && Math.max(p0, p1) >= o.pos - 0.1;
|
|
50152
|
+
return across2 && Math.max(Math.min(q0, q1), o.at - o.width / 2) < Math.min(Math.max(q0, q1), o.at + o.width / 2);
|
|
50153
|
+
});
|
|
50154
|
+
}
|
|
50155
|
+
function slabPath(plan, from, to, y, first) {
|
|
50156
|
+
const clear = (path) => !path.slice(1).some((p, i) => crossesOpening(plan, [path[i][0], path[i][2]], [p[0], p[2]], y));
|
|
50157
|
+
for (const order2 of [first, first === "u" ? "v" : "u"]) {
|
|
50158
|
+
const path = atticPath(from, to, y, order2);
|
|
50159
|
+
if (clear(path)) return path;
|
|
50160
|
+
}
|
|
50161
|
+
const [cu, cv] = centreOf(houseFootprint(plan));
|
|
50162
|
+
const alongU = Math.abs(to[0] - from[0]) >= Math.abs(to[1] - from[1]);
|
|
50163
|
+
const step = alongU ? [0, Math.sign(cv - from[1]) * SLAB_DETOUR] : [Math.sign(cu - from[0]) * SLAB_DETOUR, 0];
|
|
50164
|
+
return [[from[0], y, from[1]], [from[0] + step[0], y, from[1] + step[1]], [to[0] + step[0], y, to[1] + step[1]], [to[0], y, to[1]]];
|
|
50165
|
+
}
|
|
50166
|
+
var SLAB_DETOUR = 0.6;
|
|
50167
|
+
function toMiddle(drop) {
|
|
50168
|
+
return drop.wall.axis === "u" ? { ...drop, v: drop.wall.v0 } : { ...drop, u: drop.wall.u0 };
|
|
50169
|
+
}
|
|
50064
50170
|
function atticPath(from, to, y, first) {
|
|
50065
50171
|
const corner = first === "u" ? [to[0], from[1]] : [from[0], to[1]];
|
|
50066
50172
|
const out = [[from[0], y, from[1]]];
|
|
@@ -50075,18 +50181,43 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
50075
50181
|
const storey = plan.floors[floor];
|
|
50076
50182
|
const y = (storey ? storey.y0 : 0) + target.y;
|
|
50077
50183
|
const footprint = houseFootprint(plan);
|
|
50078
|
-
if (inside2(footprint, target.u, target.v, 0.4)) {
|
|
50079
|
-
const drop = wallDrop(plan, floor, target.u, target.v, options);
|
|
50080
|
-
if (!drop) return [];
|
|
50081
|
-
return [...atticPath(from, [drop.u, drop.v], attic, first), [drop.u, y, drop.v]];
|
|
50082
|
-
}
|
|
50184
|
+
if (inside2(footprint, target.u, target.v, 0.4)) return descend(plan, from, target, { ...options, attic, first, y });
|
|
50083
50185
|
const feed = feedTo(plan, target, y, options);
|
|
50084
50186
|
if (!feed) return [];
|
|
50085
50187
|
return [...atticPath(from, [feed.exit.u, feed.exit.v], attic, first), ...feed.route];
|
|
50086
50188
|
}
|
|
50189
|
+
function descend(plan, from, target, options) {
|
|
50190
|
+
const floor = Math.max(0, target.floor);
|
|
50191
|
+
const top = Math.max(floor, plan.floors.length - 1);
|
|
50192
|
+
const route = [];
|
|
50193
|
+
let at2 = from;
|
|
50194
|
+
let height = options.attic;
|
|
50195
|
+
for (let storey = top; storey >= floor; storey--) {
|
|
50196
|
+
const passing = storey !== floor || options.passing === true;
|
|
50197
|
+
const found = wallDrop(plan, storey, target.u, target.v, passing ? { ...options, surface: false, endClear: PASSING_END_CLEAR[options.kind] } : options);
|
|
50198
|
+
if (!found) return [];
|
|
50199
|
+
const drop = passing && options.kind === "conduit" ? toMiddle(found) : found;
|
|
50200
|
+
const path = slabPath(plan, at2, [drop.u, drop.v], height, options.first);
|
|
50201
|
+
route.push(...route.length ? path.slice(1) : path);
|
|
50202
|
+
at2 = [drop.u, drop.v];
|
|
50203
|
+
if (storey === floor) break;
|
|
50204
|
+
height = (plan.floors[storey]?.y0 ?? 0) - SLAB_MIDDLE + SLAB_LIFT[options.kind];
|
|
50205
|
+
route.push([drop.u, height, drop.v]);
|
|
50206
|
+
}
|
|
50207
|
+
route.push([at2[0], options.y, at2[1]]);
|
|
50208
|
+
return route.filter((p, i) => i === 0 || Math.hypot(p[0] - route[i - 1][0], p[1] - route[i - 1][1], p[2] - route[i - 1][2]) > 1e-4);
|
|
50209
|
+
}
|
|
50087
50210
|
function routeToCeiling(plan, from, u, v, ceilingY) {
|
|
50088
50211
|
const attic = atticFloor(plan) + ATTIC_LIFT.conduit;
|
|
50089
|
-
if (inside2(houseFootprint(plan), u, v, 0.4))
|
|
50212
|
+
if (inside2(houseFootprint(plan), u, v, 0.4)) {
|
|
50213
|
+
const over = plan.floors.findIndex((floor, index) => index > 0 && floor.y0 > ceilingY - CEILING_SLAB);
|
|
50214
|
+
if (over < 0) return [...atticPath(from, [u, v], attic, "v"), [u, ceilingY, v]];
|
|
50215
|
+
const slabY = (plan.floors[over]?.y0 ?? 0) - SLAB_MIDDLE + SLAB_LIFT.conduit;
|
|
50216
|
+
const down2 = descend(plan, from, { u, v, y: 0, floor: over }, { kind: "conduit", attic, first: "v", y: slabY, passing: true });
|
|
50217
|
+
const foot = down2[down2.length - 1];
|
|
50218
|
+
if (!foot) return [];
|
|
50219
|
+
return [...down2, ...slabPath(plan, [foot[0], foot[2]], [u, v], slabY, "v").slice(1), [u, Math.min(ceilingY, slabY), v]];
|
|
50220
|
+
}
|
|
50090
50221
|
const feed = feedTo(plan, { u, v }, ceilingY + IN_SLAB, {});
|
|
50091
50222
|
if (!feed) return [];
|
|
50092
50223
|
const top = feed.route[feed.route.length - 1];
|
|
@@ -50104,6 +50235,19 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
50104
50235
|
return { walls: plan.walls, openings: [...plan.doors, ...plan.windows], floors: plan.floors };
|
|
50105
50236
|
}
|
|
50106
50237
|
var toPlan = (route) => route.map((p) => [p[0], p[2], p[1]]);
|
|
50238
|
+
function homeRun(plan, run) {
|
|
50239
|
+
const { riser, floor, top, home, ceilingY } = run;
|
|
50240
|
+
const start = [riser.u, top, riser.v];
|
|
50241
|
+
const above = plan.floors[floor + 1];
|
|
50242
|
+
if (above && above.y0 > ceilingY - CEILING_SLAB && inside2(houseFootprint(plan), home[0], home[1], 0.4)) {
|
|
50243
|
+
const slabY = above.y0 - SLAB_MIDDLE + SLAB_LIFT.conduit;
|
|
50244
|
+
return [start, [riser.u, slabY, riser.v], ...slabPath(plan, [riser.u, riser.v], home, slabY, "v").slice(1), [home[0], Math.min(ceilingY, slabY), home[1]]];
|
|
50245
|
+
}
|
|
50246
|
+
const attic = atticFloor(plan) + ATTIC_LIFT.conduit;
|
|
50247
|
+
const up = [...descend(plan, [riser.u, riser.v], { u: riser.u, v: riser.v, y: 0, floor }, { kind: "conduit", attic, first: "v", y: top })].reverse();
|
|
50248
|
+
const route = [start, ...up.slice(1), ...routeToCeiling(plan, [riser.u, riser.v], home[0], home[1], ceilingY)];
|
|
50249
|
+
return route.filter((p, i) => i === 0 || Math.hypot(p[0] - route[i - 1][0], p[1] - route[i - 1][1], p[2] - route[i - 1][2]) > 1e-4);
|
|
50250
|
+
}
|
|
50107
50251
|
function routeConduits(plan, electrical, lamps) {
|
|
50108
50252
|
const Q = electrical.panel;
|
|
50109
50253
|
const terminals = /* @__PURE__ */ new Map();
|
|
@@ -50122,7 +50266,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
50122
50266
|
const ceilingY = lamp ? lamp.y : storey ? storey.y0 + storey.ceiling : 2.8;
|
|
50123
50267
|
homes.set(c.circuit, [home[0], home[1], ceilingY]);
|
|
50124
50268
|
const top = (Q.y ?? 1.5) + (Q.h ?? 0.4) / 2;
|
|
50125
|
-
return { ...c, points:
|
|
50269
|
+
return { ...c, points: toPlan(homeRun(plan, { riser, floor, top, home, ceilingY })) };
|
|
50126
50270
|
}
|
|
50127
50271
|
const target = terminals.get(c.to);
|
|
50128
50272
|
const start = homes.get(c.from) ?? (home ? [home[0], home[1], atticFloor(plan)] : void 0);
|
|
@@ -50445,6 +50589,67 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
50445
50589
|
group.userData.rain = { pieces: rainwater.pieces, trenches: [...rainwater.trenches, ...rainwater.boxes.map(pitOf)].map((t) => t.rect), boxes: rainwater.boxes };
|
|
50446
50590
|
return group;
|
|
50447
50591
|
}
|
|
50592
|
+
var SUBFLOOR_Y = -0.15;
|
|
50593
|
+
var RISER_CLEAR = 2e-3;
|
|
50594
|
+
var WALL_OUTLET_HEIGHT = { tap: 0.5, tub: 0.45, machine: 0.5 };
|
|
50595
|
+
var FLOOR_OUTLET_DROP = 3e-3;
|
|
50596
|
+
function square(a, b, y) {
|
|
50597
|
+
const corner = [b[0], y, a[1]];
|
|
50598
|
+
const out = [];
|
|
50599
|
+
if (Math.abs(b[0] - a[0]) > 1e-4 && Math.abs(b[1] - a[1]) > 1e-4) out.push(corner);
|
|
50600
|
+
out.push([b[0], y, b[1]]);
|
|
50601
|
+
return out;
|
|
50602
|
+
}
|
|
50603
|
+
var onCentre = (at2) => {
|
|
50604
|
+
if (at2.wall.axis === "u") return [at2.u, at2.wall.v0 + Math.sign(at2.v - at2.wall.v0) * STACK_OFF_CENTRE];
|
|
50605
|
+
return [at2.wall.u0 + Math.sign(at2.u - at2.wall.u0) * STACK_OFF_CENTRE, at2.v];
|
|
50606
|
+
};
|
|
50607
|
+
var STACK_OFF_CENTRE = 0.013;
|
|
50608
|
+
function drainRoute(plan, point) {
|
|
50609
|
+
const floor = point.floor;
|
|
50610
|
+
if (floor < 0) return null;
|
|
50611
|
+
const y0 = plan.floors[floor]?.y0 ?? 0;
|
|
50612
|
+
const outlet = WALL_OUTLET_HEIGHT[point.kind];
|
|
50613
|
+
const points = [];
|
|
50614
|
+
let at2 = [point.u, point.v];
|
|
50615
|
+
let storey = floor;
|
|
50616
|
+
if (outlet !== void 0) {
|
|
50617
|
+
const drop = wallDrop(plan, floor, point.u, point.v);
|
|
50618
|
+
if (!drop) return null;
|
|
50619
|
+
at2 = onCentre(drop);
|
|
50620
|
+
points.push([at2[0], y0 + outlet, at2[1]]);
|
|
50621
|
+
} else {
|
|
50622
|
+
points.push([point.u, y0 - FLOOR_OUTLET_DROP, point.v]);
|
|
50623
|
+
if (floor > 0) {
|
|
50624
|
+
const slabY = y0 - SLAB_MIDDLE;
|
|
50625
|
+
points.push([point.u, slabY, point.v]);
|
|
50626
|
+
const below = wallDrop(plan, floor - 1, point.u, point.v);
|
|
50627
|
+
if (!below) return null;
|
|
50628
|
+
at2 = onCentre(below);
|
|
50629
|
+
points.push(...square([point.u, point.v], at2, slabY));
|
|
50630
|
+
storey = floor - 1;
|
|
50631
|
+
}
|
|
50632
|
+
}
|
|
50633
|
+
for (; storey > 0; storey--) {
|
|
50634
|
+
const slabY = (plan.floors[storey]?.y0 ?? 0) - SLAB_MIDDLE;
|
|
50635
|
+
points.push([at2[0], slabY, at2[1]]);
|
|
50636
|
+
const below = wallDrop(plan, storey - 1, at2[0], at2[1]);
|
|
50637
|
+
if (!below) continue;
|
|
50638
|
+
const from = at2;
|
|
50639
|
+
at2 = onCentre(below);
|
|
50640
|
+
points.push(...square(from, at2, slabY));
|
|
50641
|
+
}
|
|
50642
|
+
if (Math.hypot(at2[0] - point.u, at2[1] - point.v) < 1e-3) return null;
|
|
50643
|
+
{
|
|
50644
|
+
points.push([at2[0], SUBFLOOR_Y, at2[1]]);
|
|
50645
|
+
const legs = square(at2, [point.u, point.v], SUBFLOOR_Y);
|
|
50646
|
+
const last = legs.length > 1 ? legs[legs.length - 2] : [at2[0], SUBFLOOR_Y, at2[1]];
|
|
50647
|
+
const run = Math.hypot(point.u - last[0], point.v - last[2]), stop = run > 0 ? Math.max(0, run - ((DRAIN_BORE[point.kind] ?? 0.05) / 2 + RISER_CLEAR)) / run : 0;
|
|
50648
|
+
legs[legs.length - 1] = [last[0] + (point.u - last[0]) * stop, SUBFLOOR_Y, last[2] + (point.v - last[2]) * stop];
|
|
50649
|
+
points.push(...legs);
|
|
50650
|
+
}
|
|
50651
|
+
return points.filter((p, i) => i === 0 || Math.hypot(p[0] - points[i - 1][0], p[1] - points[i - 1][1], p[2] - points[i - 1][2]) > 1e-4);
|
|
50652
|
+
}
|
|
50448
50653
|
var DEFAULT_SEGMENT_LIMITS = { wiring: 3, pipe: 2.5 };
|
|
50449
50654
|
var CUT_ROLES = /* @__PURE__ */ new Set(["slab", "wall", "partition"]);
|
|
50450
50655
|
var EPSILON2 = 1e-6;
|
|
@@ -50732,6 +50937,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
50732
50937
|
}
|
|
50733
50938
|
function underSink(tr) {
|
|
50734
50939
|
const H = shared2.ctx.r.utilities?.plumbing, nA = shared2.ctx.r.floors.length, pt = H && H.points.find((p) => p.id === tr.to), pts = tr.points.map((p) => [p[0], p[2], p[1]]), d = tr.diameter || 0.025;
|
|
50940
|
+
const stage = cursor.stage;
|
|
50941
|
+
if (shared2.ctx.constructionStages) cursor.stage = "furniture";
|
|
50735
50942
|
cursor.group = pt && pt.floor >= 0 ? "f" + Math.min(pt.floor, nA - 1) : "lot";
|
|
50736
50943
|
cursor.pc = pieceRecord("pipe:" + tr.id, "plastic", null, { tags: ["pipe"] });
|
|
50737
50944
|
for (let i = 0; i + 1 < pts.length; i++) pipe(pts[i], pts[i + 1], d, PIPE_COLOR);
|
|
@@ -50739,39 +50946,18 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
50739
50946
|
cylBase("metal", p[0], p[1] - d * 0.9, p[2], d * 0.75, d * 1.8, 13158596);
|
|
50740
50947
|
}
|
|
50741
50948
|
cursor.pc = null;
|
|
50949
|
+
cursor.stage = stage;
|
|
50742
50950
|
}
|
|
50743
50951
|
const defined = { createWater, PIPE_COLOR, pipe, _v3, waterPipes };
|
|
50744
50952
|
Object.assign(K, defined);
|
|
50745
50953
|
}
|
|
50746
50954
|
var SEWER_COLOR = 15262940;
|
|
50747
|
-
var MOUTH_HEIGHT = { flush: 0.18, shower: 0.03, tap: 0.5, tub: 0.45, machine: 0.5 };
|
|
50748
|
-
var SLAB_MIDDLE = 0.065;
|
|
50749
50955
|
var CLAMP_REACH = 0.3;
|
|
50750
50956
|
var CLAMP_DROP = 0.06;
|
|
50751
50957
|
var CLAMP_HEIGHT = 0.03;
|
|
50752
50958
|
var CLAMPED_ROLES = /* @__PURE__ */ new Set(["wall", "partition", "column"]);
|
|
50753
|
-
function drainRoute(plan, point) {
|
|
50754
|
-
const floor = point.floor;
|
|
50755
|
-
if (floor < 0) return null;
|
|
50756
|
-
const drop = wallDrop(plan, floor, point.u, point.v);
|
|
50757
|
-
if (!drop) return null;
|
|
50758
|
-
const onCentre = (at22) => at22.wall.axis === "u" ? [at22.u, at22.wall.v0] : [at22.wall.u0, at22.v];
|
|
50759
|
-
const mouth = (plan.floors[floor]?.y0 ?? 0) + (MOUTH_HEIGHT[point.kind] ?? 0.3);
|
|
50760
|
-
let at2 = onCentre(drop);
|
|
50761
|
-
const points = [[point.u, mouth, point.v], [at2[0], mouth, at2[1]]];
|
|
50762
|
-
for (let storey = floor; storey > 0; storey--) {
|
|
50763
|
-
const slabY = (plan.floors[storey]?.y0 ?? 0) - SLAB_MIDDLE;
|
|
50764
|
-
points.push([at2[0], slabY, at2[1]]);
|
|
50765
|
-
const below = wallDrop(plan, storey - 1, at2[0], at2[1]);
|
|
50766
|
-
if (!below) continue;
|
|
50767
|
-
at2 = onCentre(below);
|
|
50768
|
-
points.push([at2[0], slabY, at2[1]]);
|
|
50769
|
-
}
|
|
50770
|
-
points.push([at2[0], plan.floors[0]?.y0 ?? 0, at2[1]]);
|
|
50771
|
-
return points;
|
|
50772
|
-
}
|
|
50773
50959
|
function installUtilitiesDrains(K, shared2) {
|
|
50774
|
-
const { part, pipe, cylBase } = K;
|
|
50960
|
+
const { part, pipe, cylBase, cursor } = K;
|
|
50775
50961
|
const sh = (...a) => K.sh(...a);
|
|
50776
50962
|
function layRun(run) {
|
|
50777
50963
|
const spans = cutRun(run.points, run.limit, solidsOf(shared2.ctx.structureIndex));
|
|
@@ -50812,6 +50998,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
50812
50998
|
}
|
|
50813
50999
|
function downpipes() {
|
|
50814
51000
|
const runs = shared2.ctx.gutterInfo?.runs ?? [];
|
|
51001
|
+
const stage = cursor.stage;
|
|
51002
|
+
if (shared2.ctx.constructionStages) cursor.stage = "roof";
|
|
50815
51003
|
runs.forEach((run, index) => {
|
|
50816
51004
|
const top = run.points[0];
|
|
50817
51005
|
const points = run.points.map((p) => [p[0], p[1], p[2]]);
|
|
@@ -50819,6 +51007,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
50819
51007
|
const limit = Number.isFinite(shared2.ctx.segmentLimits.pipe) ? Math.min(shared2.ctx.segmentLimits.pipe, run.clampEvery) : Infinity;
|
|
50820
51008
|
layRun({ id: `downpipe_${index}`, points, diameter: run.radius * 2, color: run.color, group: `f${run.f}`, limit, ...clampedTo ? { clampedTo } : {}, clampEvery: run.clampEvery });
|
|
50821
51009
|
});
|
|
51010
|
+
cursor.stage = stage;
|
|
50822
51011
|
}
|
|
50823
51012
|
function drainPipes() {
|
|
50824
51013
|
if (shared2.ctx.visorScene) return;
|
|
@@ -51051,11 +51240,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
51051
51240
|
for (const x of [u0 + inset, u1 - inset]) for (const z of [v0 + inset, v1 - inset]) addStageBox(THREE, parent, x - r, yBase, z - r, x + r, yBase + height, z + r, rebarMat);
|
|
51052
51241
|
for (let y = yBase + 0.08; y < yBase + height - 0.03; y += 0.14) addStageBox(THREE, parent, u0 + inset, y, v0 + inset, u1 - inset, y + 6e-3, v1 - inset, rebarMat);
|
|
51053
51242
|
}
|
|
51243
|
+
var DIRT_BED_INSET = 0.03;
|
|
51054
51244
|
function createStageMaterials(THREE) {
|
|
51055
51245
|
return {
|
|
51056
51246
|
dirt: new THREE.MeshStandardMaterial({ color: 9073232, roughness: 0.96 }),
|
|
51057
51247
|
footing: new THREE.MeshStandardMaterial({ color: 8025710, roughness: 0.92 }),
|
|
51058
|
-
|
|
51248
|
+
// the ground beams are waterproofed (black bitumen on their top and sides) before the masonry goes up on them
|
|
51249
|
+
baldrame: new THREE.MeshStandardMaterial({ color: 2894375, roughness: 0.7 }),
|
|
51059
51250
|
slab0: new THREE.MeshStandardMaterial({ color: 10920600, roughness: 0.86 }),
|
|
51060
51251
|
// pillars, beams and slabs are cast in one concrete: where they meet, they are one surface
|
|
51061
51252
|
concrete: new THREE.MeshStandardMaterial({ color: 10262672, roughness: 0.82 }),
|
|
@@ -51293,11 +51484,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
51293
51484
|
parts2.push(...ob.parts);
|
|
51294
51485
|
openings.push(...ob.openings);
|
|
51295
51486
|
}
|
|
51296
|
-
const footprint = rawStructure.parts.filter((p) => p.
|
|
51487
|
+
const footprint = rawStructure.parts.filter((p) => p.y0 <= 0.1);
|
|
51297
51488
|
if (footprint.length) {
|
|
51298
|
-
addStageBox(THREE, foundation, Math.min(...footprint.map((p) => p.aabb[0]))
|
|
51489
|
+
addStageBox(THREE, foundation, Math.min(...footprint.map((p) => p.aabb[0])) + DIRT_BED_INSET, -0.06, Math.min(...footprint.map((p) => p.aabb[1])) + DIRT_BED_INSET, Math.max(...footprint.map((p) => p.aabb[2])) - DIRT_BED_INSET, 6e-3, Math.max(...footprint.map((p) => p.aabb[3])) - DIRT_BED_INSET, mats.dirt, "foundation_dirt_bed");
|
|
51299
51490
|
}
|
|
51300
|
-
for (const e of outbuildings ?? []) addStageBox(THREE, foundation, e.aabb[0]
|
|
51491
|
+
for (const e of outbuildings ?? []) addStageBox(THREE, foundation, e.aabb[0] + DIRT_BED_INSET, -0.06, e.aabb[1] + DIRT_BED_INSET, e.aabb[2] - DIRT_BED_INSET, 6e-3, e.aabb[3] - DIRT_BED_INSET, mats.dirt, `${e.id}_dirt_bed`);
|
|
51301
51492
|
const seen = /* @__PURE__ */ new Set();
|
|
51302
51493
|
const foundations = parts2.filter(isFoundation).filter((p) => !seen.has(p.id) && !!seen.add(p.id)).map(foundationSolid);
|
|
51303
51494
|
for (const s of foundations) addStageBox(THREE, foundation, s.aabb[0], s.y0, s.aabb[1], s.aabb[2], s.y1, s.aabb[3], mats[s.kind], s.id);
|
|
@@ -51520,8 +51711,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
51520
51711
|
wireL(span.a, span.b, radius);
|
|
51521
51712
|
});
|
|
51522
51713
|
};
|
|
51523
|
-
const wiringSpans = (P, drop) => {
|
|
51524
|
-
const poleId = (u) => "pole:" + u.toFixed(1),
|
|
51714
|
+
const wiringSpans = (P, drop, ownPole) => {
|
|
51715
|
+
const poleId = (u) => "pole:" + u.toFixed(1), piecePoles = ownPole ? [P.u - 22, P.u, P.u + 22] : [P.u - 22, P.u + 22], nearestPole = (x) => poleId(piecePoles.reduce((best, u) => Math.abs(u - x) < Math.abs(best - x) ? u : best));
|
|
51525
51716
|
if (!Number.isFinite(shared2.ctx.segmentLimits.wiring)) {
|
|
51526
51717
|
cursor.pc = pieceRecord("wiring:grid", "copper", null, { tags: ["wiring"] });
|
|
51527
51718
|
for (const dx of [-0.65, -0.2, 0.25, 0.7]) for (const k of [-1, 1]) wireL([P.u + dx, P.h - 0.5, P.v], [P.u + k * 22 + dx, P.h - 0.5, P.v], 7e-3);
|
|
@@ -51565,25 +51756,44 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
51565
51756
|
for (let i = 0; i < n; i++) wireSpans(at2(i / n), at2((i + 1) / n), 9e-3, "wiring:service:" + i, "ground");
|
|
51566
51757
|
cursor.pc = null;
|
|
51567
51758
|
};
|
|
51759
|
+
const servicePost = (u, v, h) => {
|
|
51760
|
+
const half = NETWORK_POST.half, buried = postEmbedment(h), below = shared2.ctx.visorScene ? 0 : buried, face = v - half;
|
|
51761
|
+
cursor.group = lotGroup;
|
|
51762
|
+
cursor.pc = pieceRecord("pole:" + u.toFixed(1), "concrete", null, { tags: ["pole"], holder: "ground", holdJoint: footingJointOf("concrete"), embedment: { depth: buried, width: half * 2 } });
|
|
51763
|
+
bx("plain", u - half, -below, v - half, u + half, h, v + half, concreteColor);
|
|
51764
|
+
bx("metal", u - 0.02, NETWORK_POST.anchor - 0.06, face - NETWORK_POST.bracket, u + 0.02, NETWORK_POST.anchor + 0.04, face - 2e-3, iron);
|
|
51765
|
+
cursor.pc = null;
|
|
51766
|
+
};
|
|
51767
|
+
const serviceMast = (mast) => {
|
|
51768
|
+
const path = mastPathOf(mast).map((p) => [p[0], p[2], p[1]]), end = path[path.length - 1], galvanised = 11120307;
|
|
51769
|
+
cursor.group = lotGroup;
|
|
51770
|
+
cursor.pc = pieceRecord("mast:" + mast.u.toFixed(1), "steel", null, { tags: ["mast"], holdOn: "wall", holdJoint: "clip" });
|
|
51771
|
+
for (let i = 0; i + 1 < path.length; i++) pipe2(path[i], path[i + 1], MAST_PIPE_RADIUS * 2, galvanised);
|
|
51772
|
+
cylBase("metal", end[0], end[1] - WEATHERHEAD.capLength, end[2], WEATHERHEAD.capRadius, WEATHERHEAD.capLength, galvanised);
|
|
51773
|
+
cursor.pc = null;
|
|
51774
|
+
};
|
|
51568
51775
|
if (en22) {
|
|
51569
51776
|
const P = en22.pole, from = shared2.ctx.serviceFrom, kitDraws = !!(KV && KV.serviceEntrance);
|
|
51570
51777
|
if (P) {
|
|
51571
|
-
if (!kitDraws)
|
|
51778
|
+
if (!kitDraws && en22.street === "network") servicePost(P.u, P.v, P.h);
|
|
51779
|
+
else if (!kitDraws) pole(P.u, P.v, P.h);
|
|
51572
51780
|
info.pole = { pos: [P.u, 0, P.v], h: P.h };
|
|
51573
51781
|
}
|
|
51574
|
-
const landing = en22.drop[0];
|
|
51575
|
-
if (from && landing) {
|
|
51576
|
-
streetDrop(from, [landing[0], landing[2], landing[1]]);
|
|
51782
|
+
const landing = en22.drop[0], network = en22.street === "network";
|
|
51783
|
+
if ((from || network) && landing) {
|
|
51784
|
+
if (from && !network) streetDrop(from, [landing[0], landing[2], landing[1]]);
|
|
51577
51785
|
const end = en22.drop[en22.drop.length - 1];
|
|
51578
51786
|
if (P && end && en22.drop.length > 1 && !kitDraws) {
|
|
51579
51787
|
wireSpans([landing[0], landing[2], landing[1]], [end[0], end[2], end[1]], 9e-3, "wiring:drop:0", "pole:" + P.u.toFixed(1));
|
|
51580
51788
|
cursor.pc = null;
|
|
51581
51789
|
}
|
|
51582
|
-
} else if (P) {
|
|
51790
|
+
} else if (P && !network) {
|
|
51583
51791
|
for (const k of [-1, 1]) pole(P.u + k * 22, P.v, P.h);
|
|
51584
|
-
wiringSpans(P, en22.drop && en22.drop.length > 1 && !kitDraws ? en22.drop : null);
|
|
51792
|
+
wiringSpans(P, en22.drop && en22.drop.length > 1 && !kitDraws ? en22.drop : null, !kitDraws);
|
|
51585
51793
|
}
|
|
51586
|
-
if (en22.
|
|
51794
|
+
if (en22.mast) {
|
|
51795
|
+
if (!(KV && KV.serviceMast)) serviceMast(en22.mast);
|
|
51796
|
+
} else if (en22.descent && en22.descent.length > 1 && !(KV && (KV.serviceEntrance || !P))) {
|
|
51587
51797
|
const d0 = en22.descent[0], d1 = en22.descent[en22.descent.length - 1];
|
|
51588
51798
|
cylBase("metal", d0[0], d1[2], d0[1], 0.02, d0[2] - d1[2] - (shared2.ctx.visorScene ? 0 : 0.01), 9080466);
|
|
51589
51799
|
const hw = shared2.ctx.visorScene ? 0.05 : 0.047;
|
|
@@ -51763,6 +51973,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
51763
51973
|
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 };
|
|
51764
51974
|
});
|
|
51765
51975
|
cursor.group = "f0";
|
|
51976
|
+
const stage = cursor.stage;
|
|
51977
|
+
if (shared2.ctx.constructionStages) cursor.stage = "exterior";
|
|
51766
51978
|
const junction = (A, e, sd) => {
|
|
51767
51979
|
let r = 0;
|
|
51768
51980
|
for (const B of ws) {
|
|
@@ -51814,6 +52026,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
51814
52026
|
strip(W, y0, y0 + SIDEWALK_TOP, 0, W, "sidewalk", cal, A.w.id ? `sidewalk:${A.w.id}:${sd < 0 ? 0 : 1}` : void 0, SIDEWALK_SLABS);
|
|
51815
52027
|
}
|
|
51816
52028
|
if (!shared2.ctx.baseboardBand) doorways(ws, W, y0, cal);
|
|
52029
|
+
cursor.stage = stage;
|
|
51817
52030
|
}
|
|
51818
52031
|
function clearSpan({ a, b, au, across: across2, rise }) {
|
|
51819
52032
|
let from = a, to = b;
|
|
@@ -51842,11 +52055,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
51842
52055
|
const slab = au ? [a, y0, lo, b, y0 + SIDEWALK_TOP, hi] : [lo, y0, a, hi, y0 + SIDEWALK_TOP, b];
|
|
51843
52056
|
bx("sidewalk", slab[0], slab[1], slab[2], slab[3], slab[4], slab[5], cal);
|
|
51844
52057
|
if (!shared2.ctx.visorScene) shared2.ctx.paving?.push(slab);
|
|
52058
|
+
const paving = cursor.stage;
|
|
52059
|
+
if (shared2.ctx.constructionStages) cursor.stage = "finishes";
|
|
51845
52060
|
const top = y0 + (shared2.ctx.constructionStages ? FLOOR_OVER_GROUND : 0) + 2e-3, t0 = d.pos - th / 2, t1 = d.pos + th / 2;
|
|
51846
52061
|
const [from, to] = clearSpan({ a: a + DOOR_JAMB_WIDTH, b: b - DOOR_JAMB_WIDTH, au, across: [t0, t1], rise: [y0, top] });
|
|
51847
52062
|
cursor.pc = pieceRecord(`threshold:${d.id}`, THRESHOLD.material, null, { floor: 0, mass: Math.round((to - from) * th * (top - y0) * THRESHOLD.density * 100) / 100, tags: ["threshold"], holdOn: "floor", holdJoint: footingJointOf(THRESHOLD.material) });
|
|
51848
52063
|
if (au) bx("plain", from, y0, t0, to, top, t1, THRESHOLD.color);
|
|
51849
52064
|
else bx("plain", t0, y0, from, t1, top, to, THRESHOLD.color);
|
|
52065
|
+
cursor.stage = paving;
|
|
51850
52066
|
}
|
|
51851
52067
|
cursor.pc = null;
|
|
51852
52068
|
}
|
|
@@ -52098,7 +52314,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
52098
52314
|
dresser(M, A) {
|
|
52099
52315
|
const { b: lb, c: lc } = kk(M, A), w = M.w, d = M.d, h = M.h, wood = paletteColor(M, "wood", 6965812), ng = h > 0.7 ? 3 : 2, gh = (h - 0.12) / ng;
|
|
52100
52316
|
lb("wood", 0, 0.04, 0, w, h - 0.08, d, wood);
|
|
52101
|
-
lb("wood", 0, h - 0.04, 0, w + 0.03, 0.04, d + 0.03, sh(wood, 1.15));
|
|
52317
|
+
if (M.visorScene) lb("wood", 0, h - 0.04, 0, w + 0.03, 0.04, d + 0.03, sh(wood, 1.15));
|
|
52318
|
+
else lb("wood", 0, h - 0.04, 75e-4, w, 0.04, d + 0.015, sh(wood, 1.15));
|
|
52102
52319
|
for (const sx of [-1, 1]) for (const sz of [-1, 1]) lb("wood", sx * (w / 2 - 0.04), 0, sz * (d / 2 - 0.04), 0.04, 0.04, 0.04, sh(wood, 0.4));
|
|
52103
52320
|
for (let k = 0; k < ng; k++) {
|
|
52104
52321
|
lb("wood", 0, 0.08 + k * gh, d / 2 + 5e-3, w - 0.06, gh - 0.03, 0.012, sh(wood, 1.12));
|
|
@@ -52363,10 +52580,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
52363
52580
|
lb("plain", 0, h - 0.18, d / 2 + 5e-3, w - 0.1, 0.1, 0.01, 3816e3);
|
|
52364
52581
|
},
|
|
52365
52582
|
hamper(M, A) {
|
|
52366
|
-
const { c: lc } = kk(M, A);
|
|
52367
|
-
lc("plain", 0, 0, 0,
|
|
52368
|
-
lc("plain", 0, M.h - 0.01, 0,
|
|
52583
|
+
const { c: lc } = kk(M, A), r = M.visorScene ? M.w / 2 : Math.min(M.w, M.d) / 2;
|
|
52584
|
+
lc("plain", 0, 0, 0, r, M.h, paletteColor(M, "fabric_accent", 10127978));
|
|
52585
|
+
lc("plain", 0, M.h - 0.01, 0, r - 0.03, 0.02, 2763306);
|
|
52369
52586
|
},
|
|
52587
|
+
// (outside the Visor's scene the round basket fits its footprint's narrow side: it stood 2.5 cm in the wall behind it)
|
|
52370
52588
|
trash_bin(M, A) {
|
|
52371
52589
|
const { c: lc } = kk(M, A);
|
|
52372
52590
|
lc("plain", 0, 0, 0, M.w / 2, M.h, 6974574);
|
|
@@ -52708,6 +52926,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
52708
52926
|
mine("gas_cylinder", FURNITURE.gas_cylinder);
|
|
52709
52927
|
mine("cooking_gas_cylinder", FURNITURE.cooking_gas_cylinder);
|
|
52710
52928
|
mine("gas_shelter", FURNITURE.gas_shelter);
|
|
52929
|
+
mine("gas_hose", FURNITURE.gas_hose);
|
|
52711
52930
|
mine("outdoor_bin", FURNITURE.outdoor_bin);
|
|
52712
52931
|
mine("outdoor_pot", FURNITURE.outdoor_pot);
|
|
52713
52932
|
mine("planter_bed", FURNITURE.planter_bed);
|
|
@@ -52907,6 +53126,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
52907
53126
|
return (r * r + r0 * r0 - d * d) / (2 * r * r0) > BLOB_CROSSING;
|
|
52908
53127
|
});
|
|
52909
53128
|
}
|
|
53129
|
+
var FICUS_SPREAD = 1.32;
|
|
52910
53130
|
function installFurniturePlants(K, shared2) {
|
|
52911
53131
|
const seedKey = (id) => K.seedKey(id);
|
|
52912
53132
|
const { SEED, kit2, rngString, sh } = K;
|
|
@@ -53003,19 +53223,20 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
53003
53223
|
}
|
|
53004
53224
|
function potPlant(M, A, o = {}) {
|
|
53005
53225
|
const K2 = kit2(M, A), rnd = rngString(SEED() + "|" + seedKey(M.seed) + "|vaso"), h = M.h || 0.9, r = Math.min(0.26, Math.min(M.w || 0.4, M.d || 0.4) * 0.42), pot2 = M.color != null ? M.color : [11886652, 11034686, 15262420, 4868684, 8030860][rnd() * 5 | 0];
|
|
53006
|
-
const
|
|
53226
|
+
const reach2 = M.visorScene || M.reach == null ? Number.POSITIVE_INFINITY : M.reach, rp = Math.min(r, reach2 / 1.1);
|
|
53227
|
+
const ph = Math.min(0.34, h * 0.38), top = potModel(K2, 0, 0, 0, rp, ph, pot2), green2 = M.palette && M.palette.plant != null ? M.palette.plant : GREENS2[rnd() * 5 | 0], type = o.type || ["ficus", "dracena", "samambaia"][rnd() * 3 | 0];
|
|
53007
53228
|
if (type === "ficus") {
|
|
53008
53229
|
K2.t("wood", [0, top, 0], [0.02, top + (h - ph) * 0.45, 0], 0.014, 6965808);
|
|
53009
|
-
blobs(K2, 0, top + (h - ph) * 0.35, 0, Math.max(0.2, (h - ph) * 0.4), 9, green2, rnd);
|
|
53230
|
+
blobs(K2, 0, top + (h - ph) * 0.35, 0, Math.min(Math.max(0.2, (h - ph) * 0.4), reach2 / FICUS_SPREAD), 9, green2, rnd);
|
|
53010
53231
|
} else if (type === "dracena") {
|
|
53011
53232
|
for (let i = 0; i < 3; i++) {
|
|
53012
53233
|
const a = i * 2.1, hh = (h - ph) * (0.5 + 0.2 * i / 2);
|
|
53013
53234
|
const foot = M.visorScene ? 0 : 0.02;
|
|
53014
53235
|
K2.t("wood", [Math.cos(a) * foot, top, Math.sin(a) * foot], [Math.cos(a) * 0.04, top + hh, Math.sin(a) * 0.04], 0.012, 8022600);
|
|
53015
|
-
for (let k = 0; k < 7; k++) arcLeaf(K2, Math.cos(a) * 0.04, top + hh, Math.sin(a) * 0.04, k * 0.9 + a, 0.22 + rnd() * 0.08, 0.35 - k % 3 * 0.1, 0.3, 0.028, sh(green2, 0.85 + rnd() * 0.3), false, 4);
|
|
53236
|
+
for (let k = 0; k < 7; k++) arcLeaf(K2, Math.cos(a) * 0.04, top + hh, Math.sin(a) * 0.04, k * 0.9 + a, (0.22 + rnd() * 0.08) * Math.min(1, (reach2 - 0.04) / 0.3), 0.35 - k % 3 * 0.1, 0.3, 0.028, sh(green2, 0.85 + rnd() * 0.3), false, 4);
|
|
53016
53237
|
}
|
|
53017
53238
|
} else {
|
|
53018
|
-
for (let k = 0; k < 11; k++) arcLeaf(K2, 0, top, 0, k * 0.6 + rnd() * 0.3, (h - ph) * (0.7 + rnd() * 0.4), 0.9 - k % 3 * 0.25, 1.2, 0.05, sh(green2, 0.8 + rnd() * 0.35), true, 6);
|
|
53239
|
+
for (let k = 0; k < 11; k++) arcLeaf(K2, 0, top, 0, k * 0.6 + rnd() * 0.3, (h - ph) * (0.7 + rnd() * 0.4) * Math.min(1, reach2 / ((h - ph) * 1.1)), 0.9 - k % 3 * 0.25, 1.2, 0.05, sh(green2, 0.8 + rnd() * 0.35), true, 6);
|
|
53019
53240
|
}
|
|
53020
53241
|
}
|
|
53021
53242
|
function tablePot(M, A) {
|
|
@@ -53239,13 +53460,21 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
53239
53460
|
const copper = 12088115;
|
|
53240
53461
|
for (let k = 0; k + 1 < shelter.route.length; k++) K2.t("metal", local(shelter.route[k]), local(shelter.route[k + 1]), 75e-4, copper);
|
|
53241
53462
|
if (shelter.hose.length > 1) {
|
|
53242
|
-
const valve = local(shelter.hose[0])
|
|
53463
|
+
const valve = local(shelter.hose[0]);
|
|
53243
53464
|
K2.b("metal", valve[0], valve[1] - 0.02, valve[2], 0.04, 0.04, 0.04, 13214282);
|
|
53244
|
-
const sag = [(valve[0] + stove[0]) / 2, Math.max(0.1, Math.min(valve[1], stove[1]) - 0.15), (valve[2] + stove[2]) / 2];
|
|
53245
|
-
K2.t("plain", [valve[0], valve[1] - 0.02, valve[2]], sag, 0.011, 12071454);
|
|
53246
|
-
K2.t("plain", sag, stove, 0.011, 12071454);
|
|
53247
53465
|
}
|
|
53248
53466
|
}
|
|
53467
|
+
const GAS_HOSE_COLOR = 14267452;
|
|
53468
|
+
FURNITURE.gas_hose = function(M, A) {
|
|
53469
|
+
const shelter = shelterOf(M);
|
|
53470
|
+
if (!shelter || shelter.hose.length < 2) return;
|
|
53471
|
+
const K2 = kit2(M, A);
|
|
53472
|
+
const local = (p) => [p[0] - M.x, p[2] - (typeof M.y === "number" ? M.y : 0), p[1] - M.z];
|
|
53473
|
+
const valve = local(shelter.hose[0]), stove = local(shelter.hose[shelter.hose.length - 1]);
|
|
53474
|
+
const sag = [(valve[0] + stove[0]) / 2, Math.max(0.1, Math.min(valve[1], stove[1]) - 0.15), (valve[2] + stove[2]) / 2];
|
|
53475
|
+
K2.t("plain", [valve[0], valve[1] - 0.02, valve[2]], sag, 0.011, GAS_HOSE_COLOR);
|
|
53476
|
+
K2.t("plain", sag, stove, 0.011, GAS_HOSE_COLOR);
|
|
53477
|
+
};
|
|
53249
53478
|
FURNITURE.mailbox = function(M, A) {
|
|
53250
53479
|
const K2 = kit2(M, A, 0), w = M.w || 0.3, d = M.d || 0.22, h = M.h || 0.3, y = M.y != null && M.y > 0 ? M.y : 1, structure = STYLE(), pc = structure === "high" ? 2763824 : structure === "mid" ? 13676640 : 13126202, rnd = rngString(SEED() + "|" + seedKey(M.seed) + "|correio");
|
|
53251
53480
|
if (M.pole !== false && !(M.y != null && M.y > 0)) {
|
|
@@ -53330,6 +53559,57 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
53330
53559
|
const defined = { extraTypes };
|
|
53331
53560
|
Object.assign(K, defined);
|
|
53332
53561
|
}
|
|
53562
|
+
var POTTED_PLANT_TYPES = /* @__PURE__ */ new Set(["floor_plant", "floor_plant_tall", "floor_plant_low", "plant_tall", "plant_short", "outdoor_pot", "table_plant"]);
|
|
53563
|
+
var PLANT_CLEAR = 0.04;
|
|
53564
|
+
var PLANT_MIN_REACH = 0.14;
|
|
53565
|
+
var PLANT_SPAN = [0.03, 2.4];
|
|
53566
|
+
function footprintOf(m) {
|
|
53567
|
+
const c = Math.abs(Math.cos(m.ry || 0)), s = Math.abs(Math.sin(m.ry || 0)), hx = ((m.w || 0) * c + (m.d || 0) * s) / 2, hz = ((m.w || 0) * s + (m.d || 0) * c) / 2;
|
|
53568
|
+
return [m.x - hx, m.z - hz, m.x + hx, m.z + hz];
|
|
53569
|
+
}
|
|
53570
|
+
var reachTo = (x, z, x0, z0, x1, z1) => Math.hypot(Math.max(x0 - x, 0, x - x1), Math.max(z0 - z, 0, z - z1));
|
|
53571
|
+
function freeReachOf(p) {
|
|
53572
|
+
const y0 = p.y + PLANT_SPAN[0], y1 = p.y + PLANT_SPAN[1];
|
|
53573
|
+
let reach2 = Number.POSITIVE_INFINITY;
|
|
53574
|
+
for (const b of p.boxes) if (b[1] < y1 && b[4] > y0) reach2 = Math.min(reach2, reachTo(p.x, p.z, b[0], b[2], b[3], b[5]));
|
|
53575
|
+
for (const m of p.items) {
|
|
53576
|
+
if (m === p.self || m.id === p.self.id || m.floor !== p.self.floor || m.flat || m.category === "ground_cover" || m.w == null || m.d == null) continue;
|
|
53577
|
+
const bottom = p.base + (m.y || 0), top = bottom + (m.h || 0);
|
|
53578
|
+
if (bottom >= y1 || top <= y0) continue;
|
|
53579
|
+
const r = footprintOf(m);
|
|
53580
|
+
reach2 = Math.min(reach2, reachTo(p.x, p.z, r[0], r[1], r[2], r[3]));
|
|
53581
|
+
}
|
|
53582
|
+
return reach2 - PLANT_CLEAR;
|
|
53583
|
+
}
|
|
53584
|
+
function vertexMark(accs) {
|
|
53585
|
+
const mark = /* @__PURE__ */ new Map();
|
|
53586
|
+
for (const a of accs.values()) mark.set(a, a.nv);
|
|
53587
|
+
return mark;
|
|
53588
|
+
}
|
|
53589
|
+
function partToHouse(parts2, group, p) {
|
|
53590
|
+
let at2 = p, name = group;
|
|
53591
|
+
for (let part = parts2.get(name); part; part = parts2.get(name)) {
|
|
53592
|
+
const c = Math.cos(part.ry), s = Math.sin(part.ry);
|
|
53593
|
+
at2 = [at2[0] * c + at2[2] * s + (part.pos[0] ?? 0), at2[1] + (part.pos[1] ?? 0), -at2[0] * s + at2[2] * c + (part.pos[2] ?? 0)];
|
|
53594
|
+
name = part.parent;
|
|
53595
|
+
}
|
|
53596
|
+
return at2;
|
|
53597
|
+
}
|
|
53598
|
+
function boundsSince(accs, mark, parts2) {
|
|
53599
|
+
const byName = new Map(parts2.map((p) => [p.name, p]));
|
|
53600
|
+
const box4 = [Infinity, Infinity, Infinity, -Infinity, -Infinity, -Infinity];
|
|
53601
|
+
for (const a of accs.values()) {
|
|
53602
|
+
for (let v = mark.get(a) ?? 0; v < a.nv; v++) {
|
|
53603
|
+
const local = [a.p[v * 3], a.p[v * 3 + 1], a.p[v * 3 + 2]];
|
|
53604
|
+
const p = a.group.startsWith("part:") ? partToHouse(byName, a.group, local) : local;
|
|
53605
|
+
for (let k = 0; k < 3; k++) {
|
|
53606
|
+
box4[k] = Math.min(box4[k], p[k]);
|
|
53607
|
+
box4[k + 3] = Math.max(box4[k + 3], p[k]);
|
|
53608
|
+
}
|
|
53609
|
+
}
|
|
53610
|
+
}
|
|
53611
|
+
return box4[0] <= box4[3] ? box4 : null;
|
|
53612
|
+
}
|
|
53333
53613
|
var COVER_STEP = 3e-3;
|
|
53334
53614
|
var PANEL_CLEAR = 0.05;
|
|
53335
53615
|
function installFurniturePlaceItems(K, shared2) {
|
|
@@ -53376,6 +53656,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
53376
53656
|
M.base += COVER_STEP * under;
|
|
53377
53657
|
covers.push(own);
|
|
53378
53658
|
}
|
|
53659
|
+
if (!shared2.ctx.visorScene && POTTED_PLANT_TYPES.has(m.type)) {
|
|
53660
|
+
const reach2 = freeReachOf({ x: M.x, z: M.z, y: M.base + (M.y ?? 0), boxes: (exterior ? shared2.ctx.occupied : keepOut).concat((drawn.get(cursor.group) ?? []).flat()), items: list2, self: m, base: M.base });
|
|
53661
|
+
if (reach2 < PLANT_MIN_REACH) continue;
|
|
53662
|
+
M.reach = reach2;
|
|
53663
|
+
}
|
|
53379
53664
|
if (shared2.ctx.veg && vegItem(m, M, exterior ? "lot" : "f" + f)) continue;
|
|
53380
53665
|
if (m.type === "cooking_gas_cylinder" && m.shelter && T2.gas_shelter) {
|
|
53381
53666
|
const st = cursor.stage;
|
|
@@ -53386,6 +53671,15 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
53386
53671
|
cursor.stage = st;
|
|
53387
53672
|
}
|
|
53388
53673
|
}
|
|
53674
|
+
if (m.type === "cooking_gas_cylinder" && m.shelter && T2.gas_hose) {
|
|
53675
|
+
const st = cursor.stage;
|
|
53676
|
+
if (shared2.ctx.constructionStages) cursor.stage = "furniture";
|
|
53677
|
+
try {
|
|
53678
|
+
buildItem2(m, M, T2.gas_hose, api, cursor.group);
|
|
53679
|
+
} finally {
|
|
53680
|
+
cursor.stage = st;
|
|
53681
|
+
}
|
|
53682
|
+
}
|
|
53389
53683
|
if (shared2.ctx.iv && shared2.ctx.iv.replace.has(m.id)) {
|
|
53390
53684
|
registerCollision(m, M);
|
|
53391
53685
|
continue;
|
|
@@ -53418,8 +53712,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
53418
53712
|
}
|
|
53419
53713
|
const mine = shared2.ctx.itemBoxes;
|
|
53420
53714
|
if (mine) drawn.set(cursor.group, (drawn.get(cursor.group) ?? []).concat([mine]));
|
|
53715
|
+
const mark = shared2.ctx.itemBounds ? vertexMark(cursor.accs) : null;
|
|
53421
53716
|
try {
|
|
53422
53717
|
buildItem2(m, M, ent, api, cursor.group);
|
|
53718
|
+
if (mark) recordBounds(m, mark);
|
|
53423
53719
|
} catch (e) {
|
|
53424
53720
|
cursor.group = exterior ? "lot" : "f" + f;
|
|
53425
53721
|
console.warn("builder", m.type, e);
|
|
@@ -53448,6 +53744,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
53448
53744
|
}
|
|
53449
53745
|
return noModel;
|
|
53450
53746
|
}
|
|
53747
|
+
function recordBounds(m, mark) {
|
|
53748
|
+
const box4 = boundsSince(cursor.accs, mark, K.PARTS);
|
|
53749
|
+
if (box4) shared2.ctx.itemBounds?.push({ id: m.id, type: m.type, category: m.category ?? null, room: m.room ?? null, floor: m.floor, by: "furniture", box: box4 });
|
|
53750
|
+
}
|
|
53451
53751
|
const ROOF_CLEAR = 0.06;
|
|
53452
53752
|
function overRoof(m, M, f) {
|
|
53453
53753
|
const R = shared2.ctx.r, inside22 = (rooms) => rooms.find((c) => rectsOf2(c).some((r) => r[0] < m.x && m.x < r[2] && r[1] < m.z && m.z < r[3]));
|
|
@@ -53563,6 +53863,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
53563
53863
|
const defined = { houseItems, waterTankOfHouse, hashColor, labeledBox };
|
|
53564
53864
|
Object.assign(K, defined);
|
|
53565
53865
|
}
|
|
53866
|
+
var PLANT_RADIUS_MARGIN = 1.08;
|
|
53867
|
+
var PLANT_MIN_SCALE = 0.4;
|
|
53566
53868
|
function installVegetationBridge(K, shared2) {
|
|
53567
53869
|
const seedKey = (id) => K.seedKey(id);
|
|
53568
53870
|
const { THREE, SEED, rngString } = K;
|
|
@@ -53577,7 +53879,6 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
53577
53879
|
floor_plant_tall: VEG_POT,
|
|
53578
53880
|
floor_plant: VEG_POT,
|
|
53579
53881
|
outdoor_pot: VEG_POT,
|
|
53580
|
-
toilet: VEG_POT,
|
|
53581
53882
|
floor_plant_low: ["potted_succulents", "potted_cactus"],
|
|
53582
53883
|
table_plant: ["potted_succulents", "potted_cactus"],
|
|
53583
53884
|
clump: ["lawn_tuft"],
|
|
@@ -53626,9 +53927,41 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
53626
53927
|
}
|
|
53627
53928
|
return true;
|
|
53628
53929
|
}
|
|
53629
|
-
|
|
53930
|
+
if (M.reach != null) {
|
|
53931
|
+
const fit = fitted(V, lst, pick2(lst), sd, M.reach);
|
|
53932
|
+
if (!fit) return true;
|
|
53933
|
+
G.pl.push({ species: fit.species, x: M.x, z: M.z, ry: M.ry || 0, scale: fit.scale, seed: sd });
|
|
53934
|
+
const r = fit.radius * fit.scale;
|
|
53935
|
+
shared2.ctx.itemBounds?.push({ id: m.id, type: m.type, category: m.category ?? null, room: m.room ?? null, floor: m.floor, by: "vegetation", box: [M.x - r, y, M.z - r, M.x + r, y + fit.height * fit.scale, M.z + r] });
|
|
53936
|
+
return true;
|
|
53937
|
+
}
|
|
53938
|
+
const species = pick2(lst);
|
|
53939
|
+
G.pl.push({ species, x: M.x, z: M.z, ry: M.ry || 0, scale: 1, seed: sd });
|
|
53940
|
+
if (shared2.ctx.itemBounds) {
|
|
53941
|
+
const size = speciesSize(V, species, sd);
|
|
53942
|
+
shared2.ctx.itemBounds.push({ id: m.id, type: m.type, category: m.category ?? null, room: m.room ?? null, floor: m.floor, by: "vegetation", box: [M.x - size.radius, y, M.z - size.radius, M.x + size.radius, y + size.height, M.z + size.radius] });
|
|
53943
|
+
}
|
|
53630
53944
|
return true;
|
|
53631
53945
|
}
|
|
53946
|
+
function speciesSize(V, id, seed) {
|
|
53947
|
+
const key2 = id + "|" + seed;
|
|
53948
|
+
let r = V.sizes.get(key2);
|
|
53949
|
+
if (!r) {
|
|
53950
|
+
r = V.G.generate ? V.G.generate(V.S.toSpec(id), { seed }).bounds : { radius: 0, height: 0 };
|
|
53951
|
+
V.sizes.set(key2, r);
|
|
53952
|
+
}
|
|
53953
|
+
return r;
|
|
53954
|
+
}
|
|
53955
|
+
function fitted(V, species, first, seed, reach2) {
|
|
53956
|
+
const sizeOf = (id) => speciesSize(V, id, seed);
|
|
53957
|
+
let best = null;
|
|
53958
|
+
for (const id of [first, ...species.filter((s) => s !== first)]) {
|
|
53959
|
+
const size = sizeOf(id), r = size.radius * PLANT_RADIUS_MARGIN, scale = r > reach2 ? reach2 / r : 1;
|
|
53960
|
+
if (scale === 1) return { species: id, scale, ...size };
|
|
53961
|
+
if (!best || scale > best.scale) best = { species: id, scale, ...size };
|
|
53962
|
+
}
|
|
53963
|
+
return best && best.scale >= PLANT_MIN_SCALE ? best : null;
|
|
53964
|
+
}
|
|
53632
53965
|
function assembleVegetation(groups) {
|
|
53633
53966
|
const V = shared2.ctx.veg;
|
|
53634
53967
|
if (!V) return;
|
|
@@ -53665,7 +53998,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
53665
53998
|
shared2.partState = /* @__PURE__ */ new Map();
|
|
53666
53999
|
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 });
|
|
53667
54000
|
shared2.inter = newInteractiveState();
|
|
53668
|
-
const MESSAGE_MS = 2200;
|
|
54001
|
+
const MESSAGE_MS = 2200, LAMP_OFF_COLOR = 15658214, LAMP_DIFFUSER_MATERIAL = "glass";
|
|
53669
54002
|
UV_SCALE.doorWood = 1;
|
|
53670
54003
|
UV_SCALE.doorPaint = 1;
|
|
53671
54004
|
function createInteractiveMaterials(mats) {
|
|
@@ -53716,6 +54049,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
53716
54049
|
mats.doorWood = new THREE.MeshLambertMaterial({ vertexColors: true, map: wood });
|
|
53717
54050
|
mats.doorPaint = new THREE.MeshLambertMaterial({ vertexColors: true, map: paint });
|
|
53718
54051
|
mats.off = new THREE.MeshBasicMaterial({ vertexColors: true, color: 9078656 });
|
|
54052
|
+
mats.lampOff = new THREE.MeshPhongMaterial({ color: LAMP_OFF_COLOR, shininess: 70, specular: 6710886, transparent: true, opacity: 0.9 });
|
|
53719
54053
|
}
|
|
53720
54054
|
const _EY = new THREE.Vector3(0, 1, 0), _UM3 = new THREE.Vector3(1, 1, 1);
|
|
53721
54055
|
const hudMessage = (text) => {
|
|
@@ -53756,6 +54090,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
53756
54090
|
o.geometry.applyMatrix4(inv);
|
|
53757
54091
|
o.userData.piece = def;
|
|
53758
54092
|
def.meshes.push(o);
|
|
54093
|
+
if (def.roomId && o.name.endsWith("/emissive")) o.userData.destructionMaterial = LAMP_DIFFUSER_MATERIAL;
|
|
53759
54094
|
}
|
|
53760
54095
|
});
|
|
53761
54096
|
outer.add(g);
|
|
@@ -53842,7 +54177,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
53842
54177
|
};
|
|
53843
54178
|
function applyLight(roomId) {
|
|
53844
54179
|
const on = lightOn(roomId), inter = I(), mats = shared2.mats;
|
|
53845
|
-
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;
|
|
54180
|
+
for (const d of inter.lights.get(roomId) || []) for (const m of d.meshes) if (m.name.endsWith("/emissive")) m.material = on ? mats.emissive : shared2.ctx.visorScene ? mats.off : mats.lampOff;
|
|
53846
54181
|
const sw = inter.defs.get("ix:int:" + roomId);
|
|
53847
54182
|
if (sw) {
|
|
53848
54183
|
sw.target = on ? 1 : 0;
|
|
@@ -54347,7 +54682,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
54347
54682
|
Object.assign(K, defined);
|
|
54348
54683
|
}
|
|
54349
54684
|
function installInteractablesBridge(K, shared2) {
|
|
54350
|
-
const { t, THREE, invalidate, invalidateShadow, cfg, DOC, LIGHT_TYPES, _Y, _q, _v3, accFor, applyLight, cursor, hashString: hashString2, hudMessage, lightBase, pieceRecord,
|
|
54685
|
+
const { t, THREE, invalidate, invalidateShadow, cfg, DOC, LIGHT_TYPES, _Y, _q, _v3, accFor, applyLight, cursor, hashString: hashString2, hudMessage, lightBase, pieceRecord, rgbOf, wallBlocks } = K;
|
|
54351
54686
|
const enter = (...a) => K.enter(...a);
|
|
54352
54687
|
const roomLightMask = (...a) => K.roomLightMask(...a);
|
|
54353
54688
|
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" };
|
|
@@ -54401,7 +54736,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
54401
54736
|
void world0;
|
|
54402
54737
|
const source = r;
|
|
54403
54738
|
const plane2 = A.plan(source, { seed: r.seed });
|
|
54404
|
-
const IV = { k: ik, plane: plane2, world: null, water, entries: /* @__PURE__ */ new Map(), roots: [], replace: /* @__PURE__ */ new Set(), roomStates: /* @__PURE__ */ new Map(), lampRoom: /* @__PURE__ */ new Map(), anim: /* @__PURE__ */ new Map(), screens: /* @__PURE__ */ new Map(), efx: null,
|
|
54739
|
+
const IV = { k: ik, plane: plane2, world: null, water, entries: /* @__PURE__ */ new Map(), roots: [], replace: /* @__PURE__ */ new Set(), roomStates: /* @__PURE__ */ new Map(), lampRoom: /* @__PURE__ */ new Map(), anim: /* @__PURE__ */ new Map(), screens: /* @__PURE__ */ new Map(), efx: null, contents: /* @__PURE__ */ new Map(), itemsDirty: true, itemsT: 0, dirty: true, list: null, listT: 0, t: 0, circuits: [], switchRooms: /* @__PURE__ */ new Set(), warnings: [], tBuild: 0 };
|
|
54405
54740
|
h.IV = IV;
|
|
54406
54741
|
const t0 = performance.now();
|
|
54407
54742
|
const lamps = new Set(plane2.items.filter((e) => e.type === "lamp").map((e) => e.id));
|
|
@@ -54571,20 +54906,18 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
54571
54906
|
if (!d.plug) continue;
|
|
54572
54907
|
const wire = (spec.wires || []).find((x) => x.id === d.id + "_cord"), pts = (wire ? wire.points : [d.plug]).map((p) => wl(o, p));
|
|
54573
54908
|
const sid = w.power.pluggedInto(E.id, d.id);
|
|
54574
|
-
|
|
54575
|
-
|
|
54576
|
-
|
|
54577
|
-
|
|
54578
|
-
|
|
54579
|
-
|
|
54580
|
-
|
|
54581
|
-
|
|
54582
|
-
|
|
54583
|
-
|
|
54584
|
-
for (const p of hang) pts.push(p);
|
|
54585
|
-
}
|
|
54586
|
-
}
|
|
54909
|
+
const cut = sid ? sid.indexOf(":") : -1, so = sid ? w.get(sid.slice(0, cut)) : void 0, sk = sid && so ? (so.spec.sockets || []).find((s) => s.id === sid.slice(cut + 1)) : void 0;
|
|
54910
|
+
if (!so || !sk) continue;
|
|
54911
|
+
const sp = wl(so, sk.pos), dir = [Math.sin(so.transform.ry), Math.cos(so.transform.ry)], last = pts[pts.length - 1];
|
|
54912
|
+
if (last[1] < 0.3 + E.pos[1]) {
|
|
54913
|
+
const foot = [sp[0] + dir[0] * 0.035, E.pos[1] + 0.012, sp[2] + dir[1] * 0.035];
|
|
54914
|
+
pts.push([last[0] + (foot[0] - last[0]) * 0.4, E.pos[1] + 0.012, last[2] + (foot[2] - last[2]) * 0.4], [last[0] + (foot[0] - last[0]) * 0.75, E.pos[1] + 0.012, last[2] + (foot[2] - last[2]) * 0.75], foot, [foot[0], Math.max(E.pos[1] + 0.1, sp[1] - 0.04), foot[2]], [sp[0] + dir[0] * 0.012, sp[1] - 0.01, sp[2] + dir[1] * 0.012]);
|
|
54915
|
+
} else {
|
|
54916
|
+
const hang = ik.gfx.catenary(last, [sp[0] + dir[0] * 0.012, sp[1] - 0.01, sp[2] + dir[1] * 0.012], 0.1, 8);
|
|
54917
|
+
hang.shift();
|
|
54918
|
+
for (const p of hang) pts.push(p);
|
|
54587
54919
|
}
|
|
54920
|
+
shared2.ctx.cordPaths?.push({ object: E.id, device: d.id, points: pts.map((p) => [p[0], p[1], p[2]]) });
|
|
54588
54921
|
tube2(pts, 6e-3, IV_WIRE.cord, 0, 0, 0, 0);
|
|
54589
54922
|
}
|
|
54590
54923
|
}
|
|
@@ -54620,12 +54953,16 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
54620
54953
|
}
|
|
54621
54954
|
IV.dirty = true;
|
|
54622
54955
|
switch (e.type) {
|
|
54623
|
-
case "part":
|
|
54956
|
+
case "part": {
|
|
54624
54957
|
if (e.part === "_x") break;
|
|
54625
54958
|
IV.anim.set(e.object + "|" + e.part, { object: e.object, part: e.part, target: e.target, t0: IV.t });
|
|
54626
54959
|
IV.itemsDirty = true;
|
|
54960
|
+
const E = e.target > 0 ? IV.entries.get(e.object) : void 0;
|
|
54961
|
+
if (E) ivContents(IV, E)?.sync();
|
|
54627
54962
|
invalidate();
|
|
54628
54963
|
break;
|
|
54964
|
+
}
|
|
54965
|
+
// the contents are drawn before the part moves, so they ride it from its first frame
|
|
54629
54966
|
case "device": {
|
|
54630
54967
|
const roomId = IV.lampRoom.get(e.object);
|
|
54631
54968
|
if (roomId) shared2.partState.set("light:" + roomId, !!e.on);
|
|
@@ -54636,6 +54973,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
54636
54973
|
hudMessage(e.text);
|
|
54637
54974
|
break;
|
|
54638
54975
|
case "pickup":
|
|
54976
|
+
IV.contents.get(e.object)?.sync();
|
|
54639
54977
|
IV.itemsDirty = true;
|
|
54640
54978
|
if (e.actor === "player" && e.stack) {
|
|
54641
54979
|
const d = IV.world.t("item." + e.stack.type);
|
|
@@ -54680,6 +55018,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
54680
55018
|
for (const [k, a] of IV.anim) {
|
|
54681
55019
|
const E = IV.entries.get(a.object);
|
|
54682
55020
|
if (E && E.parts) ik.gfx.syncObject(w, a.object, E.parts, { time: IV.t });
|
|
55021
|
+
IV.contents.get(a.object)?.sync();
|
|
54683
55022
|
if (w.partT(a.object, a.part) === a.target || IV.t - a.t0 > 4) IV.anim.delete(k);
|
|
54684
55023
|
}
|
|
54685
55024
|
invalidateShadow();
|
|
@@ -54719,28 +55058,23 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
54719
55058
|
invalidate();
|
|
54720
55059
|
}
|
|
54721
55060
|
}
|
|
54722
|
-
if (ivk.items && IV.itemsDirty && IV.t - IV.itemsT > 0.1
|
|
54723
|
-
}
|
|
54724
|
-
|
|
54725
|
-
|
|
54726
|
-
|
|
54727
|
-
|
|
54728
|
-
|
|
54729
|
-
|
|
54730
|
-
|
|
54731
|
-
|
|
54732
|
-
|
|
54733
|
-
|
|
54734
|
-
|
|
54735
|
-
cloth: [["box", 1, 1, 1, 0, 1]],
|
|
54736
|
-
paper: [["box", 1, 1, 1, 0, 1]],
|
|
54737
|
-
tool: [["box", 1, 1, 1, 0, 1]],
|
|
54738
|
-
shoe: [["box", 1, 0.7, 1, 0, 1]]
|
|
54739
|
-
};
|
|
55061
|
+
if (ivk.items && IV.itemsDirty && IV.t - IV.itemsT > 0.1) ivItems(IV, h);
|
|
55062
|
+
}
|
|
55063
|
+
function ivContents(IV, E) {
|
|
55064
|
+
const had = IV.contents.get(E.id);
|
|
55065
|
+
if (had) return had;
|
|
55066
|
+
const ik = IV.k, make3 = ik.GT.createContentsView;
|
|
55067
|
+
if (!ik.items || !ik.itemModel || !make3 || !(E.spec.containers || []).length) return null;
|
|
55068
|
+
const view = make3(THREE, { world: IV.world, objectId: E.id, root: E.root, buildItem: ik.itemModel });
|
|
55069
|
+
IV.contents.set(E.id, view);
|
|
55070
|
+
view.sync();
|
|
55071
|
+
invalidateShadow();
|
|
55072
|
+
return view;
|
|
55073
|
+
}
|
|
54740
55074
|
function ivItems(IV, h) {
|
|
54741
55075
|
IV.itemsDirty = false;
|
|
54742
55076
|
IV.itemsT = IV.t;
|
|
54743
|
-
const w = IV.world,
|
|
55077
|
+
const w = IV.world, f = IV.focus;
|
|
54744
55078
|
let fl = null;
|
|
54745
55079
|
if (f) {
|
|
54746
55080
|
h.houseGroup.updateWorldMatrix(true, false);
|
|
@@ -54748,57 +55082,20 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
54748
55082
|
h.houseGroup.worldToLocal(fl);
|
|
54749
55083
|
}
|
|
54750
55084
|
for (const E of IV.entries.values()) {
|
|
55085
|
+
const view = IV.contents.get(E.id);
|
|
55086
|
+
if (view) {
|
|
55087
|
+
view.sync();
|
|
55088
|
+
continue;
|
|
55089
|
+
}
|
|
54751
55090
|
if (fl && E.floor >= 0 && Math.hypot(E.pos[0] - fl.x, E.pos[2] - fl.z) > 14) continue;
|
|
54752
55091
|
for (const c of E.spec.containers || []) {
|
|
54753
|
-
if (
|
|
54754
|
-
if (
|
|
54755
|
-
|
|
54756
|
-
|
|
54757
|
-
const stack = st[i];
|
|
54758
|
-
if (stack && items[stack.type]) list2.push([E, c.id, i, items[stack.type]]);
|
|
55092
|
+
if (c.access && w.partT(E.id, c.access) <= 0) continue;
|
|
55093
|
+
if (w.contents(E.id, c.id).some((st) => st !== null)) {
|
|
55094
|
+
ivContents(IV, E);
|
|
55095
|
+
break;
|
|
54759
55096
|
}
|
|
54760
55097
|
}
|
|
54761
55098
|
}
|
|
54762
|
-
if (!list2.length) {
|
|
54763
|
-
if (IV.items) IV.items.visible = false;
|
|
54764
|
-
return;
|
|
54765
|
-
}
|
|
54766
|
-
cursor.group = "iv-items";
|
|
54767
|
-
try {
|
|
54768
|
-
for (const [E, cid, slot, def] of list2) {
|
|
54769
|
-
const p = w.slotPosition(E.id, cid, slot), form = IV_SHAPE[def.shape] || IV_SHAPE.box;
|
|
54770
|
-
for (const [geo, fx, fy, fz, y0, tone] of form) {
|
|
54771
|
-
const sx = def.size[0] * fx, sy = def.size[1] * fy, sz = def.size[2] * fz;
|
|
54772
|
-
_q.setFromAxisAngle(_Y, E.ry);
|
|
54773
|
-
const color2 = def.color == null ? 13421772 : def.color;
|
|
54774
|
-
put("plain", geo, p[0], p[1] + def.size[1] * y0 + sy / 2, p[2], _q, sx, sy, sz, tone === 1 ? color2 : sh(color2, tone));
|
|
54775
|
-
}
|
|
54776
|
-
}
|
|
54777
|
-
const A = cursor.accs.get("iv-items|plain");
|
|
54778
|
-
cursor.accs.delete("iv-items|plain");
|
|
54779
|
-
const gm = new THREE.BufferGeometry();
|
|
54780
|
-
gm.setAttribute("position", new THREE.BufferAttribute(A.p.slice(0, A.nv * 3), 3));
|
|
54781
|
-
gm.setAttribute("normal", new THREE.BufferAttribute(A.n.slice(0, A.nv * 3), 3));
|
|
54782
|
-
gm.setAttribute("color", new THREE.BufferAttribute(A.c.slice(0, A.nv * 3), 3));
|
|
54783
|
-
gm.setAttribute("uv", new THREE.BufferAttribute(A.u.slice(0, A.nv * 2), 2));
|
|
54784
|
-
gm.setIndex(new THREE.BufferAttribute(A.i.slice(0, A.ni), 1));
|
|
54785
|
-
gm.computeBoundingSphere();
|
|
54786
|
-
if (!IV.items) {
|
|
54787
|
-
const mesh2 = new THREE.Mesh(gm, shared2.mats.plain);
|
|
54788
|
-
IV.items = mesh2;
|
|
54789
|
-
mesh2.name = "iv-items";
|
|
54790
|
-
mesh2.castShadow = false;
|
|
54791
|
-
mesh2.receiveShadow = true;
|
|
54792
|
-
mesh2.frustumCulled = false;
|
|
54793
|
-
h.houseGroup.add(mesh2);
|
|
54794
|
-
} else {
|
|
54795
|
-
IV.items.geometry.dispose();
|
|
54796
|
-
IV.items.geometry = gm;
|
|
54797
|
-
}
|
|
54798
|
-
IV.items.visible = true;
|
|
54799
|
-
} finally {
|
|
54800
|
-
cursor.group = g0;
|
|
54801
|
-
}
|
|
54802
55099
|
invalidateShadow();
|
|
54803
55100
|
}
|
|
54804
55101
|
function ivTarget(IV, o, opt) {
|
|
@@ -54857,7 +55154,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
54857
55154
|
}
|
|
54858
55155
|
}
|
|
54859
55156
|
for (const sc of IV.screens.values()) sc.dispose();
|
|
54860
|
-
|
|
55157
|
+
for (const view of IV.contents.values()) view.dispose();
|
|
55158
|
+
IV.contents.clear();
|
|
54861
55159
|
}
|
|
54862
55160
|
function ivPublish(h) {
|
|
54863
55161
|
const IV = h.IV, w = IV.world, ik = IV.k, com = (fn) => (...a) => {
|
|
@@ -54924,7 +55222,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
54924
55222
|
};
|
|
54925
55223
|
return IV.pub;
|
|
54926
55224
|
}
|
|
54927
|
-
const defined = { IV_MATERIAL, IV_WIRE, IV_DOOR, ivGroup, ivAccumulate, ivBuild, ivRoomEffective, ivDraw, ivCords, ivAssemble, ivScreen, ivEvent, ivSeat, ivUpdate,
|
|
55225
|
+
const defined = { IV_MATERIAL, IV_WIRE, IV_DOOR, ivGroup, ivAccumulate, ivBuild, ivRoomEffective, ivDraw, ivCords, ivAssemble, ivScreen, ivEvent, ivSeat, ivUpdate, ivItems, ivContents, ivTarget, ivRoomLight, ivParts, ivDispose, ivPublish };
|
|
54928
55226
|
Object.assign(K, defined);
|
|
54929
55227
|
}
|
|
54930
55228
|
function installAnimationClotheslines(K, shared2) {
|
|
@@ -54987,7 +55285,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
54987
55285
|
return null;
|
|
54988
55286
|
}
|
|
54989
55287
|
const A = AD.plan ? AD : AD.create({ ...o.adapterOptions || {}, GameInteractables: GI, GameInteractablesHousehold: HH, locale: o.locale || cfg.locale, region: o.region, ...cfg.seedKey ? { seedKey: cfg.seedKey } : {} });
|
|
54990
|
-
return { GI, HH, GT, A, gfx: GT.createThreeAdapter(THREE, { document: DOC, Reflector }), items: o.items !== false, effects: o.effects !== false, effectSink: o.effectSink || null, camera: o.camera || null, onEvent: o.onEvent || null, onSeat: o.onSeat || null };
|
|
55288
|
+
return { GI, HH, GT, A, gfx: GT.createThreeAdapter(THREE, { document: DOC, Reflector }), items: o.items !== false, itemModel: o.itemModel || null, effects: o.effects !== false, effectSink: o.effectSink || null, camera: o.camera || null, onEvent: o.onEvent || null, onSeat: o.onSeat || null };
|
|
54991
55289
|
})();
|
|
54992
55290
|
const VEG = (() => {
|
|
54993
55291
|
const l = cfg.vegetation || null, G = l && (l.GameVegetation || (l.buildLot ? l : null)), S = l && (l.GameVegetationSpecies || (l.toSpec ? l : null));
|
|
@@ -55545,14 +55843,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
55545
55843
|
}
|
|
55546
55844
|
return best;
|
|
55547
55845
|
};
|
|
55548
|
-
const
|
|
55846
|
+
const gapOf2 = (p, q) => Math.hypot(Math.max(0, q.aabb[0] - p.aabb[2], p.aabb[0] - q.aabb[2]), Math.max(0, q.y0 - p.y1, p.y0 - q.y1), Math.max(0, q.aabb[1] - p.aabb[3], p.aabb[1] - q.aabb[3]));
|
|
55549
55847
|
const centreGapOf = (p, q) => Math.hypot((p.aabb[0] + p.aabb[2] - q.aabb[0] - q.aabb[2]) / 2, (p.y0 + p.y1 - q.y0 - q.y1) / 2, (p.aabb[1] + p.aabb[3] - q.aabb[1] - q.aabb[3]) / 2);
|
|
55550
55848
|
const wallBeside = (p, reach2) => {
|
|
55551
55849
|
for (const roles of [WALL_ROLES, SPAN_ROLES]) {
|
|
55552
55850
|
let best = null, bd = Infinity, bc = Infinity;
|
|
55553
55851
|
for (const q of parts2) {
|
|
55554
55852
|
if (q === p || !(q.extra ? roles === WALL_ROLES && Array.isArray(q.tags) && q.tags.includes("wall") : roles.has(q.role))) continue;
|
|
55555
|
-
const d =
|
|
55853
|
+
const d = gapOf2(p, q);
|
|
55556
55854
|
if (d > reach2) continue;
|
|
55557
55855
|
const c = centreGapOf(p, q);
|
|
55558
55856
|
if (d < bd || d === bd && (c < bc || c === bc && best !== null && q.id < best.id)) {
|
|
@@ -55586,6 +55884,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
55586
55884
|
supports.push({ part: p.id, on: p.holder, joint: p.holdJoint ?? "clip", bears: false, extra: true, ...p.tears ? { tears: true } : {} });
|
|
55587
55885
|
continue;
|
|
55588
55886
|
}
|
|
55887
|
+
if (typeof p.holder === "string") {
|
|
55888
|
+
unheld.push(p.id);
|
|
55889
|
+
continue;
|
|
55890
|
+
}
|
|
55589
55891
|
if (p.holdOn) {
|
|
55590
55892
|
const on = p.holdOn === "floor" ? floorUnder(p) : wallBeside(p, p.holdReach ?? HOLD_REACH);
|
|
55591
55893
|
if (on) supports.push({ part: p.id, on: on.id, joint: p.holdJoint ?? "clip", bears: false, extra: true });
|
|
@@ -56040,9 +56342,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
56040
56342
|
if (q.id === part.id || q.role !== "wall" && q.role !== "partition" || !structure.meshesOf(q.id).some((it) => it.mesh)) continue;
|
|
56041
56343
|
if (Math.min(q.y1, part.y1) - Math.max(q.y0, part.y0) <= 0.5) continue;
|
|
56042
56344
|
const inside22 = cu >= q.aabb[0] - 1e-3 && cu <= q.aabb[2] + 1e-3 && cv >= q.aabb[1] - 1e-3 && cv <= q.aabb[3] + 1e-3;
|
|
56043
|
-
const
|
|
56345
|
+
const reaches2 = Math.min(q.aabb[2], part.aabb[2]) - Math.max(q.aabb[0], part.aabb[0]) > PILLAR_REACH2 && Math.min(q.aabb[3], part.aabb[3]) - Math.max(q.aabb[1], part.aabb[1]) > PILLAR_REACH2;
|
|
56044
56346
|
if (inside22) first.push(q.id);
|
|
56045
|
-
else if (
|
|
56347
|
+
else if (reaches2) other.push(q.id);
|
|
56046
56348
|
}
|
|
56047
56349
|
return [...first, ...other];
|
|
56048
56350
|
}
|
|
@@ -57353,20 +57655,24 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
57353
57655
|
if (!Number.isFinite(level)) return CONSTRUCTION_LEVEL_MAX;
|
|
57354
57656
|
return Math.max(0, Math.min(CONSTRUCTION_LEVEL_MAX, Math.round(level)));
|
|
57355
57657
|
}
|
|
57658
|
+
var STAGE_LEVEL = { foundation: 1, frame: 2, masonry: 3, installations: 4, roofFraming: 5, roof: 6, finishes: 7, openings: 8, last: 8 };
|
|
57356
57659
|
function stageVisible(stage, level, opts) {
|
|
57357
57660
|
switch (stage) {
|
|
57358
57661
|
case "installations":
|
|
57359
|
-
return level >=
|
|
57662
|
+
return level >= STAGE_LEVEL.installations;
|
|
57360
57663
|
case "finishes":
|
|
57361
|
-
return level >=
|
|
57664
|
+
return level >= STAGE_LEVEL.finishes;
|
|
57362
57665
|
case "openings":
|
|
57363
|
-
return level >=
|
|
57666
|
+
return level >= STAGE_LEVEL.openings;
|
|
57364
57667
|
case "roof":
|
|
57365
|
-
return level >=
|
|
57668
|
+
return level >= STAGE_LEVEL.roof && opts.roofLayer !== false;
|
|
57366
57669
|
case "furniture":
|
|
57367
|
-
return level >=
|
|
57670
|
+
return level >= STAGE_LEVEL.last;
|
|
57671
|
+
// the protective sidewalk round the house: the last of the work outside
|
|
57672
|
+
case "exterior":
|
|
57673
|
+
return level >= STAGE_LEVEL.last;
|
|
57368
57674
|
case "perimeter":
|
|
57369
|
-
return level >=
|
|
57675
|
+
return level >= STAGE_LEVEL.last && opts.lotLayer !== false;
|
|
57370
57676
|
default:
|
|
57371
57677
|
return true;
|
|
57372
57678
|
}
|
|
@@ -57374,17 +57680,18 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
57374
57680
|
var EMBEDDED = /* @__PURE__ */ new Set(["wall_pipe", "wall_conduit", "electrical_box"]);
|
|
57375
57681
|
function groupVisible(name, level, opts) {
|
|
57376
57682
|
const roofOn = opts.roofLayer !== false;
|
|
57683
|
+
const bare = level < STAGE_LEVEL.finishes;
|
|
57377
57684
|
if (name === "stage:0:blueprint") return level <= 1;
|
|
57378
|
-
if (name === "stage:1:foundation") return level >=
|
|
57379
|
-
if (name === "stage:1:starter_bars") return level ===
|
|
57380
|
-
if (name === "stage:2:frame") return level >=
|
|
57381
|
-
if (name === "stage:3:masonry") return level >=
|
|
57382
|
-
if (name === "stage:4:installations") return level ===
|
|
57383
|
-
if (name === "stage:4:sewer_boxes") return level >=
|
|
57384
|
-
if (name === "stage:7:roof_framing") return level >=
|
|
57385
|
-
if (name === "roof") return level >=
|
|
57386
|
-
if (name === "attic_tank") return level >=
|
|
57387
|
-
if (/^t\d+$/.test(name)) return level >=
|
|
57685
|
+
if (name === "stage:1:foundation") return level >= STAGE_LEVEL.foundation && bare;
|
|
57686
|
+
if (name === "stage:1:starter_bars") return level === STAGE_LEVEL.foundation;
|
|
57687
|
+
if (name === "stage:2:frame") return level >= STAGE_LEVEL.frame && bare;
|
|
57688
|
+
if (name === "stage:3:masonry") return level >= STAGE_LEVEL.masonry && bare;
|
|
57689
|
+
if (name === "stage:4:installations") return level === STAGE_LEVEL.installations || level >= STAGE_LEVEL.installations && opts.waterLayer === true;
|
|
57690
|
+
if (name === "stage:4:sewer_boxes") return level >= STAGE_LEVEL.installations;
|
|
57691
|
+
if (name === "stage:7:roof_framing") return level >= STAGE_LEVEL.roofFraming && roofOn;
|
|
57692
|
+
if (name === "roof") return level >= STAGE_LEVEL.roof && roofOn;
|
|
57693
|
+
if (name === "attic_tank") return level >= STAGE_LEVEL.installations;
|
|
57694
|
+
if (/^t\d+$/.test(name)) return level >= STAGE_LEVEL.finishes;
|
|
57388
57695
|
return null;
|
|
57389
57696
|
}
|
|
57390
57697
|
function applyConstructionLevel(houseGroup, rawLevel, opts = {}) {
|
|
@@ -57398,7 +57705,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
57398
57705
|
const lines = name === "stage:0:blueprint" ? child.getObjectByName(BLUEPRINT_LINES) : void 0;
|
|
57399
57706
|
if (lines) lines.visible = level === 0;
|
|
57400
57707
|
const heap = name === "stage:4:installations" ? child.getObjectByName(SPOIL_HEAP) : void 0;
|
|
57401
|
-
if (heap) heap.visible = level ===
|
|
57708
|
+
if (heap) heap.visible = level === STAGE_LEVEL.installations;
|
|
57709
|
+
if (name === "roof") {
|
|
57710
|
+
for (const mesh2 of child.children) if (/\/plaster$/.test(mesh2.name)) mesh2.visible = level >= STAGE_LEVEL.finishes;
|
|
57711
|
+
}
|
|
57402
57712
|
continue;
|
|
57403
57713
|
}
|
|
57404
57714
|
if (name === "lot") child.visible = level >= 4 && lotOn;
|
|
@@ -57408,7 +57718,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
57408
57718
|
const ud = obj.userData;
|
|
57409
57719
|
if (!ud) return;
|
|
57410
57720
|
if (ud.part === "lamp_holder" || ud.part === "lamp_bulb") {
|
|
57411
|
-
obj.visible = typeof ud.id !== "string" || (ud.mount === "slab" ? level
|
|
57721
|
+
obj.visible = typeof ud.id !== "string" || (ud.mount === "slab" ? level >= STAGE_LEVEL.installations && level < STAGE_LEVEL.finishes : level >= STAGE_LEVEL.finishes && level < STAGE_LEVEL.last);
|
|
57412
57722
|
return;
|
|
57413
57723
|
}
|
|
57414
57724
|
if (typeof ud.part === "string" && EMBEDDED.has(ud.part)) {
|
|
@@ -57544,6 +57854,21 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
57544
57854
|
}
|
|
57545
57855
|
return t;
|
|
57546
57856
|
}
|
|
57857
|
+
function battenClearOfSolids(slope, s, [a, b], solids) {
|
|
57858
|
+
const { batten } = TIMBER;
|
|
57859
|
+
const p0 = down(slope.point(s, a), batten.top), p1 = down(slope.point(s, b), batten.top);
|
|
57860
|
+
const axis = Math.abs(p1[0] - p0[0]) < 1e-6 ? 0 : 2;
|
|
57861
|
+
const other = axis === 0 ? 2 : 0;
|
|
57862
|
+
const rise = Math.abs(slope.point(1, a)[axis] - slope.point(0, a)[axis]);
|
|
57863
|
+
if (rise < 1e-6) return s;
|
|
57864
|
+
const lo = Math.min(p0[other], p1[other]), hi = Math.max(p0[other], p1[other]);
|
|
57865
|
+
const y0 = Math.min(p0[1], p1[1]) - batten.height, y1 = Math.max(p0[1], p1[1]);
|
|
57866
|
+
for (const box4 of solids) {
|
|
57867
|
+
if (box4[other] > hi || box4[other + 3] < lo || box4[1] > y1 || box4[4] < y0) continue;
|
|
57868
|
+
for (const face of [box4[axis], box4[axis + 3]]) for (const side of [p0[axis] - batten.width / 2, p0[axis] + batten.width / 2]) if (Math.abs(face - side) < BATTEN_SIDE_CLEAR) return s + SIDE_STEP * 2 / rise;
|
|
57869
|
+
}
|
|
57870
|
+
return s;
|
|
57871
|
+
}
|
|
57547
57872
|
function spanAt(slope, s) {
|
|
57548
57873
|
return slope.hipped ? [slope.t0 + s + EDGE2, slope.t1 - s - EDGE2] : [slope.t0 + EDGE2, slope.t1 - EDGE2];
|
|
57549
57874
|
}
|
|
@@ -57551,8 +57876,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
57551
57876
|
const { batten, rafter, purlin } = TIMBER;
|
|
57552
57877
|
for (let s = batten.spacing / 2; s < slope.run - 0.12; s += batten.spacing) {
|
|
57553
57878
|
const [a0, b0] = spanAt(slope, s);
|
|
57554
|
-
const a = a0 +
|
|
57555
|
-
if (b - a
|
|
57879
|
+
const a = a0 + BATTEN_SHORT, b = b0 - BATTEN_SHORT;
|
|
57880
|
+
if (b - a <= 0.05) continue;
|
|
57881
|
+
const at2 = battenClearOfSolids(slope, s, [a, b], solids);
|
|
57882
|
+
addTimberAround(batches.battens, down(slope.point(at2, a), batten.top), down(slope.point(at2, b), batten.top), batten.width, batten.height, keepOut);
|
|
57556
57883
|
}
|
|
57557
57884
|
const t0 = slope.t0 + EDGE2, t1 = slope.t1 - EDGE2;
|
|
57558
57885
|
const count = Math.max(1, Math.round((t1 - t0) / rafter.spacing));
|
|
@@ -57572,7 +57899,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
57572
57899
|
const p0 = down(slope.point(s, a), top), p1 = down(slope.point(s, b), top);
|
|
57573
57900
|
const depth = Math.min(purlin.height, p0[1] - slabTop - 3e-3);
|
|
57574
57901
|
if (depth < 0.02) return;
|
|
57575
|
-
addTimberAround(batches.timber, p0, p1, purlin.width, depth, keepOut, k === 0 ? void 0 : (end) => addPost(batches.timber, end[0], end[2], slabTop, end[1] - purlin.height));
|
|
57902
|
+
addTimberAround(batches.timber, p0, p1, k === 0 ? purlin.width - PLATE_NARROWER : purlin.width, depth, keepOut, k === 0 ? void 0 : (end) => addPost(batches.timber, end[0], end[2], slabTop, end[1] - purlin.height));
|
|
57576
57903
|
if (k === 0) return;
|
|
57577
57904
|
const posts = Math.max(1, Math.ceil((b - a) / TIMBER.post.spacing));
|
|
57578
57905
|
for (let j = 0; j <= posts; j++) {
|
|
@@ -57581,6 +57908,29 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
57581
57908
|
}
|
|
57582
57909
|
});
|
|
57583
57910
|
}
|
|
57911
|
+
var BATTEN_SHORT = 0.0185;
|
|
57912
|
+
var BATTEN_SIDE_CLEAR = 35e-4;
|
|
57913
|
+
var PLATE_NARROWER = 8e-3;
|
|
57914
|
+
var BOX_VERTICES = 24;
|
|
57915
|
+
function bareBoxesOf(THREE, groups) {
|
|
57916
|
+
const out = [];
|
|
57917
|
+
const v = new THREE.Vector3();
|
|
57918
|
+
for (const group of groups) {
|
|
57919
|
+
group.updateMatrixWorld(true);
|
|
57920
|
+
group.traverse((o) => {
|
|
57921
|
+
const mesh2 = o;
|
|
57922
|
+
if (!mesh2.isMesh) return;
|
|
57923
|
+
const position = mesh2.geometry.getAttribute("position");
|
|
57924
|
+
const step = position.count > BOX_VERTICES && position.count % BOX_VERTICES === 0 ? BOX_VERTICES : position.count;
|
|
57925
|
+
for (let i = 0; i + step <= position.count; i += step) {
|
|
57926
|
+
const box4 = new THREE.Box3();
|
|
57927
|
+
for (let k = i; k < i + step; k++) box4.expandByPoint(v.fromBufferAttribute(position, k).applyMatrix4(mesh2.matrixWorld));
|
|
57928
|
+
out.push([box4.min.x, box4.min.y, box4.min.z, box4.max.x, box4.max.y, box4.max.z]);
|
|
57929
|
+
}
|
|
57930
|
+
});
|
|
57931
|
+
}
|
|
57932
|
+
return out;
|
|
57933
|
+
}
|
|
57584
57934
|
function buildRoofFramingStage(THREE, roofRects, material, solids = [], keepOut = []) {
|
|
57585
57935
|
const group = new THREE.Group();
|
|
57586
57936
|
group.name = "stage:7:roof_framing";
|
|
@@ -57781,8 +58131,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
57781
58131
|
shared2.ctx.pu = Math.max(0, pr.unit != null ? pr.unit : 0);
|
|
57782
58132
|
shared2.ctx.showBuilding = shared2.ctx.apartment && (pr.showIt == null ? true : !!pr.showIt);
|
|
57783
58133
|
shared2.ctx.limits = { x0: -2, z0: -2, x1: r.w + 2, z1: r.d + 2 };
|
|
57784
|
-
shared2.ctx.veg = VEG ? { G: VEG.G, S: VEG.S, mats: vegMaterials, groups: /* @__PURE__ */ new Map(), ok: /* @__PURE__ */ new Map(), opts: shared2.quality === "game" ? { quality: "game" } : { quality: "high", lod: 0, triangleBudget: 6e4 } } : null;
|
|
58134
|
+
shared2.ctx.veg = VEG ? { G: VEG.G, S: VEG.S, mats: vegMaterials, groups: /* @__PURE__ */ new Map(), ok: /* @__PURE__ */ new Map(), sizes: /* @__PURE__ */ new Map(), opts: shared2.quality === "game" ? { quality: "game" } : { quality: "high", lod: 0, triangleBudget: 6e4 } } : null;
|
|
57785
58135
|
shared2.ctx.vegInfo = null;
|
|
58136
|
+
shared2.ctx.itemBounds = opts.itemBounds ? [] : void 0;
|
|
58137
|
+
shared2.ctx.cordPaths = opts.itemBounds ? [] : void 0;
|
|
57786
58138
|
const cs = !!(opts.constructionStages || opts.constructionLevel != null);
|
|
57787
58139
|
shared2.ctx.constructionStages = cs;
|
|
57788
58140
|
if (Y0(0) > 0 && !shared2.ctx.visorScene) shared2.ctx.unitGround = Y0(0);
|
|
@@ -58071,7 +58423,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58071
58423
|
const bp = buildBlueprintStage(THREE, K.DOC, r, rectsOf2);
|
|
58072
58424
|
const stGroups = buildStructuralStageGroups(THREE, r0.structure, r.outbuildings || [], [...embeddedRunsOf(house), ...wallBoxRunsOf(r, shared2.ctx.wallBoxShifts)], shared2.ctx.blockLaid ?? []);
|
|
58073
58425
|
const instGroup = buildInstallationsStage(THREE, r, shared2.ctx.gutterInfo?.drains ?? [], shared2.ctx.paving ?? []);
|
|
58074
|
-
const roofFraming = buildRoofFramingStage(THREE, shared2.ctx.roofRects || [], void 0, shared2.ctx.occupied, [...atticKeepOut(THREE, house, Object.values(parts2)), ...gutterKeepOut(shared2.ctx.gutterInfo?.gutters ?? [])]);
|
|
58426
|
+
const roofFraming = buildRoofFramingStage(THREE, shared2.ctx.roofRects || [], void 0, [...shared2.ctx.occupied ?? [], ...bareBoxesOf(THREE, [stGroups.frame, stGroups.masonry])], [...atticKeepOut(THREE, house, Object.values(parts2)), ...gutterKeepOut(shared2.ctx.gutterInfo?.gutters ?? [])]);
|
|
58075
58427
|
const yardBoxes = instGroup.userData.yardBoxes;
|
|
58076
58428
|
for (const sg of [bp, stGroups.foundation, stGroups.starterBars, stGroups.frame, stGroups.masonry, instGroup, ...yardBoxes ? [yardBoxes] : [], roofFraming]) {
|
|
58077
58429
|
gs[sg.name] = sg;
|
|
@@ -58430,6 +58782,90 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58430
58782
|
installBuildBuild(K, shared2);
|
|
58431
58783
|
return buildApi(K, shared2);
|
|
58432
58784
|
}
|
|
58785
|
+
var HOLD_REACH2 = 0.05;
|
|
58786
|
+
var BACK_TOUCH = 0.02;
|
|
58787
|
+
var SOFT = /* @__PURE__ */ new Set(["fabric", "paper", "foliage"]);
|
|
58788
|
+
var gapOf = (a, b) => Math.max(0, ...[0, 1, 2].map((k) => Math.max(a.min[k] - b.max[k], b.min[k] - a.max[k])));
|
|
58789
|
+
function groupsOf(parts2, joints) {
|
|
58790
|
+
const root = new Map(parts2.map((part) => [part.id, part.id]));
|
|
58791
|
+
const find = (id) => {
|
|
58792
|
+
let at2 = id;
|
|
58793
|
+
while (root.get(at2) !== at2) at2 = root.get(at2);
|
|
58794
|
+
root.set(id, at2);
|
|
58795
|
+
return at2;
|
|
58796
|
+
};
|
|
58797
|
+
for (const joint of joints) root.set(find(joint.a), find(joint.b));
|
|
58798
|
+
const groups = /* @__PURE__ */ new Map();
|
|
58799
|
+
for (const part of parts2) {
|
|
58800
|
+
const at2 = find(part.id);
|
|
58801
|
+
groups.set(at2, [...groups.get(at2) ?? [], part.id]);
|
|
58802
|
+
}
|
|
58803
|
+
return [...groups.values()];
|
|
58804
|
+
}
|
|
58805
|
+
function nearestJoint(loose, held, boxOf3, reach2) {
|
|
58806
|
+
let best = null;
|
|
58807
|
+
for (const a of loose) {
|
|
58808
|
+
for (const b of held) {
|
|
58809
|
+
const gap = gapOf(boxOf3(a.id), boxOf3(b.id));
|
|
58810
|
+
if (gap <= reach2 && (!best || gap < best.gap)) best = { gap, a, b };
|
|
58811
|
+
}
|
|
58812
|
+
}
|
|
58813
|
+
if (!best) return null;
|
|
58814
|
+
const [joint] = inferJoints([best.a, best.b], best.gap + 0.05);
|
|
58815
|
+
return joint ? { ...joint, id: `${best.a.id}~${best.b.id}` } : null;
|
|
58816
|
+
}
|
|
58817
|
+
var FLOOR_TOUCH = 5e-3;
|
|
58818
|
+
var STANDS_ALONE = 0.3;
|
|
58819
|
+
function standsAlone(group, boxOf3) {
|
|
58820
|
+
const feet = group.map((part) => boxOf3(part.id)).filter((box4) => box4.min[1] <= FLOOR_TOUCH);
|
|
58821
|
+
if (feet.length === 0) return false;
|
|
58822
|
+
const height = Math.max(...group.map((part) => boxOf3(part.id).max[1]));
|
|
58823
|
+
const across2 = (k) => Math.max(...feet.map((box4) => box4.max[k])) - Math.min(...feet.map((box4) => box4.min[k]));
|
|
58824
|
+
return Math.min(across2(0), across2(2)) >= STANDS_ALONE * height;
|
|
58825
|
+
}
|
|
58826
|
+
function joinBodies({ parts: parts2, joints, boxOf: boxOf3 }, byId) {
|
|
58827
|
+
const groups = groupsOf(parts2, joints).map((ids) => ids.map((id) => byId.get(id))).sort((a, b) => b.length - a.length);
|
|
58828
|
+
const [main, ...rest2] = groups;
|
|
58829
|
+
if (!main) return;
|
|
58830
|
+
for (const group of rest2) {
|
|
58831
|
+
if (standsAlone(group, boxOf3)) continue;
|
|
58832
|
+
const joint = nearestJoint(group, main, boxOf3, Infinity);
|
|
58833
|
+
if (joint) joints.push(joint);
|
|
58834
|
+
}
|
|
58835
|
+
}
|
|
58836
|
+
function holdLooseGroups(params) {
|
|
58837
|
+
const byId = new Map(params.parts.map((part) => [part.id, part]));
|
|
58838
|
+
holdHanging(params, byId);
|
|
58839
|
+
joinBodies(params, byId);
|
|
58840
|
+
}
|
|
58841
|
+
function holdHanging({ parts: parts2, joints, boxOf: boxOf3 }, byId) {
|
|
58842
|
+
const back = Math.min(...parts2.map((part) => boxOf3(part.id).min[2]));
|
|
58843
|
+
for (let pass = 0; pass < parts2.length; pass++) {
|
|
58844
|
+
const groups = groupsOf(parts2, joints).map((ids) => ids.map((id) => byId.get(id)));
|
|
58845
|
+
const held = groups.filter((group) => group.some((part) => part.anchored)).flat();
|
|
58846
|
+
const loose = groups.filter((group) => !group.some((part) => part.anchored));
|
|
58847
|
+
if (loose.length === 0) return;
|
|
58848
|
+
let changed = false;
|
|
58849
|
+
for (const group of loose) {
|
|
58850
|
+
const joint = nearestJoint(group, held, boxOf3, HOLD_REACH2);
|
|
58851
|
+
if (joint) {
|
|
58852
|
+
joints.push(joint);
|
|
58853
|
+
changed = true;
|
|
58854
|
+
continue;
|
|
58855
|
+
}
|
|
58856
|
+
const onWall = group.filter((part) => !SOFT.has(part.material) && boxOf3(part.id).min[2] <= back + BACK_TOUCH);
|
|
58857
|
+
if (onWall.length === 0) continue;
|
|
58858
|
+
for (const part of onWall) part.anchored = true;
|
|
58859
|
+
changed = true;
|
|
58860
|
+
}
|
|
58861
|
+
if (changed) continue;
|
|
58862
|
+
for (const group of loose) {
|
|
58863
|
+
const joint = nearestJoint(group, held, boxOf3, Infinity);
|
|
58864
|
+
if (joint) joints.push(joint);
|
|
58865
|
+
}
|
|
58866
|
+
return;
|
|
58867
|
+
}
|
|
58868
|
+
}
|
|
58433
58869
|
var WOOD_THIN = 0.035;
|
|
58434
58870
|
var BOARD_TOP_THICK = 0.07;
|
|
58435
58871
|
var BOARD_TOP_WIDTH = 0.5;
|
|
@@ -58481,7 +58917,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58481
58917
|
const channel = (shift) => Math.min(255, Math.round((color2 >> shift & 255) * k)) << shift;
|
|
58482
58918
|
return channel(16) | channel(8) | channel(0);
|
|
58483
58919
|
}
|
|
58484
|
-
var
|
|
58920
|
+
var FLOOR_TOUCH2 = 5e-3;
|
|
58485
58921
|
var LOOSE = /* @__PURE__ */ new Set(["paper"]);
|
|
58486
58922
|
var BASE_MATERIAL = {
|
|
58487
58923
|
wood: "wood_hard",
|
|
@@ -58566,7 +59002,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58566
59002
|
else if (p.key === "wood" && material === "wood_hard" && thin < WOOD_THIN) material = "wood_soft";
|
|
58567
59003
|
const part = { id: p.id, material, shape: p.shape, position: p.position };
|
|
58568
59004
|
if (p.rotation) part.rotation = p.rotation;
|
|
58569
|
-
if (!LOOSE.has(material) && p.min[1] <=
|
|
59005
|
+
if (!LOOSE.has(material) && p.min[1] <= FLOOR_TOUCH2) part.anchored = true;
|
|
59006
|
+
if (opts.carcass && LOOSE.has(material)) {
|
|
59007
|
+
part.hands = 1;
|
|
59008
|
+
part.tags = ["book"];
|
|
59009
|
+
}
|
|
58570
59010
|
return part;
|
|
58571
59011
|
});
|
|
58572
59012
|
const byId = new Map(drawn.map((p) => [p.id, p]));
|
|
@@ -58585,6 +59025,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58585
59025
|
}
|
|
58586
59026
|
joints.push(j);
|
|
58587
59027
|
}
|
|
59028
|
+
holdLooseGroups({ parts: parts2, joints, boxOf: (id) => byId.get(id) });
|
|
59029
|
+
const low = (part) => byId.get(part.id).min[1];
|
|
59030
|
+
const wallMounted = parts2.some((part) => part.anchored && low(part) > FLOOR_TOUCH2);
|
|
59031
|
+
const sunk = parts2.some((part) => low(part) < -FLOOR_TOUCH2);
|
|
59032
|
+
const rooted = parts2.some((part) => part.material === "foliage") && parts2.some((part) => part.material.startsWith("wood") && low(part) <= FLOOR_TOUCH2);
|
|
59033
|
+
const fixed = wallMounted || sunk || rooted;
|
|
58588
59034
|
const all = drawn.reduce(
|
|
58589
59035
|
(m, p) => ({ x0: Math.min(m.x0, p.min[0]), x1: Math.max(m.x1, p.max[0]), z0: Math.min(m.z0, p.min[2]), z1: Math.max(m.z1, p.max[2]) }),
|
|
58590
59036
|
{ x0: Infinity, x1: -Infinity, z0: Infinity, z1: -Infinity }
|
|
@@ -58606,7 +59052,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58606
59052
|
if ((max[0] - min[0]) * (max[1] - min[1]) >= 0.6 * footprint && mid.max[1] >= 0.2) top = { part: mid.id, y: mid.max[1], parts: boards.map((b) => b.id) };
|
|
58607
59053
|
}
|
|
58608
59054
|
if (opts.carcass) carcass(parts2, byId);
|
|
58609
|
-
const spec = { name, parts: parts2, joints, tags: ["furniture"] };
|
|
59055
|
+
const spec = { name, parts: parts2, joints, tags: ["furniture"], ...fixed ? { fixed } : {} };
|
|
58610
59056
|
const colors = new Map(drawn.map((p) => [p.id, p.color]));
|
|
58611
59057
|
const build = (T3) => {
|
|
58612
59058
|
const group = markKitOrigin(new T3.Group(), { owner: "game-floorplan-three", kind: "furniture", id: name });
|
|
@@ -58636,7 +59082,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58636
59082
|
}
|
|
58637
59083
|
return group;
|
|
58638
59084
|
};
|
|
58639
|
-
return { spec, build, top };
|
|
59085
|
+
return { spec, build, top, fixed };
|
|
58640
59086
|
}
|
|
58641
59087
|
function furnitureSpec(THREE, type, opts = {}) {
|
|
58642
59088
|
const renderer = rendererOf(THREE, opts.document);
|
|
@@ -58672,7 +59118,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58672
59118
|
);
|
|
58673
59119
|
const spouts = K.PARTS.slice(before).filter((p) => p.type === "water_tap").map((p) => [p.pos[0] - root.x, p.pos[1], p.pos[2] - root.z]);
|
|
58674
59120
|
K.PARTS.length = before;
|
|
58675
|
-
return { spec: made.spec, build: made.build, top: made.top, size: { w, d, h }, spouts };
|
|
59121
|
+
return { spec: made.spec, build: made.build, top: made.top, size: { w, d, h }, spouts, fixed: made.fixed };
|
|
58676
59122
|
}
|
|
58677
59123
|
|
|
58678
59124
|
// src/area-layout.ts
|