@adatechnology/game-items-three 0.7.3 → 0.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-WGFTVYO3.js → chunk-76GT7V27.js} +1 -1
- package/dist/chunk-76GT7V27.js.map +1 -0
- package/dist/index.global.js +431 -278
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/testing.js +1 -1
- package/package.json +8 -8
- package/dist/chunk-WGFTVYO3.js.map +0 -1
package/dist/index.global.js
CHANGED
|
@@ -89,7 +89,7 @@ var GameItemsThree = (() => {
|
|
|
89
89
|
wearableMaterials: () => wearableMaterials
|
|
90
90
|
});
|
|
91
91
|
|
|
92
|
-
// ../game-shapes/dist/chunk-
|
|
92
|
+
// ../game-shapes/dist/chunk-FZQTELDQ.js
|
|
93
93
|
function canonicalJson(value) {
|
|
94
94
|
if (value === null) return "null";
|
|
95
95
|
if (typeof value === "number") return Object.is(value, -0) ? "-0" : Number.isFinite(value) ? String(value) : JSON.stringify(String(value));
|
|
@@ -1001,17 +1001,19 @@ var GameItemsThree = (() => {
|
|
|
1001
1001
|
if (p.prevZ) p.prevZ.nextZ = p.nextZ;
|
|
1002
1002
|
if (p.nextZ) p.nextZ.prevZ = p.prevZ;
|
|
1003
1003
|
}
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1004
|
+
var Node = class {
|
|
1005
|
+
constructor(i, x, y) {
|
|
1006
|
+
this.i = i;
|
|
1007
|
+
this.x = x;
|
|
1008
|
+
this.y = y;
|
|
1009
|
+
this.prev = null;
|
|
1010
|
+
this.next = null;
|
|
1011
|
+
this.z = 0;
|
|
1012
|
+
this.prevZ = null;
|
|
1013
|
+
this.nextZ = null;
|
|
1014
|
+
this.steiner = false;
|
|
1015
|
+
}
|
|
1016
|
+
};
|
|
1015
1017
|
function signedArea(data, start, end, dim) {
|
|
1016
1018
|
let sum = 0;
|
|
1017
1019
|
for (let i = start, j = end - dim; i < end; i += dim) {
|
|
@@ -1969,6 +1971,9 @@ var GameItemsThree = (() => {
|
|
|
1969
1971
|
}
|
|
1970
1972
|
return releaseObject3D(list2, { keep });
|
|
1971
1973
|
}
|
|
1974
|
+
function isMesh(o) {
|
|
1975
|
+
return !!o && o.isMesh === true;
|
|
1976
|
+
}
|
|
1972
1977
|
|
|
1973
1978
|
// src/kit.ts
|
|
1974
1979
|
var WEAR_TAGS = ["metal", "wood", "cloth", "plastic", "paper", "food", "glass"];
|
|
@@ -14884,6 +14889,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
14884
14889
|
floor: 60
|
|
14885
14890
|
}
|
|
14886
14891
|
},
|
|
14892
|
+
ricochetDeg: 12,
|
|
14887
14893
|
hitDebris: "chips",
|
|
14888
14894
|
breakDebris: "dust",
|
|
14889
14895
|
visual: { innerColor: 10197652 },
|
|
@@ -14915,6 +14921,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
14915
14921
|
0.04,
|
|
14916
14922
|
0.12
|
|
14917
14923
|
],
|
|
14924
|
+
ricochetDeg: 10,
|
|
14918
14925
|
hitDebris: "chips",
|
|
14919
14926
|
breakDebris: "dust",
|
|
14920
14927
|
visual: { innerColor: 12085567 },
|
|
@@ -14972,6 +14979,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
14972
14979
|
0.06,
|
|
14973
14980
|
0.3
|
|
14974
14981
|
],
|
|
14982
|
+
ricochetDeg: 15,
|
|
14975
14983
|
hitDebris: "chips",
|
|
14976
14984
|
breakDebris: "dust",
|
|
14977
14985
|
visual: { innerColor: 9407364 },
|
|
@@ -15400,6 +15408,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
15400
15408
|
0.03,
|
|
15401
15409
|
0.15
|
|
15402
15410
|
],
|
|
15411
|
+
ricochetDeg: 8,
|
|
15403
15412
|
hitDebris: "chips",
|
|
15404
15413
|
breakDebris: "dust",
|
|
15405
15414
|
thermal: {
|
|
@@ -15499,6 +15508,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
15499
15508
|
0.02,
|
|
15500
15509
|
0.08
|
|
15501
15510
|
],
|
|
15511
|
+
ricochetDeg: 8,
|
|
15502
15512
|
hitDebris: "chips",
|
|
15503
15513
|
breakDebris: "dust",
|
|
15504
15514
|
thermal: {
|
|
@@ -15593,6 +15603,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
15593
15603
|
0.05,
|
|
15594
15604
|
0.15
|
|
15595
15605
|
],
|
|
15606
|
+
ricochetDeg: 15,
|
|
15596
15607
|
hitDebris: "chips",
|
|
15597
15608
|
breakDebris: "chips",
|
|
15598
15609
|
thermal: {
|
|
@@ -15618,6 +15629,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
15618
15629
|
0.04,
|
|
15619
15630
|
0.12
|
|
15620
15631
|
],
|
|
15632
|
+
ricochetDeg: 12,
|
|
15621
15633
|
hitDebris: "chips",
|
|
15622
15634
|
breakDebris: "chips",
|
|
15623
15635
|
thermal: {
|
|
@@ -21108,7 +21120,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
21108
21120
|
}
|
|
21109
21121
|
var towerLocales = { en: { labels: en_default.labels }, "pt-BR": { labels: pt_BR_default.labels } };
|
|
21110
21122
|
|
|
21111
|
-
// ../game-floorplan-three/dist/chunk-
|
|
21123
|
+
// ../game-floorplan-three/dist/chunk-Y3Y7NYOL.js
|
|
21124
|
+
var __defProp2 = Object.defineProperty;
|
|
21125
|
+
var __defNormalProp = (obj, key2, value) => key2 in obj ? __defProp2(obj, key2, { enumerable: true, configurable: true, writable: true, value }) : obj[key2] = value;
|
|
21126
|
+
var __publicField = (obj, key2, value) => __defNormalProp(obj, typeof key2 !== "symbol" ? key2 + "" : key2, value);
|
|
21112
21127
|
var en2 = {
|
|
21113
21128
|
"prompt.open": "E: open {what}",
|
|
21114
21129
|
"prompt.close": "E: close {what}",
|
|
@@ -21192,6 +21207,20 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
21192
21207
|
const WITH_MAP = { roughcast: 1, block: 1 };
|
|
21193
21208
|
class Accumulator {
|
|
21194
21209
|
constructor() {
|
|
21210
|
+
__publicField(this, "cv");
|
|
21211
|
+
__publicField(this, "ci");
|
|
21212
|
+
__publicField(this, "p");
|
|
21213
|
+
__publicField(this, "n");
|
|
21214
|
+
__publicField(this, "c");
|
|
21215
|
+
__publicField(this, "u");
|
|
21216
|
+
__publicField(this, "i");
|
|
21217
|
+
__publicField(this, "nv");
|
|
21218
|
+
__publicField(this, "ni");
|
|
21219
|
+
__publicField(this, "lim");
|
|
21220
|
+
__publicField(this, "cur");
|
|
21221
|
+
__publicField(this, "piece0");
|
|
21222
|
+
__publicField(this, "mat", "");
|
|
21223
|
+
__publicField(this, "group", "");
|
|
21195
21224
|
this.cv = 2048;
|
|
21196
21225
|
this.ci = 3072;
|
|
21197
21226
|
this.p = new Float32Array(this.cv * 3);
|
|
@@ -21254,7 +21283,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
21254
21283
|
g.position.copy(u.pose0.p);
|
|
21255
21284
|
g.quaternion.copy(u.pose0.q);
|
|
21256
21285
|
g.scale.copy(u.pose0.s);
|
|
21257
|
-
const
|
|
21286
|
+
const [ax, ay, az] = a.axis || [0, 1, 0];
|
|
21287
|
+
const e = new THREE.Vector3(ax, ay, az);
|
|
21258
21288
|
if (a.type === "swing" || a.type === "toggle") g.rotateOnAxis(e, (a.angle || 0) * t);
|
|
21259
21289
|
else if (a.type === "slide") g.translateOnAxis(e, (a.dist || 0) * t);
|
|
21260
21290
|
else if (a.type === "scale") {
|
|
@@ -21349,7 +21379,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
21349
21379
|
}
|
|
21350
21380
|
if (uvr) {
|
|
21351
21381
|
let gu = G.u[k * 2], gv = G.u[k * 2 + 1];
|
|
21352
|
-
for (let r = uvr.rot | 0; r > 0; r--) {
|
|
21382
|
+
for (let r = (uvr.rot ?? 0) | 0; r > 0; r--) {
|
|
21353
21383
|
const t = gu;
|
|
21354
21384
|
gu = gv;
|
|
21355
21385
|
gv = 1 - t;
|
|
@@ -21447,14 +21477,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
21447
21477
|
A.nv += n;
|
|
21448
21478
|
}
|
|
21449
21479
|
let bxImpl = bxBase;
|
|
21450
|
-
|
|
21451
|
-
|
|
21452
|
-
|
|
21453
|
-
K.getBx = () => bxImpl;
|
|
21454
|
-
K.setBx = (f) => {
|
|
21480
|
+
const bx = (...a) => bxImpl(...a);
|
|
21481
|
+
const getBx = () => bxImpl;
|
|
21482
|
+
const setBx = (f) => {
|
|
21455
21483
|
bxImpl = f;
|
|
21456
21484
|
};
|
|
21457
|
-
|
|
21485
|
+
const defined = { GEO, UV_SCALE, WITH_MAP, Accumulator, cursor, PARTS, MIRRORS, part, applyPart, _Y, _qa, _qb, pieceRecord, structurePiece, accFor, _q, _e, _col, rgbOf, put, boxC, bx, getBx, setBx, cylBase, polyFace };
|
|
21486
|
+
Object.assign(K, defined);
|
|
21458
21487
|
}
|
|
21459
21488
|
function installKernelNoise(K, _shared) {
|
|
21460
21489
|
const _h2 = (x, z) => {
|
|
@@ -21470,15 +21499,18 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
21470
21499
|
const n = 0.5 * vnoise(x / 5.5, z / 5.5) + 0.32 * vnoise(x / 1.9 + 31, z / 1.9) + 0.18 * vnoise(x / 0.8 + 7, z / 0.8), m = vnoise(x / 9 + 100, z / 9 + 50) - 0.5, f = 0.76 + 0.5 * n;
|
|
21471
21500
|
return type === "dirt" ? [f * (1 + 0.14 * m), f * (1 + 0.03 * m), f * (1 - 0.18 * m)] : [f * (1 + 0.1 * m), f * (1 + 0.05 * m), f * (1 - 0.1 * m)];
|
|
21472
21501
|
}
|
|
21473
|
-
|
|
21502
|
+
const defined = { _h2, vnoise, macroGround };
|
|
21503
|
+
Object.assign(K, defined);
|
|
21474
21504
|
}
|
|
21475
21505
|
function installMaterialsTextures(K, _shared) {
|
|
21476
21506
|
const { DOC, THREE, cfg } = K;
|
|
21477
21507
|
function texture(n, f, rep = true, rx = 1, ry = 1) {
|
|
21508
|
+
if (!DOC) throw new Error("game-floorplan-three: the procedural textures need a document (options.document)");
|
|
21478
21509
|
const c = DOC.createElement("canvas");
|
|
21479
21510
|
c.width = n;
|
|
21480
21511
|
c.height = n;
|
|
21481
21512
|
const g = c.getContext("2d");
|
|
21513
|
+
if (!g) throw new Error("game-floorplan-three: no 2d canvas context");
|
|
21482
21514
|
f(g, n);
|
|
21483
21515
|
const t = new THREE.CanvasTexture(c);
|
|
21484
21516
|
t.colorSpace = THREE.SRGBColorSpace;
|
|
@@ -21597,7 +21629,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
21597
21629
|
const TEX = {};
|
|
21598
21630
|
for (const k of Object.keys(TEXGEN)) TEX[k] = cfg.textures && cfg.textures[k] || TEXGEN[k]();
|
|
21599
21631
|
const ATLAS = {};
|
|
21600
|
-
|
|
21632
|
+
const defined = { texture, rngTexture, TEXGEN, TEX, ATLAS };
|
|
21633
|
+
Object.assign(K, defined);
|
|
21634
|
+
}
|
|
21635
|
+
function context2d(c) {
|
|
21636
|
+
const g = c.getContext("2d");
|
|
21637
|
+
if (!g) throw new Error("game-floorplan-three: no 2d canvas context");
|
|
21638
|
+
return g;
|
|
21601
21639
|
}
|
|
21602
21640
|
function installMaterialsMaterials(K, _shared) {
|
|
21603
21641
|
const { THREE, cfg, ATLAS, TEX, rngTexture } = K;
|
|
@@ -21610,7 +21648,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
21610
21648
|
return t;
|
|
21611
21649
|
};
|
|
21612
21650
|
if (!(cfg.atlas && cfg.atlas.floorKind)) {
|
|
21613
|
-
const pc = props.atlas("floor").canvas, g = pc
|
|
21651
|
+
const pc = props.atlas("floor").canvas, g = context2d(pc);
|
|
21614
21652
|
for (const c of [0, 1]) {
|
|
21615
21653
|
g.save();
|
|
21616
21654
|
g.globalCompositeOperation = "screen";
|
|
@@ -21625,7 +21663,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
21625
21663
|
g.restore();
|
|
21626
21664
|
}
|
|
21627
21665
|
if (!(cfg.atlas && cfg.atlas.floorKind)) {
|
|
21628
|
-
const pc = props.atlas("floor").canvas, g = pc
|
|
21666
|
+
const pc = props.atlas("floor").canvas, g = context2d(pc);
|
|
21629
21667
|
g.save();
|
|
21630
21668
|
g.fillStyle = "rgba(128,92,62,0.52)";
|
|
21631
21669
|
g.fillRect(256, 256, 256, 256);
|
|
@@ -21722,7 +21760,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
21722
21760
|
}
|
|
21723
21761
|
const ORDER = { glass: 3, water: 2, screen: 3, building: 4 };
|
|
21724
21762
|
const NO_SHADOW = /* @__PURE__ */ new Set(["dirt", "glass", "water", "screen", "building", "picture", "floor", "emissive"]);
|
|
21725
|
-
|
|
21763
|
+
const defined = { createMaterials, antiTile, dirtMaterial, CLOTHES_UNIFORMS, clothesMaterial, ORDER, NO_SHADOW };
|
|
21764
|
+
Object.assign(K, defined);
|
|
21726
21765
|
}
|
|
21727
21766
|
function installKernelCloseScene(K, shared2) {
|
|
21728
21767
|
const { THREE, NO_SHADOW, ORDER, PARTS, applyPart, cursor } = K;
|
|
@@ -21731,15 +21770,18 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
21731
21770
|
const assembleVegetation = (...a) => K.assembleVegetation(...a);
|
|
21732
21771
|
function markMesh(m, A) {
|
|
21733
21772
|
const L = A.lim, fx = [];
|
|
21773
|
+
const pieces = shared2.ctx.pieces;
|
|
21734
21774
|
for (let k = 0; k < L.length; k++) {
|
|
21735
|
-
|
|
21736
|
-
|
|
21737
|
-
|
|
21775
|
+
const lim = L[k], pc = lim.pc;
|
|
21776
|
+
if (!pc) continue;
|
|
21777
|
+
const next = L[k + 1];
|
|
21778
|
+
const v1 = next ? next.v : A.nv, i1 = next ? next.i : A.ni;
|
|
21779
|
+
if (v1 > lim.v) fx.push({ id: pc.id, v0: lim.v, v1, i0: lim.i, i1 });
|
|
21738
21780
|
}
|
|
21739
21781
|
if (!fx.length) return;
|
|
21740
21782
|
const u = m.userData, ids = [...new Set(fx.map((f) => f.id))], weight = {};
|
|
21741
21783
|
for (const f of fx) {
|
|
21742
|
-
const mt =
|
|
21784
|
+
const mt = pieces.get(f.id).mat;
|
|
21743
21785
|
weight[mt] = (weight[mt] || 0) + f.v1 - f.v0;
|
|
21744
21786
|
}
|
|
21745
21787
|
u.ranges = fx;
|
|
@@ -21747,7 +21789,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
21747
21789
|
u.destructionMaterial = Object.keys(weight).sort((a, b) => weight[b] - weight[a])[0];
|
|
21748
21790
|
if (ids.length === 1) {
|
|
21749
21791
|
u.destructionPart = ids[0];
|
|
21750
|
-
const pc =
|
|
21792
|
+
const pc = pieces.get(ids[0]);
|
|
21751
21793
|
if (pc.role) u.structuralRole = pc.role;
|
|
21752
21794
|
}
|
|
21753
21795
|
}
|
|
@@ -21798,7 +21840,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
21798
21840
|
assembleVegetation(groups);
|
|
21799
21841
|
return groups;
|
|
21800
21842
|
}
|
|
21801
|
-
|
|
21843
|
+
const defined = { markMesh, closeScene };
|
|
21844
|
+
Object.assign(K, defined);
|
|
21802
21845
|
}
|
|
21803
21846
|
function installHouseHelpers(K, shared2) {
|
|
21804
21847
|
shared2.ctx = {};
|
|
@@ -21834,8 +21877,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
21834
21877
|
for (const h of holes) L = L.flatMap((r) => subRect(r, h));
|
|
21835
21878
|
return L;
|
|
21836
21879
|
}
|
|
21837
|
-
const wallColor = (c) =>
|
|
21838
|
-
|
|
21880
|
+
const wallColor = (c) => {
|
|
21881
|
+
const k = c && c.color ? colorOf(c.color.wall) : null;
|
|
21882
|
+
return k != null ? k : 14999768;
|
|
21883
|
+
};
|
|
21884
|
+
const floorColor = (c) => {
|
|
21885
|
+
const k = c && c.color ? colorOf(c.color.floor) : null;
|
|
21886
|
+
return k != null ? k : 11577496;
|
|
21887
|
+
};
|
|
21839
21888
|
function stairFootprint(m) {
|
|
21840
21889
|
const c = Math.cos(m.ry), s = Math.sin(m.ry), pts = [[-m.w / 2, -m.d / 2], [m.w / 2, -m.d / 2], [m.w / 2, m.d / 2], [-m.w / 2, m.d / 2]].map(([a, b]) => [m.x + a * c + b * s, m.z - a * s + b * c]);
|
|
21841
21890
|
return [Math.min(...pts.map((p) => p[0])), Math.min(...pts.map((p) => p[1])), Math.max(...pts.map((p) => p[0])), Math.max(...pts.map((p) => p[1]))];
|
|
@@ -21846,11 +21895,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
21846
21895
|
const pitch = A[f + 1].y0 - A[f].y0;
|
|
21847
21896
|
return h > pitch && h - pitch <= 0.45 ? pitch : h;
|
|
21848
21897
|
}
|
|
21849
|
-
|
|
21898
|
+
const defined = { OPEN_ROOM_TYPES: OPEN_ROOM_TYPES22, NO_CEILING, OPEN_AREA, EPS: EPS3, Y0, colorOf, rectsOf: rectsOf2, roomAt, subRect, subRects, wallColor, floorColor, stairFootprint, effectiveHeight };
|
|
21899
|
+
Object.assign(K, defined);
|
|
21850
21900
|
}
|
|
21851
21901
|
function installHouseWalls(K, shared2) {
|
|
21852
21902
|
const { EPS: EPS3, Y0, boxC, bx, cursor, effectiveHeight, pieceRecord, structurePiece, wallColor } = K;
|
|
21853
|
-
const sh = (
|
|
21903
|
+
const sh = (...a) => K.sh(...a);
|
|
21854
21904
|
function wallBox(alongU, L, a, b, ya, yb, th, cL, cH, mL, mH) {
|
|
21855
21905
|
if (yb - ya < 1e-4 || b - a < 1e-4) return;
|
|
21856
21906
|
if (alongU) {
|
|
@@ -21896,7 +21946,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
21896
21946
|
const corners = /* @__PURE__ */ new Map();
|
|
21897
21947
|
const looks = /* @__PURE__ */ new Map();
|
|
21898
21948
|
for (const w of R.walls) {
|
|
21899
|
-
const f = w.floor;
|
|
21949
|
+
const f = w.floor, colliders = shared2.ctx.colliders;
|
|
21900
21950
|
cursor.group = "f" + f;
|
|
21901
21951
|
cursor.pc = pieceOf(w);
|
|
21902
21952
|
const y0 = Y0(f), pitch = f + 1 < nA ? Y0(f + 1) - y0 : Infinity, th = w.thickness || 0.15, alongU = w.axis === "u";
|
|
@@ -21908,7 +21958,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
21908
21958
|
const face = sideL.exterior ? sideL : sideH;
|
|
21909
21959
|
looks.set(w.id, { mat: face.mat, color: face.color, top: y0 + hh });
|
|
21910
21960
|
}
|
|
21911
|
-
|
|
21961
|
+
colliders.push({ type: "wall", piece: w.id, f, x0: alongU ? s0 : L - th / 2, z0: alongU ? L - th / 2 : s0, x1: alongU ? s1 : L + th / 2, z1: alongU ? L + th / 2 : s1 });
|
|
21912
21962
|
if (w.type === "railing") {
|
|
21913
21963
|
const c0 = shared2.ctx.colors.metal != null ? shared2.ctx.colors.metal : 9080466;
|
|
21914
21964
|
const sx = alongU ? 1 : 0, sz = alongU ? 0 : 1, len = s1 - s0, n = Math.max(1, Math.round(len / 1.4));
|
|
@@ -21974,7 +22024,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
21974
22024
|
}
|
|
21975
22025
|
cursor.pc = null;
|
|
21976
22026
|
}
|
|
21977
|
-
|
|
22027
|
+
const defined = { wallBox, sideOf, pieceOf, nearestWall, walls, wallPillars };
|
|
22028
|
+
Object.assign(K, defined);
|
|
21978
22029
|
}
|
|
21979
22030
|
function installHouseDoors(K, shared2) {
|
|
21980
22031
|
const seedKey = (id) => K.seedKey(id);
|
|
@@ -21991,7 +22042,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
21991
22042
|
}
|
|
21992
22043
|
shared2.doorState = /* @__PURE__ */ new Map();
|
|
21993
22044
|
function doors() {
|
|
21994
|
-
shared2.ctx.leaves = [];
|
|
22045
|
+
const leaves = shared2.ctx.leaves = [], doorState = shared2.doorState, colliders = shared2.ctx.colliders;
|
|
21995
22046
|
const R = shared2.ctx.r, cut = shared2.ctx.cut, C = shared2.ctx.colors, wood = C.wood != null ? C.wood : 8016948, frame2 = sh(wood, 0.55);
|
|
21996
22047
|
for (const p of R.doors) {
|
|
21997
22048
|
const f = p.floor;
|
|
@@ -22022,21 +22073,21 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
22022
22073
|
}
|
|
22023
22074
|
const leaf = (u0, u1, y_0, y_1, tt, color2, mat = "wood") => alongU ? bx(mat, u0, y0 + y_0, L - tt / 2, u1, y0 + y_1, L + tt / 2, color2) : bx(mat, L - tt / 2, y0 + y_0, u0, L + tt / 2, y0 + y_1, u1, color2);
|
|
22024
22075
|
const extC = wood;
|
|
22025
|
-
const open0 = p.blocked ? false :
|
|
22026
|
-
|
|
22076
|
+
const open0 = p.blocked ? false : doorState.has(p.id) ? doorState.get(p.id) === true : !!p.open;
|
|
22077
|
+
doorState.set(p.id, open0);
|
|
22027
22078
|
const dc = alongU ? [p.at, L] : [L, p.at];
|
|
22028
|
-
const fo = { id: p.id, floor: f, type: p.model === "steel" ? "steel" : "swing", open: open0, t: open0 ? 1 : 0, blockedFlag: !!p.blocked, locked: R.state === "fortified" && !!p.exterior, handleNames: [], hT: 0, cx: dc[0], cz: dc[1], visH, groups: [], col: null };
|
|
22079
|
+
const fo = { id: p.id, floor: f, type: p.model === "steel" ? "steel" : "swing", open: open0, t: open0 ? 1 : 0, blockedFlag: !!p.blocked, locked: R.state === "fortified" && !!p.exterior, handleNames: [], hT: 0, cx: dc[0], cz: dc[1], visH, groups: [], gs: [], col: null };
|
|
22029
22080
|
const colR = { type: "door", f, x0: alongU ? a : L - th / 2, z0: alongU ? L - th / 2 : a, x1: alongU ? b : L + th / 2, z1: alongU ? L + th / 2 : b, off: open0 };
|
|
22030
|
-
|
|
22081
|
+
colliders.push(colR);
|
|
22031
22082
|
fo.col = colR;
|
|
22032
22083
|
const leafBox = (hu, d0, d1, y_0, y_1, tt, color2, mat) => alongU ? bx(mat, d0, y_0, -tt / 2, d1, y_1, tt / 2, color2) : bx(mat, -tt / 2, y_0, d0, tt / 2, y_1, d1, color2);
|
|
22033
|
-
const
|
|
22084
|
+
const newGroup2 = (k, hu, topY) => {
|
|
22034
22085
|
cursor.group = "dyn:" + p.id + ":" + k;
|
|
22035
22086
|
fo.groups.push({ name: cursor.group, pos: alongU ? [hu, topY != null ? y0 + topY : y0, L] : [L, topY != null ? y0 + topY : y0, hu] });
|
|
22036
22087
|
};
|
|
22037
22088
|
if (p.model === "steel") {
|
|
22038
|
-
const light = [14276044, 13223615, 14999766], pal = ((R.seed | 0) + p.id.length * 7) % 4, color2 = pal === 3 ? wood : light[pal], mid = (a + b) / 2;
|
|
22039
|
-
|
|
22089
|
+
const light = [14276044, 13223615, 14999766], pal = ((Number(R.seed) | 0) + p.id.length * 7) % 4, color2 = pal === 3 ? wood : light[pal], mid = (a + b) / 2;
|
|
22090
|
+
newGroup2(0, mid, visH);
|
|
22040
22091
|
const la = a + jw - mid, lb = b - jw - mid, nSec = Math.max(4, Math.round(visH / 0.5)), hs = visH / nSec, grv = sh(color2, 0.55);
|
|
22041
22092
|
leafBox(0, la, lb, -visH, 0, 0.05, color2, "metal");
|
|
22042
22093
|
for (let k = 1; k < nSec; k++) leafBox(0, la, lb, -k * hs - 0.012, -k * hs + 0.012, 0.07, grv, "metal");
|
|
@@ -22051,7 +22102,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
22051
22102
|
for (let k = 0; k < nf; k++) {
|
|
22052
22103
|
const u0 = nf === 2 ? k ? (aa + bb) / 2 : aa : aa, u1 = nf === 2 ? k ? bb : (aa + bb) / 2 : bb, color2 = p.exterior ? extC : wood;
|
|
22053
22104
|
const hingeAt = nf === 2 ? k ? u1 : u0 : p.hinge === "end" ? u1 : u0, dir = hingeAt === u0 ? 1 : -1, len = u1 - u0;
|
|
22054
|
-
|
|
22105
|
+
newGroup2(k, hingeAt);
|
|
22055
22106
|
const d0 = dir > 0 ? 5e-3 : -len + 5e-3, d1 = dir > 0 ? len - 5e-3 : -5e-3;
|
|
22056
22107
|
leafBox(hingeAt, d0, d1, 0, visH, 0.04, color2, PMAT);
|
|
22057
22108
|
{
|
|
@@ -22087,7 +22138,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
22087
22138
|
fo.rot = Math.atan2(n[0] * A[1] - n[1] * A[0], A[0] * n[0] + A[1] * n[1]);
|
|
22088
22139
|
}
|
|
22089
22140
|
}
|
|
22090
|
-
|
|
22141
|
+
leaves.push(fo);
|
|
22091
22142
|
cursor.group = "f" + f;
|
|
22092
22143
|
if (p.blocked) {
|
|
22093
22144
|
part("window_boards", [0, 0, 0], () => {
|
|
@@ -22115,11 +22166,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
22115
22166
|
}
|
|
22116
22167
|
}
|
|
22117
22168
|
}, { id: "boards:" + p.id }, "f" + f);
|
|
22118
|
-
|
|
22169
|
+
colliders.push({ type: "board", f, x0: alongU ? a : L - th / 2, z0: alongU ? L - th / 2 : a, x1: alongU ? b : L + th / 2, z1: alongU ? L + th / 2 : b });
|
|
22119
22170
|
}
|
|
22120
22171
|
}
|
|
22121
22172
|
}
|
|
22122
|
-
|
|
22173
|
+
const defined = { doorLineSides, doors };
|
|
22174
|
+
Object.assign(K, defined);
|
|
22123
22175
|
}
|
|
22124
22176
|
function installHouseWindows(K, shared2) {
|
|
22125
22177
|
const { EPS: EPS3, Y0, boxC, bx, cursor, pieceRecord, roomAt } = K;
|
|
@@ -22177,7 +22229,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
22177
22229
|
}
|
|
22178
22230
|
}
|
|
22179
22231
|
}
|
|
22180
|
-
|
|
22232
|
+
const defined = { FRAME_COLORS, SILL_COLORS, windows };
|
|
22233
|
+
Object.assign(K, defined);
|
|
22181
22234
|
}
|
|
22182
22235
|
function installHouseFloors(K, shared2) {
|
|
22183
22236
|
const { rectsOf: rectsOf2, EPS: EPS3, OPEN_AREA, Y0, bx, cursor, floorColor, stairFootprint, structurePiece, subRects } = K;
|
|
@@ -22185,7 +22238,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
22185
22238
|
if (shared2.ctx._flights && shared2.ctx._flights.r === shared2.ctx.r) return shared2.ctx._flights.l;
|
|
22186
22239
|
const R = shared2.ctx.r, mp = /* @__PURE__ */ new Map();
|
|
22187
22240
|
for (const m of R.items) {
|
|
22188
|
-
if (m.type !== "stairs" || !m.link) continue;
|
|
22241
|
+
if (m.type !== "stairs" || !m.link || typeof m.link !== "object") continue;
|
|
22189
22242
|
const k = [m.link.from, m.link.to, m.x.toFixed(2), m.z.toFixed(2), (m.ry || 0).toFixed(2)].join("|");
|
|
22190
22243
|
if (!mp.has(k)) mp.set(k, { m, from: m.link.from, to: m.link.to, rect: stairFootprint(m) });
|
|
22191
22244
|
}
|
|
@@ -22204,7 +22257,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
22204
22257
|
}
|
|
22205
22258
|
const panelRects = (p) => p.footprint && p.footprint.length ? p.footprint : [p.aabb];
|
|
22206
22259
|
function tilesOf(parent, rc) {
|
|
22207
|
-
const ps = parent
|
|
22260
|
+
const ps = parent ? shared2.ctx.panelsOf && shared2.ctx.panelsOf.get(parent) : void 0;
|
|
22208
22261
|
if (!ps) return [[parent ? structurePiece(parent) : null, rc]];
|
|
22209
22262
|
const out = [], taken = [];
|
|
22210
22263
|
for (const p of ps) for (const q of panelRects(p)) {
|
|
@@ -22266,13 +22319,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
22266
22319
|
const { rectsOf: rectsOf2, Y0, boxC, bx, cursor, flights, stairFootprint, structurePiece } = K;
|
|
22267
22320
|
const sh = (...a) => K.sh(...a);
|
|
22268
22321
|
function buildStairs() {
|
|
22269
|
-
const R = shared2.ctx.r;
|
|
22270
|
-
shared2.ctx.stairs = [];
|
|
22322
|
+
const R = shared2.ctx.r, stairs = shared2.ctx.stairs = [];
|
|
22271
22323
|
for (const vo of flights()) {
|
|
22272
22324
|
const m = vo.m, f = vo.from, Dr = m.d - (vo.LP || 0);
|
|
22273
22325
|
cursor.group = "f" + f;
|
|
22274
22326
|
cursor.pc = structurePiece("stairs_" + vo.from + "_" + vo.to);
|
|
22275
|
-
const y0 = Y0(f), H = Y0(
|
|
22327
|
+
const y0 = Y0(f), H = Y0(vo.to) - y0, n = Math.max(8, Math.round(H / 0.18)), c = Math.cos(m.ry), s = Math.sin(m.ry);
|
|
22276
22328
|
const wood = shared2.ctx.colors.wood != null ? shared2.ctx.colors.wood : 9071176, under = sh(wood, 0.7);
|
|
22277
22329
|
const P = (lx, lz) => [m.x + lx * c + lz * s, m.z - lx * s + lz * c];
|
|
22278
22330
|
const boxL = (mat, lx, y, lz, w, h, d, color2, rx = 0) => {
|
|
@@ -22295,7 +22347,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
22295
22347
|
}
|
|
22296
22348
|
}
|
|
22297
22349
|
cursor.pc = null;
|
|
22298
|
-
|
|
22350
|
+
stairs.push({ m, f, to: vo.to, y0, H, rect: stairFootprint(m), landingPoint: (vo.LP || 0) / m.d });
|
|
22299
22351
|
}
|
|
22300
22352
|
}
|
|
22301
22353
|
function elevator() {
|
|
@@ -22312,7 +22364,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
22312
22364
|
}
|
|
22313
22365
|
}
|
|
22314
22366
|
}
|
|
22315
|
-
|
|
22367
|
+
const defined = { buildStairs, elevator };
|
|
22368
|
+
Object.assign(K, defined);
|
|
22316
22369
|
}
|
|
22317
22370
|
function installLightsFixtures(K, shared2) {
|
|
22318
22371
|
const seedKey = (id) => K.seedKey(id);
|
|
@@ -22350,14 +22403,15 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
22350
22403
|
c: (mat, x, y, z, r, h, color2, seg2) => api.cylinder(M, mat, x, y0 + y, z, r, h, color2, 0, 0, seg2),
|
|
22351
22404
|
e: (mat, x, y, z, r, h, color2) => api.cylinder(M, mat, x, y0 + y - h / 2, z, r, h, color2, 0, 0, "sphere"),
|
|
22352
22405
|
t(mat, p, q, r, color2, seg2) {
|
|
22406
|
+
const tc = color2 ?? NaN;
|
|
22353
22407
|
const dx = q[0] - p[0], dy = q[1] - p[1], dz = q[2] - p[2], L = Math.hypot(dx, dy, dz);
|
|
22354
22408
|
if (L < 1e-5) return;
|
|
22355
22409
|
const nx = dx / L, ny = dy / L, nz = dz / L;
|
|
22356
22410
|
if (Math.abs(nx) < 1e-4 && Math.abs(nz) < 1e-4) {
|
|
22357
|
-
api.cylinder(M, mat, p[0], y0 + Math.min(p[1], q[1]), p[2], r, L,
|
|
22411
|
+
api.cylinder(M, mat, p[0], y0 + Math.min(p[1], q[1]), p[2], r, L, tc, 0, 0, seg2);
|
|
22358
22412
|
return;
|
|
22359
22413
|
}
|
|
22360
|
-
api.cylinder(M, mat, (p[0] + q[0]) / 2, y0 + (p[1] + q[1]) / 2, (p[2] + q[2]) / 2, r, L,
|
|
22414
|
+
api.cylinder(M, mat, (p[0] + q[0]) / 2, y0 + (p[1] + q[1]) / 2, (p[2] + q[2]) / 2, r, L, tc, Math.atan2(nz, ny), -Math.asin(nx), seg2);
|
|
22361
22415
|
},
|
|
22362
22416
|
polyFace: (mat, pts, color2, hint) => polyFace(mat, pts.map((p) => W(p[0], p[1], p[2])), color2, hint && [hint[0] * c + hint[2] * s, hint[1], -hint[0] * s + hint[2] * c]),
|
|
22363
22417
|
part(type, lx, ly, lz, fn, meta) {
|
|
@@ -22536,7 +22590,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
22536
22590
|
K2.part("light_switch", x, 0, 0.011, () => K2.b("plain", x, -0.018, 0.0125, two ? 0.03 : 0.036, 0.034, 8e-3, 16513782, 0, -0.12), { id: "sw_" + M.seed + "_" + i, room: M.room, target: M.target || M.room, opens: { type: "toggle", axis: [1, 0, 0], angle: 0.24 }, on: !!M.on, t0: M.on ? 1 : 0 });
|
|
22537
22591
|
}
|
|
22538
22592
|
}
|
|
22539
|
-
|
|
22593
|
+
const defined = { hashString: hashString2, rngString, SEED, STYLE, kit2, arcPoints, TEMP_WARM, TEMP_NEUTRAL, TEMP_COOL, colorTemperature, lightStyle, ceilingLamp, tableLamp, floorLamp, sconce, outdoorLamp, lightSwitch };
|
|
22594
|
+
Object.assign(K, defined);
|
|
22540
22595
|
}
|
|
22541
22596
|
function installLightsDecor(K, shared2) {
|
|
22542
22597
|
const { EPS: EPS3, OPEN_AREA, SEED, Y0, cursor, rngString, roomAt, stairFootprint } = K;
|
|
@@ -22601,7 +22656,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
22601
22656
|
void sd;
|
|
22602
22657
|
}
|
|
22603
22658
|
}
|
|
22604
|
-
|
|
22659
|
+
const defined = { decorLights };
|
|
22660
|
+
Object.assign(K, defined);
|
|
22605
22661
|
}
|
|
22606
22662
|
function installLotTerrain(K, shared2) {
|
|
22607
22663
|
const { rectsOf: rectsOf2, MIRRORS, PARTS, bx, cursor } = K;
|
|
@@ -22652,7 +22708,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
22652
22708
|
if (x < b) out.push([x, b]);
|
|
22653
22709
|
return out.filter((q) => q[1] - q[0] > 0.3);
|
|
22654
22710
|
}
|
|
22655
|
-
|
|
22711
|
+
const defined = { terrain, freeSpans };
|
|
22712
|
+
Object.assign(K, defined);
|
|
22656
22713
|
}
|
|
22657
22714
|
function installLotPerimeter(K, shared2) {
|
|
22658
22715
|
const { EPS: EPS3, boxC, bx, colorOf, cursor, freeSpans, pieceRecord } = K;
|
|
@@ -22670,7 +22727,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
22670
22727
|
for (const s of lt.perimeter) {
|
|
22671
22728
|
const alongU = Math.abs(s.v1 - s.v0) < EPS3, L = alongU ? s.v0 : s.u0, a = Math.min(alongU ? s.u0 : s.v0, alongU ? s.u1 : s.v1), b = Math.max(alongU ? s.u0 : s.v0, alongU ? s.u1 : s.v1);
|
|
22672
22729
|
cursor.pc = pieceRecord("lot_wall:" + s.id, s.type === "wall" ? "brick" : s.type === "fence" ? "wood_soft" : "steel", null, { tags: ["wall"] });
|
|
22673
|
-
const th = s.thickness || 0.15, h = s.height, color2 = colorOf(s.color)
|
|
22730
|
+
const th = s.thickness || 0.15, h = s.height, color2 = colorOf(s.color) ?? (C.wall || 12104874), len = b - a;
|
|
22674
22731
|
const B = (mat, u0, y0, u1, y1, t, c, off = 0) => alongU ? bx(mat, u0, y0, L + off - t / 2, u1, y1, L + off + t / 2, c) : bx(mat, L + off - t / 2, y0, u0, L + off + t / 2, y1, u1, c);
|
|
22675
22732
|
const col = { type: "lot_wall", f: -1, x0: alongU ? a : L - th / 2, z0: alongU ? L - th / 2 : a, x1: alongU ? b : L + th / 2, z1: alongU ? L + th / 2 : b };
|
|
22676
22733
|
shared2.ctx.colliders.push(col);
|
|
@@ -22744,7 +22801,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
22744
22801
|
}
|
|
22745
22802
|
}
|
|
22746
22803
|
}
|
|
22747
|
-
|
|
22804
|
+
const defined = { perimeter, paths };
|
|
22805
|
+
Object.assign(K, defined);
|
|
22748
22806
|
}
|
|
22749
22807
|
function installLotGates(K, shared2) {
|
|
22750
22808
|
const { bx, colorOf, cursor, cylBase } = K;
|
|
@@ -22758,7 +22816,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
22758
22816
|
cursor.group = "lot";
|
|
22759
22817
|
const structure = R.style, auto = structure !== "budget", wall = colorOf("wall") || 12104874, cu = (lt.rect[0] + lt.rect[2]) / 2, cz = (lt.rect[1] + lt.rect[3]) / 2;
|
|
22760
22818
|
for (const g of lt.gates) {
|
|
22761
|
-
const gc = colorOf(g.color)
|
|
22819
|
+
const gc = colorOf(g.color) ?? (C.gate != null ? C.gate : 2763310), a = g.u - g.width / 2, b = g.u + g.width / 2, v = g.v, h = g.height, t = 0.05, ped = g.model === "pedestrian", tilt = g.model === "tilting";
|
|
22762
22820
|
const sd = cz - v >= 0 ? 1 : -1;
|
|
22763
22821
|
const pil = (x0, x1, high) => {
|
|
22764
22822
|
bx("plaster", x0, 0, v - 0.13, x1, high, v + 0.13, wall);
|
|
@@ -22830,7 +22888,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
22830
22888
|
if (!g.open || ped) shared2.ctx.colliders.push({ type: "gate", f: -1, x0: a, z0: v - 0.1, x1: b, z1: v + 0.1 });
|
|
22831
22889
|
}
|
|
22832
22890
|
}
|
|
22833
|
-
|
|
22891
|
+
const defined = { slideDirection, gates };
|
|
22892
|
+
Object.assign(K, defined);
|
|
22834
22893
|
}
|
|
22835
22894
|
function installRoofRoofs(K, shared2) {
|
|
22836
22895
|
const { rectsOf: rectsOf2, EPS: EPS3, OPEN_AREA, Y0, bx, cursor } = K;
|
|
@@ -22842,13 +22901,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
22842
22901
|
function roofs() {
|
|
22843
22902
|
const R = shared2.ctx.r, F = R.facade, C = shared2.ctx.colors, nA = R.floors.length, type = F.roof;
|
|
22844
22903
|
cursor.group = "roof";
|
|
22845
|
-
shared2.ctx.roofRects = [];
|
|
22846
|
-
shared2.ctx.gutter = gutterConfig();
|
|
22847
|
-
|
|
22848
|
-
|
|
22849
|
-
|
|
22904
|
+
const roofRects = shared2.ctx.roofRects = [];
|
|
22905
|
+
const G = shared2.ctx.gutter = gutterConfig();
|
|
22906
|
+
G.ncond = 0;
|
|
22907
|
+
G.nbuz = 0;
|
|
22908
|
+
G.bz = /* @__PURE__ */ new Set();
|
|
22850
22909
|
shared2.ctx.gutterInfo = { gutters: [], downpipes: [], drains: [] };
|
|
22851
|
-
const roofColor = C.roof != null ? C.roof : 11031610, gable = (R.seed | 0) % 2 === 0;
|
|
22910
|
+
const roofColor = C.roof != null ? C.roof : 11031610, gable = (Number(R.seed) | 0) % 2 === 0;
|
|
22852
22911
|
for (let f = 0; f < nA; f++) {
|
|
22853
22912
|
const rs = R.rooms.filter((c) => c.floor === f && c.type !== "void" && !c.outbuilding && !OPEN_AREA(c)).flatMap(rectsOf2), up = R.rooms.filter((c) => c.floor === f + 1 && c.type !== "void").flatMap(rectsOf2);
|
|
22854
22913
|
if (!rs.length) continue;
|
|
@@ -22870,7 +22929,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
22870
22929
|
return Y0(f) + Math.max(...cs.map((c) => c.ceiling)) + 0.2;
|
|
22871
22930
|
};
|
|
22872
22931
|
if (type === "slab") {
|
|
22873
|
-
for (let j = 0; j < nz; j++) for (let i = 0; i < nx; i++) if (O(j, i))
|
|
22932
|
+
for (let j = 0; j < nz; j++) for (let i = 0; i < nx; i++) if (O(j, i)) roofRects.push({ f, r: [xs[i], zs[j], xs[i + 1], zs[j + 1]], slab: true, yb: pe(xs[i], zs[j], xs[i + 1], zs[j + 1]) + 0.03 });
|
|
22874
22933
|
slabs(f, xs, zs, O, U, nx, nz, full, pe, C);
|
|
22875
22934
|
cursor.pc = null;
|
|
22876
22935
|
continue;
|
|
@@ -22893,16 +22952,16 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
22893
22952
|
if (U(q.j0 - 1, i)) touchesU[1] = 1;
|
|
22894
22953
|
if (U(q.j1 + 1, i)) touchesU[3] = 1;
|
|
22895
22954
|
}
|
|
22896
|
-
|
|
22955
|
+
roofRects.push({ f, r: [x0, z0, x1, z1], touchesU });
|
|
22897
22956
|
const ybq = pe(x0, z0, x1, z1);
|
|
22898
22957
|
roofRect(type, x0, z0, x1, z1, ybq, roofColor, gable && single, F, touchesU);
|
|
22899
22958
|
cursor.pc = null;
|
|
22900
|
-
if (
|
|
22959
|
+
if (G.on) gutter(type, f, x0, z0, x1, z1, ybq, touchesU);
|
|
22901
22960
|
}
|
|
22902
22961
|
}
|
|
22903
22962
|
for (const e of shared2.ctx.outbuildingList || []) {
|
|
22904
22963
|
const [x0, z0, x1, z1] = e.aabb, yb = Y0(0) + (e.ceiling || 2.6) + 0.2;
|
|
22905
|
-
|
|
22964
|
+
roofRects.push({ f: 0, r: [x0, z0, x1, z1], outbuilding: e.id });
|
|
22906
22965
|
if (type === "slab") {
|
|
22907
22966
|
const c = C.facade != null ? C.facade : 14209216;
|
|
22908
22967
|
bx("plaster", x0 - 0.08, yb, z0 - 0.08, x1 + 0.08, yb + 0.03, z1 + 0.08, sh(C.ceiling != null ? C.ceiling : 12104876, 0.85));
|
|
@@ -22913,11 +22972,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
22913
22972
|
roofRect(type, x0, z0, x1, z1, yb, roofColor, true, F, [0, 0, 0, 0]);
|
|
22914
22973
|
cursor.pc = null;
|
|
22915
22974
|
shared2.ctx.noPiece = false;
|
|
22916
|
-
if (
|
|
22975
|
+
if (G.on) gutter(type, 0, x0, z0, x1, z1, yb, [0, 0, 0, 0]);
|
|
22917
22976
|
}
|
|
22918
22977
|
}
|
|
22919
|
-
|
|
22978
|
+
const defined = { roofs };
|
|
22979
|
+
Object.assign(K, defined);
|
|
22920
22980
|
}
|
|
22981
|
+
var paletteMeta = (colors) => colors.meta;
|
|
22921
22982
|
function installRoofGutters(K, shared2) {
|
|
22922
22983
|
const { boxC, bx, cursor, roomAt } = K;
|
|
22923
22984
|
const sh = (...a) => K.sh(...a);
|
|
@@ -22934,7 +22995,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
22934
22995
|
const draw = rnd() < p, light = rnd() < 0.6;
|
|
22935
22996
|
void draw;
|
|
22936
22997
|
const on = true;
|
|
22937
|
-
return { on, rnd, color: high ? 3816770 : light ? 15527921 : 10857392, bad: (shared2.ctx.colors
|
|
22998
|
+
return { on, rnd, color: high ? 3816770 : light ? 15527921 : 10857392, bad: paletteMeta(shared2.ctx.colors)?.state === "abandoned" || R.state === "abandoned", fallback: false };
|
|
22938
22999
|
}
|
|
22939
23000
|
function gutter(type, f, X0, Z0, X1, Z1, yb, touchesU) {
|
|
22940
23001
|
const G = shared2.ctx.gutter, o = type === "fiber_cement" ? 0.3 : 0.45, x0 = X0 - (touchesU[0] ? 0 : o), x1 = X1 + (touchesU[2] ? 0 : o), z0 = Z0 - (touchesU[1] ? 0 : o), z1 = Z1 + (touchesU[3] ? 0 : o), c = G.color, y = yb - 0.05;
|
|
@@ -22976,7 +23037,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
22976
23037
|
const px = cx + sx * 0.06, pz = cz + sz * 0.06;
|
|
22977
23038
|
if (!freeAt(px, pz, sx, sz)) return false;
|
|
22978
23039
|
const floats = G.bad && G.ncond === 1, yt = yb - 0.1, ybx = floats ? 0.7 : 0.04;
|
|
22979
|
-
G.ncond
|
|
23040
|
+
G.ncond = (G.ncond ?? 0) + 1;
|
|
22980
23041
|
if (run2 >= 2) boxC("plain", (sides[run2][4] + px) / 2, yt, pz, Math.abs(sides[run2][4] - px), 0.07, 0.07, c);
|
|
22981
23042
|
else boxC("plain", px, yt, (sides[run2][4] + pz) / 2, 0.07, 0.07, Math.abs(sides[run2][4] - pz), c);
|
|
22982
23043
|
boxC("plain", px, (ybx + yt) / 2, pz, 0.08, yt - ybx, 0.08, c);
|
|
@@ -23010,7 +23071,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
23010
23071
|
function drain(x, z, px, pz, c) {
|
|
23011
23072
|
const g0 = cursor.group;
|
|
23012
23073
|
cursor.group = "f0";
|
|
23013
|
-
if (px != null) boxC("plain", (px + x) / 2, 0.075, (pz + z) / 2, Math.abs(x - px) + 0.05, 0.05, Math.abs(z - pz) + 0.05, sh(c, 0.85));
|
|
23074
|
+
if (px != null && pz != null && c != null) boxC("plain", (px + x) / 2, 0.075, (pz + z) / 2, Math.abs(x - px) + 0.05, 0.05, Math.abs(z - pz) + 0.05, sh(c, 0.85));
|
|
23014
23075
|
const t = 0.045;
|
|
23015
23076
|
bx("plain", x - 0.12, 0, z - 0.12, x + 0.12, t - 6e-3, z + 0.12, 12170668);
|
|
23016
23077
|
bx("metal", x - 0.11, t, z - 0.11, x + 0.11, t + 0.012, z + 0.11, 5922145);
|
|
@@ -23021,7 +23082,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
23021
23082
|
bx("metal", x - 0.085, t + 0.012, z - 6e-3, x + 0.085, t + 0.02, z + 6e-3, 9080466);
|
|
23022
23083
|
cursor.group = g0;
|
|
23023
23084
|
}
|
|
23024
|
-
|
|
23085
|
+
const defined = { gutterConfig, gutter, drain };
|
|
23086
|
+
Object.assign(K, defined);
|
|
23025
23087
|
}
|
|
23026
23088
|
function installRoofSlabs(K, shared2) {
|
|
23027
23089
|
const { boxC, bx, cursor, drain, roomAt, structurePiece } = K;
|
|
@@ -23053,15 +23115,16 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
23053
23115
|
side(free(j, i + 1), x1 + o - t, z0 - ez0, x1 + o, z1 + ez1);
|
|
23054
23116
|
side(free(j - 1, i), x0 - ex0, z0 - o, x1 + ex1, z0 - o + t);
|
|
23055
23117
|
side(free(j + 1, i), x0 - ex0, z1 + o - t, x1 + ex1, z1 + o);
|
|
23056
|
-
|
|
23118
|
+
const G = shared2.ctx.gutter;
|
|
23119
|
+
if (G && G.on && G.bz) for (const [ok, dx, dz] of [[free(j - 1, i), 0, -1], [free(j + 1, i), 0, 1], [free(j, i - 1), -1, 0], [free(j, i + 1), 1, 0]]) {
|
|
23057
23120
|
const kd = f + ":" + dx + ":" + dz;
|
|
23058
|
-
if (!ok ||
|
|
23059
|
-
|
|
23060
|
-
|
|
23061
|
-
const mx = (x0 + x1) / 2, mz = (z0 + z1) / 2, ex = dx ? dx < 0 ? x0 - o : x1 + o : mx, ez = dz ? dz < 0 ? z0 - o : z1 + o : mz, cc =
|
|
23121
|
+
if (!ok || G.bz.has(kd)) continue;
|
|
23122
|
+
G.bz.add(kd);
|
|
23123
|
+
G.nbuz = (G.nbuz ?? 0) + 1;
|
|
23124
|
+
const mx = (x0 + x1) / 2, mz = (z0 + z1) / 2, ex = dx ? dx < 0 ? x0 - o : x1 + o : mx, ez = dz ? dz < 0 ? z0 - o : z1 + o : mz, cc = G.color;
|
|
23062
23125
|
boxC("plain", ex + dx * 0.15, yb + 0.1, ez + dz * 0.15, dx ? 0.42 : 0.14, 0.1, dz ? 0.42 : 0.14, cc);
|
|
23063
23126
|
boxC("plain", ex + dx * 0.36, yb + 0.1, ez + dz * 0.36, dx ? 0.04 : 0.18, 0.14, dz ? 0.04 : 0.18, sh(cc, 0.8));
|
|
23064
|
-
if (
|
|
23127
|
+
if (G.bad) boxC("plain", ex + dx * 0.05, yb + 0.5 * 0, ez + dz * 0.05, dx ? 0.06 : 0.3, 0.02, dz ? 0.06 : 0.3, 4868674);
|
|
23065
23128
|
{
|
|
23066
23129
|
const tx = ex + dx * 0.38, tz = ez + dz * 0.38;
|
|
23067
23130
|
let lv = true;
|
|
@@ -23081,7 +23144,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
23081
23144
|
}
|
|
23082
23145
|
}
|
|
23083
23146
|
}
|
|
23084
|
-
|
|
23147
|
+
const defined = { slabs };
|
|
23148
|
+
Object.assign(K, defined);
|
|
23085
23149
|
}
|
|
23086
23150
|
function installRoofTiles(K, shared2) {
|
|
23087
23151
|
const { UV_SCALE, _Y, _h2, _q, accFor, cursor, put, rgbOf, structurePiece } = K;
|
|
@@ -23212,7 +23276,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
23212
23276
|
}
|
|
23213
23277
|
return m ? structurePiece(m.id) : null;
|
|
23214
23278
|
}
|
|
23215
|
-
|
|
23279
|
+
const defined = { R_STYLE, tileRelief, ridge, pieceOfPane };
|
|
23280
|
+
Object.assign(K, defined);
|
|
23216
23281
|
}
|
|
23217
23282
|
function installRoofRect(K, shared2) {
|
|
23218
23283
|
const { R_STYLE, bx, cursor, pieceOfPane, polyFace, ridge, tileRelief } = K;
|
|
@@ -23256,7 +23321,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
23256
23321
|
}
|
|
23257
23322
|
const rm = alongX ? dz / 2 : dx / 2;
|
|
23258
23323
|
{
|
|
23259
|
-
const
|
|
23324
|
+
const roofRects = shared2.ctx.roofRects, rr = roofRects[roofRects.length - 1];
|
|
23260
23325
|
if (rr && !rr.yb) Object.assign(rr, { yb, tp, gable: !!gable, alongX, exterior: [x0, z0, x1, z1], rm });
|
|
23261
23326
|
}
|
|
23262
23327
|
if (gable) {
|
|
@@ -23293,7 +23358,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
23293
23358
|
}
|
|
23294
23359
|
}
|
|
23295
23360
|
}
|
|
23296
|
-
|
|
23361
|
+
const defined = { roofRect };
|
|
23362
|
+
Object.assign(K, defined);
|
|
23297
23363
|
}
|
|
23298
23364
|
function installMirrors(K, shared2) {
|
|
23299
23365
|
const { DOC, THREE, Reflector, MIRRORS, Y0, _Y, roomAt } = K;
|
|
@@ -23302,9 +23368,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
23302
23368
|
function mirrorEnv() {
|
|
23303
23369
|
if (shared2.mirrorEnv) return shared2.mirrorEnv;
|
|
23304
23370
|
const mk = (f) => {
|
|
23371
|
+
if (!DOC) throw new Error("game-floorplan-three: the mirrors need a document (options.document)");
|
|
23305
23372
|
const c = DOC.createElement("canvas");
|
|
23306
23373
|
c.width = c.height = 64;
|
|
23307
23374
|
const g = c.getContext("2d");
|
|
23375
|
+
if (!g) throw new Error("game-floorplan-three: no 2d canvas context");
|
|
23308
23376
|
f(g);
|
|
23309
23377
|
return c;
|
|
23310
23378
|
};
|
|
@@ -23363,7 +23431,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
23363
23431
|
B.N.push(v.x, v.y, v.z);
|
|
23364
23432
|
B.U.push(ua.getX(i), ua.getY(i));
|
|
23365
23433
|
}
|
|
23366
|
-
for (const k of geo.index
|
|
23434
|
+
for (const k of geo.index?.array ?? []) B.I.push(B.nv + k);
|
|
23367
23435
|
B.nv += pa.count;
|
|
23368
23436
|
geo.dispose();
|
|
23369
23437
|
}
|
|
@@ -23441,7 +23509,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
23441
23509
|
m.fake.visible = !on;
|
|
23442
23510
|
}
|
|
23443
23511
|
}
|
|
23444
|
-
|
|
23512
|
+
const defined = { mirrorEnv, newMirrorState, assembleMirrors, floorAtY, chooseMirror };
|
|
23513
|
+
Object.assign(K, defined);
|
|
23445
23514
|
}
|
|
23446
23515
|
function installCars(K, shared2) {
|
|
23447
23516
|
const { THREE, FLEET, _Y } = K;
|
|
@@ -23452,13 +23521,16 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
23452
23521
|
high: ["electric_hatch", "hybrid_suv", "midsize_suv", "v8_coupe", "large_suv", "midsize_pickup", "crossover_pickup", "fastback_sedan"]
|
|
23453
23522
|
}, K.cfg.carKinds);
|
|
23454
23523
|
const CAR_CACHE = /* @__PURE__ */ new Map();
|
|
23455
|
-
function materialSignature(
|
|
23524
|
+
function materialSignature(material) {
|
|
23525
|
+
const m = material;
|
|
23456
23526
|
const f = (v) => v == null ? "" : typeof v === "number" ? v.toFixed(3) : v.isColor ? v.getHexString() : v.uuid || String(v);
|
|
23457
23527
|
return [m.type, f(m.color), f(m.roughness), f(m.metalness), f(m.opacity), m.transparent ? 1 : 0, m.side, f(m.map), f(m.emissive), f(m.emissiveIntensity), m.vertexColors ? 1 : 0, m.flatShading ? 1 : 0, f(m.envMapIntensity), f(m.alphaTest)].join("|");
|
|
23458
23528
|
}
|
|
23459
23529
|
const BUCKETS = /* @__PURE__ */ new Map();
|
|
23460
|
-
function bucketMaterial(
|
|
23461
|
-
if (
|
|
23530
|
+
function bucketMaterial(material) {
|
|
23531
|
+
if (material.type !== "MeshStandardMaterial") return null;
|
|
23532
|
+
const m = material;
|
|
23533
|
+
if (m.map || m.alphaTest || m.vertexColors || !m.color) return null;
|
|
23462
23534
|
const mt = m.metalness > 0.5 ? 2 : m.metalness > 0.2 ? 1 : 0, rg = m.roughness < 0.3 ? 0 : m.roughness < 0.6 ? 1 : 2, tr = m.transparent || m.opacity < 1, op = tr ? Math.max(0.2, Math.min(0.9, Math.round(m.opacity * 5) / 5)) : 1, sig = "bucket" + mt + rg + "s" + m.side + (tr ? "t" + op : "");
|
|
23463
23535
|
let b = BUCKETS.get(sig);
|
|
23464
23536
|
if (!b) {
|
|
@@ -23470,7 +23542,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
23470
23542
|
}
|
|
23471
23543
|
function carModel(k, seed) {
|
|
23472
23544
|
const kc = k + "|" + shared2.quality + "|" + (seed || 0);
|
|
23473
|
-
if (CAR_CACHE.has(kc)) return CAR_CACHE.get(kc);
|
|
23545
|
+
if (CAR_CACHE.has(kc)) return CAR_CACHE.get(kc) ?? null;
|
|
23474
23546
|
if (!FLEET) return null;
|
|
23475
23547
|
let res = null;
|
|
23476
23548
|
try {
|
|
@@ -23478,8 +23550,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
23478
23550
|
c.root.updateMatrixWorld(true);
|
|
23479
23551
|
const inv = new THREE.Matrix4();
|
|
23480
23552
|
const byMaterial = /* @__PURE__ */ new Map(), tmp = new THREE.Matrix4(), v = new THREE.Vector3(), nm = new THREE.Matrix3(), bb = new THREE.Box3();
|
|
23481
|
-
c.g.traverse((
|
|
23482
|
-
if (!
|
|
23553
|
+
c.g.traverse((node) => {
|
|
23554
|
+
if (!isMesh(node)) return;
|
|
23555
|
+
const o = node;
|
|
23556
|
+
if (o.isInstancedMesh || o.isSkinnedMesh || !o.geometry || !o.geometry.attributes.position) return;
|
|
23483
23557
|
for (let p = o; p; p = p.parent) if (p.visible === false) return;
|
|
23484
23558
|
const mats = Array.isArray(o.material) ? o.material : [o.material];
|
|
23485
23559
|
let geo = o.geometry;
|
|
@@ -23493,7 +23567,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
23493
23567
|
const pa = geo.attributes.position, na = geo.attributes.normal, ua = geo.attributes.uv, total = pa.count;
|
|
23494
23568
|
const grs = Array.isArray(o.material) && o.geometry.groups.length ? o.geometry.groups : [{ start: 0, count: total, materialIndex: 0 }];
|
|
23495
23569
|
for (const gr of grs) {
|
|
23496
|
-
const m = mats[gr.materialIndex] || mats[0];
|
|
23570
|
+
const m = (gr.materialIndex != null ? mats[gr.materialIndex] : void 0) || mats[0];
|
|
23497
23571
|
if (!m) continue;
|
|
23498
23572
|
const a0 = Math.min(gr.start, total), n0 = Math.min(gr.count, total - a0) - Math.min(gr.count, total - a0) % 3;
|
|
23499
23573
|
if (n0 < 3) continue;
|
|
@@ -23594,7 +23668,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
23594
23668
|
return g;
|
|
23595
23669
|
}
|
|
23596
23670
|
function assembleCars(groups) {
|
|
23597
|
-
if (shared2.quality === "game")
|
|
23671
|
+
if (shared2.quality === "game") {
|
|
23672
|
+
assembleMergedCars(groups);
|
|
23673
|
+
return;
|
|
23674
|
+
}
|
|
23598
23675
|
for (const C of CARS) {
|
|
23599
23676
|
const g = carGroup(C.k, C.w, C.d, C.seed);
|
|
23600
23677
|
if (!g) continue;
|
|
@@ -23645,7 +23722,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
23645
23722
|
(groups[B.parent] || (groups[B.parent] = new THREE.Group())).add(m);
|
|
23646
23723
|
}
|
|
23647
23724
|
}
|
|
23648
|
-
|
|
23725
|
+
const defined = { CARS, CAR_BY_STYLE, CAR_CACHE, materialSignature, BUCKETS, bucketMaterial, carModel, carGroup, assembleCars, assembleMergedCars };
|
|
23726
|
+
Object.assign(K, defined);
|
|
23649
23727
|
}
|
|
23650
23728
|
function installHouseBuilding(K, shared2) {
|
|
23651
23729
|
const { bx, cursor } = K;
|
|
@@ -23699,12 +23777,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
23699
23777
|
bx("plaster", Math.min(hall[0] - 3, color2[0]), ytop, Math.min(un[1] ? unitBox(un[1])[1] : 0, el[1]), Math.max(color2[2], un0[2]), ytop + 0.2, Math.max(un0[3], un[1] ? unitBox(un[1])[3] : 0), 11841704);
|
|
23700
23778
|
shared2.ctx.limits = { x0: Math.min(hall[0] - 3, color2[0]), z0: Math.min(el[1], un[1] ? unitBox(un[1])[1] : 0), x1: Math.max(color2[2], un0[2]), z1: Math.max(un0[3], un[1] ? unitBox(un[1])[3] : 0) };
|
|
23701
23779
|
}
|
|
23702
|
-
|
|
23780
|
+
const defined = { building };
|
|
23781
|
+
Object.assign(K, defined);
|
|
23703
23782
|
}
|
|
23704
23783
|
function installUtilitiesWater(K, shared2) {
|
|
23705
23784
|
const { THREE, _Y, _q, cursor, cylBase, part, pieceRecord, put } = K;
|
|
23706
23785
|
function createWater(r, state) {
|
|
23707
|
-
const H = r.utilities
|
|
23786
|
+
const H = r.utilities?.plumbing, cap = H ? +H.capacityL || 0 : 0, ls = { dry: [], full: [] }, points = {}, itemPoint = {};
|
|
23708
23787
|
if (H) for (const p of H.points) {
|
|
23709
23788
|
points[p.id] = p;
|
|
23710
23789
|
itemPoint[p.item] = p.id;
|
|
@@ -23793,14 +23872,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
23793
23872
|
}
|
|
23794
23873
|
const _v3 = new THREE.Vector3();
|
|
23795
23874
|
function waterPipes() {
|
|
23796
|
-
const H = shared2.ctx.r.utilities
|
|
23875
|
+
const H = shared2.ctx.r.utilities?.plumbing;
|
|
23797
23876
|
if (!H || !H.visibleRuns) return;
|
|
23798
23877
|
const nA = shared2.ctx.r.floors.length;
|
|
23799
23878
|
const groupOf = (c) => c && c.floor >= 0 ? "f" + Math.min(c.floor, nA - 1) : "lot", xyz = (p) => [p[0], p[2], p[1]];
|
|
23800
23879
|
for (const tr of H.visibleRuns) {
|
|
23801
23880
|
const pts = tr.points.map(xyz), d = tr.diameter || 0.025;
|
|
23802
23881
|
if (tr.exposed === "wall") {
|
|
23803
|
-
const pt = H.points.find((p) => p.run === tr.id), com = shared2.ctx.roomById[tr.to], g2 = groupOf(com || pt && { floor: pt.floor });
|
|
23882
|
+
const pt = H.points.find((p) => p.run === tr.id), com = tr.to != null ? shared2.ctx.roomById[tr.to] : void 0, g2 = groupOf(com || pt && { floor: pt.floor });
|
|
23804
23883
|
part("wall_pipe", [0, 0, 0], () => {
|
|
23805
23884
|
for (let i = 0; i + 1 < pts.length; i++) pipe(pts[i], pts[i + 1], d, PIPE_COLOR);
|
|
23806
23885
|
for (const p of pts) cylBase("plain", p[0], p[1] - d, p[2], d * 0.7, d * 2, PIPE_COLOR);
|
|
@@ -23822,16 +23901,17 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
23822
23901
|
cursor.pc = null;
|
|
23823
23902
|
}
|
|
23824
23903
|
}
|
|
23825
|
-
|
|
23904
|
+
const defined = { createWater, PIPE_COLOR, pipe, _v3, waterPipes };
|
|
23905
|
+
Object.assign(K, defined);
|
|
23826
23906
|
}
|
|
23827
23907
|
function installUtilitiesElectrical(K, shared2) {
|
|
23828
23908
|
const { _Y, _q, _v3, bx, cursor, cylBase, pieceRecord, put } = K;
|
|
23829
23909
|
const sh = (...a) => K.sh(...a);
|
|
23830
23910
|
function electricalStructure() {
|
|
23831
|
-
const
|
|
23911
|
+
const R = shared2.ctx.r, E = R.utilities?.electrical;
|
|
23832
23912
|
shared2.ctx.electricalInfo = null;
|
|
23833
23913
|
if (!E) return;
|
|
23834
|
-
const
|
|
23914
|
+
const nA = R.floors.length, lotGroup = R.lot ? "lot" : "f0", concreteColor = 11973547, iron = 4869200, wireRun = 1842206, info = { pole: null, meter: null, panel: null, conduits: [], outlets: [], switches: [], circuits: E.circuits || [], exposed: !!E.exposed };
|
|
23835
23915
|
const en22 = E.serviceEntrance, KV = shared2.ctx.iv ? shared2.ctx.iv.plane : null;
|
|
23836
23916
|
const wireL = (a, b, r_ = 8e-3) => {
|
|
23837
23917
|
const L = Math.hypot(b[0] - a[0], b[1] - a[1], b[2] - a[2]);
|
|
@@ -23936,7 +24016,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
23936
24016
|
_q.setFromUnitVectors(_Y, _v3.set(dx / L, dy / L, dz / L));
|
|
23937
24017
|
put("plain", "cyl", (a[0] + b[0]) / 2, (a[1] + b[1]) / 2, (a[2] + b[2]) / 2, _q, diameter, L, diameter, color2);
|
|
23938
24018
|
}
|
|
23939
|
-
|
|
24019
|
+
const defined = { electricalStructure, pipe2 };
|
|
24020
|
+
Object.assign(K, defined);
|
|
23940
24021
|
}
|
|
23941
24022
|
function installHouseBaseboard(K, shared2) {
|
|
23942
24023
|
const { Y0, bx, cursor, sideOf } = K;
|
|
@@ -23972,7 +24053,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
23972
24053
|
strip(W, y0, y0 + 0.045, 0, W, "sidewalk", cal);
|
|
23973
24054
|
}
|
|
23974
24055
|
}
|
|
23975
|
-
|
|
24056
|
+
const defined = { baseboardAndSidewalk };
|
|
24057
|
+
Object.assign(K, defined);
|
|
23976
24058
|
}
|
|
23977
24059
|
function installUtilitiesSolar(K, shared2) {
|
|
23978
24060
|
const { Y0, boxC, bx, cursor, cylBase } = K;
|
|
@@ -23985,6 +24067,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
23985
24067
|
if (u >= a - 0.05 && u <= c + 0.05 && v >= b - 0.05 && v <= d + 0.05) y = Math.max(y == null ? -1e9 : y, rr.yb);
|
|
23986
24068
|
continue;
|
|
23987
24069
|
}
|
|
24070
|
+
if (!rr.exterior || rr.tp == null || rr.rm == null) continue;
|
|
23988
24071
|
const [x0, z0, x1, z1] = rr.exterior;
|
|
23989
24072
|
if (u < x0 || u > x1 || v < z0 || v > z1) continue;
|
|
23990
24073
|
const dz = Math.min(v - z0, z1 - v), dx = Math.min(u - x0, x1 - u), dd = rr.gable ? rr.alongX ? dz : dx : Math.min(dx, dz), h = rr.yb + rr.tp * Math.min(dd, rr.rm);
|
|
@@ -23993,7 +24076,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
23993
24076
|
return y;
|
|
23994
24077
|
}
|
|
23995
24078
|
function solar() {
|
|
23996
|
-
const R = shared2.ctx.r, S = R.utilities
|
|
24079
|
+
const R = shared2.ctx.r, S = R.utilities?.solar;
|
|
23997
24080
|
shared2.ctx.solarInfo = null;
|
|
23998
24081
|
if (!S || !S.panels || !S.panels.length) return;
|
|
23999
24082
|
cursor.group = "roof";
|
|
@@ -24036,13 +24119,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
24036
24119
|
bx("plain", iv.u - W * 0.6, y0 + 0.05, iv.v + fa0, iv.u + W * 0.6, y0 + 0.17, iv.v + fa1, 2106924);
|
|
24037
24120
|
bx("emissive", iv.u - 0.03, y0 - 0.12, iv.v + fa0, iv.u + 0.03, y0 - 0.09, iv.v + fa1, 6479994);
|
|
24038
24121
|
}
|
|
24039
|
-
const top = Math.max(...(shared2.ctx.roofRects || []).
|
|
24122
|
+
const top = Math.max(...(shared2.ctx.roofRects || []).flatMap((t2) => t2.yb != null ? [t2.yb] : []), Y0(fa) + 2.8);
|
|
24040
24123
|
cylBase("plain", iv.u, y0 + h / 2, iv.v, 0.016, Math.max(0.2, top - 0.2 - (y0 + h / 2)), 15262936);
|
|
24041
24124
|
info.inverter = { id: iv.id, pos: [iv.u, y0, iv.v], side: iv.side, link: iv.link };
|
|
24042
24125
|
}
|
|
24043
24126
|
shared2.ctx.solarInfo = info;
|
|
24044
24127
|
}
|
|
24045
|
-
|
|
24128
|
+
const defined = { roofHeightAt, solar };
|
|
24129
|
+
Object.assign(K, defined);
|
|
24046
24130
|
}
|
|
24047
24131
|
function installHouseOutbuildings(K, shared2) {
|
|
24048
24132
|
const { t, bx, cursor, floorColor } = K;
|
|
@@ -24055,7 +24139,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
24055
24139
|
counts.set(w.floor, i + 1);
|
|
24056
24140
|
return w.id ? w : Object.assign({}, w, { id: `wall_${w.floor}_${i}` });
|
|
24057
24141
|
}) });
|
|
24058
|
-
const E = (r.outbuildings || []).filter((e) => e && e.walls && e.walls.length && e.interior && e.interior.length);
|
|
24142
|
+
const E = (r.outbuildings || []).filter((e) => !!(e && e.walls && e.walls.length && e.interior && e.interior.length));
|
|
24059
24143
|
if (!E.length) return r;
|
|
24060
24144
|
const rooms = r.rooms.slice(), walls = r.walls.slice(), doors = r.doors.slice(), windows = r.windows.slice(), items = r.items.filter((m) => m.type !== "outbuilding");
|
|
24061
24145
|
for (const e of E) {
|
|
@@ -24069,7 +24153,22 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
24069
24153
|
const alongU = p.axis === "u", below = p.pos < (alongU ? cz : cx);
|
|
24070
24154
|
doors.push({ id: p.id, floor: 0, u: p.u, v: p.v, axis: p.axis, pos: p.pos, at: p.at, width: p.width, a: below ? "outside" : e.id, b: below ? e.id : "outside", opensTo: e.id, exterior: true, side: p.side, leaves: 1, model: "single", hinge: "start", zones: [], blocked: false, outbuilding: e.id });
|
|
24071
24155
|
}
|
|
24072
|
-
for (const j of e.windows || []) windows.push({
|
|
24156
|
+
for (const j of e.windows || []) windows.push({
|
|
24157
|
+
id: j.id,
|
|
24158
|
+
floor: 0,
|
|
24159
|
+
u: j.u,
|
|
24160
|
+
v: j.v,
|
|
24161
|
+
axis: j.axis,
|
|
24162
|
+
pos: j.pos,
|
|
24163
|
+
at: j.at,
|
|
24164
|
+
width: j.width,
|
|
24165
|
+
y0: j.y0 ?? 1,
|
|
24166
|
+
y1: j.y1 ?? 2,
|
|
24167
|
+
/* the structure always gives a window its sill and head (1.0, 2.0) */
|
|
24168
|
+
room: e.id,
|
|
24169
|
+
side: j.side,
|
|
24170
|
+
outbuilding: e.id
|
|
24171
|
+
});
|
|
24073
24172
|
(e.items || []).forEach((m, i) => items.push({ id: e.id + "." + m.type + i, type: m.type, category: m.category, x: m.u, z: m.v, ry: m.ry || 0, w: m.w, d: m.d, h: m.h, y: 0.04, frontU: m.frontU, frontV: m.frontV, room: e.id, floor: 0, outdoor: false, aabb: m.aabb, color: "wood" }));
|
|
24074
24173
|
items.push({ id: e.id + ".ceiling_light", type: "ceiling_light", category: "ceiling_light", x: cx, z: cz, ry: 0, w: 0.35, d: 0.35, h: 0.1, y: pe - 0.1, room: e.id, floor: 0, outdoor: false, assembly: "ceiling", color: "metal", decor: true });
|
|
24075
24174
|
}
|
|
@@ -24090,7 +24189,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
24090
24189
|
}
|
|
24091
24190
|
}
|
|
24092
24191
|
}
|
|
24093
|
-
|
|
24192
|
+
const defined = { OUTBUILDING_USE, applyOutbuildings, outbuildings };
|
|
24193
|
+
Object.assign(K, defined);
|
|
24094
24194
|
}
|
|
24095
24195
|
function installFurnitureApi(K, _shared) {
|
|
24096
24196
|
const { _e, _h2, _q, boxC, cursor, macroGround, polyFace, put } = K;
|
|
@@ -24153,7 +24253,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
24153
24253
|
return { b: (mat, x, y, z, w, h, d, color2, ry, rx, rz) => A.box(M, mat, x, y0 + y, z, w, h, d, color2, ry || 0, rx || 0, rz || 0), c: (mat, x, y, z, r, h, color2, rx, rz, seg2) => A.cylinder(M, mat, x, y0 + y, z, r, h, color2, rx || 0, rz || 0, seg2), rnd: rngOf(M), wood: paletteColor(M, "wood", 8016948), met: paletteColor(M, "metal", 10133154) };
|
|
24154
24254
|
}
|
|
24155
24255
|
const PE = Math.PI / 2;
|
|
24156
|
-
|
|
24256
|
+
const defined = { MATERIAL_MAP: MATERIAL_MAP2, mm, LIGHTS, makeApi, sh, paletteColor, rngOf, kk, PE };
|
|
24257
|
+
Object.assign(K, defined);
|
|
24157
24258
|
}
|
|
24158
24259
|
function installFurnitureBuilders(K, _shared) {
|
|
24159
24260
|
const { PE, _q, kit2, kk, paletteColor, put, rngOf, sh } = K;
|
|
@@ -24279,7 +24380,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
24279
24380
|
for (let s = 0; s < np; s++) lb("fabric", np === 1 ? 0 : (s ? 1 : -1) * w * 0.23, 0.5, -d / 2 + 0.3, w * (np === 1 ? 0.6 : 0.4), 0.12, 0.34, 15789798, (s ? 1 : -1) * 0.08);
|
|
24280
24381
|
},
|
|
24281
24382
|
wardrobe(M, A) {
|
|
24282
|
-
const { b: lb } = kk(M, A), w = M.w, d = M.d, h = M.h, wood =
|
|
24383
|
+
const { b: lb } = kk(M, A), w = M.w, d = M.d, h = M.h, wood = paletteColor(M, "wood", 5980208), np = Math.max(2, Math.round(w / 0.7));
|
|
24283
24384
|
lb("wood", 0, 0.06, 0, w, h - 0.06, d, wood);
|
|
24284
24385
|
lb("wood", 0, h, 0, w + 0.04, 0.04, d + 0.04, sh(wood, 0.8));
|
|
24285
24386
|
lb("wood", 0, 0, 0, w - 0.04, 0.06, d - 0.04, sh(wood, 0.4));
|
|
@@ -24671,7 +24772,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
24671
24772
|
lb("metal", 0, h - 0.04, d / 2, w, 0.03, 0.03, 3815994);
|
|
24672
24773
|
}
|
|
24673
24774
|
};
|
|
24674
|
-
|
|
24775
|
+
const defined = { FURNITURE };
|
|
24776
|
+
Object.assign(K, defined);
|
|
24675
24777
|
}
|
|
24676
24778
|
function installFurnitureTypeTable(K, _shared) {
|
|
24677
24779
|
const { FURNITURE, kk, paletteColor } = K;
|
|
@@ -24679,7 +24781,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
24679
24781
|
function typeTable(props) {
|
|
24680
24782
|
const B = props.builders, T2 = {};
|
|
24681
24783
|
const mv = (type, id) => {
|
|
24682
|
-
|
|
24784
|
+
const f = B[id || type];
|
|
24785
|
+
if (f) T2[type] = { f, source: "props3d" };
|
|
24683
24786
|
};
|
|
24684
24787
|
const mine = (type, f, source = "game") => {
|
|
24685
24788
|
T2[type] = { f, source };
|
|
@@ -24818,7 +24921,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
24818
24921
|
extraTypes(T2, props);
|
|
24819
24922
|
return T2;
|
|
24820
24923
|
}
|
|
24821
|
-
|
|
24924
|
+
const defined = { typeTable };
|
|
24925
|
+
Object.assign(K, defined);
|
|
24822
24926
|
}
|
|
24823
24927
|
function installFurnitureTaps(K, shared2) {
|
|
24824
24928
|
shared2.tapCount = 0;
|
|
@@ -24880,7 +24984,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
24880
24984
|
}, { id: id + "_a", target: id, hidden: true, fluid: "water" });
|
|
24881
24985
|
return id;
|
|
24882
24986
|
}
|
|
24883
|
-
|
|
24987
|
+
const defined = { counterTap, wallTap };
|
|
24988
|
+
Object.assign(K, defined);
|
|
24884
24989
|
}
|
|
24885
24990
|
function installFurnitureFixtures(K, _shared) {
|
|
24886
24991
|
const seedKey = (id) => K.seedKey(id);
|
|
@@ -24989,7 +25094,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
24989
25094
|
const a = rnd() * 6.283, u = Math.sqrt(rnd()), ph = (rnd() - 0.2) * 1.2, dx = Math.cos(a) * u * R * 0.75, dz = Math.sin(a) * u * R * 0.75, dy = (o.flatten ? 0.35 : 0.55) * R * (Math.sin(ph) * 0.5 + 0.5) * 1.5 - R * 0.15;
|
|
24990
25095
|
const r = R * (0.34 + rnd() * 0.22) * (1 - u * 0.25), alt = r * 2 * (o.flatten ? 0.75 : 0.95), f = 0.72 + Math.min(1, (dy + R * 0.2) / (R * 1.2)) * 0.32 + rnd() * 0.12;
|
|
24991
25096
|
K2.e("plant", cx + dx, cy + dy + r * 0.5, cz + dz, r, alt, sh(green2, f));
|
|
24992
|
-
if (o.flower && rnd() < o.flower) {
|
|
25097
|
+
if (o.flower && o.flowers && rnd() < o.flower) {
|
|
24993
25098
|
const fa = rnd() * 6.283;
|
|
24994
25099
|
K2.e("plain", cx + dx + Math.cos(fa) * r * 0.78, cy + dy + r * 0.5 + rnd() * r * 0.5, cz + dz + Math.sin(fa) * r * 0.78, 0.028 + rnd() * 0.012, 0.05, o.flowers[rnd() * o.flowers.length | 0]);
|
|
24995
25100
|
}
|
|
@@ -25102,7 +25207,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
25102
25207
|
else blobs(K2, x, bh - 0.05, z, 0.24 + rnd() * 0.08, 6, green2, rnd, { flatten: true, flower: tp === "flower" ? 0.9 : 0.25, flowers: FLOWERS.slice(i % 3, i % 3 + 3) });
|
|
25103
25208
|
}
|
|
25104
25209
|
}
|
|
25105
|
-
|
|
25210
|
+
const defined = { GREENS: GREENS2, FLOWERS, blobs, potModel, arcLeaf, tuft, palm_tree, treeModel, shrubModel, potPlant, tablePot, planterModel };
|
|
25211
|
+
Object.assign(K, defined);
|
|
25106
25212
|
}
|
|
25107
25213
|
function installFurnitureYard(K, shared2) {
|
|
25108
25214
|
const seedKey = (id) => K.seedKey(id);
|
|
@@ -25256,7 +25362,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
25256
25362
|
};
|
|
25257
25363
|
FURNITURE.mailbox = function(M, A) {
|
|
25258
25364
|
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");
|
|
25259
|
-
if (M.pole !== false && !(M.y > 0)) {
|
|
25365
|
+
if (M.pole !== false && !(M.y != null && M.y > 0)) {
|
|
25260
25366
|
K2.b("plain", 0, 0, -d / 2 - 0.1, 0.12, y, 0.12, 12104874);
|
|
25261
25367
|
}
|
|
25262
25368
|
K2.b("metal", 0, y, 0, w, h * 0.78, d, pc);
|
|
@@ -25276,7 +25382,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
25276
25382
|
);
|
|
25277
25383
|
K2.b("plain", 0, y + h * 0.62, d / 2 + 4e-3, 0.08, 0.05, 4e-3, 15921386);
|
|
25278
25384
|
};
|
|
25279
|
-
|
|
25385
|
+
const defined = { CLOTHES_COLORS, strip, garment: garment2 };
|
|
25386
|
+
Object.assign(K, defined);
|
|
25280
25387
|
}
|
|
25281
25388
|
function installFurnitureExtraTypes(K, _shared) {
|
|
25282
25389
|
const seedKey = (id) => K.seedKey(id);
|
|
@@ -25334,7 +25441,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
25334
25441
|
tuft(K2, 0, 0, 0, Math.max(0.2, (M.w || 0.4) / 2), 16, 5212738, rnd);
|
|
25335
25442
|
});
|
|
25336
25443
|
}
|
|
25337
|
-
|
|
25444
|
+
const defined = { extraTypes };
|
|
25445
|
+
Object.assign(K, defined);
|
|
25338
25446
|
}
|
|
25339
25447
|
function installFurniturePlaceItems(K, shared2) {
|
|
25340
25448
|
const { THREE, Y0, _col, boxC, colorOf, cursor, decorLights, makeApi, structurePiece } = K;
|
|
@@ -25354,8 +25462,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
25354
25462
|
if (m.type === "stairs") continue;
|
|
25355
25463
|
const exterior = m.outdoor || m.floor < 0, f = exterior ? -1 : Math.min(m.floor, R.floors.length - 1);
|
|
25356
25464
|
cursor.group = exterior ? "lot" : "f" + f;
|
|
25357
|
-
const com = shared2.ctx.roomById[m.room], base = exterior ? 0 : Y0(f);
|
|
25358
|
-
const M = { x: m.x, z: m.z, ry: m.ry || 0, w: m.w, d: m.d, h: m.h, y: m.y || 0, base, floor: exterior ? -1 : f, palette: shared2.ctx.colors, color: m.category === "ground_cover" ? void 0 : colorOf(m.color)
|
|
25465
|
+
const com = m.room != null ? shared2.ctx.roomById[m.room] : void 0, base = exterior ? 0 : Y0(f);
|
|
25466
|
+
const M = { x: m.x, z: m.z, ry: m.ry || 0, w: m.w, d: m.d, h: m.h, y: m.y || 0, base, floor: exterior ? -1 : f, palette: shared2.ctx.colors, color: m.category === "ground_cover" ? void 0 : colorOf(m.color) ?? void 0, seed: m.id, room: m.room, typeWith: com ? com.type : null, ceiling: com ? com.ceiling : 2.9, on: shared2.ctx.night, light: shared2.ctx.night, lit: shared2.ctx.night, open: !!m.doorOpen, overhead: m.overhead, assembly: m.assembly, hose: m.hose };
|
|
25359
25467
|
if (m.category === "ground_cover" && m.polygon) {
|
|
25360
25468
|
const xs = m.polygon.map((p) => p[0]), zs = m.polygon.map((p) => p[1]);
|
|
25361
25469
|
M.x = (Math.min(...xs) + Math.max(...xs)) / 2;
|
|
@@ -25432,7 +25540,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
25432
25540
|
boxC("plain", m.x, M.base + (m.y || 0) + h / 2, m.z, m.w, h, m.d, color2, 0, m.ry || 0, 0);
|
|
25433
25541
|
shared2.ctx.labels.push({ pos: new THREE.Vector3(m.x, M.base + (m.y || 0) + h + 0.15, m.z), text: m.type, group, type: "no_model" });
|
|
25434
25542
|
}
|
|
25435
|
-
|
|
25543
|
+
const defined = { houseItems, waterTankOfHouse, hashColor, labeledBox };
|
|
25544
|
+
Object.assign(K, defined);
|
|
25436
25545
|
}
|
|
25437
25546
|
function installVegetationBridge(K, shared2) {
|
|
25438
25547
|
const seedKey = (id) => K.seedKey(id);
|
|
@@ -25465,7 +25574,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
25465
25574
|
const ids = VEG_MAP[m.type], can2 = VEG_PLANTER[m.type];
|
|
25466
25575
|
if (!ids && !can2) return false;
|
|
25467
25576
|
const rnd = rngString(SEED() + "|" + seedKey(m.id) + "|veg"), pick2 = (l) => l[Math.min(l.length - 1, rnd() * l.length | 0)], ok = (id) => {
|
|
25468
|
-
if (V.ok.has(id)) return V.ok.get(id);
|
|
25577
|
+
if (V.ok.has(id)) return V.ok.get(id) === true;
|
|
25469
25578
|
let r = true;
|
|
25470
25579
|
try {
|
|
25471
25580
|
V.S.toSpec(id);
|
|
@@ -25511,7 +25620,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
25511
25620
|
obj.position.y = G.y;
|
|
25512
25621
|
obj.name = "vegetation";
|
|
25513
25622
|
obj.traverse((o) => {
|
|
25514
|
-
if (o
|
|
25623
|
+
if (isMesh(o)) {
|
|
25515
25624
|
o.castShadow = true;
|
|
25516
25625
|
o.receiveShadow = true;
|
|
25517
25626
|
o.name = "veg/" + o.name;
|
|
@@ -25526,7 +25635,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
25526
25635
|
}
|
|
25527
25636
|
shared2.ctx.vegInfo = { plants: pl, triangles: tri, colliders: col, lodCounts: lod, materials: mats };
|
|
25528
25637
|
}
|
|
25529
|
-
|
|
25638
|
+
const defined = { VEG_POT, VEG_CACTUS, VEG_MAP, VEG_PLANTER, vegItem, assembleVegetation };
|
|
25639
|
+
Object.assign(K, defined);
|
|
25530
25640
|
}
|
|
25531
25641
|
function installInteractionState(K, shared2) {
|
|
25532
25642
|
const { THREE, cfg, colliderChanged, invalidateShadow, invalidate, UV_SCALE, applyPart, texture } = K;
|
|
@@ -25592,12 +25702,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
25592
25702
|
shared2.inter.msg = { text, until: performance.now() + MESSAGE_MS };
|
|
25593
25703
|
if (cfg.onMessage) cfg.onMessage(text);
|
|
25594
25704
|
};
|
|
25595
|
-
|
|
25705
|
+
const I = () => shared2.inter;
|
|
25706
|
+
function definePiece(name, definition) {
|
|
25707
|
+
const def = definition;
|
|
25596
25708
|
def.name = name;
|
|
25597
25709
|
def.meshes = [];
|
|
25598
25710
|
def.t = def.target = shared2.partState.has(name) ? shared2.partState.get(name) : def.t0 || 0;
|
|
25599
|
-
|
|
25600
|
-
|
|
25711
|
+
I().defs.set(name, def);
|
|
25712
|
+
I().pieces.push(def);
|
|
25601
25713
|
return def;
|
|
25602
25714
|
}
|
|
25603
25715
|
const localOf = (M, lx, lz) => {
|
|
@@ -25609,17 +25721,18 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
25609
25721
|
return true;
|
|
25610
25722
|
}
|
|
25611
25723
|
function assembleInteractive(gs) {
|
|
25612
|
-
|
|
25724
|
+
const inter = I();
|
|
25725
|
+
for (const [name, def] of inter.defs) {
|
|
25613
25726
|
const g = gs[name];
|
|
25614
25727
|
if (!g) continue;
|
|
25615
25728
|
delete gs[name];
|
|
25616
25729
|
const outer = new THREE.Group();
|
|
25617
|
-
outer.position.
|
|
25730
|
+
outer.position.fromArray(def.pivot);
|
|
25618
25731
|
outer.rotation.y = def.ry || 0;
|
|
25619
25732
|
outer.updateMatrix();
|
|
25620
|
-
const inv = new THREE.Matrix4().compose(new THREE.Vector3(
|
|
25733
|
+
const inv = new THREE.Matrix4().compose(new THREE.Vector3().fromArray(def.pivot), new THREE.Quaternion().setFromAxisAngle(_EY, def.ry || 0), _UM3).invert();
|
|
25621
25734
|
g.traverse((o) => {
|
|
25622
|
-
if (o
|
|
25735
|
+
if (isMesh(o)) {
|
|
25623
25736
|
o.geometry.applyMatrix4(inv);
|
|
25624
25737
|
o.userData.piece = def;
|
|
25625
25738
|
def.meshes.push(o);
|
|
@@ -25631,13 +25744,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
25631
25744
|
const parent = def.leaf ? def.leaf.gs[def.k] : gs[def.parent] || (gs[def.parent] = new THREE.Group());
|
|
25632
25745
|
if (parent) parent.add(outer);
|
|
25633
25746
|
if (def.roomId) {
|
|
25634
|
-
|
|
25635
|
-
|
|
25747
|
+
let lamps = inter.lights.get(def.roomId);
|
|
25748
|
+
if (!lamps) inter.lights.set(def.roomId, lamps = []);
|
|
25749
|
+
lamps.push(def);
|
|
25636
25750
|
}
|
|
25637
25751
|
applyPiece(def);
|
|
25638
25752
|
}
|
|
25639
|
-
for (const roomId of
|
|
25640
|
-
|
|
25753
|
+
for (const roomId of inter.litRooms) applyLight(roomId);
|
|
25754
|
+
inter.defs.forEach((d) => {
|
|
25641
25755
|
if (d.col) d.col.off = d.t > 0.5;
|
|
25642
25756
|
});
|
|
25643
25757
|
}
|
|
@@ -25645,6 +25759,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
25645
25759
|
const n = p.inner;
|
|
25646
25760
|
if (!n) return;
|
|
25647
25761
|
switch (p.kind) {
|
|
25762
|
+
/* each kind always sets its dimensions (sgn, angle, travel, k, axis) */
|
|
25648
25763
|
case "swing":
|
|
25649
25764
|
n.rotation.y = p.sgn * p.t * p.angle;
|
|
25650
25765
|
break;
|
|
@@ -25677,8 +25792,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
25677
25792
|
}
|
|
25678
25793
|
const DURATION = { swing: 0.55, drawer: 0.4, curtain: 0.9, gate_swing: 0.9, gate_tilt: 1.4, gate_slide: 1.6, lightSwitch: 0.12, part: 0.4 };
|
|
25679
25794
|
function animateInteractive(dt) {
|
|
25680
|
-
|
|
25681
|
-
|
|
25795
|
+
const inter = I();
|
|
25796
|
+
if (!inter.anim.size) return;
|
|
25797
|
+
for (const p of inter.anim) {
|
|
25682
25798
|
const step = dt / (DURATION[p.kind] || 0.5), d = p.target - p.t;
|
|
25683
25799
|
p.t = Math.abs(d) <= step ? p.target : p.t + Math.sign(d) * step;
|
|
25684
25800
|
applyPiece(p);
|
|
@@ -25686,7 +25802,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
25686
25802
|
p.col.off = p.target > 0.5;
|
|
25687
25803
|
colliderChanged(p.col);
|
|
25688
25804
|
}
|
|
25689
|
-
if (p.t === p.target)
|
|
25805
|
+
if (p.t === p.target) inter.anim.delete(p);
|
|
25690
25806
|
}
|
|
25691
25807
|
invalidateShadow();
|
|
25692
25808
|
}
|
|
@@ -25697,7 +25813,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
25697
25813
|
p.col.off = p.target > 0.5;
|
|
25698
25814
|
colliderChanged(p.col);
|
|
25699
25815
|
}
|
|
25700
|
-
|
|
25816
|
+
I().anim.add(p);
|
|
25701
25817
|
}
|
|
25702
25818
|
const lightBase = (roomId) => roomId == null ? true : shared2.partState.has("light:" + roomId) ? !!shared2.partState.get("light:" + roomId) : !!shared2.ctx.night;
|
|
25703
25819
|
const lightOn = (roomId) => {
|
|
@@ -25705,20 +25821,21 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
25705
25821
|
return S ? S.ef : lightBase(roomId);
|
|
25706
25822
|
};
|
|
25707
25823
|
function applyLight(roomId) {
|
|
25708
|
-
const on = lightOn(roomId);
|
|
25709
|
-
for (const d of
|
|
25710
|
-
const sw =
|
|
25824
|
+
const on = lightOn(roomId), inter = I(), mats = shared2.mats;
|
|
25825
|
+
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;
|
|
25826
|
+
const sw = inter.defs.get("ix:int:" + roomId);
|
|
25711
25827
|
if (sw) {
|
|
25712
25828
|
sw.target = on ? 1 : 0;
|
|
25713
|
-
if (sw.t !== sw.target)
|
|
25829
|
+
if (sw.t !== sw.target) inter.anim.add(sw);
|
|
25714
25830
|
}
|
|
25715
25831
|
invalidate();
|
|
25716
25832
|
}
|
|
25717
25833
|
function toggleLight(roomId) {
|
|
25718
25834
|
const S = shared2.ctx.iv && shared2.ctx.iv.roomStates.get(roomId);
|
|
25719
25835
|
if (S) {
|
|
25720
|
-
|
|
25721
|
-
|
|
25836
|
+
const IV = shared2.ctx.iv;
|
|
25837
|
+
ivRoomLight(IV, roomId, !S.ef);
|
|
25838
|
+
const ef = ivRoomEffective(IV, S);
|
|
25722
25839
|
if (ef !== S.ef) {
|
|
25723
25840
|
S.ef = ef;
|
|
25724
25841
|
applyLight(roomId);
|
|
@@ -25730,9 +25847,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
25730
25847
|
applyLight(roomId);
|
|
25731
25848
|
if (cfg.onLight) cfg.onLight(roomId, lightOn(roomId));
|
|
25732
25849
|
}
|
|
25733
|
-
|
|
25850
|
+
const defined = { newInteractiveState, MESSAGE_MS, createInteractiveMaterials, _EY, _UM3, hudMessage, definePiece, localOf, visibleChain, assembleInteractive, applyPiece, DURATION, animateInteractive, togglePiece, lightBase, lightOn, applyLight, toggleLight };
|
|
25851
|
+
Object.assign(K, defined);
|
|
25734
25852
|
}
|
|
25735
25853
|
function installInteractionCollision(K, shared2) {
|
|
25854
|
+
const inter = () => shared2.inter;
|
|
25736
25855
|
const NO_COLLIDE = /(^|_)(rug|floor|concrete|dirt|lawn|deck|ceiling_light|pendant|chandelier|spot|picture|curtain|blinds|wall_shelving|plank_shelf|wall_ac|ac_condenser|pool|soaking_tub|pergola|stairs|mirror)/;
|
|
25737
25856
|
function registerCollision(m, M) {
|
|
25738
25857
|
const h = m.h || 0, y = M.y || 0;
|
|
@@ -25742,7 +25861,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
25742
25861
|
w = Math.min(w, 0.5);
|
|
25743
25862
|
d = Math.min(d, 0.5);
|
|
25744
25863
|
}
|
|
25745
|
-
|
|
25864
|
+
inter().objs.push({ f: M.floor, cx: m.x, cz: m.z, c: Math.cos(M.ry), s: Math.sin(M.ry), hw: w / 2, hd: d / 2, type: m.type });
|
|
25746
25865
|
}
|
|
25747
25866
|
function objectDistance(o, x, z) {
|
|
25748
25867
|
const dx = x - o.cx, dz = z - o.cz, lx = dx * o.c - dz * o.s, lz = dx * o.s + dz * o.c, ex = Math.abs(lx) - o.hw, ez = Math.abs(lz) - o.hd;
|
|
@@ -25750,7 +25869,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
25750
25869
|
}
|
|
25751
25870
|
function collideObject(x, z, fx, fz, floor) {
|
|
25752
25871
|
const R = 0.2;
|
|
25753
|
-
for (const o of
|
|
25872
|
+
for (const o of inter().objs) {
|
|
25754
25873
|
if (o.f !== -1 ? o.f !== floor : floor !== 0) continue;
|
|
25755
25874
|
const d1 = objectDistance(o, x, z);
|
|
25756
25875
|
if (d1 < R && d1 < objectDistance(o, fx, fz) - 1e-6) return true;
|
|
@@ -25770,13 +25889,15 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
25770
25889
|
const de = opt.from || [x + 1e4, z + 1e4];
|
|
25771
25890
|
return collideObject(x, z, de[0], de[1], floor);
|
|
25772
25891
|
}
|
|
25773
|
-
|
|
25892
|
+
const defined = { NO_COLLIDE, registerCollision, objectDistance, collideObject, collideAt };
|
|
25893
|
+
Object.assign(K, defined);
|
|
25774
25894
|
}
|
|
25775
25895
|
function installInteractionItems(K, shared2) {
|
|
25776
25896
|
const { t, LIGHTS, cursor, definePiece, localOf, registerCollision, togglePiece } = K;
|
|
25777
25897
|
const DOOR_ITEM = /^(tv_unit|tv_unit_small|tv_unit_large|sideboard|china_cabinet|filing_cabinet|pantry|laundry_cabinet|wardrobe|wardrobe_small|wardrobe_large|closet_wardrobe|kitchen_cabinet|kitchen_cabinet_large|kitchen_cabinet_small|fridge|fridge_large|display_fridge_medium|display_fridge)$/;
|
|
25778
25898
|
const DRAWER_ITEM = /^(console_table|dresser|nightstand|vanity_table)$/;
|
|
25779
25899
|
const LIGHT_TYPES = /* @__PURE__ */ new Set(["ceiling_light", "pendant", "chandelier", "track_spot", "hanging_plant"]);
|
|
25900
|
+
const I = () => shared2.inter;
|
|
25780
25901
|
function objectName(type, drawer) {
|
|
25781
25902
|
return drawer ? "drawer" : /^wardrobe/.test(type) ? "wardrobe" : /fridge|refrig|freezer/.test(type) ? "fridge" : /pantry/.test(type) ? "pantry" : "cabinet";
|
|
25782
25903
|
}
|
|
@@ -25805,8 +25926,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
25805
25926
|
cursor.group = parent;
|
|
25806
25927
|
}
|
|
25807
25928
|
for (let i = n0; i < LIGHTS.length; i++) LIGHTS[i].roomId = m.room;
|
|
25808
|
-
if (!
|
|
25809
|
-
|
|
25929
|
+
if (!I().defs.has(name)) definePiece(name, { kind: "light", pivot: [0, 0, 0], ry: 0, parent, roomId: m.room });
|
|
25930
|
+
I().litRooms.add(m.room);
|
|
25810
25931
|
}
|
|
25811
25932
|
function curtainItem(m, M, ent, api, parent) {
|
|
25812
25933
|
M.open = false;
|
|
@@ -25834,12 +25955,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
25834
25955
|
for (const c of body) api[c[0]](M, ...c[1]);
|
|
25835
25956
|
if (!parts.length) return;
|
|
25836
25957
|
const [ax, az] = localOf(M, 0, 0.2);
|
|
25837
|
-
|
|
25838
|
-
|
|
25958
|
+
const first = parts[0];
|
|
25959
|
+
I().items.push({ type: "curtain", id: m.id, floor: M.floor, anchor: [ax, M.base + (M.y || 0) + (m.h || 2) * 0.5, az], range: 2.4, angle: 1, pieces: parts, text: () => t(first.target > 0.5 ? "prompt.close" : "prompt.open", { what: t("what.curtain") }), action: () => {
|
|
25960
|
+
const al = first.target > 0.5 ? 0 : 1;
|
|
25839
25961
|
for (const p of parts) {
|
|
25840
25962
|
p.target = al;
|
|
25841
25963
|
shared2.partState.set(p.name, al);
|
|
25842
|
-
|
|
25964
|
+
I().anim.add(p);
|
|
25843
25965
|
}
|
|
25844
25966
|
} });
|
|
25845
25967
|
}
|
|
@@ -25860,7 +25982,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
25860
25982
|
calls.forEach((c, i) => {
|
|
25861
25983
|
if (owner.has(i)) return;
|
|
25862
25984
|
const a = c[1];
|
|
25863
|
-
let x0, x1, y0, y1, ok = false, grip = 0, wide = false;
|
|
25985
|
+
let x0 = 0, x1 = 0, y0 = 0, y1 = 0, ok = false, grip = 0, wide = false;
|
|
25864
25986
|
if (c[0] === "box") {
|
|
25865
25987
|
const [mat, x, y, z, w, h, d, , ry, rx, rz] = a;
|
|
25866
25988
|
if (ry || rx || rz || d > 0.05 || z + d / 2 < front - 5e-3 || w > M.w * 1.01) return;
|
|
@@ -25892,8 +26014,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
25892
26014
|
return;
|
|
25893
26015
|
}
|
|
25894
26016
|
candidate.sort((p, q) => overlap(x0, x1, q.x0, q.x1) - overlap(x0, x1, p.x0, p.x1));
|
|
25895
|
-
|
|
25896
|
-
|
|
26017
|
+
const best = candidate[0];
|
|
26018
|
+
owner.set(i, best);
|
|
26019
|
+
if (grip) best.grip = grip;
|
|
25897
26020
|
});
|
|
25898
26021
|
const name = objectName(m.type, drawer), parts = [];
|
|
25899
26022
|
panels.forEach((p, k) => {
|
|
@@ -25909,8 +26032,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
25909
26032
|
p.def = def;
|
|
25910
26033
|
parts.push(def);
|
|
25911
26034
|
const [ax, az] = localOf(M, cx, front + 0.08);
|
|
25912
|
-
|
|
25913
|
-
def.item =
|
|
26035
|
+
I().items.push({ type: drawer ? "drawer" : "cabinet", id: m.id, floor: M.floor, anchor: [ax, M.base + (M.y || 0) + (p.y0 + p.y1) / 2, az], range: 1.6, angle: 0.4, pieces: [def], text: () => t(def.target > 0.5 ? "prompt.close" : "prompt.open", { what: t("what." + name) }), action: () => togglePiece(def) });
|
|
26036
|
+
def.item = I().items[I().items.length - 1];
|
|
25914
26037
|
});
|
|
25915
26038
|
calls.forEach((c, i) => {
|
|
25916
26039
|
const p = owner.get(i);
|
|
@@ -25924,12 +26047,15 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
25924
26047
|
}
|
|
25925
26048
|
cursor.group = parent;
|
|
25926
26049
|
}
|
|
25927
|
-
|
|
26050
|
+
const defined = { DOOR_ITEM, DRAWER_ITEM, LIGHT_TYPES, objectName, recordApi, buildItem: buildItem2, lightItem, curtainItem, furnitureItem };
|
|
26051
|
+
Object.assign(K, defined);
|
|
25928
26052
|
}
|
|
25929
26053
|
function installInteractionFittings(K, shared2) {
|
|
25930
26054
|
const { t, EPS: EPS3, OPEN_AREA, Y0, applyPiece, bx, cursor, definePiece, gates, lightOn, roomAt, slideDirection, toggleLight, togglePiece } = K;
|
|
26055
|
+
const I = () => shared2.inter;
|
|
26056
|
+
const house = () => shared2.ctx.r;
|
|
25931
26057
|
function gatesInteractive() {
|
|
25932
|
-
const lt =
|
|
26058
|
+
const lt = house().lot;
|
|
25933
26059
|
if (!lt) return;
|
|
25934
26060
|
const cz0 = (lt.rect[1] + lt.rect[3]) / 2;
|
|
25935
26061
|
const orig = K.getBx(), gs = lt.gates, opening = gs.map((g) => g.open), reg = gs.map((g) => {
|
|
@@ -25949,9 +26075,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
25949
26075
|
return;
|
|
25950
26076
|
}
|
|
25951
26077
|
}
|
|
25952
|
-
|
|
26078
|
+
orig(mat, x0, y0, z0, x1, y1, z1, color2);
|
|
25953
26079
|
});
|
|
25954
|
-
const
|
|
26080
|
+
const colliders = shared2.ctx.colliders, n0 = colliders.length;
|
|
25955
26081
|
try {
|
|
25956
26082
|
gs.forEach((g) => {
|
|
25957
26083
|
g.open = false;
|
|
@@ -25963,7 +26089,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
25963
26089
|
g.open = opening[i];
|
|
25964
26090
|
});
|
|
25965
26091
|
}
|
|
25966
|
-
const cols =
|
|
26092
|
+
const cols = colliders.slice(n0), cz = (lt.rect[1] + lt.rect[3]) / 2, cu = (lt.rect[0] + lt.rect[2]) / 2;
|
|
25967
26093
|
reg.forEach((r, i) => {
|
|
25968
26094
|
const g = r.g;
|
|
25969
26095
|
if (!isFinite(r.x0)) return;
|
|
@@ -25972,25 +26098,25 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
25972
26098
|
const p = ped ? definePiece(name, Object.assign(base, { kind: "gate_swing", pivot: [r.x0, 0, g.v], angle: -sd * 1.65 })) : tilt ? definePiece(name, Object.assign(base, { kind: "gate_tilting", pivot: [(r.x0 + r.x1) / 2, r.y1, g.v], angle: -sd * 1.45 })) : definePiece(name, Object.assign(base, { kind: "gate_sliding", pivot: [r.x0, 0, r.zm], travel: r.dx * g.width }));
|
|
25973
26099
|
if (p.col) p.col.off = p.target > 0.5;
|
|
25974
26100
|
const text = () => t(p.target > 0.5 ? "prompt.close" : "prompt.open", { what: t(ped ? "what.pedestrianGate" : "what.garageGate") });
|
|
25975
|
-
|
|
26101
|
+
I().items.push({ type: "gate", id: g.id, floor: -1, anchor: [g.u, 1, g.v + sd * 0.4], range: 2.8, angle: 0.9, pieces: [p], text, action: () => togglePiece(p), noWall: true });
|
|
25976
26102
|
});
|
|
25977
26103
|
}
|
|
25978
26104
|
function mailboxInteractive() {
|
|
25979
|
-
for (const m of
|
|
26105
|
+
for (const m of house().items) {
|
|
25980
26106
|
if (m.type !== "mailbox") continue;
|
|
25981
26107
|
const g = shared2.ctx.parts && shared2.ctx.parts["mailbox_" + m.id];
|
|
25982
26108
|
if (!g) continue;
|
|
25983
26109
|
const name = "ix:correio:" + m.id, def = definePiece(name, { kind: "part", pivot: [0, 0, 0], ry: 0, parent: "lot" });
|
|
25984
26110
|
def.inner = g;
|
|
25985
26111
|
const fx = Math.sin(m.ry || 0), fz = Math.cos(m.ry || 0), ay = (m.y || 1) + (m.h || 0.3) * 0.4;
|
|
25986
|
-
|
|
26112
|
+
I().items.push({ type: "mailbox", id: m.id, floor: -1, anchor: [m.x + fx * 0.2, ay, m.z + fz * 0.2], range: 2.2, angle: 0.7, pieces: [def], text: () => t(def.target > 0.5 ? "prompt.close" : "prompt.open", { what: t("what.mailbox") }), action: () => togglePiece(def), noWall: true });
|
|
25987
26113
|
applyPiece(def);
|
|
25988
26114
|
}
|
|
25989
26115
|
}
|
|
25990
26116
|
function placeSwitches() {
|
|
25991
|
-
const R =
|
|
26117
|
+
const R = house(), used = /* @__PURE__ */ new Set();
|
|
25992
26118
|
for (const c of R.rooms) {
|
|
25993
|
-
if (c.type === "void" || OPEN_AREA(c) || !
|
|
26119
|
+
if (c.type === "void" || OPEN_AREA(c) || !I().litRooms.has(c.id) || used.has(c.id) || shared2.ctx.iv && shared2.ctx.iv.switchRooms.has(c.id)) continue;
|
|
25994
26120
|
const doors = R.doors.filter((p) => p.floor === c.floor && (p.a === c.id || p.b === c.id));
|
|
25995
26121
|
doors.sort((p, q) => ((q.exterior ? 1 : 0) - (p.exterior ? 1 : 0)) * (c.type === "living" ? 1 : -1));
|
|
25996
26122
|
for (const p of doors) if (putSwitch(c, p)) {
|
|
@@ -26000,11 +26126,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26000
26126
|
}
|
|
26001
26127
|
}
|
|
26002
26128
|
function putSwitch(c, p) {
|
|
26003
|
-
const R =
|
|
26129
|
+
const R = house(), f = p.floor, alongU = p.axis === "u", L = p.pos, a = p.at - p.width / 2, b = p.at + p.width / 2;
|
|
26004
26130
|
const wref = R.walls.find((w) => w.floor === f && w.axis === p.axis && Math.abs((alongU ? w.v0 : w.u0) - L) < EPS3), th = wref ? wref.thickness || 0.15 : 0.15;
|
|
26005
26131
|
const inside2 = (sd2) => {
|
|
26006
26132
|
const cc = roomAt(f, alongU ? p.at : L + sd2 * 0.4, alongU ? L + sd2 * 0.4 : p.at);
|
|
26007
|
-
return cc && cc.id === c.id;
|
|
26133
|
+
return !!cc && cc.id === c.id;
|
|
26008
26134
|
};
|
|
26009
26135
|
const sd = inside2(1) ? 1 : inside2(-1) ? -1 : 0;
|
|
26010
26136
|
if (!sd) return false;
|
|
@@ -26027,17 +26153,20 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26027
26153
|
const piece2 = definePiece("ix:int:" + roomId, { kind: "light_switch", pivot: pv, ry: 0, parent: "f" + f, axis: alongU ? "x" : "z", sgn: alongU ? sd : -sd, t0: lightOn(roomId) ? 1 : 0 });
|
|
26028
26154
|
piece2.t = piece2.target = lightOn(roomId) ? 1 : 0;
|
|
26029
26155
|
const an = alongU ? [u, yc, face + sd * 0.12] : [face + sd * 0.12, yc, u];
|
|
26030
|
-
|
|
26156
|
+
I().items.push({ type: "light_switch", id: roomId, floor: f, anchor: an, range: 1.5, angle: 0.45, pieces: [piece2], text: () => t(lightOn(roomId) ? "prompt.lightOff" : "prompt.lightOn"), action: () => toggleLight(roomId) });
|
|
26031
26157
|
return true;
|
|
26032
26158
|
}
|
|
26033
26159
|
return false;
|
|
26034
26160
|
}
|
|
26035
|
-
|
|
26161
|
+
const defined = { gatesInteractive, mailboxInteractive, placeSwitches, putSwitch };
|
|
26162
|
+
Object.assign(K, defined);
|
|
26036
26163
|
}
|
|
26037
26164
|
function installInteractionDoors(K, shared2) {
|
|
26038
26165
|
const { t, colliderChanged, invalidateShadow, applyPiece, hudMessage } = K;
|
|
26166
|
+
const leaves = () => shared2.ctx.leaves;
|
|
26039
26167
|
function linkDoorLeaves() {
|
|
26040
|
-
|
|
26168
|
+
const I = shared2.inter;
|
|
26169
|
+
for (const fo of leaves()) fo.handles = (fo.handleNames || []).map((n) => I.defs.get(n)).filter((d) => !!d);
|
|
26041
26170
|
}
|
|
26042
26171
|
function handleApply(fo) {
|
|
26043
26172
|
for (const mc of fo.handles || []) {
|
|
@@ -26047,11 +26176,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26047
26176
|
}
|
|
26048
26177
|
function toggleDoor(fo) {
|
|
26049
26178
|
if (fo.phase === "rattle") return;
|
|
26179
|
+
const col = fo.col;
|
|
26050
26180
|
if (fo.phase === "handle" || fo.phase === "swing") {
|
|
26051
26181
|
fo.open = !fo.open;
|
|
26052
26182
|
shared2.doorState.set(fo.id, fo.open);
|
|
26053
|
-
|
|
26054
|
-
colliderChanged(
|
|
26183
|
+
col.off = fo.open;
|
|
26184
|
+
colliderChanged(col);
|
|
26055
26185
|
fo.anim = true;
|
|
26056
26186
|
fo.phase = "swing";
|
|
26057
26187
|
return;
|
|
@@ -26065,8 +26195,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26065
26195
|
}
|
|
26066
26196
|
fo.open = !fo.open;
|
|
26067
26197
|
shared2.doorState.set(fo.id, fo.open);
|
|
26068
|
-
|
|
26069
|
-
colliderChanged(
|
|
26198
|
+
col.off = fo.open;
|
|
26199
|
+
colliderChanged(col);
|
|
26070
26200
|
fo.anim = true;
|
|
26071
26201
|
shared2.ctx.animateDoorsOn = true;
|
|
26072
26202
|
if (fo.handles && fo.handles.length) {
|
|
@@ -26077,7 +26207,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26077
26207
|
function animateDoors(dt) {
|
|
26078
26208
|
if (!shared2.ctx.animateDoorsOn) return;
|
|
26079
26209
|
let active = false;
|
|
26080
|
-
for (const fo of
|
|
26210
|
+
for (const fo of leaves()) {
|
|
26081
26211
|
if (!fo.phase) continue;
|
|
26082
26212
|
active = true;
|
|
26083
26213
|
if (fo.phase === "handle") {
|
|
@@ -26097,7 +26227,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26097
26227
|
handleApply(fo);
|
|
26098
26228
|
if (fo.hT <= 0) fo.phase = null;
|
|
26099
26229
|
} else if (fo.phase === "rattle") {
|
|
26100
|
-
fo.jig
|
|
26230
|
+
fo.jig = (fo.jig ?? 0) - dt;
|
|
26101
26231
|
fo.hT = fo.jig > 0 ? 0.55 * Math.abs(Math.sin(fo.jig * 26)) : 0;
|
|
26102
26232
|
handleApply(fo);
|
|
26103
26233
|
if (fo.jig <= 0) {
|
|
@@ -26111,9 +26241,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26111
26241
|
invalidateShadow();
|
|
26112
26242
|
}
|
|
26113
26243
|
function wallBlocks(ex, ez, ax, az, floor) {
|
|
26114
|
-
const n = shared2.ctx.wallColliders != null ? shared2.ctx.wallColliders : 0;
|
|
26244
|
+
const n = shared2.ctx.wallColliders != null ? shared2.ctx.wallColliders : 0, colliders = shared2.ctx.colliders;
|
|
26115
26245
|
for (let i = 0; i < n; i++) {
|
|
26116
|
-
const c =
|
|
26246
|
+
const c = colliders[i];
|
|
26117
26247
|
if (c.f !== floor && !(c.f === -1 && floor === 0)) continue;
|
|
26118
26248
|
let t0 = 0, t1 = 1;
|
|
26119
26249
|
const dx = ax - ex, dz = az - ez;
|
|
@@ -26143,7 +26273,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26143
26273
|
g.updateMatrix();
|
|
26144
26274
|
}
|
|
26145
26275
|
}
|
|
26146
|
-
|
|
26276
|
+
const defined = { linkDoorLeaves, handleApply, toggleDoor, animateDoors, wallBlocks, doorText, applyLeaf };
|
|
26277
|
+
Object.assign(K, defined);
|
|
26147
26278
|
}
|
|
26148
26279
|
function installInteractionTarget(K, shared2) {
|
|
26149
26280
|
const { doorText, toggleDoor, visibleChain, wallBlocks } = K;
|
|
@@ -26151,6 +26282,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26151
26282
|
function targetOf(o, opt) {
|
|
26152
26283
|
if (!o) return null;
|
|
26153
26284
|
opt = opt || {};
|
|
26285
|
+
const I = shared2.inter;
|
|
26154
26286
|
const ex = o.x, ey = o.y, ez = o.z, floor = o.floor, cp = Math.cos(o.pitch || 0), vx = Math.sin(o.yaw) * cp, vy = Math.sin(o.pitch || 0), vz = Math.cos(o.yaw) * cp;
|
|
26155
26287
|
let best = null;
|
|
26156
26288
|
const tries = (score, text, action, target) => {
|
|
@@ -26164,16 +26296,16 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26164
26296
|
if (angle > 1.35 && d > 0.9) continue;
|
|
26165
26297
|
tries(angle * 1.6 + d * 0.5 + (angle < 0.25 ? 0 : 0.6), doorText(fo), () => toggleDoor(fo), fo);
|
|
26166
26298
|
}
|
|
26167
|
-
const vis =
|
|
26299
|
+
const vis = I.pieces.flatMap((p) => p.meshes).filter(visibleChain), hit = vis.length && opt.strike ? opt.strike(vis) : null;
|
|
26168
26300
|
const kitA = shared2.ctx.iv ? ivTarget(shared2.ctx.iv, o, opt && opt.interactives) : null;
|
|
26169
26301
|
const nearKit = kitA && hit && Math.hypot(kitA.target.pos[0] - ex, kitA.target.pos[1] - ey, kitA.target.pos[2] - ez) < hit.distance + 0.1;
|
|
26170
26302
|
const pieceHit = hit && !nearKit && hit.object.userData.piece;
|
|
26171
|
-
for (const it of
|
|
26303
|
+
for (const it of I.items) {
|
|
26172
26304
|
if (it.floor !== floor && !(it.floor === -1 && floor === 0)) continue;
|
|
26173
26305
|
const [ax, ay, az] = it.anchor, dx = ax - ex, dy = ay - ey, dz = az - ez, d = Math.hypot(dx, dy, dz), dh = Math.hypot(dx, dz);
|
|
26174
26306
|
if (dh > it.range + 0.4) continue;
|
|
26175
26307
|
const angle = Math.acos(Math.max(-1, Math.min(1, (dx * vx + dy * vy + dz * vz) / (d || 1))));
|
|
26176
|
-
const byRay = pieceHit && it.pieces.includes(pieceHit) && hit.distance <= it.range + 0.5;
|
|
26308
|
+
const byRay = !!hit && pieceHit && it.pieces.includes(pieceHit) && hit.distance <= it.range + 0.5;
|
|
26177
26309
|
if (!byRay && !(dh <= it.range && angle <= it.angle)) continue;
|
|
26178
26310
|
if (!it.noWall && wallBlocks(ex, ez, ax, az, it.floor < 0 ? 0 : it.floor)) continue;
|
|
26179
26311
|
tries((byRay ? 0 : angle * 2) + d * 0.3 - (byRay ? 1.5 : 0), it.text(), it.action, it);
|
|
@@ -26181,7 +26313,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26181
26313
|
if (kitA) tries(kitA.score - (nearKit ? 0.5 : 0), kitA.text, kitA.action, kitA.target);
|
|
26182
26314
|
return best;
|
|
26183
26315
|
}
|
|
26184
|
-
|
|
26316
|
+
const defined = { targetOf };
|
|
26317
|
+
Object.assign(K, defined);
|
|
26185
26318
|
}
|
|
26186
26319
|
function installInteractablesBridge(K, shared2) {
|
|
26187
26320
|
const { t, THREE, invalidate, invalidateShadow, cfg, DOC, LIGHT_TYPES, _Y, _q, _v3, accFor, applyLight, cursor, hashString: hashString2, hudMessage, lightBase, pieceRecord, put, rgbOf, sh, wallBlocks } = K;
|
|
@@ -26236,7 +26369,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26236
26369
|
function ivBuild(h, water) {
|
|
26237
26370
|
const ik = K.IVK, r = shared2.ctx.r, A = ik.A, world0 = null;
|
|
26238
26371
|
void world0;
|
|
26239
|
-
const
|
|
26372
|
+
const source = r;
|
|
26373
|
+
const plane2 = A.plan(source, { seed: r.seed });
|
|
26240
26374
|
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, items: null, itemsDirty: true, itemsT: 0, dirty: true, list: null, listT: 0, t: 0, circuits: [], switchRooms: /* @__PURE__ */ new Set(), warnings: [], tBuild: 0 };
|
|
26241
26375
|
h.IV = IV;
|
|
26242
26376
|
const t0 = performance.now();
|
|
@@ -26255,9 +26389,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26255
26389
|
const wants = (roomId) => lightBase(roomId);
|
|
26256
26390
|
const entById = new Map(plane2.items.map((e) => [e.id, e]));
|
|
26257
26391
|
const entByItem = new Map(plane2.items.map((e) => [e.item, e]));
|
|
26258
|
-
|
|
26392
|
+
const mats = shared2.mats;
|
|
26393
|
+
IV.mats = { plain: mats.plain, metal: shared2.mats.metal, wood: shared2.mats.wood, glass: shared2.mats.glass, fabric: shared2.mats.fabric, plant: shared2.mats.plant, water: shared2.mats.water, emissive: shared2.mats.emissive, atlas_picture: shared2.mats.picture, atlas_floor: shared2.mats.floor };
|
|
26259
26394
|
const ev = (e) => ivEvent(h, e);
|
|
26260
|
-
const world = IV.world = A.createWorld(
|
|
26395
|
+
const world = IV.world = A.createWorld(source, { water, seed: r.seed, onEvent: ev });
|
|
26261
26396
|
const add0 = world.add;
|
|
26262
26397
|
world.add = (id, spec, tr) => {
|
|
26263
26398
|
const e = entById.get(id);
|
|
@@ -26274,7 +26409,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26274
26409
|
}
|
|
26275
26410
|
return add0(id, spec, tr);
|
|
26276
26411
|
};
|
|
26277
|
-
const added = A.add(world, plane2, { isBlocked: A.blockedOf(
|
|
26412
|
+
const added = A.add(world, plane2, { isBlocked: A.blockedOf(source), build: (type, item) => ivDraw(IV, entByItem.get(item), type, item) });
|
|
26278
26413
|
world.add = add0;
|
|
26279
26414
|
IV.warnings = added.warnings;
|
|
26280
26415
|
IV.added = added;
|
|
@@ -26321,14 +26456,15 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26321
26456
|
}
|
|
26322
26457
|
function ivDraw(IV, ent, type, item) {
|
|
26323
26458
|
const ik = IV.k, loc = Object.assign({}, item, { x: 0, z: 0, ry: 0 });
|
|
26459
|
+
const ix = item.x, iz = item.z, iry = item.ry;
|
|
26324
26460
|
const mesh2 = ik.gfx.createMeshApi({ quality: "game", materials: IV.mats, shadows: true, mergeParts: true, swayAmplitude: 0.03 });
|
|
26325
26461
|
const spec = ik.A.household.build(type, loc, mesh2.api);
|
|
26326
26462
|
const out = mesh2.finish(spec);
|
|
26327
26463
|
for (const l of out.lights) l.removeFromParent();
|
|
26328
26464
|
const group = ivGroup(ent), g0 = cursor.group, root = new THREE.Group();
|
|
26329
26465
|
root.name = "iv:" + ent.id;
|
|
26330
|
-
root.position.set(
|
|
26331
|
-
root.rotation.y =
|
|
26466
|
+
root.position.set(ix, ent.floorY, iz);
|
|
26467
|
+
root.rotation.y = iry;
|
|
26332
26468
|
root.userData.iv = ent.id;
|
|
26333
26469
|
const screen = spec.devices && spec.devices.some((d) => d.kind === "screen");
|
|
26334
26470
|
let body = null;
|
|
@@ -26337,7 +26473,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26337
26473
|
if (type === "gas_bottle") {
|
|
26338
26474
|
cursor.pc = pieceRecord("gas_cylinder:" + ent.id, "steel", null, { floor: ent.floor, mass: 11, form: "cyl", thickness: 3e-3, fill: 0.03, contains: { fluid: "gas", liters: 13, pressurized: true }, explodes: { energy: 12e4, radius: 5, atC: 300 }, tags: ["gas_bottle"] });
|
|
26339
26475
|
for (const m of out.group.children) if (!m.name.startsWith("static:")) m.traverse((o) => {
|
|
26340
|
-
if (o
|
|
26476
|
+
if (isMesh(o)) {
|
|
26341
26477
|
o.userData.destructionPart = cursor.pc.id;
|
|
26342
26478
|
o.userData.destructionMaterial = "steel";
|
|
26343
26479
|
}
|
|
@@ -26345,13 +26481,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26345
26481
|
}
|
|
26346
26482
|
try {
|
|
26347
26483
|
for (const m of out.group.children.slice()) {
|
|
26348
|
-
if (m
|
|
26484
|
+
if (isMesh(m) && m.name.startsWith("static:")) {
|
|
26349
26485
|
if (screen && m.userData.material === "emissive") {
|
|
26350
26486
|
body = m;
|
|
26351
26487
|
root.add(m);
|
|
26352
26488
|
continue;
|
|
26353
26489
|
}
|
|
26354
|
-
ivAccumulate(IV_MATERIAL[m.userData.material] || "plain", m.geometry,
|
|
26490
|
+
ivAccumulate(IV_MATERIAL[m.userData.material] || "plain", m.geometry, ix, ent.floorY, iz, iry, null);
|
|
26355
26491
|
m.geometry.dispose();
|
|
26356
26492
|
} else root.add(m);
|
|
26357
26493
|
}
|
|
@@ -26361,7 +26497,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26361
26497
|
}
|
|
26362
26498
|
const base = new Set(Object.values(IV.mats));
|
|
26363
26499
|
root.traverse((o) => {
|
|
26364
|
-
if (!o
|
|
26500
|
+
if (!isMesh(o)) return;
|
|
26365
26501
|
o.userData.iv = ent.id;
|
|
26366
26502
|
if (o.castShadow) {
|
|
26367
26503
|
if (!o.geometry.boundingSphere) o.geometry.computeBoundingSphere();
|
|
@@ -26372,7 +26508,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26372
26508
|
roomLightMask(m);
|
|
26373
26509
|
}
|
|
26374
26510
|
});
|
|
26375
|
-
const E = { id: ent.id, type, entry: ent, floor: ent.floor, group, root, parts: out.parts, spec, screen: body, pos: [
|
|
26511
|
+
const E = { id: ent.id, type, entry: ent, floor: ent.floor, group, root, parts: out.parts, spec, screen: body, pos: [ix, ent.floorY, iz], ry: iry, origin: ent.origin };
|
|
26376
26512
|
IV.entries.set(ent.id, E);
|
|
26377
26513
|
if (root.children.length) IV.roots.push(E);
|
|
26378
26514
|
return spec;
|
|
@@ -26400,7 +26536,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26400
26536
|
const wire = (spec.wires || []).find((x) => x.id === d.id + "_cord"), pts = (wire ? wire.points : [d.plug]).map((p) => wl(o, p));
|
|
26401
26537
|
const sid = w.power.pluggedInto(E.id, d.id);
|
|
26402
26538
|
if (sid) {
|
|
26403
|
-
const cut = sid.indexOf(":"), so = w.get(sid.slice(0, cut)), sk = so && so.spec.sockets.find((s) => s.id === sid.slice(cut + 1));
|
|
26539
|
+
const cut = sid.indexOf(":"), so = w.get(sid.slice(0, cut)), sk = so && (so.spec.sockets || []).find((s) => s.id === sid.slice(cut + 1));
|
|
26404
26540
|
if (so && sk) {
|
|
26405
26541
|
const sp = wl(so, sk.pos), dir = [Math.sin(so.transform.ry), Math.cos(so.transform.ry)], last = pts[pts.length - 1];
|
|
26406
26542
|
if (last[1] < 0.3 + E.pos[1]) {
|
|
@@ -26435,9 +26571,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26435
26571
|
roomLightMask(sc.material);
|
|
26436
26572
|
IV.screens.set(E.id, sc);
|
|
26437
26573
|
}
|
|
26438
|
-
|
|
26439
|
-
|
|
26440
|
-
|
|
26574
|
+
const mesh2 = E.screen;
|
|
26575
|
+
mesh2.material = sc.material;
|
|
26576
|
+
mesh2.castShadow = false;
|
|
26577
|
+
mesh2.receiveShadow = false;
|
|
26441
26578
|
}
|
|
26442
26579
|
function ivEvent(h, e) {
|
|
26443
26580
|
const IV = h.IV;
|
|
@@ -26473,16 +26610,17 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26473
26610
|
IV.itemsDirty = true;
|
|
26474
26611
|
break;
|
|
26475
26612
|
}
|
|
26476
|
-
|
|
26613
|
+
const ik = K.IVK;
|
|
26614
|
+
if (ik.onEvent) {
|
|
26477
26615
|
try {
|
|
26478
|
-
|
|
26616
|
+
ik.onEvent(e, IV.pub);
|
|
26479
26617
|
} catch (err) {
|
|
26480
26618
|
console.warn("interactables.onEvent", err);
|
|
26481
26619
|
}
|
|
26482
26620
|
}
|
|
26483
|
-
if (e.type === "seat" &&
|
|
26621
|
+
if (e.type === "seat" && ik.onSeat && e.actor === "player") {
|
|
26484
26622
|
try {
|
|
26485
|
-
|
|
26623
|
+
ik.onSeat(e.seated ? ivSeat(IV) : null, e);
|
|
26486
26624
|
} catch (err) {
|
|
26487
26625
|
console.warn("interactables.onSeat", err);
|
|
26488
26626
|
}
|
|
@@ -26491,7 +26629,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26491
26629
|
function ivSeat(IV) {
|
|
26492
26630
|
const w = IV.world, s = w.seatOf("player");
|
|
26493
26631
|
if (!s) return null;
|
|
26494
|
-
const o = w.get(s.object), seat = o.spec.seats.find((q) => q.id === s.seat), L = IV.k.GI.localToWorld, tr = o.transform, E = IV.entries.get(s.object);
|
|
26632
|
+
const o = w.get(s.object), seat = (o.spec.seats || []).find((q) => q.id === s.seat), L = IV.k.GI.localToWorld, tr = o.transform, E = IV.entries.get(s.object);
|
|
26495
26633
|
const eye = L(tr, [seat.pos[0], seat.pos[1] + (seat.eye === void 0 ? seat.pose === "lie" ? 0.18 : 0.62 : seat.eye), seat.pos[2]]);
|
|
26496
26634
|
return { object: s.object, seatInfo: s.seat, pose: seat.pose, eye, yaw: tr.ry + seat.ry, pitch: seat.pose === "lie" ? 0.55 : -0.08, exitPoint: L(tr, seat.exit), floor: E ? E.floor : 0, type: E ? E.type : null };
|
|
26497
26635
|
}
|
|
@@ -26533,18 +26671,19 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26533
26671
|
}
|
|
26534
26672
|
}
|
|
26535
26673
|
const em = w.emitters();
|
|
26536
|
-
|
|
26674
|
+
const ivk = K.IVK;
|
|
26675
|
+
if (em.length && !IV.efx && ivk.effects) {
|
|
26537
26676
|
const g = h.houseGroup;
|
|
26538
|
-
IV.efx = ik.gfx.createEffects(g, { maxParticles: 1400, seed: 11, document: DOC, ...
|
|
26677
|
+
IV.efx = ik.gfx.createEffects(g, { maxParticles: 1400, seed: 11, document: DOC, ...ivk.effectSink ? { effects: ivk.effectSink } : {} });
|
|
26539
26678
|
}
|
|
26540
26679
|
if (IV.efx) {
|
|
26541
26680
|
const alive = IV.efx.stats().alive;
|
|
26542
26681
|
if (em.length || alive) {
|
|
26543
|
-
IV.efx.update(dt, em,
|
|
26682
|
+
IV.efx.update(dt, em, ivk.camera ? typeof ivk.camera === "function" ? ivk.camera() : ivk.camera : void 0);
|
|
26544
26683
|
invalidate();
|
|
26545
26684
|
}
|
|
26546
26685
|
}
|
|
26547
|
-
if (
|
|
26686
|
+
if (ivk.items && IV.itemsDirty && IV.t - IV.itemsT > 0.1 && !IV.anim.size) ivItems(IV, h);
|
|
26548
26687
|
}
|
|
26549
26688
|
const IV_SHAPE = {
|
|
26550
26689
|
can: [["cyl", 1, 1, 1, 0, 1]],
|
|
@@ -26579,7 +26718,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26579
26718
|
if (c.access && w.partT(E.id, c.access) < 0.02) continue;
|
|
26580
26719
|
const st = w.contents(E.id, c.id);
|
|
26581
26720
|
for (let i = 0; i < st.length; i++) {
|
|
26582
|
-
|
|
26721
|
+
const stack = st[i];
|
|
26722
|
+
if (stack && items[stack.type]) list2.push([E, c.id, i, items[stack.type]]);
|
|
26583
26723
|
}
|
|
26584
26724
|
}
|
|
26585
26725
|
}
|
|
@@ -26608,12 +26748,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26608
26748
|
gm.setIndex(new THREE.BufferAttribute(A.i.slice(0, A.ni), 1));
|
|
26609
26749
|
gm.computeBoundingSphere();
|
|
26610
26750
|
if (!IV.items) {
|
|
26611
|
-
|
|
26612
|
-
IV.items
|
|
26613
|
-
|
|
26614
|
-
|
|
26615
|
-
|
|
26616
|
-
|
|
26751
|
+
const mesh2 = new THREE.Mesh(gm, shared2.mats.plain);
|
|
26752
|
+
IV.items = mesh2;
|
|
26753
|
+
mesh2.name = "iv-items";
|
|
26754
|
+
mesh2.castShadow = false;
|
|
26755
|
+
mesh2.receiveShadow = true;
|
|
26756
|
+
mesh2.frustumCulled = false;
|
|
26757
|
+
h.houseGroup.add(mesh2);
|
|
26617
26758
|
} else {
|
|
26618
26759
|
IV.items.geometry.dispose();
|
|
26619
26760
|
IV.items.geometry = gm;
|
|
@@ -26747,7 +26888,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26747
26888
|
};
|
|
26748
26889
|
return IV.pub;
|
|
26749
26890
|
}
|
|
26750
|
-
|
|
26891
|
+
const defined = { IV_MATERIAL, IV_WIRE, IV_DOOR, ivGroup, ivAccumulate, ivBuild, ivRoomEffective, ivDraw, ivCords, ivAssemble, ivScreen, ivEvent, ivSeat, ivUpdate, IV_SHAPE, ivItems, ivTarget, ivRoomLight, ivParts, ivDispose, ivPublish };
|
|
26892
|
+
Object.assign(K, defined);
|
|
26751
26893
|
}
|
|
26752
26894
|
function installAnimationClotheslines(K, shared2) {
|
|
26753
26895
|
const { invalidate, CLOTHES_UNIFORMS } = K;
|
|
@@ -26770,7 +26912,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26770
26912
|
}
|
|
26771
26913
|
invalidate();
|
|
26772
26914
|
}
|
|
26773
|
-
|
|
26915
|
+
const defined = { WIND, animateClotheslines };
|
|
26916
|
+
Object.assign(K, defined);
|
|
26774
26917
|
}
|
|
26775
26918
|
function installBuildInstance(K, shared2) {
|
|
26776
26919
|
const { PROPS, THREE, DOC, cfg, HP, createInteractiveMaterials, createMaterials, typeTable } = K;
|
|
@@ -26793,7 +26936,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26793
26936
|
shared2.quality = h.quality;
|
|
26794
26937
|
}
|
|
26795
26938
|
const tagDamage = (type) => ({ type, hp: HP[type], hpMax: HP[type] });
|
|
26796
|
-
|
|
26939
|
+
const defined = { props, TYPES, newState, enter, tagDamage };
|
|
26940
|
+
Object.assign(K, defined);
|
|
26797
26941
|
}
|
|
26798
26942
|
function installInteractablesKit(K, shared2) {
|
|
26799
26943
|
const { t, THREE, DOC, cfg, Reflector } = K;
|
|
@@ -26819,15 +26963,18 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26819
26963
|
for (const k of ["wood", "foliage", "flowers", "fruit", "spines"]) roomLightMask(m[k]);
|
|
26820
26964
|
return m;
|
|
26821
26965
|
})());
|
|
26822
|
-
|
|
26966
|
+
const defined = { IVK, VEG, vegMaterials };
|
|
26967
|
+
Object.assign(K, defined);
|
|
26823
26968
|
}
|
|
26969
|
+
var newGroup = (k, house, exterior) => ({ k, house, ls: [], exterior, pos: [0, 0, 0], color: 0, n: 0, range: 0, rects: [], y: [0, 0], exclusion: null, lumens: 0, dist: 0, decay: 0, floor: 0, roomId: null, dm: 0, d: 0 });
|
|
26824
26970
|
function installLightsRoomLight(K, shared2) {
|
|
26825
26971
|
const { THREE, rectsOf: rectsOf2, cfg } = K;
|
|
26826
26972
|
const MAX_LIGHTS = 12, EMPTY = [1e9, 1e9, -1e9, -1e9];
|
|
26827
26973
|
const LZU = { uRB0: { value: new Float32Array(MAX_LIGHTS * 4) }, uRB1: { value: new Float32Array(MAX_LIGHTS * 4) }, uRB2: { value: new Float32Array(MAX_LIGHTS * 4) }, uRBY: { value: new Float32Array(MAX_LIGHTS * 2) }, uREx: { value: new Float32Array(MAX_LIGHTS * 4) }, uIndK: { value: 0.06 } };
|
|
26828
26974
|
for (let i = 0; i < MAX_LIGHTS; i++) for (const k of ["uRB0", "uRB1", "uRB2", "uREx"]) LZU[k].value.set(EMPTY, i * 4);
|
|
26829
|
-
function roomLightMask(
|
|
26830
|
-
|
|
26975
|
+
function roomLightMask(material) {
|
|
26976
|
+
const m = material;
|
|
26977
|
+
if (!m || m.userData && m.userData.roomLightMask || !(m.isMeshLambertMaterial || m.isMeshPhongMaterial || m.isMeshStandardMaterial || m.isMeshPhysicalMaterial)) return material;
|
|
26831
26978
|
m.userData = m.userData || {};
|
|
26832
26979
|
m.userData.roomLightMask = true;
|
|
26833
26980
|
const prev = m.onBeforeCompile, pk = m.customProgramCacheKey;
|
|
@@ -26855,12 +27002,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26855
27002
|
return (pk ? pk.call(this) : "") + "|rm1";
|
|
26856
27003
|
};
|
|
26857
27004
|
m.needsUpdate = true;
|
|
26858
|
-
return
|
|
27005
|
+
return material;
|
|
26859
27006
|
}
|
|
26860
|
-
function lighting(
|
|
26861
|
-
o =
|
|
27007
|
+
function lighting(options) {
|
|
27008
|
+
const o = options || {};
|
|
26862
27009
|
const scene = o.scene, N = Math.max(1, Math.min(MAX_LIGHTS, o.n || 6)), NS = Math.max(0, Math.min(N, o.shadows != null ? o.shadows : 2)), size = o.shadowSize || 512, MAX_EXTERNAL = o.external != null ? o.external : 2;
|
|
26863
|
-
|
|
27010
|
+
const mats = shared2.mats;
|
|
27011
|
+
for (const k of Object.keys(mats)) roomLightMask(mats[k]);
|
|
26864
27012
|
const budget = o.budget, lease = budget ? budget.lease({ owner: "floorplan.rooms", point: N, shadows: NS }) : null;
|
|
26865
27013
|
if (budget && !lease) throw new Error("lighting: the LightBudget has no " + N + " free point slots (" + NS + " with shadow) for the rooms");
|
|
26866
27014
|
if (budget) for (const [key2, width] of [["uRB0", 4], ["uRB1", 4], ["uRB2", 4], ["uRBY", 2], ["uREx", 4]]) {
|
|
@@ -26911,9 +27059,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26911
27059
|
}
|
|
26912
27060
|
for (let i = 0; i < NS; i++) PL[i].shadow.needsUpdate = true;
|
|
26913
27061
|
};
|
|
26914
|
-
A.update = function(
|
|
26915
|
-
op =
|
|
26916
|
-
houses = (Array.isArray(houses) ? houses : [houses]).filter(Boolean);
|
|
27062
|
+
A.update = function(houseOrList, focus, options2) {
|
|
27063
|
+
const op = options2 || {}, houses = (Array.isArray(houseOrList) ? houseOrList : [houseOrList]).filter((h) => !!h);
|
|
26917
27064
|
_f.set(focus.x, focus.y, focus.z);
|
|
26918
27065
|
const rooms = [], exterior = [];
|
|
26919
27066
|
for (const house of houses) {
|
|
@@ -26925,7 +27072,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26925
27072
|
if (!house.lightOn(l.roomId)) continue;
|
|
26926
27073
|
const k = l.type === "outdoor" ? "ext:" + (l.id || exterior.length) : l.roomId != null ? l.roomId : l.room;
|
|
26927
27074
|
let g = by.get(k);
|
|
26928
|
-
if (!g) by.set(k, g =
|
|
27075
|
+
if (!g) by.set(k, g = newGroup(k, house, l.type === "outdoor"));
|
|
26929
27076
|
g.ls.push(l);
|
|
26930
27077
|
}
|
|
26931
27078
|
for (const g of by.values()) {
|
|
@@ -26960,9 +27107,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26960
27107
|
}
|
|
26961
27108
|
}
|
|
26962
27109
|
g.exclusion = [x0 + 0.03, z0 + 0.03, x1 - 0.03, z1 - 0.03];
|
|
26963
|
-
|
|
26964
|
-
g.
|
|
26965
|
-
g.
|
|
27110
|
+
const l0 = ls[0];
|
|
27111
|
+
g.lumens = l0.lumens != null ? l0.lumens : 3.2;
|
|
27112
|
+
g.dist = l0.dist != null ? l0.dist : 5.5;
|
|
27113
|
+
g.decay = l0.decay != null ? l0.decay : 2;
|
|
26966
27114
|
} else {
|
|
26967
27115
|
const c = house.r.rooms.find((q) => q.id === g.k);
|
|
26968
27116
|
if (!c) continue;
|
|
@@ -27063,8 +27211,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
27063
27211
|
}
|
|
27064
27212
|
const effectsByBudget = /* @__PURE__ */ new WeakMap();
|
|
27065
27213
|
const OPENING_REACH = 2.5, OPENING_SIDE = 0.6;
|
|
27066
|
-
function effectLights(
|
|
27067
|
-
o =
|
|
27214
|
+
function effectLights(options) {
|
|
27215
|
+
const o = options || {};
|
|
27068
27216
|
const budget = o.budget;
|
|
27069
27217
|
if (!budget) throw new Error("effectLights: a LightBudget is required");
|
|
27070
27218
|
const known = effectsByBudget.get(budget);
|
|
@@ -27142,7 +27290,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
27142
27290
|
const A = {
|
|
27143
27291
|
/** Once per frame, after the budget's `present`: points the mask of every lit slot that is not the house's at the rooms its light reaches. */
|
|
27144
27292
|
update(houses) {
|
|
27145
|
-
const indoors = cfg.effectLightsIndoors !== false, list2 = (Array.isArray(houses) ? houses : [houses]).filter(
|
|
27293
|
+
const indoors = cfg.effectLightsIndoors !== false, list2 = (Array.isArray(houses) ? houses : [houses]).filter((h) => !!h), cache2 = /* @__PURE__ */ new Map();
|
|
27146
27294
|
for (let at2 = 0; at2 < size; at2++) {
|
|
27147
27295
|
if (ours.has(at2)) continue;
|
|
27148
27296
|
const light = budget.group.children[at2];
|
|
@@ -27170,7 +27318,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
27170
27318
|
if (!o.ours) effectsByBudget.set(budget, A);
|
|
27171
27319
|
return A;
|
|
27172
27320
|
}
|
|
27173
|
-
|
|
27321
|
+
const defined = { MAX_LIGHTS, EMPTY, LZU, roomLightMask, lighting, effectLights };
|
|
27322
|
+
Object.assign(K, defined);
|
|
27174
27323
|
}
|
|
27175
27324
|
var NONE = { panels: [], replaced: [], supports: [] };
|
|
27176
27325
|
var MEMO = /* @__PURE__ */ new WeakMap();
|
|
@@ -28347,8 +28496,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
28347
28496
|
}
|
|
28348
28497
|
function installBuildBuild(K, shared2) {
|
|
28349
28498
|
const { THREE, cfg, rectsOf: rectsOf2, invalidateShadow, colliderChanged, VERSION: VERSION2, CARS, EPS: EPS3, LIGHTS, MIRRORS, Y0, animateClotheslines, animateDoors, animateInteractive, applyLeaf, applyOutbuildings, applyPart, applyPiece, assembleInteractive, baseboardAndSidewalk, buildStairs, building, carModel, chooseMirror, closeScene, collideAt, createWater, cursor, doorText, doors, electricalStructure, elevator, floorsAndSlabs, gatesInteractive, houseItems, ivAssemble, ivBuild, ivDispose, ivParts, ivPublish, ivUpdate, lightOn, linkDoorLeaves, mailboxInteractive, newInteractiveState, newMirrorState, outbuildings, paths, perimeter, placeSwitches, roofs, roomAt, solar, targetOf, terrain, toggleDoor, toggleLight, walls, waterPipes, windows, props, TYPES, IVK, VEG, vegMaterials, markGroups, assembleStructure, createHouseDestruction, newState, enter, tagDamage } = K;
|
|
28350
|
-
function build(r0,
|
|
28351
|
-
opts =
|
|
28499
|
+
function build(r0, options) {
|
|
28500
|
+
const opts = options || {};
|
|
28352
28501
|
const r = applyOutbuildings(r0);
|
|
28353
28502
|
const t0 = performance.now();
|
|
28354
28503
|
const h = { ctx: { mv: props, types: TYPES }, inter: newInteractiveState(), state: opts.state || newState(), mirrors: newMirrorState(), quality: opts.quality === "game" || opts.quality === "high" ? opts.quality : cfg.quality === "game" ? "game" : "high", lodCurrent: 0, lodMin: 0 };
|
|
@@ -28369,7 +28518,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
28369
28518
|
shared2.ctx.pieces = /* @__PURE__ */ new Map();
|
|
28370
28519
|
shared2.ctx.pieceObjects = /* @__PURE__ */ new Map();
|
|
28371
28520
|
shared2.ctx.structureIndex = {};
|
|
28372
|
-
for (const e of r0.structure
|
|
28521
|
+
for (const e of r0.structure?.parts || []) shared2.ctx.structureIndex[e.id] = e;
|
|
28373
28522
|
{
|
|
28374
28523
|
const view = shared2.ctx.panelView = panelViewOf(r0.structure, !!cfg.destruction);
|
|
28375
28524
|
shared2.ctx.panelsOf = /* @__PURE__ */ new Map();
|
|
@@ -28381,7 +28530,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
28381
28530
|
else shared2.ctx.panelsOf.set(e.slab, [e]);
|
|
28382
28531
|
}
|
|
28383
28532
|
}
|
|
28384
|
-
shared2.ctx.panes = r0.roof
|
|
28533
|
+
shared2.ctx.panes = r0.roof?.panes || [];
|
|
28385
28534
|
shared2.ctx.noPiece = false;
|
|
28386
28535
|
cursor.separate = opts.pieces === "meshes";
|
|
28387
28536
|
cursor.pc = null;
|
|
@@ -28392,7 +28541,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
28392
28541
|
shared2.ctx.pu = Math.max(0, pr.unit != null ? pr.unit : 0);
|
|
28393
28542
|
shared2.ctx.showBuilding = shared2.ctx.apartment && (pr.showIt == null ? true : !!pr.showIt);
|
|
28394
28543
|
shared2.ctx.limits = { x0: -2, z0: -2, x1: r.w + 2, z1: r.d + 2 };
|
|
28395
|
-
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" } : { lod: 0, triangleBudget: 6e4 } } : null;
|
|
28544
|
+
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;
|
|
28396
28545
|
shared2.ctx.vegInfo = null;
|
|
28397
28546
|
terrain();
|
|
28398
28547
|
if (r.lot) {
|
|
@@ -28442,7 +28591,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
28442
28591
|
const g = gs[gd.name];
|
|
28443
28592
|
if (!g) continue;
|
|
28444
28593
|
delete gs[gd.name];
|
|
28445
|
-
g.position.
|
|
28594
|
+
g.position.fromArray(gd.pos);
|
|
28446
28595
|
parent.add(g);
|
|
28447
28596
|
fo.gs.push(g);
|
|
28448
28597
|
}
|
|
@@ -28457,7 +28606,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
28457
28606
|
root.add(house);
|
|
28458
28607
|
shared2.mirrors.house = house;
|
|
28459
28608
|
if (shared2.ctx.apartment) {
|
|
28460
|
-
const
|
|
28609
|
+
const units = r.building.units, u = units[Math.min(shared2.ctx.pu, units.length - 1)];
|
|
28461
28610
|
house.position.set(u.u, shared2.ctx.showBuilding ? 0 : -r.floors[0].y0, u.v);
|
|
28462
28611
|
house.rotation.y = u.ry;
|
|
28463
28612
|
shared2.ctx.unitRy = u.ry;
|
|
@@ -28573,7 +28722,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
28573
28722
|
const wallAt = (f, axis, L) => r.walls.find((w) => w.floor === f && w.axis === axis && Math.abs((axis === "u" ? w.v0 : w.u0) - L) < EPS3);
|
|
28574
28723
|
for (const j of r.windows) {
|
|
28575
28724
|
const alongU = j.axis === "u", y0 = Y0(j.floor), a = j.at - j.width / 2, b = j.at + j.width / 2, w = wallAt(j.floor, j.axis, j.pos), th = w ? w.thickness || 0.15 : 0.15, L = j.pos, id = "window:" + j.id;
|
|
28576
|
-
|
|
28725
|
+
const jy0 = j.y0, jy1 = j.y1;
|
|
28726
|
+
parts[id] = { id, type: "window", group: null, virtual: true, floor: j.floor, aabb: alongU ? [a, y0 + jy0, L - th / 2, b, y0 + jy1, L + th / 2] : [L - th / 2, y0 + jy0, a, L + th / 2, y0 + jy1, b], damageable: tagDamage("glass"), opens: () => {
|
|
28577
28727
|
}, t: 0 };
|
|
28578
28728
|
}
|
|
28579
28729
|
for (const E of mirrorsCopy) {
|
|
@@ -28616,7 +28766,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
28616
28766
|
const countDraw = () => {
|
|
28617
28767
|
let n = 0, t = 0;
|
|
28618
28768
|
root.traverseVisible((o) => {
|
|
28619
|
-
if (o
|
|
28769
|
+
if (isMesh(o)) {
|
|
28620
28770
|
n++;
|
|
28621
28771
|
t += (o.geometry.index ? o.geometry.index.count : o.geometry.attributes.position.count) / 3;
|
|
28622
28772
|
}
|
|
@@ -28630,8 +28780,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
28630
28780
|
const budget = opts.drawCallBudget != null ? opts.drawCallBudget : cfg.drawCallBudget;
|
|
28631
28781
|
const stats2 = { quality: h.quality, drawCalls: s0.n, drawCallsLOD1: s1.n, triangles: s0.t, trianglesLod1: s1.t, budget: budget || null, overBudget: !!budget && s0.n > budget, tBuild: performance.now() - t0 };
|
|
28632
28782
|
shared2.ctx.tBuild = stats2.tBuild;
|
|
28633
|
-
const applyLod = (
|
|
28634
|
-
n = Math.max(0, Math.min(2,
|
|
28783
|
+
const applyLod = (level) => {
|
|
28784
|
+
const n = Math.max(0, Math.min(2, level | 0));
|
|
28635
28785
|
if (n === h.lodCurrent) return;
|
|
28636
28786
|
h.lodCurrent = n;
|
|
28637
28787
|
for (const o of lodObjects) o.visible = n < 1;
|
|
@@ -28708,7 +28858,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
28708
28858
|
lights: (() => {
|
|
28709
28859
|
const by = {};
|
|
28710
28860
|
for (const l of shared2.ctx.lights) {
|
|
28711
|
-
const k = l.roomId != null ? l.roomId : l.room;
|
|
28861
|
+
const k = String(l.roomId != null ? l.roomId : l.room);
|
|
28712
28862
|
(by[k] || (by[k] = [])).push(l);
|
|
28713
28863
|
}
|
|
28714
28864
|
return { list: shared2.ctx.lights, byRoom: by };
|
|
@@ -28748,9 +28898,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
28748
28898
|
applyLod(Math.max(n, h.lodMin));
|
|
28749
28899
|
}
|
|
28750
28900
|
},
|
|
28751
|
-
show(
|
|
28901
|
+
show(options2) {
|
|
28752
28902
|
enter(h);
|
|
28753
|
-
o =
|
|
28903
|
+
const o = options2 || {};
|
|
28754
28904
|
const rr = shared2.ctx.r, nA = rr.floors.length, a = o.floor == null ? -1 : o.floor, sel = a >= nA ? -1 : a, cut = !!o.cut;
|
|
28755
28905
|
for (const [k, g] of Object.entries(gs)) {
|
|
28756
28906
|
let v = true;
|
|
@@ -28770,7 +28920,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
28770
28920
|
enter(h);
|
|
28771
28921
|
const a = targetOf(o, opt);
|
|
28772
28922
|
if (!a) return false;
|
|
28773
|
-
return actOn(a.target && a.target.pub ? a.target.pub : { id: a.target && a.target.id || a.text, type: a.target && a.target.kit ? a.target.type : "door", label: a.text, ref: a.target, _action: a.action }, a);
|
|
28923
|
+
return actOn(a.target && a.target.pub ? a.target.pub : { id: a.target && a.target.id || a.text, type: a.target && a.target.kit ? a.target.type : "door", label: a.text, ref: a.target, _action: a.action, floor: 0, pos: [], radius: 0 }, a);
|
|
28774
28924
|
},
|
|
28775
28925
|
message() {
|
|
28776
28926
|
return shared2.inter.msg && performance.now() < shared2.inter.msg.until ? shared2.inter.msg.text : null;
|
|
@@ -28827,13 +28977,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
28827
28977
|
}
|
|
28828
28978
|
return null;
|
|
28829
28979
|
},
|
|
28830
|
-
partAt(p,
|
|
28831
|
-
tol =
|
|
28980
|
+
partAt(p, tolerance) {
|
|
28981
|
+
const tol = tolerance || 0.05;
|
|
28832
28982
|
let m = null;
|
|
28833
28983
|
for (const k in parts) {
|
|
28834
|
-
const
|
|
28984
|
+
const part = parts[k], a = part.aabb;
|
|
28835
28985
|
if (a && p.x >= a[0] - tol && p.x <= a[3] + tol && p.y >= a[1] - tol && p.y <= a[4] + tol && p.z >= a[2] - tol && p.z <= a[5] + tol) {
|
|
28836
|
-
m =
|
|
28986
|
+
m = part;
|
|
28837
28987
|
break;
|
|
28838
28988
|
}
|
|
28839
28989
|
}
|
|
@@ -28844,8 +28994,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
28844
28994
|
destruction.deactivate();
|
|
28845
28995
|
if (h.IV) ivDispose(h);
|
|
28846
28996
|
root.traverse((o) => {
|
|
28847
|
-
if (o
|
|
28848
|
-
if (o.type === "Reflector" && o.dispose) o.dispose();
|
|
28997
|
+
if (isMesh(o) && o.geometry && !o.geometry.userData.shared) o.geometry.dispose();
|
|
28998
|
+
if (o.type === "Reflector" && "dispose" in o && typeof o.dispose === "function") o.dispose();
|
|
28849
28999
|
});
|
|
28850
29000
|
root.removeFromParent();
|
|
28851
29001
|
},
|
|
@@ -28853,7 +29003,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
28853
29003
|
};
|
|
28854
29004
|
return res;
|
|
28855
29005
|
}
|
|
28856
|
-
|
|
29006
|
+
const defined = { build };
|
|
29007
|
+
Object.assign(K, defined);
|
|
28857
29008
|
}
|
|
28858
29009
|
function buildApi(K, shared2) {
|
|
28859
29010
|
const { cfg, VERSION: VERSION2, ATLAS, TEX, applyPart, carGroup, carModel, props, TYPES, roomLightMask, lighting, effectLights, newState, build } = K;
|
|
@@ -28873,11 +29024,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
28873
29024
|
lighting,
|
|
28874
29025
|
effectLights,
|
|
28875
29026
|
setNight(n) {
|
|
28876
|
-
shared2.mats.glass
|
|
28877
|
-
|
|
29027
|
+
const glass = shared2.mats.glass;
|
|
29028
|
+
glass.emissive.set(n ? 9067040 : 0);
|
|
29029
|
+
glass.opacity = n ? 0.4 : 0.24;
|
|
28878
29030
|
},
|
|
28879
29031
|
/** The chipped-plaster painting of every house of this renderer as a `DeferredQueue` for a frame budget (id `floorplan.breach-paint`); asking for it changes nothing. */
|
|
28880
29032
|
deferredQueue: () => K.breachPaintQueue,
|
|
29033
|
+
/* the destruction side is typed with the breach */
|
|
28881
29034
|
cars: { model: carModel, group: carGroup, info: (k, seed) => {
|
|
28882
29035
|
const m = carModel(k, seed);
|
|
28883
29036
|
return m && { parts: m.parts.length, tris: m.tris, L: m.L, W: m.W, H: m.H };
|
|
@@ -28979,10 +29132,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
28979
29132
|
}
|
|
28980
29133
|
|
|
28981
29134
|
// ../game-floorplan-residential/dist/index.js
|
|
28982
|
-
var
|
|
29135
|
+
var __defProp3 = Object.defineProperty;
|
|
28983
29136
|
var __export2 = (target, all) => {
|
|
28984
29137
|
for (var name in all)
|
|
28985
|
-
|
|
29138
|
+
__defProp3(target, name, { get: all[name], enumerable: true });
|
|
28986
29139
|
};
|
|
28987
29140
|
var residentialItems = [
|
|
28988
29141
|
{ type: "sofa_3seat", category: "sofa", w: 2.1, d: 0.9, h: 0.85, color: { role: "fabric_main" } },
|