@adatechnology/game-items-three 0.9.1 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-35IYUYZP.js → chunk-S4UUQQOL.js} +5 -3
- package/dist/chunk-S4UUQQOL.js.map +1 -0
- package/dist/index.d.ts +14 -1
- package/dist/index.global.js +313 -138
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +15 -1
- package/dist/index.js.map +1 -1
- package/dist/testing.js +1 -1
- package/package.json +13 -11
- package/dist/chunk-35IYUYZP.js.map +0 -1
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,
|
|
@@ -5197,7 +5198,7 @@ var GameItemsThree = (() => {
|
|
|
5197
5198
|
teamId: "pregos",
|
|
5198
5199
|
teamBox: [
|
|
5199
5200
|
1.3,
|
|
5200
|
-
0.
|
|
5201
|
+
0.335,
|
|
5201
5202
|
0.5
|
|
5202
5203
|
],
|
|
5203
5204
|
scale: 0.1
|
|
@@ -8278,7 +8279,9 @@ var GameItemsThree = (() => {
|
|
|
8278
8279
|
mesh2(cyl(0.035, 0.035, 1.1, 6), steel, [direction * 0.06, y, z], [0, 0, R]),
|
|
8279
8280
|
mesh2(new T2.ConeGeometry(0.035, 0.16, 6), steel, [-direction * 0.57, y, z], [0, 0, direction * R])
|
|
8280
8281
|
];
|
|
8281
|
-
|
|
8282
|
+
const LOW = -0.0675;
|
|
8283
|
+
const HIGH = LOW + 0.135;
|
|
8284
|
+
return G(...nail(LOW, -0.15, 1), ...nail(LOW, 0.15, -1), ...nail(HIGH, -0.15, -1), ...nail(HIGH, 0.15, 1));
|
|
8282
8285
|
};
|
|
8283
8286
|
|
|
8284
8287
|
// src/models/raffia-sack.ts
|
|
@@ -10105,6 +10108,19 @@ var GameItemsThree = (() => {
|
|
|
10105
10108
|
return { root, kind, ...shape ? { shape } : {}, size: item.size, materials };
|
|
10106
10109
|
}
|
|
10107
10110
|
|
|
10111
|
+
// src/contained.ts
|
|
10112
|
+
function createContainedItemModel(items, options = {}) {
|
|
10113
|
+
const byId = /* @__PURE__ */ new Map();
|
|
10114
|
+
for (const item of items) byId.set(item.id, item);
|
|
10115
|
+
return (stack, T2) => {
|
|
10116
|
+
const item = byId.get(stack.type);
|
|
10117
|
+
if (!item) return null;
|
|
10118
|
+
const model = buildItem(T2, item, options);
|
|
10119
|
+
model.root.userData.item = { id: item.id, kind: model.kind };
|
|
10120
|
+
return model.root;
|
|
10121
|
+
};
|
|
10122
|
+
}
|
|
10123
|
+
|
|
10108
10124
|
// src/item-models.ts
|
|
10109
10125
|
var itemModels = { has: hasItemModel, build: buildItem };
|
|
10110
10126
|
|
|
@@ -17506,7 +17522,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
17506
17522
|
const dz = Math.max(box4.min[2] - loss.z, 0, loss.z - box4.max[2]);
|
|
17507
17523
|
return Math.hypot(dx, dz) < loss.radius + loss.depth * groundCfg.spread;
|
|
17508
17524
|
};
|
|
17509
|
-
const
|
|
17525
|
+
const footprintOf2 = (o, b, loss) => {
|
|
17510
17526
|
const box4 = aabbOf(b.p.spec.shape, b.p.pos, b.p.q);
|
|
17511
17527
|
const long = box4.max[0] - box4.min[0] >= box4.max[2] - box4.min[2] ? 0 : 2;
|
|
17512
17528
|
const across2 = long === 0 ? 2 : 0;
|
|
@@ -17949,7 +17965,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
17949
17965
|
const opened = [];
|
|
17950
17966
|
const settled = [];
|
|
17951
17967
|
let lost = false;
|
|
17952
|
-
const touched = bearersOf(o).filter((b) => nearLoss(o, b.p, loss)).map((b) => ({ b, fp:
|
|
17968
|
+
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
17969
|
const bearers = bearersOf(o);
|
|
17954
17970
|
const pillarFirst = (b) => b.p.spec.structure?.role === "column" ? 0 : 1;
|
|
17955
17971
|
const order2 = [...touched].sort((x, y) => pillarFirst(x.b) - pillarFirst(y.b));
|
|
@@ -30578,7 +30594,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
30578
30594
|
kind: "material",
|
|
30579
30595
|
size: [
|
|
30580
30596
|
0.13,
|
|
30581
|
-
0.
|
|
30597
|
+
0.0335,
|
|
30582
30598
|
0.05
|
|
30583
30599
|
],
|
|
30584
30600
|
weight: 0.5,
|
|
@@ -43628,7 +43644,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
43628
43644
|
h: 4.4,
|
|
43629
43645
|
y: 0,
|
|
43630
43646
|
solid: true,
|
|
43631
|
-
massKg: 14
|
|
43647
|
+
massKg: 14,
|
|
43648
|
+
fixed: true
|
|
43632
43649
|
},
|
|
43633
43650
|
{
|
|
43634
43651
|
id: "electrical_panel",
|
|
@@ -44483,6 +44500,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
44483
44500
|
// was `maquina`
|
|
44484
44501
|
});
|
|
44485
44502
|
var OWN_TYPES = Object.freeze({ lamp: true, gas_piped: true });
|
|
44503
|
+
var KITCHEN_SINK_WORKTOP = 0.9;
|
|
44486
44504
|
var sourceOf = (result) => result;
|
|
44487
44505
|
var ADAPTER_VERSION = "0.3.0";
|
|
44488
44506
|
var r3 = (n) => Math.round(n * 1e3) / 1e3;
|
|
@@ -44873,7 +44891,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
44873
44891
|
list2.push(sink);
|
|
44874
44892
|
let cabinet2 = null;
|
|
44875
44893
|
if (rest2 >= 0.35) {
|
|
44876
|
-
cabinet2 = part(m.id + "#cabinet", "kitchen_cabinet_base", rest2, m.d, m.h, 0, left ? width / 2 - rest2 / 2 : -(width / 2) + rest2 / 2, 0);
|
|
44894
|
+
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);
|
|
44877
44895
|
list2.push(cabinet2);
|
|
44878
44896
|
}
|
|
44879
44897
|
if (contents[m.id]) store(cabinet2 ? [["kitchen_cabinet_base", cabinet2.item], ["sink_kitchen", sink.item]] : [["sink_kitchen", sink.item]], contents[m.id]);
|
|
@@ -45387,9 +45405,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
45387
45405
|
{ type: "sofa_3seat", category: "sofa", w: 2.1, d: 0.9, h: 0.85, color: { role: "fabric_main" } },
|
|
45388
45406
|
{ type: "sofa_2seat", category: "sofa", w: 1.6, d: 0.85, h: 0.85, color: { role: "fabric_main" } },
|
|
45389
45407
|
{ type: "sofa_l", category: "sofa", w: 2.4, d: 0.95, h: 0.85, color: { role: "fabric_main" } },
|
|
45390
|
-
{ type: "tv_unit", category: "tv_unit", w: 1.6, d: 0.45, h: 0.55 },
|
|
45391
|
-
{ type: "tv_unit_small", category: "tv_unit", w: 1.2, d: 0.4, h: 0.5 },
|
|
45392
|
-
{ type: "tv_unit_large", category: "tv_unit", w: 1.9, d: 0.45, h: 0.6 },
|
|
45408
|
+
{ type: "tv_unit", category: "tv_unit", w: 1.6, d: 0.45, h: 0.55, opening: 0.4 },
|
|
45409
|
+
{ type: "tv_unit_small", category: "tv_unit", w: 1.2, d: 0.4, h: 0.5, opening: 0.4 },
|
|
45410
|
+
{ type: "tv_unit_large", category: "tv_unit", w: 1.9, d: 0.45, h: 0.6, opening: 0.4 },
|
|
45393
45411
|
{ type: "tv", category: "tv", w: 0.9, d: 0.1, h: 0.55 },
|
|
45394
45412
|
{ type: "tv_large", category: "tv", w: 1.2, d: 0.1, h: 0.7 },
|
|
45395
45413
|
{ type: "coffee_table", category: "coffee_table", w: 0.9, d: 0.55, h: 0.42 },
|
|
@@ -45401,33 +45419,33 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
45401
45419
|
{ type: "shelf_unit", category: "shelf_unit", w: 1.4, d: 0.4, h: 1.8 },
|
|
45402
45420
|
{ type: "shelf_unit_small", category: "shelf_unit", w: 1, d: 0.35, h: 1.5 },
|
|
45403
45421
|
{ type: "floor_lamp", category: "lamp", w: 0.3, d: 0.3, h: 1.5 },
|
|
45404
|
-
{ type: "sideboard", category: "sideboard", w: 1.2, d: 0.4, h: 0.85 },
|
|
45422
|
+
{ type: "sideboard", category: "sideboard", w: 1.2, d: 0.4, h: 0.85, opening: 0.4 },
|
|
45405
45423
|
{ type: "console_table", category: "console_table", w: 0.9, d: 0.3, h: 0.85 },
|
|
45406
45424
|
{ type: "bench", category: "bench", w: 1, d: 0.35, h: 0.45 },
|
|
45407
45425
|
{ type: "workbench", category: "workbench", w: 1.2, d: 0.6, h: 0.95 },
|
|
45408
45426
|
{ type: "floor_mirror", category: "mirror", w: 0.5, d: 0.12, h: 1.8 },
|
|
45409
|
-
{ type: "fridge", category: "fridge", w: 0.7, d: 0.68, h: 1.8, color: { role: "metal" } },
|
|
45410
|
-
{ type: "fridge_large", category: "fridge", w: 0.8, d: 0.72, h: 1.85, color: { role: "metal" } },
|
|
45411
|
-
{ type: "stove", category: "stove", w: 0.62, d: 0.6, h: 0.95, color: { role: "metal" } },
|
|
45412
|
-
{ type: "stove_4burner", category: "stove", w: 0.7, d: 0.62, h: 0.95, color: { role: "metal" } },
|
|
45413
|
-
{ type: "kitchen_cabinet", category: "kitchen_cabinet", overhead: true, w: 1.6, d: 0.6, h: 0.95, color: { role: "metal" } },
|
|
45414
|
-
{ type: "kitchen_cabinet_large", category: "kitchen_cabinet", overhead: true, w: 2, d: 0.6, h: 0.95, color: { role: "metal" } },
|
|
45415
|
-
{ type: "kitchen_cabinet_small", category: "kitchen_cabinet", overhead: true, w: 1.2, d: 0.6, h: 0.95, color: { role: "metal" } },
|
|
45427
|
+
{ type: "fridge", category: "fridge", w: 0.7, d: 0.68, h: 1.8, opening: 0.6, color: { role: "metal" } },
|
|
45428
|
+
{ type: "fridge_large", category: "fridge", w: 0.8, d: 0.72, h: 1.85, opening: 0.6, color: { role: "metal" } },
|
|
45429
|
+
{ type: "stove", category: "stove", w: 0.62, d: 0.6, h: 0.95, opening: 0.5, color: { role: "metal" } },
|
|
45430
|
+
{ type: "stove_4burner", category: "stove", w: 0.7, d: 0.62, h: 0.95, opening: 0.5, color: { role: "metal" } },
|
|
45431
|
+
{ type: "kitchen_cabinet", category: "kitchen_cabinet", overhead: true, w: 1.6, d: 0.6, h: 0.95, opening: 0.5, color: { role: "metal" } },
|
|
45432
|
+
{ type: "kitchen_cabinet_large", category: "kitchen_cabinet", overhead: true, w: 2, d: 0.6, h: 0.95, opening: 0.5, color: { role: "metal" } },
|
|
45433
|
+
{ type: "kitchen_cabinet_small", category: "kitchen_cabinet", overhead: true, w: 1.2, d: 0.6, h: 0.95, opening: 0.5, color: { role: "metal" } },
|
|
45416
45434
|
{ type: "dining_table", category: "dining_table", w: 1.1, d: 0.8, h: 0.78 },
|
|
45417
45435
|
{ type: "dining_table_small", category: "dining_table", w: 0.9, d: 0.7, h: 0.75 },
|
|
45418
45436
|
{ type: "dining_table_round", category: "dining_table", w: 0.9, d: 0.9, h: 0.75 },
|
|
45419
45437
|
{ type: "microwave", category: "appliance", w: 0.5, d: 0.4, h: 0.3, color: { role: "metal" } },
|
|
45420
45438
|
{ type: "trash_bin", category: "trash_bin", w: 0.3, d: 0.3, h: 0.6 },
|
|
45421
|
-
{ type: "pantry", category: "pantry", w: 1.2, d: 0.4, h: 2 },
|
|
45439
|
+
{ type: "pantry", category: "pantry", w: 1.2, d: 0.4, h: 2, opening: 0.5 },
|
|
45422
45440
|
{ type: "double_bed", category: "bed", w: 1.6, d: 2.05, h: 0.62, color: { role: "fabric_main" } },
|
|
45423
45441
|
{ type: "queen_bed", category: "bed", w: 1.8, d: 2.1, h: 0.62, color: { role: "fabric_main" } },
|
|
45424
45442
|
{ type: "single_bed", category: "bed", w: 0.95, d: 2, h: 0.55, color: { role: "fabric_main" } },
|
|
45425
45443
|
{ type: "king_bed", category: "bed_king", w: 2, d: 2.15, h: 0.65, color: { role: "fabric_main" } },
|
|
45426
|
-
{ type: "nightstand", category: "nightstand", w: 0.45, d: 0.42, h: 0.6 },
|
|
45427
|
-
{ type: "wardrobe", category: "wardrobe", w: 1.6, d: 0.6, h: 2 },
|
|
45428
|
-
{ type: "wardrobe_small", category: "wardrobe", w: 1, d: 0.55, h: 1.9 },
|
|
45429
|
-
{ type: "wardrobe_large", category: "wardrobe_large", w: 2.4, d: 0.65, h: 2.1 },
|
|
45430
|
-
{ type: "dresser", category: "dresser", w: 1, d: 0.45, h: 0.85 },
|
|
45444
|
+
{ type: "nightstand", category: "nightstand", w: 0.45, d: 0.42, h: 0.6, opening: 0.45 },
|
|
45445
|
+
{ type: "wardrobe", category: "wardrobe", w: 1.6, d: 0.6, h: 2, opening: 0.5 },
|
|
45446
|
+
{ type: "wardrobe_small", category: "wardrobe", w: 1, d: 0.55, h: 1.9, opening: 0.5 },
|
|
45447
|
+
{ type: "wardrobe_large", category: "wardrobe_large", w: 2.4, d: 0.65, h: 2.1, opening: 0.5 },
|
|
45448
|
+
{ type: "dresser", category: "dresser", w: 1, d: 0.45, h: 0.85, opening: 0.5 },
|
|
45431
45449
|
{ type: "desk", category: "desk", w: 1.1, d: 0.6, h: 0.75 },
|
|
45432
45450
|
{ type: "vanity_table", category: "vanity_table", w: 1, d: 0.5, h: 0.8 },
|
|
45433
45451
|
{ type: "toilet", category: "toilet", w: 0.4, d: 0.62, h: 0.75, color: { role: "ceiling" } },
|
|
@@ -45437,8 +45455,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
45437
45455
|
{ type: "shower_large", category: "shower", windowHeight: 1.95, w: 1.1, d: 1.1, h: 0.1, color: { role: "ceiling" } },
|
|
45438
45456
|
{ type: "hamper", category: "hamper", w: 0.35, d: 0.3, h: 0.5 },
|
|
45439
45457
|
{ type: "laundry_tub", category: "laundry_tub", w: 0.6, d: 0.55, h: 0.9, color: { role: "metal" } },
|
|
45440
|
-
{ type: "washing_machine", category: "washing_machine", w: 0.6, d: 0.65, h: 0.9, color: { role: "metal" } },
|
|
45441
|
-
{ type: "laundry_cabinet", category: "laundry_cabinet", w: 0.8, d: 0.4, h: 1.8 },
|
|
45458
|
+
{ type: "washing_machine", category: "washing_machine", w: 0.6, d: 0.65, h: 0.9, opening: 0.5, color: { role: "metal" } },
|
|
45459
|
+
{ type: "laundry_cabinet", category: "laundry_cabinet", w: 0.8, d: 0.4, h: 1.8, opening: 0.45 },
|
|
45442
45460
|
{ type: "laundry_shelf", category: "laundry_shelf", w: 1, d: 0.35, h: 1.6 },
|
|
45443
45461
|
{ type: "car", category: "car", w: 1.85, d: 4.3, h: 1.5, color: { pick: [1842206, 15263974, 10132897, 8003359, 2046559, 4016698, 12103834] } },
|
|
45444
45462
|
{ type: "car_small", category: "car", w: 1.7, d: 3.8, h: 1.45, color: { pick: [1842206, 15263974, 10132897, 8003359, 2046559, 4016698, 12103834] } },
|
|
@@ -45448,10 +45466,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
45448
45466
|
{ type: "office_desk", category: "office_desk", w: 1.4, d: 0.7, h: 0.75 },
|
|
45449
45467
|
{ type: "office_desk_large", category: "office_desk", w: 1.6, d: 0.8, h: 0.75 },
|
|
45450
45468
|
{ type: "bookcase", category: "bookcase", w: 1.2, d: 0.35, h: 2 },
|
|
45451
|
-
{ type: "filing_cabinet", category: "filing_cabinet", w: 0.5, d: 0.6, h: 1.3 },
|
|
45469
|
+
{ type: "filing_cabinet", category: "filing_cabinet", w: 0.5, d: 0.6, h: 1.3, opening: 0.5 },
|
|
45452
45470
|
{ type: "dining_table_large", category: "dining_table_large", w: 2.4, d: 1.1, h: 0.78 },
|
|
45453
|
-
{ type: "buffet", category: "buffet", w: 1.6, d: 0.5, h: 0.9 },
|
|
45454
|
-
{ type: "china_cabinet", category: "china_cabinet", w: 1.2, d: 0.45, h: 2 },
|
|
45471
|
+
{ type: "buffet", category: "buffet", w: 1.6, d: 0.5, h: 0.9, opening: 0.45 },
|
|
45472
|
+
{ type: "china_cabinet", category: "china_cabinet", w: 1.2, d: 0.45, h: 2, opening: 0.45 },
|
|
45455
45473
|
{ type: "stairs", category: "stairs", w: 1, d: 3.2, h: 2.8 },
|
|
45456
45474
|
{ type: "planter_bed", category: "planter_bed", w: 3, d: 0.7, h: 0.4, color: { role: "dirt" } },
|
|
45457
45475
|
{ type: "planter_bed_small", category: "planter_bed", w: 1.8, d: 0.6, h: 0.4, color: { role: "dirt" } },
|
|
@@ -45491,7 +45509,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
45491
45509
|
{ type: "breakfast_bar", category: "breakfast_bar", w: 2, d: 0.55, h: 1, window: true },
|
|
45492
45510
|
{ type: "sauna", category: "sauna", w: 2, d: 2, h: 2.1 },
|
|
45493
45511
|
{ type: "soaking_tub", category: "soaking_tub", w: 1.6, d: 1.6, h: 0.8 },
|
|
45494
|
-
{ type: "closet_wardrobe", category: "wardrobe_large", w: 2, d: 0.6, h: 2.2 },
|
|
45512
|
+
{ type: "closet_wardrobe", category: "wardrobe_large", w: 2, d: 0.6, h: 2.2, opening: 0.5 },
|
|
45495
45513
|
{ type: "sofa_xl", category: "sofa", w: 3, d: 1, h: 0.85, color: { role: "fabric_main" } },
|
|
45496
45514
|
{ type: "gourmet_counter", category: "gourmet", w: 3, d: 0.7, h: 1, window: true, equip: ["bbq_grill", "kitchen_cabinet"] },
|
|
45497
45515
|
{ type: "gourmet_counter_small", category: "gourmet", w: 1.8, d: 0.65, h: 1, window: true, equip: ["bbq_grill", "kitchen_cabinet"] },
|
|
@@ -46568,7 +46586,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
46568
46586
|
}
|
|
46569
46587
|
var residentialTower = residentialTowerTemplate();
|
|
46570
46588
|
|
|
46571
|
-
// ../game-floorplan-three/dist/chunk-
|
|
46589
|
+
// ../game-floorplan-three/dist/chunk-FDMQUIRF.js
|
|
46572
46590
|
var __defProp3 = Object.defineProperty;
|
|
46573
46591
|
var __defNormalProp = (obj, key2, value) => key2 in obj ? __defProp3(obj, key2, { enumerable: true, configurable: true, writable: true, value }) : obj[key2] = value;
|
|
46574
46592
|
var __publicField = (obj, key2, value) => __defNormalProp(obj, typeof key2 !== "symbol" ? key2 + "" : key2, value);
|
|
@@ -48317,10 +48335,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
48317
48335
|
}
|
|
48318
48336
|
function floorLamp(M, A) {
|
|
48319
48337
|
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 };
|
|
48320
|
-
|
|
48338
|
+
const shade3 = M.visorScene ? 0.17 : Math.min(0.17, Math.min(M.w || 0.34, M.d || 0.34) / 2 - 6e-3);
|
|
48339
|
+
K2.c("metal", 0, 0, 0, Math.min(0.13, shade3), 0.025, 2763308);
|
|
48321
48340
|
K2.c("metal", 0, 0.025, 0, 0.011, h - 0.3, 2763308);
|
|
48322
|
-
K2.c("plain", 0, h - 0.28, 0,
|
|
48323
|
-
K2.part("lamp", 0, h - 0.28, 0, () => K2.c("emissive", 0, h - 0.28, 0,
|
|
48341
|
+
K2.c("plain", 0, h - 0.28, 0, shade3, 0.26, 15656656);
|
|
48342
|
+
K2.part("lamp", 0, h - 0.28, 0, () => K2.c("emissive", 0, h - 0.28, 0, shade3 + 3e-3, 0.262, color2), meta);
|
|
48324
48343
|
if (M.on && A.light) A.light(Object.assign({}, M, { lampId: id }), 0, h - 0.15, 0, color2, 5, "floor");
|
|
48325
48344
|
}
|
|
48326
48345
|
function sconce(M, A) {
|
|
@@ -52297,7 +52316,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
52297
52316
|
dresser(M, A) {
|
|
52298
52317
|
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;
|
|
52299
52318
|
lb("wood", 0, 0.04, 0, w, h - 0.08, d, wood);
|
|
52300
|
-
lb("wood", 0, h - 0.04, 0, w + 0.03, 0.04, d + 0.03, sh(wood, 1.15));
|
|
52319
|
+
if (M.visorScene) lb("wood", 0, h - 0.04, 0, w + 0.03, 0.04, d + 0.03, sh(wood, 1.15));
|
|
52320
|
+
else lb("wood", 0, h - 0.04, 75e-4, w, 0.04, d + 0.015, sh(wood, 1.15));
|
|
52301
52321
|
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));
|
|
52302
52322
|
for (let k = 0; k < ng; k++) {
|
|
52303
52323
|
lb("wood", 0, 0.08 + k * gh, d / 2 + 5e-3, w - 0.06, gh - 0.03, 0.012, sh(wood, 1.12));
|
|
@@ -52562,10 +52582,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
52562
52582
|
lb("plain", 0, h - 0.18, d / 2 + 5e-3, w - 0.1, 0.1, 0.01, 3816e3);
|
|
52563
52583
|
},
|
|
52564
52584
|
hamper(M, A) {
|
|
52565
|
-
const { c: lc } = kk(M, A);
|
|
52566
|
-
lc("plain", 0, 0, 0,
|
|
52567
|
-
lc("plain", 0, M.h - 0.01, 0,
|
|
52585
|
+
const { c: lc } = kk(M, A), r = M.visorScene ? M.w / 2 : Math.min(M.w, M.d) / 2;
|
|
52586
|
+
lc("plain", 0, 0, 0, r, M.h, paletteColor(M, "fabric_accent", 10127978));
|
|
52587
|
+
lc("plain", 0, M.h - 0.01, 0, r - 0.03, 0.02, 2763306);
|
|
52568
52588
|
},
|
|
52589
|
+
// (outside the Visor's scene the round basket fits its footprint's narrow side: it stood 2.5 cm in the wall behind it)
|
|
52569
52590
|
trash_bin(M, A) {
|
|
52570
52591
|
const { c: lc } = kk(M, A);
|
|
52571
52592
|
lc("plain", 0, 0, 0, M.w / 2, M.h, 6974574);
|
|
@@ -53107,6 +53128,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
53107
53128
|
return (r * r + r0 * r0 - d * d) / (2 * r * r0) > BLOB_CROSSING;
|
|
53108
53129
|
});
|
|
53109
53130
|
}
|
|
53131
|
+
var FICUS_SPREAD = 1.32;
|
|
53110
53132
|
function installFurniturePlants(K, shared2) {
|
|
53111
53133
|
const seedKey = (id) => K.seedKey(id);
|
|
53112
53134
|
const { SEED, kit2, rngString, sh } = K;
|
|
@@ -53203,19 +53225,20 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
53203
53225
|
}
|
|
53204
53226
|
function potPlant(M, A, o = {}) {
|
|
53205
53227
|
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];
|
|
53206
|
-
const
|
|
53228
|
+
const reach2 = M.visorScene || M.reach == null ? Number.POSITIVE_INFINITY : M.reach, rp = Math.min(r, reach2 / 1.1);
|
|
53229
|
+
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];
|
|
53207
53230
|
if (type === "ficus") {
|
|
53208
53231
|
K2.t("wood", [0, top, 0], [0.02, top + (h - ph) * 0.45, 0], 0.014, 6965808);
|
|
53209
|
-
blobs(K2, 0, top + (h - ph) * 0.35, 0, Math.max(0.2, (h - ph) * 0.4), 9, green2, rnd);
|
|
53232
|
+
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);
|
|
53210
53233
|
} else if (type === "dracena") {
|
|
53211
53234
|
for (let i = 0; i < 3; i++) {
|
|
53212
53235
|
const a = i * 2.1, hh = (h - ph) * (0.5 + 0.2 * i / 2);
|
|
53213
53236
|
const foot = M.visorScene ? 0 : 0.02;
|
|
53214
53237
|
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);
|
|
53215
|
-
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);
|
|
53238
|
+
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);
|
|
53216
53239
|
}
|
|
53217
53240
|
} else {
|
|
53218
|
-
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);
|
|
53241
|
+
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);
|
|
53219
53242
|
}
|
|
53220
53243
|
}
|
|
53221
53244
|
function tablePot(M, A) {
|
|
@@ -53538,6 +53561,57 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
53538
53561
|
const defined = { extraTypes };
|
|
53539
53562
|
Object.assign(K, defined);
|
|
53540
53563
|
}
|
|
53564
|
+
var POTTED_PLANT_TYPES = /* @__PURE__ */ new Set(["floor_plant", "floor_plant_tall", "floor_plant_low", "plant_tall", "plant_short", "outdoor_pot", "table_plant"]);
|
|
53565
|
+
var PLANT_CLEAR = 0.04;
|
|
53566
|
+
var PLANT_MIN_REACH = 0.14;
|
|
53567
|
+
var PLANT_SPAN = [0.03, 2.4];
|
|
53568
|
+
function footprintOf(m) {
|
|
53569
|
+
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;
|
|
53570
|
+
return [m.x - hx, m.z - hz, m.x + hx, m.z + hz];
|
|
53571
|
+
}
|
|
53572
|
+
var reachTo = (x, z, x0, z0, x1, z1) => Math.hypot(Math.max(x0 - x, 0, x - x1), Math.max(z0 - z, 0, z - z1));
|
|
53573
|
+
function freeReachOf(p) {
|
|
53574
|
+
const y0 = p.y + PLANT_SPAN[0], y1 = p.y + PLANT_SPAN[1];
|
|
53575
|
+
let reach2 = Number.POSITIVE_INFINITY;
|
|
53576
|
+
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]));
|
|
53577
|
+
for (const m of p.items) {
|
|
53578
|
+
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;
|
|
53579
|
+
const bottom = p.base + (m.y || 0), top = bottom + (m.h || 0);
|
|
53580
|
+
if (bottom >= y1 || top <= y0) continue;
|
|
53581
|
+
const r = footprintOf(m);
|
|
53582
|
+
reach2 = Math.min(reach2, reachTo(p.x, p.z, r[0], r[1], r[2], r[3]));
|
|
53583
|
+
}
|
|
53584
|
+
return reach2 - PLANT_CLEAR;
|
|
53585
|
+
}
|
|
53586
|
+
function vertexMark(accs) {
|
|
53587
|
+
const mark = /* @__PURE__ */ new Map();
|
|
53588
|
+
for (const a of accs.values()) mark.set(a, a.nv);
|
|
53589
|
+
return mark;
|
|
53590
|
+
}
|
|
53591
|
+
function partToHouse(parts2, group, p) {
|
|
53592
|
+
let at2 = p, name = group;
|
|
53593
|
+
for (let part = parts2.get(name); part; part = parts2.get(name)) {
|
|
53594
|
+
const c = Math.cos(part.ry), s = Math.sin(part.ry);
|
|
53595
|
+
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)];
|
|
53596
|
+
name = part.parent;
|
|
53597
|
+
}
|
|
53598
|
+
return at2;
|
|
53599
|
+
}
|
|
53600
|
+
function boundsSince(accs, mark, parts2) {
|
|
53601
|
+
const byName = new Map(parts2.map((p) => [p.name, p]));
|
|
53602
|
+
const box4 = [Infinity, Infinity, Infinity, -Infinity, -Infinity, -Infinity];
|
|
53603
|
+
for (const a of accs.values()) {
|
|
53604
|
+
for (let v = mark.get(a) ?? 0; v < a.nv; v++) {
|
|
53605
|
+
const local = [a.p[v * 3], a.p[v * 3 + 1], a.p[v * 3 + 2]];
|
|
53606
|
+
const p = a.group.startsWith("part:") ? partToHouse(byName, a.group, local) : local;
|
|
53607
|
+
for (let k = 0; k < 3; k++) {
|
|
53608
|
+
box4[k] = Math.min(box4[k], p[k]);
|
|
53609
|
+
box4[k + 3] = Math.max(box4[k + 3], p[k]);
|
|
53610
|
+
}
|
|
53611
|
+
}
|
|
53612
|
+
}
|
|
53613
|
+
return box4[0] <= box4[3] ? box4 : null;
|
|
53614
|
+
}
|
|
53541
53615
|
var COVER_STEP = 3e-3;
|
|
53542
53616
|
var PANEL_CLEAR = 0.05;
|
|
53543
53617
|
function installFurniturePlaceItems(K, shared2) {
|
|
@@ -53584,6 +53658,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
53584
53658
|
M.base += COVER_STEP * under;
|
|
53585
53659
|
covers.push(own);
|
|
53586
53660
|
}
|
|
53661
|
+
if (!shared2.ctx.visorScene && POTTED_PLANT_TYPES.has(m.type)) {
|
|
53662
|
+
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 });
|
|
53663
|
+
if (reach2 < PLANT_MIN_REACH) continue;
|
|
53664
|
+
M.reach = reach2;
|
|
53665
|
+
}
|
|
53587
53666
|
if (shared2.ctx.veg && vegItem(m, M, exterior ? "lot" : "f" + f)) continue;
|
|
53588
53667
|
if (m.type === "cooking_gas_cylinder" && m.shelter && T2.gas_shelter) {
|
|
53589
53668
|
const st = cursor.stage;
|
|
@@ -53635,8 +53714,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
53635
53714
|
}
|
|
53636
53715
|
const mine = shared2.ctx.itemBoxes;
|
|
53637
53716
|
if (mine) drawn.set(cursor.group, (drawn.get(cursor.group) ?? []).concat([mine]));
|
|
53717
|
+
const mark = shared2.ctx.itemBounds ? vertexMark(cursor.accs) : null;
|
|
53638
53718
|
try {
|
|
53639
53719
|
buildItem2(m, M, ent, api, cursor.group);
|
|
53720
|
+
if (mark) recordBounds(m, mark);
|
|
53640
53721
|
} catch (e) {
|
|
53641
53722
|
cursor.group = exterior ? "lot" : "f" + f;
|
|
53642
53723
|
console.warn("builder", m.type, e);
|
|
@@ -53665,6 +53746,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
53665
53746
|
}
|
|
53666
53747
|
return noModel;
|
|
53667
53748
|
}
|
|
53749
|
+
function recordBounds(m, mark) {
|
|
53750
|
+
const box4 = boundsSince(cursor.accs, mark, K.PARTS);
|
|
53751
|
+
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 });
|
|
53752
|
+
}
|
|
53668
53753
|
const ROOF_CLEAR = 0.06;
|
|
53669
53754
|
function overRoof(m, M, f) {
|
|
53670
53755
|
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]));
|
|
@@ -53780,6 +53865,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
53780
53865
|
const defined = { houseItems, waterTankOfHouse, hashColor, labeledBox };
|
|
53781
53866
|
Object.assign(K, defined);
|
|
53782
53867
|
}
|
|
53868
|
+
var PLANT_RADIUS_MARGIN = 1.08;
|
|
53869
|
+
var PLANT_MIN_SCALE = 0.4;
|
|
53783
53870
|
function installVegetationBridge(K, shared2) {
|
|
53784
53871
|
const seedKey = (id) => K.seedKey(id);
|
|
53785
53872
|
const { THREE, SEED, rngString } = K;
|
|
@@ -53794,7 +53881,6 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
53794
53881
|
floor_plant_tall: VEG_POT,
|
|
53795
53882
|
floor_plant: VEG_POT,
|
|
53796
53883
|
outdoor_pot: VEG_POT,
|
|
53797
|
-
toilet: VEG_POT,
|
|
53798
53884
|
floor_plant_low: ["potted_succulents", "potted_cactus"],
|
|
53799
53885
|
table_plant: ["potted_succulents", "potted_cactus"],
|
|
53800
53886
|
clump: ["lawn_tuft"],
|
|
@@ -53843,9 +53929,41 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
53843
53929
|
}
|
|
53844
53930
|
return true;
|
|
53845
53931
|
}
|
|
53846
|
-
|
|
53932
|
+
if (M.reach != null) {
|
|
53933
|
+
const fit = fitted(V, lst, pick2(lst), sd, M.reach);
|
|
53934
|
+
if (!fit) return true;
|
|
53935
|
+
G.pl.push({ species: fit.species, x: M.x, z: M.z, ry: M.ry || 0, scale: fit.scale, seed: sd });
|
|
53936
|
+
const r = fit.radius * fit.scale;
|
|
53937
|
+
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] });
|
|
53938
|
+
return true;
|
|
53939
|
+
}
|
|
53940
|
+
const species = pick2(lst);
|
|
53941
|
+
G.pl.push({ species, x: M.x, z: M.z, ry: M.ry || 0, scale: 1, seed: sd });
|
|
53942
|
+
if (shared2.ctx.itemBounds) {
|
|
53943
|
+
const size = speciesSize(V, species, sd);
|
|
53944
|
+
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] });
|
|
53945
|
+
}
|
|
53847
53946
|
return true;
|
|
53848
53947
|
}
|
|
53948
|
+
function speciesSize(V, id, seed) {
|
|
53949
|
+
const key2 = id + "|" + seed;
|
|
53950
|
+
let r = V.sizes.get(key2);
|
|
53951
|
+
if (!r) {
|
|
53952
|
+
r = V.G.generate ? V.G.generate(V.S.toSpec(id), { seed }).bounds : { radius: 0, height: 0 };
|
|
53953
|
+
V.sizes.set(key2, r);
|
|
53954
|
+
}
|
|
53955
|
+
return r;
|
|
53956
|
+
}
|
|
53957
|
+
function fitted(V, species, first, seed, reach2) {
|
|
53958
|
+
const sizeOf = (id) => speciesSize(V, id, seed);
|
|
53959
|
+
let best = null;
|
|
53960
|
+
for (const id of [first, ...species.filter((s) => s !== first)]) {
|
|
53961
|
+
const size = sizeOf(id), r = size.radius * PLANT_RADIUS_MARGIN, scale = r > reach2 ? reach2 / r : 1;
|
|
53962
|
+
if (scale === 1) return { species: id, scale, ...size };
|
|
53963
|
+
if (!best || scale > best.scale) best = { species: id, scale, ...size };
|
|
53964
|
+
}
|
|
53965
|
+
return best && best.scale >= PLANT_MIN_SCALE ? best : null;
|
|
53966
|
+
}
|
|
53849
53967
|
function assembleVegetation(groups) {
|
|
53850
53968
|
const V = shared2.ctx.veg;
|
|
53851
53969
|
if (!V) return;
|
|
@@ -53882,7 +54000,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
53882
54000
|
shared2.partState = /* @__PURE__ */ new Map();
|
|
53883
54001
|
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 });
|
|
53884
54002
|
shared2.inter = newInteractiveState();
|
|
53885
|
-
const MESSAGE_MS = 2200;
|
|
54003
|
+
const MESSAGE_MS = 2200, LAMP_OFF_COLOR = 15658214, LAMP_DIFFUSER_MATERIAL = "glass";
|
|
53886
54004
|
UV_SCALE.doorWood = 1;
|
|
53887
54005
|
UV_SCALE.doorPaint = 1;
|
|
53888
54006
|
function createInteractiveMaterials(mats) {
|
|
@@ -53933,6 +54051,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
53933
54051
|
mats.doorWood = new THREE.MeshLambertMaterial({ vertexColors: true, map: wood });
|
|
53934
54052
|
mats.doorPaint = new THREE.MeshLambertMaterial({ vertexColors: true, map: paint });
|
|
53935
54053
|
mats.off = new THREE.MeshBasicMaterial({ vertexColors: true, color: 9078656 });
|
|
54054
|
+
mats.lampOff = new THREE.MeshPhongMaterial({ color: LAMP_OFF_COLOR, shininess: 70, specular: 6710886, transparent: true, opacity: 0.9 });
|
|
53936
54055
|
}
|
|
53937
54056
|
const _EY = new THREE.Vector3(0, 1, 0), _UM3 = new THREE.Vector3(1, 1, 1);
|
|
53938
54057
|
const hudMessage = (text) => {
|
|
@@ -53973,6 +54092,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
53973
54092
|
o.geometry.applyMatrix4(inv);
|
|
53974
54093
|
o.userData.piece = def;
|
|
53975
54094
|
def.meshes.push(o);
|
|
54095
|
+
if (def.roomId && o.name.endsWith("/emissive")) o.userData.destructionMaterial = LAMP_DIFFUSER_MATERIAL;
|
|
53976
54096
|
}
|
|
53977
54097
|
});
|
|
53978
54098
|
outer.add(g);
|
|
@@ -54059,7 +54179,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
54059
54179
|
};
|
|
54060
54180
|
function applyLight(roomId) {
|
|
54061
54181
|
const on = lightOn(roomId), inter = I(), mats = shared2.mats;
|
|
54062
|
-
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;
|
|
54182
|
+
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;
|
|
54063
54183
|
const sw = inter.defs.get("ix:int:" + roomId);
|
|
54064
54184
|
if (sw) {
|
|
54065
54185
|
sw.target = on ? 1 : 0;
|
|
@@ -54564,7 +54684,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
54564
54684
|
Object.assign(K, defined);
|
|
54565
54685
|
}
|
|
54566
54686
|
function installInteractablesBridge(K, shared2) {
|
|
54567
|
-
const { t, THREE, invalidate, invalidateShadow, cfg, DOC, LIGHT_TYPES, _Y, _q, _v3, accFor, applyLight, cursor, hashString: hashString2, hudMessage, lightBase, pieceRecord,
|
|
54687
|
+
const { t, THREE, invalidate, invalidateShadow, cfg, DOC, LIGHT_TYPES, _Y, _q, _v3, accFor, applyLight, cursor, hashString: hashString2, hudMessage, lightBase, pieceRecord, rgbOf, wallBlocks } = K;
|
|
54568
54688
|
const enter = (...a) => K.enter(...a);
|
|
54569
54689
|
const roomLightMask = (...a) => K.roomLightMask(...a);
|
|
54570
54690
|
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" };
|
|
@@ -54618,7 +54738,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
54618
54738
|
void world0;
|
|
54619
54739
|
const source = r;
|
|
54620
54740
|
const plane2 = A.plan(source, { seed: r.seed });
|
|
54621
|
-
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,
|
|
54741
|
+
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 };
|
|
54622
54742
|
h.IV = IV;
|
|
54623
54743
|
const t0 = performance.now();
|
|
54624
54744
|
const lamps = new Set(plane2.items.filter((e) => e.type === "lamp").map((e) => e.id));
|
|
@@ -54788,20 +54908,18 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
54788
54908
|
if (!d.plug) continue;
|
|
54789
54909
|
const wire = (spec.wires || []).find((x) => x.id === d.id + "_cord"), pts = (wire ? wire.points : [d.plug]).map((p) => wl(o, p));
|
|
54790
54910
|
const sid = w.power.pluggedInto(E.id, d.id);
|
|
54791
|
-
|
|
54792
|
-
|
|
54793
|
-
|
|
54794
|
-
|
|
54795
|
-
|
|
54796
|
-
|
|
54797
|
-
|
|
54798
|
-
|
|
54799
|
-
|
|
54800
|
-
|
|
54801
|
-
for (const p of hang) pts.push(p);
|
|
54802
|
-
}
|
|
54803
|
-
}
|
|
54911
|
+
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;
|
|
54912
|
+
if (!so || !sk) continue;
|
|
54913
|
+
const sp = wl(so, sk.pos), dir = [Math.sin(so.transform.ry), Math.cos(so.transform.ry)], last = pts[pts.length - 1];
|
|
54914
|
+
if (last[1] < 0.3 + E.pos[1]) {
|
|
54915
|
+
const foot = [sp[0] + dir[0] * 0.035, E.pos[1] + 0.012, sp[2] + dir[1] * 0.035];
|
|
54916
|
+
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]);
|
|
54917
|
+
} else {
|
|
54918
|
+
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);
|
|
54919
|
+
hang.shift();
|
|
54920
|
+
for (const p of hang) pts.push(p);
|
|
54804
54921
|
}
|
|
54922
|
+
shared2.ctx.cordPaths?.push({ object: E.id, device: d.id, points: pts.map((p) => [p[0], p[1], p[2]]) });
|
|
54805
54923
|
tube2(pts, 6e-3, IV_WIRE.cord, 0, 0, 0, 0);
|
|
54806
54924
|
}
|
|
54807
54925
|
}
|
|
@@ -54837,12 +54955,16 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
54837
54955
|
}
|
|
54838
54956
|
IV.dirty = true;
|
|
54839
54957
|
switch (e.type) {
|
|
54840
|
-
case "part":
|
|
54958
|
+
case "part": {
|
|
54841
54959
|
if (e.part === "_x") break;
|
|
54842
54960
|
IV.anim.set(e.object + "|" + e.part, { object: e.object, part: e.part, target: e.target, t0: IV.t });
|
|
54843
54961
|
IV.itemsDirty = true;
|
|
54962
|
+
const E = e.target > 0 ? IV.entries.get(e.object) : void 0;
|
|
54963
|
+
if (E) ivContents(IV, E)?.sync();
|
|
54844
54964
|
invalidate();
|
|
54845
54965
|
break;
|
|
54966
|
+
}
|
|
54967
|
+
// the contents are drawn before the part moves, so they ride it from its first frame
|
|
54846
54968
|
case "device": {
|
|
54847
54969
|
const roomId = IV.lampRoom.get(e.object);
|
|
54848
54970
|
if (roomId) shared2.partState.set("light:" + roomId, !!e.on);
|
|
@@ -54853,6 +54975,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
54853
54975
|
hudMessage(e.text);
|
|
54854
54976
|
break;
|
|
54855
54977
|
case "pickup":
|
|
54978
|
+
IV.contents.get(e.object)?.sync();
|
|
54856
54979
|
IV.itemsDirty = true;
|
|
54857
54980
|
if (e.actor === "player" && e.stack) {
|
|
54858
54981
|
const d = IV.world.t("item." + e.stack.type);
|
|
@@ -54897,6 +55020,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
54897
55020
|
for (const [k, a] of IV.anim) {
|
|
54898
55021
|
const E = IV.entries.get(a.object);
|
|
54899
55022
|
if (E && E.parts) ik.gfx.syncObject(w, a.object, E.parts, { time: IV.t });
|
|
55023
|
+
IV.contents.get(a.object)?.sync();
|
|
54900
55024
|
if (w.partT(a.object, a.part) === a.target || IV.t - a.t0 > 4) IV.anim.delete(k);
|
|
54901
55025
|
}
|
|
54902
55026
|
invalidateShadow();
|
|
@@ -54936,28 +55060,23 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
54936
55060
|
invalidate();
|
|
54937
55061
|
}
|
|
54938
55062
|
}
|
|
54939
|
-
if (ivk.items && IV.itemsDirty && IV.t - IV.itemsT > 0.1
|
|
54940
|
-
}
|
|
54941
|
-
|
|
54942
|
-
|
|
54943
|
-
|
|
54944
|
-
|
|
54945
|
-
|
|
54946
|
-
|
|
54947
|
-
|
|
54948
|
-
|
|
54949
|
-
|
|
54950
|
-
|
|
54951
|
-
|
|
54952
|
-
cloth: [["box", 1, 1, 1, 0, 1]],
|
|
54953
|
-
paper: [["box", 1, 1, 1, 0, 1]],
|
|
54954
|
-
tool: [["box", 1, 1, 1, 0, 1]],
|
|
54955
|
-
shoe: [["box", 1, 0.7, 1, 0, 1]]
|
|
54956
|
-
};
|
|
55063
|
+
if (ivk.items && IV.itemsDirty && IV.t - IV.itemsT > 0.1) ivItems(IV, h);
|
|
55064
|
+
}
|
|
55065
|
+
function ivContents(IV, E) {
|
|
55066
|
+
const had = IV.contents.get(E.id);
|
|
55067
|
+
if (had) return had;
|
|
55068
|
+
const ik = IV.k, make3 = ik.GT.createContentsView;
|
|
55069
|
+
if (!ik.items || !ik.itemModel || !make3 || !(E.spec.containers || []).length) return null;
|
|
55070
|
+
const view = make3(THREE, { world: IV.world, objectId: E.id, root: E.root, buildItem: ik.itemModel });
|
|
55071
|
+
IV.contents.set(E.id, view);
|
|
55072
|
+
view.sync();
|
|
55073
|
+
invalidateShadow();
|
|
55074
|
+
return view;
|
|
55075
|
+
}
|
|
54957
55076
|
function ivItems(IV, h) {
|
|
54958
55077
|
IV.itemsDirty = false;
|
|
54959
55078
|
IV.itemsT = IV.t;
|
|
54960
|
-
const w = IV.world,
|
|
55079
|
+
const w = IV.world, f = IV.focus;
|
|
54961
55080
|
let fl = null;
|
|
54962
55081
|
if (f) {
|
|
54963
55082
|
h.houseGroup.updateWorldMatrix(true, false);
|
|
@@ -54965,57 +55084,20 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
54965
55084
|
h.houseGroup.worldToLocal(fl);
|
|
54966
55085
|
}
|
|
54967
55086
|
for (const E of IV.entries.values()) {
|
|
55087
|
+
const view = IV.contents.get(E.id);
|
|
55088
|
+
if (view) {
|
|
55089
|
+
view.sync();
|
|
55090
|
+
continue;
|
|
55091
|
+
}
|
|
54968
55092
|
if (fl && E.floor >= 0 && Math.hypot(E.pos[0] - fl.x, E.pos[2] - fl.z) > 14) continue;
|
|
54969
55093
|
for (const c of E.spec.containers || []) {
|
|
54970
|
-
if (
|
|
54971
|
-
if (
|
|
54972
|
-
|
|
54973
|
-
|
|
54974
|
-
const stack = st[i];
|
|
54975
|
-
if (stack && items[stack.type]) list2.push([E, c.id, i, items[stack.type]]);
|
|
55094
|
+
if (c.access && w.partT(E.id, c.access) <= 0) continue;
|
|
55095
|
+
if (w.contents(E.id, c.id).some((st) => st !== null)) {
|
|
55096
|
+
ivContents(IV, E);
|
|
55097
|
+
break;
|
|
54976
55098
|
}
|
|
54977
55099
|
}
|
|
54978
55100
|
}
|
|
54979
|
-
if (!list2.length) {
|
|
54980
|
-
if (IV.items) IV.items.visible = false;
|
|
54981
|
-
return;
|
|
54982
|
-
}
|
|
54983
|
-
cursor.group = "iv-items";
|
|
54984
|
-
try {
|
|
54985
|
-
for (const [E, cid, slot, def] of list2) {
|
|
54986
|
-
const p = w.slotPosition(E.id, cid, slot), form = IV_SHAPE[def.shape] || IV_SHAPE.box;
|
|
54987
|
-
for (const [geo, fx, fy, fz, y0, tone] of form) {
|
|
54988
|
-
const sx = def.size[0] * fx, sy = def.size[1] * fy, sz = def.size[2] * fz;
|
|
54989
|
-
_q.setFromAxisAngle(_Y, E.ry);
|
|
54990
|
-
const color2 = def.color == null ? 13421772 : def.color;
|
|
54991
|
-
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));
|
|
54992
|
-
}
|
|
54993
|
-
}
|
|
54994
|
-
const A = cursor.accs.get("iv-items|plain");
|
|
54995
|
-
cursor.accs.delete("iv-items|plain");
|
|
54996
|
-
const gm = new THREE.BufferGeometry();
|
|
54997
|
-
gm.setAttribute("position", new THREE.BufferAttribute(A.p.slice(0, A.nv * 3), 3));
|
|
54998
|
-
gm.setAttribute("normal", new THREE.BufferAttribute(A.n.slice(0, A.nv * 3), 3));
|
|
54999
|
-
gm.setAttribute("color", new THREE.BufferAttribute(A.c.slice(0, A.nv * 3), 3));
|
|
55000
|
-
gm.setAttribute("uv", new THREE.BufferAttribute(A.u.slice(0, A.nv * 2), 2));
|
|
55001
|
-
gm.setIndex(new THREE.BufferAttribute(A.i.slice(0, A.ni), 1));
|
|
55002
|
-
gm.computeBoundingSphere();
|
|
55003
|
-
if (!IV.items) {
|
|
55004
|
-
const mesh2 = new THREE.Mesh(gm, shared2.mats.plain);
|
|
55005
|
-
IV.items = mesh2;
|
|
55006
|
-
mesh2.name = "iv-items";
|
|
55007
|
-
mesh2.castShadow = false;
|
|
55008
|
-
mesh2.receiveShadow = true;
|
|
55009
|
-
mesh2.frustumCulled = false;
|
|
55010
|
-
h.houseGroup.add(mesh2);
|
|
55011
|
-
} else {
|
|
55012
|
-
IV.items.geometry.dispose();
|
|
55013
|
-
IV.items.geometry = gm;
|
|
55014
|
-
}
|
|
55015
|
-
IV.items.visible = true;
|
|
55016
|
-
} finally {
|
|
55017
|
-
cursor.group = g0;
|
|
55018
|
-
}
|
|
55019
55101
|
invalidateShadow();
|
|
55020
55102
|
}
|
|
55021
55103
|
function ivTarget(IV, o, opt) {
|
|
@@ -55074,7 +55156,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
55074
55156
|
}
|
|
55075
55157
|
}
|
|
55076
55158
|
for (const sc of IV.screens.values()) sc.dispose();
|
|
55077
|
-
|
|
55159
|
+
for (const view of IV.contents.values()) view.dispose();
|
|
55160
|
+
IV.contents.clear();
|
|
55078
55161
|
}
|
|
55079
55162
|
function ivPublish(h) {
|
|
55080
55163
|
const IV = h.IV, w = IV.world, ik = IV.k, com = (fn) => (...a) => {
|
|
@@ -55141,7 +55224,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
55141
55224
|
};
|
|
55142
55225
|
return IV.pub;
|
|
55143
55226
|
}
|
|
55144
|
-
const defined = { IV_MATERIAL, IV_WIRE, IV_DOOR, ivGroup, ivAccumulate, ivBuild, ivRoomEffective, ivDraw, ivCords, ivAssemble, ivScreen, ivEvent, ivSeat, ivUpdate,
|
|
55227
|
+
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 };
|
|
55145
55228
|
Object.assign(K, defined);
|
|
55146
55229
|
}
|
|
55147
55230
|
function installAnimationClotheslines(K, shared2) {
|
|
@@ -55204,7 +55287,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
55204
55287
|
return null;
|
|
55205
55288
|
}
|
|
55206
55289
|
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 } : {} });
|
|
55207
|
-
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 };
|
|
55290
|
+
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 };
|
|
55208
55291
|
})();
|
|
55209
55292
|
const VEG = (() => {
|
|
55210
55293
|
const l = cfg.vegetation || null, G = l && (l.GameVegetation || (l.buildLot ? l : null)), S = l && (l.GameVegetationSpecies || (l.toSpec ? l : null));
|
|
@@ -55762,14 +55845,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
55762
55845
|
}
|
|
55763
55846
|
return best;
|
|
55764
55847
|
};
|
|
55765
|
-
const
|
|
55848
|
+
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]));
|
|
55766
55849
|
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);
|
|
55767
55850
|
const wallBeside = (p, reach2) => {
|
|
55768
55851
|
for (const roles of [WALL_ROLES, SPAN_ROLES]) {
|
|
55769
55852
|
let best = null, bd = Infinity, bc = Infinity;
|
|
55770
55853
|
for (const q of parts2) {
|
|
55771
55854
|
if (q === p || !(q.extra ? roles === WALL_ROLES && Array.isArray(q.tags) && q.tags.includes("wall") : roles.has(q.role))) continue;
|
|
55772
|
-
const d =
|
|
55855
|
+
const d = gapOf2(p, q);
|
|
55773
55856
|
if (d > reach2) continue;
|
|
55774
55857
|
const c = centreGapOf(p, q);
|
|
55775
55858
|
if (d < bd || d === bd && (c < bc || c === bc && best !== null && q.id < best.id)) {
|
|
@@ -58050,8 +58133,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58050
58133
|
shared2.ctx.pu = Math.max(0, pr.unit != null ? pr.unit : 0);
|
|
58051
58134
|
shared2.ctx.showBuilding = shared2.ctx.apartment && (pr.showIt == null ? true : !!pr.showIt);
|
|
58052
58135
|
shared2.ctx.limits = { x0: -2, z0: -2, x1: r.w + 2, z1: r.d + 2 };
|
|
58053
|
-
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;
|
|
58136
|
+
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;
|
|
58054
58137
|
shared2.ctx.vegInfo = null;
|
|
58138
|
+
shared2.ctx.itemBounds = opts.itemBounds ? [] : void 0;
|
|
58139
|
+
shared2.ctx.cordPaths = opts.itemBounds ? [] : void 0;
|
|
58055
58140
|
const cs = !!(opts.constructionStages || opts.constructionLevel != null);
|
|
58056
58141
|
shared2.ctx.constructionStages = cs;
|
|
58057
58142
|
if (Y0(0) > 0 && !shared2.ctx.visorScene) shared2.ctx.unitGround = Y0(0);
|
|
@@ -58699,6 +58784,90 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58699
58784
|
installBuildBuild(K, shared2);
|
|
58700
58785
|
return buildApi(K, shared2);
|
|
58701
58786
|
}
|
|
58787
|
+
var HOLD_REACH2 = 0.05;
|
|
58788
|
+
var BACK_TOUCH = 0.02;
|
|
58789
|
+
var SOFT = /* @__PURE__ */ new Set(["fabric", "paper", "foliage"]);
|
|
58790
|
+
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])));
|
|
58791
|
+
function groupsOf(parts2, joints) {
|
|
58792
|
+
const root = new Map(parts2.map((part) => [part.id, part.id]));
|
|
58793
|
+
const find = (id) => {
|
|
58794
|
+
let at2 = id;
|
|
58795
|
+
while (root.get(at2) !== at2) at2 = root.get(at2);
|
|
58796
|
+
root.set(id, at2);
|
|
58797
|
+
return at2;
|
|
58798
|
+
};
|
|
58799
|
+
for (const joint of joints) root.set(find(joint.a), find(joint.b));
|
|
58800
|
+
const groups = /* @__PURE__ */ new Map();
|
|
58801
|
+
for (const part of parts2) {
|
|
58802
|
+
const at2 = find(part.id);
|
|
58803
|
+
groups.set(at2, [...groups.get(at2) ?? [], part.id]);
|
|
58804
|
+
}
|
|
58805
|
+
return [...groups.values()];
|
|
58806
|
+
}
|
|
58807
|
+
function nearestJoint(loose, held, boxOf3, reach2) {
|
|
58808
|
+
let best = null;
|
|
58809
|
+
for (const a of loose) {
|
|
58810
|
+
for (const b of held) {
|
|
58811
|
+
const gap = gapOf(boxOf3(a.id), boxOf3(b.id));
|
|
58812
|
+
if (gap <= reach2 && (!best || gap < best.gap)) best = { gap, a, b };
|
|
58813
|
+
}
|
|
58814
|
+
}
|
|
58815
|
+
if (!best) return null;
|
|
58816
|
+
const [joint] = inferJoints([best.a, best.b], best.gap + 0.05);
|
|
58817
|
+
return joint ? { ...joint, id: `${best.a.id}~${best.b.id}` } : null;
|
|
58818
|
+
}
|
|
58819
|
+
var FLOOR_TOUCH = 5e-3;
|
|
58820
|
+
var STANDS_ALONE = 0.3;
|
|
58821
|
+
function standsAlone(group, boxOf3) {
|
|
58822
|
+
const feet = group.map((part) => boxOf3(part.id)).filter((box4) => box4.min[1] <= FLOOR_TOUCH);
|
|
58823
|
+
if (feet.length === 0) return false;
|
|
58824
|
+
const height = Math.max(...group.map((part) => boxOf3(part.id).max[1]));
|
|
58825
|
+
const across2 = (k) => Math.max(...feet.map((box4) => box4.max[k])) - Math.min(...feet.map((box4) => box4.min[k]));
|
|
58826
|
+
return Math.min(across2(0), across2(2)) >= STANDS_ALONE * height;
|
|
58827
|
+
}
|
|
58828
|
+
function joinBodies({ parts: parts2, joints, boxOf: boxOf3 }, byId) {
|
|
58829
|
+
const groups = groupsOf(parts2, joints).map((ids) => ids.map((id) => byId.get(id))).sort((a, b) => b.length - a.length);
|
|
58830
|
+
const [main, ...rest2] = groups;
|
|
58831
|
+
if (!main) return;
|
|
58832
|
+
for (const group of rest2) {
|
|
58833
|
+
if (standsAlone(group, boxOf3)) continue;
|
|
58834
|
+
const joint = nearestJoint(group, main, boxOf3, Infinity);
|
|
58835
|
+
if (joint) joints.push(joint);
|
|
58836
|
+
}
|
|
58837
|
+
}
|
|
58838
|
+
function holdLooseGroups(params) {
|
|
58839
|
+
const byId = new Map(params.parts.map((part) => [part.id, part]));
|
|
58840
|
+
holdHanging(params, byId);
|
|
58841
|
+
joinBodies(params, byId);
|
|
58842
|
+
}
|
|
58843
|
+
function holdHanging({ parts: parts2, joints, boxOf: boxOf3 }, byId) {
|
|
58844
|
+
const back = Math.min(...parts2.map((part) => boxOf3(part.id).min[2]));
|
|
58845
|
+
for (let pass = 0; pass < parts2.length; pass++) {
|
|
58846
|
+
const groups = groupsOf(parts2, joints).map((ids) => ids.map((id) => byId.get(id)));
|
|
58847
|
+
const held = groups.filter((group) => group.some((part) => part.anchored)).flat();
|
|
58848
|
+
const loose = groups.filter((group) => !group.some((part) => part.anchored));
|
|
58849
|
+
if (loose.length === 0) return;
|
|
58850
|
+
let changed = false;
|
|
58851
|
+
for (const group of loose) {
|
|
58852
|
+
const joint = nearestJoint(group, held, boxOf3, HOLD_REACH2);
|
|
58853
|
+
if (joint) {
|
|
58854
|
+
joints.push(joint);
|
|
58855
|
+
changed = true;
|
|
58856
|
+
continue;
|
|
58857
|
+
}
|
|
58858
|
+
const onWall = group.filter((part) => !SOFT.has(part.material) && boxOf3(part.id).min[2] <= back + BACK_TOUCH);
|
|
58859
|
+
if (onWall.length === 0) continue;
|
|
58860
|
+
for (const part of onWall) part.anchored = true;
|
|
58861
|
+
changed = true;
|
|
58862
|
+
}
|
|
58863
|
+
if (changed) continue;
|
|
58864
|
+
for (const group of loose) {
|
|
58865
|
+
const joint = nearestJoint(group, held, boxOf3, Infinity);
|
|
58866
|
+
if (joint) joints.push(joint);
|
|
58867
|
+
}
|
|
58868
|
+
return;
|
|
58869
|
+
}
|
|
58870
|
+
}
|
|
58702
58871
|
var WOOD_THIN = 0.035;
|
|
58703
58872
|
var BOARD_TOP_THICK = 0.07;
|
|
58704
58873
|
var BOARD_TOP_WIDTH = 0.5;
|
|
@@ -58750,7 +58919,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58750
58919
|
const channel = (shift) => Math.min(255, Math.round((color2 >> shift & 255) * k)) << shift;
|
|
58751
58920
|
return channel(16) | channel(8) | channel(0);
|
|
58752
58921
|
}
|
|
58753
|
-
var
|
|
58922
|
+
var FLOOR_TOUCH2 = 5e-3;
|
|
58754
58923
|
var LOOSE = /* @__PURE__ */ new Set(["paper"]);
|
|
58755
58924
|
var BASE_MATERIAL = {
|
|
58756
58925
|
wood: "wood_hard",
|
|
@@ -58835,7 +59004,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58835
59004
|
else if (p.key === "wood" && material === "wood_hard" && thin < WOOD_THIN) material = "wood_soft";
|
|
58836
59005
|
const part = { id: p.id, material, shape: p.shape, position: p.position };
|
|
58837
59006
|
if (p.rotation) part.rotation = p.rotation;
|
|
58838
|
-
if (!LOOSE.has(material) && p.min[1] <=
|
|
59007
|
+
if (!LOOSE.has(material) && p.min[1] <= FLOOR_TOUCH2) part.anchored = true;
|
|
58839
59008
|
if (opts.carcass && LOOSE.has(material)) {
|
|
58840
59009
|
part.hands = 1;
|
|
58841
59010
|
part.tags = ["book"];
|
|
@@ -58858,6 +59027,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58858
59027
|
}
|
|
58859
59028
|
joints.push(j);
|
|
58860
59029
|
}
|
|
59030
|
+
holdLooseGroups({ parts: parts2, joints, boxOf: (id) => byId.get(id) });
|
|
59031
|
+
const low = (part) => byId.get(part.id).min[1];
|
|
59032
|
+
const wallMounted = parts2.some((part) => part.anchored && low(part) > FLOOR_TOUCH2);
|
|
59033
|
+
const sunk = parts2.some((part) => low(part) < -FLOOR_TOUCH2);
|
|
59034
|
+
const rooted = parts2.some((part) => part.material === "foliage") && parts2.some((part) => part.material.startsWith("wood") && low(part) <= FLOOR_TOUCH2);
|
|
59035
|
+
const fixed = wallMounted || sunk || rooted;
|
|
58861
59036
|
const all = drawn.reduce(
|
|
58862
59037
|
(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]) }),
|
|
58863
59038
|
{ x0: Infinity, x1: -Infinity, z0: Infinity, z1: -Infinity }
|
|
@@ -58879,7 +59054,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58879
59054
|
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) };
|
|
58880
59055
|
}
|
|
58881
59056
|
if (opts.carcass) carcass(parts2, byId);
|
|
58882
|
-
const spec = { name, parts: parts2, joints, tags: ["furniture"] };
|
|
59057
|
+
const spec = { name, parts: parts2, joints, tags: ["furniture"], ...fixed ? { fixed } : {} };
|
|
58883
59058
|
const colors = new Map(drawn.map((p) => [p.id, p.color]));
|
|
58884
59059
|
const build = (T3) => {
|
|
58885
59060
|
const group = markKitOrigin(new T3.Group(), { owner: "game-floorplan-three", kind: "furniture", id: name });
|
|
@@ -58909,7 +59084,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58909
59084
|
}
|
|
58910
59085
|
return group;
|
|
58911
59086
|
};
|
|
58912
|
-
return { spec, build, top };
|
|
59087
|
+
return { spec, build, top, fixed };
|
|
58913
59088
|
}
|
|
58914
59089
|
function furnitureSpec(THREE, type, opts = {}) {
|
|
58915
59090
|
const renderer = rendererOf(THREE, opts.document);
|
|
@@ -58945,7 +59120,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58945
59120
|
);
|
|
58946
59121
|
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]);
|
|
58947
59122
|
K.PARTS.length = before;
|
|
58948
|
-
return { spec: made.spec, build: made.build, top: made.top, size: { w, d, h }, spouts };
|
|
59123
|
+
return { spec: made.spec, build: made.build, top: made.top, size: { w, d, h }, spouts, fixed: made.fixed };
|
|
58949
59124
|
}
|
|
58950
59125
|
|
|
58951
59126
|
// src/area-layout.ts
|