@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,1065 @@
1
+ /**
2
+ * Clean-room MIT Parametric 3D CAD Builders:
3
+ * Vehicles, Mobility, Gym, Sports, Musical Instruments, Games & Props.
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
+ * Helper to add a 4-part spoked wheel assembly (rubber tire, alloy rim, 5 spokes, brake hub).
22
+ * Axis is 'x' when the car travels along Z (e.g. Tesla), or 'z' when the car travels along X (e.g. Camaro).
23
+ */
24
+ function addCarWheel(
25
+ parent: THREE.Object3D,
26
+ radius: number,
27
+ tireW: number,
28
+ x: number,
29
+ y: number,
30
+ z: number,
31
+ axleAxis: 'x' | 'z',
32
+ p: MaterialPalette,
33
+ chromeRim = false,
34
+ ): void {
35
+ const rot: [number, number, number] = axleAxis === 'x' ? [0, 0, Math.PI / 2] : [Math.PI / 2, 0, 0]
36
+ const rimMat = chromeRim ? p.metalChrome : p.metalBrushed
37
+ addCyl(parent, radius, radius, tireW, x, y, z, p.rubberBlack, 24, rot)
38
+ addCyl(parent, radius * 0.72, radius * 0.72, tireW * 1.03, x, y, z, p.metalDark, 18, rot)
39
+ addTorus(
40
+ parent,
41
+ radius * 0.68,
42
+ radius * 0.06,
43
+ x + (axleAxis === 'x' ? Math.sign(x) * tireW * 0.48 : 0),
44
+ y,
45
+ z + (axleAxis === 'z' ? Math.sign(z) * tireW * 0.48 : 0),
46
+ rimMat,
47
+ axleAxis === 'x' ? [0, Math.PI / 2, 0] : [0, 0, 0],
48
+ )
49
+ // 5 turbine/rally spokes on outer face
50
+ const wheelGroup = new THREE.Group()
51
+ wheelGroup.position.set(
52
+ x + (axleAxis === 'x' ? Math.sign(x) * tireW * 0.51 : 0),
53
+ y,
54
+ z + (axleAxis === 'z' ? Math.sign(z) * tireW * 0.51 : 0),
55
+ )
56
+ if (axleAxis === 'x') wheelGroup.rotation.y = Math.PI / 2
57
+ for (let i = 0; i < 5; i++) {
58
+ const a = (i / 5) * Math.PI * 2
59
+ addBox(
60
+ wheelGroup,
61
+ radius * 0.13,
62
+ radius * 0.62,
63
+ tireW * 0.08,
64
+ Math.cos(a) * radius * 0.3,
65
+ Math.sin(a) * radius * 0.3,
66
+ 0,
67
+ rimMat,
68
+ [0, 0, a - Math.PI / 2],
69
+ )
70
+ }
71
+ parent.add(wheelGroup)
72
+ addCyl(parent, radius * 0.22, radius * 0.22, tireW * 1.1, x, y, z, rimMat, 12, rot)
73
+ }
74
+
75
+ /**
76
+ * Extrude a 2D vehicle side profile along the car width with smooth chamfered shoulders.
77
+ * Points are in `(longitudinal, vertical)` coordinates; extruded symmetrically across `width`.
78
+ */
79
+ function addCarProfileExtrude(
80
+ parent: THREE.Object3D,
81
+ pts: ReadonlyArray<readonly [number, number]>,
82
+ width: number,
83
+ bevelThickness: number,
84
+ bevelSize: number,
85
+ axis: 'z' | 'x',
86
+ mat: THREE.Material,
87
+ ): THREE.Mesh {
88
+ const shape = new THREE.Shape()
89
+ const [x0, y0] = pts[0]!
90
+ shape.moveTo(x0, y0)
91
+ for (let i = 1; i < pts.length; i++) {
92
+ const [px, py] = pts[i]!
93
+ shape.lineTo(px, py)
94
+ }
95
+ shape.closePath()
96
+
97
+ const safeBevelT = Math.min(bevelThickness, width * 0.35)
98
+ const safeBevelS = Math.min(bevelSize, width * 0.25)
99
+ const coreW = Math.max(1e-3, width - safeBevelT * 2)
100
+ const geom = new THREE.ExtrudeGeometry(shape, {
101
+ depth: coreW,
102
+ bevelEnabled: safeBevelT > 1e-4 && safeBevelS > 1e-4,
103
+ bevelThickness: safeBevelT,
104
+ bevelSize: safeBevelS,
105
+ bevelSegments: 3,
106
+ curveSegments: 8,
107
+ })
108
+ geom.translate(0, 0, -coreW / 2)
109
+ const mesh = new THREE.Mesh(geom, mat)
110
+ if (axis === 'z') {
111
+ // Shape X maps to +Z (front of car), Shape Y stays +Y, extrusion Z maps to X (width)
112
+ mesh.rotation.y = -Math.PI / 2
113
+ }
114
+ parent.add(mesh)
115
+ return mesh
116
+ }
117
+
118
+ // ---------------------------------------------------------------------------
119
+ // Vehicles & Mobility (4)
120
+ // ---------------------------------------------------------------------------
121
+
122
+ const buildTesla: SlugBuilderFn = (w, h, d, p) => {
123
+ // Build natively along Z (front +Z, rear -Z); rotate if w > d override is passed
124
+ const alongZ = d >= w
125
+ const carW = alongZ ? w : d
126
+ const carL = alongZ ? d : w
127
+ const inner = new THREE.Group()
128
+
129
+ const wheelR = Math.min(h * 0.245, carL * 0.086)
130
+ const tireW = carW * 0.135
131
+ const axleY = wheelR
132
+ const sillY = wheelR * 0.56
133
+ const bodyH = h - sillY
134
+
135
+ // Sculpted dark aerodynamic undertray & rocker sill skirt
136
+ addBox(inner, carW * 0.84, bodyH * 0.08, carL * 0.84, 0, sillY + bodyH * 0.04, 0, p.plasticDark)
137
+
138
+ // Sculpted fastback lower body shell (sleek Model 3 / Model Y side profile with beveled fenders)
139
+ const lowerPts: ReadonlyArray<readonly [number, number]> = [
140
+ [-carL * 0.45, sillY + bodyH * 0.04],
141
+ [-carL * 0.485, sillY + bodyH * 0.16],
142
+ [-carL * 0.49, sillY + bodyH * 0.36],
143
+ [-carL * 0.455, sillY + bodyH * 0.54],
144
+ [-carL * 0.34, sillY + bodyH * 0.6],
145
+ [carL * 0.22, sillY + bodyH * 0.55],
146
+ [carL * 0.38, sillY + bodyH * 0.46],
147
+ [carL * 0.475, sillY + bodyH * 0.32],
148
+ [carL * 0.49, sillY + bodyH * 0.16],
149
+ [carL * 0.455, sillY + bodyH * 0.04],
150
+ ]
151
+ addCarProfileExtrude(inner, lowerPts, carW * 0.94, carW * 0.08, bodyH * 0.055, 'z', p.ceramicWhite)
152
+
153
+ // Sculpted tapered fastback greenhouse cabin (narrower upper tumblehome + smooth arched coupe roof)
154
+ const cabinPts: ReadonlyArray<readonly [number, number]> = [
155
+ [-carL * 0.39, sillY + bodyH * 0.53],
156
+ [-carL * 0.25, sillY + bodyH * 0.84],
157
+ [-carL * 0.05, sillY + bodyH * 0.97],
158
+ [carL * 0.1, sillY + bodyH * 0.94],
159
+ [carL * 0.26, sillY + bodyH * 0.53],
160
+ ]
161
+ addCarProfileExtrude(inner, cabinPts, carW * 0.78, carW * 0.065, bodyH * 0.04, 'z', p.ceramicWhite)
162
+
163
+ // Panoramic dark smoked automotive glass roof + raked windshield + fastback hatch glass (high contrast vs white body)
164
+ const autoGlass = p.custom(0x1b2636, 0.1, 0.24)
165
+ const glassRoofPts: ReadonlyArray<readonly [number, number]> = [
166
+ [-carL * 0.375, sillY + bodyH * 0.56],
167
+ [-carL * 0.245, sillY + bodyH * 0.875],
168
+ [-carL * 0.045, sillY + bodyH * 1.0],
169
+ [carL * 0.105, sillY + bodyH * 0.975],
170
+ [carL * 0.275, sillY + bodyH * 0.56],
171
+ ]
172
+ addCarProfileExtrude(inner, glassRoofPts, carW * 0.68, carW * 0.025, bodyH * 0.022, 'z', autoGlass)
173
+
174
+ // Flush dark smoked side-window daylight opening (DLO) cleanly proud of cabin side tumblehome
175
+ const sideWinPts: ReadonlyArray<readonly [number, number]> = [
176
+ [-carL * 0.28, sillY + bodyH * 0.59],
177
+ [-carL * 0.19, sillY + bodyH * 0.81],
178
+ [-carL * 0.03, sillY + bodyH * 0.88],
179
+ [carL * 0.08, sillY + bodyH * 0.86],
180
+ [carL * 0.18, sillY + bodyH * 0.58],
181
+ ]
182
+ addCarProfileExtrude(inner, sideWinPts, carW * 0.825, carW * 0.01, bodyH * 0.012, 'z', autoGlass)
183
+ // Gloss-black B-pillar divider bar on side glass
184
+ addBox(inner, carW * 0.84, bodyH * 0.27, carL * 0.024, 0, sillY + bodyH * 0.72, -carL * 0.04, p.plasticDark)
185
+
186
+ // Recessed dark wheel-well arch liners + subtle flared fender lips
187
+ for (const sx of [-1, 1]) {
188
+ for (const sz of [-0.305, 0.305]) {
189
+ addCyl(inner, wheelR * 1.12, wheelR * 1.12, tireW * 0.92, sx * carW * 0.4, axleY, sz * carL, p.plasticDark, 20, [
190
+ 0,
191
+ 0,
192
+ Math.PI / 2,
193
+ ])
194
+ }
195
+ }
196
+
197
+ // Sculpted side wing mirrors on dark stalks + flush black door handles (proud of door panel)
198
+ for (const sx of [-1, 1]) {
199
+ addBox(inner, carW * 0.05, bodyH * 0.035, carL * 0.022, sx * carW * 0.45, sillY + bodyH * 0.56, carL * 0.14, p.plasticDark)
200
+ addRoundedRectExtrude(
201
+ inner,
202
+ carW * 0.095,
203
+ carL * 0.048,
204
+ bodyH * 0.065,
205
+ carL * 0.015,
206
+ sx * carW * 0.5,
207
+ sillY + bodyH * 0.59,
208
+ carL * 0.135,
209
+ p.ceramicWhite,
210
+ )
211
+ addBox(inner, carW * 0.018, bodyH * 0.02, carL * 0.055, sx * carW * 0.478, sillY + bodyH * 0.43, carL * 0.03, p.metalDark)
212
+ addBox(inner, carW * 0.018, bodyH * 0.02, carL * 0.055, sx * carW * 0.478, sillY + bodyH * 0.43, -carL * 0.14, p.metalDark)
213
+ }
214
+
215
+ // Front lower aero intake grille, swept LED DRL headlights, rear diffuser & sleek LED taillight bar
216
+ addBox(inner, carW * 0.56, bodyH * 0.09, carL * 0.03, 0, sillY + bodyH * 0.11, carL * 0.485, p.plasticDark)
217
+ addBox(inner, carW * 0.78, bodyH * 0.12, carL * 0.04, 0, sillY + bodyH * 0.1, -carL * 0.482, p.plasticDark)
218
+ for (const sx of [-1, 1]) {
219
+ addBox(inner, carW * 0.21, bodyH * 0.055, carL * 0.045, sx * carW * 0.3, sillY + bodyH * 0.35, carL * 0.468, p.emissiveWarm, [
220
+ 0,
221
+ sx * -0.26,
222
+ 0,
223
+ ])
224
+ addBox(inner, carW * 0.22, bodyH * 0.06, carL * 0.035, sx * carW * 0.31, sillY + bodyH * 0.43, -carL * 0.486, p.emissiveRed)
225
+ }
226
+ addBox(inner, carW * 0.64, bodyH * 0.024, carL * 0.03, 0, sillY + bodyH * 0.43, -carL * 0.49, p.emissiveRed)
227
+ // Rear license plate recessed badge
228
+ addBox(inner, carW * 0.2, bodyH * 0.075, carL * 0.016, 0, sillY + bodyH * 0.26, -carL * 0.496, p.ceramicWhite)
229
+
230
+ // 4 turbine alloy wheels
231
+ for (const sx of [-1, 1]) {
232
+ for (const sz of [-0.305, 0.305]) {
233
+ addCarWheel(inner, wheelR, tireW, sx * (carW * 0.44), axleY, sz * carL, 'x', p, false)
234
+ }
235
+ }
236
+
237
+ const root = new THREE.Group()
238
+ if (!alongZ) inner.rotation.y = Math.PI / 2
239
+ root.add(inner)
240
+ return normalizeAndGroundGroup(root, w, h, d)
241
+ }
242
+
243
+ const buildCamaro1967: SlugBuilderFn = (w, h, d, p) => {
244
+ // Build natively along X (front +X, rear -X) matching [4.09, 1.22, 1.89]
245
+ const alongX = w >= d
246
+ const carL = alongX ? w : d
247
+ const carW = alongX ? d : w
248
+ const inner = new THREE.Group()
249
+
250
+ const wheelR = Math.min(h * 0.27, carL * 0.088)
251
+ const tireW = carW * 0.145
252
+ const axleY = wheelR
253
+ const sillY = wheelR * 0.52
254
+ const bodyH = h - sillY
255
+
256
+ // Lower dark rocker panels & dual chrome rear exhaust pipes
257
+ addBox(inner, carL * 0.86, bodyH * 0.09, carW * 0.84, 0, sillY + bodyH * 0.05, 0, p.metalDark)
258
+ for (const sz of [-0.26, 0.26]) {
259
+ addCyl(inner, h * 0.028, h * 0.028, carL * 0.08, -carL * 0.49, sillY + bodyH * 0.06, sz * carW, p.metalChrome, 10, [
260
+ 0,
261
+ 0,
262
+ Math.PI / 2,
263
+ ])
264
+ }
265
+
266
+ // Classic long-hood, short-deck 1967 muscle coupe sculpted body profile
267
+ const bodyPts: ReadonlyArray<readonly [number, number]> = [
268
+ [-carL * 0.47, sillY + bodyH * 0.06],
269
+ [-carL * 0.49, sillY + bodyH * 0.22],
270
+ [-carL * 0.475, sillY + bodyH * 0.56],
271
+ [-carL * 0.28, sillY + bodyH * 0.58],
272
+ [carL * 0.14, sillY + bodyH * 0.59],
273
+ [carL * 0.46, sillY + bodyH * 0.53],
274
+ [carL * 0.49, sillY + bodyH * 0.32],
275
+ [carL * 0.47, sillY + bodyH * 0.08],
276
+ ]
277
+ addCarProfileExtrude(inner, bodyPts, carW * 0.92, carW * 0.055, bodyH * 0.04, 'x', p.paintBlue)
278
+
279
+ // Low-slung pony-car coupe greenhouse cabin (set rearward for classic proportions)
280
+ const cabinPts: ReadonlyArray<readonly [number, number]> = [
281
+ [-carL * 0.34, sillY + bodyH * 0.56],
282
+ [-carL * 0.2, sillY + bodyH * 0.96],
283
+ [carL * 0.01, sillY + bodyH * 0.98],
284
+ [carL * 0.14, sillY + bodyH * 0.57],
285
+ ]
286
+ addCarProfileExtrude(inner, cabinPts, carW * 0.78, carW * 0.045, bodyH * 0.03, 'x', p.paintBlue)
287
+
288
+ // Clean proud dark smoked automotive windshield + rear fastback glass + side windows (zero Z-fighting!)
289
+ const camaroGlass = p.custom(0x1b2636, 0.1, 0.24)
290
+ const glassPts: ReadonlyArray<readonly [number, number]> = [
291
+ [-carL * 0.325, sillY + bodyH * 0.58],
292
+ [-carL * 0.215, sillY + bodyH * 0.91],
293
+ [carL * 0.015, sillY + bodyH * 0.93],
294
+ [carL * 0.138, sillY + bodyH * 0.59],
295
+ ]
296
+ addCarProfileExtrude(inner, glassPts, carW * 0.72, carW * 0.012, bodyH * 0.015, 'x', camaroGlass)
297
+ const sideWinPts: ReadonlyArray<readonly [number, number]> = [
298
+ [-carL * 0.25, sillY + bodyH * 0.62],
299
+ [-carL * 0.17, sillY + bodyH * 0.89],
300
+ [-carL * 0.01, sillY + bodyH * 0.9],
301
+ [carL * 0.09, sillY + bodyH * 0.62],
302
+ ]
303
+ addCarProfileExtrude(inner, sideWinPts, carW * 0.805, carW * 0.008, bodyH * 0.01, 'x', camaroGlass)
304
+
305
+ // Raised cowl power-bulge hood + twin proud white racing stripes (+0.012m clearance)
306
+ addBox(inner, carL * 0.3, bodyH * 0.065, carW * 0.44, carL * 0.28, sillY + bodyH * 0.615, 0, p.paintBlue)
307
+ for (const sz of [-0.115, 0.115]) {
308
+ addBox(inner, carL * 0.32, bodyH * 0.025, carW * 0.11, carL * 0.29, sillY + bodyH * 0.655, sz * carW, p.paintWhite)
309
+ addBox(inner, carL * 0.15, bodyH * 0.025, carW * 0.11, -carL * 0.39, sillY + bodyH * 0.605, sz * carW, p.paintWhite)
310
+ }
311
+
312
+ // Rear ducktail spoiler lip
313
+ addBox(inner, carL * 0.06, bodyH * 0.09, carW * 0.84, -carL * 0.465, sillY + bodyH * 0.62, 0, p.paintBlue, [0, 0, 0.38])
314
+
315
+ // Recessed black front grille, twin round chrome headlights & wrap-around chrome bumpers
316
+ addBox(inner, carL * 0.04, bodyH * 0.22, carW * 0.84, carL * 0.482, sillY + bodyH * 0.34, 0, p.plasticDark)
317
+ for (const sz of [-0.32, 0.32]) {
318
+ addCyl(inner, h * 0.082, h * 0.082, carL * 0.042, carL * 0.492, sillY + bodyH * 0.35, sz * carW, p.metalChrome, 14, [
319
+ 0,
320
+ 0,
321
+ Math.PI / 2,
322
+ ])
323
+ addCyl(inner, h * 0.062, h * 0.062, carL * 0.048, carL * 0.497, sillY + bodyH * 0.35, sz * carW, p.emissiveWarm, 12, [
324
+ 0,
325
+ 0,
326
+ Math.PI / 2,
327
+ ])
328
+ // Rectangular classic rear taillights
329
+ addBox(inner, carL * 0.032, bodyH * 0.12, carW * 0.24, -carL * 0.49, sillY + bodyH * 0.38, sz * carW, p.emissiveRed)
330
+ }
331
+ // Front & rear gleaming chrome bumpers
332
+ addBox(inner, carL * 0.055, bodyH * 0.1, carW * 0.96, carL * 0.505, sillY + bodyH * 0.16, 0, p.metalChrome)
333
+ addBox(inner, carL * 0.055, bodyH * 0.1, carW * 0.96, -carL * 0.505, sillY + bodyH * 0.18, 0, p.metalChrome)
334
+
335
+ // Chrome side trim strips, dark wheel wells & round retro mirrors
336
+ for (const sz of [-1, 1]) {
337
+ addBox(inner, carL * 0.62, bodyH * 0.025, carW * 0.024, -carL * 0.04, sillY + bodyH * 0.44, sz * carW * 0.475, p.metalChrome)
338
+ addCyl(inner, h * 0.042, h * 0.042, carL * 0.04, carL * 0.1, sillY + bodyH * 0.62, sz * carW * 0.495, p.metalChrome, 10, [
339
+ 0,
340
+ 0,
341
+ Math.PI / 2,
342
+ ])
343
+ for (const sx of [-0.31, 0.31]) {
344
+ addCyl(inner, wheelR * 1.12, wheelR * 1.12, tireW * 0.9, sx * carL, axleY, sz * (carW * 0.4), p.plasticDark, 18, [
345
+ Math.PI / 2,
346
+ 0,
347
+ 0,
348
+ ])
349
+ }
350
+ }
351
+
352
+ // 4 chrome-rimmed deep-dish rally wheels
353
+ for (const sz of [-1, 1]) {
354
+ for (const sx of [-0.31, 0.31]) {
355
+ addCarWheel(inner, wheelR, tireW, sx * carL, axleY, sz * (carW * 0.44), 'z', p, true)
356
+ }
357
+ }
358
+
359
+ const root = new THREE.Group()
360
+ if (!alongX) inner.rotation.y = Math.PI / 2
361
+ root.add(inner)
362
+ return normalizeAndGroundGroup(root, w, h, d)
363
+ }
364
+
365
+ const buildScooter: SlugBuilderFn = (w, h, d, p) => {
366
+ const g = new THREE.Group()
367
+ const wheelR = Math.min(h * 0.14, w * 0.13)
368
+ const deckY = wheelR * 1.15
369
+
370
+ // Front & rear wheels + rear mudguard fender
371
+ for (const sx of [-0.38, 0.36]) {
372
+ addCyl(g, wheelR, wheelR, d * 0.12, sx * w, wheelR, 0, p.rubberBlack, 18, [Math.PI / 2, 0, 0])
373
+ addCyl(g, wheelR * 0.56, wheelR * 0.56, d * 0.13, sx * w, wheelR, 0, p.metalBrushed, 12, [Math.PI / 2, 0, 0])
374
+ }
375
+ addBox(g, wheelR * 1.8, wheelR * 0.28, d * 0.16, -w * 0.38, wheelR * 2.05, 0, p.metalDark, [0, 0, 0.28])
376
+
377
+ // Low footboard deck + rubber grip tape + red accent strip
378
+ addBox(g, w * 0.62, h * 0.05, d * 0.34, -w * 0.04, deckY, 0, p.metalDark)
379
+ addBox(g, w * 0.56, h * 0.015, d * 0.28, -w * 0.04, deckY + h * 0.03, 0, p.rubberBlack)
380
+ addBox(g, w * 0.58, h * 0.02, d * 0.36, -w * 0.04, deckY, 0, p.paintRed)
381
+
382
+ // Folding neck joint, angled front fork & tall steering column stem
383
+ addBox(g, w * 0.14, h * 0.08, d * 0.14, w * 0.28, deckY + h * 0.08, 0, p.metalDark, [0, 0, 0.55])
384
+ addCyl(g, d * 0.045, d * 0.055, h * 0.84, w * 0.29, h * 0.54, 0, p.metalDark, 12, [0, 0, 0.16])
385
+
386
+ // T-bar handlebars spanning Z + rubber handgrips + brake lever + front LED headlight
387
+ addCyl(g, d * 0.038, d * 0.038, d * 0.96, w * 0.22, h * 0.94, 0, p.metalBrushed, 12, [Math.PI / 2, 0, 0])
388
+ for (const sz of [-1, 1]) {
389
+ addCyl(g, d * 0.055, d * 0.055, d * 0.28, w * 0.22, h * 0.94, sz * d * 0.35, p.rubberBlack, 12, [
390
+ Math.PI / 2,
391
+ 0,
392
+ 0,
393
+ ])
394
+ }
395
+ addBox(g, w * 0.06, h * 0.05, d * 0.1, w * 0.27, h * 0.9, 0, p.emissiveWarm)
396
+ addBox(g, w * 0.05, h * 0.035, d * 0.14, w * 0.22, h * 0.97, 0, p.screenGlow)
397
+
398
+ return normalizeAndGroundGroup(g, w, h, d)
399
+ }
400
+
401
+ const buildSkate: SlugBuilderFn = (w, h, d, p) => {
402
+ const g = new THREE.Group()
403
+ const wheelR = h * 0.28
404
+ const deckY = h * 0.62
405
+
406
+ // Maple plywood flat deck + upturned nose & tail kicktails + dark grip tape
407
+ addBox(g, w * 0.62, h * 0.14, d * 0.94, 0, deckY, 0, p.woodLight)
408
+ addBox(g, w * 0.6, h * 0.04, d * 0.9, 0, deckY + h * 0.08, 0, p.rubberBlack)
409
+ // Graphic underside stripe
410
+ addBox(g, w * 0.44, h * 0.02, d * 0.48, 0, deckY - h * 0.075, 0, p.paintRed)
411
+
412
+ for (const sx of [-1, 1]) {
413
+ // Angled nose/tail kicktail
414
+ addBox(g, w * 0.22, h * 0.13, d * 0.88, sx * w * 0.39, deckY + h * 0.16, 0, p.woodLight, [0, 0, sx * 0.32])
415
+ addBox(g, w * 0.2, h * 0.04, d * 0.84, sx * w * 0.39, deckY + h * 0.22, 0, p.rubberBlack, [0, 0, sx * 0.32])
416
+
417
+ // Cast aluminum skateboard truck (baseplate + hanger axle)
418
+ const tx = sx * w * 0.26
419
+ addBox(g, w * 0.08, h * 0.12, d * 0.36, tx, deckY - h * 0.12, 0, p.metalBrushed)
420
+ addCyl(g, h * 0.1, h * 0.1, d * 0.84, tx, wheelR, 0, p.metalBrushed, 10, [Math.PI / 2, 0, 0])
421
+
422
+ // Pair of urethane skate wheels with chrome bearing hubs
423
+ for (const sz of [-1, 1]) {
424
+ addCyl(g, wheelR, wheelR, d * 0.18, tx, wheelR, sz * d * 0.4, p.paintYellow, 16, [Math.PI / 2, 0, 0])
425
+ addCyl(g, wheelR * 0.42, wheelR * 0.42, d * 0.2, tx, wheelR, sz * d * 0.4, p.metalChrome, 10, [
426
+ Math.PI / 2,
427
+ 0,
428
+ 0,
429
+ ])
430
+ }
431
+ }
432
+
433
+ return normalizeAndGroundGroup(g, w, h, d)
434
+ }
435
+
436
+ // ---------------------------------------------------------------------------
437
+ // Gym & Sports (6)
438
+ // ---------------------------------------------------------------------------
439
+
440
+ const buildBarbell: SlugBuilderFn = (w, h, d, p) => {
441
+ // Runs along Z (d = 1.72, w = 0.38, h = 0.38)
442
+ const g = new THREE.Group()
443
+ const plateR = Math.min(w, h) * 0.5
444
+ const barY = plateR
445
+
446
+ // Olympic knurled steel bar shaft + thicker rotating end sleeves
447
+ addCyl(g, plateR * 0.085, plateR * 0.085, d * 0.72, 0, barY, 0, p.metalChrome, 14, [Math.PI / 2, 0, 0])
448
+ for (const sz of [-1, 1]) {
449
+ // Rotating sleeve + inner flange
450
+ addCyl(g, plateR * 0.15, plateR * 0.15, d * 0.18, 0, barY, sz * d * 0.41, p.metalBrushed, 14, [
451
+ Math.PI / 2,
452
+ 0,
453
+ 0,
454
+ ])
455
+ addCyl(g, plateR * 0.22, plateR * 0.22, d * 0.02, 0, barY, sz * d * 0.33, p.metalBrushed, 14, [
456
+ Math.PI / 2,
457
+ 0,
458
+ 0,
459
+ ])
460
+
461
+ // 3 stacked Olympic bumper plates per end (20kg black + 15kg blue + 10kg red)
462
+ const plates: ReadonlyArray<readonly [number, number, number, THREE.Material]> = [
463
+ [0.36, 1.0, 0.036, p.rubberBlack],
464
+ [0.405, 0.92, 0.03, p.paintBlue],
465
+ [0.445, 0.8, 0.026, p.paintRed],
466
+ ]
467
+ for (const [zFrac, rScale, thickFrac, matPlate] of plates) {
468
+ addCyl(g, plateR * rScale, plateR * rScale, d * thickFrac, 0, barY, sz * d * zFrac, matPlate, 24, [
469
+ Math.PI / 2,
470
+ 0,
471
+ 0,
472
+ ])
473
+ addCyl(g, plateR * 0.28, plateR * 0.28, d * (thickFrac + 0.004), 0, barY, sz * d * zFrac, p.metalBrushed, 16, [
474
+ Math.PI / 2,
475
+ 0,
476
+ 0,
477
+ ])
478
+ }
479
+
480
+ // Spring lock collar
481
+ addCyl(g, plateR * 0.2, plateR * 0.2, d * 0.025, 0, barY, sz * d * 0.475, p.metalChrome, 12, [
482
+ Math.PI / 2,
483
+ 0,
484
+ 0,
485
+ ])
486
+ }
487
+
488
+ return normalizeAndGroundGroup(g, w, h, d)
489
+ }
490
+
491
+ const buildBarbellStand: SlugBuilderFn = (w, h, d, p) => {
492
+ // Power squat rack / barbell stand [1.34, 1.22, 1.72]: bar spans Z, depth along X
493
+ const g = new THREE.Group()
494
+ const tube = 0.065
495
+
496
+ // Heavy H-frame matte steel base rails + rubber floor feet
497
+ for (const sz of [-1, 1]) {
498
+ const zPos = sz * d * 0.34
499
+ addBox(g, w * 0.92, tube, tube, 0, tube * 0.5, zPos, p.metalDark)
500
+ // Vertical rack columns
501
+ addBox(g, tube, h * 0.9, tube, -w * 0.18, h * 0.45, zPos, p.metalDark)
502
+ // Angled rear gusset brace
503
+ addBox(g, w * 0.28, tube * 0.8, tube * 0.8, -w * 0.32, h * 0.18, zPos, p.metalDark, [0, 0, 0.72])
504
+ // Safety spotter catch arm extending forward
505
+ addBox(g, w * 0.48, tube * 0.85, tube * 0.9, w * 0.06, h * 0.52, zPos, p.metalDark)
506
+ // Upper J-cup barbell cradle
507
+ addBox(g, w * 0.14, tube * 0.9, tube * 1.1, -w * 0.12, h * 0.82, zPos, p.metalBrushed)
508
+ // Side weight storage horn + stored bumper plates
509
+ addCyl(g, 0.024, 0.024, w * 0.24, -w * 0.3, h * 0.34, zPos, p.metalChrome, 10, [0, 0, Math.PI / 2])
510
+ addCyl(g, h * 0.16, h * 0.16, 0.045, -w * 0.28, h * 0.34, zPos, p.rubberBlack, 18, [0, 0, Math.PI / 2])
511
+ addCyl(g, h * 0.13, h * 0.13, 0.04, -w * 0.34, h * 0.34, zPos, p.paintRed, 18, [0, 0, Math.PI / 2])
512
+ }
513
+
514
+ // Rear structural crossbars joining left & right uprights
515
+ addBox(g, tube, tube, d * 0.68, -w * 0.4, tube * 0.5, 0, p.metalDark)
516
+ addBox(g, tube, tube, d * 0.68, -w * 0.18, h * 0.34, 0, p.metalDark)
517
+ addBox(g, tube, tube, d * 0.68, -w * 0.18, h * 0.74, 0, p.metalDark)
518
+
519
+ // Racked Olympic barbell with bumper plates resting across top J-cups
520
+ const barX = -w * 0.1
521
+ const barY = h * 0.87
522
+ addCyl(g, 0.02, 0.02, d * 0.98, barX, barY, 0, p.metalChrome, 14, [Math.PI / 2, 0, 0])
523
+ for (const sz of [-1, 1]) {
524
+ addCyl(g, h * 0.18, h * 0.18, 0.05, barX, barY, sz * d * 0.42, p.rubberBlack, 20, [Math.PI / 2, 0, 0])
525
+ addCyl(g, h * 0.15, h * 0.15, 0.045, barX, barY, sz * d * 0.46, p.paintBlue, 20, [Math.PI / 2, 0, 0])
526
+ }
527
+
528
+ return normalizeAndGroundGroup(g, w, h, d)
529
+ }
530
+
531
+ const buildThreadmill: SlugBuilderFn = (w, h, d, p) => {
532
+ // Oriented along X (w = 2.1 length, d = 0.9 width, front motor/console at +X)
533
+ const g = new THREE.Group()
534
+ const deckH = h * 0.11
535
+
536
+ // Running deck frame, dark textured running belt & brushed aluminum side foot rails
537
+ addBox(g, w * 0.94, deckH, d * 0.92, -w * 0.02, deckH * 0.5, 0, p.metalDark)
538
+ addBox(g, w * 0.72, deckH * 0.25, d * 0.66, -w * 0.11, deckH + deckH * 0.05, 0, p.rubberBlack)
539
+ for (const sz of [-1, 1]) {
540
+ addBox(g, w * 0.74, deckH * 0.3, d * 0.11, -w * 0.11, deckH + deckH * 0.08, sz * d * 0.4, p.metalBrushed)
541
+ }
542
+
543
+ // Front motor hood cowling with red sport accent trim
544
+ addBox(g, w * 0.22, h * 0.16, d * 0.9, w * 0.36, deckH + h * 0.06, 0, p.plasticDark)
545
+ addBox(g, w * 0.23, h * 0.025, d * 0.92, w * 0.36, deckH + h * 0.12, 0, p.paintRed)
546
+
547
+ // Twin angled upright console masts & ergonomic side handrails
548
+ for (const sz of [-1, 1]) {
549
+ addBox(g, w * 0.07, h * 0.84, d * 0.08, w * 0.36, h * 0.52, sz * d * 0.42, p.metalDark, [0, 0, 0.16])
550
+ // Side handrails with foam grips
551
+ addCyl(g, d * 0.032, d * 0.032, w * 0.32, w * 0.16, h * 0.72, sz * d * 0.42, p.rubberBlack, 10, [
552
+ 0,
553
+ 0,
554
+ Math.PI / 2 - 0.12,
555
+ ])
556
+ }
557
+
558
+ // Angled cockpit console head, glowing telemetry display, cup holders & red safety key
559
+ const conX = w * 0.27
560
+ const conY = h * 0.88
561
+ addBox(g, w * 0.22, h * 0.16, d * 0.92, conX, conY, 0, p.plasticDark, [0, 0, 0.48])
562
+ addBox(g, w * 0.04, h * 0.16, d * 0.52, conX - w * 0.05, conY + h * 0.06, 0, p.screenGlow, [0, 0, 0.48])
563
+ // Red magnetic emergency stop clip & cross grip bar
564
+ addBox(g, w * 0.035, h * 0.035, d * 0.07, conX - w * 0.08, conY - h * 0.04, 0, p.paintRed)
565
+ addCyl(g, d * 0.025, d * 0.025, d * 0.62, conX - w * 0.11, conY - h * 0.06, 0, p.metalChrome, 10, [
566
+ Math.PI / 2,
567
+ 0,
568
+ 0,
569
+ ])
570
+
571
+ return normalizeAndGroundGroup(g, w, h, d)
572
+ }
573
+
574
+ const buildExerciseBike: SlugBuilderFn = (w, h, d, p) => {
575
+ // Oriented along Z (d = 1.12 length, w = 0.58 width, flywheel at +Z)
576
+ const g = new THREE.Group()
577
+
578
+ // Front & rear horizontal floor stabilizer bars with rubber leveling feet
579
+ for (const sz of [-0.42, 0.42]) {
580
+ addBox(g, w * 0.92, h * 0.05, d * 0.08, 0, h * 0.035, sz * d, p.metalDark)
581
+ for (const sx of [-1, 1]) {
582
+ addCyl(g, w * 0.06, w * 0.07, h * 0.03, sx * w * 0.44, h * 0.015, sz * d, p.rubberBlack, 10)
583
+ }
584
+ }
585
+
586
+ // Diagonal steel spin-bike main frame & bottom bracket shell
587
+ addBox(g, w * 0.14, h * 0.08, d * 0.84, 0, h * 0.09, 0, p.metalDark)
588
+ addBox(g, w * 0.14, h * 0.46, d * 0.1, 0, h * 0.34, -d * 0.2, p.metalDark, [0.34, 0, 0])
589
+ addBox(g, w * 0.14, h * 0.5, d * 0.1, 0, h * 0.36, d * 0.22, p.metalDark, [-0.36, 0, 0])
590
+ addBox(g, w * 0.16, h * 0.08, d * 0.46, 0, h * 0.48, 0.01, p.paintRed, [-0.15, 0, 0])
591
+
592
+ // Heavy weighted front flywheel + tension knob
593
+ const flyR = Math.min(h * 0.21, d * 0.22)
594
+ addCyl(g, flyR, flyR, w * 0.11, 0, h * 0.34, d * 0.34, p.metalBrushed, 24, [0, 0, Math.PI / 2])
595
+ addCyl(g, flyR * 0.65, flyR * 0.65, w * 0.125, 0, h * 0.34, d * 0.34, p.metalDark, 18, [0, 0, Math.PI / 2])
596
+ addCyl(g, w * 0.05, w * 0.04, h * 0.07, 0, h * 0.58, d * 0.22, p.paintRed, 10)
597
+
598
+ // Pedals & crank arms
599
+ for (const sx of [-1, 1]) {
600
+ addBox(g, w * 0.04, h * 0.16, d * 0.04, sx * w * 0.16, h * 0.26 + sx * h * 0.06, -d * 0.04, p.metalBrushed)
601
+ addBox(g, w * 0.16, h * 0.03, d * 0.12, sx * w * 0.26, h * 0.26 + sx * h * 0.12, -d * 0.04, p.plasticDark)
602
+ }
603
+
604
+ // Chrome seat post + sculpted cycling saddle
605
+ addCyl(g, w * 0.035, w * 0.035, h * 0.34, 0, h * 0.66, -d * 0.28, p.metalChrome, 10, [0.22, 0, 0])
606
+ addSphere(g, w * 0.18, 0, h * 0.84, -d * 0.31, p.leatherDark, [0.75, 0.35, 1.35], 12)
607
+
608
+ // Front handlebar post, bullhorn aero bars, water bottle & mini telemetry LCD
609
+ addCyl(g, w * 0.038, w * 0.038, h * 0.38, 0, h * 0.72, d * 0.28, p.metalChrome, 10, [-0.24, 0, 0])
610
+ addCyl(g, w * 0.032, w * 0.032, w * 0.9, 0, h * 0.92, d * 0.34, p.rubberBlack, 10, [0, 0, Math.PI / 2])
611
+ for (const sx of [-1, 1]) {
612
+ addCyl(g, w * 0.032, w * 0.032, d * 0.24, sx * w * 0.42, h * 0.94, d * 0.25, p.rubberBlack, 10, [
613
+ Math.PI / 2 - 0.18,
614
+ 0,
615
+ 0,
616
+ ])
617
+ }
618
+ addBox(g, w * 0.28, h * 0.1, d * 0.05, 0, h * 0.96, d * 0.34, p.screenGlow, [-0.55, 0, 0])
619
+ addCyl(g, w * 0.075, w * 0.07, h * 0.18, 0, h * 0.52, d * 0.02, p.paintBlue, 12)
620
+
621
+ return normalizeAndGroundGroup(g, w, h, d)
622
+ }
623
+
624
+ const buildBasketHoop: SlugBuilderFn = (w, h, d, p) => {
625
+ const g = new THREE.Group()
626
+
627
+ // Weighted ballast base + front roller wheels
628
+ addBox(g, w * 0.88, h * 0.08, d * 0.88, 0, h * 0.04, -d * 0.04, p.plasticDark)
629
+ for (const sx of [-1, 1]) {
630
+ addCyl(g, h * 0.025, h * 0.025, w * 0.08, sx * w * 0.38, h * 0.025, d * 0.38, p.rubberBlack, 10, [
631
+ 0,
632
+ 0,
633
+ Math.PI / 2,
634
+ ])
635
+ }
636
+
637
+ // Telescoping steel vertical support mast + diagonal brace struts
638
+ addCyl(g, w * 0.07, w * 0.085, h * 0.84, 0, h * 0.48, -d * 0.26, p.metalDark, 14)
639
+ for (const sx of [-1, 1]) {
640
+ addCyl(g, w * 0.022, w * 0.022, h * 0.28, sx * w * 0.18, h * 0.18, -d * 0.04, p.metalBrushed, 8, [
641
+ -0.65,
642
+ 0,
643
+ sx * 0.3,
644
+ ])
645
+ }
646
+ // Upper backboard offset arm
647
+ addBox(g, w * 0.14, h * 0.04, d * 0.34, 0, h * 0.82, -d * 0.09, p.metalDark)
648
+
649
+ // Clear polycarbonate backboard with outer white border & shooter's square
650
+ const bbY = h * 0.86
651
+ const bbZ = d * 0.06
652
+ const bbW = w * 0.98
653
+ const bbH = h * 0.26
654
+ addBox(g, bbW, bbH, d * 0.04, 0, bbY, bbZ, p.glass)
655
+ // Perimeter frame bars
656
+ const bf = 0.022
657
+ addBox(g, bbW, bf, d * 0.055, 0, bbY + bbH * 0.5, bbZ, p.metalDark)
658
+ addBox(g, bbW, bf, d * 0.055, 0, bbY - bbH * 0.5, bbZ, p.metalDark)
659
+ addBox(g, bf, bbH, d * 0.055, -bbW * 0.5, bbY, bbZ, p.metalDark)
660
+ addBox(g, bf, bbH, d * 0.055, bbW * 0.5, bbY, bbZ, p.metalDark)
661
+ // Inner painted shooter's rectangle
662
+ addBox(g, bbW * 0.38, bf * 0.7, d * 0.05, 0, bbY + bbH * 0.1, bbZ + 0.004, p.paintWhite)
663
+ addBox(g, bbW * 0.38, bf * 0.7, d * 0.05, 0, bbY - bbH * 0.22, bbZ + 0.004, p.paintWhite)
664
+ addBox(g, bf * 0.7, bbH * 0.32, d * 0.05, -bbW * 0.19, bbY - bbH * 0.06, bbZ + 0.004, p.paintWhite)
665
+ addBox(g, bf * 0.7, bbH * 0.32, d * 0.05, bbW * 0.19, bbY - bbH * 0.06, bbZ + 0.004, p.paintWhite)
666
+
667
+ // Bright orange-red steel rim torus + hanging tapered white net cords
668
+ const rimR = Math.min(w * 0.26, d * 0.28)
669
+ const rimY = bbY - bbH * 0.22
670
+ const rimZ = bbZ + rimR + d * 0.05
671
+ addBox(g, rimR * 0.45, h * 0.03, d * 0.08, 0, rimY, bbZ + d * 0.04, p.paintRed)
672
+ addTorus(g, rimR, 0.014, 0, rimY, rimZ, p.paintRed, [Math.PI / 2, 0, 0])
673
+
674
+ const netH = h * 0.14
675
+ addTorus(g, rimR * 0.64, 0.008, 0, rimY - netH, rimZ, p.ceramicWhite, [Math.PI / 2, 0, 0])
676
+ for (let i = 0; i < 10; i++) {
677
+ const a = (i / 10) * Math.PI * 2
678
+ const mx = Math.cos(a) * rimR * 0.82
679
+ const mz = rimZ + Math.sin(a) * rimR * 0.82
680
+ addCyl(g, 0.006, 0.006, netH * 1.05, mx, rimY - netH * 0.5, mz, p.ceramicWhite, 6, [
681
+ Math.sin(a) * 0.26,
682
+ 0,
683
+ -Math.cos(a) * 0.26,
684
+ ])
685
+ }
686
+
687
+ return normalizeAndGroundGroup(g, w, h, d)
688
+ }
689
+
690
+ const buildBall: SlugBuilderFn = (w, h, d, p) => {
691
+ const g = new THREE.Group()
692
+ const r = Math.min(w, h, d) * 0.5
693
+
694
+ // Classic basketball pebble-leather sphere with crisp dark channel seam ribs
695
+ addSphere(g, r * 0.985, 0, r, 0, p.terracotta, undefined, 20)
696
+ // Equatorial & meridian recessed seam tori
697
+ const seamTube = r * 0.032
698
+ addTorus(g, r * 0.985, seamTube, 0, r, 0, p.rubberBlack, [Math.PI / 2, 0, 0])
699
+ addTorus(g, r * 0.985, seamTube, 0, r, 0, p.rubberBlack, [0, 0, 0])
700
+ addTorus(g, r * 0.985, seamTube, 0, r, 0, p.rubberBlack, [0, Math.PI / 2, 0])
701
+ // Side curved grip channel ribs
702
+ addTorus(g, r * 0.72, seamTube * 0.85, r * 0.66, r, 0, p.rubberBlack, [0, Math.PI / 2, 0])
703
+ addTorus(g, r * 0.72, seamTube * 0.85, -r * 0.66, r, 0, p.rubberBlack, [0, Math.PI / 2, 0])
704
+
705
+ return normalizeAndGroundGroup(g, w, h, d)
706
+ }
707
+
708
+ // ---------------------------------------------------------------------------
709
+ // Music, Games & Small Props (6)
710
+ // ---------------------------------------------------------------------------
711
+
712
+ const buildPiano: SlugBuilderFn = (w, h, d, p) => {
713
+ const g = new THREE.Group()
714
+ const cabD = d * 0.56
715
+ const cabZ = -d * 0.22
716
+
717
+ // Main upright polished wood cabinet + beveled top lid + brass hinge trim
718
+ addBox(g, w * 0.96, h * 0.95, cabD, 0, h * 0.475, cabZ, p.woodDark)
719
+ addBox(g, w, h * 0.045, cabD * 1.06, 0, h * 0.975, cabZ, p.woodDark)
720
+ addBox(g, w * 0.92, h * 0.015, d * 0.03, 0, h * 0.955, cabZ + cabD * 0.5, p.metalCopper)
721
+
722
+ // Decorative recessed upper front panel & tilting sheet-music desk with open score
723
+ addBox(g, w * 0.86, h * 0.34, d * 0.04, 0, h * 0.74, cabZ + cabD * 0.51, p.woodWarm)
724
+ addBox(g, w * 0.44, h * 0.03, d * 0.08, 0, h * 0.62, cabZ + cabD * 0.56, p.woodDark)
725
+ addBox(g, w * 0.36, h * 0.22, d * 0.02, 0, h * 0.74, cabZ + cabD * 0.57, p.ceramicWhite, [-0.15, 0, 0])
726
+
727
+ // Extending keybed shelf + front cheek blocks + console support legs & toe blocks
728
+ const keyY = h * 0.52
729
+ const keyBedD = d * 0.46
730
+ const keyBedZ = d * 0.24
731
+ addBox(g, w * 0.96, h * 0.08, keyBedD, 0, keyY - h * 0.04, keyBedZ, p.woodDark)
732
+ for (const sx of [-1, 1]) {
733
+ addBox(g, w * 0.065, h * 0.1, keyBedD * 0.95, sx * w * 0.45, keyY + h * 0.02, keyBedZ, p.woodDark)
734
+ // Console leg + lower toe block
735
+ addBox(g, w * 0.065, h * 0.48, d * 0.1, sx * w * 0.44, h * 0.24, d * 0.36, p.woodDark)
736
+ addBox(g, w * 0.09, h * 0.06, d * 0.48, sx * w * 0.44, h * 0.03, d * 0.22, p.woodDark)
737
+ }
738
+
739
+ // Crisp 28 white natural keys + grouped 2+3 raised black sharp/flat keys
740
+ const whiteKeys = 28
741
+ const keySpanW = w * 0.82
742
+ const kw = keySpanW / whiteKeys
743
+ for (let i = 0; i < whiteKeys; i++) {
744
+ const kx = -keySpanW * 0.5 + (i + 0.5) * kw
745
+ addBox(g, kw * 0.88, h * 0.035, keyBedD * 0.72, kx, keyY + h * 0.015, keyBedZ + d * 0.02, p.ceramicWhite)
746
+ const noteInOctave = i % 7
747
+ if (i < whiteKeys - 1 && noteInOctave !== 2 && noteInOctave !== 6) {
748
+ addBox(
749
+ g,
750
+ kw * 0.58,
751
+ h * 0.04,
752
+ keyBedD * 0.45,
753
+ kx + kw * 0.5,
754
+ keyY + h * 0.034,
755
+ keyBedZ - d * 0.04,
756
+ p.plasticDark,
757
+ )
758
+ }
759
+ }
760
+
761
+ // 3 brass foot pedals in recessed bottom pedal box
762
+ addBox(g, w * 0.32, h * 0.09, d * 0.06, 0, h * 0.06, cabZ + cabD * 0.51, p.plasticDark)
763
+ for (const sx of [-0.08, 0, 0.08]) {
764
+ addBox(g, w * 0.028, h * 0.02, d * 0.14, sx * w, h * 0.055, cabZ + cabD * 0.58, p.metalCopper, [0.15, 0, 0])
765
+ }
766
+
767
+ return normalizeAndGroundGroup(g, w, h, d)
768
+ }
769
+
770
+ const buildGuitar: SlugBuilderFn = (w, h, d, p) => {
771
+ const g = new THREE.Group()
772
+ const bodyD = d * 0.85
773
+
774
+ // Classic acoustic figure-8 soundbox: lower bout + waist + upper bout
775
+ const lowerR = w * 0.48
776
+ const upperR = w * 0.35
777
+ const lowerY = h * 0.2
778
+ const upperY = h * 0.39
779
+ // Back & sides (mahogany) + warm spruce soundboard face
780
+ addCyl(g, lowerR, lowerR, bodyD, 0, lowerY, 0, p.woodDark, 24, [Math.PI / 2, 0, 0])
781
+ addCyl(g, upperR, upperR, bodyD, 0, upperY, 0, p.woodDark, 22, [Math.PI / 2, 0, 0])
782
+ addBox(g, w * 0.54, h * 0.16, bodyD, 0, h * 0.3, 0, p.woodDark)
783
+ addCyl(g, lowerR * 0.96, lowerR * 0.96, bodyD * 0.14, 0, lowerY, bodyD * 0.46, p.woodLight, 24, [
784
+ Math.PI / 2,
785
+ 0,
786
+ 0,
787
+ ])
788
+ addCyl(g, upperR * 0.96, upperR * 0.96, bodyD * 0.14, 0, upperY, bodyD * 0.46, p.woodLight, 22, [
789
+ Math.PI / 2,
790
+ 0,
791
+ 0,
792
+ ])
793
+
794
+ const topZ = bodyD * 0.54
795
+ // Recessed dark soundhole + decorative rosette ring
796
+ addCyl(g, w * 0.15, w * 0.15, bodyD * 0.08, 0, h * 0.34, topZ, p.plasticDark, 20, [Math.PI / 2, 0, 0])
797
+ addTorus(g, w * 0.17, w * 0.018, 0, h * 0.34, topZ + 0.002, p.woodWarm, [0, 0, 0])
798
+
799
+ // Teardrop pickguard + rosewood bridge with white saddle
800
+ addSphere(g, w * 0.11, w * 0.16, h * 0.25, topZ + 0.003, p.leatherDark, [0.8, 1.3, 0.12], 12)
801
+ addBox(g, w * 0.32, h * 0.032, bodyD * 0.14, 0, h * 0.16, topZ + 0.006, p.woodDark)
802
+ addBox(g, w * 0.24, h * 0.01, bodyD * 0.18, 0, h * 0.165, topZ + 0.01, p.ceramicWhite)
803
+
804
+ // Slender tapered neck + dark rosewood fretboard + metal frets
805
+ const neckW = w * 0.16
806
+ addBox(g, neckW, h * 0.42, bodyD * 0.38, 0, h * 0.67, bodyD * 0.24, p.woodWarm)
807
+ addBox(g, neckW * 1.04, h * 0.46, bodyD * 0.12, 0, h * 0.65, bodyD * 0.46, p.woodDark)
808
+ for (let i = 0; i < 10; i++) {
809
+ addBox(g, neckW * 1.05, 0.004, bodyD * 0.14, 0, h * (0.48 + i * 0.036), bodyD * 0.49, p.metalChrome)
810
+ }
811
+
812
+ // Headstock + 6 chrome tuning pegs
813
+ addBox(g, neckW * 1.38, h * 0.14, bodyD * 0.22, 0, h * 0.93, bodyD * 0.34, p.woodDark, [-0.14, 0, 0])
814
+ for (let i = 0; i < 3; i++) {
815
+ const py = h * (0.89 + i * 0.04)
816
+ for (const sx of [-1, 1]) {
817
+ addCyl(g, 0.01, 0.01, w * 0.09, sx * neckW * 0.88, py, bodyD * 0.32, p.metalChrome, 8, [0, 0, Math.PI / 2])
818
+ }
819
+ }
820
+
821
+ // 6 steel strings spanning bridge to nut
822
+ for (let i = 0; i < 6; i++) {
823
+ const sx = (-0.5 + i / 5) * neckW * 0.72
824
+ addCyl(g, 0.0022, 0.0022, h * 0.7, sx, h * 0.51, topZ + 0.014, p.metalBrushed, 6)
825
+ }
826
+
827
+ return normalizeAndGroundGroup(g, w, h, d)
828
+ }
829
+
830
+ const buildPoolTable: SlugBuilderFn = (w, h, d, p) => {
831
+ const g = new THREE.Group()
832
+ const apronH = h * 0.22
833
+ const tableTopY = h * 0.88
834
+ const legH = tableTopY - apronH
835
+
836
+ // 4 sturdy tapered mahogany legs with brass leveler feet
837
+ for (const sx of [-1, 1]) {
838
+ for (const sz of [-1, 1]) {
839
+ const lx = sx * w * 0.39
840
+ const lz = sz * d * 0.4
841
+ addCyl(g, w * 0.07, w * 0.052, legH, lx, legH * 0.5, lz, p.woodDark, 14)
842
+ addCyl(g, w * 0.056, w * 0.062, h * 0.05, lx, h * 0.025, lz, p.metalCopper, 12)
843
+ }
844
+ }
845
+
846
+ // Heavy boxed apron cabinet (kept strictly below felt bed to avoid coplanar Z-fighting)
847
+ addBox(g, w * 0.92, apronH, d * 0.94, 0, tableTopY - apronH * 0.5 - 0.012, 0, p.woodDark)
848
+
849
+ // Tournament green baize felt playfield (cleanly proud above slate/apron)
850
+ const railW = w * 0.085
851
+ const railH = h * 0.075
852
+ const feltY = tableTopY + h * 0.018
853
+ addBox(g, w - railW * 1.4, h * 0.032, d - railW * 1.4, 0, feltY, 0, p.feltGreen)
854
+
855
+ // 4 beveled mahogany outer cushion rails + green inner cushions + diamond sights
856
+ const railY = tableTopY + railH * 0.5 + 0.008
857
+ // Left & right long rails
858
+ for (const sx of [-1, 1]) {
859
+ addBox(g, railW, railH, d, sx * (w * 0.5 - railW * 0.5), railY, 0, p.woodWarm)
860
+ addBox(g, railW * 0.32, railH * 0.65, d * 0.84, sx * (w * 0.5 - railW * 1.05), railY, 0, p.feltGreen)
861
+ for (const sz of [-0.32, -0.16, 0.16, 0.32]) {
862
+ addBox(g, 0.022, 0.01, 0.022, sx * (w * 0.5 - railW * 0.45), railY + railH * 0.52, sz * d, p.ceramicWhite, [
863
+ 0,
864
+ Math.PI / 4,
865
+ 0,
866
+ ])
867
+ }
868
+ }
869
+ // Head & foot short rails
870
+ for (const sz of [-1, 1]) {
871
+ addBox(g, w, railH, railW, 0, railY, sz * (d * 0.5 - railW * 0.5), p.woodWarm)
872
+ addBox(g, w * 0.8, railH * 0.65, railW * 0.32, 0, railY, sz * (d * 0.5 - railW * 1.05), p.feltGreen)
873
+ }
874
+
875
+ // 6 drop pockets (4 corners + 2 side pockets) with brass corner castings
876
+ const pocketR = railW * 0.52
877
+ const pockets: ReadonlyArray<readonly [number, number]> = [
878
+ [-w * 0.5 + railW * 0.72, -d * 0.5 + railW * 0.72],
879
+ [w * 0.5 - railW * 0.72, -d * 0.5 + railW * 0.72],
880
+ [-w * 0.5 + railW * 0.72, d * 0.5 - railW * 0.72],
881
+ [w * 0.5 - railW * 0.72, d * 0.5 - railW * 0.72],
882
+ [-w * 0.5 + railW * 0.6, 0],
883
+ [w * 0.5 - railW * 0.6, 0],
884
+ ]
885
+ for (const [px, pz] of pockets) {
886
+ addCyl(g, pocketR, pocketR, railH * 1.08, px, railY, pz, p.rubberBlack, 14)
887
+ addTorus(g, pocketR * 1.04, 0.012, px, railY + railH * 0.52, pz, p.metalCopper, [Math.PI / 2, 0, 0])
888
+ }
889
+
890
+ // Racked billiard balls at foot spot + white cue ball at break spot
891
+ const ballR = Math.min(w * 0.022, 0.032)
892
+ const ballY = feltY + h * 0.015 + ballR
893
+ const ballMats = [p.paintYellow, p.paintBlue, p.paintRed, p.plasticDark, p.paintRed, p.paintYellow, p.paintBlue]
894
+ let idx = 0
895
+ for (let row = 0; row < 4; row++) {
896
+ for (let col = 0; col <= row; col++) {
897
+ const bx = (col - row * 0.5) * ballR * 2.12
898
+ const bz = -d * 0.22 - row * ballR * 1.85
899
+ const bm = row === 2 && col === 1 ? p.plasticDark : (ballMats[idx % ballMats.length] ?? p.paintRed)
900
+ addSphere(g, ballR, bx, ballY, bz, bm, undefined, 10)
901
+ idx++
902
+ }
903
+ }
904
+ // White cue ball
905
+ addSphere(g, ballR, 0, ballY, d * 0.24, p.ceramicWhite, undefined, 10)
906
+
907
+ // 2 tapered maple pool cues resting neatly along the side rail
908
+ for (const [offsetX, rotY] of [
909
+ [w * 0.45, 0.02],
910
+ [-w * 0.45, -0.02],
911
+ ] as const) {
912
+ addCyl(g, 0.016, 0.008, d * 0.56, offsetX, railY + railH * 0.66, 0, p.woodLight, 10, [Math.PI / 2, rotY, 0])
913
+ addCyl(g, 0.017, 0.015, d * 0.22, offsetX, railY + railH * 0.66, -d * 0.17, p.woodDark, 10, [
914
+ Math.PI / 2,
915
+ rotY,
916
+ 0,
917
+ ])
918
+ }
919
+
920
+ return normalizeAndGroundGroup(g, w, h, d)
921
+ }
922
+
923
+ const buildBooks: SlugBuilderFn = (w, h, d, p) => {
924
+ const g = new THREE.Group()
925
+
926
+ // 4 standing hardcover books on the left with covers, spines & recessed cream pages
927
+ const standingSpecs: ReadonlyArray<readonly [number, number, number, THREE.Material]> = [
928
+ [-0.36, 0.15, 0.96, p.paintBlue],
929
+ [-0.2, 0.13, 0.88, p.paintRed],
930
+ [-0.06, 0.14, 0.92, p.woodDark],
931
+ [0.09, 0.12, 0.82, p.fabricAccent],
932
+ ]
933
+ for (const [xFrac, thickFrac, hFrac, coverMat] of standingSpecs) {
934
+ const bw = w * thickFrac
935
+ const bh = h * hFrac
936
+ const bd = d * (0.82 + (hFrac - 0.8) * 0.6)
937
+ const bx = xFrac * w
938
+ // Outer cover & spine
939
+ addBox(g, bw, bh, bd, bx, bh * 0.5, 0, coverMat)
940
+ // Cream paper page block peeking from top and front edge
941
+ addBox(g, bw * 0.72, bh * 0.94, bd * 0.92, bx, bh * 0.5, -bd * 0.05, p.ceramicWhite)
942
+ // Gold/copper spine band accent
943
+ addBox(g, bw * 1.03, bh * 0.06, d * 0.04, bx, bh * 0.78, bd * 0.49, p.metalCopper)
944
+ }
945
+
946
+ // 2 books stacked horizontally on the right for organic curated composition
947
+ addBox(g, w * 0.34, h * 0.18, d * 0.88, w * 0.33, h * 0.09, 0, p.paintYellow)
948
+ addBox(g, w * 0.31, h * 0.13, d * 0.84, w * 0.33, h * 0.09, 0, p.ceramicWhite)
949
+ addBox(g, w * 0.3, h * 0.15, d * 0.8, w * 0.32, h * 0.255, 0.01, p.woodWarm, [0, 0.12, 0])
950
+ addBox(g, w * 0.27, h * 0.11, d * 0.76, w * 0.32, h * 0.255, 0.01, p.ceramicWhite, [0, 0.12, 0])
951
+
952
+ return normalizeAndGroundGroup(g, w, h, d)
953
+ }
954
+
955
+ const buildToy: SlugBuilderFn = (w, h, d, p) => {
956
+ const g = new THREE.Group()
957
+
958
+ // Classic painted wooden articulated nursery robot toy figure on plinth
959
+ addBox(g, w * 0.74, h * 0.06, d * 0.74, 0, h * 0.03, 0, p.woodLight)
960
+
961
+ // Feet & articulated wooden legs
962
+ for (const sx of [-1, 1]) {
963
+ addBox(g, w * 0.24, h * 0.08, d * 0.38, sx * w * 0.19, h * 0.1, d * 0.06, p.paintRed)
964
+ addCyl(g, w * 0.09, w * 0.09, h * 0.24, sx * w * 0.19, h * 0.26, 0, p.woodLight, 12)
965
+ }
966
+
967
+ // Rounded painted blue wooden torso + colorful front control dials
968
+ addRoundedRectExtrude(g, w * 0.56, d * 0.46, h * 0.3, w * 0.08, 0, h * 0.52, 0, p.paintBlue)
969
+ addBox(g, w * 0.38, h * 0.16, d * 0.06, 0, h * 0.54, d * 0.24, p.ceramicWhite)
970
+ addCyl(g, w * 0.055, w * 0.055, d * 0.05, -w * 0.1, h * 0.55, d * 0.27, p.paintRed, 10, [Math.PI / 2, 0, 0])
971
+ addCyl(g, w * 0.055, w * 0.055, d * 0.05, w * 0.1, h * 0.55, d * 0.27, p.paintYellow, 10, [Math.PI / 2, 0, 0])
972
+
973
+ // Articulated wooden arms & claw/sphere hands
974
+ for (const sx of [-1, 1]) {
975
+ addSphere(g, w * 0.085, sx * w * 0.34, h * 0.62, 0, p.paintYellow, undefined, 10)
976
+ addCyl(g, w * 0.068, w * 0.068, h * 0.26, sx * w * 0.39, h * 0.49, d * 0.04, p.woodLight, 10, [
977
+ -0.24,
978
+ 0,
979
+ sx * 0.18,
980
+ ])
981
+ addSphere(g, w * 0.075, sx * w * 0.42, h * 0.36, d * 0.08, p.paintRed, undefined, 10)
982
+ }
983
+
984
+ // Neck peg + boxy smiling yellow head + eyes + brass antenna
985
+ addCyl(g, w * 0.08, w * 0.09, h * 0.06, 0, h * 0.7, 0, p.woodWarm, 10)
986
+ addRoundedRectExtrude(g, w * 0.42, d * 0.4, h * 0.2, w * 0.06, 0, h * 0.82, 0, p.paintYellow)
987
+ for (const sx of [-1, 1]) {
988
+ addSphere(g, w * 0.045, sx * w * 0.1, h * 0.84, d * 0.2, p.plasticDark, undefined, 10)
989
+ addCyl(g, w * 0.055, w * 0.055, w * 0.06, sx * w * 0.24, h * 0.82, 0, p.paintRed, 10, [0, 0, Math.PI / 2])
990
+ }
991
+ addBox(g, w * 0.16, h * 0.025, d * 0.04, 0, h * 0.77, d * 0.2, p.plasticDark)
992
+ addCyl(g, w * 0.018, w * 0.018, h * 0.08, 0, h * 0.94, 0, p.metalCopper, 8)
993
+ addSphere(g, w * 0.045, 0, h * 0.98, 0, p.paintRed, undefined, 10)
994
+
995
+ return normalizeAndGroundGroup(g, w, h, d)
996
+ }
997
+
998
+ const buildCarToy: SlugBuilderFn = (w, h, d, p) => {
999
+ // Classic chunky retro wooden/painted kids' racer toy car oriented along Z [0.31, 0.38, 0.6]
1000
+ const g = new THREE.Group()
1001
+ const wheelR = Math.min(h * 0.26, d * 0.18)
1002
+ const tireW = w * 0.18
1003
+
1004
+ // Lower warm wood chassis base
1005
+ addBox(g, w * 0.64, h * 0.14, d * 0.86, 0, wheelR + h * 0.04, 0, p.woodWarm)
1006
+
1007
+ // Sculpted vintage red racer body with cream racing stripe & tapered nose
1008
+ addRoundedRectExtrude(g, w * 0.7, d * 0.78, h * 0.3, w * 0.12, 0, wheelR + h * 0.22, -d * 0.02, p.paintRed)
1009
+ addBox(g, w * 0.56, h * 0.22, d * 0.24, 0, wheelR + h * 0.2, d * 0.35, p.paintRed)
1010
+ addBox(g, w * 0.18, h * 0.03, d * 0.86, 0, wheelR + h * 0.38, 0.02, p.ceramicWhite)
1011
+
1012
+ // Rounded retro tail headrest fairing + open cockpit seat + angled steering wheel
1013
+ addSphere(g, w * 0.24, 0, wheelR + h * 0.44, -d * 0.22, p.paintRed, [0.9, 0.85, 1.3], 12)
1014
+ addBox(g, w * 0.46, h * 0.14, d * 0.26, 0, wheelR + h * 0.36, -d * 0.04, p.leatherDark)
1015
+ addCyl(g, w * 0.022, w * 0.022, h * 0.24, 0, wheelR + h * 0.48, d * 0.14, p.metalChrome, 8, [-0.55, 0, 0])
1016
+ addTorus(g, w * 0.2, w * 0.032, 0, wheelR + h * 0.56, d * 0.08, p.plasticDark, [0.95, 0, 0])
1017
+
1018
+ // Vintage metallic radiator grille + twin round headlights
1019
+ addBox(g, w * 0.44, h * 0.2, d * 0.04, 0, wheelR + h * 0.18, d * 0.47, p.metalBrushed)
1020
+ for (const sx of [-1, 1]) {
1021
+ addCyl(g, w * 0.09, w * 0.09, d * 0.08, sx * w * 0.26, wheelR + h * 0.26, d * 0.42, p.metalChrome, 12, [
1022
+ Math.PI / 2,
1023
+ 0,
1024
+ 0,
1025
+ ])
1026
+ addSphere(g, w * 0.075, sx * w * 0.26, wheelR + h * 0.26, d * 0.46, p.emissiveWarm, [1, 1, 0.4], 10)
1027
+ }
1028
+
1029
+ // 4 chunky protruding wooden-hub toy wheels
1030
+ for (const sx of [-1, 1]) {
1031
+ for (const sz of [-0.3, 0.3]) {
1032
+ const wx = sx * w * 0.41
1033
+ const wz = sz * d
1034
+ addCyl(g, wheelR, wheelR, tireW, wx, wheelR, wz, p.rubberBlack, 18, [0, 0, Math.PI / 2])
1035
+ addCyl(g, wheelR * 0.65, wheelR * 0.65, tireW * 1.06, wx, wheelR, wz, p.woodLight, 14, [0, 0, Math.PI / 2])
1036
+ addCyl(g, wheelR * 0.26, wheelR * 0.26, tireW * 1.12, wx, wheelR, wz, p.metalChrome, 10, [0, 0, Math.PI / 2])
1037
+ }
1038
+ }
1039
+
1040
+ return normalizeAndGroundGroup(g, w, h, d)
1041
+ }
1042
+
1043
+ export const PROPS_VEHICLES_BUILDERS: Record<string, SlugBuilderFn> = {
1044
+ // Vehicles & Mobility (4)
1045
+ tesla: buildTesla,
1046
+ '1967-chevrolet-camaro-moa24wsf': buildCamaro1967,
1047
+ scooter: buildScooter,
1048
+ skate: buildSkate,
1049
+
1050
+ // Gym & Sports (6)
1051
+ barbell: buildBarbell,
1052
+ 'barbell-stand': buildBarbellStand,
1053
+ threadmill: buildThreadmill,
1054
+ 'exercise-bike': buildExerciseBike,
1055
+ 'basket-hoop': buildBasketHoop,
1056
+ ball: buildBall,
1057
+
1058
+ // Music, Games & Small Props (6)
1059
+ piano: buildPiano,
1060
+ guitar: buildGuitar,
1061
+ 'pool-table': buildPoolTable,
1062
+ books: buildBooks,
1063
+ toy: buildToy,
1064
+ 'car-toy': buildCarToy,
1065
+ }