@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.
- package/ASSETS.md +298 -0
- package/LICENSE +21 -0
- package/README.md +71 -2
- package/dist/agent-operations.d.ts +8 -0
- package/dist/agent-operations.js +305 -0
- package/dist/agent-tools.d.ts +7 -0
- package/dist/agent-tools.js +128 -0
- package/dist/audit.d.ts +78 -0
- package/dist/bin/pascal-mit-assets.js +5238 -0
- package/dist/bom.d.ts +123 -0
- package/dist/cad/appliance-mep-builders.d.ts +7 -0
- package/dist/cad/furniture-builders.d.ts +9 -0
- package/dist/cad/index.d.ts +48 -0
- package/dist/cad/index.js +23 -0
- package/dist/cad/kitchen-bath-builders.d.ts +9 -0
- package/dist/cad/outdoor-fenestration-builders.d.ts +8 -0
- package/dist/cad/primitives.d.ts +56 -0
- package/dist/cad/props-vehicles-builders.d.ts +8 -0
- package/dist/chunk-2qgndrap.js +5200 -0
- package/dist/chunk-6hzyh6qv.js +346 -0
- package/dist/chunk-f72r2bmp.js +84 -0
- package/dist/chunk-hqgm57dv.js +310 -0
- package/dist/chunk-kgwk6kan.js +150 -0
- package/dist/chunk-raafkn3w.js +286 -0
- package/dist/chunk-vzmjt9dz.js +4380 -0
- package/dist/chunk-xhkwv6t4.js +5080 -0
- package/dist/hdri/index.d.ts +1 -0
- package/dist/hdri/index.js +322 -0
- package/dist/hdri/sky.d.ts +26 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.js +198 -0
- package/dist/manifest.d.ts +46 -0
- package/dist/materials/index.d.ts +10 -0
- package/dist/materials/index.js +1464 -0
- package/dist/materials/ktx2.d.ts +10 -0
- package/dist/materials/noise.d.ts +89 -0
- package/dist/materials/patterns.d.ts +15 -0
- package/dist/nodes/mit-item.d.ts +76 -0
- package/dist/render.d.ts +10 -0
- package/dist/render.js +24 -0
- package/dist/scripts/build-assets.js +17129 -0
- package/dist/sfx/index.d.ts +1 -0
- package/dist/sfx/index.js +1223 -0
- package/dist/sfx/synth.d.ts +25 -0
- package/dist/sku-crosswalk.d.ts +46 -0
- package/dist/ui/chat-card.d.ts +7 -0
- package/dist/ui/host-panel.d.ts +1 -0
- package/dist/ui/inspector-card.d.ts +4 -0
- package/dist/ui/schedule-view.d.ts +1 -0
- package/package.json +135 -4
- package/src/agent-operations.ts +373 -0
- package/src/agent-tools.ts +136 -0
- package/src/audit.ts +356 -0
- package/src/bom.ts +512 -0
- package/src/cad/appliance-mep-builders.ts +1336 -0
- package/src/cad/furniture-builders.ts +1622 -0
- package/src/cad/index.ts +993 -0
- package/src/cad/kitchen-bath-builders.ts +1189 -0
- package/src/cad/outdoor-fenestration-builders.ts +1499 -0
- package/src/cad/primitives.ts +286 -0
- package/src/cad/props-vehicles-builders.ts +1065 -0
- package/src/hdri/index.ts +5 -0
- package/src/hdri/sky.ts +481 -0
- package/src/index.ts +127 -0
- package/src/manifest.ts +5296 -0
- package/src/materials/index.ts +56 -0
- package/src/materials/ktx2.ts +138 -0
- package/src/materials/noise.ts +417 -0
- package/src/materials/patterns.ts +1507 -0
- package/src/nodes/mit-item.ts +163 -0
- package/src/render.ts +25 -0
- package/src/sfx/index.ts +6 -0
- package/src/sfx/synth.ts +1495 -0
- package/src/sku-crosswalk.ts +3868 -0
- package/src/ui/chat-card.tsx +93 -0
- package/src/ui/host-panel.tsx +330 -0
- package/src/ui/inspector-card.tsx +213 -0
- package/src/ui/schedule-view.tsx +188 -0
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared clean-room MIT procedural Three.js geometry & fresh PBR material helpers.
|
|
3
|
+
* Strictly React-free, editor-free, and node:*-free.
|
|
4
|
+
*
|
|
5
|
+
* INVARIANT: Always create fresh materials per build call (never cache global singletons)
|
|
6
|
+
* so Pascal <GeometrySystem> disposal never breaks sibling meshes.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import * as THREE from 'three'
|
|
10
|
+
|
|
11
|
+
export type MaterialPalette = {
|
|
12
|
+
woodWarm: THREE.MeshStandardMaterial
|
|
13
|
+
woodDark: THREE.MeshStandardMaterial
|
|
14
|
+
woodLight: THREE.MeshStandardMaterial
|
|
15
|
+
fabricNeutral: THREE.MeshStandardMaterial
|
|
16
|
+
fabricAccent: THREE.MeshStandardMaterial
|
|
17
|
+
leatherDark: THREE.MeshStandardMaterial
|
|
18
|
+
metalChrome: THREE.MeshStandardMaterial
|
|
19
|
+
metalBrushed: THREE.MeshStandardMaterial
|
|
20
|
+
metalDark: THREE.MeshStandardMaterial
|
|
21
|
+
metalCopper: THREE.MeshStandardMaterial
|
|
22
|
+
ceramicWhite: THREE.MeshStandardMaterial
|
|
23
|
+
ceramicMatte: THREE.MeshStandardMaterial
|
|
24
|
+
glass: THREE.MeshStandardMaterial
|
|
25
|
+
mirror: THREE.MeshStandardMaterial
|
|
26
|
+
plasticWhite: THREE.MeshStandardMaterial
|
|
27
|
+
plasticDark: THREE.MeshStandardMaterial
|
|
28
|
+
rubberBlack: THREE.MeshStandardMaterial
|
|
29
|
+
foliageDark: THREE.MeshStandardMaterial
|
|
30
|
+
foliageLight: THREE.MeshStandardMaterial
|
|
31
|
+
barkBrown: THREE.MeshStandardMaterial
|
|
32
|
+
terracotta: THREE.MeshStandardMaterial
|
|
33
|
+
stoneLight: THREE.MeshStandardMaterial
|
|
34
|
+
stoneDark: THREE.MeshStandardMaterial
|
|
35
|
+
screenGlow: THREE.MeshStandardMaterial
|
|
36
|
+
emissiveWarm: THREE.MeshStandardMaterial
|
|
37
|
+
emissiveGreen: THREE.MeshStandardMaterial
|
|
38
|
+
emissiveRed: THREE.MeshStandardMaterial
|
|
39
|
+
feltGreen: THREE.MeshStandardMaterial
|
|
40
|
+
paintRed: THREE.MeshStandardMaterial
|
|
41
|
+
paintBlue: THREE.MeshStandardMaterial
|
|
42
|
+
paintYellow: THREE.MeshStandardMaterial
|
|
43
|
+
paintWhite: THREE.MeshStandardMaterial
|
|
44
|
+
custom: (hex: number, roughness?: number, metalness?: number) => THREE.MeshStandardMaterial
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function mat(
|
|
48
|
+
color: number,
|
|
49
|
+
roughness: number,
|
|
50
|
+
metalness = 0.0,
|
|
51
|
+
extra?: Partial<THREE.MeshStandardMaterialParameters>,
|
|
52
|
+
): THREE.MeshStandardMaterial {
|
|
53
|
+
return new THREE.MeshStandardMaterial({
|
|
54
|
+
color,
|
|
55
|
+
roughness,
|
|
56
|
+
metalness,
|
|
57
|
+
...extra,
|
|
58
|
+
})
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function createMitMaterialPalette(accentHex?: number): MaterialPalette {
|
|
62
|
+
const accent = accentHex ?? 0x5c7285
|
|
63
|
+
return {
|
|
64
|
+
woodWarm: mat(0xa8764c, 0.58, 0.02),
|
|
65
|
+
woodDark: mat(0x5a3b26, 0.52, 0.03),
|
|
66
|
+
woodLight: mat(0xd2b48c, 0.62, 0.02),
|
|
67
|
+
fabricNeutral: mat(0xc8c2b8, 0.88, 0.0),
|
|
68
|
+
fabricAccent: mat(accent, 0.85, 0.0),
|
|
69
|
+
leatherDark: mat(0x3a2c24, 0.48, 0.04),
|
|
70
|
+
metalChrome: mat(0xdce2e8, 0.16, 0.92),
|
|
71
|
+
metalBrushed: mat(0xb8bec6, 0.34, 0.86),
|
|
72
|
+
metalDark: mat(0x2c3036, 0.42, 0.78),
|
|
73
|
+
metalCopper: mat(0xc87d55, 0.28, 0.88),
|
|
74
|
+
ceramicWhite: mat(0xf2f1ed, 0.18, 0.02),
|
|
75
|
+
ceramicMatte: mat(0xe3dfd7, 0.52, 0.01),
|
|
76
|
+
glass: mat(0xcfe4ee, 0.08, 0.1, { transparent: true, opacity: 0.42 }),
|
|
77
|
+
mirror: mat(0xdde6ec, 0.05, 0.96),
|
|
78
|
+
plasticWhite: mat(0xededeb, 0.38, 0.02),
|
|
79
|
+
plasticDark: mat(0x26292e, 0.45, 0.05),
|
|
80
|
+
rubberBlack: mat(0x1f2124, 0.88, 0.02),
|
|
81
|
+
foliageDark: mat(0x386137, 0.78, 0.0),
|
|
82
|
+
foliageLight: mat(0x55844a, 0.74, 0.0),
|
|
83
|
+
barkBrown: mat(0x634832, 0.9, 0.0),
|
|
84
|
+
terracotta: mat(0xb86844, 0.76, 0.0),
|
|
85
|
+
stoneLight: mat(0xcbc6bc, 0.78, 0.02),
|
|
86
|
+
stoneDark: mat(0x5c5c5a, 0.72, 0.04),
|
|
87
|
+
screenGlow: mat(0x1e2836, 0.14, 0.25, { emissive: 0x162438, emissiveIntensity: 0.35 }),
|
|
88
|
+
emissiveWarm: mat(0xfff1d6, 0.2, 0.0, { emissive: 0xffe4b5, emissiveIntensity: 0.75 }),
|
|
89
|
+
emissiveGreen: mat(0x2fb364, 0.3, 0.05, { emissive: 0x1d9a4f, emissiveIntensity: 0.8 }),
|
|
90
|
+
emissiveRed: mat(0xc9352b, 0.32, 0.05, { emissive: 0xb02218, emissiveIntensity: 0.45 }),
|
|
91
|
+
feltGreen: mat(0x1f6e43, 0.92, 0.0),
|
|
92
|
+
paintRed: mat(0xb8322a, 0.36, 0.12),
|
|
93
|
+
paintBlue: mat(0x2e5b88, 0.32, 0.25),
|
|
94
|
+
paintYellow: mat(0xd9a834, 0.42, 0.08),
|
|
95
|
+
paintWhite: mat(0xebeae6, 0.45, 0.04),
|
|
96
|
+
custom: (hex: number, roughness = 0.55, metalness = 0.05) => mat(hex, roughness, metalness),
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export function addBox(
|
|
101
|
+
parent: THREE.Object3D,
|
|
102
|
+
w: number,
|
|
103
|
+
h: number,
|
|
104
|
+
d: number,
|
|
105
|
+
x: number,
|
|
106
|
+
y: number,
|
|
107
|
+
z: number,
|
|
108
|
+
material: THREE.Material,
|
|
109
|
+
rot?: [number, number, number],
|
|
110
|
+
): THREE.Mesh {
|
|
111
|
+
const mesh = new THREE.Mesh(new THREE.BoxGeometry(w, h, d), material)
|
|
112
|
+
mesh.position.set(x, y, z)
|
|
113
|
+
if (rot) mesh.rotation.set(rot[0], rot[1], rot[2])
|
|
114
|
+
mesh.castShadow = true
|
|
115
|
+
mesh.receiveShadow = true
|
|
116
|
+
parent.add(mesh)
|
|
117
|
+
return mesh
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export function addCyl(
|
|
121
|
+
parent: THREE.Object3D,
|
|
122
|
+
rTop: number,
|
|
123
|
+
rBot: number,
|
|
124
|
+
h: number,
|
|
125
|
+
x: number,
|
|
126
|
+
y: number,
|
|
127
|
+
z: number,
|
|
128
|
+
material: THREE.Material,
|
|
129
|
+
radialSegments = 16,
|
|
130
|
+
rot?: [number, number, number],
|
|
131
|
+
): THREE.Mesh {
|
|
132
|
+
const mesh = new THREE.Mesh(new THREE.CylinderGeometry(rTop, rBot, h, radialSegments), material)
|
|
133
|
+
mesh.position.set(x, y, z)
|
|
134
|
+
if (rot) mesh.rotation.set(rot[0], rot[1], rot[2])
|
|
135
|
+
mesh.castShadow = true
|
|
136
|
+
mesh.receiveShadow = true
|
|
137
|
+
parent.add(mesh)
|
|
138
|
+
return mesh
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export function addSphere(
|
|
142
|
+
parent: THREE.Object3D,
|
|
143
|
+
r: number,
|
|
144
|
+
x: number,
|
|
145
|
+
y: number,
|
|
146
|
+
z: number,
|
|
147
|
+
material: THREE.Material,
|
|
148
|
+
scale?: [number, number, number],
|
|
149
|
+
segments = 14,
|
|
150
|
+
): THREE.Mesh {
|
|
151
|
+
const mesh = new THREE.Mesh(new THREE.SphereGeometry(r, segments, Math.max(8, Math.floor(segments * 0.75))), material)
|
|
152
|
+
mesh.position.set(x, y, z)
|
|
153
|
+
if (scale) mesh.scale.set(scale[0], scale[1], scale[2])
|
|
154
|
+
mesh.castShadow = true
|
|
155
|
+
mesh.receiveShadow = true
|
|
156
|
+
parent.add(mesh)
|
|
157
|
+
return mesh
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export function addTorus(
|
|
161
|
+
parent: THREE.Object3D,
|
|
162
|
+
r: number,
|
|
163
|
+
tube: number,
|
|
164
|
+
x: number,
|
|
165
|
+
y: number,
|
|
166
|
+
z: number,
|
|
167
|
+
material: THREE.Material,
|
|
168
|
+
rot?: [number, number, number],
|
|
169
|
+
): THREE.Mesh {
|
|
170
|
+
const mesh = new THREE.Mesh(new THREE.TorusGeometry(r, tube, 10, 22), material)
|
|
171
|
+
mesh.position.set(x, y, z)
|
|
172
|
+
if (rot) mesh.rotation.set(rot[0], rot[1], rot[2])
|
|
173
|
+
mesh.castShadow = true
|
|
174
|
+
mesh.receiveShadow = true
|
|
175
|
+
parent.add(mesh)
|
|
176
|
+
return mesh
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export function addRoundedRectExtrude(
|
|
180
|
+
parent: THREE.Object3D,
|
|
181
|
+
w: number,
|
|
182
|
+
d: number,
|
|
183
|
+
h: number,
|
|
184
|
+
radius: number,
|
|
185
|
+
x: number,
|
|
186
|
+
y: number,
|
|
187
|
+
z: number,
|
|
188
|
+
material: THREE.Material,
|
|
189
|
+
): THREE.Mesh {
|
|
190
|
+
const r = Math.min(radius, w * 0.45, d * 0.45)
|
|
191
|
+
const hw = w / 2
|
|
192
|
+
const hd = d / 2
|
|
193
|
+
const shape = new THREE.Shape()
|
|
194
|
+
shape.moveTo(-hw + r, -hd)
|
|
195
|
+
shape.lineTo(hw - r, -hd)
|
|
196
|
+
shape.quadraticCurveTo(hw, -hd, hw, -hd + r)
|
|
197
|
+
shape.lineTo(hw, hd - r)
|
|
198
|
+
shape.quadraticCurveTo(hw, hd, hw - r, hd)
|
|
199
|
+
shape.lineTo(-hw + r, hd)
|
|
200
|
+
shape.quadraticCurveTo(-hw, hd, -hw, hd - r)
|
|
201
|
+
shape.lineTo(-hw, -hd + r)
|
|
202
|
+
shape.quadraticCurveTo(-hw, -hd, -hw + r, -hd)
|
|
203
|
+
|
|
204
|
+
const geo = new THREE.ExtrudeGeometry(shape, {
|
|
205
|
+
depth: Math.max(0.004, h),
|
|
206
|
+
bevelEnabled: true,
|
|
207
|
+
bevelThickness: Math.min(0.012, h * 0.25),
|
|
208
|
+
bevelSize: Math.min(0.012, r * 0.35),
|
|
209
|
+
bevelSegments: 2,
|
|
210
|
+
curveSegments: 6,
|
|
211
|
+
})
|
|
212
|
+
geo.rotateX(-Math.PI / 2)
|
|
213
|
+
geo.computeBoundingBox()
|
|
214
|
+
if (geo.boundingBox) {
|
|
215
|
+
const cy = (geo.boundingBox.min.y + geo.boundingBox.max.y) / 2
|
|
216
|
+
geo.translate(0, -cy, 0)
|
|
217
|
+
}
|
|
218
|
+
const mesh = new THREE.Mesh(geo, material)
|
|
219
|
+
mesh.position.set(x, y, z)
|
|
220
|
+
mesh.castShadow = true
|
|
221
|
+
mesh.receiveShadow = true
|
|
222
|
+
parent.add(mesh)
|
|
223
|
+
return mesh
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export function addFourLegs(
|
|
227
|
+
parent: THREE.Object3D,
|
|
228
|
+
w: number,
|
|
229
|
+
d: number,
|
|
230
|
+
legH: number,
|
|
231
|
+
legR: number,
|
|
232
|
+
inset: number,
|
|
233
|
+
material: THREE.Material,
|
|
234
|
+
taperRatio = 0.72,
|
|
235
|
+
): void {
|
|
236
|
+
const xs = [-w / 2 + inset, w / 2 - inset]
|
|
237
|
+
const zs = [-d / 2 + inset, d / 2 - inset]
|
|
238
|
+
for (const x of xs) {
|
|
239
|
+
for (const z of zs) {
|
|
240
|
+
addCyl(parent, legR, legR * taperRatio, legH, x, legH / 2, z, material, 10)
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Fits a procedurally built group cleanly into exact target [w, h, d] bounds,
|
|
247
|
+
* centered on X/Z and resting on Y = 0.
|
|
248
|
+
*/
|
|
249
|
+
export function normalizeAndGroundGroup(
|
|
250
|
+
inner: THREE.Group,
|
|
251
|
+
targetW: number,
|
|
252
|
+
targetH: number,
|
|
253
|
+
targetD: number,
|
|
254
|
+
): THREE.Group {
|
|
255
|
+
const root = new THREE.Group()
|
|
256
|
+
root.add(inner)
|
|
257
|
+
inner.updateMatrixWorld(true)
|
|
258
|
+
const box = new THREE.Box3().setFromObject(inner)
|
|
259
|
+
if (box.isEmpty()) return root
|
|
260
|
+
|
|
261
|
+
const size = new THREE.Vector3()
|
|
262
|
+
const center = new THREE.Vector3()
|
|
263
|
+
box.getSize(size)
|
|
264
|
+
box.getCenter(center)
|
|
265
|
+
|
|
266
|
+
const safeW = Number.isFinite(targetW) && targetW > 1e-4 ? targetW : 1e-4
|
|
267
|
+
const safeH = Number.isFinite(targetH) && targetH > 1e-4 ? targetH : 1e-4
|
|
268
|
+
const safeD = Number.isFinite(targetD) && targetD > 1e-4 ? targetD : 1e-4
|
|
269
|
+
|
|
270
|
+
const sx = size.x > 1e-5 ? safeW / size.x : 1
|
|
271
|
+
const sy = size.y > 1e-5 ? safeH / size.y : 1
|
|
272
|
+
const sz = size.z > 1e-5 ? safeD / size.z : 1
|
|
273
|
+
|
|
274
|
+
inner.position.set(-center.x * sx, -box.min.y * sy, -center.z * sz)
|
|
275
|
+
inner.scale.set(sx, sy, sz)
|
|
276
|
+
root.updateMatrixWorld(true)
|
|
277
|
+
return root
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
export type SlugBuilderFn = (
|
|
281
|
+
w: number,
|
|
282
|
+
h: number,
|
|
283
|
+
d: number,
|
|
284
|
+
p: MaterialPalette,
|
|
285
|
+
slug: string,
|
|
286
|
+
) => THREE.Group
|