@kruschdev/pascal-plugin-mit-assets 0.0.0-stage → 0.1.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.
Files changed (78) hide show
  1. package/ASSETS.md +298 -0
  2. package/LICENSE +21 -0
  3. package/README.md +71 -2
  4. package/dist/agent-operations.d.ts +8 -0
  5. package/dist/agent-operations.js +305 -0
  6. package/dist/agent-tools.d.ts +7 -0
  7. package/dist/agent-tools.js +128 -0
  8. package/dist/audit.d.ts +78 -0
  9. package/dist/bin/pascal-mit-assets.js +5238 -0
  10. package/dist/bom.d.ts +123 -0
  11. package/dist/cad/appliance-mep-builders.d.ts +7 -0
  12. package/dist/cad/furniture-builders.d.ts +9 -0
  13. package/dist/cad/index.d.ts +48 -0
  14. package/dist/cad/index.js +23 -0
  15. package/dist/cad/kitchen-bath-builders.d.ts +9 -0
  16. package/dist/cad/outdoor-fenestration-builders.d.ts +8 -0
  17. package/dist/cad/primitives.d.ts +56 -0
  18. package/dist/cad/props-vehicles-builders.d.ts +8 -0
  19. package/dist/chunk-2qgndrap.js +5200 -0
  20. package/dist/chunk-6hzyh6qv.js +346 -0
  21. package/dist/chunk-f72r2bmp.js +84 -0
  22. package/dist/chunk-hqgm57dv.js +310 -0
  23. package/dist/chunk-kgwk6kan.js +150 -0
  24. package/dist/chunk-raafkn3w.js +286 -0
  25. package/dist/chunk-vzmjt9dz.js +4380 -0
  26. package/dist/chunk-xhkwv6t4.js +5080 -0
  27. package/dist/hdri/index.d.ts +1 -0
  28. package/dist/hdri/index.js +322 -0
  29. package/dist/hdri/sky.d.ts +26 -0
  30. package/dist/index.d.ts +30 -0
  31. package/dist/index.js +198 -0
  32. package/dist/manifest.d.ts +46 -0
  33. package/dist/materials/index.d.ts +10 -0
  34. package/dist/materials/index.js +1464 -0
  35. package/dist/materials/ktx2.d.ts +10 -0
  36. package/dist/materials/noise.d.ts +89 -0
  37. package/dist/materials/patterns.d.ts +15 -0
  38. package/dist/nodes/mit-item.d.ts +76 -0
  39. package/dist/render.d.ts +10 -0
  40. package/dist/render.js +24 -0
  41. package/dist/scripts/build-assets.js +17129 -0
  42. package/dist/sfx/index.d.ts +1 -0
  43. package/dist/sfx/index.js +1223 -0
  44. package/dist/sfx/synth.d.ts +25 -0
  45. package/dist/sku-crosswalk.d.ts +46 -0
  46. package/dist/ui/chat-card.d.ts +7 -0
  47. package/dist/ui/host-panel.d.ts +1 -0
  48. package/dist/ui/inspector-card.d.ts +4 -0
  49. package/dist/ui/schedule-view.d.ts +1 -0
  50. package/package.json +135 -4
  51. package/src/agent-operations.ts +373 -0
  52. package/src/agent-tools.ts +136 -0
  53. package/src/audit.ts +356 -0
  54. package/src/bom.ts +512 -0
  55. package/src/cad/appliance-mep-builders.ts +1336 -0
  56. package/src/cad/furniture-builders.ts +1622 -0
  57. package/src/cad/index.ts +993 -0
  58. package/src/cad/kitchen-bath-builders.ts +1189 -0
  59. package/src/cad/outdoor-fenestration-builders.ts +1499 -0
  60. package/src/cad/primitives.ts +286 -0
  61. package/src/cad/props-vehicles-builders.ts +1065 -0
  62. package/src/hdri/index.ts +5 -0
  63. package/src/hdri/sky.ts +481 -0
  64. package/src/index.ts +127 -0
  65. package/src/manifest.ts +5296 -0
  66. package/src/materials/index.ts +56 -0
  67. package/src/materials/ktx2.ts +138 -0
  68. package/src/materials/noise.ts +417 -0
  69. package/src/materials/patterns.ts +1507 -0
  70. package/src/nodes/mit-item.ts +163 -0
  71. package/src/render.ts +25 -0
  72. package/src/sfx/index.ts +6 -0
  73. package/src/sfx/synth.ts +1495 -0
  74. package/src/sku-crosswalk.ts +3868 -0
  75. package/src/ui/chat-card.tsx +93 -0
  76. package/src/ui/host-panel.tsx +330 -0
  77. package/src/ui/inspector-card.tsx +213 -0
  78. package/src/ui/schedule-view.tsx +188 -0
@@ -0,0 +1,1499 @@
1
+ /**
2
+ * Clean-room MIT Parametric 3D CAD Builders:
3
+ * Doors, Windows, Stairs, Columns, Fences, Outdoor Structures & Botanicals.
4
+ * Strictly Three.js + ./primitives only. Zero React, @pascal-app/*, Next, or node:* imports.
5
+ * Never caches global materials; uses only the passed MaterialPalette.
6
+ */
7
+
8
+ import * as THREE from 'three'
9
+ import {
10
+ addBox,
11
+ addCyl,
12
+ addRoundedRectExtrude,
13
+ addSphere,
14
+ addTorus,
15
+ normalizeAndGroundGroup,
16
+ type MaterialPalette,
17
+ type SlugBuilderFn,
18
+ } from './primitives'
19
+
20
+ /**
21
+ * Shared outer door jamb & casing frame helper.
22
+ */
23
+ function addDoorFrame(
24
+ g: THREE.Group,
25
+ w: number,
26
+ h: number,
27
+ d: number,
28
+ frameMat: THREE.Material,
29
+ jambW: number,
30
+ ): void {
31
+ // Left jamb, right jamb, head jamb
32
+ addBox(g, jambW, h, d, -w * 0.5 + jambW * 0.5, h * 0.5, 0, frameMat)
33
+ addBox(g, jambW, h, d, w * 0.5 - jambW * 0.5, h * 0.5, 0, frameMat)
34
+ addBox(g, w, jambW, d, 0, h - jambW * 0.5, 0, frameMat)
35
+ // Front & back decorative casing trim
36
+ const trimW = jambW * 1.35
37
+ const trimD = d * 0.14
38
+ for (const sz of [-1, 1]) {
39
+ const z = sz * (d * 0.5 + trimD * 0.35)
40
+ addBox(g, trimW, h, trimD, -w * 0.5 + jambW * 0.5, h * 0.5, z, frameMat)
41
+ addBox(g, trimW, h, trimD, w * 0.5 - jambW * 0.5, h * 0.5, z, frameMat)
42
+ addBox(g, w + trimW * 0.4, trimW, trimD, 0, h - jambW * 0.4, z, frameMat)
43
+ }
44
+ }
45
+
46
+ /**
47
+ * Shared outer rectangular window frame & sill helper.
48
+ */
49
+ function addWindowFrame(
50
+ g: THREE.Group,
51
+ w: number,
52
+ h: number,
53
+ d: number,
54
+ frameMat: THREE.Material,
55
+ sillMat: THREE.Material,
56
+ frameThick: number,
57
+ ): { innerW: number; innerH: number; centerY: number } {
58
+ // Perimeter jambs
59
+ addBox(g, frameThick, h, d * 0.86, -w * 0.5 + frameThick * 0.5, h * 0.5, 0, frameMat)
60
+ addBox(g, frameThick, h, d * 0.86, w * 0.5 - frameThick * 0.5, h * 0.5, 0, frameMat)
61
+ addBox(g, w, frameThick, d * 0.86, 0, h - frameThick * 0.5, 0, frameMat)
62
+ addBox(g, w, frameThick, d * 0.86, 0, frameThick * 0.5, 0, frameMat)
63
+ // Protruding architectural sill ledge
64
+ addBox(g, w * 1.04, frameThick * 0.72, d * 1.12, 0, frameThick * 0.36, 0, sillMat)
65
+
66
+ return {
67
+ innerW: w - frameThick * 2,
68
+ innerH: h - frameThick * 2,
69
+ centerY: h * 0.5,
70
+ }
71
+ }
72
+
73
+ /**
74
+ * Shared sash + glass + optional grid muntin builder.
75
+ */
76
+ function addWindowSash(
77
+ parent: THREE.Object3D,
78
+ sw: number,
79
+ sh: number,
80
+ sd: number,
81
+ x: number,
82
+ y: number,
83
+ z: number,
84
+ frameMat: THREE.Material,
85
+ glassMat: THREE.Material,
86
+ cols: number,
87
+ rows: number,
88
+ railThick = 0.032,
89
+ ): void {
90
+ const sash = new THREE.Group()
91
+ sash.position.set(x, y, z)
92
+ const t = Math.min(railThick, sw * 0.14, sh * 0.14)
93
+
94
+ // 4 sash rails
95
+ addBox(sash, t, sh, sd, -sw * 0.5 + t * 0.5, 0, 0, frameMat)
96
+ addBox(sash, t, sh, sd, sw * 0.5 - t * 0.5, 0, 0, frameMat)
97
+ addBox(sash, sw, t, sd, 0, sh * 0.5 - t * 0.5, 0, frameMat)
98
+ addBox(sash, sw, t, sd, 0, -sh * 0.5 + t * 0.5, 0, frameMat)
99
+
100
+ // Glazing pane
101
+ addBox(sash, Math.max(0.01, sw - t * 1.8), Math.max(0.01, sh - t * 1.8), sd * 0.22, 0, 0, 0, glassMat)
102
+
103
+ // Muntin grid dividers
104
+ const muntinT = t * 0.45
105
+ for (let c = 1; c < cols; c++) {
106
+ const mx = -sw * 0.5 + (c / cols) * sw
107
+ addBox(sash, muntinT, sh - t * 1.6, sd * 0.55, mx, 0, 0, frameMat)
108
+ }
109
+ for (let r = 1; r < rows; r++) {
110
+ const my = -sh * 0.5 + (r / rows) * sh
111
+ addBox(sash, sw - t * 1.6, muntinT, sd * 0.55, 0, my, 0, frameMat)
112
+ }
113
+
114
+ parent.add(sash)
115
+ }
116
+
117
+ // ---------------------------------------------------------------------------
118
+ // Doors & Architectural (8)
119
+ // ---------------------------------------------------------------------------
120
+
121
+ const buildDoor: SlugBuilderFn = (w, h, d, p) => {
122
+ const g = new THREE.Group()
123
+ const jambW = Math.min(0.06, w * 0.075)
124
+ addDoorFrame(g, w, h, d * 0.88, p.paintWhite, jambW)
125
+
126
+ // Main wood door leaf
127
+ const leafW = w - jambW * 2.05
128
+ const leafH = h - jambW * 1.15
129
+ const leafD = d * 0.48
130
+ addBox(g, leafW, leafH, leafD, 0, leafH * 0.5, 0, p.woodWarm)
131
+
132
+ // 6 molded recessed/raised architectural door panels on both faces
133
+ const panelRows: ReadonlyArray<readonly [number, number]> = [
134
+ [0.78, 0.16],
135
+ [0.5, 0.24],
136
+ [0.2, 0.22],
137
+ ]
138
+ for (const sz of [-1, 1]) {
139
+ for (const [yFrac, hFrac] of panelRows) {
140
+ for (const sx of [-0.23, 0.23]) {
141
+ addBox(
142
+ g,
143
+ leafW * 0.34,
144
+ leafH * hFrac,
145
+ leafD * 0.22,
146
+ sx * leafW,
147
+ leafH * yFrac,
148
+ sz * leafD * 0.48,
149
+ p.woodDark,
150
+ )
151
+ addBox(
152
+ g,
153
+ leafW * 0.28,
154
+ leafH * hFrac * 0.84,
155
+ leafD * 0.16,
156
+ sx * leafW,
157
+ leafH * yFrac,
158
+ sz * leafD * 0.56,
159
+ p.woodWarm,
160
+ )
161
+ }
162
+ }
163
+ }
164
+
165
+ // Dual chrome lever handles, rosettes & deadbolt
166
+ const handleX = leafW * 0.38
167
+ const handleY = h * 0.47
168
+ for (const sz of [-1, 1]) {
169
+ addCyl(g, 0.026, 0.026, d * 0.12, handleX, handleY, sz * leafD * 0.56, p.metalChrome, 14, [
170
+ Math.PI / 2,
171
+ 0,
172
+ 0,
173
+ ])
174
+ addBox(g, 0.12, 0.022, 0.018, handleX - 0.045, handleY, sz * (leafD * 0.56 + 0.045), p.metalChrome)
175
+ addCyl(g, 0.02, 0.02, d * 0.12, handleX, handleY + 0.1, sz * leafD * 0.55, p.metalChrome, 12, [
176
+ Math.PI / 2,
177
+ 0,
178
+ 0,
179
+ ])
180
+ }
181
+
182
+ // 3 barrel hinges on hinge jamb
183
+ for (const hy of [0.16, 0.5, 0.84]) {
184
+ addCyl(g, 0.012, 0.012, 0.09, -leafW * 0.5, h * hy, leafD * 0.45, p.metalBrushed, 10)
185
+ }
186
+
187
+ return normalizeAndGroundGroup(g, w, h, d)
188
+ }
189
+
190
+ const buildDoorBar: SlugBuilderFn = (w, h, d, p) => {
191
+ const g = new THREE.Group()
192
+ const jambW = Math.min(0.06, w * 0.07)
193
+ addDoorFrame(g, w, h, d * 0.86, p.metalDark, jambW)
194
+
195
+ // Heavy-duty steel fire-exit door leaf
196
+ const leafW = w - jambW * 2.05
197
+ const leafH = h - jambW * 1.15
198
+ const leafD = d * 0.48
199
+ addBox(g, leafW, leafH, leafD, 0, leafH * 0.5, 0, p.metalBrushed)
200
+
201
+ // Narrow vertical fire-rated vision lite window
202
+ const litX = leafW * 0.22
203
+ const litY = leafH * 0.68
204
+ addBox(g, leafW * 0.2, leafH * 0.34, leafD * 1.14, litX, litY, 0, p.metalDark)
205
+ addBox(g, leafW * 0.15, leafH * 0.3, leafD * 1.2, litX, litY, 0, p.glass)
206
+
207
+ // Horizontal stainless steel panic crash bar assembly on front (+Z)
208
+ const barY = h * 0.46
209
+ const barZ = leafD * 0.5 + d * 0.26
210
+ addBox(g, leafW * 0.11, 0.12, d * 0.34, -leafW * 0.36, barY, leafD * 0.5 + d * 0.14, p.metalDark)
211
+ addBox(g, leafW * 0.11, 0.12, d * 0.34, leafW * 0.36, barY, leafD * 0.5 + d * 0.14, p.metalDark)
212
+ addBox(g, leafW * 0.72, 0.075, d * 0.18, 0, barY, barZ, p.metalChrome)
213
+
214
+ // Exterior pull handle on reverse (-Z)
215
+ addBox(g, 0.024, 0.22, 0.05, leafW * 0.36, barY, -leafD * 0.5 - 0.03, p.metalChrome)
216
+
217
+ // Overhead hydraulic door closer + articulated arm
218
+ addBox(g, leafW * 0.28, 0.07, d * 0.35, -leafW * 0.22, leafH - 0.08, leafD * 0.5 + d * 0.14, p.metalDark)
219
+ addBox(
220
+ g,
221
+ leafW * 0.24,
222
+ 0.022,
223
+ 0.025,
224
+ -leafW * 0.12,
225
+ leafH - 0.02,
226
+ leafD * 0.5 + d * 0.24,
227
+ p.metalBrushed,
228
+ [0, 0.3, 0],
229
+ )
230
+
231
+ return normalizeAndGroundGroup(g, w, h, d)
232
+ }
233
+
234
+ const buildDoorWithBar: SlugBuilderFn = (w, h, d, p) => {
235
+ const g = new THREE.Group()
236
+ const jambW = Math.min(0.065, w * 0.075)
237
+ addDoorFrame(g, w, h, d * 0.86, p.metalDark, jambW)
238
+
239
+ // Commercial wood/composite leaf with stainless bottom kickplate
240
+ const leafW = w - jambW * 2.05
241
+ const leafH = h - jambW * 1.15
242
+ const leafD = d * 0.46
243
+ addBox(g, leafW, leafH, leafD, 0, leafH * 0.5, 0, p.woodDark)
244
+ addBox(g, leafW * 0.96, leafH * 0.14, leafD * 1.08, 0, leafH * 0.075, 0, p.metalBrushed)
245
+
246
+ // Upper half-lite security glazing
247
+ addBox(g, leafW * 0.66, leafH * 0.3, leafD * 1.12, 0, leafH * 0.74, 0, p.metalDark)
248
+ addBox(g, leafW * 0.58, leafH * 0.25, leafD * 1.18, 0, leafH * 0.74, 0, p.glass)
249
+
250
+ // Panic bar with red emergency push pad strip
251
+ const barY = h * 0.46
252
+ addBox(g, leafW * 0.1, 0.11, d * 0.32, -leafW * 0.37, barY, leafD * 0.5 + d * 0.14, p.metalDark)
253
+ addBox(g, leafW * 0.1, 0.11, d * 0.32, leafW * 0.37, barY, leafD * 0.5 + d * 0.14, p.metalDark)
254
+ addBox(g, leafW * 0.74, 0.08, d * 0.16, 0, barY, leafD * 0.5 + d * 0.26, p.metalChrome)
255
+ addBox(g, leafW * 0.56, 0.042, d * 0.06, 0, barY, leafD * 0.5 + d * 0.35, p.paintRed)
256
+
257
+ // Top closer
258
+ addBox(g, leafW * 0.26, 0.065, d * 0.3, leafW * 0.24, leafH - 0.07, leafD * 0.5 + d * 0.12, p.metalDark)
259
+
260
+ return normalizeAndGroundGroup(g, w, h, d)
261
+ }
262
+
263
+ const buildDoorwayFront: SlugBuilderFn = (w, h, d, p) => {
264
+ const g = new THREE.Group()
265
+ const pilasterW = w * 0.09
266
+ const transomH = h * 0.16
267
+
268
+ // Stone/metal exterior threshold sill
269
+ addBox(g, w, 0.055, d * 1.06, 0, 0.0275, 0, p.stoneDark)
270
+
271
+ // Fluted classical pilasters & crown header entablature
272
+ for (const sx of [-1, 1]) {
273
+ addBox(g, pilasterW, h * 0.92, d * 0.88, sx * (w * 0.5 - pilasterW * 0.5), h * 0.46, 0, p.paintWhite)
274
+ addBox(
275
+ g,
276
+ pilasterW * 1.18,
277
+ 0.09,
278
+ d * 0.98,
279
+ sx * (w * 0.5 - pilasterW * 0.5),
280
+ h * 0.91,
281
+ 0,
282
+ p.paintWhite,
283
+ )
284
+ }
285
+ addBox(g, w * 1.04, h * 0.08, d * 1.04, 0, h * 0.96, 0, p.paintWhite)
286
+
287
+ // Transom window bar & 3-lite glazed transom above door
288
+ const innerW = Math.max(0.05, w - pilasterW * 2)
289
+ const doorH = Math.max(0.08, h - transomH - h * 0.08)
290
+ const barH = Math.min(0.055, h * 0.05)
291
+ const transomClearH = Math.max(0.02, transomH - barH)
292
+ const leafH = Math.max(0.04, doorH - barH)
293
+ addBox(g, innerW, barH, d * 0.78, 0, doorH + barH * 0.5, 0, p.paintWhite)
294
+ addWindowSash(
295
+ g,
296
+ innerW,
297
+ transomClearH,
298
+ d * 0.45,
299
+ 0,
300
+ doorH + barH + transomClearH * 0.5,
301
+ 0,
302
+ p.paintWhite,
303
+ p.glass,
304
+ 3,
305
+ 1,
306
+ Math.min(0.028, transomClearH * 0.25, innerW * 0.1),
307
+ )
308
+
309
+ // Solid mahogany/dark wood entry door leaf
310
+ const leafD = d * 0.4
311
+ addBox(g, innerW * 0.96, leafH, leafD, 0, barH + leafH * 0.5, 0, p.woodDark)
312
+
313
+ // Lower raised molding panels
314
+ for (const sx of [-0.22, 0.22]) {
315
+ addBox(g, innerW * 0.34, doorH * 0.32, leafD * 1.24, sx * innerW, doorH * 0.26, 0, p.woodWarm)
316
+ }
317
+
318
+ // Upper divided-lite entry window inside door leaf
319
+ addWindowSash(g, innerW * 0.66, doorH * 0.34, leafD * 1.18, 0, doorH * 0.72, 0, p.paintWhite, p.glass, 3, 2, 0.024)
320
+
321
+ // Brass entry pull handle, thumb latch, deadbolt & mail slot
322
+ for (const sz of [-1, 1]) {
323
+ addBox(g, 0.045, 0.22, 0.024, innerW * 0.37, doorH * 0.46, sz * (leafD * 0.5 + 0.015), p.metalCopper)
324
+ addBox(g, 0.024, 0.14, 0.045, innerW * 0.37, doorH * 0.44, sz * (leafD * 0.5 + 0.045), p.metalCopper)
325
+ }
326
+ addBox(g, innerW * 0.22, 0.048, leafD * 1.18, 0, doorH * 0.46, 0, p.metalCopper)
327
+
328
+ return normalizeAndGroundGroup(g, w, h, d)
329
+ }
330
+
331
+ const buildGlassDoor: SlugBuilderFn = (w, h, d, p) => {
332
+ const g = new THREE.Group()
333
+ const jambW = Math.min(0.055, w * 0.065)
334
+ addDoorFrame(g, w, h, d * 0.88, p.metalDark, jambW)
335
+
336
+ // Bottom threshold strip
337
+ addBox(g, w, 0.03, d * 0.96, 0, 0.015, 0, p.metalBrushed)
338
+
339
+ // Full-lite French patio glass door sash (stiles, wide bottom kick rail, 2x4 grid)
340
+ const leafW = w - jambW * 2.05
341
+ const leafH = h - jambW * 1.15 - 0.03
342
+ const leafD = d * 0.44
343
+ const leafY = 0.03 + leafH * 0.5
344
+
345
+ // Bottom kick rail
346
+ addBox(g, leafW, leafH * 0.1, leafD, 0, 0.03 + leafH * 0.05, 0, p.metalDark)
347
+ // Upper full glass sash with clean French muntins
348
+ addWindowSash(
349
+ g,
350
+ leafW,
351
+ leafH * 0.9,
352
+ leafD,
353
+ 0,
354
+ leafY + leafH * 0.05,
355
+ 0,
356
+ p.metalDark,
357
+ p.glass,
358
+ 2,
359
+ 4,
360
+ 0.045,
361
+ )
362
+
363
+ // Sleek vertical stainless tubular pull handles on both faces
364
+ for (const sz of [-1, 1]) {
365
+ const hz = sz * (leafD * 0.5 + 0.045)
366
+ addCyl(g, 0.014, 0.014, 0.52, leafW * 0.38, h * 0.48, hz, p.metalChrome, 12)
367
+ addCyl(g, 0.01, 0.01, 0.05, leafW * 0.38, h * 0.48 + 0.18, sz * (leafD * 0.5 + 0.022), p.metalChrome, 10, [
368
+ Math.PI / 2,
369
+ 0,
370
+ 0,
371
+ ])
372
+ addCyl(g, 0.01, 0.01, 0.05, leafW * 0.38, h * 0.48 - 0.18, sz * (leafD * 0.5 + 0.022), p.metalChrome, 10, [
373
+ Math.PI / 2,
374
+ 0,
375
+ 0,
376
+ ])
377
+ }
378
+
379
+ return normalizeAndGroundGroup(g, w, h, d)
380
+ }
381
+
382
+ const buildColumn: SlugBuilderFn = (w, h, d, p) => {
383
+ const g = new THREE.Group()
384
+ const baseW = Math.min(w, d)
385
+ const shaftR = baseW * 0.36
386
+
387
+ // Square plinth + stepped Attic base torus moldings
388
+ addBox(g, baseW, h * 0.06, baseW, 0, h * 0.03, 0, p.stoneLight)
389
+ addTorus(g, shaftR * 1.18, baseW * 0.07, 0, h * 0.075, 0, p.stoneLight, [Math.PI / 2, 0, 0])
390
+ addCyl(g, shaftR * 1.08, shaftR * 1.15, h * 0.035, 0, h * 0.105, 0, p.stoneLight, 24)
391
+
392
+ // Tapered classical shaft with 12 vertical architectural fluting ribs
393
+ const shaftH = h * 0.78
394
+ const shaftY = h * 0.12 + shaftH * 0.5
395
+ addCyl(g, shaftR * 0.88, shaftR, shaftH, 0, shaftY, 0, p.stoneLight, 24)
396
+ for (let i = 0; i < 12; i++) {
397
+ const a = (i / 12) * Math.PI * 2
398
+ const r = shaftR * 0.94
399
+ addCyl(
400
+ g,
401
+ shaftR * 0.065,
402
+ shaftR * 0.078,
403
+ shaftH * 0.96,
404
+ Math.cos(a) * r,
405
+ shaftY,
406
+ Math.sin(a) * r,
407
+ p.ceramicMatte,
408
+ 8,
409
+ )
410
+ }
411
+
412
+ // Astragal necking ring, flared echinus bell & square abacus capital slab
413
+ addTorus(g, shaftR * 0.92, baseW * 0.045, 0, h * 0.905, 0, p.stoneLight, [Math.PI / 2, 0, 0])
414
+ addCyl(g, shaftR * 1.24, shaftR * 0.9, h * 0.045, 0, h * 0.935, 0, p.stoneLight, 24)
415
+ addBox(g, baseW, h * 0.05, baseW, 0, h * 0.975, 0, p.stoneLight)
416
+
417
+ return normalizeAndGroundGroup(g, w, h, d)
418
+ }
419
+
420
+ const buildPillar: SlugBuilderFn = (w, h, d, p) => {
421
+ const g = new THREE.Group()
422
+
423
+ // Stepped dark stone footing plinth
424
+ addBox(g, w, h * 0.12, d, 0, h * 0.06, 0, p.stoneDark)
425
+ addBox(g, w * 0.9, h * 0.06, d * 0.9, 0, h * 0.15, 0, p.stoneLight)
426
+
427
+ // Dressed masonry pier shaft with rusticated reveal course bands
428
+ const shaftH = h * 0.62
429
+ const shaftY = h * 0.18 + shaftH * 0.5
430
+ addBox(g, w * 0.78, shaftH, d * 0.78, 0, shaftY, 0, p.stoneLight)
431
+ for (let i = 0; i < 4; i++) {
432
+ const cy = h * (0.26 + i * 0.15)
433
+ addBox(g, w * 0.82, h * 0.025, d * 0.82, 0, cy, 0, p.stoneDark)
434
+ }
435
+
436
+ // Overhanging beveled coping capstone + spherical finial
437
+ addBox(g, w * 0.98, h * 0.07, d * 0.98, 0, h * 0.835, 0, p.stoneDark)
438
+ addBox(g, w * 0.76, h * 0.04, d * 0.76, 0, h * 0.89, 0, p.stoneLight)
439
+ addSphere(g, Math.min(w, d) * 0.22, 0, h * 0.95, 0, p.stoneLight, [1, 0.92, 1], 14)
440
+
441
+ return normalizeAndGroundGroup(g, w, h, d)
442
+ }
443
+
444
+ const buildStairs: SlugBuilderFn = (w, h, d, p) => {
445
+ const g = new THREE.Group()
446
+ // Ascend from front (+Z, y=0) to back (-Z, y=h) so treads & risers face forward (+Z)
447
+ const steps = 13
448
+ const railH = Math.min(0.86, h * 0.28)
449
+ const flightH = Math.max(h * 0.68, h - railH)
450
+ const stepRise = flightH / steps
451
+ const stepRun = d / steps
452
+ const treadThick = Math.min(0.048, stepRise * 0.28)
453
+ const stringerW = Math.min(0.065, w * 0.07)
454
+ const stairLen = Math.hypot(d, flightH)
455
+ const slopeAngle = Math.atan2(flightH, d)
456
+
457
+ // Twin sloped structural steel side stringers rising from +Z (y=0) to -Z (y=flightH)
458
+ for (const sx of [-1, 1]) {
459
+ addBox(
460
+ g,
461
+ stringerW,
462
+ stepRise * 1.4,
463
+ stairLen,
464
+ sx * (w * 0.5 - stringerW * 0.5),
465
+ flightH * 0.5 - stepRise * 0.25,
466
+ 0,
467
+ p.metalDark,
468
+ [slopeAngle, 0, 0],
469
+ )
470
+ }
471
+
472
+ // Individual wood treads + clean painted risers ascending from +Z (y=0) to -Z (y=flightH)
473
+ const treadW = w - stringerW * 1.4
474
+ for (let i = 0; i < steps; i++) {
475
+ const topY = (i + 1) * stepRise
476
+ const zCenter = d * 0.5 - (i + 0.5) * stepRun
477
+ // Solid wood tread with slight bullnose overhang toward +Z
478
+ addBox(g, treadW, treadThick, stepRun * 1.1, 0, topY - treadThick * 0.5, zCenter + stepRun * 0.03, p.woodWarm)
479
+ // Recessed crisp vertical riser facing +Z
480
+ addBox(
481
+ g,
482
+ treadW * 0.98,
483
+ stepRise - treadThick * 0.4,
484
+ 0.025,
485
+ 0,
486
+ topY - stepRise * 0.5,
487
+ zCenter + stepRun * 0.48,
488
+ p.paintWhite,
489
+ )
490
+ }
491
+
492
+ // Left & right guardrails: newel posts, vertical balusters, and sloped wood handrails
493
+ const railInset = stringerW * 0.5
494
+ for (const sx of [-1, 1]) {
495
+ const rx = sx * (w * 0.5 - railInset)
496
+ for (let i = 0; i <= steps; i += 2) {
497
+ const frac = i / steps
498
+ const baseY = frac * flightH
499
+ const pz = d * 0.5 - frac * d
500
+ const isNewel = i === 0 || i >= steps - 1
501
+ const postW = isNewel ? 0.05 : 0.02
502
+ addBox(g, postW, railH, postW, rx, baseY + railH * 0.5, pz, isNewel ? p.metalDark : p.metalBrushed)
503
+ }
504
+ // Continuous sloped handrail
505
+ addBox(g, 0.055, 0.048, stairLen * 1.03, rx, flightH * 0.5 + railH, 0, p.woodWarm, [slopeAngle, 0, 0])
506
+ }
507
+
508
+ return normalizeAndGroundGroup(g, w, h, d)
509
+ }
510
+
511
+ // ---------------------------------------------------------------------------
512
+ // Windows (9)
513
+ // ---------------------------------------------------------------------------
514
+
515
+ const buildWindowDouble: SlugBuilderFn = (w, h, d, p) => {
516
+ const g = new THREE.Group()
517
+ const ft = Math.min(0.06, w * 0.05, h * 0.05)
518
+ const { innerW, innerH, centerY } = addWindowFrame(g, w, h, d, p.paintWhite, p.woodLight, ft)
519
+
520
+ // Center vertical mullion
521
+ const mullW = ft * 0.85
522
+ addBox(g, mullW, innerH, d * 0.72, 0, centerY, 0, p.paintWhite)
523
+
524
+ // Left & right casement sashes with 1x2 muntins & chrome latches
525
+ const sashW = (innerW - mullW) * 0.5
526
+ for (const sx of [-1, 1]) {
527
+ addWindowSash(g, sashW, innerH, d * 0.45, sx * (mullW * 0.5 + sashW * 0.5), centerY, 0, p.paintWhite, p.glass, 1, 2)
528
+ addBox(g, 0.018, 0.075, 0.028, sx * (mullW * 0.65), centerY, d * 0.28, p.metalChrome)
529
+ }
530
+
531
+ return normalizeAndGroundGroup(g, w, h, d)
532
+ }
533
+
534
+ const buildWindowLarge: SlugBuilderFn = (w, h, d, p) => {
535
+ const g = new THREE.Group()
536
+ const ft = Math.min(0.065, w * 0.04, h * 0.05)
537
+ const { innerW, innerH, centerY } = addWindowFrame(g, w, h, d, p.metalDark, p.stoneLight, ft)
538
+
539
+ // 3-bay picture window: wide fixed center bay + 2 narrower flanking casements
540
+ const mullW = ft * 0.9
541
+ const sideW = innerW * 0.24
542
+ const centerW = innerW - sideW * 2 - mullW * 2
543
+
544
+ for (const sx of [-1, 1]) {
545
+ addBox(g, mullW, innerH, d * 0.76, sx * (centerW * 0.5 + mullW * 0.5), centerY, 0, p.metalDark)
546
+ addWindowSash(
547
+ g,
548
+ sideW,
549
+ innerH,
550
+ d * 0.44,
551
+ sx * (centerW * 0.5 + mullW + sideW * 0.5),
552
+ centerY,
553
+ 0,
554
+ p.metalDark,
555
+ p.glass,
556
+ 1,
557
+ 2,
558
+ )
559
+ addBox(g, 0.018, 0.08, 0.03, sx * (centerW * 0.5 + mullW + sideW * 0.14), centerY - innerH * 0.1, d * 0.28, p.metalChrome)
560
+ }
561
+ addWindowSash(g, centerW, innerH, d * 0.42, 0, centerY, 0, p.metalDark, p.glass, 2, 1)
562
+
563
+ return normalizeAndGroundGroup(g, w, h, d)
564
+ }
565
+
566
+ const buildWindowRectangle: SlugBuilderFn = (w, h, d, p) => {
567
+ const g = new THREE.Group()
568
+ const ft = Math.min(0.055, w * 0.05, h * 0.055)
569
+ const { innerW, innerH, centerY } = addWindowFrame(g, w, h, d, p.paintWhite, p.paintWhite, ft)
570
+
571
+ // Horizontal sliding twin sashes offset cleanly in Z
572
+ const sashW = innerW * 0.52
573
+ addWindowSash(g, sashW, innerH, d * 0.32, -innerW * 0.24, centerY, -d * 0.12, p.paintWhite, p.glass, 1, 1)
574
+ addWindowSash(g, sashW, innerH, d * 0.32, innerW * 0.24, centerY, d * 0.12, p.paintWhite, p.glass, 1, 1)
575
+ // Center sliding lock latch
576
+ addBox(g, 0.022, 0.065, 0.035, 0.01, centerY, d * 0.3, p.metalChrome)
577
+
578
+ return normalizeAndGroundGroup(g, w, h, d)
579
+ }
580
+
581
+ const buildWindowRound: SlugBuilderFn = (w, h, d, p) => {
582
+ const g = new THREE.Group()
583
+ const outerR = Math.min(w, h) * 0.5
584
+ const casingW = outerR * 0.16
585
+ const sashW = outerR * 0.08
586
+ const glassR = outerR - casingW - sashW * 0.8
587
+
588
+ // Helper for crisp flat-faced architectural circular casing/sash ring (not an inflated donut!)
589
+ const addFlatRing = (rOut: number, rIn: number, depth: number, mat: THREE.Material): void => {
590
+ const shape = new THREE.Shape()
591
+ shape.absarc(0, 0, rOut, 0, Math.PI * 2, false)
592
+ const hole = new THREE.Path()
593
+ hole.absarc(0, 0, Math.max(1e-3, rIn), 0, Math.PI * 2, true)
594
+ shape.holes.push(hole)
595
+ const bev = Math.min(0.008, (rOut - rIn) * 0.15, depth * 0.15)
596
+ const coreD = Math.max(1e-3, depth - bev * 2)
597
+ const geom = new THREE.ExtrudeGeometry(shape, {
598
+ depth: coreD,
599
+ bevelEnabled: bev > 1e-4,
600
+ bevelThickness: bev,
601
+ bevelSize: bev,
602
+ bevelSegments: 2,
603
+ curveSegments: 36,
604
+ })
605
+ geom.translate(0, 0, -coreD / 2)
606
+ const mesh = new THREE.Mesh(geom, mat)
607
+ mesh.position.set(0, h * 0.5, 0)
608
+ g.add(mesh)
609
+ }
610
+
611
+ // Flat-faced outer molded white architectural casing + recessed inner wood sash ring
612
+ addFlatRing(outerR, outerR - casingW, d * 0.92, p.paintWhite)
613
+ addFlatRing(outerR - casingW * 0.92, glassR, d * 0.58, p.woodLight)
614
+
615
+ // Circular clear glass disc
616
+ addCyl(g, glassR * 1.02, glassR * 1.02, d * 0.14, 0, h * 0.5, 0, p.glass, 36, [
617
+ Math.PI / 2,
618
+ 0,
619
+ 0,
620
+ ])
621
+
622
+ // Crisp flat cruciform architectural muntin crossbars + center boss
623
+ const barLen = glassR * 2.02
624
+ const barT = Math.max(0.018, outerR * 0.055)
625
+ addBox(g, barLen, barT, d * 0.34, 0, h * 0.5, 0, p.paintWhite)
626
+ addBox(g, barT, barLen, d * 0.34, 0, h * 0.5, 0, p.paintWhite)
627
+ addCyl(g, barT * 0.9, barT * 0.9, d * 0.38, 0, h * 0.5, 0, p.paintWhite, 16, [Math.PI / 2, 0, 0])
628
+
629
+ return normalizeAndGroundGroup(g, w, h, d)
630
+ }
631
+
632
+ const buildWindowSimple: SlugBuilderFn = (w, h, d, p) => {
633
+ const g = new THREE.Group()
634
+ const ft = Math.min(0.055, w * 0.06, h * 0.05)
635
+ const { innerW, innerH, centerY } = addWindowFrame(g, w, h, d, p.paintWhite, p.woodLight, ft)
636
+
637
+ // Classic double-hung upper & lower sashes with meeting rail & lock
638
+ const sashH = innerH * 0.52
639
+ addWindowSash(g, innerW, sashH, d * 0.3, 0, centerY + innerH * 0.24, -d * 0.12, p.paintWhite, p.glass, 2, 2)
640
+ addWindowSash(g, innerW, sashH, d * 0.3, 0, centerY - innerH * 0.24, d * 0.12, p.paintWhite, p.glass, 2, 1)
641
+ // Chrome sash lock at center meeting rail
642
+ addBox(g, 0.05, 0.025, 0.04, 0, centerY + 0.015, d * 0.28, p.metalChrome)
643
+
644
+ return normalizeAndGroundGroup(g, w, h, d)
645
+ }
646
+
647
+ const buildWindowSmall: SlugBuilderFn = (w, h, d, p) => {
648
+ const g = new THREE.Group()
649
+ const ft = Math.min(0.05, w * 0.08, h * 0.07)
650
+ const { innerW, innerH, centerY } = addWindowFrame(g, w, h, d, p.paintWhite, p.paintWhite, ft)
651
+
652
+ // Compact single-pane awning sash + bottom crank handle
653
+ addWindowSash(g, innerW, innerH, d * 0.42, 0, centerY, 0, p.paintWhite, p.glass, 1, 1)
654
+ addBox(g, 0.05, 0.02, 0.04, 0, ft + 0.02, d * 0.3, p.metalChrome)
655
+
656
+ return normalizeAndGroundGroup(g, w, h, d)
657
+ }
658
+
659
+ const buildWindowSmall2: SlugBuilderFn = (w, h, d, p) => {
660
+ const g = new THREE.Group()
661
+ const ft = Math.min(0.05, w * 0.08, h * 0.06)
662
+ const { innerW, innerH, centerY } = addWindowFrame(g, w, h, d, p.woodWarm, p.woodDark, ft)
663
+
664
+ // Portrait casement divided by horizontal transom bar (top 1/3 fixed, lower 2/3 casement)
665
+ const transomY = centerY + innerH * 0.18
666
+ addBox(g, innerW, ft * 0.7, d * 0.72, 0, transomY, 0, p.woodWarm)
667
+ addWindowSash(g, innerW, innerH * 0.3, d * 0.42, 0, centerY + innerH * 0.35, 0, p.woodWarm, p.glass, 1, 1)
668
+ addWindowSash(g, innerW, innerH * 0.64, d * 0.44, 0, centerY - innerH * 0.18, 0, p.woodWarm, p.glass, 1, 1)
669
+ addBox(g, 0.02, 0.08, 0.03, innerW * 0.42, centerY - innerH * 0.16, d * 0.28, p.metalChrome)
670
+
671
+ return normalizeAndGroundGroup(g, w, h, d)
672
+ }
673
+
674
+ const buildWindowSquare: SlugBuilderFn = (w, h, d, p) => {
675
+ const g = new THREE.Group()
676
+ const ft = Math.min(0.055, w * 0.06, h * 0.06)
677
+ const { innerW, innerH, centerY } = addWindowFrame(g, w, h, d, p.metalDark, p.stoneLight, ft)
678
+
679
+ // Crisp 2x2 cruciform architectural square grid window
680
+ addWindowSash(g, innerW, innerH, d * 0.44, 0, centerY, 0, p.metalDark, p.glass, 2, 2, 0.036)
681
+
682
+ return normalizeAndGroundGroup(g, w, h, d)
683
+ }
684
+
685
+ const buildWindowBlackOpen: SlugBuilderFn = (w, h, d, p) => {
686
+ const g = new THREE.Group()
687
+ const ft = Math.min(0.055, w * 0.05, h * 0.045)
688
+ const frameD = d * 0.48
689
+ const { innerW, innerH, centerY } = addWindowFrame(g, w, h, frameD, p.metalDark, p.metalDark, ft)
690
+
691
+ // Center vertical mullion
692
+ const mullW = ft * 0.78
693
+ addBox(g, mullW, innerH, frameD * 0.8, 0, centerY, 0, p.metalDark)
694
+
695
+ const sashW = (innerW - mullW) * 0.5
696
+ // Left closed industrial divided-lite sash
697
+ addWindowSash(g, sashW, innerH, frameD * 0.45, -(mullW * 0.5 + sashW * 0.5), centerY, 0, p.metalDark, p.glass, 1, 3, 0.028)
698
+
699
+ // Right hinged casement swung open outward (~28 deg around right jamb hinge!)
700
+ const pivot = new THREE.Group()
701
+ pivot.position.set(w * 0.5 - ft, centerY, frameD * 0.2)
702
+ pivot.rotation.y = 0.46
703
+ addWindowSash(pivot, sashW, innerH, frameD * 0.45, -sashW * 0.5, 0, 0, p.metalDark, p.glass, 1, 3, 0.028)
704
+ // Chrome casement handle on open sash
705
+ addBox(pivot, 0.018, 0.09, 0.032, -sashW + 0.03, -0.05, 0.03, p.metalChrome)
706
+ g.add(pivot)
707
+
708
+ // Brushed metal friction stay strut bridging sill to open sash
709
+ addBox(g, sashW * 0.42, 0.012, 0.016, w * 0.28, ft + 0.02, frameD * 0.65, p.metalBrushed, [0, 0.42, 0])
710
+
711
+ return normalizeAndGroundGroup(g, w, h, d)
712
+ }
713
+
714
+ // ---------------------------------------------------------------------------
715
+ // Fences & Outdoor Structures (8)
716
+ // ---------------------------------------------------------------------------
717
+
718
+ const buildFence: SlugBuilderFn = (w, h, d, p) => {
719
+ const g = new THREE.Group()
720
+ const postW = Math.min(0.095, d * 0.95, w * 0.25)
721
+
722
+ // End square wood posts with pyramid caps
723
+ for (const sx of [-1, 1]) {
724
+ const px = sx * (w * 0.5 - postW * 0.5)
725
+ addBox(g, postW, h * 0.96, postW, px, h * 0.48, 0, p.woodDark)
726
+ addCyl(g, 0.005, postW * 0.72, h * 0.05, px, h * 0.985, 0, p.woodDark, 4, [0, Math.PI / 4, 0])
727
+ }
728
+
729
+ // Twin horizontal rails
730
+ const spanW = w - postW * 1.4
731
+ addBox(g, spanW, h * 0.06, d * 0.4, 0, h * 0.25, -d * 0.14, p.woodWarm)
732
+ addBox(g, spanW, h * 0.06, d * 0.4, 0, h * 0.72, -d * 0.14, p.woodWarm)
733
+
734
+ // Evenly spaced vertical pickets
735
+ const picketCount = Math.max(8, Math.round(spanW / 0.13))
736
+ const step = spanW / picketCount
737
+ const picketW = step * 0.72
738
+ for (let i = 0; i < picketCount; i++) {
739
+ const x = -spanW * 0.5 + (i + 0.5) * step
740
+ addBox(g, picketW, h * 0.88, d * 0.26, x, h * 0.46, d * 0.18, p.woodWarm)
741
+ addBox(g, picketW * 0.7, picketW * 0.7, d * 0.25, x, h * 0.9, d * 0.18, p.woodWarm, [0, 0, Math.PI / 4])
742
+ }
743
+
744
+ return normalizeAndGroundGroup(g, w, h, d)
745
+ }
746
+
747
+ const buildLowFence: SlugBuilderFn = (w, h, d, p) => {
748
+ const g = new THREE.Group()
749
+ const postW = Math.min(0.09, d * 0.92, w * 0.25)
750
+
751
+ // Classic white cottage garden picket fence
752
+ for (const sx of [-1, 1]) {
753
+ const px = sx * (w * 0.5 - postW * 0.5)
754
+ addBox(g, postW, h * 0.9, postW, px, h * 0.45, 0, p.paintWhite)
755
+ addBox(g, postW * 1.22, h * 0.05, postW * 1.22, px, h * 0.91, 0, p.paintWhite)
756
+ addSphere(g, postW * 0.42, px, h * 0.96, 0, p.paintWhite, undefined, 10)
757
+ }
758
+
759
+ const spanW = w - postW * 1.4
760
+ addBox(g, spanW, h * 0.08, d * 0.36, 0, h * 0.24, -d * 0.12, p.paintWhite)
761
+ addBox(g, spanW, h * 0.08, d * 0.36, 0, h * 0.66, -d * 0.12, p.paintWhite)
762
+
763
+ const picketCount = Math.max(9, Math.round(spanW / 0.12))
764
+ const step = spanW / picketCount
765
+ const picketW = step * 0.64
766
+ for (let i = 0; i < picketCount; i++) {
767
+ const x = -spanW * 0.5 + (i + 0.5) * step
768
+ addBox(g, picketW, h * 0.8, d * 0.24, x, h * 0.44, d * 0.18, p.paintWhite)
769
+ addBox(g, picketW * 0.7, picketW * 0.7, d * 0.23, x, h * 0.84, d * 0.18, p.paintWhite, [0, 0, Math.PI / 4])
770
+ }
771
+
772
+ return normalizeAndGroundGroup(g, w, h, d)
773
+ }
774
+
775
+ const buildMediumFence: SlugBuilderFn = (w, h, d, p) => {
776
+ const g = new THREE.Group()
777
+ const postW = Math.min(0.085, d * 0.9, w * 0.25)
778
+
779
+ // Modern architectural steel posts + horizontal cedar slats
780
+ for (const sx of [-1, 1]) {
781
+ const px = sx * (w * 0.5 - postW * 0.5)
782
+ addBox(g, postW, h, postW, px, h * 0.5, 0, p.metalDark)
783
+ addBox(g, postW * 1.12, 0.025, postW * 1.12, px, h, 0, p.metalBrushed)
784
+ }
785
+
786
+ // Center vertical stiffener bar
787
+ addBox(g, postW * 0.45, h * 0.94, d * 0.3, 0, h * 0.48, -d * 0.18, p.metalDark)
788
+
789
+ // 8 horizontal warm wood slats with clean daylight shadow gaps
790
+ const slats = 8
791
+ const spanW = w - postW * 1.2
792
+ const slatH = (h * 0.9) / slats
793
+ for (let i = 0; i < slats; i++) {
794
+ const sy = h * 0.07 + (i + 0.5) * slatH
795
+ addBox(g, spanW, slatH * 0.74, d * 0.36, 0, sy, d * 0.08, p.woodWarm)
796
+ }
797
+
798
+ return normalizeAndGroundGroup(g, w, h, d)
799
+ }
800
+
801
+ const buildHighFence: SlugBuilderFn = (w, h, d, p) => {
802
+ const g = new THREE.Group()
803
+ const postW = Math.min(0.1, d * 0.96, w * 0.25)
804
+
805
+ // Heavy timber posts with stone collars & top cap rail
806
+ for (const sx of [-1, 1]) {
807
+ const px = sx * (w * 0.5 - postW * 0.5)
808
+ addBox(g, postW * 1.18, h * 0.05, postW * 1.18, px, h * 0.025, 0, p.stoneLight)
809
+ addBox(g, postW, h * 0.98, postW, px, h * 0.5, 0, p.woodDark)
810
+ }
811
+ addBox(g, w, h * 0.035, d * 1.04, 0, h * 0.985, 0, p.woodDark)
812
+
813
+ const spanW = w - postW * 1.5
814
+ const solidH = h * 0.76
815
+ // Lower board-on-board solid privacy planks
816
+ const boards = 12
817
+ const bw = spanW / boards
818
+ for (let i = 0; i < boards; i++) {
819
+ const bx = -spanW * 0.5 + (i + 0.5) * bw
820
+ const zOff = (i % 2 === 0 ? 1 : -1) * d * 0.12
821
+ addBox(g, bw * 0.96, solidH, d * 0.24, bx, solidH * 0.5 + h * 0.02, zOff, i % 2 === 0 ? p.woodWarm : p.woodLight)
822
+ }
823
+
824
+ // Mid horizontal divider rail separating privacy section from top lattice
825
+ addBox(g, spanW, h * 0.035, d * 0.6, 0, solidH + h * 0.025, 0, p.woodDark)
826
+
827
+ // Upper open architectural trellis lattice band
828
+ const latY = solidH + h * 0.04 + h * 0.09
829
+ const latH = h * 0.18
830
+ for (let i = 1; i < 8; i++) {
831
+ const lx = -spanW * 0.5 + (i / 8) * spanW
832
+ addBox(g, 0.024, latH, d * 0.24, lx, latY, 0, p.woodWarm)
833
+ }
834
+ addBox(g, spanW, 0.024, d * 0.24, 0, latY, 0, p.woodWarm)
835
+
836
+ return normalizeAndGroundGroup(g, w, h, d)
837
+ }
838
+
839
+ const buildParkingSpot: SlugBuilderFn = (w, h, d, p) => {
840
+ const g = new THREE.Group()
841
+ const padH = Math.min(0.015, h * 0.15)
842
+ const stripeH = padH * 0.35
843
+ const stripeW = Math.min(0.11, d * 0.05)
844
+
845
+ // Asphalt parking bay base slab (matching surfaceHeight ~0.015)
846
+ addBox(g, w, padH, d, 0, padH * 0.5, 0, p.stoneDark)
847
+
848
+ // Painted white perimeter bay striping lines (sides & front edge)
849
+ addBox(g, w * 0.98, stripeH, stripeW, 0, padH + stripeH * 0.5, -d * 0.5 + stripeW * 0.5, p.paintWhite)
850
+ addBox(g, w * 0.98, stripeH, stripeW, 0, padH + stripeH * 0.5, d * 0.5 - stripeW * 0.5, p.paintWhite)
851
+ addBox(g, stripeW, stripeH, d, w * 0.5 - stripeW * 0.5, padH + stripeH * 0.5, 0, p.paintWhite)
852
+ // Entry tick marks
853
+ addBox(g, stripeW * 2.2, stripeH, stripeW, -w * 0.46, padH + stripeH * 0.5, 0, p.paintWhite)
854
+
855
+ // Precast concrete wheel-stop bumper curb with yellow safety stripes near front end
856
+ const curbH = h - padH
857
+ const curbX = w * 0.34
858
+ const curbD = d * 0.72
859
+ addBox(g, 0.16, curbH * 0.72, curbD, curbX, padH + curbH * 0.36, 0, p.stoneLight)
860
+ addBox(g, 0.11, curbH * 0.3, curbD * 0.98, curbX, padH + curbH * 0.85, 0, p.stoneLight)
861
+ for (const sz of [-0.3, 0, 0.3]) {
862
+ addBox(g, 0.165, curbH * 0.75, curbD * 0.12, curbX, padH + curbH * 0.38, sz * curbD, p.paintYellow)
863
+ }
864
+
865
+ return normalizeAndGroundGroup(g, w, h, d)
866
+ }
867
+
868
+ const buildPatioUmbrella: SlugBuilderFn = (w, h, d, p) => {
869
+ const g = new THREE.Group()
870
+ const spanR = Math.min(w, d) * 0.5
871
+ const poleR = Math.min(0.036, Math.max(0.016, spanR * 0.04))
872
+ const baseR = Math.min(0.32, spanR * 0.32)
873
+
874
+ // Heavy circular cast-stone umbrella stand base + stainless collar
875
+ addCyl(g, baseR * 0.92, baseR, h * 0.035, 0, h * 0.0175, 0, p.stoneDark, 20)
876
+ addCyl(g, poleR * 1.7, poleR * 2.0, h * 0.06, 0, h * 0.06, 0, p.metalBrushed, 14)
877
+
878
+ // Tall slender vertical wood/aluminum umbrella mast + hand crank assembly
879
+ addCyl(g, poleR, poleR, h * 0.9, 0, h * 0.51, 0, p.woodWarm, 14)
880
+ addBox(g, poleR * 2.8, h * 0.042, poleR * 2.8, 0, h * 0.36, 0, p.metalDark)
881
+ addBox(g, poleR * 4.5, h * 0.012, poleR * 0.9, poleR * 2.2, h * 0.36, 0, p.metalChrome)
882
+
883
+ // Runner collar + 8 structural support ribs radiating smoothly to canopy perimeter
884
+ const canopyBottomY = h * 0.72
885
+ const canopyTopY = h * 0.93
886
+ addCyl(g, poleR * 1.9, poleR * 1.9, h * 0.035, 0, canopyBottomY - h * 0.05, 0, p.metalBrushed, 14)
887
+ for (let i = 0; i < 8; i++) {
888
+ const a = (i / 8) * Math.PI * 2
889
+ const ribHolder = new THREE.Group()
890
+ ribHolder.rotation.y = a
891
+ addBox(
892
+ ribHolder,
893
+ spanR * 0.9,
894
+ h * 0.008,
895
+ poleR * 0.55,
896
+ spanR * 0.45,
897
+ canopyBottomY + h * 0.015,
898
+ 0,
899
+ p.metalBrushed,
900
+ [0, 0, 0.16],
901
+ )
902
+ g.add(ribHolder)
903
+ }
904
+
905
+ // Wide faceted octagonal fabric umbrella canopy + scalloped white valance skirt + vented wind-cap + finial
906
+ addCyl(g, spanR * 0.16, spanR, canopyTopY - canopyBottomY, 0, (canopyTopY + canopyBottomY) * 0.5, 0, p.fabricAccent, 8)
907
+ addCyl(g, spanR, spanR * 0.985, h * 0.045, 0, canopyBottomY - h * 0.015, 0, p.paintWhite, 8)
908
+ addCyl(g, spanR * 0.05, spanR * 0.34, h * 0.042, 0, canopyTopY + h * 0.018, 0, p.fabricAccent, 8)
909
+ addCyl(g, poleR * 0.45, poleR * 1.0, h * 0.042, 0, h * 0.975, 0, p.metalChrome, 10)
910
+
911
+ return normalizeAndGroundGroup(g, w, h, d)
912
+ }
913
+
914
+ const buildSunbed: SlugBuilderFn = (w, h, d, p) => {
915
+ const g = new THREE.Group()
916
+ const bedY = h * 0.32
917
+ const legH = bedY - 0.03
918
+
919
+ // Frame rails + 4 legs + 2 rear transport wheels
920
+ addBox(g, w * 0.9, 0.055, d * 0.96, 0, bedY, 0, p.woodWarm)
921
+ for (const sx of [-1, 1]) {
922
+ // Front legs
923
+ addBox(g, 0.05, legH, 0.05, sx * w * 0.4, legH * 0.5, d * 0.4, p.woodWarm)
924
+ // Rear legs + transport wheels
925
+ addBox(g, 0.05, legH * 0.85, 0.05, sx * w * 0.4, legH * 0.52, -d * 0.4, p.woodWarm)
926
+ addCyl(g, h * 0.08, h * 0.08, 0.04, sx * w * 0.45, h * 0.08, -d * 0.4, p.rubberBlack, 14, [
927
+ 0,
928
+ 0,
929
+ Math.PI / 2,
930
+ ])
931
+ addCyl(g, h * 0.035, h * 0.035, 0.045, sx * w * 0.45, h * 0.08, -d * 0.4, p.metalChrome, 10, [
932
+ 0,
933
+ 0,
934
+ Math.PI / 2,
935
+ ])
936
+ // Low side armrests
937
+ addBox(g, 0.05, 0.035, d * 0.48, sx * w * 0.46, bedY + h * 0.16, 0, p.woodWarm)
938
+ addBox(g, 0.04, h * 0.16, 0.04, sx * w * 0.46, bedY + h * 0.08, d * 0.18, p.woodWarm)
939
+ }
940
+
941
+ // Horizontal seat cushion pad (front half)
942
+ addRoundedRectExtrude(g, w * 0.84, d * 0.56, h * 0.09, 0.04, 0, bedY + h * 0.06, d * 0.2, p.fabricNeutral)
943
+
944
+ // Reclined angled backrest frame, support struts & cushion (rear half)
945
+ const backLen = Math.hypot(h * 0.62, d * 0.42)
946
+ const tilt = 0.92
947
+ addBox(g, w * 0.88, 0.045, backLen, 0, bedY + h * 0.34, -d * 0.24, p.woodWarm, [tilt, 0, 0])
948
+ addBox(g, w * 0.82, h * 0.08, backLen * 0.94, 0, bedY + h * 0.38, -d * 0.21, p.fabricNeutral, [tilt, 0, 0])
949
+ // Rear brushed aluminum adjustable ratchet prop arms
950
+ for (const sx of [-1, 1]) {
951
+ addCyl(g, 0.014, 0.014, h * 0.38, sx * w * 0.32, bedY + h * 0.18, -d * 0.34, p.metalBrushed, 8, [
952
+ -0.38,
953
+ 0,
954
+ 0,
955
+ ])
956
+ }
957
+
958
+ // Accent headrest bolster pillow
959
+ addCyl(g, h * 0.065, h * 0.065, w * 0.62, 0, h * 0.91, -d * 0.34, p.fabricAccent, 14, [0, 0, Math.PI / 2])
960
+
961
+ return normalizeAndGroundGroup(g, w, h, d)
962
+ }
963
+
964
+ const buildOutdoorPlayhouse: SlugBuilderFn = (w, h, d, p) => {
965
+ const g = new THREE.Group()
966
+ const deckH = h * 0.08
967
+ const wallH = h * 0.52
968
+ const wallY = deckH + wallH * 0.5
969
+
970
+ // Raised timber deck platform with small front porch
971
+ addBox(g, w, deckH, d, 0, deckH * 0.5, 0, p.woodDark)
972
+
973
+ // Cottage walls (occupying rear 76% of depth, leaving front porch)
974
+ const houseD = d * 0.74
975
+ const houseZ = -d * 0.12
976
+ addBox(g, w * 0.9, wallH, houseD, 0, wallY, houseZ, p.paintWhite)
977
+
978
+ // Corner trim boards & porch support posts
979
+ for (const sx of [-1, 1]) {
980
+ addBox(g, w * 0.06, wallH, w * 0.06, sx * w * 0.44, wallY, d * 0.44, p.woodLight)
981
+ addBox(g, w * 0.05, wallH * 0.36, d * 0.26, sx * w * 0.44, deckH + wallH * 0.22, d * 0.34, p.woodLight)
982
+ }
983
+
984
+ // Front framed dutch door opening
985
+ const frontZ = houseZ + houseD * 0.5
986
+ addBox(g, w * 0.38, wallH * 0.8, 0.025, 0, deckH + wallH * 0.4, frontZ + 0.008, p.woodWarm)
987
+ addBox(g, w * 0.28, wallH * 0.34, 0.03, 0, deckH + wallH * 0.58, frontZ + 0.012, p.glass)
988
+
989
+ // Side windows with blue shutters & flower boxes
990
+ for (const sx of [-1, 1]) {
991
+ const wx = sx * (w * 0.45 + 0.008)
992
+ addBox(g, 0.02, wallH * 0.4, houseD * 0.36, wx, wallY + wallH * 0.05, houseZ, p.glass)
993
+ addBox(g, 0.025, wallH * 0.42, houseD * 0.12, wx, wallY + wallH * 0.05, houseZ - houseD * 0.24, p.paintBlue)
994
+ addBox(g, 0.025, wallH * 0.42, houseD * 0.12, wx, wallY + wallH * 0.05, houseZ + houseD * 0.24, p.paintBlue)
995
+ addBox(g, 0.04, wallH * 0.12, houseD * 0.4, wx + sx * 0.015, wallY - wallH * 0.18, houseZ, p.terracotta)
996
+ addBox(g, 0.035, wallH * 0.09, houseD * 0.36, wx + sx * 0.015, wallY - wallH * 0.1, houseZ, p.foliageLight)
997
+ }
998
+
999
+ // Gabled pitched roof covering cottage + front porch + chimney stack
1000
+ const roofBaseY = deckH + wallH
1001
+ const roofPeakH = h * 0.38
1002
+ const slopeLen = Math.hypot(w * 0.56, roofPeakH)
1003
+ const pitch = Math.atan2(roofPeakH, w * 0.52)
1004
+ addBox(g, slopeLen, h * 0.04, d * 1.04, -w * 0.26, roofBaseY + roofPeakH * 0.48, 0, p.terracotta, [0, 0, pitch])
1005
+ addBox(g, slopeLen, h * 0.04, d * 1.04, w * 0.26, roofBaseY + roofPeakH * 0.48, 0, p.terracotta, [0, 0, -pitch])
1006
+ // Triangular gable end fills (approximated cleanly by stepped gable wedge)
1007
+ addCyl(g, 0.005, w * 0.46, roofPeakH * 0.95, 0, roofBaseY + roofPeakH * 0.44, houseZ, p.woodLight, 3, [0, Math.PI / 6, 0])
1008
+ // Ridge cap beam & miniature terracotta chimney
1009
+ addBox(g, w * 0.08, h * 0.05, d * 1.05, 0, roofBaseY + roofPeakH * 0.94, 0, p.woodDark)
1010
+ addBox(g, w * 0.14, h * 0.22, d * 0.14, w * 0.22, roofBaseY + roofPeakH * 0.72, -d * 0.2, p.paintRed)
1011
+
1012
+ return normalizeAndGroundGroup(g, w, h, d)
1013
+ }
1014
+
1015
+ // ---------------------------------------------------------------------------
1016
+ // Botanicals & Plants (8)
1017
+ // ---------------------------------------------------------------------------
1018
+
1019
+ const buildTree: SlugBuilderFn = (w, h, d, p) => {
1020
+ const g = new THREE.Group()
1021
+ const rx = w * 0.5
1022
+ const rz = d * 0.5
1023
+ const trunkR = Math.min(rx, rz) * 0.13
1024
+
1025
+ // Flared root base & sturdy tapered bark trunk
1026
+ addCyl(g, trunkR * 0.82, trunkR * 1.5, h * 0.14, 0, h * 0.07, 0, p.barkBrown, 10)
1027
+ addCyl(g, trunkR * 0.56, trunkR * 0.86, h * 0.44, 0, h * 0.34, 0, p.barkBrown, 10)
1028
+
1029
+ // 4 structural boughs rising cleanly from upper trunk directly into crown interior (zero bare sticks)
1030
+ const boughs: ReadonlyArray<readonly [number, number, number]> = [
1031
+ [0.16, 0.12, 0.36],
1032
+ [-0.16, 0.1, -0.34],
1033
+ [0.1, -0.16, -0.32],
1034
+ [-0.12, -0.14, 0.32],
1035
+ ]
1036
+ for (const [bx, bz, tilt] of boughs) {
1037
+ addCyl(
1038
+ g,
1039
+ trunkR * 0.24,
1040
+ trunkR * 0.45,
1041
+ h * 0.18,
1042
+ bx * rx * 0.75,
1043
+ h * 0.56,
1044
+ bz * rz * 0.75,
1045
+ p.barkBrown,
1046
+ 8,
1047
+ [bz * 0.9, 0, -tilt],
1048
+ )
1049
+ }
1050
+
1051
+ // Lush 12-lobe organic broadleaf canopy (dark shaded lower volume, sunlit upper foliage puffs)
1052
+ const canopyClusters: ReadonlyArray<readonly [number, number, number, number, boolean]> = [
1053
+ [0, 0.72, 0, 0.78, false],
1054
+ [0.44, 0.62, 0.28, 0.56, false],
1055
+ [-0.44, 0.64, 0.24, 0.56, false],
1056
+ [0.28, 0.63, -0.42, 0.56, false],
1057
+ [-0.34, 0.66, -0.38, 0.54, false],
1058
+ [0.02, 0.58, 0.42, 0.48, false],
1059
+ [-0.04, 0.6, -0.44, 0.48, false],
1060
+ [0.36, 0.8, -0.14, 0.5, true],
1061
+ [-0.32, 0.82, 0.18, 0.48, true],
1062
+ [0.08, 0.86, 0.28, 0.46, true],
1063
+ [-0.12, 0.88, -0.22, 0.44, true],
1064
+ [0, 0.93, 0, 0.42, true],
1065
+ ]
1066
+ for (const [cx, cy, cz, scaleFrac, isLight] of canopyClusters) {
1067
+ addSphere(
1068
+ g,
1069
+ 1,
1070
+ cx * rx * 0.68,
1071
+ cy * h,
1072
+ cz * rz * 0.68,
1073
+ isLight ? p.foliageLight : p.foliageDark,
1074
+ [rx * scaleFrac, h * 0.16 * scaleFrac * 1.4, rz * scaleFrac],
1075
+ 12,
1076
+ )
1077
+ }
1078
+
1079
+ return normalizeAndGroundGroup(g, w, h, d)
1080
+ }
1081
+
1082
+ const buildFirTree: SlugBuilderFn = (w, h, d, p) => {
1083
+ const g = new THREE.Group()
1084
+ const rx = w * 0.5
1085
+ const rz = d * 0.5
1086
+ const trunkR = Math.min(rx, rz) * 0.15
1087
+
1088
+ // Tapered bark trunk visible at lower section
1089
+ addCyl(g, trunkR * 0.45, trunkR, h * 0.34, 0, h * 0.17, 0, p.barkBrown, 10)
1090
+
1091
+ // 8 lush overlapping faceted conical evergreen bough tiers tapering cleanly to spire
1092
+ const tiers = 8
1093
+ for (let i = 0; i < tiers; i++) {
1094
+ const frac = i / (tiers - 1)
1095
+ const tierY = h * (0.2 + frac * 0.72)
1096
+ const tierH = h * (0.24 - frac * 0.1)
1097
+ const botR = Math.max(0.04, (1 - frac * 0.8) * 1.0)
1098
+ const topR = i === tiers - 1 ? 0.008 : botR * 0.28
1099
+ const mesh = addCyl(
1100
+ g,
1101
+ topR,
1102
+ botR,
1103
+ tierH,
1104
+ 0,
1105
+ tierY,
1106
+ 0,
1107
+ i % 2 === 0 ? p.foliageDark : p.foliageLight,
1108
+ 9,
1109
+ [0, i * 0.38, 0],
1110
+ )
1111
+ mesh.scale.set(rx, 1, rz)
1112
+ }
1113
+
1114
+ return normalizeAndGroundGroup(g, w, h, d)
1115
+ }
1116
+
1117
+ const buildPalm: SlugBuilderFn = (w, h, d, p) => {
1118
+ const g = new THREE.Group()
1119
+ const rx = w * 0.5
1120
+ const rz = d * 0.5
1121
+ const trunkR = Math.min(rx, rz) * 0.11
1122
+
1123
+ // Gently curving segmented ring-bark palm trunk
1124
+ const segments = 9
1125
+ const trunkTopY = h * 0.76
1126
+ const segH = trunkTopY / segments
1127
+ let topX = 0
1128
+ for (let i = 0; i < segments; i++) {
1129
+ const t = i / (segments - 1)
1130
+ const curveX = Math.sin(t * Math.PI * 0.75) * rx * 0.18
1131
+ const rBot = trunkR * (1.32 - t * 0.52)
1132
+ const rTop = trunkR * (1.22 - t * 0.54)
1133
+ addCyl(g, rTop, rBot, segH * 1.08, curveX, (i + 0.5) * segH, 0, p.barkBrown, 10, [0, 0, -0.06 * Math.cos(t * 2)])
1134
+ topX = curveX
1135
+ }
1136
+
1137
+ // Green crownshaft + 3 coconuts tucked beneath fronds
1138
+ addCyl(g, trunkR * 0.82, trunkR * 0.74, h * 0.08, topX, trunkTopY + h * 0.03, 0, p.foliageDark, 10)
1139
+ for (let i = 0; i < 3; i++) {
1140
+ const a = (i / 3) * Math.PI * 2
1141
+ addSphere(
1142
+ g,
1143
+ trunkR * 0.54,
1144
+ topX + Math.cos(a) * trunkR * 0.9,
1145
+ trunkTopY + h * 0.01,
1146
+ Math.sin(a) * trunkR * 0.9,
1147
+ p.woodDark,
1148
+ undefined,
1149
+ 8,
1150
+ )
1151
+ }
1152
+
1153
+ // 10 gracefully arching multi-segment palm fronds radiating 360 deg with wide tropical spread
1154
+ const fronds = 10
1155
+ for (let i = 0; i < fronds; i++) {
1156
+ const a = (i / fronds) * Math.PI * 2
1157
+ const upper = i % 2 === 0
1158
+ const frondHolder = new THREE.Group()
1159
+ frondHolder.position.set(topX, trunkTopY + h * 0.055, 0)
1160
+ frondHolder.rotation.y = a
1161
+
1162
+ const span = Math.max(rx, rz) * (upper ? 0.84 : 0.98)
1163
+ const matFrond = upper ? p.foliageLight : p.foliageDark
1164
+ // Inner rising petiole & leaflets
1165
+ addBox(frondHolder, span * 0.44, h * 0.015, span * 0.22, span * 0.21, h * (upper ? 0.075 : 0.035), 0, matFrond, [
1166
+ 0,
1167
+ 0,
1168
+ upper ? 0.44 : 0.2,
1169
+ ])
1170
+ // Mid arching frond blade
1171
+ addBox(frondHolder, span * 0.46, h * 0.014, span * 0.26, span * 0.56, h * (upper ? 0.11 : 0.025), 0, matFrond, [
1172
+ 0,
1173
+ 0,
1174
+ upper ? -0.14 : -0.34,
1175
+ ])
1176
+ // Outer drooping frond tip
1177
+ addBox(frondHolder, span * 0.34, h * 0.012, span * 0.15, span * 0.84, h * (upper ? 0.045 : -0.055), 0, matFrond, [
1178
+ 0,
1179
+ 0,
1180
+ -0.72,
1181
+ ])
1182
+ g.add(frondHolder)
1183
+ }
1184
+
1185
+ return normalizeAndGroundGroup(g, w, h, d)
1186
+ }
1187
+
1188
+ const buildBush: SlugBuilderFn = (w, h, d, p) => {
1189
+ const g = new THREE.Group()
1190
+
1191
+ // Dense lush central foliage mass so lobes merge organically instead of reading as separate balls
1192
+ addSphere(g, 1, 0, h * 0.46, 0, p.foliageDark, [w * 0.44, h * 0.42, d * 0.44], 16)
1193
+
1194
+ // 16 densely overlapping varied-scale organic foliage lobes around crown & flanks
1195
+ const lobes: ReadonlyArray<readonly [number, number, number, number, number, number, boolean]> = [
1196
+ [-0.36, 0.42, 0.08, 0.22, 0.38, 0.36, false],
1197
+ [-0.22, 0.58, -0.1, 0.25, 0.42, 0.38, true],
1198
+ [-0.1, 0.52, 0.18, 0.24, 0.4, 0.36, false],
1199
+ [0.02, 0.64, -0.02, 0.26, 0.42, 0.38, true],
1200
+ [0.16, 0.54, 0.16, 0.24, 0.4, 0.36, false],
1201
+ [0.26, 0.58, -0.1, 0.25, 0.42, 0.38, true],
1202
+ [0.37, 0.42, 0.06, 0.22, 0.36, 0.34, false],
1203
+ [-0.3, 0.36, 0.2, 0.2, 0.34, 0.32, true],
1204
+ [-0.18, 0.38, -0.22, 0.22, 0.34, 0.32, false],
1205
+ [0.04, 0.42, -0.24, 0.22, 0.36, 0.34, false],
1206
+ [0.2, 0.38, -0.22, 0.22, 0.34, 0.32, true],
1207
+ [0.32, 0.36, 0.2, 0.2, 0.34, 0.32, true],
1208
+ [-0.12, 0.72, 0.06, 0.2, 0.32, 0.3, true],
1209
+ [0.14, 0.7, -0.06, 0.2, 0.32, 0.3, true],
1210
+ [0, 0.48, 0.26, 0.22, 0.34, 0.3, true],
1211
+ [-0.28, 0.5, -0.12, 0.2, 0.34, 0.32, false],
1212
+ ]
1213
+ for (const [fx, fy, fz, rw, rh, rd, isLight] of lobes) {
1214
+ addSphere(
1215
+ g,
1216
+ 1,
1217
+ fx * w,
1218
+ fy * h,
1219
+ fz * d,
1220
+ isLight ? p.foliageLight : p.foliageDark,
1221
+ [rw * w, rh * h, rd * d],
1222
+ 12,
1223
+ )
1224
+ }
1225
+
1226
+ // Subtle decorative garden blossom buds
1227
+ for (const [bx, by, bz] of [
1228
+ [-0.24, 0.78, 0.18],
1229
+ [0.02, 0.86, 0.14],
1230
+ [0.24, 0.76, -0.12],
1231
+ [0.14, 0.72, 0.22],
1232
+ ] as const) {
1233
+ addSphere(g, Math.min(h, d) * 0.042, bx * w, by * h, bz * d, p.paintWhite, undefined, 8)
1234
+ }
1235
+
1236
+ return normalizeAndGroundGroup(g, w, h, d)
1237
+ }
1238
+
1239
+ const buildHedge: SlugBuilderFn = (w, h, d, p) => {
1240
+ const g = new THREE.Group()
1241
+
1242
+ // Low soil/mulch base strip
1243
+ addBox(g, w * 0.94, h * 0.07, d * 0.84, 0, h * 0.035, 0, p.barkBrown)
1244
+
1245
+ // Sculpted manicured boxwood hedge core with softly beveled top crown
1246
+ addRoundedRectExtrude(g, w * 0.96, d * 0.88, h * 0.86, d * 0.24, 0, h * 0.5, 0, p.foliageDark)
1247
+
1248
+ // Continuous tightly overlapping boxwood foliage tufts softening top & side silhouette organically
1249
+ const tufts = 11
1250
+ for (let i = 0; i < tufts; i++) {
1251
+ const t = i / (tufts - 1) - 0.5
1252
+ const tx = t * w * 0.9
1253
+ const tz = (i % 2 === 0 ? 1 : -1) * d * 0.12
1254
+ addSphere(
1255
+ g,
1256
+ 1,
1257
+ tx,
1258
+ h * (0.86 + (i % 3) * 0.022),
1259
+ tz,
1260
+ i % 2 === 0 ? p.foliageLight : p.foliageDark,
1261
+ [w * 0.11, h * 0.12, d * 0.36],
1262
+ 10,
1263
+ )
1264
+ for (const sz of [-1, 1]) {
1265
+ addSphere(
1266
+ g,
1267
+ 1,
1268
+ tx,
1269
+ h * (0.42 + ((i + (sz > 0 ? 1 : 0)) % 3) * 0.14),
1270
+ sz * d * 0.36,
1271
+ (i + (sz > 0 ? 1 : 0)) % 2 === 0 ? p.foliageLight : p.foliageDark,
1272
+ [w * 0.11, h * 0.22, d * 0.18],
1273
+ 9,
1274
+ )
1275
+ }
1276
+ }
1277
+
1278
+ return normalizeAndGroundGroup(g, w, h, d)
1279
+ }
1280
+
1281
+ const buildIndoorPlant: SlugBuilderFn = (w, h, d, p) => {
1282
+ const g = new THREE.Group()
1283
+ const potR = Math.min(w, d) * 0.28
1284
+ const potH = h * 0.25
1285
+
1286
+ // Mid-century wooden planter stand legs + cross brace
1287
+ const standH = h * 0.16
1288
+ for (let i = 0; i < 4; i++) {
1289
+ const a = (i / 4) * Math.PI * 2 + Math.PI / 4
1290
+ addCyl(
1291
+ g,
1292
+ potR * 0.09,
1293
+ potR * 0.07,
1294
+ standH * 1.4,
1295
+ Math.cos(a) * potR * 1.02,
1296
+ standH * 0.7,
1297
+ Math.sin(a) * potR * 1.02,
1298
+ p.woodWarm,
1299
+ 8,
1300
+ )
1301
+ }
1302
+ addBox(g, potR * 2.1, h * 0.018, potR * 0.16, 0, standH * 0.45, 0, p.woodWarm)
1303
+ addBox(g, potR * 0.16, h * 0.018, potR * 2.1, 0, standH * 0.45, 0, p.woodWarm)
1304
+
1305
+ // Tapered ceramic/terracotta pot + rolled rim + dark soil disc
1306
+ const potY = standH * 0.48 + potH * 0.5
1307
+ addCyl(g, potR, potR * 0.78, potH, 0, potY, 0, p.ceramicMatte, 20)
1308
+ addTorus(g, potR * 0.99, potR * 0.07, 0, potY + potH * 0.48, 0, p.ceramicWhite, [Math.PI / 2, 0, 0])
1309
+ addCyl(g, potR * 0.92, potR * 0.92, h * 0.02, 0, potY + potH * 0.44, 0, p.barkBrown, 16)
1310
+
1311
+ // Multi-stem woody fiddle-leaf fig branches
1312
+ const soilY = potY + potH * 0.44
1313
+ const stems: ReadonlyArray<readonly [number, number, number, number]> = [
1314
+ [0, 0, 0.56, 0.05],
1315
+ [0.06, 0.04, 0.48, -0.18],
1316
+ [-0.06, -0.04, 0.44, 0.2],
1317
+ ]
1318
+ for (const [sx, sz, lenFrac, tilt] of stems) {
1319
+ addCyl(
1320
+ g,
1321
+ potR * 0.07,
1322
+ potR * 0.12,
1323
+ h * lenFrac,
1324
+ sx * w,
1325
+ soilY + h * lenFrac * 0.46,
1326
+ sz * d,
1327
+ p.barkBrown,
1328
+ 8,
1329
+ [sz * 0.8, 0, tilt],
1330
+ )
1331
+ }
1332
+
1333
+ // 14 broad paddle foliage leaves fanning at varied heights & azimuths
1334
+ const leafCount = 14
1335
+ for (let i = 0; i < leafCount; i++) {
1336
+ const a = i * 2.399 // golden angle distribution
1337
+ const frac = i / (leafCount - 1)
1338
+ const ly = soilY + h * (0.22 + frac * 0.44)
1339
+ const radial = Math.min(w, d) * (0.34 - Math.abs(frac - 0.5) * 0.24)
1340
+ const leafHolder = new THREE.Group()
1341
+ leafHolder.position.set(0, ly, 0)
1342
+ leafHolder.rotation.y = a
1343
+ addSphere(
1344
+ leafHolder,
1345
+ 1,
1346
+ radial * 0.72,
1347
+ 0,
1348
+ 0,
1349
+ i % 2 === 0 ? p.foliageDark : p.foliageLight,
1350
+ [radial * 0.55, h * 0.028, radial * 0.36],
1351
+ 10,
1352
+ )
1353
+ leafHolder.rotation.z = 0.25 - frac * 0.35
1354
+ g.add(leafHolder)
1355
+ }
1356
+
1357
+ return normalizeAndGroundGroup(g, w, h, d)
1358
+ }
1359
+
1360
+ const buildSmallIndoorPlant: SlugBuilderFn = (w, h, d, p) => {
1361
+ const g = new THREE.Group()
1362
+ const potR = Math.min(w, d) * 0.34
1363
+ const potH = h * 0.34
1364
+
1365
+ // Matching saucer + glazed ceramic pot + soil disc
1366
+ addCyl(g, potR * 1.06, potR * 0.94, h * 0.05, 0, h * 0.025, 0, p.ceramicMatte, 20)
1367
+ addCyl(g, potR, potR * 0.82, potH, 0, h * 0.05 + potH * 0.5, 0, p.ceramicWhite, 20)
1368
+ const soilY = h * 0.05 + potH * 0.95
1369
+ addCyl(g, potR * 0.9, potR * 0.9, h * 0.02, 0, soilY, 0, p.barkBrown, 16)
1370
+
1371
+ // 10 fanning botanical sword/monstera leaves radiating outward
1372
+ const leafCount = 10
1373
+ for (let i = 0; i < leafCount; i++) {
1374
+ const a = (i / leafCount) * Math.PI * 2 + (i % 2) * 0.18
1375
+ const inner = i % 2 === 0
1376
+ const leafH = h * (inner ? 0.56 : 0.44)
1377
+ const leafHolder = new THREE.Group()
1378
+ leafHolder.position.set(0, soilY, 0)
1379
+ leafHolder.rotation.y = a
1380
+
1381
+ const leaf = addSphere(
1382
+ leafHolder,
1383
+ 1,
1384
+ potR * (inner ? 0.34 : 0.58),
1385
+ leafH * 0.5,
1386
+ 0,
1387
+ inner ? p.foliageDark : p.foliageLight,
1388
+ [potR * 0.12, leafH * 0.52, potR * 0.36],
1389
+ 10,
1390
+ )
1391
+ leaf.rotation.z = inner ? -0.22 : -0.48
1392
+ g.add(leafHolder)
1393
+ }
1394
+
1395
+ return normalizeAndGroundGroup(g, w, h, d)
1396
+ }
1397
+
1398
+ const buildCactus: SlugBuilderFn = (w, h, d, p) => {
1399
+ const g = new THREE.Group()
1400
+ const potR = Math.min(w, d) * 0.38
1401
+ const potH = h * 0.32
1402
+
1403
+ // Tapered terracotta clay pot with wide collar rim & sandy soil
1404
+ addCyl(g, potR * 0.96, potR * 0.72, potH, 0, potH * 0.5, 0, p.terracotta, 18)
1405
+ addCyl(g, potR * 1.05, potR * 1.0, potH * 0.24, 0, potH * 0.88, 0, p.terracotta, 18)
1406
+ addCyl(g, potR * 0.92, potR * 0.92, h * 0.02, 0, potH * 0.94, 0, p.stoneLight, 16)
1407
+
1408
+ // Ribbed central saguaro column + rounded dome crown
1409
+ const colR = potR * 0.46
1410
+ const colH = h * 0.56
1411
+ const colBaseY = potH * 0.9
1412
+ addCyl(g, colR * 0.95, colR, colH, 0, colBaseY + colH * 0.5, 0, p.foliageDark, 14)
1413
+ addSphere(g, colR * 0.95, 0, colBaseY + colH, 0, p.foliageDark, [1, 0.9, 1], 12)
1414
+ // Longitudinal ribs along main cactus body
1415
+ for (let i = 0; i < 8; i++) {
1416
+ const a = (i / 8) * Math.PI * 2
1417
+ addCyl(
1418
+ g,
1419
+ colR * 0.16,
1420
+ colR * 0.16,
1421
+ colH * 0.96,
1422
+ Math.cos(a) * colR * 0.9,
1423
+ colBaseY + colH * 0.5,
1424
+ Math.sin(a) * colR * 0.9,
1425
+ p.foliageLight,
1426
+ 6,
1427
+ )
1428
+ }
1429
+
1430
+ // Two iconic curved L-shaped saguaro arms (left higher, right lower)
1431
+ const arms: ReadonlyArray<readonly [number, number, number]> = [
1432
+ [-1, 0.54, 0.24],
1433
+ [1, 0.42, 0.2],
1434
+ ]
1435
+ for (const [sx, armYFrac, armHFrac] of arms) {
1436
+ const armR = colR * 0.62
1437
+ const elbowX = sx * (colR + armR * 1.45)
1438
+ const elbowY = h * armYFrac
1439
+ // Horizontal joint from trunk to elbow
1440
+ addCyl(g, armR, armR, armR * 2.1, sx * (colR + armR * 0.6), elbowY, 0, p.foliageDark, 10, [
1441
+ 0,
1442
+ 0,
1443
+ Math.PI / 2,
1444
+ ])
1445
+ addSphere(g, armR, elbowX, elbowY, 0, p.foliageDark, undefined, 10)
1446
+ // Vertical ascending arm + dome tip
1447
+ const upH = h * armHFrac
1448
+ addCyl(g, armR * 0.94, armR, upH, elbowX, elbowY + upH * 0.5, 0, p.foliageDark, 10)
1449
+ addSphere(g, armR * 0.94, elbowX, elbowY + upH, 0, p.foliageLight, undefined, 10)
1450
+ }
1451
+
1452
+ // Tiny desert blossom on top crown
1453
+ addSphere(g, colR * 0.34, 0, colBaseY + colH + colR * 0.95, 0, p.paintYellow, [1, 0.7, 1], 10)
1454
+
1455
+ return normalizeAndGroundGroup(g, w, h, d)
1456
+ }
1457
+
1458
+ export const OUTDOOR_FENESTRATION_BUILDERS: Record<string, SlugBuilderFn> = {
1459
+ // Doors & Architectural (8)
1460
+ door: buildDoor,
1461
+ 'door-bar': buildDoorBar,
1462
+ 'door-with-bar': buildDoorWithBar,
1463
+ 'doorway-front': buildDoorwayFront,
1464
+ 'glass-door': buildGlassDoor,
1465
+ column: buildColumn,
1466
+ pillar: buildPillar,
1467
+ stairs: buildStairs,
1468
+
1469
+ // Windows (9)
1470
+ 'window-double': buildWindowDouble,
1471
+ 'window-large': buildWindowLarge,
1472
+ 'window-rectangle': buildWindowRectangle,
1473
+ 'window-round': buildWindowRound,
1474
+ 'window-simple': buildWindowSimple,
1475
+ 'window-small': buildWindowSmall,
1476
+ 'window-small-2': buildWindowSmall2,
1477
+ 'window-square': buildWindowSquare,
1478
+ 'window1-black-open-1731': buildWindowBlackOpen,
1479
+
1480
+ // Fences & Outdoor Structures (8)
1481
+ fence: buildFence,
1482
+ 'low-fence': buildLowFence,
1483
+ 'medium-fence': buildMediumFence,
1484
+ 'high-fence': buildHighFence,
1485
+ 'parking-spot': buildParkingSpot,
1486
+ 'patio-umbrella': buildPatioUmbrella,
1487
+ sunbed: buildSunbed,
1488
+ 'outdoor-playhouse': buildOutdoorPlayhouse,
1489
+
1490
+ // Botanicals & Plants (8)
1491
+ tree: buildTree,
1492
+ 'fir-tree': buildFirTree,
1493
+ palm: buildPalm,
1494
+ bush: buildBush,
1495
+ hedge: buildHedge,
1496
+ 'indoor-plant': buildIndoorPlant,
1497
+ 'small-indoor-plant': buildSmallIndoorPlant,
1498
+ cactus: buildCactus,
1499
+ }