@developerz.ai/ts23d 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 (524) hide show
  1. package/.claude/agents/bug-hunter.md +21 -0
  2. package/.claude/agents/docs-author.md +13 -0
  3. package/.claude/agents/dx-auditor.md +14 -0
  4. package/.claude/agents/primitive-author.md +22 -0
  5. package/.claude/agents/recipe-author.md +36 -0
  6. package/.claude/agents/visual-reviewer.md +23 -0
  7. package/.claude/commands/feature.md +28 -0
  8. package/.claude/commands/new-recipe.md +19 -0
  9. package/.claude/commands/release.md +14 -0
  10. package/.claude/commands/verify.md +9 -0
  11. package/.claude/skills/author-recipe/SKILL.md +93 -0
  12. package/CHANGELOG.md +79 -0
  13. package/CLAUDE.md +85 -0
  14. package/LICENSE +21 -0
  15. package/README.md +380 -2
  16. package/dist/chunk-11v28977.js +1575 -0
  17. package/dist/chunk-11v28977.js.map +30 -0
  18. package/dist/chunk-1ypfs7ga.js +3571 -0
  19. package/dist/chunk-1ypfs7ga.js.map +42 -0
  20. package/dist/chunk-4ddzsqtc.js +464 -0
  21. package/dist/chunk-4ddzsqtc.js.map +19 -0
  22. package/dist/chunk-a8fxakcj.js +19 -0
  23. package/dist/chunk-a8fxakcj.js.map +11 -0
  24. package/dist/chunk-gcyp9b4d.js +755 -0
  25. package/dist/chunk-gcyp9b4d.js.map +22 -0
  26. package/dist/chunk-kgvbpqqw.js +44 -0
  27. package/dist/chunk-kgvbpqqw.js.map +10 -0
  28. package/dist/chunk-kvcep7ft.js +1919 -0
  29. package/dist/chunk-kvcep7ft.js.map +43 -0
  30. package/dist/chunk-ravbb06q.js +89 -0
  31. package/dist/chunk-ravbb06q.js.map +11 -0
  32. package/dist/chunk-w1zyhj40.js +1031 -0
  33. package/dist/chunk-w1zyhj40.js.map +21 -0
  34. package/dist/chunk-wtqhq529.js +2532 -0
  35. package/dist/chunk-wtqhq529.js.map +43 -0
  36. package/dist/chunk-xnt2sdhf.js +836 -0
  37. package/dist/chunk-xnt2sdhf.js.map +17 -0
  38. package/dist/cli/args.d.ts +24 -0
  39. package/dist/cli/bin.d.ts +2 -0
  40. package/dist/cli/bin.js +307 -0
  41. package/dist/cli/bin.js.map +14 -0
  42. package/dist/cli/load.d.ts +2 -0
  43. package/dist/cli/manifest.d.ts +49 -0
  44. package/dist/cli/render-cmds.d.ts +12 -0
  45. package/dist/cli/run.d.ts +1 -0
  46. package/dist/core/asset.d.ts +10 -0
  47. package/dist/core/definition.d.ts +148 -0
  48. package/dist/core/errors.d.ts +17 -0
  49. package/dist/core/family.d.ts +23 -0
  50. package/dist/core/index.d.ts +9 -0
  51. package/dist/core/index.js +69 -0
  52. package/dist/core/index.js.map +9 -0
  53. package/dist/core/mesh.d.ts +35 -0
  54. package/dist/core/part.d.ts +114 -0
  55. package/dist/core/png.d.ts +1 -0
  56. package/dist/core/rng.d.ts +12 -0
  57. package/dist/core/transform.d.ts +20 -0
  58. package/dist/core/vec.d.ts +11 -0
  59. package/dist/core/world.d.ts +16 -0
  60. package/dist/export/bin-writer.d.ts +16 -0
  61. package/dist/export/container.d.ts +3 -0
  62. package/dist/export/glb.d.ts +38 -0
  63. package/dist/export/index.d.ts +4 -0
  64. package/dist/export/index.js +26 -0
  65. package/dist/export/index.js.map +9 -0
  66. package/dist/export/lights.d.ts +8 -0
  67. package/dist/export/materials.d.ts +23 -0
  68. package/dist/export/merge-pivots.d.ts +6 -0
  69. package/dist/export/metadata.d.ts +19 -0
  70. package/dist/export/motion.d.ts +9 -0
  71. package/dist/export/optimize-parts.d.ts +26 -0
  72. package/dist/export/primitive.d.ts +3 -0
  73. package/dist/export/tangents.d.ts +2 -0
  74. package/dist/export/textures.d.ts +22 -0
  75. package/dist/export/version.d.ts +2 -0
  76. package/dist/grammar/index.d.ts +2 -0
  77. package/dist/grammar/index.js +16 -0
  78. package/dist/grammar/index.js.map +9 -0
  79. package/dist/grammar/split.d.ts +21 -0
  80. package/dist/grammar/whyte.d.ts +5 -0
  81. package/dist/index.d.ts +11 -0
  82. package/dist/index.js +411 -0
  83. package/dist/index.js.map +9 -0
  84. package/dist/kinds/building.d.ts +44 -0
  85. package/dist/kinds/faces.d.ts +27 -0
  86. package/dist/kinds/head-armour.d.ts +9 -0
  87. package/dist/kinds/head-beard.d.ts +6 -0
  88. package/dist/kinds/head-bust.d.ts +4 -0
  89. package/dist/kinds/head-extras.d.ts +15 -0
  90. package/dist/kinds/head-face.d.ts +6 -0
  91. package/dist/kinds/head-geom.d.ts +7 -0
  92. package/dist/kinds/head-hair.d.ts +4 -0
  93. package/dist/kinds/head-layout.d.ts +29 -0
  94. package/dist/kinds/head-mesh.d.ts +27 -0
  95. package/dist/kinds/head-params.d.ts +108 -0
  96. package/dist/kinds/head-presets.d.ts +19 -0
  97. package/dist/kinds/head-rim.d.ts +10 -0
  98. package/dist/kinds/head.d.ts +39 -0
  99. package/dist/kinds/hull-lines.d.ts +65 -0
  100. package/dist/kinds/hull-skin.d.ts +6 -0
  101. package/dist/kinds/hull.d.ts +14 -0
  102. package/dist/kinds/index.d.ts +16 -0
  103. package/dist/kinds/index.js +78 -0
  104. package/dist/kinds/index.js.map +9 -0
  105. package/dist/kinds/mass.d.ts +15 -0
  106. package/dist/kinds/openings.d.ts +30 -0
  107. package/dist/kinds/planned.d.ts +6 -0
  108. package/dist/kinds/roof-chimney.d.ts +16 -0
  109. package/dist/kinds/roof-shape.d.ts +64 -0
  110. package/dist/kinds/roof.d.ts +31 -0
  111. package/dist/kinds/vegetation-fronds.d.ts +15 -0
  112. package/dist/kinds/vegetation-impostor.d.ts +9 -0
  113. package/dist/kinds/vegetation-leaves.d.ts +15 -0
  114. package/dist/kinds/vegetation-mesh.d.ts +21 -0
  115. package/dist/kinds/vegetation-params.d.ts +90 -0
  116. package/dist/kinds/vegetation-presets.d.ts +20 -0
  117. package/dist/kinds/vegetation-skeleton.d.ts +20 -0
  118. package/dist/kinds/vegetation.d.ts +42 -0
  119. package/dist/kinds/vehicle.d.ts +42 -0
  120. package/dist/material/generator.d.ts +4 -0
  121. package/dist/material/index.d.ts +4 -0
  122. package/dist/material/index.js +38 -0
  123. package/dist/material/index.js.map +9 -0
  124. package/dist/material/paint/bond.d.ts +3 -0
  125. package/dist/material/paint/canvas.d.ts +32 -0
  126. package/dist/material/paint/cell.d.ts +4 -0
  127. package/dist/material/paint/cells-round.d.ts +5 -0
  128. package/dist/material/paint/cells.d.ts +7 -0
  129. package/dist/material/paint/compose.d.ts +5 -0
  130. package/dist/material/paint/concrete.d.ts +3 -0
  131. package/dist/material/paint/courses.d.ts +31 -0
  132. package/dist/material/paint/decode-png.d.ts +6 -0
  133. package/dist/material/paint/default-sheet.d.ts +2 -0
  134. package/dist/material/paint/foliage-broad.d.ts +5 -0
  135. package/dist/material/paint/foliage-common.d.ts +35 -0
  136. package/dist/material/paint/foliage-compound.d.ts +4 -0
  137. package/dist/material/paint/foliage-conifer.d.ts +5 -0
  138. package/dist/material/paint/foliage-raster.d.ts +26 -0
  139. package/dist/material/paint/foliage.d.ts +3 -0
  140. package/dist/material/paint/masks.d.ts +3 -0
  141. package/dist/material/paint/noise.d.ts +9 -0
  142. package/dist/material/paint/normal.d.ts +8 -0
  143. package/dist/material/paint/orm.d.ts +8 -0
  144. package/dist/material/paint/planks.d.ts +3 -0
  145. package/dist/material/paint/plates.d.ts +3 -0
  146. package/dist/material/paint/shapes.d.ts +8 -0
  147. package/dist/material/paint/slate.d.ts +3 -0
  148. package/dist/material/paint/stamp.d.ts +3 -0
  149. package/dist/material/paint/strip.d.ts +3 -0
  150. package/dist/material/paint/surface.d.ts +5 -0
  151. package/dist/material/paint/types.d.ts +35 -0
  152. package/dist/material/paint/validate.d.ts +3 -0
  153. package/dist/material/palette.d.ts +12 -0
  154. package/dist/material/shader-godot.d.ts +2 -0
  155. package/dist/material/shader-three.d.ts +2 -0
  156. package/dist/material/shader.d.ts +46 -0
  157. package/dist/material/trim-sheet.d.ts +22 -0
  158. package/dist/neural/generator.d.ts +25 -0
  159. package/dist/neural/images.d.ts +17 -0
  160. package/dist/neural/index.d.ts +2 -0
  161. package/dist/neural/index.js +14 -0
  162. package/dist/neural/index.js.map +9 -0
  163. package/dist/passes/bake-ao.d.ts +17 -0
  164. package/dist/passes/grime.d.ts +15 -0
  165. package/dist/passes/index.d.ts +6 -0
  166. package/dist/passes/index.js +22 -0
  167. package/dist/passes/index.js.map +9 -0
  168. package/dist/passes/livery.d.ts +19 -0
  169. package/dist/passes/optimize-cache.d.ts +15 -0
  170. package/dist/passes/optimize-weld.d.ts +15 -0
  171. package/dist/passes/optimize.d.ts +28 -0
  172. package/dist/passes/ray-grid.d.ts +23 -0
  173. package/dist/passes/weighted-normals.d.ts +8 -0
  174. package/dist/primitives/beam.d.ts +17 -0
  175. package/dist/primitives/bevel-box.d.ts +13 -0
  176. package/dist/primitives/box.d.ts +16 -0
  177. package/dist/primitives/cell.d.ts +20 -0
  178. package/dist/primitives/check.d.ts +12 -0
  179. package/dist/primitives/closed.d.ts +11 -0
  180. package/dist/primitives/erosion.d.ts +22 -0
  181. package/dist/primitives/font-5x7.d.ts +3 -0
  182. package/dist/primitives/heightfield.d.ts +16 -0
  183. package/dist/primitives/index.d.ts +23 -0
  184. package/dist/primitives/index.js +81 -0
  185. package/dist/primitives/index.js.map +9 -0
  186. package/dist/primitives/lathe-facets.d.ts +8 -0
  187. package/dist/primitives/lathe.d.ts +26 -0
  188. package/dist/primitives/lattice.d.ts +30 -0
  189. package/dist/primitives/loft.d.ts +15 -0
  190. package/dist/primitives/mc-table.d.ts +2 -0
  191. package/dist/primitives/member.d.ts +19 -0
  192. package/dist/primitives/noise.d.ts +34 -0
  193. package/dist/primitives/planar.d.ts +10 -0
  194. package/dist/primitives/prism.d.ts +13 -0
  195. package/dist/primitives/sculpt-edit.d.ts +56 -0
  196. package/dist/primitives/sculpt-tree.d.ts +23 -0
  197. package/dist/primitives/sculpt.d.ts +27 -0
  198. package/dist/primitives/sdf-grid.d.ts +17 -0
  199. package/dist/primitives/sdf-ops.d.ts +37 -0
  200. package/dist/primitives/sdf.d.ts +21 -0
  201. package/dist/primitives/strip-uv.d.ts +11 -0
  202. package/dist/primitives/surface-nets.d.ts +7 -0
  203. package/dist/primitives/sweep.d.ts +19 -0
  204. package/dist/primitives/terrain-color.d.ts +30 -0
  205. package/dist/primitives/terrain-grid.d.ts +36 -0
  206. package/dist/primitives/text-layout.d.ts +22 -0
  207. package/dist/primitives/text.d.ts +27 -0
  208. package/dist/primitives/tiled.d.ts +22 -0
  209. package/dist/primitives/transport.d.ts +17 -0
  210. package/dist/primitives/triangulate.d.ts +2 -0
  211. package/dist/primitives/value-noise.d.ts +10 -0
  212. package/dist/qa/checks.d.ts +11 -0
  213. package/dist/qa/clash.d.ts +2 -0
  214. package/dist/qa/floating.d.ts +5 -0
  215. package/dist/qa/gates.d.ts +12 -0
  216. package/dist/qa/geometry.d.ts +21 -0
  217. package/dist/qa/index.d.ts +12 -0
  218. package/dist/qa/index.js +78 -0
  219. package/dist/qa/index.js.map +9 -0
  220. package/dist/qa/inside.d.ts +12 -0
  221. package/dist/qa/inspect.d.ts +18 -0
  222. package/dist/qa/lods.d.ts +12 -0
  223. package/dist/qa/measures.d.ts +4 -0
  224. package/dist/qa/occlusion.d.ts +3 -0
  225. package/dist/qa/sanity.d.ts +7 -0
  226. package/dist/qa/types.d.ts +12 -0
  227. package/dist/render/beauty.d.ts +40 -0
  228. package/dist/render/camera.d.ts +33 -0
  229. package/dist/render/depth-map.d.ts +38 -0
  230. package/dist/render/font.d.ts +1 -0
  231. package/dist/render/ground.d.ts +13 -0
  232. package/dist/render/index.d.ts +10 -0
  233. package/dist/render/index.js +47 -0
  234. package/dist/render/index.js.map +9 -0
  235. package/dist/render/lighting.d.ts +20 -0
  236. package/dist/render/lod-strip.d.ts +5 -0
  237. package/dist/render/metrics.d.ts +37 -0
  238. package/dist/render/options.d.ts +28 -0
  239. package/dist/render/photo-match.d.ts +19 -0
  240. package/dist/render/raster.d.ts +25 -0
  241. package/dist/render/resolve.d.ts +11 -0
  242. package/dist/render/review-prompt.d.ts +2 -0
  243. package/dist/render/review-warnings.d.ts +34 -0
  244. package/dist/render/review.d.ts +24 -0
  245. package/dist/render/scene.d.ts +18 -0
  246. package/dist/render/shade.d.ts +22 -0
  247. package/dist/render/sheet.d.ts +15 -0
  248. package/dist/render/texture.d.ts +15 -0
  249. package/dist/render/thumbnail.d.ts +8 -0
  250. package/dist/render/vis-buffer.d.ts +18 -0
  251. package/dist/testing/assert.d.ts +21 -0
  252. package/dist/testing/compiled.d.ts +15 -0
  253. package/dist/testing/hash.d.ts +1 -0
  254. package/dist/testing/index.d.ts +4 -0
  255. package/dist/testing/index.js +134 -0
  256. package/dist/testing/index.js.map +13 -0
  257. package/dist/testing/snapshot.d.ts +13 -0
  258. package/docs/README.md +52 -0
  259. package/docs/architecture/README.md +68 -0
  260. package/docs/architecture/adding-a-kind.md +44 -0
  261. package/docs/architecture/adding-a-primitive.md +49 -0
  262. package/docs/architecture/errors.md +47 -0
  263. package/docs/architecture/glb-production.md +214 -0
  264. package/docs/architecture/gltf-capabilities.md +80 -0
  265. package/docs/decisions/001-recipe-compiler-over-ai-meshes.md +27 -0
  266. package/docs/decisions/002-typescript-not-json.md +22 -0
  267. package/docs/decisions/003-shared-trim-sheet.md +21 -0
  268. package/docs/decisions/004-z-up-metres.md +21 -0
  269. package/docs/decisions/005-zero-runtime-deps.md +21 -0
  270. package/docs/decisions/006-single-package-subpath-exports.md +20 -0
  271. package/docs/decisions/007-cpu-contact-sheets.md +21 -0
  272. package/docs/decisions/008-surface-materials.md +21 -0
  273. package/docs/decisions/009-gltf-front-axis.md +21 -0
  274. package/docs/decisions/README.md +15 -0
  275. package/docs/idea/01-vision.md +117 -0
  276. package/docs/idea/02-dsl.md +343 -0
  277. package/docs/idea/03-ir.md +97 -0
  278. package/docs/idea/04-materials.md +114 -0
  279. package/docs/idea/05-agent-loop.md +141 -0
  280. package/docs/idea/06-qa.md +101 -0
  281. package/docs/idea/07-what-fits.md +45 -0
  282. package/docs/idea/08-neural-adapters.md +78 -0
  283. package/docs/idea/09-kinds.md +105 -0
  284. package/docs/landscape.md +49 -0
  285. package/docs/plans/roadmap.md +127 -0
  286. package/examples/build-with-bun.ts +41 -0
  287. package/llms.txt +47 -0
  288. package/package.json +99 -4
  289. package/recipes/README.md +38 -0
  290. package/recipes/asteroid/README.md +46 -0
  291. package/recipes/asteroid/asteroid.ts +336 -0
  292. package/recipes/boulders/README.md +28 -0
  293. package/recipes/boulders/boulders.ts +117 -0
  294. package/recipes/boxcar/README.md +46 -0
  295. package/recipes/boxcar/boxcar.ts +916 -0
  296. package/recipes/cargo_container_scifi/README.md +52 -0
  297. package/recipes/cargo_container_scifi/cargo_container_scifi.ts +461 -0
  298. package/recipes/dropship/README.md +84 -0
  299. package/recipes/dropship/dropship.ts +1144 -0
  300. package/recipes/eiffel_tower/README.md +110 -0
  301. package/recipes/eiffel_tower/eiffel_tower.ts +781 -0
  302. package/recipes/goblin_head/README.md +62 -0
  303. package/recipes/goblin_head/goblin_head.ts +36 -0
  304. package/recipes/human_head/README.md +64 -0
  305. package/recipes/human_head/human_head.ts +37 -0
  306. package/recipes/loco_440/README.md +32 -0
  307. package/recipes/loco_440/loco_440.ts +1404 -0
  308. package/recipes/material_swatches/README.md +21 -0
  309. package/recipes/material_swatches/material_swatches.ts +183 -0
  310. package/recipes/mountain_range/README.md +45 -0
  311. package/recipes/mountain_range/mountain_range.ts +128 -0
  312. package/recipes/oak/README.md +30 -0
  313. package/recipes/oak/oak.ts +19 -0
  314. package/recipes/orc_head/README.md +66 -0
  315. package/recipes/orc_head/orc_head.ts +39 -0
  316. package/recipes/palm/README.md +30 -0
  317. package/recipes/palm/palm.ts +19 -0
  318. package/recipes/pine/README.md +29 -0
  319. package/recipes/pine/pine.ts +19 -0
  320. package/recipes/signal_gantry/README.md +36 -0
  321. package/recipes/signal_gantry/signal_gantry.ts +522 -0
  322. package/recipes/station_halt/README.md +39 -0
  323. package/recipes/station_halt/station_halt.ts +722 -0
  324. package/recipes/t34/README.md +44 -0
  325. package/recipes/t34/t34.ts +1068 -0
  326. package/recipes/tiger_1/README.md +75 -0
  327. package/recipes/tiger_1/tiger_1.ts +1370 -0
  328. package/recipes/water_tower/README.md +40 -0
  329. package/recipes/water_tower/water_tower.ts +542 -0
  330. package/src/cli/args.ts +112 -0
  331. package/src/cli/bin.ts +7 -0
  332. package/src/cli/load.ts +17 -0
  333. package/src/cli/manifest.ts +89 -0
  334. package/src/cli/render-cmds.ts +66 -0
  335. package/src/cli/run.ts +168 -0
  336. package/src/core/asset.ts +128 -0
  337. package/src/core/definition.ts +149 -0
  338. package/src/core/errors.ts +45 -0
  339. package/src/core/family.ts +50 -0
  340. package/src/core/index.ts +66 -0
  341. package/src/core/mesh.ts +114 -0
  342. package/src/core/part.ts +130 -0
  343. package/src/core/png.ts +49 -0
  344. package/src/core/rng.ts +49 -0
  345. package/src/core/transform.ts +90 -0
  346. package/src/core/vec.ts +26 -0
  347. package/src/core/world.ts +80 -0
  348. package/src/export/bin-writer.ts +79 -0
  349. package/src/export/container.ts +35 -0
  350. package/src/export/glb.ts +200 -0
  351. package/src/export/index.ts +18 -0
  352. package/src/export/lights.ts +49 -0
  353. package/src/export/materials.ts +126 -0
  354. package/src/export/merge-pivots.ts +146 -0
  355. package/src/export/metadata.ts +59 -0
  356. package/src/export/motion.ts +70 -0
  357. package/src/export/optimize-parts.ts +80 -0
  358. package/src/export/primitive.ts +35 -0
  359. package/src/export/tangents.ts +75 -0
  360. package/src/export/textures.ts +88 -0
  361. package/src/export/version.ts +6 -0
  362. package/src/grammar/index.ts +4 -0
  363. package/src/grammar/split.ts +87 -0
  364. package/src/grammar/whyte.ts +20 -0
  365. package/src/index.ts +14 -0
  366. package/src/kinds/building.ts +153 -0
  367. package/src/kinds/faces.ts +138 -0
  368. package/src/kinds/head-armour.ts +151 -0
  369. package/src/kinds/head-beard.ts +133 -0
  370. package/src/kinds/head-bust.ts +221 -0
  371. package/src/kinds/head-extras.ts +150 -0
  372. package/src/kinds/head-face.ts +222 -0
  373. package/src/kinds/head-geom.ts +31 -0
  374. package/src/kinds/head-hair.ts +152 -0
  375. package/src/kinds/head-layout.ts +63 -0
  376. package/src/kinds/head-mesh.ts +157 -0
  377. package/src/kinds/head-params.ts +153 -0
  378. package/src/kinds/head-presets.ts +152 -0
  379. package/src/kinds/head-rim.ts +128 -0
  380. package/src/kinds/head.ts +171 -0
  381. package/src/kinds/hull-lines.ts +160 -0
  382. package/src/kinds/hull-skin.ts +83 -0
  383. package/src/kinds/hull.ts +209 -0
  384. package/src/kinds/index.ts +63 -0
  385. package/src/kinds/mass.ts +110 -0
  386. package/src/kinds/openings.ts +141 -0
  387. package/src/kinds/planned.ts +12 -0
  388. package/src/kinds/roof-chimney.ts +100 -0
  389. package/src/kinds/roof-shape.ts +230 -0
  390. package/src/kinds/roof.ts +250 -0
  391. package/src/kinds/vegetation-fronds.ts +126 -0
  392. package/src/kinds/vegetation-impostor.ts +118 -0
  393. package/src/kinds/vegetation-leaves.ts +168 -0
  394. package/src/kinds/vegetation-mesh.ts +174 -0
  395. package/src/kinds/vegetation-params.ts +147 -0
  396. package/src/kinds/vegetation-presets.ts +184 -0
  397. package/src/kinds/vegetation-skeleton.ts +168 -0
  398. package/src/kinds/vegetation.ts +199 -0
  399. package/src/kinds/vehicle.ts +144 -0
  400. package/src/material/generator.ts +56 -0
  401. package/src/material/index.ts +29 -0
  402. package/src/material/paint/bond.ts +60 -0
  403. package/src/material/paint/canvas.ts +91 -0
  404. package/src/material/paint/cell.ts +39 -0
  405. package/src/material/paint/cells-round.ts +119 -0
  406. package/src/material/paint/cells.ts +111 -0
  407. package/src/material/paint/compose.ts +53 -0
  408. package/src/material/paint/concrete.ts +62 -0
  409. package/src/material/paint/courses.ts +85 -0
  410. package/src/material/paint/decode-png.ts +100 -0
  411. package/src/material/paint/default-sheet.ts +61 -0
  412. package/src/material/paint/foliage-broad.ts +126 -0
  413. package/src/material/paint/foliage-common.ts +93 -0
  414. package/src/material/paint/foliage-compound.ts +135 -0
  415. package/src/material/paint/foliage-conifer.ts +143 -0
  416. package/src/material/paint/foliage-raster.ts +196 -0
  417. package/src/material/paint/foliage.ts +23 -0
  418. package/src/material/paint/masks.ts +44 -0
  419. package/src/material/paint/noise.ts +52 -0
  420. package/src/material/paint/normal.ts +52 -0
  421. package/src/material/paint/orm.ts +95 -0
  422. package/src/material/paint/planks.ts +56 -0
  423. package/src/material/paint/plates.ts +72 -0
  424. package/src/material/paint/shapes.ts +28 -0
  425. package/src/material/paint/slate.ts +52 -0
  426. package/src/material/paint/stamp.ts +40 -0
  427. package/src/material/paint/strip.ts +42 -0
  428. package/src/material/paint/surface.ts +60 -0
  429. package/src/material/paint/types.ts +51 -0
  430. package/src/material/paint/validate.ts +58 -0
  431. package/src/material/palette.ts +43 -0
  432. package/src/material/shader-godot.ts +77 -0
  433. package/src/material/shader-three.ts +103 -0
  434. package/src/material/shader.ts +100 -0
  435. package/src/material/trim-sheet.ts +100 -0
  436. package/src/neural/generator.ts +37 -0
  437. package/src/neural/images.ts +27 -0
  438. package/src/neural/index.ts +10 -0
  439. package/src/passes/bake-ao.ts +183 -0
  440. package/src/passes/grime.ts +37 -0
  441. package/src/passes/index.ts +8 -0
  442. package/src/passes/livery.ts +66 -0
  443. package/src/passes/optimize-cache.ts +175 -0
  444. package/src/passes/optimize-weld.ts +147 -0
  445. package/src/passes/optimize.ts +85 -0
  446. package/src/passes/ray-grid.ts +237 -0
  447. package/src/passes/weighted-normals.ts +125 -0
  448. package/src/primitives/beam.ts +60 -0
  449. package/src/primitives/bevel-box.ts +140 -0
  450. package/src/primitives/box.ts +90 -0
  451. package/src/primitives/cell.ts +115 -0
  452. package/src/primitives/check.ts +49 -0
  453. package/src/primitives/closed.ts +74 -0
  454. package/src/primitives/erosion.ts +183 -0
  455. package/src/primitives/font-5x7.ts +117 -0
  456. package/src/primitives/heightfield.ts +101 -0
  457. package/src/primitives/index.ts +56 -0
  458. package/src/primitives/lathe-facets.ts +45 -0
  459. package/src/primitives/lathe.ts +174 -0
  460. package/src/primitives/lattice.ts +131 -0
  461. package/src/primitives/loft.ts +174 -0
  462. package/src/primitives/mc-table.ts +41 -0
  463. package/src/primitives/member.ts +130 -0
  464. package/src/primitives/noise.ts +157 -0
  465. package/src/primitives/planar.ts +55 -0
  466. package/src/primitives/prism.ts +85 -0
  467. package/src/primitives/sculpt-edit.ts +212 -0
  468. package/src/primitives/sculpt-tree.ts +226 -0
  469. package/src/primitives/sculpt.ts +80 -0
  470. package/src/primitives/sdf-grid.ts +131 -0
  471. package/src/primitives/sdf-ops.ts +145 -0
  472. package/src/primitives/sdf.ts +83 -0
  473. package/src/primitives/strip-uv.ts +26 -0
  474. package/src/primitives/surface-nets.ts +161 -0
  475. package/src/primitives/sweep.ts +162 -0
  476. package/src/primitives/terrain-color.ts +85 -0
  477. package/src/primitives/terrain-grid.ts +137 -0
  478. package/src/primitives/text-layout.ts +85 -0
  479. package/src/primitives/text.ts +197 -0
  480. package/src/primitives/tiled.ts +93 -0
  481. package/src/primitives/transport.ts +85 -0
  482. package/src/primitives/triangulate.ts +42 -0
  483. package/src/primitives/value-noise.ts +62 -0
  484. package/src/qa/checks.ts +110 -0
  485. package/src/qa/clash.ts +177 -0
  486. package/src/qa/floating.ts +63 -0
  487. package/src/qa/gates.ts +126 -0
  488. package/src/qa/geometry.ts +187 -0
  489. package/src/qa/index.ts +28 -0
  490. package/src/qa/inside.ts +114 -0
  491. package/src/qa/inspect.ts +107 -0
  492. package/src/qa/lods.ts +97 -0
  493. package/src/qa/measures.ts +67 -0
  494. package/src/qa/occlusion.ts +166 -0
  495. package/src/qa/sanity.ts +137 -0
  496. package/src/qa/types.ts +17 -0
  497. package/src/render/beauty.ts +115 -0
  498. package/src/render/camera.ts +142 -0
  499. package/src/render/depth-map.ts +191 -0
  500. package/src/render/font.ts +76 -0
  501. package/src/render/ground.ts +87 -0
  502. package/src/render/index.ts +34 -0
  503. package/src/render/lighting.ts +95 -0
  504. package/src/render/lod-strip.ts +34 -0
  505. package/src/render/metrics.ts +147 -0
  506. package/src/render/options.ts +81 -0
  507. package/src/render/photo-match.ts +28 -0
  508. package/src/render/raster.ts +143 -0
  509. package/src/render/resolve.ts +109 -0
  510. package/src/render/review-prompt.ts +59 -0
  511. package/src/render/review-warnings.ts +92 -0
  512. package/src/render/review.ts +103 -0
  513. package/src/render/scene.ts +119 -0
  514. package/src/render/shade.ts +199 -0
  515. package/src/render/sheet.ts +88 -0
  516. package/src/render/texture.ts +97 -0
  517. package/src/render/thumbnail.ts +75 -0
  518. package/src/render/vis-buffer.ts +119 -0
  519. package/src/testing/assert.ts +115 -0
  520. package/src/testing/compiled.ts +31 -0
  521. package/src/testing/hash.ts +14 -0
  522. package/src/testing/index.ts +14 -0
  523. package/src/testing/snapshot.ts +37 -0
  524. package/src/types/gltf-validator.d.ts +13 -0
@@ -0,0 +1,722 @@
1
+ // Country station: the GWR standard small brick station as at Toddington (1904). One-storey red
2
+ // brick building on a 3 ft (0.915 m) brick-faced platform, slate gable roof with two stacks, deep
3
+ // canopy on cast-iron columns with a fretted valance, benches, lamps, a running-in name board.
4
+ // Track side = +X (the platform edge), ground / rail top z = 0. Dossier: ./README.md.
5
+
6
+ import {
7
+ beam,
8
+ box,
9
+ cell,
10
+ cylinder,
11
+ defineAsset,
12
+ grime,
13
+ hex,
14
+ type Lod,
15
+ lathe,
16
+ type Mesh,
17
+ mass,
18
+ merge,
19
+ type OpeningSide,
20
+ opening,
21
+ place,
22
+ prism,
23
+ type RoofMeshOptions,
24
+ ridgeHeight,
25
+ roof,
26
+ text,
27
+ tiled,
28
+ type Vec2,
29
+ type Vec3,
30
+ } from '@developerz.ai/ts23d';
31
+
32
+ // ---------------------------------------------------------------- layout (metres)
33
+ const PLAT_Z = 0.915; // 3 ft over rail
34
+ const PLAT_X0 = -4.6;
35
+ const PLAT_EDGE = 7.0; // face of the coping over the track
36
+ const PLAT_Y = 15;
37
+ const B_X0 = -3.6; // back wall
38
+ const B_X1 = 2.8; // platform-side wall
39
+ const B_Y = 10;
40
+ const WALL_H = 3.9;
41
+ const EAVE_Z = PLAT_Z + WALL_H;
42
+ const CAN_X1 = 6.25; // canopy front edge
43
+ const CAN_Y = 9.2;
44
+ const CAN_Z_WALL = 4.3;
45
+ const CAN_Z_FRONT = 3.78;
46
+ const COL_X = 5.6;
47
+ const canZ = (x: number): number =>
48
+ CAN_Z_WALL + ((CAN_Z_FRONT - CAN_Z_WALL) * (x - B_X1)) / (CAN_X1 - B_X1);
49
+
50
+ const brick = hex('#a24f36');
51
+ const blueBrick = hex('#3b3a44');
52
+ const slate = hex('#4b5058');
53
+ const coping = hex('#d9d3c4');
54
+ const paving = hex('#9d988e');
55
+ const chocolate = hex('#4a2d22');
56
+ const cream = hex('#e7dcc0');
57
+ const iron = hex('#2b2522');
58
+ const glass = hex('#2c3a42');
59
+ const signBlack = hex('#151515');
60
+ const white = hex('#f2efe6');
61
+
62
+ const ROOF: RoofMeshOptions = {
63
+ type: 'gable',
64
+ footprint: [B_X1 - B_X0, 2 * B_Y],
65
+ pitchDeg: 33,
66
+ at: [(B_X0 + B_X1) / 2, 0, EAVE_Z],
67
+ color: slate,
68
+ strip: 'slate',
69
+ overhang: 0.45,
70
+ rake: 0.35,
71
+ ridge: 'y',
72
+ trim: cream,
73
+ wall: { color: brick, strip: 'brick' },
74
+ chimneys: [
75
+ { at: [-0.9, -4.6], size: [0.75, 0.55], height: 1.1, color: brick, strip: 'brick', pots: 2 },
76
+ { at: [-0.9, 5.2], size: [0.75, 0.55], height: 1.1, color: brick, strip: 'brick', pots: 2 },
77
+ ],
78
+ };
79
+ const RIDGE_Z = ridgeHeight(ROOF); // world z of the ridge
80
+
81
+ // ---------------------------------------------------------------- furniture (local space)
82
+ /** GWR platform bench, 1.8 m: slatted seat and back on two cast-iron ends; faces +X, base z = 0. */
83
+ function bench(lod: Lod): Mesh {
84
+ const out: Mesh[] = [];
85
+ const end: Vec2[] = [
86
+ [0.22, 0],
87
+ [0.3, 0],
88
+ [0.12, 0.42],
89
+ [0.2, 0.46],
90
+ [-0.18, 0.46],
91
+ [-0.2, 0.9],
92
+ [-0.26, 0.9],
93
+ [-0.24, 0.42],
94
+ [-0.3, 0],
95
+ [-0.22, 0],
96
+ [-0.14, 0.38],
97
+ [0.08, 0.38],
98
+ ];
99
+ for (const y of [-0.82, 0.82])
100
+ out.push(
101
+ place(prism({ profile: end, depth: 0.05, plane: 'xz', color: iron, strip: 'iron' }), {
102
+ at: [0, y, 0],
103
+ }),
104
+ );
105
+ const slats = lod === 0 ? 4 : 1;
106
+ for (let i = 0; i < slats; i++) {
107
+ const x0 = 0.18 - (i * 0.38) / slats;
108
+ out.push(
109
+ box({
110
+ size: [0.38 / slats - 0.015, 1.8, 0.035],
111
+ at: [x0 - 0.19 / slats, 0, 0.46],
112
+ color: chocolate,
113
+ strip: 'wood',
114
+ }),
115
+ );
116
+ }
117
+ const backs = lod === 0 ? 3 : 1;
118
+ for (let i = 0; i < backs; i++)
119
+ out.push(
120
+ box({
121
+ size: [0.03, 1.8, 0.4 / backs - 0.02],
122
+ at: [-0.22, 0, 0.5 + (i * 0.4) / backs],
123
+ color: chocolate,
124
+ strip: 'wood',
125
+ }),
126
+ );
127
+ return merge(out);
128
+ }
129
+
130
+ /** Platform lamp: cast-iron post, square lantern (glass separate for glow), ladder bar. */
131
+ function lampPost(lod: Lod): { post: Mesh; glass: Mesh } {
132
+ const glassM = box({
133
+ size: [0.32, 0.32, 0.4],
134
+ at: [0, 0, 2.74],
135
+ color: hex('#f3d79a'),
136
+ strip: 'glass',
137
+ });
138
+ if (lod === 2)
139
+ return {
140
+ post: merge([
141
+ box({ size: [0.12, 0.12, 2.7], color: chocolate }),
142
+ box({ size: [0.4, 0.4, 0.2], at: [0, 0, 3.14], color: chocolate }),
143
+ ]),
144
+ glass: glassM,
145
+ };
146
+ const segs = [10, 8, 6][lod] ?? 6;
147
+ const post: Mesh[] = [
148
+ lathe({
149
+ profile: [
150
+ [0, 0],
151
+ [0.13, 0],
152
+ [0.13, 0.25],
153
+ [0.07, 0.4],
154
+ [0.055, 0.5],
155
+ [0.045, 2.55],
156
+ [0.07, 2.65],
157
+ [0.07, 2.7],
158
+ [0, 2.7],
159
+ ],
160
+ segments: segs,
161
+ color: chocolate,
162
+ }),
163
+ // Lantern frame and pyramid cap.
164
+ box({ size: [0.36, 0.36, 0.04], at: [0, 0, 2.7], color: chocolate }),
165
+ lathe({
166
+ profile: [
167
+ [0.27, 3.18],
168
+ [0.05, 3.36],
169
+ [0.05, 3.42],
170
+ [0, 3.45],
171
+ ],
172
+ segments: 4,
173
+ color: chocolate,
174
+ }),
175
+ box({ size: [0.4, 0.4, 0.04], at: [0, 0, 3.14], color: chocolate }),
176
+ ];
177
+ if (lod < 2)
178
+ post.push(beam({ from: [0, -0.32, 2.45], to: [0, 0.32, 2.45], width: 0.03, color: chocolate })); // ladder bar
179
+ return { post: merge(post), glass: glassM };
180
+ }
181
+
182
+ /** Running-in board: two posts and a black board lettered in white, facing +X. */
183
+ function nameBoard(name: string, lod: Lod): Mesh {
184
+ const out: Mesh[] = [];
185
+ for (const y of [-2.0, 2.0])
186
+ out.push(box({ size: [0.12, 0.12, 2.35], at: [0, y, 0], color: cream, strip: 'wood' }));
187
+ out.push(box({ size: [0.08, 5.0, 0.95], at: [0.1, 0, 1.35], color: signBlack, strip: 'wood' }));
188
+ if (lod < 2) {
189
+ out.push(box({ size: [0.1, 5.1, 0.06], at: [0.1, 0, 2.3], color: cream, strip: 'wood' })); // capping
190
+ out.push(
191
+ text(name, {
192
+ origin: [0.14, 0, 1.54],
193
+ height: 0.56,
194
+ color: white,
195
+ align: 'centre',
196
+ font: 'block',
197
+ maxWidth: 4.7,
198
+ }),
199
+ );
200
+ }
201
+ return merge(out);
202
+ }
203
+
204
+ // ---------------------------------------------------------------- the station
205
+ export const station_halt = defineAsset({
206
+ name: 'station_halt',
207
+ kind: 'building',
208
+ description:
209
+ 'GWR standard country station (Toddington, 1904): red brick building with slate roof and stacks, chocolate-and-cream canopy with fretted valance on cast-iron columns, brick-faced platform, benches, lamps, running-in board.',
210
+ tags: ['railroad', 'station', 'gwr', 'edwardian', 'uk', 'brick'],
211
+ license: 'CC0-1.0',
212
+ sources: [
213
+ 'https://commons.wikimedia.org/wiki/File:Toddington_Railway_Station_GWSR_001.jpg',
214
+ 'https://commons.wikimedia.org/wiki/File:Toddington_railway_station_1.jpg',
215
+ 'https://commons.wikimedia.org/wiki/File:Toddington_railway_station9.4.05.jpg',
216
+ 'https://en.wikipedia.org/wiki/Toddington_railway_station',
217
+ 'https://en.wikipedia.org/wiki/Railway_platform_height',
218
+ 'https://www.bachmann.co.uk/product/gwr-standard-station---chocolate-and-cream/44-1019',
219
+ ],
220
+ real: {
221
+ length: PLAT_EDGE + 0.25 - PLAT_X0,
222
+ width: 2 * PLAT_Y,
223
+ height: RIDGE_Z + 1.45,
224
+ measures: [
225
+ {
226
+ label: 'platform height over rail (3 ft)',
227
+ value: PLAT_Z,
228
+ axis: 'z',
229
+ parts: ['platform'],
230
+ source: 'Railway platform height (UK 915 mm)',
231
+ },
232
+ {
233
+ label: 'building length (photo-scaled)',
234
+ value: 2 * B_Y,
235
+ axis: 'y',
236
+ parts: ['building'],
237
+ tolerance: 0.05,
238
+ source: 'Toddington photos',
239
+ },
240
+ {
241
+ label: 'building depth (photo-scaled)',
242
+ value: B_X1 - B_X0,
243
+ axis: 'x',
244
+ parts: ['building'],
245
+ tolerance: 0.05,
246
+ source: 'Toddington photos',
247
+ },
248
+ ],
249
+ },
250
+ budget: { triangles: [10500, 5800, 550] },
251
+ glow: [{ parts: ['lamp_*_glass'], color: [1, 0.82, 0.55], strength: 3 }],
252
+ build(ctx) {
253
+ const lod = ctx.lod;
254
+ const bevel = ctx.pick([0.015, 0.008, 0]);
255
+ const dirt = (m: Mesh): Mesh => grime(m, { ground: PLAT_Z + 0.7, groundStrength: 0.3 });
256
+
257
+ // ---- platform: blue-brick faced fill, paving, pale stone coping over the track.
258
+ const pf: Mesh[] = [
259
+ mass(
260
+ {
261
+ size: [PLAT_EDGE - 0.25 - PLAT_X0, 2 * PLAT_Y, PLAT_Z - 0.08],
262
+ at: [(PLAT_EDGE - 0.25 + PLAT_X0) / 2, 0, 0],
263
+ color: blueBrick,
264
+ strip: 'brick',
265
+ omit: ['bottom', 'top'],
266
+ },
267
+ lod,
268
+ ),
269
+ // Flagstone paving at true scale (courses run across the platform), on an 8 cm slab edge.
270
+ box({
271
+ size: [PLAT_EDGE - 0.25 - PLAT_X0, 2 * PLAT_Y, 0.08],
272
+ at: [(PLAT_EDGE - 0.25 + PLAT_X0) / 2, 0, PLAT_Z - 0.08],
273
+ color: paving,
274
+ omit: ['bottom', 'top'],
275
+ }),
276
+ tiled({
277
+ origin: [PLAT_X0, -PLAT_Y, PLAT_Z],
278
+ u: [PLAT_EDGE - 0.25 - PLAT_X0, 0, 0],
279
+ v: [0, 2 * PLAT_Y, 0],
280
+ color: paving,
281
+ strip: lod === 2 ? 'plain' : 'stone',
282
+ ...(lod === 2 ? { vMetres: 2 * PLAT_Y } : {}),
283
+ }),
284
+ box({
285
+ size: [0.5, 2 * PLAT_Y, 0.1],
286
+ at: [PLAT_EDGE - 0.25, 0, PLAT_Z - 0.1],
287
+ color: coping,
288
+ strip: 'stone',
289
+ omit: ['bottom'],
290
+ ...(bevel ? { bevel } : {}),
291
+ }),
292
+ ];
293
+ if (lod < 2)
294
+ pf.push(
295
+ box({ size: [0.12, 2 * PLAT_Y, 0.004], at: [PLAT_EDGE - 0.12, 0, PLAT_Z], color: white }),
296
+ ); // white edge line
297
+ ctx.part('platform', grime(merge(pf), { ground: 0.5, groundStrength: 0.35 }));
298
+
299
+ // ---- building: brick walls in true-scale courses, blue plinth, eaves band.
300
+ const bw: Mesh[] = [
301
+ mass(
302
+ {
303
+ size: [B_X1 - B_X0, 2 * B_Y, WALL_H],
304
+ at: [(B_X0 + B_X1) / 2, 0, PLAT_Z],
305
+ color: brick,
306
+ strip: 'brick',
307
+ omit: ['bottom', 'top'],
308
+ courseOrigin: PLAT_Z,
309
+ },
310
+ lod,
311
+ ),
312
+ ];
313
+ if (lod < 2) {
314
+ bw.push(
315
+ mass(
316
+ {
317
+ size: [B_X1 - B_X0 + 0.08, 2 * B_Y + 0.08, 0.45],
318
+ at: [(B_X0 + B_X1) / 2, 0, PLAT_Z],
319
+ color: blueBrick,
320
+ strip: 'brick',
321
+ omit: ['bottom', 'top'],
322
+ courseOrigin: PLAT_Z,
323
+ },
324
+ lod,
325
+ ),
326
+ );
327
+ bw.push(
328
+ mass(
329
+ {
330
+ size: [B_X1 - B_X0 + 0.06, 2 * B_Y + 0.06, 0.15],
331
+ at: [(B_X0 + B_X1) / 2, 0, EAVE_Z - 0.32],
332
+ color: blueBrick,
333
+ strip: 'brick',
334
+ omit: ['bottom', 'top'],
335
+ courseOrigin: PLAT_Z,
336
+ },
337
+ lod,
338
+ ),
339
+ );
340
+ }
341
+ ctx.part('building', dirt(merge(bw)));
342
+
343
+ // ---- openings: sashes and panelled doors (chocolate doors, cream frames, stone sills/heads).
344
+ type Op = { kind: 'window' | 'door'; side: OpeningSide; at: Vec3 };
345
+ const front = ['W', 'D', 'W', 'W', 'D', 'W', 'W', 'D', 'W', 'W'];
346
+ const ops: Op[] = front.map((k, i) => ({
347
+ kind: k === 'D' ? 'door' : 'window',
348
+ side: 'front',
349
+ at: [B_X1, -8.4 + i * 1.87, k === 'D' ? PLAT_Z : PLAT_Z + 0.85],
350
+ }));
351
+ for (const y of [-6.5, -2.2, 2.2, 6.5])
352
+ ops.push({ kind: 'window', side: 'back', at: [B_X0, y, PLAT_Z + 0.85] });
353
+ ops.push({ kind: 'door', side: 'back', at: [B_X0, 0, PLAT_Z] });
354
+ for (const [side, y] of [
355
+ ['left', B_Y],
356
+ ['right', -B_Y],
357
+ ] as const)
358
+ ops.push({ kind: 'window', side, at: [-0.4, y, PLAT_Z + 0.85] });
359
+ ops.forEach((o, i) => {
360
+ const isDoor = o.kind === 'door';
361
+ ctx.part(
362
+ `${isDoor ? 'door' : 'window'}_${o.side}_${i}`,
363
+ opening(
364
+ {
365
+ kind: o.kind,
366
+ width: isDoor ? 1.0 : 1.05,
367
+ height: isDoor ? 2.35 : 1.85,
368
+ at: o.at,
369
+ facing: o.side,
370
+ glass,
371
+ frame: isDoor ? chocolate : cream,
372
+ wall: brick,
373
+ wallStrip: 'brick',
374
+ trim: coping,
375
+ panes: [2, 3],
376
+ },
377
+ lod,
378
+ ),
379
+ );
380
+ if (isDoor && o.side === 'front')
381
+ ctx.socket(`door_${i}_use`, {
382
+ kind: 'interact',
383
+ at: [o.at[0] + 0.4, o.at[1], PLAT_Z + 1.0],
384
+ dir: [-1, 0, 0],
385
+ });
386
+ });
387
+
388
+ // ---- roof with stacks; smoke from both pots.
389
+ const info = roof(ctx, { ...ROOF, name: 'roof' });
390
+ (ROOF.chimneys ?? []).forEach((c, i) => {
391
+ const x = (ROOF.at[0] ?? 0) + c.at[0];
392
+ const y = c.at[1];
393
+ const top =
394
+ Math.max(info.heightAt(x - 0.4, y), info.heightAt(x + 0.4, y)) + (c.height ?? 0.9) + 0.4;
395
+ ctx.emitter(`chimney_${i}`, {
396
+ kind: 'smoke',
397
+ at: [x, y, top],
398
+ rate: 3,
399
+ life: 5,
400
+ size: [0.3, 1.6],
401
+ color: [0.5, 0.5, 0.52],
402
+ speed: 0.6,
403
+ when: 'always',
404
+ });
405
+ });
406
+
407
+ // ---- canopy: sloped deck (slate-grey sheet over a boarded cream soffit), valance, columns.
408
+ const cn: Mesh[] = [
409
+ prism({
410
+ profile: [
411
+ [B_X1, CAN_Z_WALL + 0.1],
412
+ [CAN_X1, CAN_Z_FRONT + 0.06],
413
+ [CAN_X1, CAN_Z_FRONT - 0.04],
414
+ [B_X1, CAN_Z_WALL - 0.02],
415
+ ],
416
+ depth: 2 * CAN_Y,
417
+ plane: 'xz',
418
+ color: slate,
419
+ strip: 'iron',
420
+ }),
421
+ // Eaves girder on the column heads.
422
+ box({
423
+ size: [0.16, 2 * CAN_Y, 0.2],
424
+ at: [COL_X, 0, canZ(COL_X) - 0.24],
425
+ color: chocolate,
426
+ strip: 'iron',
427
+ }),
428
+ ];
429
+ // Fretted valance along the front and both ends: boards with a sawtooth bottom (LOD0).
430
+ const valance = (len: number): Mesh => {
431
+ const top = 0.5;
432
+ if (lod > 0)
433
+ return prism({
434
+ profile: [
435
+ [-len / 2, 0.08],
436
+ [len / 2, 0.08],
437
+ [len / 2, top],
438
+ [-len / 2, top],
439
+ ],
440
+ depth: 0.03,
441
+ plane: 'yz',
442
+ color: cream,
443
+ strip: 'wood',
444
+ });
445
+ const teeth = Math.round(len / 0.16);
446
+ const pts: Vec2[] = [
447
+ [-len / 2, top],
448
+ [-len / 2, 0.1],
449
+ ];
450
+ for (let i = 0; i < teeth; i++) {
451
+ const y0 = -len / 2 + (i * len) / teeth;
452
+ pts.push([y0 + len / teeth / 2, 0]);
453
+ pts.push([y0 + len / teeth, 0.1]);
454
+ }
455
+ pts.push([len / 2, top]);
456
+ return prism({ profile: pts, depth: 0.03, plane: 'yz', color: cream, strip: 'wood' });
457
+ };
458
+ cn.push(place(valance(2 * CAN_Y + 0.04), { at: [CAN_X1 + 0.02, 0, CAN_Z_FRONT - 0.5 + 0.06] }));
459
+ for (const s of [-1, 1]) {
460
+ const len = CAN_X1 - B_X1;
461
+ cn.push(
462
+ place(valance(len), {
463
+ at: [(CAN_X1 + B_X1) / 2, s * (CAN_Y + 0.02), CAN_Z_FRONT - 0.44],
464
+ yaw: Math.PI / 2,
465
+ }),
466
+ );
467
+ // Canopy ends stay open: only the valance returns along them, as at Toddington.
468
+ }
469
+ // Wall brackets (cast iron, cantilever look) between the columns.
470
+ if (lod < 2)
471
+ for (let y = -CAN_Y + 0.6; y <= CAN_Y - 0.5; y += lod === 0 ? 2.3 : 4.6)
472
+ cn.push(
473
+ beam({
474
+ from: [B_X1, y, CAN_Z_WALL - 0.75],
475
+ to: [B_X1 + 1.1, y, canZ(B_X1 + 1.1) - 0.03],
476
+ width: 0.06,
477
+ height: 0.12,
478
+ color: chocolate,
479
+ strip: 'iron',
480
+ up: [0, 1, 0],
481
+ }),
482
+ );
483
+ ctx.part('canopy', merge(cn));
484
+
485
+ const colTop = canZ(COL_X) - 0.24;
486
+ const colSegs = ctx.pick([12, 8, 5]);
487
+ const column =
488
+ lod === 2
489
+ ? box({ size: [0.18, 0.18, colTop - PLAT_Z], color: chocolate })
490
+ : lathe({
491
+ profile: [
492
+ [0, 0],
493
+ [0.17, 0],
494
+ [0.17, 0.28],
495
+ [0.1, 0.36],
496
+ [0.08, 0.45],
497
+ [0.07, colTop - PLAT_Z - 0.4],
498
+ [0.1, colTop - PLAT_Z - 0.22],
499
+ [0.17, colTop - PLAT_Z - 0.06],
500
+ [0.17, colTop - PLAT_Z],
501
+ [0, colTop - PLAT_Z],
502
+ ],
503
+ segments: colSegs,
504
+ color: chocolate,
505
+ });
506
+ const cols: Mesh[] = [];
507
+ const colYs = [-8.4, -4.2, 0, 4.2, 8.4];
508
+ for (const y of colYs) {
509
+ cols.push(place(column, { at: [COL_X, y, PLAT_Z] }));
510
+ if (lod === 0)
511
+ // Spandrel brace from the shaft up to the girder.
512
+ for (const s of [-1, 1])
513
+ cols.push(
514
+ beam({
515
+ from: [COL_X, y + s * 0.07, colTop - 0.7],
516
+ to: [COL_X, y + s * 0.75, colTop],
517
+ width: 0.05,
518
+ height: 0.05,
519
+ color: chocolate,
520
+ strip: 'iron',
521
+ }),
522
+ );
523
+ }
524
+ ctx.part('canopy_columns', dirt(merge(cols)));
525
+
526
+ // ---- furniture: benches against the wall, lamps beyond the canopy, the name board, clock.
527
+ const benchM = bench(lod);
528
+ const benchYs = [-5.9, -0.5, 3.1];
529
+ if (lod < 2)
530
+ ctx.part(
531
+ 'benches',
532
+ merge(benchYs.map((y) => place(benchM, { at: [B_X1 + 0.38, y, PLAT_Z] }))),
533
+ );
534
+ benchYs.forEach((y, i) => {
535
+ ctx.socket(`bench_${i}`, {
536
+ kind: 'seat',
537
+ at: [B_X1 + 0.4, y, PLAT_Z + 0.47],
538
+ dir: [1, 0, 0],
539
+ });
540
+ });
541
+
542
+ const lamp = lampPost(lod);
543
+ [-12.2, 9.8].forEach((y, i) => {
544
+ ctx.part(`lamp_${i}`, place(lamp.post, { at: [6.1, y, PLAT_Z] }));
545
+ ctx.part(`lamp_${i}_glass`, place(lamp.glass, { at: [6.1, y, PLAT_Z] }), {
546
+ surface: 'glass',
547
+ });
548
+ ctx.socket(`lamp_${i}_light`, { kind: 'light', at: [6.1, y, PLAT_Z + 2.94] });
549
+ });
550
+
551
+ ctx.part('name_board', place(nameBoard('TODDINGTON', lod), { at: [5.6, 12.55, PLAT_Z] }));
552
+
553
+ // ---- rainwater goods: half-round gutters on both eaves, downpipes clear of the canopy.
554
+ if (lod < 2) {
555
+ const rw: Mesh[] = [];
556
+ const gz = info.eave - 0.06;
557
+ const pipeSegs = lod === 0 ? 8 : 4;
558
+ for (const [xe, xw] of [
559
+ [B_X1 + 0.45, B_X1 + 0.07],
560
+ [B_X0 - 0.45, B_X0 - 0.07],
561
+ ] as const) {
562
+ rw.push(
563
+ beam({
564
+ from: [xe, -B_Y - 0.35, gz],
565
+ to: [xe, B_Y + 0.35, gz],
566
+ width: 0.12,
567
+ segments: pipeSegs,
568
+ color: chocolate,
569
+ }),
570
+ );
571
+ for (const y of [-B_Y + 0.25, B_Y - 0.25]) {
572
+ rw.push(
573
+ beam({
574
+ from: [xe, y, gz],
575
+ to: [xw, y, gz - 0.35],
576
+ width: 0.08,
577
+ segments: pipeSegs,
578
+ color: chocolate,
579
+ }),
580
+ );
581
+ rw.push(
582
+ beam({
583
+ from: [xw, y, gz - 0.35],
584
+ to: [xw, y, PLAT_Z],
585
+ width: 0.08,
586
+ segments: pipeSegs,
587
+ color: chocolate,
588
+ }),
589
+ );
590
+ if (lod === 0)
591
+ for (const z of [PLAT_Z + 1.0, PLAT_Z + 2.4])
592
+ rw.push(
593
+ box({
594
+ size: [0.04, 0.12, 0.04],
595
+ at: [xw + (xw > 0 ? -0.05 : 0.05), y, z],
596
+ color: chocolate,
597
+ }),
598
+ ); // holdfasts
599
+ }
600
+ }
601
+ ctx.part('rainwater', rw.length ? merge(rw) : null);
602
+ }
603
+ // Gable finials (LOD0/1): turned timber spikes on the bargeboard apex.
604
+ if (lod < 2) {
605
+ const fin = lathe({
606
+ profile: [
607
+ [0, -0.15],
608
+ [0.06, -0.15],
609
+ [0.06, 0.05],
610
+ [0.09, 0.15],
611
+ [0.04, 0.35],
612
+ [0, 0.55],
613
+ ],
614
+ segments: 6,
615
+ color: cream,
616
+ });
617
+ ctx.part(
618
+ 'finials',
619
+ merge(
620
+ [-1, 1].map((sy) => place(fin, { at: [(B_X0 + B_X1) / 2, sy * (B_Y + 0.33), RIDGE_Z] })),
621
+ ),
622
+ );
623
+ }
624
+
625
+ if (lod === 0) {
626
+ // Milk churns and a GWR platform barrow by the gable (the halt's goods traffic).
627
+ const churn = lathe({
628
+ profile: [
629
+ [0, 0],
630
+ [0.17, 0],
631
+ [0.18, 0.05],
632
+ [0.18, 0.55],
633
+ [0.11, 0.72],
634
+ [0.1, 0.82],
635
+ [0.12, 0.86],
636
+ [0, 0.88],
637
+ ],
638
+ segments: 12,
639
+ color: hex('#b9bab6'),
640
+ strip: 'iron',
641
+ });
642
+ ctx.part(
643
+ 'churns',
644
+ merge(
645
+ [
646
+ [3.4, -11.0],
647
+ [3.8, -11.2],
648
+ [3.55, -11.55],
649
+ ].map(([x = 0, y = 0]) => place(churn, { at: [x, y, PLAT_Z] })),
650
+ ),
651
+ );
652
+ const barrow: Mesh[] = [
653
+ box({ size: [1.3, 0.62, 0.05], at: [0, 0, 0.32], color: chocolate, strip: 'wood' }),
654
+ box({ size: [0.05, 0.62, 0.45], at: [0.62, 0, 0.37], color: chocolate, strip: 'wood' }),
655
+ cylinder({
656
+ radius: 0.15,
657
+ length: 0.04,
658
+ segments: 10,
659
+ axis: 'y',
660
+ at: [0.3, 0.33, 0.15],
661
+ color: iron,
662
+ }),
663
+ cylinder({
664
+ radius: 0.15,
665
+ length: 0.04,
666
+ segments: 10,
667
+ axis: 'y',
668
+ at: [0.3, -0.33, 0.15],
669
+ color: iron,
670
+ }),
671
+ cylinder({
672
+ radius: 0.02,
673
+ length: 0.7,
674
+ segments: 6,
675
+ axis: 'y',
676
+ at: [0.3, 0, 0.15],
677
+ color: iron,
678
+ }),
679
+ box({ size: [0.05, 0.05, 0.32], at: [-0.6, 0.27, 0], color: iron }),
680
+ box({ size: [0.05, 0.05, 0.32], at: [-0.6, -0.27, 0], color: iron }),
681
+ beam({ from: [-0.65, 0.27, 0.34], to: [-1.0, 0.27, 0.5], width: 0.04, color: chocolate }),
682
+ beam({ from: [-0.65, -0.27, 0.34], to: [-1.0, -0.27, 0.5], width: 0.04, color: chocolate }),
683
+ ];
684
+ ctx.part('barrow', place(merge(barrow), { at: [4.4, -13.0, PLAT_Z], yaw: 0.5 }));
685
+ // Platform clock on a wall bracket, both faces along the platform.
686
+ const ck: Mesh[] = [
687
+ box({ size: [0.6, 0.1, 0.6], at: [B_X1 + 0.9, 1.2, 3.0], color: chocolate }),
688
+ cell({
689
+ origin: [B_X1 + 0.6, 1.2 + 0.051, 3.0],
690
+ u: [0.6, 0, 0],
691
+ v: [0, 0, 0.6],
692
+ color: white,
693
+ cell: 'clock',
694
+ }),
695
+ cell({
696
+ origin: [B_X1 + 1.2, 1.2 - 0.051, 3.0],
697
+ u: [-0.6, 0, 0],
698
+ v: [0, 0, 0.6],
699
+ color: white,
700
+ cell: 'clock',
701
+ }),
702
+ beam({ from: [B_X1, 1.2, 3.3], to: [B_X1 + 0.6, 1.2, 3.3], width: 0.05, color: iron }),
703
+ ];
704
+ ctx.part('clock', merge(ck));
705
+ // Room boards over the front doors.
706
+ const boards: Mesh[] = [];
707
+ for (const o of ops)
708
+ if (o.kind === 'door' && o.side === 'front')
709
+ boards.push(
710
+ cell({
711
+ origin: [B_X1 + 0.002, o.at[1] - 0.55, PLAT_Z + 2.75],
712
+ u: [0, 1.1, 0],
713
+ v: [0, 0, 0.3],
714
+ color: white,
715
+ cell: 'sign',
716
+ inset: -0.03,
717
+ }),
718
+ );
719
+ ctx.part('room_boards', merge(boards));
720
+ }
721
+ },
722
+ });