topotopo 0.3.0 → 0.5.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 (354) hide show
  1. package/NOTICE +40 -10
  2. package/README.md +475 -111
  3. package/dist/cli.js +328 -133
  4. package/dist/config.d.ts +48 -0
  5. package/dist/config.js +170 -0
  6. package/dist/core/analysis.d.ts +5 -1
  7. package/dist/core/analysis.js +8 -3
  8. package/dist/core/bake.d.ts +16 -8
  9. package/dist/core/bake.js +165 -29
  10. package/dist/core/bevel.d.ts +3 -1
  11. package/dist/core/bevel.js +238 -97
  12. package/dist/core/decimate.d.ts +65 -0
  13. package/dist/core/decimate.js +409 -3
  14. package/dist/core/erosion.d.ts +37 -0
  15. package/dist/core/erosion.js +41 -1
  16. package/dist/core/geometry.d.ts +5 -1
  17. package/dist/core/geometry.js +204 -4
  18. package/dist/core/heightfield.d.ts +27 -4
  19. package/dist/core/heightfield.js +54 -16
  20. package/dist/core/imageops.d.ts +6 -0
  21. package/dist/core/imageops.js +51 -0
  22. package/dist/core/intrinsics.d.ts +7 -0
  23. package/dist/core/intrinsics.js +94 -0
  24. package/dist/core/manifold.d.ts +12 -1
  25. package/dist/core/manifold.js +78 -6
  26. package/dist/core/materials.d.ts +11 -0
  27. package/dist/core/materials.js +56 -0
  28. package/dist/core/noise.d.ts +9 -0
  29. package/dist/core/noise.js +10 -1
  30. package/dist/core/packed.js +11 -0
  31. package/dist/core/particles.d.ts +1 -1
  32. package/dist/core/particles.js +1 -1
  33. package/dist/core/polymerge.d.ts +21 -0
  34. package/dist/core/polymerge.js +327 -0
  35. package/dist/core/rbd.js +13 -1
  36. package/dist/core/repair.d.ts +2 -0
  37. package/dist/core/repair.js +2 -0
  38. package/dist/core/report.d.ts +70 -0
  39. package/dist/core/report.js +275 -0
  40. package/dist/core/scatter.d.ts +1 -1
  41. package/dist/core/scatter.js +1 -1
  42. package/dist/core/scene.d.ts +20 -0
  43. package/dist/core/scene.js +72 -0
  44. package/dist/core/sha256.d.ts +4 -0
  45. package/dist/core/sha256.js +69 -0
  46. package/dist/core/shapes.d.ts +3 -0
  47. package/dist/core/shapes.js +34 -0
  48. package/dist/core/snippet-lib.d.ts +15 -2
  49. package/dist/core/snippet-lib.js +40 -14
  50. package/dist/core/solidify.d.ts +38 -0
  51. package/dist/core/solidify.js +356 -0
  52. package/dist/core/tangents.d.ts +54 -0
  53. package/dist/core/tangents.js +218 -0
  54. package/dist/core/texcoord.d.ts +4 -0
  55. package/dist/core/texcoord.js +14 -0
  56. package/dist/core/texnoise.d.ts +6 -1
  57. package/dist/core/texnoise.js +6 -2
  58. package/dist/core/texsdf.d.ts +131 -0
  59. package/dist/core/texsdf.js +637 -0
  60. package/dist/core/texture.d.ts +163 -9
  61. package/dist/core/texture.js +844 -20
  62. package/dist/core/topology.d.ts +32 -0
  63. package/dist/core/topology.js +238 -7
  64. package/dist/core/traceimage.d.ts +7 -0
  65. package/dist/core/traceimage.js +221 -0
  66. package/dist/core/tritri.d.ts +5 -0
  67. package/dist/core/tritri.js +120 -0
  68. package/dist/core/unwrap.d.ts +72 -0
  69. package/dist/core/unwrap.js +800 -0
  70. package/dist/core/usercode.d.ts +27 -0
  71. package/dist/core/usercode.js +87 -0
  72. package/dist/core/uv.d.ts +15 -16
  73. package/dist/core/uv.js +36 -189
  74. package/dist/core/uvislands.d.ts +62 -0
  75. package/dist/core/uvislands.js +574 -0
  76. package/dist/core/uvoverlap.d.ts +58 -0
  77. package/dist/core/uvoverlap.js +220 -0
  78. package/dist/core/uvpack.d.ts +64 -0
  79. package/dist/core/uvpack.js +628 -0
  80. package/dist/core/uvreport.d.ts +127 -0
  81. package/dist/core/uvreport.js +372 -0
  82. package/dist/core/wrangle.d.ts +6 -1
  83. package/dist/core/wrangle.js +27 -16
  84. package/dist/core/xatlas.d.ts +16 -1
  85. package/dist/core/xatlas.js +95 -61
  86. package/dist/engines.d.ts +63 -0
  87. package/dist/engines.js +180 -0
  88. package/dist/explain.d.ts +4 -3
  89. package/dist/explain.js +129 -12
  90. package/dist/graph/engine.d.ts +92 -29
  91. package/dist/graph/engine.js +298 -148
  92. package/dist/graph/expr.d.ts +6 -3
  93. package/dist/graph/expr.js +18 -8
  94. package/dist/graph/outputs.d.ts +23 -0
  95. package/dist/graph/outputs.js +41 -0
  96. package/dist/graph/packages.d.ts +72 -0
  97. package/dist/graph/packages.js +261 -0
  98. package/dist/graph/parallel.d.ts +3 -1
  99. package/dist/graph/parallel.js +4 -1
  100. package/dist/graph/params.d.ts +6 -0
  101. package/dist/graph/params.js +34 -7
  102. package/dist/graph/scope.d.ts +55 -0
  103. package/dist/graph/scope.js +14 -0
  104. package/dist/graph/types.d.ts +75 -12
  105. package/dist/graph/types.js +4 -2
  106. package/dist/graph/vars.d.ts +16 -0
  107. package/dist/graph/vars.js +80 -0
  108. package/dist/host/artifacts.d.ts +10 -1
  109. package/dist/host/artifacts.js +37 -6
  110. package/dist/host/cook.d.ts +241 -0
  111. package/dist/host/cook.js +844 -0
  112. package/dist/host/export-targets.d.ts +42 -5
  113. package/dist/host/export-targets.js +72 -13
  114. package/dist/host/godot-commands.d.ts +4 -0
  115. package/dist/host/godot-commands.js +21 -0
  116. package/dist/host/godot.d.ts +183 -0
  117. package/dist/host/godot.js +916 -0
  118. package/dist/host/node.d.ts +12 -7
  119. package/dist/host/node.js +27 -9
  120. package/dist/host/pool.js +51 -2
  121. package/dist/host/sidecars.d.ts +8 -0
  122. package/dist/host/sidecars.js +50 -0
  123. package/dist/host/types.d.ts +19 -6
  124. package/dist/host/version.d.ts +1 -0
  125. package/dist/host/version.js +3 -0
  126. package/dist/host/worker.js +5 -2
  127. package/dist/index.d.ts +5 -3
  128. package/dist/index.js +3 -2
  129. package/dist/inspect.d.ts +84 -1
  130. package/dist/inspect.js +271 -24
  131. package/dist/io/common.d.ts +33 -5
  132. package/dist/io/export.js +2 -1
  133. package/dist/io/files.d.ts +23 -4
  134. package/dist/io/files.js +60 -8
  135. package/dist/io/gltf.js +355 -51
  136. package/dist/io/heightmap.d.ts +3 -0
  137. package/dist/io/heightmap.js +1 -0
  138. package/dist/io/import.js +10 -0
  139. package/dist/io/inspect-scene.d.ts +55 -0
  140. package/dist/io/inspect-scene.js +155 -0
  141. package/dist/io/kinds.d.ts +81 -0
  142. package/dist/io/kinds.js +163 -0
  143. package/dist/io/points.d.ts +2 -1
  144. package/dist/io/points.js +3 -1
  145. package/dist/io/sidecars.d.ts +24 -0
  146. package/dist/io/sidecars.js +57 -0
  147. package/dist/io/source.d.ts +65 -0
  148. package/dist/io/source.js +112 -0
  149. package/dist/io/targets.d.ts +47 -3
  150. package/dist/io/targets.js +149 -14
  151. package/dist/io/textures.js +21 -1
  152. package/dist/io/unreal.js +5 -1
  153. package/dist/mcp/docs.d.ts +10 -1
  154. package/dist/mcp/docs.js +816 -119
  155. package/dist/mcp/inputs.d.ts +12 -5
  156. package/dist/mcp/inputs.js +50 -13
  157. package/dist/mcp/server.js +70 -24
  158. package/dist/mcp/tools.d.ts +14 -7
  159. package/dist/mcp/tools.js +207 -108
  160. package/dist/mcp/verify.d.ts +2 -2
  161. package/dist/mcp/verify.js +1 -1
  162. package/dist/mcp/workspace.d.ts +15 -0
  163. package/dist/mcp/workspace.js +349 -0
  164. package/dist/nodes/attributes.js +198 -1
  165. package/dist/nodes/bake.js +207 -83
  166. package/dist/nodes/beam.d.ts +1 -0
  167. package/dist/nodes/beam.js +201 -0
  168. package/dist/nodes/bevel.js +54 -5
  169. package/dist/nodes/cloth.js +2 -0
  170. package/dist/nodes/code.js +22 -10
  171. package/dist/nodes/curves.js +440 -93
  172. package/dist/nodes/flow.js +53 -33
  173. package/dist/nodes/generate.js +13 -39
  174. package/dist/nodes/heightfield.js +248 -77
  175. package/dist/nodes/imageops.d.ts +1 -0
  176. package/dist/nodes/imageops.js +203 -0
  177. package/dist/nodes/index.d.ts +4 -0
  178. package/dist/nodes/index.js +4 -0
  179. package/dist/nodes/material.js +91 -23
  180. package/dist/nodes/measure.js +45 -18
  181. package/dist/nodes/particles.js +2 -0
  182. package/dist/nodes/pcg.js +6 -5
  183. package/dist/nodes/procedural.js +4 -3
  184. package/dist/nodes/rbd.js +1 -1
  185. package/dist/nodes/remesh.js +71 -15
  186. package/dist/nodes/scene.d.ts +1 -0
  187. package/dist/nodes/scene.js +55 -0
  188. package/dist/nodes/sdf.js +10 -5
  189. package/dist/nodes/solid.js +20 -5
  190. package/dist/nodes/solidify.d.ts +1 -0
  191. package/dist/nodes/solidify.js +52 -0
  192. package/dist/nodes/splines.d.ts +15 -1
  193. package/dist/nodes/splines.js +112 -105
  194. package/dist/nodes/texture.d.ts +21 -6
  195. package/dist/nodes/texture.js +1318 -185
  196. package/dist/nodes/topology.d.ts +7 -0
  197. package/dist/nodes/topology.js +133 -6
  198. package/dist/nodes/transform.js +11 -3
  199. package/dist/nodes/util.d.ts +1 -1
  200. package/dist/nodes/uv.js +192 -174
  201. package/dist/nodes/wasmcall.js +6 -2
  202. package/dist/open.d.ts +19 -0
  203. package/dist/open.js +12 -0
  204. package/dist/package.d.ts +288 -0
  205. package/dist/package.js +772 -0
  206. package/dist/packages/check.d.ts +32 -0
  207. package/dist/packages/check.js +169 -0
  208. package/dist/packages/commands.d.ts +57 -0
  209. package/dist/packages/commands.js +537 -0
  210. package/dist/packages/registry.d.ts +796 -0
  211. package/dist/packages/registry.js +2998 -0
  212. package/dist/packages/update.d.ts +124 -0
  213. package/dist/packages/update.js +476 -0
  214. package/dist/render/options.d.ts +2 -0
  215. package/dist/render/options.js +44 -5
  216. package/dist/render/pbr.d.ts +28 -0
  217. package/dist/render/pbr.js +378 -0
  218. package/dist/render/preview.d.ts +69 -0
  219. package/dist/render/preview.js +26 -0
  220. package/dist/render/raster.d.ts +78 -7
  221. package/dist/render/raster.js +600 -145
  222. package/dist/render/texview.d.ts +7 -1
  223. package/dist/render/texview.js +34 -2
  224. package/dist/scan.d.ts +61 -0
  225. package/dist/scan.js +228 -0
  226. package/dist/session.d.ts +311 -0
  227. package/dist/session.js +849 -0
  228. package/dist/viewer/app/api.js +48 -6
  229. package/dist/viewer/app/camera.js +1 -1
  230. package/dist/viewer/app/cooking.js +78 -0
  231. package/dist/viewer/app/embed.js +100 -0
  232. package/dist/viewer/app/export-popover.js +118 -16
  233. package/dist/viewer/app/grid.js +6 -2
  234. package/dist/viewer/app/guides.js +123 -1
  235. package/dist/viewer/app/keymap.js +7 -4
  236. package/dist/viewer/app/layers.js +5 -5
  237. package/dist/viewer/app/main.js +186 -53
  238. package/dist/viewer/app/markers.js +61 -1
  239. package/dist/viewer/app/outliner.js +72 -27
  240. package/dist/viewer/app/output-info.js +45 -0
  241. package/dist/viewer/app/outputs.css +147 -8
  242. package/dist/viewer/app/outputs.js +168 -54
  243. package/dist/viewer/app/packages.js +614 -0
  244. package/dist/viewer/app/props.js +177 -53
  245. package/dist/viewer/app/scene.js +35 -6
  246. package/dist/viewer/app/select.js +5 -4
  247. package/dist/viewer/app/selection.js +1 -1
  248. package/dist/viewer/app/status.js +12 -15
  249. package/dist/viewer/app/style.css +66 -8
  250. package/dist/viewer/app/units.js +1 -1
  251. package/dist/viewer/app/vars.js +48 -1
  252. package/dist/viewer/app/welcome.js +72 -0
  253. package/dist/viewer/graph-file.d.ts +62 -0
  254. package/dist/viewer/graph-file.js +175 -0
  255. package/dist/viewer/index.html +24 -11
  256. package/dist/viewer/json-edit.d.ts +13 -0
  257. package/dist/viewer/json-edit.js +274 -0
  258. package/dist/viewer/outputs.d.ts +49 -5
  259. package/dist/viewer/outputs.js +264 -56
  260. package/dist/viewer/packages.d.ts +121 -0
  261. package/dist/viewer/packages.js +584 -0
  262. package/dist/viewer/server.d.ts +24 -7
  263. package/dist/viewer/server.js +289 -31
  264. package/dist/web/app/web.css +419 -0
  265. package/dist/web/app/web.js +188 -0
  266. package/dist/web/bake.d.ts +34 -0
  267. package/dist/web/bake.js +153 -0
  268. package/dist/web/folder-page.d.ts +101 -0
  269. package/dist/web/folder-page.js +146 -0
  270. package/dist/web/folders.d.ts +280 -0
  271. package/dist/web/folders.js +970 -0
  272. package/dist/web/library.d.ts +91 -0
  273. package/dist/web/library.js +228 -0
  274. package/dist/web/markdown.d.ts +45 -0
  275. package/dist/web/markdown.js +677 -0
  276. package/dist/web/pages.d.ts +258 -0
  277. package/dist/web/pages.js +301 -0
  278. package/dist/web/server.d.ts +24 -0
  279. package/dist/web/server.js +1068 -0
  280. package/dist/workspace.d.ts +88 -105
  281. package/dist/workspace.js +359 -375
  282. package/integrations/godot/addons/topotopo/LICENSE +202 -0
  283. package/integrations/godot/addons/topotopo/README.md +57 -0
  284. package/integrations/godot/addons/topotopo/context_menu.gd +43 -0
  285. package/integrations/godot/addons/topotopo/dock.gd +266 -0
  286. package/integrations/godot/addons/topotopo/dock.tscn +72 -0
  287. package/integrations/godot/addons/topotopo/export_filter.gd +72 -0
  288. package/integrations/godot/addons/topotopo/gltf_instancing.gd +131 -0
  289. package/integrations/godot/addons/topotopo/icons/topotopo.svg +1 -0
  290. package/integrations/godot/addons/topotopo/inspector.gd +38 -0
  291. package/integrations/godot/addons/topotopo/instances_post_import.gd +111 -0
  292. package/integrations/godot/addons/topotopo/package.gd +23 -0
  293. package/integrations/godot/addons/topotopo/package_importer.gd +187 -0
  294. package/integrations/godot/addons/topotopo/plugin.cfg +7 -0
  295. package/integrations/godot/addons/topotopo/plugin.gd +970 -0
  296. package/integrations/godot/addons/topotopo/record.gd +435 -0
  297. package/integrations/godot/addons/topotopo/runner.gd +458 -0
  298. package/integrations/godot/addons/topotopo/tools/check.gd +42 -0
  299. package/integrations/godot/addons/topotopo/watcher.gd +199 -0
  300. package/kernels/pkg/README.md +23 -29
  301. package/kernels/pkg-simd/README.md +23 -29
  302. package/library/architecture/versions/1.0/architecture.topo +12 -0
  303. package/{shelf → library/architecture/versions/1.0/graphs}/arch.json +3 -3
  304. package/{shelf → library/architecture/versions/1.0/graphs}/beam_truss.json +6 -6
  305. package/{shelf → library/architecture/versions/1.0/graphs}/brick_wall.json +8 -8
  306. package/{shelf → library/architecture/versions/1.0/graphs}/door_frame.json +3 -3
  307. package/{shelf → library/architecture/versions/1.0/graphs}/hex_grid_floor.json +3 -2
  308. package/{shelf → library/architecture/versions/1.0/graphs}/house.json +8 -8
  309. package/library/architecture/versions/1.0/graphs/lineup.json +42 -0
  310. package/{shelf → library/architecture/versions/1.0/graphs}/pillar.json +3 -2
  311. package/{shelf → library/architecture/versions/1.0/graphs}/railing.json +5 -5
  312. package/{shelf → library/architecture/versions/1.0/graphs}/roof_gable.json +2 -2
  313. package/{shelf → library/architecture/versions/1.0/graphs}/roof_hip.json +2 -2
  314. package/{shelf → library/architecture/versions/1.0/graphs}/roof_skeleton.json +2 -1
  315. package/{shelf → library/architecture/versions/1.0/graphs}/scaffold.json +4 -4
  316. package/{shelf → library/architecture/versions/1.0/graphs}/spiral_stairs.json +3 -2
  317. package/{shelf → library/architecture/versions/1.0/graphs}/stairs.json +6 -6
  318. package/{shelf → library/architecture/versions/1.0/graphs}/tile_floor.json +3 -2
  319. package/{shelf → library/architecture/versions/1.0/graphs}/wall_segment.json +10 -10
  320. package/{shelf → library/architecture/versions/1.0/graphs}/window_frame.json +2 -2
  321. package/library/architecture/versions/1.0/version.json +1119 -0
  322. package/{shelf → library/nature/versions/1.0/graphs}/bush.json +2 -2
  323. package/{shelf → library/nature/versions/1.0/graphs}/cliff_block.json +4 -3
  324. package/{shelf → library/nature/versions/1.0/graphs}/forest_patch.json +5 -5
  325. package/{shelf → library/nature/versions/1.0/graphs}/grass_clumps.json +2 -2
  326. package/library/nature/versions/1.0/graphs/lineup.json +24 -0
  327. package/{shelf → library/nature/versions/1.0/graphs}/log.json +6 -6
  328. package/{shelf → library/nature/versions/1.0/graphs}/rock.json +5 -4
  329. package/{shelf → library/nature/versions/1.0/graphs}/scatter_rocks.json +5 -5
  330. package/{shelf → library/nature/versions/1.0/graphs}/tree_lowpoly.json +3 -2
  331. package/library/nature/versions/1.0/nature.topo +12 -0
  332. package/library/nature/versions/1.0/version.json +534 -0
  333. package/{shelf → library/props/versions/1.0/graphs}/barrel.json +5 -4
  334. package/{shelf → library/props/versions/1.0/graphs}/crate.json +3 -3
  335. package/library/props/versions/1.0/graphs/lineup.json +18 -0
  336. package/{shelf → library/props/versions/1.0/graphs}/pallet.json +4 -3
  337. package/{shelf → library/props/versions/1.0/graphs}/pipe_run.json +3 -3
  338. package/{shelf → library/props/versions/1.0/graphs}/sandbag_wall.json +5 -5
  339. package/library/props/versions/1.0/props.topo +12 -0
  340. package/library/props/versions/1.0/version.json +336 -0
  341. package/{shelf → library/street/versions/1.0/graphs}/bench.json +5 -5
  342. package/{shelf → library/street/versions/1.0/graphs}/bollard.json +2 -1
  343. package/{shelf → library/street/versions/1.0/graphs}/cable.json +4 -4
  344. package/{shelf → library/street/versions/1.0/graphs}/fence.json +7 -7
  345. package/{shelf → library/street/versions/1.0/graphs}/lamp_post.json +2 -2
  346. package/library/street/versions/1.0/graphs/lineup.json +22 -0
  347. package/{shelf → library/street/versions/1.0/graphs}/road_strip.json +2 -2
  348. package/{shelf → library/street/versions/1.0/graphs}/sign_post.json +1 -1
  349. package/library/street/versions/1.0/street.topo +12 -0
  350. package/library/street/versions/1.0/version.json +421 -0
  351. package/package.json +23 -8
  352. package/dist/graph/migrate.d.ts +0 -23
  353. package/dist/graph/migrate.js +0 -58
  354. package/shelf/index.json +0 -190
package/README.md CHANGED
@@ -1,7 +1,5 @@
1
1
  # <img src="docs/brand/mark.svg" alt="" width="44" height="44" align="top"> TopoTopo
2
2
 
3
- *Formerly Polyforge; renamed before the first tagged release. Files written as `polyforge-*` still load.*
4
-
5
3
  TopoTopo is an open-source procedural geometry engine. You describe geometry as a node graph in JSON; the engine
6
4
  cooks it headless and deterministic, and exports it to Unreal, Blender and Houdini. Built for LLM agents through MCP,
7
5
  and for people through the CLI. It runs on Node and WebAssembly with no GPU, every cook is reproducible from the
@@ -11,9 +9,9 @@ graph and its seeds, and the core is browser-ready.
11
9
  modelling (bevel, knife, bridge, quad fill), UVs (xatlas unwrap, LSCM), remeshing (isotropic, quad, voxel) and LOD,
12
10
  scattering and instancing, robust booleans, Voronoi fracture, an SDF/implicit toolkit and sampled SDF grids,
13
11
  heightfield terrain (masks, hydraulic and thermal erosion, roads, scattering), procedural textures and bakes,
14
- cloth draping and inflation (XPBD), L-systems, text, loops, a frame solver, in-graph checks, and code nodes. A shelf of ready-made graph assets (walls,
15
- roofs, stairs, props, trees, rocks, PCG helpers) is used like nodes. Every node documents its params and carries an
16
- example that is cooked in the tests.
12
+ cloth draping and inflation (XPBD), L-systems, text, loops, a frame solver, in-graph checks, and code nodes. TopoTopo's
13
+ own packages, ready-made generators (walls, houses, roofs, stairs, props, trees, rocks, roads, PCG helpers), are
14
+ used like nodes. Every node documents its params and carries an example that is cooked in the tests.
17
15
  - **Familiar to Houdini users**: SOP-style nodes, attributes, groups and `.geo` export; Houdini node names work as
18
16
  aliases. Blender Geometry Nodes and Unreal PCG users will recognise the rest.
19
17
  - **Rust/WASM kernels**: a straight skeleton (pitched roofs and polygon offsets from any footprint, holes included),
@@ -49,22 +47,24 @@ graph and its seeds, and the core is browser-ready.
49
47
  maps, roads and scatter; export as Unreal Landscape heightmaps (16-bit PNG or RAW `.r16` with a JSON sidecar holding
50
48
  the import scale) and 8-bit weight layers, or as one `unreal_landscape` bundle: heightmap, every layer, a manifest
51
49
  with the exact Landscape import settings, the meshes and the instance stream.
52
- - **Textures**: a Substance-Designer-style image node family (noise, patterns, cells, shapes, blends, levels, warps,
53
- normal and AO from height, channel packing) and bakes from meshes in uv space (AO, curvature, thickness, normals and
54
- height from a high-res mesh, island ids, masks, vertex colour). Your own PNGs (8 or 16 bit, grey or colour) load as
50
+ - **Textures**: a Substance Designer / Houdini Copernicus style image node family for PBR materials (noise, patterns,
51
+ cells, grunge, shapes and signed distance fields with offsets, booleans and bevels, flood fill, blends, levels and
52
+ histogram tools, warps, slope and directional blur, make it tile, normal, height, curvature and AO conversions,
53
+ channel packing), with widths and distances in metres so a graph gives the same maps at any resolution, and bakes
54
+ from meshes in uv space (AO, curvature, thickness, normals and height from a high-res mesh, island ids, masks, vertex
55
+ colour). Your own PNGs (8 or 16 bit, grey or colour) load as
55
56
  images with `image_file` and go through the same nodes. Images travel with the geometry, materials reference them as
56
57
  `image:<name>`, and glTF/USD exports carry them, so assets ship with textures whose licence is the graph's.
57
58
  - **Live preview and controls**: a local three.js page that refreshes whenever a graph changes. Click any node to
58
59
  see its result. A graph's exposed `params` appear as sliders, checkboxes, selects and colour pickers; dragging one
59
- re-cooks only the nodes that read it. Drop your own files
60
- anywhere on the page: they land in the workspace `inputs/` folder (with `topotopo view`, the `inputs/` folder beside
60
+ re-cooks only the nodes that read it, the newest value replacing a cook still running, and the page shows which
61
+ node is cooking and for how long, with a Stop button. Drop your own files
62
+ anywhere on the page: they land in the package `inputs/` folder (with `topotopo view`, the `inputs/` folder beside
61
63
  the graph file), show as grey reference layers (a PNG as a flat picture), and `file` nodes read them as
62
64
  `inputs/<name>`.
63
65
 
64
- **Documentation:** [topotopo.dev](https://topotopo.dev) has the node reference, the shelf and example galleries, the
65
- design notes and the release notes, generated from this repository (`npm run site`).
66
-
67
- The design notes, including whether the browser is a limitation, are in [docs/DESIGN.md](docs/DESIGN.md).
66
+ **Documentation:** [topotopo.dev](https://topotopo.dev) has the node reference, TopoTopo's own packages, the example
67
+ renders and the release notes, generated from this repository (`npm run site`).
68
68
 
69
69
  ![city](examples/renders/voronoi_city.png)
70
70
 
@@ -77,16 +77,20 @@ Requires Node ≥ 22.18.
77
77
  ```bash
78
78
  npx topotopo --catalog # node types by category
79
79
  npx topotopo --help-node scatter # one node's params, defaults and example
80
+ npx topotopo --help-topic export # a help topic (the MCP help tool's text)
80
81
  npx topotopo graph.json --render out.png --export out.glb # cook, render, export
81
- npx topotopo graph.json --export-all # every output's export target, into exports/ beside it
82
+ npx topotopo graph.json --export-all # every output's export target, into its package's exports/
82
83
  npx topotopo view graph.json # live 3D viewer, re-cooks on save; drops go to inputs/ beside it
83
- npx topotopo mcp --workspace /absolute/path/to/workspace # the MCP server over stdio
84
+ npx topotopo mcp --package /absolute/path/to/package # the MCP server over stdio
84
85
  ```
85
86
 
86
- The current release is v0.3 ([release notes](docs/release/v0.3-release-notes.md)); v0.2 was the first tagged release
87
- ([release notes](docs/release/v0.2-release-notes.md)). To try unreleased changes, build the tarball from a clone: `npm pack`, then
88
- `npm install -g ./topotopo-<version>.tgz` (or into a project).
89
- `import { Engine } from 'topotopo'` gives the engine API (`src/index.ts`) with its type declarations.
87
+ The current release is v0.4 ([release notes](docs/release/v0.4-release-notes.md)); earlier ones:
88
+ [v0.3](docs/release/v0.3-release-notes.md), [v0.2](docs/release/v0.2-release-notes.md), the first tagged release. To try unreleased changes, build the tarball from a clone: `npm pack`, then
89
+ `npm install -g ./topotopo-<version>.tgz` (or, without `-g`, into a folder of your own).
90
+ `import { Engine } from 'topotopo'` gives the engine API (`src/index.ts`) with its type declarations, and
91
+ `import { createNodeHost, openPackage } from 'topotopo/node'` the Node host and packages with the packages they use, for a
92
+ script that cooks package outputs itself (a world generator): `openPackage(engine, dir)` puts the packages a package uses, its
93
+ graphs and assets in the engine's root scope, and `packages.addFor(graph)` adds what a graph names on first use.
90
94
 
91
95
  **From a clone.** Development runs the TypeScript sources directly (Node type stripping); there is no build step for
92
96
  working on the code or running the tests. `npm run build` (run by `npm pack`) compiles `src/` to `dist/` for the package.
@@ -114,17 +118,59 @@ To browse the examples in the live 3D viewer without an MCP client:
114
118
  npm run preview
115
119
  ```
116
120
 
117
- The viewer's left panel has three tabs: **Scene** (the graph's nodes and guides), **Outputs** and **Inputs**.
118
- **Outputs**, the default, shows all graphs' main results, named deliverables and their textures; click one to
119
- inspect it alone, and **Scene** in the top bar restores the scene. Publish extra results in graph JSON with
120
- `"outputs": {"rotor": {"node": "rotor_final", "label": "Rotor"}}`, keeping `"output"` as the default. Each result
121
- has an **Export** button: the first click asks for a format and a file inside `exports/` and stores that target in
122
- the graph (`"export": "glb"`, or `{"format": "obj", "path": "parts/rotor.obj", "up_axis": "z"}`, on the graph or on an
123
- output); later clicks overwrite the same file, and **Export all** writes every target. MCP `export {output}` and the
124
- CLI's `--export-all` write the same targets. **Inputs** lists your files in `inputs/`, with **Add input** (or drop
125
- files anywhere on the page); the agent is told about new ones in its next tool answer. Images open in a 2D viewer
126
- with layers and channels (generated textures default to RGB; use A to inspect packed alpha/AO); JPEG/WebP are for
127
- viewing only. For `topotopo view graph.json`, `inputs/` and `exports/` are beside that graph.
121
+ The viewer opens a package (`topotopo edit <package>`, the MCP server's package, or `topotopo view graph.json`) with
122
+ the package's default graph in view; the browser tab is named after the package. A package's graphs are the files in
123
+ `graphs/` and the graph files beside its manifest, `<id>.topo`. A package without graphs shows its name, a pointer to
124
+ TopoTopo's built-in packages and what to ask your agent; a folder that is no package says so and how to make it one. The left panel
125
+ has four tabs: **Scene** (the graph's nodes and guides), **Outputs**, **Inputs** and, in a package, **Packages** (see
126
+ [Packages](#packages)). **Outputs**, the default, shows each graph's results, one card per result, and their textures;
127
+ click one to inspect it alone, and **Scene** in the top bar returns to the whole scene. Publish extra results in graph
128
+ JSON with `"outputs": {"rotor": {"node": "rotor_final", "label": "Rotor"}}`, keeping `"output"` as the default (a
129
+ named output of the output node is the default one, marked so). Each card says what the result is with the words
130
+ packages and search use, mesh, instances, points, curves, terrain, textures, material, volume or scene, and its size in a line
131
+ beside it ("2049 × 2049 samples, 2 m apart"), and offers only the formats that write it, each with a line saying what
132
+ it writes (a terrain: 16-bit PNG or RAW heightmap with its JSON sidecar, mask PNGs, the Unreal Landscape bundle; a
133
+ mesh: GLB, glTF, USD, OBJ …). While a result cooks again its card keeps its picture; a card whose cook was stopped
134
+ says it is out of date.
135
+ **Download** gets the result in the format you pick as a browser download: the file itself, or one zip when the
136
+ format writes several files (a heightmap and its sidecar, a textures folder). **Export** writes it into `exports/`:
137
+ the first click asks for a format and a file there and stores that target in the graph (`"export": "glb"`, or
138
+ `{"format": "obj", "path": "parts/rotor.obj", "up_axis": "z"}`, on the graph or on an output); later clicks overwrite
139
+ the same file, the card's details give its full path, and **Export all** writes every target. MCP `export {output}`
140
+ and the CLI's `--export-all` write the same targets. Downloads and exports both carry the record of how they were
141
+ made (see below); in the Saved files and Inputs lists a sidecar or `.source.json` shows with the file it describes.
142
+ A heightfield's details have a layer picker: the terrain shows that layer (the mask by default) in red. **Inputs**
143
+ lists your files in `inputs/`, with **Add input** (or drop files anywhere on the page); the agent is told about new
144
+ ones in its next tool answer. Images open in a 2D viewer with layers and channels (generated textures default to
145
+ RGB; use A to inspect packed alpha/AO); JPEG/WebP are for viewing only. Exports always go into the package's
146
+ `exports/`: the folder of the nearest `.topo` file above the graph, from the viewer, the CLI and the agent alike (a
147
+ graph file in no package exports beside itself). For `topotopo view graph.json`, `inputs/` is beside that graph.
148
+
149
+ The **Controls** panel, at the top of the right column, holds the graph's exposed vars; **Properties** below it says
150
+ what the selection is. Above the controls, and in the status bar, the cook in progress: the node cooking and the time
151
+ so far, then the last cook's time, or the failing node and its message. **Stop** in the status bar ends a cook at the
152
+ next node (long nodes such as erosion stop between their iterations; others finish first, and the line says so); the
153
+ view keeps the last finished result. Changing a value while a cook runs starts over with the newest value. The status
154
+ bar also says what the view shows and its size; other messages appear over the view and clear themselves. **edge
155
+ check** in the top bar draws open, non-manifold and flipped edges as the render tool does.
156
+ **Guides** lay a scene out by hand where sliders are not enough: the **guides** tools in the top bar (or Shift+1–4)
157
+ place nulls, draw curves and areas and drag volumes, on your reference layers or the ground. In select mode, drag a
158
+ guide to move it and a point (a CV, a null, a volume's corner) to move that point; double-click a curve's line to add
159
+ a CV and a CV to remove it; every change is one undo step. Guides are saved as `inputs/markers.json`, curves and areas
160
+ as polylines and nulls as points, each with its `name` and `role`, and a graph reads them like any input
161
+ (`{"type": "file", "params": {"path": "inputs/markers.json", "missing": "empty"}}`, which cooks before the first guide
162
+ exists). The scene cooks again after a guide edit, and an agent reads the same file. Try it on the example village:
163
+ `topotopo edit examples/guided_town`. There, curves named `road…` become roads with lamp posts, `fence…` fences, areas
164
+ named `house…` houses on that footprint, `forest…` woods; volumes clear the woods, and nulls named `bench…`, `lamp…`
165
+ or `tree…` place one.
166
+
167
+ ![guides: before and after](docs/guides-before-after.png)
168
+
169
+ With `topotopo view graph.json` the graph file stays as you wrote it: the values you tune are kept by the viewer,
170
+ through exports, output switches and saves of the file (a value goes back to the file's only when its declaration in
171
+ `params` changes or the var is removed). A mark shows each value that differs from the file; ↺ takes one back,
172
+ **Reset all** takes all of them back, and **Save values** writes them into the file's `vars`. The viewer's writes to
173
+ the file (saved values, export targets) change only those values: formatting, key order and number spellings stay.
128
174
 
129
175
  The default **TopoTopo** keymap uses right-drag orbit around the surface beneath the cursor, middle-drag pan and
130
176
  wheel zoom toward the cursor. F/A frame, 1–4 select cameras, 5–7 change shading, O toggles orthographic and Space
@@ -134,20 +180,20 @@ toggles quad view. Maya, Houdini and Blender presets, including previously saved
134
180
  chunks on a pool of worker threads, and independent graph branches cook concurrently. The output is the same bit for
135
181
  bit with or without it. `TOPOTOPO_WORKERS` sets the number of threads (default: CPU threads − 1; `0` turns the pool
136
182
  off). Threads start on first use and stop after 30 s idle (`TOPOTOPO_WORKERS_IDLE_MS`); small inputs stay on the main
137
- thread. Details in [docs/DESIGN.md](docs/DESIGN.md#worker-pool).
183
+ thread.
138
184
 
139
185
  ### Connect to Claude Code
140
186
  With the package, the server is the `mcp` subcommand of the `topotopo` command:
141
187
 
142
188
  ```bash
143
- claude mcp add topotopo -- npx -y topotopo mcp --workspace /absolute/path/to/workspace
189
+ claude mcp add topotopo -- npx -y topotopo mcp --package /absolute/path/to/package
144
190
  ```
145
191
 
146
192
  From a clone, the repository includes [.mcp.json](.mcp.json) (it runs `node src/mcp/server.ts`), so opening a Claude
147
193
  Code session in this folder offers the `topotopo` server. To register a clone from anywhere, use an absolute path:
148
194
 
149
195
  ```bash
150
- claude mcp add topotopo -- node /absolute/path/to/topotopo/src/mcp/server.ts --workspace /absolute/path/to/topotopo/workspace
196
+ claude mcp add topotopo -- node /absolute/path/to/topotopo/src/mcp/server.ts --package /absolute/path/to/topotopo/package
151
197
  ```
152
198
 
153
199
  ### Other MCP clients (Claude Desktop, …)
@@ -157,40 +203,48 @@ With the package:
157
203
  "mcpServers": {
158
204
  "topotopo": {
159
205
  "command": "npx",
160
- "args": ["-y", "topotopo", "mcp", "--workspace", "C:/path/to/workspace"]
206
+ "args": ["-y", "topotopo", "mcp", "--package", "C:/path/to/package"]
161
207
  }
162
208
  }
163
209
  }
164
210
  ```
165
211
  From a clone, run the sources instead: `"command": "node"`, `"args": ["C:/path/to/topotopo/src/mcp/server.ts",
166
- "--workspace", "C:/path/to/topotopo/workspace"]` (`node src/cli.ts mcp …` is the same server).
212
+ "--package", "C:/path/to/topotopo/package"]` (`node src/cli.ts mcp …` is the same server).
167
213
 
168
- Options: `--viewer` (start the live preview immediately), or set `TOPOTOPO_PORT`, `TOPOTOPO_WORKSPACE`,
214
+ Options: `--viewer` (start the live preview immediately), or set `TOPOTOPO_PORT`, `TOPOTOPO_PACKAGE`,
169
215
  `TOPOTOPO_SCRIPT_TIMEOUT_MS`, `TOPOTOPO_SIM_TIMEOUT_MS` and `TOPOTOPO_WORKERS`. The server exits when the client closes its stdin.
170
216
 
171
- The workspace folder holds `graphs/` (one JSON file per graph), `assets/` (saved assets), `inputs/` and `exports/`.
217
+ The package folder holds `graphs/` (one JSON file per graph), `assets/` (saved assets), `inputs/` and `exports/`.
172
218
  `inputs/` is where you put your own material: meshes, guide curves and points, blockouts and PNG masks from Blender,
173
219
  Houdini or Unreal (glTF, OBJ, STL, PLY, .geo, CSV, PNG). The agent's `inputs` tool lists and describes them, and a
174
220
  `file` node reads one as `inputs/<file>` (a PNG as an image for the texture nodes). Naming objects `path.river`, `zone.park`, `site.well`, `volume.no_trees` or
175
221
  `blockout.house` tells the agent what they mean (help topic `inputs`).
176
222
 
223
+ When the server starts, it makes its folder a package (an `<id>.topo` and a starter `graphs/main.json`, so that its
224
+ graphs can use packages, TopoTopo's own among them) if the folder is in no package and holds nothing but these four
225
+ folders, or nothing at all, as a new one does; the default folder, `<cwd>/topotopo`, takes the name of the
226
+ folder it is in. A folder with anything else in it, such as a repository or a folder of your own files, stays as it is
227
+ until you say so: `workspace {action: "init"}` (or `topotopo init <folder>`) makes it a package. A folder inside a package
228
+ works in that package's folder. The first reply the agent gets says which of these happened.
229
+
177
230
  ## MCP tools
178
231
 
179
232
  | tool | purpose |
180
233
  |---|---|
181
- | `catalog` | node types by category (filter/search) |
182
- | `help` | exact node docs (params, defaults, ranges, aliases, examples) and topics: graph, inputs, expressions, time, wrangle, groups, attributes, sdf, heightfield, textures, loops, instancing, rbd, pcg, curves, particles, assets, uv, render, export, verify, cloth, recipes |
234
+ | `catalog` | node types by category (filter/search), with the outputs of the packages the open package uses and of TopoTopo's own packages |
235
+ | `help` | exact node docs (params, defaults, ranges, aliases, examples) and topics: graph, inputs, expressions, time, wrangle, groups, attributes, sdf, heightfield, textures, loops, instancing, rbd, pcg, curves, particles, assets, packages, uv, render, export, verify, cloth, workspace, recipes; a package output's params, inputs, version and note, also one search found that the package does not use yet |
183
236
  | `build` | create/replace a graph and cook it; `dry_run`, `mode: "merge"`, optional `render`, `frame` (also on edit, inspect, render, export); `params` declare the vars a person tunes (type, desc, min, max, options, label, step), shown as controls in the viewer |
184
237
  | `edit` | incremental ops: set, add, insert-after, remove (auto-rewire), connect, rename, replace, output, vars, bypass |
185
- | `inputs` | `list` the files in the workspace `inputs/` folder (kind, size, date, counts, bbox, object names; PNG size and bit depth) and `describe` one: polygons vs open polylines vs loose points vs packed prims, bbox, attributes, groups, every `name` / `role` value, materials |
186
- | `inspect` | summary, attribute stats, topology health (watertight, pieces, volume, genus), element listings, images (size and per-layer ranges) |
187
- | `render` | PNG with persp/front/right/top views, `turntable`, a `uv` view (`quad_uv`), uv checker, a `texture` view of images and `textures: true` for base colour maps on meshes, colour by attribute (+ `legend`), group highlight, flipped normals in blue; opt-in overlays: `section` view and `clip` plane with filled caps, edge overlays (`wireframe` all / hard / boundary / groups), `glyphs` (N, up, orient, v), group / piece / attribute labels and point / prim numbers, `shading` flat / matcap / ao, `scale: 2`, `view_labels: false` (no view labels or axis gizmo, as in the shelf thumbnails); a footer line names what is shown (help topic `render`) |
188
- | `export` | glb / gltf / obj / usda / ply / stl / json / geo / csv / points.json (packed instances: instance rows + meshes sidecar + one GLB per source); heightfields: png16 / r16 (+ JSON sidecar with the Unreal import numbers) / mask_png / unreal_landscape (a directory bundle); images: textures (one PNG per image; glb/gltf embed and usda writes the textures materials use) |
189
- | `graphs` | list / get / delete / rename / duplicate workspace graphs (stored as JSON in `workspace/graphs`) |
190
- | `assets` | save a graph with vars as a reusable node type (like an HDA); list / get / delete; `fork` copies a shelf asset into the workspace to edit |
238
+ | `inputs` | `list` the files in the package `inputs/` folder (kind, size, date, counts, bbox, object names; PNG size and bit depth) and `describe` one: polygons vs open polylines vs loose points vs packed prims, bbox, attributes, groups, every `name` / `role` value, materials |
239
+ | `inspect` | one-screen summary (counts, triangles, bbox to the millimetre, parts, materials, images, uv state, open edges), `detail: "budget"` (triangles per part, per LOD and per node), `detail: "scene"` (the glb export read back: nodes, sockets, parents, meshes, materials, images), attribute stats, topology health (a closed solid or why not: open edges counted after welding uv/normal seam splits, non-manifold edges, flipped faces, inward pieces, degenerate faces, each with the part and world position of the first one and the fix; pieces, volume, genus, render/export triangle slivers), element listings, images (size and per-layer ranges), `detail: "uv"` (exact uv overlaps split into in-tile, tiling and across-LOD overlap with parts and positions, collapsed and out-of-tile triangles, charts, utilization, per-piece texel density; `json: true`) |
240
+ | `render` | PNG with persp/front/right/top views (every 3D view fits the bounds; `zoom` is relative to that fit), three-quarter views (`front_left`, `back_right`, …), `size: "1600x600"` for wide views, `transparent` background, `grid: false`, a reference image behind the views (`underlay`, `underlay_opacity`, `underlay_fit`), scene empties as labelled dots (`sockets`), `turntable`, a `uv` view (`quad_uv`), uv checker, a `texture` view of images and `textures: true` for base colour maps on meshes, colour by attribute (+ `legend`), group highlight, flipped normals in blue; opt-in overlays: `section` view and `clip` plane with filled caps, edge overlays (`wireframe` all / hard / boundary / groups), `glyphs` (N, up, orient, v), group / piece / attribute labels and point / prim numbers, `shading` flat / matcap / ao, `shading: "pbr"` (the exported metallic-roughness material with its base colour, normal, orm and roughness maps under a fixed studio rig; deterministic, `exposure` in stops), `scale: 2`, `view_labels: false` (no view labels or axis gizmo, as in the built-in packages' thumbnails), `heightfield_res` (heightfield quads drawn per side, default 256, or `"full"`), `heightfield_layer` (the heightfield layer drawn in red, default the mask, or `"none"`); a footer line names what is shown (help topic `render`) |
241
+ | `export` | glb / gltf / obj / usda / ply / stl / json / geo / csv / points.json (packed instances: instance rows + meshes sidecar + one GLB per source); heightfields: png16 / r16 (+ JSON sidecar with the Unreal import numbers) / mask_png / unreal_landscape (a directory bundle); images: textures (one PNG per image; glb/gltf embed and usda writes the textures materials use); every export records its source (graph, vars, seeds, frame, version) to be made again |
242
+ | `graphs` | list / get / delete / rename / duplicate package graphs (stored as JSON in the package's `graphs/`) |
243
+ | `assets` | save a graph with vars as a reusable node type (like an HDA); list / get / delete; `fork` copies a package output's graph (TopoTopo's own included) into the package's assets to edit |
191
244
  | `explain` | describe a node's geometry in words: "reads as" summary, pieces, watertight, genus, flipped normals, symmetry planes, principal axis, wall thickness, degenerate faces, attributes, groups |
192
- | `diff` | compare two graphs, nodes or frames: counts, bbox delta, attribute/group changes, Hausdorff and mean distance, verdict; `render: true` adds an overlay (grey same, blue only b, orange only a) |
245
+ | `diff` | compare two graphs, nodes or frames: counts, bbox delta, attribute/group changes, heightfields, images and SDF grids, Hausdorff and mean distance, verdict; `render: true` adds an overlay (grey same, blue only b, orange only a) |
193
246
  | `preview` | start the live viewer and return its URL |
247
+ | `workspace` | the workspace around the open package: `show` it, list or unlist its shared libraries with `libraries` (when the person names one), or make a folder one with `init_workspace`; the person's registered workspaces and libraries (the web app): `list` / `get` (with thumbnail) / `create` / `set` / `bake`, and `open`, which makes a package the folder every tool and the viewer work in, or `init`, which makes the server's folder a package; the packages the open package uses: `packages` (one line each; with `package`, one package's outputs), `search` (the outputs of every place the package looks in by words, kind and tag, and whether the package can use them), `use`, `remove`, `follow` (a package's working folder for the session), `publish` (with `dry_run: true` a dry run, which the agent shows the person before publishing), `outdated` (the newer versions and their notes) and `update` (a before/after with overlay renders, applied with the versions it showed when the person says so) |
194
248
 
195
249
  ## Graph format
196
250
 
@@ -216,13 +270,20 @@ graph: `npoints('pts')`, `nprims`, `nvertices`, `bbox('base').size.y` (also `min
216
270
  `detail('n', 'attr')`, `point('n', i, 'P')`, `prim('n', i, 'attr')` and `ch('box1/size')` for another node's param.
217
271
  Referenced nodes become dependencies: they are cooked first, editing them re-cooks the reader, and unknown names or
218
272
  cycles are reported before cooking. Node names must be string literals; these functions are not available in `vars`.
219
- Expressions run in a sandbox that sees only these names, `Math` and the helpers listed by `help {topic: "expressions"}`.
273
+ Expressions run in a sandbox that sees only these names, `Math`, the conversions (`Number`, `parseFloat`, `parseInt`,
274
+ `String`, `Boolean`, `isFinite`, `isNaN`) and the helpers listed by `help {topic: "expressions"}`.
275
+
276
+ Code reads graph vars the same way, by their bare name: `wrangle`, `script`, `sdf_expr`, `heightfield_layer`, the
277
+ parametric nodes and the expressions of `group` and `assert` (`@P.y += height`, not `vars.height`). Vars are read-only,
278
+ and a node re-cooks when a var its code names changes. A var's name must be one code can read: not a JavaScript
279
+ keyword, a helper (`noise`, `rand`, `length` …), a built-in or the time (`frame`, `time`); validation names the clash.
220
280
 
221
- Group patterns look like `top`, `!top`, `0-10` or `@P.y>0.5`. A wrangle snippet looks like this:
281
+ Group patterns look like `top`, `!top`, `0-10` or `@P.y>0.5`. A wrangle snippet looks like this (`amplitude` and `seed`
282
+ are graph vars):
222
283
 
223
284
  ```js
224
- @P.y += noise(mul(@P, 2)) * 0.1;
225
- @Cd = hsv2rgb(rand(@ptnum), 0.6, 1);
285
+ @P.y += noise(mul(@P, 2)) * amplitude;
286
+ @Cd = hsv2rgb(rand(@ptnum, seed), 0.6, 1);
226
287
  if (@P.y < 0) removepoint(0, @ptnum);
227
288
  ```
228
289
 
@@ -243,28 +304,32 @@ boundary. Do not cook graphs from untrusted sources in a privileged process.
243
304
 
244
305
  ## Node types
245
306
 
307
+ Image cutouts and atlases: [workflow guide](docs/image-cutouts.md), [example graph](examples/image_cutouts.json).
308
+ Four general nodes crop images, trace masks, extend edge pixels and pack aligned maps. Material alpha masking
309
+ is preserved in GLB and shown in the live and headless previews.
310
+
246
311
  | category | nodes |
247
312
  |---|---|
248
- | generate | `box` `grid` `sphere` `tube` `torus` `platonic` `points` `point_grid` `parametric_surface` `terrain` `lsystem` `text` |
249
- | curve | `parametric_curve` `line` `circle` `curve` `spiral` `shape2d` `resample` `carve` `ends` `sweep` `polywire` `revolve` `extrude` `offset_curve` `boolean2d` `fill` `loft` `voronoi2d` `triangulate2d` `bezier` `nurbs` (Bezier/NURBS curve prims, evaluated exactly wherever they are used) `convert_curve` `spline_fit` `fillet_curve` `offset_curve_3d` `project_curve` `curve_attribs` `straight_skeleton` (skeleton, polygon offset, pitched roof) |
313
+ | generate | `box` `grid` `sphere` `tube` `torus` `platonic` `points` `point_grid` `parametric_surface` `terrain` `lsystem` `text` `beam` (beams between points or along curve segments, any profile) |
314
+ | curve | image contours `trace_image`; `parametric_curve` `line` `circle` `curve` `spiral` `shape2d` `resample` `carve` `ends` `sweep` `polywire` `revolve` `extrude` `offset_curve` `boolean2d` `fill` `loft` `voronoi2d` `triangulate2d` `bezier` `nurbs` (Bezier/NURBS curve prims, evaluated exactly wherever they are used) `convert_curve` `spline_fit` `fillet_curve` `offset_curve_3d` `project_curve` `curve_attribs` `straight_skeleton` (skeleton, polygon offset, pitched roof) |
250
315
  | transform | `transform` `match_size` `mirror` |
251
316
  | deform | `noise_displace` `twist` `bend` `taper` `smooth` `peak` `jitter` `ray` `soft_transform` `lattice` `path_deform` `point_deform` `rest` |
252
- | attribute | `attrib_create` `attrib_randomize` `attrib_promote` `attrib_delete` `attrib_rename` `attrib_copy` `attrib_transfer` `attrib_array` `attrib_noise` `color` `material` `measure` `connectivity` (float/int tuples, strings, and float[]/int[]/string[] array attributes) |
317
+ | attribute | `attrib_create` `attrib_randomize` `attrib_promote` `attrib_delete` `attrib_rename` `attrib_copy` `attrib_transfer` `attrib_array` `attrib_noise` `attrib_string` (names from a pattern, find/replace, case) `color` `material` `measure` `connectivity` (float/int tuples, strings, and float[]/int[]/string[] array attributes) |
253
318
  | measure | `curvature` `occlusion` (ambient occlusion, cavity, thickness) `distance` `assert` (in-graph checks: watertight, counts, bbox, edge length, degenerate, self-intersections, attributes, groups, expression) |
254
319
  | group | `group` `delete` `group_promote` `group_expand` `group_combine` `group_delete` `group_rename` (point, vertex, prim and edge groups) |
255
- | topology | `sort` `normal` `fuse` `clean` `reverse` `facet` `triangulate` `subdivide` `poly_extrude` `poly_bevel` `grid_split` `fill_holes` `bound` `decimate` `remesh` (voxel) `remesh_isotropic` `remesh_quad` (field-aligned, quad-dominant) `mesh_repair` `lod` `knife` `polysplit` `edge_divide` `dissolve` `edge_collapse` `polybridge` `polyfill` |
320
+ | topology | `sort` `normal` `fuse` `clean` `reverse` `facet` `triangulate` `subdivide` `poly_extrude` `solidify` (constant-thickness shell, mitred folds, rims; invalid results are errors) `poly_bevel` `grid_split` `fill_holes` `bound` `decimate` `remesh` (voxel) `remesh_isotropic` `remesh_quad` (field-aligned, quad-dominant) `mesh_repair` `lod` `knife` `polysplit` `edge_divide` `dissolve` `edge_collapse` `polybridge` `polyfill` `remove_interior` (faces buried inside other parts) |
256
321
  | copy | `copy_xform` `scatter` (count or density per m², density attribute + 0..1 mask, blue noise, relaxation, exact min distance, per-prim cap) `copy_to_points` (real copies or packed instances; variants by attribute or weights) `pack` `unpack` |
257
322
  | pcg | `mask` (slope, height, curvature, occlusion, distance, direction, noise, attribute, group, inside; combine) `attribute_from_map` (PNG → attribute by uv or planar projection) `orient` (orient/N/up from normals, a surface, curve tangents, a direction or target; random yaw, tilt, scale) `points_along_curve` `cluster` (k-means, radius) `prune` (overlap, density, expression, near geometry) |
258
323
  | solid | `convex_hull` `boolean` `clip` `minkowski` `smooth_solid` `voronoi_fracture` `slice` |
259
324
  | sdf | `sdf_shape` `sdf_expr` `sdf_combine` `sdf_modify` `sdf_from_mesh` `sdf_to_mesh` (implicit, lazily sampled); sampled grids (Rust/WASM): `sdf_grid` `grid_combine` `grid_offset` `grid_blur` `grid_dilate` `grid_erode` `grid_resample` `grid_to_mesh` (sharp dual contouring or marching cubes) `grid_to_sdf` `voxel_remesh` |
260
- | heightfield | `heightfield` `heightfield_noise` `heightfield_from_mesh` `heightfield_from_image` `heightfield_to_mesh` `heightfield_to_sdf` `heightfield_remap` `heightfield_blur` `heightfield_terrace` `heightfield_clip` `heightfield_cutout` `heightfield_layer` `heightfield_mask_by_feature` `heightfield_mask_by_object` `heightfield_mask_noise` `heightfield_mask_blur` `heightfield_mask_expand` `heightfield_erode` `heightfield_fill_sinks` `heightfield_flow` `heightfield_project` `heightfield_path` `heightfield_scatter` `heightfield_resample` `heightfield_transform` (grids in XZ with named layers; export `png16`/`r16`/`mask_png` for Unreal Landscape) |
325
+ | heightfield | `heightfield` `heightfield_noise` `heightfield_from_mesh` `heightfield_from_image` `heightfield_to_mesh` `heightfield_to_sdf` `heightfield_remap` `heightfield_blur` `heightfield_terrace` `heightfield_clip` `heightfield_cutout` `heightfield_layer` `heightfield_mask_by_feature` `heightfield_mask_by_object` `heightfield_mask_noise` `heightfield_mask_blur` `heightfield_mask_expand` `heightfield_erode` `heightfield_fill_sinks` `heightfield_flow` `heightfield_project` `heightfield_path` `heightfield_scatter` `heightfield_resample` `heightfield_transform` `heightfield_crop` (grids in XZ with named layers; tiles cropped from a map match it; export `png16`/`r16`/`mask_png` for Unreal Landscape) |
261
326
  | uv | `uv_project` `uv_transform` `uv_unwrap` (xatlas) `uv_flatten` (LSCM) `uv_layout` `uv_autoseam` |
262
- | texture | generators `tex_noise` `tex_pattern` `tex_cells` `tex_gradient` `tex_shape` `tex_splatter` `tex_scratches` `tex_text`; PNG files `image_file`; filters `tex_blend` `tex_levels` `tex_curves` `tex_blur` `tex_warp` `tex_transform` `tex_edge_detect` `tex_invert` `tex_threshold` `tex_histogram_scan` `tex_normal_from_height` `tex_height_to_ao` `tex_channel` (ORM packing) `tex_colorize` `tex_tile_sampler` `tex_output`; bakes in uv space `bake_ao` `bake_curvature` `bake_thickness` `bake_position` `bake_normal` `bake_world_normal` `bake_height` `bake_island_id` `bake_mask` `bake_vertex_color`; `texture_to_material` `tex_to_heightfield` `heightfield_to_tex` (images are 2D float layers carried on the geometry; glb/usda embed them, export format `textures` writes PNGs) |
327
+ | texture | generators `tex_noise` `tex_pattern` `tex_cells` (with crystal facets) `tex_gradient` `tex_constant` `tex_shape` `tex_sdf_shape` (signed distance in metres) `tex_grunge` (dirt, leaks, spots) `tex_splatter` `tex_scratches` `tex_text`; PNG files `image_file`; filters `tex_blend` `tex_levels` `tex_curves` `tex_blur` `tex_directional_blur` `tex_slope_blur` `tex_warp` (directional, slope, vector, non-uniform, multi-directional) `tex_transform` `tex_make_tile` `tex_edge_detect` (Sobel, or lines of a width in metres along an outline) `tex_invert` `tex_threshold` `tex_clamp` `tex_quantize` `tex_auto_levels` `tex_histogram_scan` `tex_histogram_range` `tex_histogram_select` `tex_normal_from_height` (relief in metres) `tex_normal_blend` (reoriented normal blending) `tex_normal_normalize` `tex_normal_invert` `tex_height_from_normal` `tex_curvature` `tex_ao` (ground-truth AO in metres) `tex_height_to_ao` `tex_channel` (ORM packing) `tex_colorize` `tex_tile_sampler` (scale, rotation and intensity maps, several stamps, id and colour outputs) `tex_output`; shapes and regions in metres `tex_sdf_from_mask` `tex_sdf_op` (offset, round, stroke) `tex_sdf_boolean` `tex_sdf_to_mask` `tex_bevel` `tex_distance` `tex_flood_fill`; cutouts and atlases `tex_crop` `tex_dilate` `tex_pack`; bakes in uv space `bake_ao` `bake_curvature` `bake_thickness` `bake_position` `bake_normal` `bake_world_normal` `bake_height` `bake_island_id` `bake_mask` `bake_vertex_color`; `texture_to_material` `tex_to_heightfield` `heightfield_to_tex` (images are 2D float layers carried on the geometry, each named after the node that made it; glb/usda embed them, export format `textures` writes PNGs) |
263
328
  | sim | `particles` (Houdini POPs in one node: emission from points, gravity, drag, wind, curl noise, point/heightfield/SDF fields, attraction, floor and mesh collisions with die/slide/bounce, trails as polylines; steps with the frame, each frame's state cached; bit-identical on the worker pool) `rbd_settle` (drop pieces onto a terrain, container or ground until they rest; Rapier rigid bodies, packed instances stay packed) `rbd_stack` (drop them one at a time into piles) `drape` (XPBD cloth: colliders, floor, pins, wind, self collision) `inflate` (pressure: cushions, balloons) |
264
329
  | code | `wrangle` `script` |
265
330
  | flow | `merge` `switch` `null` `input` `foreach` `solver` `graph_ref` (plus saved assets) |
266
- | io | `file` (obj, stl, ply, glb/gltf, geo/bgeo, csv, points.json, json) |
267
- | shelf | graph assets used like nodes, e.g. `stairs` `railing` `roof_skeleton` `house` `crate` `tree_lowpoly` `forest_patch`; every asset is listed with its thumbnail under [Shelf](#shelf) |
331
+ | io | `file` (obj, stl, ply, glb/gltf, geo/bgeo, csv, points.json, json), `scene_null` (named scene empty / attachment socket: a meshless glTF node under the root, an empty or a mesh) |
332
+ | package | the outputs of packages by full name, TopoTopo's own among them: `topotopo/architecture/stairs` `topotopo/architecture/house` `topotopo/architecture/roof_skeleton` `topotopo/props/crate` `topotopo/nature/tree_lowpoly` `topotopo/nature/forest_patch` `topotopo/street/road_strip` …; every one is listed with its thumbnail under [TopoTopo's own packages](#topotopos-own-packages) |
268
333
 
269
334
  Every node's inputs, parameters (types, defaults, ranges, options, aliases) and outputs are listed in the generated
270
335
  [node reference](docs/nodes.md).
@@ -282,19 +347,26 @@ heightfield with a road and rocks on its steep slopes. `unreal_demo` is the Unre
282
347
  Unreal Landscape exactly, weight layers, a road, and packed trees and rocks with variants and materials; `npm run export:demo` writes its file set
283
348
  (landscape bundle, `scene.glb`, `scene.usda`, `scene.geo`, `instances.csv` with meshes) to `out/unreal_demo/`.
284
349
  `splines` shows the curve toolkit: a NURBS road projected onto bumpy ground, a boardwalk with filleted corners and
285
- offset handrails, and a Bezier letter extruded. `shelf_street` is a street block built only from shelf assets (see
286
- [Shelf](#shelf)). `textures` is a brick wall material made only from texture nodes and the shelf crate with baked AO and
287
- curvature turned into worn paint on its edges and an ORM map, rendered with `textures: true` next to the texture view.
288
- `house_city` spawns the `house` shelf asset on a grid of lots with per-lot parameters, and `skeleton_roofs` shows
350
+ offset handrails, and a Bezier letter extruded. `street_block` is a street block built only from TopoTopo's own packages
351
+ (see [TopoTopo's own packages](#topotopos-own-packages)). `textures` is a brick wall material made only from texture
352
+ nodes and the props package's crate with baked AO and curvature turned into worn paint on its edges and an ORM map,
353
+ rendered with `textures: true` next to the texture view. `texture_lab` is worn painted metal from texture nodes only:
354
+ SDF plates and rivets, edge wear from curvature, chipped by grunge and slope blur, brushed steel under the paint, a paint
355
+ tint per plate from flood fill, rust running from the rivets, AO and an ORM map.
356
+ `guided_town` ([examples/guided_town](examples/guided_town), a package of its own) is a village laid out with the
357
+ viewer's guides: a road, house footprints, a fence, woods and a clearing in its `inputs/markers.json`, built from
358
+ TopoTopo's own packages; open it with `topotopo edit examples/guided_town` and drag them.
359
+ `house_city` spawns the architecture package's `house` on a grid of lots with per-lot parameters, and `skeleton_roofs` shows
289
360
  straight-skeleton roofs (an L-shaped house, a courtyard roof around a hole, nested offsets). `deformers` (lattice,
290
361
  path_deform, soft_transform), `measures` (curvature, occlusion, distance, assert) and `remesh_lod` (isotropic remesh,
291
362
  repair, LOD levels) cover their node families; `voxel_remesh` compares sharp dual contouring with marching cubes on a
292
363
  sampled SDF grid, `quad_remesh` shows field-aligned quads on a noisy sphere, a bevelled box, a rock and a tube, and
293
364
  `erosion_models` erodes one ridged terrain four ways (TypeScript and WASM droplets, virtual pipes, pipes plus stream
294
- power). `particles` runs particles down an eroded massif from emitters on its ridges (the heightfield as gradient field and
365
+ power), and `terrain_tiles` bends escarpments and a river with domain-warped noise, with one tile of the map cooked on
366
+ its own (`heightfield_crop`) floating above the area it matches. `particles` runs particles down an eroded massif from emitters on its ridges (the heightfield as gradient field and
295
367
  collision surface, curl noise, sliding contacts; trails coloured by age) next to a fountain bouncing on a plane.
296
- `rbd_settle` drops shelf rocks onto the rocks_on_terrain landscape until they rest (rigid bodies) and piles
297
- crates on a pad with `rbd_stack`. `drape` is the cloth family: a tarp draped over a stack of shelf crates, a
368
+ `rbd_settle` drops the nature package's rocks onto the rocks_on_terrain landscape until they rest (rigid bodies) and piles
369
+ crates on a pad with `rbd_stack`. `drape` is the cloth family: a tarp draped over a stack of the props package's crates, a
298
370
  banner pinned between two poles in the wind, and a box inflated into a cushion.
299
371
 
300
372
  To cook a graph from the command line:
@@ -302,12 +374,38 @@ To cook a graph from the command line:
302
374
  ```bash
303
375
  node src/cli.ts examples/tree.json --render out/tree.png --export out/tree.glb
304
376
  node src/cli.ts examples/csg_bracket.json --render out/bracket.png --section x:0.3 --wireframe hard --labels groups --shading matcap
377
+ node src/cli.ts examples/csg_bracket.json --views front --size 1600x700 --underlay ref.png --render out/compare.png # a reference image behind the view
378
+ node src/cli.ts examples/street_block.json --inspect budget # triangles per part, per LOD and per node
379
+ node src/cli.ts examples/street_block.json --inspect scene # what the glb export holds: nodes, sockets, materials, images
305
380
  node src/cli.ts examples/terrain_erosion.json --node road --export out/terrain.png # 16-bit heightmap + terrain.json (Unreal)
306
381
  node src/cli.ts examples/unreal_demo.json --node landscape --format unreal_landscape --export out/level # Landscape bundle
307
382
  node src/cli.ts examples/forest.json --node forest --export out/trees.csv --pcg # instance rows + trees.meshes.json + trees_meshes/*.glb
383
+ node src/cli.ts examples/rocks_on_terrain.json --var seed=11 --var rock_count=300 --render out/rocks.png # vars for one run
308
384
  node src/cli.ts view examples/unreal_demo.json # live viewer at http://127.0.0.1:7341: node list, per-node geometry, re-cook on save
385
+ node src/cli.ts --help-topic export # a help topic; --catalog ends with the list
309
386
  ```
310
387
 
388
+ `--var name=value` sets a graph var for one run without editing the file (repeat it; numbers, `true`/`false` and JSON
389
+ values are parsed, other text is a string; an unknown name lists the graph's vars). `--output <name>` renders, exports
390
+ and inspects a named output (the graph's `"outputs"`) instead of the default one; `--output` naming a node (or `--node`
391
+ naming an output) says which flag to use. Relative paths inside a graph (file nodes, texture maps) read from its package
392
+ folder: the nearest folder with a `.topo` file at or above the graph file, else the graph file's folder (the MCP server
393
+ and the viewer use the same rule), and `--export-all` writes into that folder's `exports/`. Several `--render` flags
394
+ share one cook: the options after a `--render` apply to that render, those before the first to every render (a warning
395
+ names options left after the last of several). Renders draw heightfields at up to
396
+ 256 quads per side, so a 513 × 513 field shows at 257 × 257 and the footer says so; `--heightfield-res full` draws
397
+ every sample. They show the mask layer in red; `--heightfield-layer flow` shows another layer (`none`: none).
398
+
399
+ Every export records how it was made in a `source` block: the graph's name and the SHA-256 of its JSON as cooked, the
400
+ output and node, frame and fps, every var after overrides, the seeds the graph sets, the format and options, and the
401
+ TopoTopo version; the options are every one the format reads, the defaults included, so a later default change does not
402
+ change what a record replays. Heightmaps (`png16`, `r16`) keep it in their `.json` sidecar, instance rows in `<name>.meshes.json`
403
+ and the Unreal Landscape bundle in `landscape.json`; every other export writes `<file>.source.json` next to the file (a
404
+ `textures` folder gets `source.json` inside it), and glTF also carries it in `asset.extras.source`. The same graph,
405
+ values and options give the same bytes, so the manifest is enough to make the export again: pass its output
406
+ (`--output`) or node (`--node`), `--frame`, `--fps`, one `--var name=<value as JSON>` per var, `--format` and every
407
+ option as its flag (`--up-axis z`, `--custom-attribs` / `--no-custom-attribs`, `--layers a,b`; help topic `export`).
408
+
311
409
  Animated graphs cook at a frame (`--frame 40`) or over a range. With `--frames`, output paths may contain `{frame}` or
312
410
  `{frame:04}`; without a pattern, `.0001`-style frame numbers are inserted before the extension:
313
411
 
@@ -325,56 +423,309 @@ Landscape heightmap. Generate the sample with `npm run export:demo`; the plugin
325
423
  the two-node PCG graph, coordinates, automation tests and editor verification steps. It is separate from the npm
326
424
  package; copy it into your Unreal project's `Plugins/` directory.
327
425
 
328
- ## Shelf
426
+ ## Godot 4.7
329
427
 
330
- [shelf/](shelf) holds ready-made graph assets (TopoTopo's answer to a shelf of HDAs): walls with windows and doors,
331
- whole houses, roofs (gable, hip, and straight-skeleton roofs for any footprint), stairs, railings and fences, bricks and
332
- tiles, props, trees and rocks, and PCG helpers that dress a road or a terrain. The engine registers them on startup as
333
- node types of category `shelf`, so a graph uses one like any node:
428
+ A package inside a Godot project imports into it as `<id>.topo`: each published output becomes a plain GLB that Godot
429
+ imports itself (sockets as `Node3D`, LOD pieces as sibling meshes, packed instances as `MultiMeshInstance3D`), and a
430
+ textures output becomes PNGs. Levels place and load the GLBs; their Advanced Import Settings survive every recook.
431
+ Only outputs whose sources changed cook again, only files whose bytes changed are written, and a failed output keeps
432
+ its last good GLB. The GLBs, their `.import` files and the record `<package>/.topotopo/godot.json` are committed, so a
433
+ teammate or build machine without TopoTopo still builds the game.
434
+
435
+ ```text
436
+ topotopo godot setup <godot project folder> [--no-enable]
437
+ topotopo godot status <godot project folder> [--strict] [--json]
438
+ topotopo cook <.topo | package folder | folder>... --for godot [--into <folder>] [--flat] [--skip a,b] [--instancing packed|expand] [--adopt] [--force] [--no-cache] [--timeout <s>] [--report <file>] [--progress json] [--quiet]
439
+ topotopo cook --jobs <jobs.json> [--force] [--no-cache] [--progress json]
440
+ ```
441
+
442
+ `godot setup` copies the plugin into `addons/topotopo/`, records where TopoTopo is, hides each package's TopoTopo
443
+ folders from Godot (`.gdignore`), enables the plugin, adds the cook's files to `.gitignore` and keeps the addon out of
444
+ every export preset. `godot status --strict` exits 1 when a package is stale, failed, never cooked or exposes its
445
+ folders: run it in CI after `godot --headless --import`. `topotopo cook --for godot` writes exactly what the plugin
446
+ writes (options from `<id>.topo.import`, flags override them). Exit codes: 0 ok, 1 an output or package failed, 2 a
447
+ usage or setup error. `--help-topic godot` has the details; the plugin's contract is
448
+ [integrations/godot/PROTOCOL.md](integrations/godot/PROTOCOL.md).
449
+
450
+ In the editor, the plugin ([integrations/godot/addons/topotopo](integrations/godot/addons/topotopo/README.md)) cooks
451
+ in the background while you work: save a graph in TopoTopo's viewer (right-click a `.topo` or one of its outputs:
452
+ **Open in TopoTopo**) or let an agent change it over MCP, and the changed GLBs reimport and open levels update. A
453
+ failed output shows Godot's ImportFail icon on the `.topo`, an Output line naming the node, a toast and a row in the
454
+ **TopoTopo** panel, while levels keep the last good GLB. Without TopoTopo on a machine, the committed outputs are used
455
+ and `godot --headless --path <project> --script res://addons/topotopo/tools/check.gd` checks them in CI. To try it,
456
+ set up the demo project with `topotopo godot setup integrations/godot/demo` and follow its
457
+ [README](integrations/godot/demo/README.md).
458
+
459
+ ## Web app
460
+
461
+ `topotopo web` is a file explorer of your workspaces and libraries with TopoTopo's knowledge on top, at
462
+ http://127.0.0.1:7340. Every folder is a page that mirrors the folder on disk, so you audit a game where its files are.
463
+
464
+ ```bash
465
+ topotopo workspace add D:/games/my-game
466
+ topotopo library add props D:/shared/props
467
+ topotopo web
468
+ ```
469
+
470
+ - **Front page**: each registered workspace and library as a card with a few pictures from inside and its counts of
471
+ packages, folders, files and flags; TopoTopo's built-in library last. The search finds every package by name, tag
472
+ and the packages it uses, and their outputs by name, kind and tag.
473
+ - **Folder pages** at `/w/<workspace>/<path>/` and `/l/<library>/<path>/`: the folder's flags, its notes, a card per
474
+ subfolder (with a picture and counts) and its files by type: images to view large, sounds and videos in players,
475
+ models (`.glb`, `.gltf`) in 3D on a click, the rest to open or download. The same addresses serve the files, read
476
+ only and with ranges (players seek); SVG and HTML are downloads only.
477
+ - **Notes**: every `.md` and `.txt` file in a folder is a box on its page: a `README` first, then documents, then
478
+ text files, each in file name order (`01-overview.md` first). A folder of many notes shows 24 as boxes (always those
479
+ with a flag) and lists the rest with its files; a link to one of them opens it on its folder's page. Markdown
480
+ renders (front matter as the note's properties, headings, lists, emphasis, code, quotes, tables, links, images; raw
481
+ HTML stays text). A link shows what it leads to: an image, a sound or video in a player, a model as a 3D view, a
482
+ folder or package as a card titled with the link's words, a YouTube or Vimeo address in its privacy player
483
+ (youtube-nocookie.com, player.vimeo.com, the only outside content the web app loads), a heading (`#usage`,
484
+ `other.md#setup`), anything else as a link. Alone in its paragraph the card, picture or player stands in its place;
485
+ in running text the link stays a link, marked with an icon, and the card, picture or player follows the paragraph.
486
+ Paths are read from the note's folder (`/` from the workspace's root); `res://` from the Godot project, `/Game/`
487
+ from Unreal's `Content/`. A link to a missing file is struck through. A path that leaves the tree, names a drive or
488
+ a network share (`\\host\share`) or passes hidden folders stays text and is never looked up.
489
+ - **Packages**: a folder with a `.topo` file shows its package on its page, in one piece: the baked preview in 3D
490
+ (the wheel scrolls the page until you click into it, or hold Ctrl), description, tags and links, Open in editor and
491
+ Re-bake, its published outputs, versions, the packages that use it and those it uses, its graphs and exports; then
492
+ its notes and attachments. Previews bake by themselves when graphs change; after a failed bake the last good preview
493
+ stays, marked.
494
+ - **Flags**, at the top of a page and counted on the cards of the folders above it: a link in a note to a missing
495
+ file, a preview that did not cook (with why), a package that publishes versions and has none or has changes no
496
+ version holds, an export older than its graph (its recorded source no longer matches the graph), published outputs
497
+ that no package of the workspace uses. Each says what to do. Audits run in the background and are made again for
498
+ the workspace or library that changed; a very large tree is audited in part, and its pages say where it stopped.
499
+ - **Hidden**: dot folders, `node_modules`, `topotopo-packages/`, a package's `versions/` and `packages/`, the engines'
500
+ caches (`.godot`, `Intermediate`, `Saved`, `DerivedDataCache`, `Binaries`) and the files Godot writes beside yours
501
+ (`*.import`, `*.uid`), also when reached by another name (a link, a Windows short name); Unreal's `.uasset` and
502
+ `.umap` files are one line with a count. An engine project inside a workspace is one card that opens as pages of
503
+ its own, not audited.
504
+
505
+ Each package keeps a stable address for boards and wikis: `/p/<workspace or library>/<id>` leads to its folder page,
506
+ `/p/<…>/<id>/thumb.png` is its thumbnail and `/embed/<…>/<id>` a 3D view to frame. Workspaces and libraries share one
507
+ set of names; a library inside a registered workspace shows as the workspace's folder. The web app listens on
508
+ 127.0.0.1 only and never cooks in its own process.
509
+
510
+ ## Workspaces, packages and libraries
511
+
512
+ Three words: a **workspace** is a folder tree, one production (a game, an archviz job), with `topotopo-workspace.json`
513
+ at its root; every folder in it with a `.topo` file is a **package**, and the packages of a workspace find each other
514
+ by themselves; a **library** is a shared folder of packages registered on this machine (`topotopo library add <name>
515
+ <folder>`), which a workspace lists to use it. TopoTopo's built-in library is always there.
516
+
517
+ The workspace's preferred place is inside the engine's content folder: the Godot project folder or a folder in it,
518
+ Unreal's `Content/` or a folder in it. Explorer, the engine and the web app then show one tree, and each package's
519
+ `exports/` lies inside the engine project, where the engine imports from. Plain folders group packages (a Godot project
520
+ keeps its content in `assets/`):
521
+
522
+ ```text
523
+ my-game/ the Godot project
524
+ project.godot
525
+ topotopo-workspace.json {"name": "my-game", "libraries": ["props"], "engine": {"type": "godot", "project": "project.godot"}}
526
+ topotopo-packages/ one copy of each package version the workspace uses
527
+ assets/props/lantern/ a package: lantern.topo, graphs/, inputs/, exports/, attachments/
528
+ assets/levels/yard/ a package that uses studio/rocks from the props library
529
+ ```
530
+
531
+ `topotopo workspace init` makes a folder a workspace: it finds the engine project at or above the folder, else one
532
+ below it (`--engine godot:<path>|unreal:<path>|none` names it), and says when Unreal will not see the workspace (outside
533
+ the project's `Content/` or a plugin's), which packages lie outside an engine project found below it, and which Godot
534
+ export presets would ship TopoTopo's files, with the `exclude_filter` entries to add (`*/attachments/*, */graphs/*,
535
+ */inputs/*, *.topo, */exports/*.source.json, */exports/.outputs.json`). `topotopo workspace library add props` lists a
536
+ shared library for the workspace (a registered name, or a folder outside the workspace, written as its path from the
537
+ workspace); `remove` unlists it. The tools never add a library by themselves.
538
+
539
+ Where a package finds packages: in a workspace, in the workspace itself, then in the shared libraries its file lists,
540
+ in order, then in TopoTopo's built-in library. Outside a workspace, in the library the package is in (read from the
541
+ package's own checkout, so its siblings come from the same worktree), then in every other registered library, then in
542
+ the built-in library. A name comes from the first place that has it, and the same name in a later place is not used
543
+ (`topotopo packages` and search say so). Only the built-in library has the packages named `topotopo/…`. Two folders of
544
+ one workspace or library publishing the same name leave that name out until one is renamed, and publishing blocks.
545
+
546
+ The scan that finds a workspace's packages does not enter a package (a package holds no other), and skips dot folders,
547
+ `node_modules`, `topotopo-packages`, Unreal's `Binaries`, `Intermediate`, `Saved`, `DerivedDataCache`,
548
+ `__ExternalActors__` and `__ExternalObjects__`, C#'s `bin` and `obj` beside a project file, a folder holding another
549
+ engine project, another workspace and a TopoTopo checkout.
550
+
551
+ **Godot.** Inside a Godot project TopoTopo keeps a `.gdignore` in each package's `versions/`, `packages/` and `inputs/`,
552
+ its working folders, so Godot imports none of them; `topotopo check` adds one that is missing. `attachments/`,
553
+ `exports/` and `graphs/` stay visible to the engine, until `topotopo godot setup` hides `graphs/`, `assets/` and
554
+ `exports/` too for the Godot plugin (see [Godot 4.7](#godot-47)). Files Godot writes beside ours (`*.import`, `*.uid`,
555
+ `*.translation`) never count as TopoTopo's: a package publishes the same version with or without them.
556
+
557
+ **Unreal.** Auto Reimport (Editor Preferences, Loading and Saving) watches `Content/` and imports a new or changed
558
+ source file. Keep TopoTopo's working folders out of it with these exclude wildcards: `*/versions/*`, `*/packages/*`,
559
+ `*/inputs/*`, `*/topotopo-packages/*`. The `*.uasset` files Unreal writes beside an export never count as TopoTopo's.
560
+
561
+ ## Packages
562
+
563
+ A package can use the published outputs of other packages by name, as node types: `{"type": "studio/trees/pine"}`, or
564
+ `studio/trees` for the package's default output. An output's params are the vars of its graph that its node reads, and
565
+ its inputs are that graph's input nodes. A package that publishes versions has its author name it once in its manifest (`"name":
566
+ "studio/trees"`); each version is a frozen copy in its `versions/` folder, numbered big.small
567
+ by what changed for the packages that use it (a removed or renamed output, param or input, a narrower range or a
568
+ removed option makes a big version). A package that uses another keeps a copy of the version it uses, so it cooks the
569
+ same on every machine and what it uses never changes by itself: outside a workspace in its own `packages/`, named in
570
+ its manifest; in a workspace in the workspace's `topotopo-packages/`, whose `uses` names one version of each package for
571
+ the whole workspace, so an update shows the before/after of every place any package uses the updated package and
572
+ changes them all. A package that publishes versions keeps its own copies, since they are published with it. Hashes read
573
+ text files with LF line ends, so a checkout that turns them into CRLF changes nothing, and `init` writes a
574
+ `.gitattributes` that keeps `versions/` and `packages/` byte for byte.
575
+
576
+ The first build or edit that names a package adds it, once the graph validates; a rejected graph adds and writes
577
+ nothing. A graph-file cook adds it too and says so; `--locked` makes it fail instead, for a build machine. `topotopo
578
+ remove` drops a package no graph names any more, with the copies nothing else uses. Only a package uses packages:
579
+ `topotopo init` (MCP: `workspace {action: "init"}`) makes a folder one, and the MCP server makes its folder one when it
580
+ starts if the folder is in no package and holds nothing but `graphs/`, `assets/`, `exports/` and `inputs/`, or nothing
581
+ at all. A package's own graphs name its other outputs the same way, a house of the package's walls: they resolve to the
582
+ same version, with no entry in `uses`, and outputs that name each other in a loop are refused. To tune a package while
583
+ looking at one that uses it, `--follow studio/trees` (or the MCP `workspace` tool's `follow`) uses the package's
584
+ working folder for one session. Exports record the package versions they used. TopoTopo's built-in packages are used,
585
+ copied and locked like any other (a newer version in a TopoTopo release shows as an update).
586
+
587
+ An export target is a path inside the package's `exports/` folder (`"export": {"format": "glb", "path":
588
+ "props/crate.glb"}`); with the workspace inside the engine project, the engine imports it from there.
589
+
590
+ Every published output says what it is. Publishing cooks it as a package that uses this one would, in the package's
591
+ own scope, and records its kind (`mesh`, `instances`, `points`, `curves`, `terrain`, `textures`, `material`, `volume`, or
592
+ `scene` for several of these), its tags and its description, from the graph's `outputs`: `{"pine": {"node": "out", "kind":
593
+ "mesh", "tags": ["conifer", "low-poly"], "description": "…"}}`. A `kind` written there is checked: publishing refuses
594
+ an output of another kind, or one that cooks to nothing, and build and the viewer warn before that. An output of
595
+ another kind than before makes the version big; tags and descriptions are small changes. A `material` output holds
596
+ materials and their maps with no geometry (texture nodes into `texture_to_material` with no mesh); another package puts
597
+ it on its meshes through the `material` node's second input, and publishing records each map's size (help topic
598
+ `materials`). Publishing checks the
599
+ outputs' declarations first and stops there when one is wrong, says each problem once, and names a version number only
600
+ for what would publish. `topotopo publish --dry-run` (MCP: `publish {dry_run: true}`) runs every check and says the
601
+ version number it would get, its changes, blocks and warnings, writing nothing. `topotopo search conifer --kind mesh`
602
+ (MCP: `workspace {action: "search"}`) finds outputs in the places the package looks in and TopoTopo's built-in library,
603
+ and in a workspace also in the registered libraries it does not list, saying the `workspace library add` that lists one.
604
+
605
+ `topotopo outdated` lists the packages a package uses that have newer versions, with their notes, and the update to run
606
+ for each. `topotopo update studio/trees` shows a before/after first: every place the package uses the updated package, cooked
607
+ with the version in use and the new one, what changed and the notes in between, without writing anything (a big
608
+ version is named with `--to`, and the before/after says what the package's graphs must change: params it no longer
609
+ has, values its narrower range clamps, options it dropped). It ends with the command that applies exactly that update,
610
+ `--from` the version in use `--to` the new one with `--apply`.
611
+
612
+ In the live viewer (`topotopo edit levels/forest`, or `topotopo view` on a graph in a package) the **Packages** tab
613
+ has **Find packages**, a search of the places the package looks in and TopoTopo's built-in packages, and a box per
614
+ package in use: its
615
+ version and a badge (up to date, update available, live), the nodes that use it (a click shows one), and its outputs,
616
+ folded, with the ones in use marked. Where a package has a working folder of its own, **Source: Published 1.1 | Live
617
+ folder** shows that folder's unpublished edits for the viewer session, and every save there cooks the scene
618
+ again; results and exports that use it are marked as holding unpublished edits. **Update to 1.2…** shows first what
619
+ changes in each place the package uses it (a with the version in use, b with the new one, or both overlaid, chosen
620
+ over the view) and applies it only when you confirm; a big version whose graphs must change asks once more and gives a
621
+ line to copy for your agent. The Scene tree marks the nodes of a package with an update or a live folder. In a
622
+ package that publishes versions the tab shows its last version, whether it changed since, and **Check publish**, the dry run.
623
+
624
+ The commands (a folder named must exist; without one, the current folder's package):
625
+
626
+ ```text
627
+ topotopo workspace [folder]
628
+ topotopo workspace init [folder] [--name n] [--engine godot:<path>|unreal:<path>|none] [--library <name or folder>] [--follow | --no-follow]
629
+ topotopo workspace library add|remove <name or folder> [--workspace <folder>]
630
+ topotopo workspace add|list [folder]
631
+ topotopo init [folder] [--name owner/name]
632
+ topotopo use owner/name [folder] [--version 1.1]
633
+ topotopo remove owner/name [folder]
634
+ topotopo packages [owner/name] [folder]
635
+ topotopo publish [folder] --note "..." [--big] [--dry-run]
636
+ topotopo search [words] [folder] [--kind k] [--tag t]
637
+ topotopo outdated [folder]
638
+ topotopo check [folder]
639
+ topotopo update owner/name [folder] [--to 1.4] [--render <folder>]
640
+ topotopo update owner/name [folder] --from 1.3 --to 1.4 --apply
641
+ ```
642
+
643
+ ```bash
644
+ topotopo workspace init game
645
+ topotopo init game/assets/trees --name studio/trees
646
+ topotopo publish game/assets/trees --dry-run
647
+ topotopo publish game/assets/trees --note "first version"
648
+ topotopo workspace library add props --workspace game
649
+ topotopo search conifer --kind mesh ./game/levels/forest
650
+ topotopo use studio/trees game/levels/forest
651
+ topotopo packages game/levels/forest
652
+ topotopo outdated game/levels/forest
653
+ topotopo update studio/trees game/levels/forest
654
+ topotopo update studio/trees game/levels/forest --from 1.0 --to 1.1 --apply
655
+ ```
656
+
657
+ `topotopo --help-topic packages` and `--help-topic workspace` (MCP: `help {topic: "packages"}`) have the details.
658
+
659
+ ## TopoTopo's own packages
660
+
661
+ TopoTopo comes with packages of its own, four packages of ready-made generators in its built-in library
662
+ ([library/](library)), used by full name like any package's outputs. `topotopo/architecture` has walls with windows
663
+ and doors, whole houses, roofs (gable, hip, and straight-skeleton roofs for any footprint), stairs, railings, pillars,
664
+ arches, floors, trusses and scaffolds; `topotopo/nature` rocks, cliffs, trees, bushes and logs, and forests, grass and
665
+ rock fields that dress a surface; `topotopo/props` barrels, crates, pallets, sandbag walls and pipe runs;
666
+ `topotopo/street` roads, lamp posts, bollards, benches, street signs, fences and cables:
334
667
 
335
668
  ```json
336
- { "nodes": { "stairs": { "type": "stairs", "params": { "steps": 16, "style": "open" } } } }
669
+ { "nodes": { "stairs": { "type": "topotopo/architecture/stairs", "params": { "steps": 16, "style": "open" } } } }
337
670
  ```
338
671
 
339
- Each asset documents its typed parameters (`help {nodes: ["stairs"]}`, or [docs/nodes.md](docs/nodes.md#shelf-nodes)),
340
- puts its pivot at the base (Y up, metres), and tags every piece with `name` and `material` attributes, so exports split
341
- and shade cleanly. Assets that follow a curve (`railing`, `fence`, `pipe_run`, `road_strip`) take it as input 0 and
342
- those that dress a surface (`scatter_rocks`, `forest_patch`, `grass_clumps`) take the surface as input 0; without an
343
- input they build a default one, which is what the thumbnails show. A workspace asset with the same name overrides a
344
- shelf asset; `assets {action: "fork", name: "stairs"}` copies one into the workspace as a graph to edit and save back.
345
- [examples/shelf_street.json](examples/shelf_street.json) builds a street block from shelf assets only (transform, merge
346
- and copy nodes just place them):
672
+ TopoTopo carries them built in, so they work offline and every package finds them without listing a library: the first
673
+ graph that names an output copies its package's version into the package's `packages/` and locks it, as for any package,
674
+ and a newer version in a TopoTopo release shows as an update (`topotopo outdated`) instead of changing a scene by
675
+ itself. A graph outside a package cannot use them: `topotopo init` makes its folder one (the MCP server makes a
676
+ folder one that holds nothing but TopoTopo's own folders). Each output documents its typed parameters (`help {nodes: ["topotopo/architecture/stairs"]}`, or
677
+ [docs/nodes.md](docs/nodes.md#package-nodes)), puts its pivot at the base (Y up, metres), and tags every piece with
678
+ `name` and `material` attributes, so exports split and shade cleanly. Outputs that follow a curve (`railing`, `fence`,
679
+ `pipe_run`, `road_strip`) take it as input 0 and those that dress a surface (`scatter_rocks`, `forest_patch`,
680
+ `grass_clumps`) take the surface as input 0; without an input they build a default one, which is what the thumbnails
681
+ show. A built-in package's pieces build on each other (the house is the package's walls and roof), and its default output
682
+ (`topotopo/nature` alone, or `topotopo/nature/lineup`) lines its outputs up. Every output has its kind pinned and tags
683
+ a game developer searches by (`conifer`, `modular`, `masonry`, `street-furniture`): `topotopo search --tag
684
+ street-furniture`. `assets {action: "fork", name: "topotopo/architecture/stairs"}` copies
685
+ an output's graph into the package's assets to edit. [examples/street_block.json](examples/street_block.json) builds a
686
+ street block from the built-in packages alone (transform, merge and copy nodes just place them):
687
+
688
+ ![street block](examples/renders/street_block.png)
347
689
 
348
- ![shelf street](examples/renders/shelf_street.png)
690
+ `npm run builtin` rewrites the built-in packages' line-ups, their thumbnails and the tables below. `npm run builtin -- --publish nature
691
+ --note "..."` publishes a built-in package's next version, numbered as for any package (TopoTopo's own packages are published there
692
+ and nowhere else), and `npm test` fails while a built-in package's working folder differs from its newest version.
693
+ `node test/builtin.ts` cooks every output at its defaults and at the ends of every numeric range.
349
694
 
350
- `npm run shelf` rewrites `shelf/index.json` (the list the engine loads, also over HTTP), the thumbnails and the table
351
- below; `node test/shelf.ts` cooks every asset at its defaults and at the ends of every numeric range.
695
+ <!-- builtin:start (generated by npm run builtin) -->
352
696
 
353
- <!-- shelf:start (generated by npm run shelf) -->
697
+ **topotopo/architecture** 1.0: walls with windows and doors, houses on any footprint, gable, hip and straight-skeleton roofs, stairs and spiral stairs, railings, pillars and arches, brick walls, tiled and hexagonal floors, trusses and scaffolds.
354
698
 
355
- **architecture**
699
+ | | | | |
700
+ |---|---|---|---|
701
+ | <img src="library/architecture/thumbs/arch.png" width="120" alt="topotopo/architecture/arch"><br>`topotopo/architecture/arch` | <img src="library/architecture/thumbs/beam_truss.png" width="120" alt="topotopo/architecture/beam_truss"><br>`topotopo/architecture/beam_truss` | <img src="library/architecture/thumbs/brick_wall.png" width="120" alt="topotopo/architecture/brick_wall"><br>`topotopo/architecture/brick_wall` | <img src="library/architecture/thumbs/door_frame.png" width="120" alt="topotopo/architecture/door_frame"><br>`topotopo/architecture/door_frame` |
702
+ | <img src="library/architecture/thumbs/hex_grid_floor.png" width="120" alt="topotopo/architecture/hex_grid_floor"><br>`topotopo/architecture/hex_grid_floor` | <img src="library/architecture/thumbs/house.png" width="120" alt="topotopo/architecture/house"><br>`topotopo/architecture/house` | <img src="library/architecture/thumbs/pillar.png" width="120" alt="topotopo/architecture/pillar"><br>`topotopo/architecture/pillar` | <img src="library/architecture/thumbs/railing.png" width="120" alt="topotopo/architecture/railing"><br>`topotopo/architecture/railing` |
703
+ | <img src="library/architecture/thumbs/roof_gable.png" width="120" alt="topotopo/architecture/roof_gable"><br>`topotopo/architecture/roof_gable` | <img src="library/architecture/thumbs/roof_hip.png" width="120" alt="topotopo/architecture/roof_hip"><br>`topotopo/architecture/roof_hip` | <img src="library/architecture/thumbs/roof_skeleton.png" width="120" alt="topotopo/architecture/roof_skeleton"><br>`topotopo/architecture/roof_skeleton` | <img src="library/architecture/thumbs/scaffold.png" width="120" alt="topotopo/architecture/scaffold"><br>`topotopo/architecture/scaffold` |
704
+ | <img src="library/architecture/thumbs/spiral_stairs.png" width="120" alt="topotopo/architecture/spiral_stairs"><br>`topotopo/architecture/spiral_stairs` | <img src="library/architecture/thumbs/stairs.png" width="120" alt="topotopo/architecture/stairs"><br>`topotopo/architecture/stairs` | <img src="library/architecture/thumbs/tile_floor.png" width="120" alt="topotopo/architecture/tile_floor"><br>`topotopo/architecture/tile_floor` | <img src="library/architecture/thumbs/wall_segment.png" width="120" alt="topotopo/architecture/wall_segment"><br>`topotopo/architecture/wall_segment` |
705
+ | <img src="library/architecture/thumbs/window_frame.png" width="120" alt="topotopo/architecture/window_frame"><br>`topotopo/architecture/window_frame` | | | |
356
706
 
357
- | | | | | | |
358
- |---|---|---|---|---|---|
359
- | <img src="shelf/thumbs/arch.png" width="120" alt="arch"><br>`arch` | <img src="shelf/thumbs/beam_truss.png" width="120" alt="beam_truss"><br>`beam_truss` | <img src="shelf/thumbs/brick_wall.png" width="120" alt="brick_wall"><br>`brick_wall` | <img src="shelf/thumbs/door_frame.png" width="120" alt="door_frame"><br>`door_frame` | <img src="shelf/thumbs/fence.png" width="120" alt="fence"><br>`fence` | <img src="shelf/thumbs/hex_grid_floor.png" width="120" alt="hex_grid_floor"><br>`hex_grid_floor` |
360
- | <img src="shelf/thumbs/house.png" width="120" alt="house"><br>`house` | <img src="shelf/thumbs/pillar.png" width="120" alt="pillar"><br>`pillar` | <img src="shelf/thumbs/railing.png" width="120" alt="railing"><br>`railing` | <img src="shelf/thumbs/roof_gable.png" width="120" alt="roof_gable"><br>`roof_gable` | <img src="shelf/thumbs/roof_hip.png" width="120" alt="roof_hip"><br>`roof_hip` | <img src="shelf/thumbs/roof_skeleton.png" width="120" alt="roof_skeleton"><br>`roof_skeleton` |
361
- | <img src="shelf/thumbs/scaffold.png" width="120" alt="scaffold"><br>`scaffold` | <img src="shelf/thumbs/spiral_stairs.png" width="120" alt="spiral_stairs"><br>`spiral_stairs` | <img src="shelf/thumbs/stairs.png" width="120" alt="stairs"><br>`stairs` | <img src="shelf/thumbs/tile_floor.png" width="120" alt="tile_floor"><br>`tile_floor` | <img src="shelf/thumbs/wall_segment.png" width="120" alt="wall_segment"><br>`wall_segment` | <img src="shelf/thumbs/window_frame.png" width="120" alt="window_frame"><br>`window_frame` |
707
+ **topotopo/nature** 1.0: rocks and cliff blocks, low-poly trees, bushes and logs, and forests, grass clumps and scattered rocks that dress a surface.
362
708
 
363
- **props**
709
+ | | | | |
710
+ |---|---|---|---|
711
+ | <img src="library/nature/thumbs/bush.png" width="120" alt="topotopo/nature/bush"><br>`topotopo/nature/bush` | <img src="library/nature/thumbs/cliff_block.png" width="120" alt="topotopo/nature/cliff_block"><br>`topotopo/nature/cliff_block` | <img src="library/nature/thumbs/forest_patch.png" width="120" alt="topotopo/nature/forest_patch"><br>`topotopo/nature/forest_patch` | <img src="library/nature/thumbs/grass_clumps.png" width="120" alt="topotopo/nature/grass_clumps"><br>`topotopo/nature/grass_clumps` |
712
+ | <img src="library/nature/thumbs/log.png" width="120" alt="topotopo/nature/log"><br>`topotopo/nature/log` | <img src="library/nature/thumbs/rock.png" width="120" alt="topotopo/nature/rock"><br>`topotopo/nature/rock` | <img src="library/nature/thumbs/scatter_rocks.png" width="120" alt="topotopo/nature/scatter_rocks"><br>`topotopo/nature/scatter_rocks` | <img src="library/nature/thumbs/tree_lowpoly.png" width="120" alt="topotopo/nature/tree_lowpoly"><br>`topotopo/nature/tree_lowpoly` |
364
713
 
365
- | | | | | | |
366
- |---|---|---|---|---|---|
367
- | <img src="shelf/thumbs/barrel.png" width="120" alt="barrel"><br>`barrel` | <img src="shelf/thumbs/bench.png" width="120" alt="bench"><br>`bench` | <img src="shelf/thumbs/bollard.png" width="120" alt="bollard"><br>`bollard` | <img src="shelf/thumbs/bush.png" width="120" alt="bush"><br>`bush` | <img src="shelf/thumbs/cable.png" width="120" alt="cable"><br>`cable` | <img src="shelf/thumbs/cliff_block.png" width="120" alt="cliff_block"><br>`cliff_block` |
368
- | <img src="shelf/thumbs/crate.png" width="120" alt="crate"><br>`crate` | <img src="shelf/thumbs/lamp_post.png" width="120" alt="lamp_post"><br>`lamp_post` | <img src="shelf/thumbs/log.png" width="120" alt="log"><br>`log` | <img src="shelf/thumbs/pallet.png" width="120" alt="pallet"><br>`pallet` | <img src="shelf/thumbs/pipe_run.png" width="120" alt="pipe_run"><br>`pipe_run` | <img src="shelf/thumbs/rock.png" width="120" alt="rock"><br>`rock` |
369
- | <img src="shelf/thumbs/sandbag_wall.png" width="120" alt="sandbag_wall"><br>`sandbag_wall` | <img src="shelf/thumbs/sign_post.png" width="120" alt="sign_post"><br>`sign_post` | <img src="shelf/thumbs/tree_lowpoly.png" width="120" alt="tree_lowpoly"><br>`tree_lowpoly` | | | |
714
+ **topotopo/props** 1.0: barrels, crates, pallets, sandbag walls and pipe runs.
370
715
 
371
- **terrain**
716
+ | | | | |
717
+ |---|---|---|---|
718
+ | <img src="library/props/thumbs/barrel.png" width="120" alt="topotopo/props/barrel"><br>`topotopo/props/barrel` | <img src="library/props/thumbs/crate.png" width="120" alt="topotopo/props/crate"><br>`topotopo/props/crate` | <img src="library/props/thumbs/pallet.png" width="120" alt="topotopo/props/pallet"><br>`topotopo/props/pallet` | <img src="library/props/thumbs/pipe_run.png" width="120" alt="topotopo/props/pipe_run"><br>`topotopo/props/pipe_run` |
719
+ | <img src="library/props/thumbs/sandbag_wall.png" width="120" alt="topotopo/props/sandbag_wall"><br>`topotopo/props/sandbag_wall` | | | |
372
720
 
373
- | | | | | | |
374
- |---|---|---|---|---|---|
375
- | <img src="shelf/thumbs/forest_patch.png" width="120" alt="forest_patch"><br>`forest_patch` | <img src="shelf/thumbs/grass_clumps.png" width="120" alt="grass_clumps"><br>`grass_clumps` | <img src="shelf/thumbs/road_strip.png" width="120" alt="road_strip"><br>`road_strip` | <img src="shelf/thumbs/scatter_rocks.png" width="120" alt="scatter_rocks"><br>`scatter_rocks` | | |
721
+ **topotopo/street** 1.0: roads with kerbs and sidewalks, lamp posts, bollards, benches, street signs, fences and hanging cables.
376
722
 
377
- <!-- shelf:end -->
723
+ | | | | |
724
+ |---|---|---|---|
725
+ | <img src="library/street/thumbs/bench.png" width="120" alt="topotopo/street/bench"><br>`topotopo/street/bench` | <img src="library/street/thumbs/bollard.png" width="120" alt="topotopo/street/bollard"><br>`topotopo/street/bollard` | <img src="library/street/thumbs/cable.png" width="120" alt="topotopo/street/cable"><br>`topotopo/street/cable` | <img src="library/street/thumbs/fence.png" width="120" alt="topotopo/street/fence"><br>`topotopo/street/fence` |
726
+ | <img src="library/street/thumbs/lamp_post.png" width="120" alt="topotopo/street/lamp_post"><br>`topotopo/street/lamp_post` | <img src="library/street/thumbs/road_strip.png" width="120" alt="topotopo/street/road_strip"><br>`topotopo/street/road_strip` | <img src="library/street/thumbs/sign_post.png" width="120" alt="topotopo/street/sign_post"><br>`topotopo/street/sign_post` | |
727
+
728
+ <!-- builtin:end -->
378
729
 
379
730
  ## Testing
380
731
 
@@ -383,23 +734,24 @@ below; `node test/shelf.ts` cooks every asset at its defaults and at the ends of
383
734
  | layer | command | what it checks |
384
735
  |---|---|---|
385
736
  | smoke | `npm run test:smoke [-- filter]` | every node type cooks on its fixture inputs and passes the geometry invariants (`checkGeo`) |
386
- | golden | `npm run test:golden [-- filter]` | every node fixture, every `examples/*.json` graph and every shelf asset matches its fingerprint in `test/golden/` |
737
+ | golden | `npm run test:golden [-- filter]` | every node fixture, every `examples/*.json` graph and every output of TopoTopo's own packages matches its fingerprint in `test/golden/` |
387
738
  | property | `npm run test:property` | 150 random node chains: no exception escapes the engine, invariants hold, cooks are deterministic, the cache returns the same result after a param is changed and restored; plus a wrangle fuzz (random, malformed and never-ending snippets), hostile `=expr` expressions (escapes and endless loops, pool off and on), hostile code params (`heightfield_layer`, `sdf_expr`, parametric nodes), `sdf_expr` fields that hang only when `sdf_to_mesh`/`sdf_grid` sample them, and thrown values whose message never comes back (wrangle, script; also with a poisoned realm) |
388
739
  | docs | `npm run test:docs` | `docs/nodes.md` matches the node definitions; this README's node table lists every node type |
389
740
  | examples | `npm run test:examples [-- filter]` | every node type has an `example` (shown by `help` and in `docs/nodes.md`) and it cooks without errors or warnings: a node spec on the node's fixture inputs, a graph as written |
390
741
  | io | `node test/io.ts` | export → import round trips for every format |
391
742
  | interop | `npm run test:interop` | glTF (validator), Houdini `.geo`/`.bgeo`, CSV/PCG and points JSON round trips; instance rows and their Unreal transforms, per-instance glTF/USD attributes, packed `.geo`, textures, the Unreal Landscape bundle, `export:demo` |
392
- | uv | `npm run test:uv` | unwrap/flatten/layout: finite uv in 0..1, topology kept, LSCM angle error, no island overlaps, uniform texel density, GLB round trip, uv view size |
743
+ | uv | `npm run test:uv` | unwrap/flatten/layout: finite uv in 0..1, topology kept, LSCM angle error, no island overlaps (also random island sets in the property test), uniform texel density, texel weights, fit atlas/udim/stack, orient world, long charts cut, thin charts joined, no stretched charts, slivers and merged parts, decimate and lod keeping the uv free of folds, box projection mirroring, inspect uv density and per-tile utilization, GLB round trip, uv view size |
393
744
  | render | `node test/render.ts` | every render option renders at the expected size; pixel probes for edge overlays, section caps (incl. inside-out), clip, glyphs, labels, legends, shading, the footer line, `view_labels: false`; default output unchanged by the new code paths |
394
745
  | remesh | `npm run test:remesh` | remesh_isotropic edge lengths, watertightness, Cd continuity, box features, adaptive size, group/boundary/seams, timing; decimate seams, lock_border, points; mesh_repair winding, duplicates, holes, non-manifold split, slivers, self-intersections; lod levels and names |
395
746
  | quad remesh | `node test/remeshquad.ts` | Rust/WASM quad extraction, provenance, continuous UVs and seams, groups, determinism and pool parity; `node bench/remeshquad.ts` measures the 100k-triangle case |
396
747
  | mcp | `node test/mcp.ts` | the MCP server end to end over stdio |
748
+ | cook | `npm run test:cook` | `cook --for godot` on neutral props: layout, the record, GLBs Godot reads, determinism, incremental cooks, failures, the foreign-file guard, orphans, options, the lock, the cache, the jobs file, `godot setup` and `status`, and the freshness golden values the Godot addon is tested against (`node test/cook.ts --update` rewrites them) |
397
749
  | arrays | `node test/arrays.ts` | array attributes: storage, merge and builder rules, wrangle `f[]@`/`i[]@`/`s[]@` and helpers, `attrib_array`, JSON, inspect, fingerprints, every node type fed array attributes |
398
750
  | packed | `node test/packed.ts` | packed prims: model (clone, subsets, merge dedup, builder, bbox), pack/unpack round trips, packed copies equal real copies, transforms, auto-unpack, JSON/GLB/USD, render budget, every node type fed instances |
399
- | heightfield | `node test/heightfield.ts` | heightfields: the volume model, every heightfield node's behaviour (round trips, masks, erosion determinism and mass conservation, roads, scattering), the erosion speed target (512² × 100 iterations), png16/r16/mask_png export through the PNG decoder, render/inspect hooks, MCP export |
751
+ | heightfield | `node test/heightfield.ts` | heightfields: the volume model, every heightfield node's behaviour (round trips, masks, crops and tiles that match the whole map, erosion determinism and mass conservation, the same erosion settings at three spacings, roads, scattering), the erosion speed target (512² × 100 iterations), png16/r16/mask_png export through the PNG decoder, render/inspect hooks, MCP export |
400
752
  | pcg | `npm run test:pcg` | scatter v2 (density counts, density attribute and mask ratios, relaxation, exact min_distance, per-prim cap, emitted attributes, prim uv, seeds, legacy defaults), every mask feature and combine mode, attribute_from_map on generated 8/16-bit and RGB PNGs (projections, filters, wrap, file stamp), orient modes against surface normals and copy_to_points, points_along_curve arc spacing, cluster k-means/radius, prune overlap/density/expression/near geometry, copy_to_points variant weights and packed = real copies |
401
753
  | splines | `npm run test:splines` | Bezier against its closed form, a rational NURBS circle, de Boor = de Casteljau, arc length, closest point, exact Bezier ⇄ NURBS conversions, interpolation and fitting; spline prims through clone/merge/subsets/JSON; auto-conversion and its warning; every spline node's behaviour (fillet arcs, constant 3D offset along a helix, projection onto a plane and a heightfield, monotonic curveu); render and export; every node type fed spline prims |
402
- | shelf | `npm run test:shelf [-- filter]` | every shelf asset: typed, documented params; cooks at its defaults (cold cache, under 1 s), at both ends of every numeric range, with every enum option and flipped bool, and on its fixture curve or surface; `name` and `material` on every prim; pivot; promised watertightness; index, thumbnails and README table current; workspace override precedence; `assets` list / delete / fork |
754
+ | builtin | `npm run test:builtin [-- filter]` | every output of TopoTopo's own packages, cooked as a package that uses it: typed, documented params; cooks at its defaults (cold cache, under 1 s), at both ends of every numeric range, with every enum option and flipped bool, and on its fixture curve or surface; `name` and `material` on every prim; pivot; promised watertightness; each package's line-up, thumbnails and README table current, and its working folder its newest version; `assets` fork / list / get / delete; the catalog and help |
403
755
  | textures | `npm run test:textures` | texture nodes and bakes: generators deterministic and tileable (every noise basis repeats at u + 1), blend modes against known values, blur keeps the mean, normal maps (flat = (0.5, 0.5, 1), slope directions, OpenGL/DirectX, resolution-independent strength), AO of a plane white and of a box interior dark, curvature bright on bevels, padding, island ids = xatlas charts, normals and height from a high-res mesh, texture_to_material and ORM packing, glTF embeds PNGs (validator), USD writes files, the textures format, the texture view and texture sampling, merge/clone/JSON, fingerprints, pool on/off identical, 2048² noise timing |
404
756
  | particles | `npm run test:particles` | the particles node: emission counts and lifetimes, attribute and group carry, determinism, pool on/off bit-identical (noise, fields, mesh and floor collisions, trails), particles never below the floor or a mesh and never inside a closed one, spheres kept pscale off a mesh, trail lengths/curveu/ages, max_particles, max_births (step cap, batched runs = one run), frames = one long run (resume, jump back, substeps, moving emitter), point/heightfield/SDF fields, wind, attraction, analytic Perlin gradients and divergence-free curl noise, 100k particles × 200 steps |
405
757
  | rbd | `npm run test:rbd` | rbd_settle / rbd_stack: rocks rest on the ground plane, a terrain mesh and a heightfield (exact hulls checked independently: no vertex below the surface or inside another piece beyond 5 mm / 1 cm; reduced hulls within 5 % of a radius), every piece settled and touching something, bit-identical across cooks, engines and pool on/off, input order independent (also coincident pieces of different shapes), packed = unpacked, static `active` = 0 pieces, initial `v`, fallen pieces and `delete_fallen`, the overlap warning, `ground_plane` auto, `max_pieces`, a 12-crate pile that keeps every crate, animate (frame 1, resumed frames, last frame = settled), every collision shape, and the 1,000-piece timing |
@@ -410,6 +762,14 @@ below; `node test/shelf.ts` cooks every asset at its defaults and at the ends of
410
762
  Fixtures (source geometry, per-node inputs and params) live in `test/fixtures.ts`; `fixtureGraphFor(type)` builds the
411
763
  graph every layer uses to cook a node.
412
764
 
765
+ **The Godot addon** has its own tests, outside `npm test` because they need Godot:
766
+ `GODOT=<the Godot 4.7 editor, on Windows its _console.exe> npm run test:godot` runs the addon in that editor, headless,
767
+ with its settings and cache in a temp folder: the GDScript port of the record and freshness against the golden values
768
+ of `test/cook.ts`, first and incremental imports, sockets, extracted textures and MultiMesh buffers as the cook wrote
769
+ them, an output's own Godot settings surviving recooks, failures, a machine without TopoTopo, published copies, an
770
+ export pack, a C# project, the window's flow (background cooks, reimports, the panel) and the demo project. Without
771
+ `GODOT` it is skipped.
772
+
413
773
  **Golden fingerprints.** A fingerprint holds counts, the bbox (rounded to 1e-4), the attribute schema and group names
414
774
  per class, and hashes of positions (quantised to 1e-5), topology and every attribute (1e-4). They are stable across runs
415
775
  and tolerant to float noise, and there is one JSON file per node or example, so a change shows up as a readable git
@@ -442,18 +802,20 @@ CI (`.github/workflows/ci.yml`) runs `npm run typecheck`, `npm test`, `npm run b
442
802
  `main`. `test/portability.ts` (part of `npm test`) covers what one platform cannot see: generated files that must not
443
803
  depend on the locale, exact file-name case, a symlinked checkout and LF line endings.
444
804
 
445
- **Package.** `npm run pack:test` builds and packs the npm tarball, installs it into an empty project in a temp
805
+ **Package.** `npm run pack:test` builds and packs the npm tarball, installs it into an empty folder in a temp
446
806
  directory and uses it from there: the `topotopo` bin (help, cooking an example with a render), the library import and
447
- its types, the shelf, the bundled font, the worker pool, the WASM kernels and the MCP server over stdio. It takes about
448
- a minute and is not part of `npm test`; run it before a release (see [CONTRIBUTING.md](CONTRIBUTING.md)).
807
+ its types, the built-in library of TopoTopo's own packages (a package's first use copies a built-in package from it), the bundled font,
808
+ the worker pool, the WASM kernels and the MCP server over stdio. It takes about a minute and is not part of
809
+ `npm test`; run it before a release (see [CONTRIBUTING.md](CONTRIBUTING.md)).
449
810
 
450
811
  ## Layout
451
812
 
452
813
  `src/core` holds the geometry model and algorithms. `src/graph` holds the node system and cooking engine, and `src/nodes`
453
814
  the node library. The renderer is in `src/render`, import/export in `src/io`, and the MCP server, tools and docs in
454
- `src/mcp`. `src/viewer` has the live preview, and `src/host` the Node host (sandbox, files, fonts). The structure is
455
- described in [docs/DESIGN.md](docs/DESIGN.md). `dist/` (not in git) is the compiled package: `npm run build` mirrors
456
- `src/` there one to one, so the shelf, fonts, kernels and worker entry are found relative to either.
815
+ `src/mcp`. `src/viewer` has the live preview, `src/web` the web app (a page per folder of the workspaces and libraries), and `src/host` the Node
816
+ host (sandbox, files, fonts).
817
+ `dist/` (not in git) is the compiled package: `npm run build` mirrors
818
+ `src/` there one to one, so the built-in library, fonts, kernels and worker entry are found relative to either.
457
819
 
458
820
  ## Support
459
821
 
@@ -461,6 +823,8 @@ TopoTopo is free and stays free. If it saves you time, you can sponsor its maint
461
823
  [GitHub Sponsors](https://github.com/sponsors/faxlab). Sponsorship funds maintainer time and comes with no
462
824
  obligations either way.
463
825
 
826
+ For releases and new packs, about once a month, join the [mailing list](https://topotopo.kit.com/54b6b32c3f).
827
+
464
828
  ## Licence
465
829
 
466
830
  Apache-2.0 (see [LICENSE](LICENSE)). Third-party components and their licence texts are listed in [NOTICE](NOTICE).