@chanmeng666/archlang-3d 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +77 -0
- package/README.md +14 -3
- package/dist/browser.d.ts +94 -6
- package/dist/browser.js +282 -31
- package/dist/camera-DVOiag0F.d.ts +227 -0
- package/dist/{chunk-VUSBWX7N.js → chunk-EG7UT2HG.js} +50 -5
- package/dist/{chunk-EYEEIS4R.js → chunk-EQBMPXB5.js} +65 -5
- package/dist/chunk-KF5ME6KH.js +143 -0
- package/dist/{chunk-KUK6ARJC.js → chunk-RPGAMA3G.js} +23 -13
- package/dist/{chunk-4AF5Q7M3.js → chunk-VS4OAVPD.js} +278 -22
- package/dist/cli.js +6 -6
- package/dist/{facts-DHuCDilh.d.ts → facts-BRIFxHL_.d.ts} +1 -1
- package/dist/index.d.ts +46 -124
- package/dist/index.js +32 -4
- package/dist/node.d.ts +6 -4
- package/dist/node.js +10 -4
- package/dist/replay.d.ts +24 -8
- package/dist/scene3d.schema.json +63 -0
- package/dist/{strip-CdTeMoHA.d.ts → strip-Nt7eJ-4E.d.ts} +151 -97
- package/dist/viewer.iife.js +177 -177
- package/package.json +3 -2
- package/dist/chunk-2ZINQMUB.js +0 -66
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ARCHLANG_3D_VERSION,
|
|
3
3
|
validateScene3D
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-EG7UT2HG.js";
|
|
5
5
|
import {
|
|
6
6
|
PREVIEW_LABEL,
|
|
7
|
+
PREVIEW_LIMITS,
|
|
8
|
+
VIEW_CONTROLS_LABEL,
|
|
7
9
|
replayPayload
|
|
8
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-KF5ME6KH.js";
|
|
9
11
|
import {
|
|
10
12
|
FINISH_PALETTE,
|
|
11
13
|
FLOOR_FINISHES,
|
|
@@ -14,7 +16,7 @@ import {
|
|
|
14
16
|
keyFrames,
|
|
15
17
|
linearRgb,
|
|
16
18
|
slotGroups
|
|
17
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-EQBMPXB5.js";
|
|
18
20
|
|
|
19
21
|
// src/node.ts
|
|
20
22
|
import { readFileSync as readFileSync2 } from "node:fs";
|
|
@@ -79,16 +81,24 @@ canvas{max-width:100%;height:auto;display:block}
|
|
|
79
81
|
#archlang-replay-strip[hidden]{display:none}
|
|
80
82
|
input[type=range]{width:min(720px,90vw)}
|
|
81
83
|
p{margin:0;font-size:12px;opacity:.8}
|
|
84
|
+
canvas:focus-visible{outline:2px solid ${fg};outline-offset:2px}
|
|
85
|
+
.archlang-views{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:6px;max-width:min(720px,90vw)}
|
|
86
|
+
.archlang-views button{font:inherit;font-size:13px;padding:2px 10px;border:1px solid ${fg};border-radius:4px;background:transparent;color:${fg};cursor:pointer}
|
|
87
|
+
.archlang-views button[aria-pressed=true]{background:${fg};color:${bg}}
|
|
88
|
+
.archlang-views-storeys{display:inline-flex;align-items:center;gap:4px;margin-left:8px}
|
|
89
|
+
.archlang-views-hint{flex-basis:100%;text-align:center;font-size:12px;opacity:.8}
|
|
82
90
|
</style>
|
|
83
91
|
</head>
|
|
84
92
|
<body>
|
|
85
93
|
<main>
|
|
86
94
|
<div id="archlang-replay-stage" style="width:${payload.width}px">
|
|
87
|
-
<canvas id="archlang-replay" role="
|
|
95
|
+
<canvas id="archlang-replay" role="application" aria-label="${escapeHtml(`${opts.title}: the plan drawing itself in its authoring order, then rising; ${VIEW_CONTROLS_LABEL}`)}"></canvas>${payload.facts ? `
|
|
88
96
|
<div id="archlang-replay-strip" role="group" aria-label="Plan facts" hidden></div>` : ""}
|
|
89
97
|
</div>
|
|
90
98
|
<input id="archlang-replay-t" type="range" min="0" max="1" step="0.001" value="0" aria-label="Replay position">
|
|
99
|
+
<div id="archlang-replay-views"></div>
|
|
91
100
|
<p>${escapeHtml(PREVIEW_LABEL)}</p>
|
|
101
|
+
<p>${escapeHtml(PREVIEW_LIMITS)}</p>
|
|
92
102
|
</main>
|
|
93
103
|
<script type="application/json" id="archlang-replay-payload">${json}</script>
|
|
94
104
|
<script>${script}</script>
|
|
@@ -113,20 +123,20 @@ var SWIFTSHADER_ARGS = [
|
|
|
113
123
|
];
|
|
114
124
|
|
|
115
125
|
// src/replay/video.ts
|
|
126
|
+
function seekOnly(html) {
|
|
127
|
+
return html.replace(
|
|
128
|
+
'<script type="application/json"',
|
|
129
|
+
// No scrollbar may shift the canvas between frames.
|
|
130
|
+
'<style>html,body{overflow:hidden}</style><script>window.__replayAutoplay=false</script>\n<script type="application/json"'
|
|
131
|
+
);
|
|
132
|
+
}
|
|
116
133
|
async function renderReplay(o) {
|
|
117
134
|
const fps = o.fps ?? 30;
|
|
118
135
|
const seconds = o.seconds ?? 15;
|
|
119
136
|
const frames = Math.round(fps * seconds);
|
|
120
137
|
const dir = mkdtempSync(join2(tmpdir(), "archlang3d-replay-"));
|
|
121
138
|
const file = join2(dir, "replay.html");
|
|
122
|
-
writeFileSync(
|
|
123
|
-
file,
|
|
124
|
-
o.html.replace(
|
|
125
|
-
'<script type="application/json"',
|
|
126
|
-
// No scrollbar may shift the canvas between frames.
|
|
127
|
-
'<style>html,body{overflow:hidden}</style><script>window.__replayAutoplay=false</script>\n<script type="application/json"'
|
|
128
|
-
)
|
|
129
|
-
);
|
|
139
|
+
writeFileSync(file, seekOnly(o.html));
|
|
130
140
|
const { chromium } = await import("playwright-core");
|
|
131
141
|
const browser = await chromium.launch({ args: SWIFTSHADER_ARGS });
|
|
132
142
|
try {
|
|
@@ -175,7 +185,7 @@ async function renderReplay(o) {
|
|
|
175
185
|
"-pix_fmt",
|
|
176
186
|
"yuv420p",
|
|
177
187
|
"-crf",
|
|
178
|
-
|
|
188
|
+
String(o.crf ?? 18),
|
|
179
189
|
"-movflags",
|
|
180
190
|
"+faststart",
|
|
181
191
|
o.mp4
|
|
@@ -19,14 +19,15 @@ import {
|
|
|
19
19
|
t0Shells,
|
|
20
20
|
wallOwnership,
|
|
21
21
|
where
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-EG7UT2HG.js";
|
|
23
23
|
import {
|
|
24
|
+
STAIR_MATERIAL,
|
|
24
25
|
floorFinish
|
|
25
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-EQBMPXB5.js";
|
|
26
27
|
|
|
27
28
|
// src/adapter/adapt.ts
|
|
28
29
|
import * as core from "@chanmeng666/archlang";
|
|
29
|
-
var MIN_CORE = "1.
|
|
30
|
+
var MIN_CORE = "1.57.0";
|
|
30
31
|
var hasHanded = (storeys) => storeys.some((s) => s.ir.elements.some((e) => e.kind === "furniture" && isHandedAsset(assetFor(e.category))));
|
|
31
32
|
function mirroredIds(source, world, n) {
|
|
32
33
|
const unknown = Array.from({ length: n }, () => null);
|
|
@@ -169,6 +170,141 @@ function slabRegion(footprint, floors, ledger) {
|
|
|
169
170
|
}
|
|
170
171
|
return out;
|
|
171
172
|
}
|
|
173
|
+
var PROBE_MIN = 2;
|
|
174
|
+
var PROBE_OFF = 1;
|
|
175
|
+
function meets(a, b, c, d) {
|
|
176
|
+
const rx = b[0] - a[0];
|
|
177
|
+
const ry = b[1] - a[1];
|
|
178
|
+
const sx = d[0] - c[0];
|
|
179
|
+
const sy = d[1] - c[1];
|
|
180
|
+
const qx = c[0] - a[0];
|
|
181
|
+
const qy = c[1] - a[1];
|
|
182
|
+
const den = rx * sy - ry * sx;
|
|
183
|
+
if (den !== 0) {
|
|
184
|
+
const t = (qx * sy - qy * sx) / den;
|
|
185
|
+
const u = (qx * ry - qy * rx) / den;
|
|
186
|
+
return t >= 0 && t <= 1 && u >= 0 && u <= 1 ? [t] : [];
|
|
187
|
+
}
|
|
188
|
+
if (qx * ry - qy * rx !== 0) return [];
|
|
189
|
+
const rr = rx * rx + ry * ry;
|
|
190
|
+
return [qx * rx + qy * ry, (d[0] - a[0]) * rx + (d[1] - a[1]) * ry].map((x) => x / rr).filter((t) => t > 0 && t < 1);
|
|
191
|
+
}
|
|
192
|
+
function stretches(a, b, cutters) {
|
|
193
|
+
const len = Math.hypot(b[0] - a[0], b[1] - a[1]);
|
|
194
|
+
const ts = [0, 1, ...cutters.flatMap(([c, d]) => meets(a, b, c, d))].sort((x, y) => x - y);
|
|
195
|
+
const out = [];
|
|
196
|
+
for (let i = 1; i < ts.length; i++) {
|
|
197
|
+
const t0 = ts[i - 1];
|
|
198
|
+
const t1 = ts[i];
|
|
199
|
+
if ((t1 - t0) * len < PROBE_MIN) continue;
|
|
200
|
+
const t = (t0 + t1) / 2;
|
|
201
|
+
out.push([a[0] + (b[0] - a[0]) * t, a[1] + (b[1] - a[1]) * t]);
|
|
202
|
+
}
|
|
203
|
+
return out;
|
|
204
|
+
}
|
|
205
|
+
var edgesOf = (r) => r.map((p, i) => [p, r[(i + 1) % r.length]]);
|
|
206
|
+
function coveredBy(ring, region) {
|
|
207
|
+
if (region.length === 0 || ring.length < 3) return false;
|
|
208
|
+
const inRegion = (p) => region.some((s) => where(p, s.outer) !== false && !(s.holes ?? []).some((h) => where(p, h) === true));
|
|
209
|
+
const ringEdges = edgesOf(ring);
|
|
210
|
+
const regionEdges = region.flatMap((s) => [s.outer, ...s.holes ?? []].flatMap(edgesOf));
|
|
211
|
+
for (const [a, b] of ringEdges) {
|
|
212
|
+
if (!inRegion(a)) return false;
|
|
213
|
+
if (!stretches(a, b, regionEdges).every(inRegion)) return false;
|
|
214
|
+
}
|
|
215
|
+
for (const [a, b] of regionEdges) {
|
|
216
|
+
const len = Math.hypot(b[0] - a[0], b[1] - a[1]);
|
|
217
|
+
if (len === 0) continue;
|
|
218
|
+
const nx = -(b[1] - a[1]) / len * PROBE_OFF;
|
|
219
|
+
const ny = (b[0] - a[0]) / len * PROBE_OFF;
|
|
220
|
+
for (const m of stretches(a, b, ringEdges)) {
|
|
221
|
+
if (where(m, ring) !== true) continue;
|
|
222
|
+
if (!inRegion([m[0] + nx, m[1] + ny]) || !inRegion([m[0] - nx, m[1] - ny])) return false;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
return true;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// src/mesh/stair.ts
|
|
229
|
+
function stairRisers(flights) {
|
|
230
|
+
return flights.reduce((n, f) => n + f.treads + 1, 0);
|
|
231
|
+
}
|
|
232
|
+
function runCoordinate(f, d) {
|
|
233
|
+
const [x, y] = f.at;
|
|
234
|
+
switch (f.foot) {
|
|
235
|
+
case "bottom":
|
|
236
|
+
return y + f.size.h - d;
|
|
237
|
+
case "top":
|
|
238
|
+
return y + d;
|
|
239
|
+
case "right":
|
|
240
|
+
return x + f.size.w - d;
|
|
241
|
+
case "left":
|
|
242
|
+
return x + d;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
var alongY = (foot) => foot === "top" || foot === "bottom";
|
|
246
|
+
function sideways(section, c0, c1, runAlongY) {
|
|
247
|
+
const up = prism({ outer: section }, c0, c1);
|
|
248
|
+
if (!up) return null;
|
|
249
|
+
const positions = [];
|
|
250
|
+
for (let i = 0; i < up.positions.length; i += 3) {
|
|
251
|
+
const [u, h, v] = [up.positions[i], up.positions[i + 1], up.positions[i + 2]];
|
|
252
|
+
if (runAlongY) positions.push(h, v, u);
|
|
253
|
+
else positions.push(u, v, h);
|
|
254
|
+
}
|
|
255
|
+
const indices = [...up.indices];
|
|
256
|
+
if (!runAlongY) {
|
|
257
|
+
for (let t = 0; t < indices.length; t += 3) {
|
|
258
|
+
const b = indices[t + 1];
|
|
259
|
+
indices[t + 1] = indices[t + 2];
|
|
260
|
+
indices[t + 2] = b;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
return { positions, indices };
|
|
264
|
+
}
|
|
265
|
+
function stairSolid(stair, z0, rise) {
|
|
266
|
+
const flights = stair.flights;
|
|
267
|
+
if (!flights?.length || !(rise > 0)) return null;
|
|
268
|
+
const R = stairRisers(flights);
|
|
269
|
+
const riserTop = (k) => z0 + Math.round(rise * k / R);
|
|
270
|
+
const shells = [];
|
|
271
|
+
const landingTops = [];
|
|
272
|
+
let dropped = 0;
|
|
273
|
+
let climbed = 0;
|
|
274
|
+
flights.forEach((f, i) => {
|
|
275
|
+
const n = f.treads;
|
|
276
|
+
const yRun = alongY(f.foot);
|
|
277
|
+
const run = yRun ? f.size.h : f.size.w;
|
|
278
|
+
const [lo, extent] = yRun ? [f.at[0], f.size.w] : [f.at[1], f.size.h];
|
|
279
|
+
const width = Math.min(stair.width, extent);
|
|
280
|
+
const c0 = lo + Math.round((extent - width) / 2);
|
|
281
|
+
const c1 = c0 + width;
|
|
282
|
+
const at = (t) => runCoordinate(f, Math.round(run * t / n));
|
|
283
|
+
const section = [[at(0), z0]];
|
|
284
|
+
for (let t = 0; t < n; t++) {
|
|
285
|
+
const h = riserTop(climbed + t + 1);
|
|
286
|
+
section.push([at(t), h], [at(t + 1), h]);
|
|
287
|
+
}
|
|
288
|
+
section.push([at(n), z0]);
|
|
289
|
+
const s = sideways(section, c0, c1, yRun);
|
|
290
|
+
if (s) shells.push(s);
|
|
291
|
+
else dropped++;
|
|
292
|
+
climbed += n + 1;
|
|
293
|
+
const landing = stair.landings?.[i];
|
|
294
|
+
if (landing && i < flights.length - 1) {
|
|
295
|
+
const top = riserTop(climbed);
|
|
296
|
+
landingTops.push(top);
|
|
297
|
+
const box = prism(
|
|
298
|
+
rect(landing.at[0], landing.at[1], landing.at[0] + landing.size.w, landing.at[1] + landing.size.h),
|
|
299
|
+
z0,
|
|
300
|
+
top
|
|
301
|
+
);
|
|
302
|
+
if (box) shells.push(box);
|
|
303
|
+
else dropped++;
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
return { shells, risers: R, landingTops, top: riserTop(R - 1), dropped };
|
|
307
|
+
}
|
|
172
308
|
|
|
173
309
|
// src/mesh/build.ts
|
|
174
310
|
var MM = 1e3;
|
|
@@ -214,7 +350,8 @@ var STAGE = {
|
|
|
214
350
|
door: "openings",
|
|
215
351
|
window: "openings",
|
|
216
352
|
opening: "openings",
|
|
217
|
-
furniture: "fixtures"
|
|
353
|
+
furniture: "fixtures",
|
|
354
|
+
stair: "walls"
|
|
218
355
|
};
|
|
219
356
|
var byText = (a, b) => a < b ? -1 : a > b ? 1 : 0;
|
|
220
357
|
function along(a, b, d) {
|
|
@@ -311,7 +448,7 @@ function leafThroughWall(leaf, walls) {
|
|
|
311
448
|
}
|
|
312
449
|
return false;
|
|
313
450
|
}
|
|
314
|
-
function levelNodes(lv, ledger, defaulted, isTop, doors) {
|
|
451
|
+
function levelNodes(lv, ledger, defaulted, isTop, doors, below, above) {
|
|
315
452
|
const e = lv.elevation;
|
|
316
453
|
const out = [];
|
|
317
454
|
let holesLeftOut = 0;
|
|
@@ -388,13 +525,123 @@ function levelNodes(lv, ledger, defaulted, isTop, doors) {
|
|
|
388
525
|
}
|
|
389
526
|
);
|
|
390
527
|
});
|
|
528
|
+
const ceiling = above ? above.elevation - SLAB_MM * MM - e : 0;
|
|
529
|
+
const slabAbove = above && ceiling > 0 ? slabRegion(above.footprint, above.floors, []).flatMap((r) => lessVoids(r.outer, above.voids, "slab", [])) : [];
|
|
530
|
+
const stopped = (height, rings) => height > ceiling && ceiling > 0 && rings.every((r) => coveredBy(r, slabAbove));
|
|
531
|
+
const stopLedger = (kind, id) => {
|
|
532
|
+
ledger.push({
|
|
533
|
+
kind,
|
|
534
|
+
id,
|
|
535
|
+
field: `top_mm(L${lv.level})`,
|
|
536
|
+
value: ceiling / MM,
|
|
537
|
+
provenance: "derived",
|
|
538
|
+
rule: "stops-under-slab-above"
|
|
539
|
+
});
|
|
540
|
+
};
|
|
391
541
|
lv.columns.forEach((c, i) => {
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
542
|
+
const box = rect(c.at[0], c.at[1], c.at[0] + c.size.w, c.at[1] + c.size.h);
|
|
543
|
+
const stop = stopped(lv.storeyHeight, [box.outer]);
|
|
544
|
+
if (stop) stopLedger("column", c.id);
|
|
545
|
+
node("column", c.id, i, [prism2(box, e, e + (stop ? ceiling : lv.storeyHeight))]);
|
|
546
|
+
});
|
|
547
|
+
const climbs = [];
|
|
548
|
+
lv.stairs.forEach((s, i) => {
|
|
549
|
+
if (s.dir === "up") {
|
|
550
|
+
climbs.push({ s, order: i, rise: above ? above.elevation - e : lv.storeyHeight, from: "own" });
|
|
551
|
+
if (!above) {
|
|
552
|
+
ledger.push({
|
|
553
|
+
kind: "stair",
|
|
554
|
+
id: s.id,
|
|
555
|
+
field: "rise_mm",
|
|
556
|
+
value: lv.storeyHeight / MM,
|
|
557
|
+
provenance: "default",
|
|
558
|
+
rule: "stair-rise-storey-height"
|
|
559
|
+
});
|
|
560
|
+
}
|
|
561
|
+
} else if (!below) {
|
|
562
|
+
ledger.push({
|
|
563
|
+
kind: "stair",
|
|
564
|
+
id: s.id,
|
|
565
|
+
field: "geometry",
|
|
566
|
+
value: "omitted",
|
|
567
|
+
provenance: "default",
|
|
568
|
+
rule: "stair-down-no-storey-below"
|
|
569
|
+
});
|
|
570
|
+
}
|
|
571
|
+
});
|
|
572
|
+
(above?.stairs ?? []).forEach((s, i) => {
|
|
573
|
+
const partnered = lv.stairs.some((t) => t.id === s.id && t.dir === "up");
|
|
574
|
+
if (s.dir === "down" && !partnered && above)
|
|
575
|
+
climbs.push({ s, order: lv.stairs.length + i, rise: above.elevation - e, from: "above" });
|
|
395
576
|
});
|
|
577
|
+
const stairFloor = e + FLOOR_FINISH_MM * MM;
|
|
578
|
+
for (const { s, order, rise, from } of climbs) {
|
|
579
|
+
const solid = stairSolid(s, stairFloor, rise);
|
|
580
|
+
if (!solid) {
|
|
581
|
+
ledger.push({
|
|
582
|
+
kind: "stair",
|
|
583
|
+
id: s.id,
|
|
584
|
+
field: "geometry",
|
|
585
|
+
value: "omitted",
|
|
586
|
+
provenance: "default",
|
|
587
|
+
rule: s.flights?.length ? "stair-rise-not-positive" : "stair-no-flights"
|
|
588
|
+
});
|
|
589
|
+
continue;
|
|
590
|
+
}
|
|
591
|
+
if (!defaulted.has("stair:defaults")) {
|
|
592
|
+
defaulted.add("stair:defaults");
|
|
593
|
+
ledger.push(
|
|
594
|
+
{
|
|
595
|
+
kind: "stair",
|
|
596
|
+
field: "material",
|
|
597
|
+
value: STAIR_MATERIAL,
|
|
598
|
+
provenance: "default",
|
|
599
|
+
rule: "stair-material-default"
|
|
600
|
+
},
|
|
601
|
+
{ kind: "stair", field: "form", value: "solid", provenance: "default", rule: "stair-solid-default" }
|
|
602
|
+
);
|
|
603
|
+
}
|
|
604
|
+
ledger.push({
|
|
605
|
+
kind: "stair",
|
|
606
|
+
id: s.id,
|
|
607
|
+
field: "risers",
|
|
608
|
+
value: solid.risers,
|
|
609
|
+
provenance: "derived",
|
|
610
|
+
rule: "stair-risers-from-treads"
|
|
611
|
+
});
|
|
612
|
+
node("stair", s.id, order, [...solid.shells, ...Array.from({ length: solid.dropped }, () => null)], {
|
|
613
|
+
dir: s.dir,
|
|
614
|
+
width_mm: s.width / MM,
|
|
615
|
+
flights: s.flights?.length ?? 0,
|
|
616
|
+
risers: solid.risers,
|
|
617
|
+
rise_mm: rise / MM,
|
|
618
|
+
...from === "above" ? { from_storey_above: true } : {}
|
|
619
|
+
});
|
|
620
|
+
}
|
|
396
621
|
const openings = new Map(lv.openings.map((o) => [o.id, o]));
|
|
397
|
-
const
|
|
622
|
+
const wallHeight = new Map(
|
|
623
|
+
lv.walls.map((w) => {
|
|
624
|
+
const cut = w.cuts.flatMap((id) => {
|
|
625
|
+
const o = openings.get(id);
|
|
626
|
+
return o ? [o] : [];
|
|
627
|
+
});
|
|
628
|
+
const stop = stopped(w.height, [...w.body.map((p) => p.outer), ...cut.map((o) => o.cut)]);
|
|
629
|
+
if (!stop) return [w.id, w.height];
|
|
630
|
+
stopLedger("wall", w.id);
|
|
631
|
+
for (const o of cut.filter((x) => x.head > ceiling)) {
|
|
632
|
+
ledger.push({
|
|
633
|
+
kind: o.kind,
|
|
634
|
+
id: o.id,
|
|
635
|
+
field: `head_mm(L${lv.level})`,
|
|
636
|
+
value: ceiling / MM,
|
|
637
|
+
provenance: "derived",
|
|
638
|
+
rule: "head-at-slab-above"
|
|
639
|
+
});
|
|
640
|
+
}
|
|
641
|
+
return [w.id, ceiling];
|
|
642
|
+
})
|
|
643
|
+
);
|
|
644
|
+
const hostHeight = wallHeight;
|
|
398
645
|
const splitAt = /* @__PURE__ */ new Map();
|
|
399
646
|
for (const o of lv.openings) {
|
|
400
647
|
const h = hostHeight.get(o.host);
|
|
@@ -407,13 +654,14 @@ function levelNodes(lv, ledger, defaulted, isTop, doors) {
|
|
|
407
654
|
}
|
|
408
655
|
const splits = (p) => (splitAt.get(`${p[0]},${p[1]}`) ?? []).map((h) => e + h);
|
|
409
656
|
lv.walls.forEach((w, i) => {
|
|
410
|
-
const
|
|
657
|
+
const height = wallHeight.get(w.id) ?? w.height;
|
|
658
|
+
const top = e + height;
|
|
411
659
|
const shells = w.body.map((p) => prism2(p, e, top, splits));
|
|
412
660
|
for (const id of w.cuts) {
|
|
413
661
|
const o = openings.get(id);
|
|
414
662
|
if (!o) continue;
|
|
415
|
-
if (o.sill > 0) shells.push(prism2({ outer: o.cut }, e, e + Math.min(o.sill,
|
|
416
|
-
if (o.head <
|
|
663
|
+
if (o.sill > 0) shells.push(prism2({ outer: o.cut }, e, e + Math.min(o.sill, height)));
|
|
664
|
+
if (o.head < height) shells.push(prism2({ outer: o.cut }, e + o.head, top));
|
|
417
665
|
}
|
|
418
666
|
node("wall", w.id, i, shells, {
|
|
419
667
|
...w.category ? { category: w.category } : {},
|
|
@@ -531,6 +779,7 @@ function levelNodes(lv, ledger, defaulted, isTop, doors) {
|
|
|
531
779
|
});
|
|
532
780
|
const floorTop = e + FLOOR_FINISH_MM * MM;
|
|
533
781
|
const tallest = lv.walls.reduce((m, w) => Math.max(m, w.height), 0) || lv.storeyHeight;
|
|
782
|
+
const tallestBuilt = lv.walls.reduce((m, w) => Math.max(m, wallHeight.get(w.id) ?? w.height), 0) || lv.storeyHeight;
|
|
534
783
|
lv.furniture.forEach((f, i) => {
|
|
535
784
|
const parts = t0Shells(f, floorTop);
|
|
536
785
|
const family = parts ? f.asset.slice("t0:".length) : void 0;
|
|
@@ -588,7 +837,7 @@ function levelNodes(lv, ledger, defaulted, isTop, doors) {
|
|
|
588
837
|
rule: "furniture-mount-from-top"
|
|
589
838
|
});
|
|
590
839
|
}
|
|
591
|
-
if (floorTop + h * MM > e +
|
|
840
|
+
if (floorTop + h * MM > e + tallestBuilt) {
|
|
592
841
|
ledger.push({
|
|
593
842
|
kind: "furniture",
|
|
594
843
|
id: f.id,
|
|
@@ -598,7 +847,7 @@ function levelNodes(lv, ledger, defaulted, isTop, doors) {
|
|
|
598
847
|
rule: "furniture-hung-above-walls"
|
|
599
848
|
});
|
|
600
849
|
}
|
|
601
|
-
} else if (parts && family && floorTop + h * MM > e +
|
|
850
|
+
} else if (parts && family && floorTop + h * MM > e + tallestBuilt) {
|
|
602
851
|
ledger.push({
|
|
603
852
|
kind: "furniture",
|
|
604
853
|
id: f.id,
|
|
@@ -665,17 +914,22 @@ function buildMesh(scene, opts = {}) {
|
|
|
665
914
|
},
|
|
666
915
|
{ kind: "door", field: "leaf_mm", value: LEAF_MM, provenance: "default", rule: "door-leaf-40" },
|
|
667
916
|
{ kind: "roof", field: "thickness_mm", value: ROOF_MM, provenance: "default", rule: "roof-flat-150" },
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
917
|
+
// Narrowed by card X3 (was `m1-omits-stairs-outdoor-fences`, kind `stair`): stairs are built.
|
|
918
|
+
...["outdoor", "fence"].map(
|
|
919
|
+
(kind) => ({
|
|
920
|
+
kind,
|
|
921
|
+
field: "geometry",
|
|
922
|
+
value: "omitted",
|
|
923
|
+
provenance: "default",
|
|
924
|
+
rule: "m1-omits-outdoor-fences"
|
|
925
|
+
})
|
|
926
|
+
)
|
|
675
927
|
];
|
|
676
928
|
const defaulted = /* @__PURE__ */ new Set();
|
|
677
929
|
const top = scene.levels.length - 1;
|
|
678
|
-
const nodes = scene.levels.flatMap(
|
|
930
|
+
const nodes = scene.levels.flatMap(
|
|
931
|
+
(lv, i) => levelNodes(lv, ledger, defaulted, i === top, doors, scene.levels[i - 1], scene.levels[i + 1])
|
|
932
|
+
);
|
|
679
933
|
nodes.sort(
|
|
680
934
|
(a, b) => a.level - b.level || byText(a.kind, b.kind) || byText(a.id, b.id) || byText(a.part ?? "", b.part ?? "")
|
|
681
935
|
);
|
|
@@ -687,6 +941,8 @@ export {
|
|
|
687
941
|
adaptPlan,
|
|
688
942
|
rectsOf,
|
|
689
943
|
slabRegion,
|
|
944
|
+
stairRisers,
|
|
945
|
+
stairSolid,
|
|
690
946
|
FURNITURE_HEIGHT_MM,
|
|
691
947
|
DOOR_POSES,
|
|
692
948
|
openLeaf,
|
package/dist/cli.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
DOOR_POSES,
|
|
4
4
|
adaptPlan,
|
|
5
5
|
buildMesh
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-VS4OAVPD.js";
|
|
7
7
|
import {
|
|
8
8
|
SWIFTSHADER_ARGS,
|
|
9
9
|
checkGlb,
|
|
@@ -13,18 +13,18 @@ import {
|
|
|
13
13
|
renderReplay,
|
|
14
14
|
replayHtml,
|
|
15
15
|
writeGlb
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-RPGAMA3G.js";
|
|
17
17
|
import {
|
|
18
18
|
ARCHLANG_3D_VERSION,
|
|
19
19
|
replayFacts
|
|
20
|
-
} from "./chunk-
|
|
21
|
-
import "./chunk-
|
|
20
|
+
} from "./chunk-EG7UT2HG.js";
|
|
21
|
+
import "./chunk-KF5ME6KH.js";
|
|
22
22
|
import {
|
|
23
23
|
storeysOf,
|
|
24
24
|
timeline,
|
|
25
25
|
viewLabel,
|
|
26
26
|
viewMesh
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-EQBMPXB5.js";
|
|
28
28
|
|
|
29
29
|
// src/cli/run.ts
|
|
30
30
|
import { readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
@@ -270,7 +270,7 @@ function sceneFacts(scene, mesh) {
|
|
|
270
270
|
window: ids("window"),
|
|
271
271
|
furniture: ids("furniture"),
|
|
272
272
|
column: ids("column"),
|
|
273
|
-
stair:
|
|
273
|
+
stair: ids("stair")
|
|
274
274
|
}
|
|
275
275
|
};
|
|
276
276
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { World } from '@chanmeng666/archlang';
|
|
2
|
-
import {
|
|
2
|
+
import { B as ReplayView, R as ReplayFacts } from './strip-Nt7eJ-4E.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The metrics strip's numbers (card G4), read from the core's public `describe()` and `lint()` for
|