@chanmeng666/archlang-3d 0.8.1 → 0.9.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.
@@ -0,0 +1,251 @@
1
+ // src/materials.ts
2
+ var MATERIAL_SLOTS = [
3
+ "body",
4
+ "wood",
5
+ "wood_dark",
6
+ "fabric",
7
+ "cushion",
8
+ "linen",
9
+ "wool",
10
+ "ceramic",
11
+ "stone",
12
+ "metal",
13
+ "glass",
14
+ "appliance",
15
+ "screen",
16
+ "paint",
17
+ "rubber",
18
+ "foliage",
19
+ "bark",
20
+ "soil",
21
+ "water"
22
+ ];
23
+ var m = (srgb, roughness, metallic = 0, alpha = 1) => ({
24
+ srgb,
25
+ alpha,
26
+ metallic,
27
+ roughness
28
+ });
29
+ var PALETTE = {
30
+ wood: m("#c6a785", 0.75),
31
+ wood_dark: m("#7b5b44", 0.7),
32
+ fabric: m("#968f85", 0.95),
33
+ cushion: m("#bfb7ab", 0.95),
34
+ linen: m("#f3efe7", 0.9),
35
+ wool: m("#a7ac98", 1),
36
+ ceramic: m("#f6f4f0", 0.25),
37
+ stone: m("#d8d4cc", 0.45),
38
+ metal: m("#aeb2b4", 0.35, 1),
39
+ glass: m("#c9dee6", 0.05, 0, 0.35),
40
+ appliance: m("#dcdcd8", 0.35),
41
+ screen: m("#2e3033", 0.2),
42
+ paint: m("#a9b1a2", 0.6),
43
+ rubber: m("#3b3b3b", 0.9),
44
+ foliage: m("#8c9b78", 0.9),
45
+ bark: m("#6f5b49", 0.9),
46
+ soil: m("#5f4b3b", 1),
47
+ water: m("#a3c6d0", 0.1, 0, 0.7)
48
+ };
49
+ var STAIR_MATERIAL = "wood";
50
+ var STAIR_RAIL_MATERIAL = "wood_dark";
51
+ var DOOR_OAK = m("#c2a27e", 0.7);
52
+ var FRAME_BRONZE = m("#55534f", 0.5);
53
+ var KIND_PALETTE = {
54
+ slab: m("#bdb6ab", 0.9),
55
+ column: m("#e6e1d8", 0.85),
56
+ wall: m("#f2f0eb", 0.9),
57
+ door: DOOR_OAK,
58
+ "window:frame": FRAME_BRONZE,
59
+ "window:glass": m("#bcd6e0", 0.05, 0, 0.4),
60
+ // The trim (card RM8.6): a window's reveal in its frame's bronze, its exterior sill in the pale
61
+ // stone and its interior board in the oak of the palette; a cased opening's lining and casing in
62
+ // the doors' oak (a door's own lining and casing are `door`). Drafting defaults, ledgered once per
63
+ // Mesh3D as `trim-material-default` from `TRIM_MATERIAL`.
64
+ "window:reveal": FRAME_BRONZE,
65
+ "window:sill": PALETTE.stone,
66
+ "window:board": PALETTE.wood,
67
+ "opening:lining": DOOR_OAK,
68
+ "opening:casing": DOOR_OAK,
69
+ opening: m("#e6e1d8", 0.85),
70
+ furniture: m("#d6cec1", 0.9),
71
+ roof: m("#9c958a", 0.9),
72
+ "wall:demolish": m("#c8553d", 0.9, 0, 0.3),
73
+ // A stair (card X3): the core gives it no material, so the ledgered default (`STAIR_MATERIAL`,
74
+ // `stair-material-default`): that slot's own entry, never a second copy of its colour.
75
+ stair: PALETTE[STAIR_MATERIAL],
76
+ "stair:rail": PALETTE[STAIR_RAIL_MATERIAL]
77
+ };
78
+ var TRIM_MATERIAL = {
79
+ "door:lining": { material: "door", srgb: KIND_PALETTE.door.srgb },
80
+ "door:casing": { material: "door", srgb: KIND_PALETTE.door.srgb },
81
+ "opening:lining": { material: "opening:lining", srgb: KIND_PALETTE["opening:lining"].srgb },
82
+ "opening:casing": { material: "opening:casing", srgb: KIND_PALETTE["opening:casing"].srgb },
83
+ "window:reveal": { material: "window:reveal", srgb: KIND_PALETTE["window:reveal"].srgb },
84
+ "window:sill": { material: "window:sill", srgb: KIND_PALETTE["window:sill"].srgb },
85
+ "window:board": { material: "window:board", srgb: KIND_PALETTE["window:board"].srgb }
86
+ };
87
+ var WALL_CAP_SRGB = "#8f877d";
88
+ var FLOOR_FINISHES = [
89
+ "timber",
90
+ "tile",
91
+ "neutral",
92
+ "carpeting",
93
+ "stone",
94
+ "deck",
95
+ "paving",
96
+ "concrete"
97
+ ];
98
+ var FINISH_PALETTE = {
99
+ timber: m("#cdb596", 0.6),
100
+ tile: m("#e3e1db", 0.35),
101
+ neutral: m("#e8e2d7", 0.9),
102
+ carpeting: PALETTE.wool,
103
+ stone: PALETTE.stone,
104
+ deck: PALETTE.wood,
105
+ paving: m("#ab9f87", 0.85),
106
+ concrete: m("#c9c5be", 0.6)
107
+ };
108
+ var FLOOR_WORD_FINISH = {
109
+ tile: "tile",
110
+ paving: "paving",
111
+ deck: "deck",
112
+ concrete: "concrete",
113
+ timber: "timber",
114
+ carpeting: "carpeting",
115
+ stone: "stone"
116
+ };
117
+ function wordFinish(word) {
118
+ return word !== void 0 && Object.hasOwn(FLOOR_WORD_FINISH, word) ? FLOOR_WORD_FINISH[word] : void 0;
119
+ }
120
+ var FLOOR_FINISH_RULES = [
121
+ ["tile", ["bath", "wc", "utility"]],
122
+ ["timber", ["living", "dining", "bedroom", "office", "hall", "circulation"]],
123
+ ["tile", ["kitchen", "entry"]]
124
+ ];
125
+ function floorFinish(uses) {
126
+ for (const [finish, kinds] of FLOOR_FINISH_RULES) if (uses?.some((u) => kinds.includes(u))) return finish;
127
+ return "neutral";
128
+ }
129
+ var GROUND_TINT = {
130
+ lawn: "lawn",
131
+ planting: "lawn",
132
+ paving: "paving",
133
+ deck: "paving",
134
+ gravel: "paving",
135
+ water: "water",
136
+ driveway: "paving",
137
+ patio: "paving",
138
+ balcony: "paving",
139
+ sand: "paving",
140
+ soil: "paving"
141
+ };
142
+ var GROUND_WASH = 6;
143
+ var SITE_PALETTE = {
144
+ gravel: m("#cbc3b4", 0.95),
145
+ tarmac: m("#8c8984", 0.85),
146
+ sand: m("#dcc9a3", 0.95)
147
+ };
148
+ var GROUND_SPLITS = {
149
+ planting: PALETTE.foliage,
150
+ deck: PALETTE.wood,
151
+ gravel: SITE_PALETTE.gravel,
152
+ driveway: SITE_PALETTE.tarmac,
153
+ sand: SITE_PALETTE.sand,
154
+ soil: PALETTE.soil
155
+ };
156
+ var GROUND_ROUGHNESS = { lawn: 0.95, paving: 0.85, water: 0.1 };
157
+ var FENCE_PALETTE = {
158
+ picket: m("#eeebe4", 0.8),
159
+ panel: PALETTE.wood,
160
+ post: PALETTE.wood_dark
161
+ };
162
+ var GROUND_PLANE = { light: "#e2ddd3", dark: "#16293d", marginMm: 6e3 };
163
+ var CONTACT_SHADOW = {
164
+ wall: { of: 0.75, minMm: 80, maxMm: 200 },
165
+ furniture: { of: 0.12, minMm: 30, maxMm: 120 },
166
+ fence: { of: 1.5, minMm: 40, maxMm: 120 },
167
+ stairThicknessMm: 100,
168
+ alpha: { floor: 0.2, corner: 0.12, furniture: 0.18 },
169
+ alphaDark: { floor: 0.3, corner: 0.18, furniture: 0.27 },
170
+ liftMm: 1
171
+ };
172
+ function contactBandMm(rule, size) {
173
+ return Math.min(rule.maxMm, Math.max(rule.minMm, Math.round(rule.of * size)));
174
+ }
175
+ function siteColour(own, theme, toward) {
176
+ if (theme === "light") return own;
177
+ const mix = (i) => {
178
+ const a = Number.parseInt(own.slice(i, i + 2), 16);
179
+ const b = Number.parseInt(toward.slice(i, i + 2), 16);
180
+ return Math.round(a * 0.4 + b * 0.6).toString(16).padStart(2, "0");
181
+ };
182
+ return `#${mix(1)}${mix(3)}${mix(5)}`;
183
+ }
184
+ function linearRgb(hex) {
185
+ const ch = (i) => {
186
+ const c = Number.parseInt(hex.slice(i, i + 2), 16) / 255;
187
+ const v = c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
188
+ return Math.round(v * 1e4) / 1e4;
189
+ };
190
+ return [ch(1), ch(3), ch(5)];
191
+ }
192
+ function slotColour(slot, theme, furniture) {
193
+ const own = PALETTE[slot].srgb;
194
+ if (theme === "light") return own;
195
+ const mix = (i) => {
196
+ const a = Number.parseInt(own.slice(i, i + 2), 16);
197
+ const b = Number.parseInt(furniture.slice(i, i + 2), 16);
198
+ return Math.round(a * 0.4 + b * 0.6).toString(16).padStart(2, "0");
199
+ };
200
+ return `#${mix(1)}${mix(3)}${mix(5)}`;
201
+ }
202
+ function finishColour(finish, theme, floor) {
203
+ const own = FINISH_PALETTE[finish].srgb;
204
+ if (theme === "light") return own;
205
+ const mix = (i) => {
206
+ const a = Number.parseInt(own.slice(i, i + 2), 16);
207
+ const b = Number.parseInt(floor.slice(i, i + 2), 16);
208
+ return Math.round(a * 0.4 + b * 0.6).toString(16).padStart(2, "0");
209
+ };
210
+ return `#${mix(1)}${mix(3)}${mix(5)}`;
211
+ }
212
+ function slotGroups(shells) {
213
+ const by = /* @__PURE__ */ new Map();
214
+ for (const s of shells) {
215
+ const k = s.slot ?? "body";
216
+ const g = by.get(k);
217
+ if (g) g.push(s);
218
+ else by.set(k, [s]);
219
+ }
220
+ return MATERIAL_SLOTS.filter((k) => by.has(k)).map((slot) => ({ slot, shells: by.get(slot) }));
221
+ }
222
+
223
+ export {
224
+ MATERIAL_SLOTS,
225
+ PALETTE,
226
+ STAIR_MATERIAL,
227
+ STAIR_RAIL_MATERIAL,
228
+ KIND_PALETTE,
229
+ TRIM_MATERIAL,
230
+ WALL_CAP_SRGB,
231
+ FLOOR_FINISHES,
232
+ FINISH_PALETTE,
233
+ FLOOR_WORD_FINISH,
234
+ wordFinish,
235
+ FLOOR_FINISH_RULES,
236
+ floorFinish,
237
+ GROUND_TINT,
238
+ GROUND_WASH,
239
+ SITE_PALETTE,
240
+ GROUND_SPLITS,
241
+ GROUND_ROUGHNESS,
242
+ FENCE_PALETTE,
243
+ GROUND_PLANE,
244
+ CONTACT_SHADOW,
245
+ contactBandMm,
246
+ siteColour,
247
+ linearRgb,
248
+ slotColour,
249
+ finishColour,
250
+ slotGroups
251
+ };
@@ -0,0 +1,6 @@
1
+ // package.json
2
+ var version = "0.9.0";
3
+
4
+ export {
5
+ version
6
+ };
@@ -1,9 +1,13 @@
1
1
  import {
2
2
  C16,
3
- CONTACT_SHADOW,
4
- S16,
3
+ S16
4
+ } from "./chunk-ISFIFLC7.js";
5
+ import {
5
6
  ease
6
- } from "./chunk-LNIVDMPG.js";
7
+ } from "./chunk-EL4456GB.js";
8
+ import {
9
+ CONTACT_SHADOW
10
+ } from "./chunk-ONUOWO37.js";
7
11
 
8
12
  // src/replay/wall-lines.ts
9
13
  function takesWallLines(n) {