@chanmeng666/archlang-3d 0.1.1 → 0.2.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.
@@ -71,7 +71,7 @@ interface Wall {
71
71
  /** Ids of the openings whose cut is hosted by this wall. */
72
72
  cuts: string[];
73
73
  }
74
- type DoorKind = "hinged" | "sliding" | "barn" | "bifold" | "pocket" | "garage" | "double";
74
+ type DoorKind = "hinged" | "sliding" | "barn" | "bifold" | "pocket" | "garage" | "double" | "glazed_sliding";
75
75
  interface Opening {
76
76
  id: string;
77
77
  source: Source;
@@ -116,6 +116,13 @@ interface Furniture {
116
116
  yawDeg: number;
117
117
  /** What the mesh builds it with: `t0:<family>` (a parametric generator) or `greybox`. */
118
118
  asset: string;
119
+ /**
120
+ * The piece is reflected across its own width (its `mirror`, or a reflecting `place`), as the
121
+ * core's Plan JSON says (`planToJson`'s `mirror`, a public field). Recorded only on a piece whose
122
+ * asset is handed (`T0_HANDED`): a mirror-symmetric asset is its own reflection, so the fact
123
+ * would change nothing there and is not read. Absent when the piece is not reflected.
124
+ */
125
+ mirror?: true;
119
126
  }
120
127
  interface Box {
121
128
  id: string;
@@ -204,6 +211,8 @@ type Stage = "brief" | "rooms" | "walls" | "openings" | "fixtures" | "drafting";
204
211
  interface Shell {
205
212
  positions: number[];
206
213
  indices: number[];
214
+ /** A T0 part's material slot (`materials.ts`); absent = `body`, the node kind's own colour. */
215
+ slot?: Exclude<MaterialSlot, "body">;
207
216
  }
208
217
  type NodeKind = "slab" | "floor" | "column" | "wall" | "door" | "window" | "opening" | "furniture" | "roof";
209
218
  interface MeshNode {
@@ -232,6 +241,98 @@ interface Mesh3D {
232
241
  nodes: MeshNode[];
233
242
  }
234
243
 
244
+ /**
245
+ * Material slots (visual-assets card V1): the ONE palette both the GLB writer (`glb/write.ts`) and
246
+ * the replay viewer (`replay/mount.ts`) read, so a piece's oak or ceramic is the same colour in
247
+ * both. A T0 part names its slot (`Part.mat`, `mesh/t0.ts`); its shell carries it (`Shell.slot`);
248
+ * a node with slotted shells is still ONE node under its key (`furniture:<id>`), drawn as one
249
+ * primitive (GLB, material `fixture:<slot>`) or one mesh (viewer) per slot.
250
+ *
251
+ * `body` is the untagged part: it carries no slot and keeps its kind's own colour, so a piece that
252
+ * names no slot is drawn exactly as before. Browser-safe and pure: no clock, no random source.
253
+ */
254
+
255
+ /** The closed set of slots, in the order a node's primitives (GLB) and meshes (viewer) are written. */
256
+ declare const MATERIAL_SLOTS: readonly ["body", "wood", "wood_dark", "fabric", "cushion", "linen", "wool", "ceramic", "stone", "metal", "glass", "appliance", "screen", "paint", "rubber", "foliage", "bark", "soil", "water"];
257
+ type MaterialSlot = (typeof MATERIAL_SLOTS)[number];
258
+ interface SlotMaterial {
259
+ /** Base colour, sRGB `#rrggbb`: the viewer's colour, and the GLB's after `linearRgb`. */
260
+ srgb: string;
261
+ /** 1 = opaque; below 1 the GLB writes `alphaMode: BLEND` and the viewer draws it translucent. */
262
+ alpha: number;
263
+ /** glTF metallic-roughness factors (the viewer's Lambert shading reads neither). */
264
+ metallic: number;
265
+ roughness: number;
266
+ }
267
+ /**
268
+ * The palette: warm and quiet, a furnished Scandinavian interior rather than a massing model —
269
+ * light oak and walnut, warm grey upholstery, off-white linen and ceramics, a pale stone worktop,
270
+ * brushed steel, a sage-grey kitchen and muted greens outdoors.
271
+ */
272
+ declare const PALETTE: Readonly<Record<Exclude<MaterialSlot, "body">, SlotMaterial>>;
273
+ /**
274
+ * The building's own materials (visual-assets V9), by Mesh3D kind, and `<kind>:<part>` where a
275
+ * part differs (a window's frame and glass, a demolished wall's ghost): the light replay's colours
276
+ * and, through `linearRgb`, the GLB's. Soft daylight on a refined model: warm-white walls on a
277
+ * warm-grey concrete slab, oak doors, slim dark-bronze window frames, pale glass. A floor takes its
278
+ * finish's colour (`FINISH_PALETTE`), never a kind colour.
279
+ */
280
+ declare const KIND_PALETTE: {
281
+ readonly slab: SlotMaterial;
282
+ readonly column: SlotMaterial;
283
+ readonly wall: SlotMaterial;
284
+ readonly door: SlotMaterial;
285
+ readonly "window:frame": SlotMaterial;
286
+ readonly "window:glass": SlotMaterial;
287
+ readonly opening: SlotMaterial;
288
+ readonly furniture: SlotMaterial;
289
+ readonly roof: SlotMaterial;
290
+ readonly "wall:demolish": SlotMaterial;
291
+ };
292
+ type KindMaterial = keyof typeof KIND_PALETTE;
293
+ /**
294
+ * The replay's colour for a wall's cut top (its cap, the faces at its full height): the poché of a
295
+ * plan, read as the section through a model whose roof is lifted off. A display convention of the
296
+ * viewer, not a material: the GLB has no cap.
297
+ */
298
+ declare const WALL_CAP_SRGB = "#8f877d";
299
+ /** The floor finishes a room's floor is laid in (visual-assets V9): colour only, no texture. */
300
+ declare const FLOOR_FINISHES: readonly ["timber", "tile", "neutral"];
301
+ type FloorFinish = (typeof FLOOR_FINISHES)[number];
302
+ /** Light oak boards, pale stone tile, and the neutral finish a room whose use is unknown keeps. */
303
+ declare const FINISH_PALETTE: Readonly<Record<FloorFinish, SlotMaterial>>;
304
+ /**
305
+ * A room's floor finish from its declared `uses` (the core's use kinds, read off the plan by
306
+ * `adaptPlan`), first rule that names one of them: a wet room is tiled whatever else it is (`bath
307
+ * wc`, `utility wc`); a room lived in, slept or worked in, or walked through is timber (an open
308
+ * `living kitchen` keeps its boards); a kitchen or an entry on its own is tiled; anything else (a
309
+ * garage, a store, a room without `uses`) keeps the neutral finish. A drafting default, ledgered per
310
+ * floor as `floor-finish-default` (ADR 0030 decision 5); never read from a label.
311
+ */
312
+ declare const FLOOR_FINISH_RULES: ReadonlyArray<readonly [FloorFinish, readonly string[]]>;
313
+ /** The finish {@link FLOOR_FINISH_RULES} gives a room with these `uses`. */
314
+ declare function floorFinish(uses: readonly string[] | undefined): FloorFinish;
315
+ /** sRGB `#rrggbb` → linear RGB, each channel rounded to 4 decimals (glTF base colours are linear). */
316
+ declare function linearRgb(hex: string): [number, number, number];
317
+ /**
318
+ * A slot's viewer colour under a replay theme: the palette itself on the light theme; on the dark
319
+ * (blueprint) theme, 60% of the way from the palette to the theme's furniture colour, so materials
320
+ * stay told apart without leaving the theme. Each channel is one float multiply-add of 0–255
321
+ * integers, rounded to a whole channel value: basic IEEE-754 operations, correctly rounded in
322
+ * every engine, so every engine agrees.
323
+ */
324
+ declare function slotColour(slot: Exclude<MaterialSlot, "body">, theme: "light" | "dark", furniture: string): string;
325
+ /**
326
+ * A floor finish's viewer colour under a replay theme: the finish itself on the light theme; on the
327
+ * dark one, 60% of the way to the theme's floor colour (the same arithmetic as `slotColour`).
328
+ */
329
+ declare function finishColour(finish: FloorFinish, theme: "light" | "dark", floor: string): string;
330
+ /** A node's shells grouped by slot, in `MATERIAL_SLOTS` order (untagged `body` first). */
331
+ declare function slotGroups(shells: readonly Shell[]): Array<{
332
+ slot: MaterialSlot;
333
+ shells: Shell[];
334
+ }>;
335
+
235
336
  /**
236
337
  * The replay as a pure function of time (card A3; archlang-3d plan §6.5; decision D3). The plan
237
338
  * draws itself in its authoring order, then rises:
@@ -430,4 +531,4 @@ interface StripItem {
430
531
  */
431
532
  declare function stripAt(facts: ReplayFacts, events: readonly ReplayEvent[], t: number): StripItem[];
432
533
 
433
- export { type Assumption as A, stateAt as B, storeysOf as C, type DoorKind as D, EXPLODE_GAP_MM as E, type Floor as F, timeline as G, viewLabel as H, viewMesh as I, type Level as L, type Mesh3D as M, type NodeKind as N, type Opening as O, type Polygon as P, type ReplayFacts as R, type StripItem as S, type Um as U, type Wall as W, type Scene3D as a, type Pt as b, type Shell as c, type Ring3 as d, type Furniture as e, type ReplayEvent as f, type ReplayState as g, FIXTURE_FAMILIES as h, type Fence as i, type MeshNode as j, type Meta as k, type NodeState as l, type Outdoor as m, PHASE as n, type Provenance as o, type ReplayView as p, type Roof as q, STOP_LEAD as r, stripAt as s, type Source as t, type Stage as u, type Stair as v, authoringOrder as w, ease as x, explodeLifts as y, keyFrames as z };
534
+ export { slotColour as $, type Assumption as A, STOP_LEAD as B, type SlotMaterial as C, type DoorKind as D, EXPLODE_GAP_MM as E, type Floor as F, type Source as G, type Stage as H, type Stair as I, type Wall as J, KIND_PALETTE as K, type Level as L, type Mesh3D as M, type NodeKind as N, type Opening as O, type Polygon as P, authoringOrder as Q, type ReplayFacts as R, type StripItem as S, ease as T, type Um as U, explodeLifts as V, WALL_CAP_SRGB as W, finishColour as X, floorFinish as Y, keyFrames as Z, linearRgb as _, type Scene3D as a, slotGroups as a0, stateAt as a1, storeysOf as a2, timeline as a3, viewLabel as a4, viewMesh as a5, type Pt as b, type Shell as c, type Ring3 as d, type MaterialSlot as e, type Furniture as f, type ReplayEvent as g, type ReplayState as h, FINISH_PALETTE as i, FIXTURE_FAMILIES as j, FLOOR_FINISHES as k, FLOOR_FINISH_RULES as l, type Fence as m, type FloorFinish as n, type KindMaterial as o, MATERIAL_SLOTS as p, type MeshNode as q, type Meta as r, stripAt as s, type NodeState as t, type Outdoor as u, PALETTE as v, PHASE as w, type Provenance as x, type ReplayView as y, type Roof as z };