topotopo 0.4.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.
- package/NOTICE +10 -10
- package/README.md +460 -117
- package/dist/cli.js +323 -146
- package/dist/config.d.ts +48 -0
- package/dist/config.js +170 -0
- package/dist/core/bake.d.ts +14 -3
- package/dist/core/bake.js +153 -4
- package/dist/core/bevel.d.ts +3 -1
- package/dist/core/bevel.js +76 -3
- package/dist/core/decimate.d.ts +65 -0
- package/dist/core/decimate.js +409 -3
- package/dist/core/erosion.d.ts +37 -0
- package/dist/core/erosion.js +41 -1
- package/dist/core/geometry.d.ts +5 -1
- package/dist/core/geometry.js +203 -3
- package/dist/core/heightfield.d.ts +27 -4
- package/dist/core/heightfield.js +54 -16
- package/dist/core/intrinsics.d.ts +7 -0
- package/dist/core/intrinsics.js +94 -0
- package/dist/core/manifold.d.ts +12 -1
- package/dist/core/manifold.js +78 -6
- package/dist/core/materials.d.ts +7 -0
- package/dist/core/materials.js +45 -0
- package/dist/core/noise.d.ts +9 -0
- package/dist/core/noise.js +10 -1
- package/dist/core/polymerge.d.ts +21 -0
- package/dist/core/polymerge.js +327 -0
- package/dist/core/repair.d.ts +2 -0
- package/dist/core/repair.js +2 -0
- package/dist/core/report.d.ts +70 -0
- package/dist/core/report.js +275 -0
- package/dist/core/scene.js +2 -1
- package/dist/core/sha256.d.ts +4 -0
- package/dist/core/sha256.js +69 -0
- package/dist/core/shapes.d.ts +3 -0
- package/dist/core/shapes.js +34 -0
- package/dist/core/snippet-lib.d.ts +14 -1
- package/dist/core/snippet-lib.js +39 -13
- package/dist/core/tangents.d.ts +2 -0
- package/dist/core/tangents.js +5 -1
- package/dist/core/texnoise.d.ts +6 -1
- package/dist/core/texnoise.js +6 -2
- package/dist/core/texsdf.d.ts +131 -0
- package/dist/core/texsdf.js +637 -0
- package/dist/core/texture.d.ts +163 -9
- package/dist/core/texture.js +844 -20
- package/dist/core/topology.d.ts +10 -0
- package/dist/core/topology.js +168 -0
- package/dist/core/unwrap.d.ts +72 -0
- package/dist/core/unwrap.js +800 -0
- package/dist/core/usercode.d.ts +27 -0
- package/dist/core/usercode.js +87 -0
- package/dist/core/uv.d.ts +4 -18
- package/dist/core/uv.js +35 -188
- package/dist/core/uvislands.d.ts +62 -0
- package/dist/core/uvislands.js +574 -0
- package/dist/core/uvoverlap.d.ts +58 -0
- package/dist/core/uvoverlap.js +220 -0
- package/dist/core/uvpack.d.ts +64 -0
- package/dist/core/uvpack.js +628 -0
- package/dist/core/uvreport.d.ts +61 -0
- package/dist/core/uvreport.js +207 -143
- package/dist/core/wrangle.d.ts +6 -1
- package/dist/core/wrangle.js +27 -16
- package/dist/core/xatlas.d.ts +16 -1
- package/dist/core/xatlas.js +66 -62
- package/dist/engines.d.ts +63 -0
- package/dist/engines.js +180 -0
- package/dist/explain.d.ts +4 -3
- package/dist/explain.js +129 -12
- package/dist/graph/engine.d.ts +92 -29
- package/dist/graph/engine.js +298 -148
- package/dist/graph/expr.d.ts +6 -3
- package/dist/graph/expr.js +18 -8
- package/dist/graph/outputs.d.ts +23 -0
- package/dist/graph/outputs.js +41 -0
- package/dist/graph/packages.d.ts +72 -0
- package/dist/graph/packages.js +261 -0
- package/dist/graph/parallel.d.ts +3 -1
- package/dist/graph/parallel.js +4 -1
- package/dist/graph/params.d.ts +6 -0
- package/dist/graph/params.js +34 -7
- package/dist/graph/scope.d.ts +55 -0
- package/dist/graph/scope.js +14 -0
- package/dist/graph/types.d.ts +75 -12
- package/dist/graph/types.js +4 -2
- package/dist/graph/vars.d.ts +16 -0
- package/dist/graph/vars.js +80 -0
- package/dist/host/artifacts.d.ts +10 -1
- package/dist/host/artifacts.js +37 -6
- package/dist/host/cook.d.ts +241 -0
- package/dist/host/cook.js +844 -0
- package/dist/host/export-targets.d.ts +42 -5
- package/dist/host/export-targets.js +72 -13
- package/dist/host/godot-commands.d.ts +4 -0
- package/dist/host/godot-commands.js +21 -0
- package/dist/host/godot.d.ts +183 -0
- package/dist/host/godot.js +916 -0
- package/dist/host/node.d.ts +12 -7
- package/dist/host/node.js +27 -9
- package/dist/host/pool.js +51 -2
- package/dist/host/sidecars.d.ts +8 -0
- package/dist/host/sidecars.js +50 -0
- package/dist/host/types.d.ts +19 -6
- package/dist/host/version.d.ts +1 -0
- package/dist/host/version.js +3 -0
- package/dist/host/worker.js +5 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/inspect.d.ts +80 -2
- package/dist/inspect.js +265 -30
- package/dist/io/common.d.ts +25 -5
- package/dist/io/export.js +2 -1
- package/dist/io/files.d.ts +23 -4
- package/dist/io/files.js +60 -8
- package/dist/io/gltf.js +134 -47
- package/dist/io/heightmap.d.ts +3 -0
- package/dist/io/heightmap.js +1 -0
- package/dist/io/import.js +10 -0
- package/dist/io/inspect-scene.d.ts +55 -0
- package/dist/io/inspect-scene.js +155 -0
- package/dist/io/kinds.d.ts +81 -0
- package/dist/io/kinds.js +163 -0
- package/dist/io/points.d.ts +2 -1
- package/dist/io/points.js +3 -1
- package/dist/io/sidecars.d.ts +24 -0
- package/dist/io/sidecars.js +57 -0
- package/dist/io/source.d.ts +65 -0
- package/dist/io/source.js +112 -0
- package/dist/io/targets.d.ts +47 -3
- package/dist/io/targets.js +148 -13
- package/dist/io/textures.js +21 -1
- package/dist/io/unreal.js +5 -1
- package/dist/mcp/docs.d.ts +10 -1
- package/dist/mcp/docs.js +786 -143
- package/dist/mcp/inputs.d.ts +12 -5
- package/dist/mcp/inputs.js +50 -13
- package/dist/mcp/server.js +56 -27
- package/dist/mcp/tools.d.ts +14 -7
- package/dist/mcp/tools.js +196 -103
- package/dist/mcp/verify.d.ts +2 -2
- package/dist/mcp/verify.js +1 -1
- package/dist/mcp/workspace.d.ts +15 -0
- package/dist/mcp/workspace.js +349 -0
- package/dist/nodes/attributes.js +198 -1
- package/dist/nodes/bake.js +151 -47
- package/dist/nodes/beam.d.ts +1 -0
- package/dist/nodes/beam.js +201 -0
- package/dist/nodes/bevel.js +51 -3
- package/dist/nodes/cloth.js +2 -0
- package/dist/nodes/code.js +21 -9
- package/dist/nodes/curves.js +433 -93
- package/dist/nodes/flow.js +53 -33
- package/dist/nodes/generate.js +12 -38
- package/dist/nodes/heightfield.js +248 -77
- package/dist/nodes/imageops.js +16 -19
- package/dist/nodes/index.d.ts +1 -0
- package/dist/nodes/index.js +1 -0
- package/dist/nodes/material.js +89 -24
- package/dist/nodes/measure.js +43 -17
- package/dist/nodes/particles.js +2 -0
- package/dist/nodes/pcg.js +6 -5
- package/dist/nodes/procedural.js +4 -3
- package/dist/nodes/remesh.js +71 -15
- package/dist/nodes/scene.js +4 -2
- package/dist/nodes/sdf.js +10 -5
- package/dist/nodes/solid.js +20 -5
- package/dist/nodes/splines.d.ts +15 -1
- package/dist/nodes/splines.js +112 -105
- package/dist/nodes/texture.d.ts +21 -6
- package/dist/nodes/texture.js +1318 -185
- package/dist/nodes/topology.d.ts +7 -0
- package/dist/nodes/topology.js +133 -6
- package/dist/nodes/transform.js +6 -2
- package/dist/nodes/uv.js +192 -174
- package/dist/nodes/wasmcall.js +5 -1
- package/dist/open.d.ts +19 -0
- package/dist/open.js +12 -0
- package/dist/package.d.ts +288 -0
- package/dist/package.js +772 -0
- package/dist/packages/check.d.ts +32 -0
- package/dist/packages/check.js +169 -0
- package/dist/packages/commands.d.ts +57 -0
- package/dist/packages/commands.js +537 -0
- package/dist/packages/registry.d.ts +796 -0
- package/dist/packages/registry.js +2998 -0
- package/dist/packages/update.d.ts +124 -0
- package/dist/packages/update.js +476 -0
- package/dist/render/options.d.ts +2 -0
- package/dist/render/options.js +44 -5
- package/dist/render/preview.d.ts +15 -4
- package/dist/render/preview.js +6 -4
- package/dist/render/raster.d.ts +66 -5
- package/dist/render/raster.js +506 -138
- package/dist/render/texview.d.ts +6 -0
- package/dist/render/texview.js +27 -0
- package/dist/scan.d.ts +61 -0
- package/dist/scan.js +228 -0
- package/dist/session.d.ts +311 -0
- package/dist/session.js +849 -0
- package/dist/viewer/app/api.js +48 -6
- package/dist/viewer/app/cooking.js +78 -0
- package/dist/viewer/app/embed.js +27 -7
- package/dist/viewer/app/export-popover.js +118 -16
- package/dist/viewer/app/grid.js +5 -1
- package/dist/viewer/app/guides.js +122 -0
- package/dist/viewer/app/keymap.js +6 -3
- package/dist/viewer/app/layers.js +4 -4
- package/dist/viewer/app/main.js +185 -52
- package/dist/viewer/app/markers.js +60 -0
- package/dist/viewer/app/outliner.js +72 -27
- package/dist/viewer/app/output-info.js +45 -0
- package/dist/viewer/app/outputs.css +147 -8
- package/dist/viewer/app/outputs.js +168 -54
- package/dist/viewer/app/packages.js +614 -0
- package/dist/viewer/app/props.js +176 -52
- package/dist/viewer/app/scene.js +30 -5
- package/dist/viewer/app/select.js +4 -3
- package/dist/viewer/app/status.js +12 -15
- package/dist/viewer/app/style.css +65 -7
- package/dist/viewer/app/vars.js +47 -0
- package/dist/viewer/app/welcome.js +72 -0
- package/dist/viewer/graph-file.d.ts +62 -0
- package/dist/viewer/graph-file.js +175 -0
- package/dist/viewer/index.html +23 -10
- package/dist/viewer/json-edit.d.ts +13 -0
- package/dist/viewer/json-edit.js +274 -0
- package/dist/viewer/outputs.d.ts +49 -5
- package/dist/viewer/outputs.js +264 -56
- package/dist/viewer/packages.d.ts +121 -0
- package/dist/viewer/packages.js +584 -0
- package/dist/viewer/server.d.ts +14 -9
- package/dist/viewer/server.js +266 -28
- package/dist/web/app/web.css +419 -0
- package/dist/web/app/web.js +188 -0
- package/dist/{gallery → web}/bake.d.ts +4 -4
- package/dist/{gallery → web}/bake.js +24 -15
- package/dist/web/folder-page.d.ts +101 -0
- package/dist/web/folder-page.js +146 -0
- package/dist/web/folders.d.ts +280 -0
- package/dist/web/folders.js +970 -0
- package/dist/web/library.d.ts +91 -0
- package/dist/web/library.js +228 -0
- package/dist/web/markdown.d.ts +45 -0
- package/dist/web/markdown.js +677 -0
- package/dist/web/pages.d.ts +258 -0
- package/dist/web/pages.js +301 -0
- package/dist/web/server.d.ts +24 -0
- package/dist/web/server.js +1068 -0
- package/dist/workspace.d.ts +88 -118
- package/dist/workspace.js +358 -460
- package/integrations/godot/addons/topotopo/LICENSE +202 -0
- package/integrations/godot/addons/topotopo/README.md +57 -0
- package/integrations/godot/addons/topotopo/context_menu.gd +43 -0
- package/integrations/godot/addons/topotopo/dock.gd +266 -0
- package/integrations/godot/addons/topotopo/dock.tscn +72 -0
- package/integrations/godot/addons/topotopo/export_filter.gd +72 -0
- package/integrations/godot/addons/topotopo/gltf_instancing.gd +131 -0
- package/integrations/godot/addons/topotopo/icons/topotopo.svg +1 -0
- package/integrations/godot/addons/topotopo/inspector.gd +38 -0
- package/integrations/godot/addons/topotopo/instances_post_import.gd +111 -0
- package/integrations/godot/addons/topotopo/package.gd +23 -0
- package/integrations/godot/addons/topotopo/package_importer.gd +187 -0
- package/integrations/godot/addons/topotopo/plugin.cfg +7 -0
- package/integrations/godot/addons/topotopo/plugin.gd +970 -0
- package/integrations/godot/addons/topotopo/record.gd +435 -0
- package/integrations/godot/addons/topotopo/runner.gd +458 -0
- package/integrations/godot/addons/topotopo/tools/check.gd +42 -0
- package/integrations/godot/addons/topotopo/watcher.gd +199 -0
- package/kernels/pkg/README.md +2 -1
- package/kernels/pkg-simd/README.md +2 -1
- package/library/architecture/versions/1.0/architecture.topo +12 -0
- package/{shelf → library/architecture/versions/1.0/graphs}/arch.json +3 -3
- package/{shelf → library/architecture/versions/1.0/graphs}/beam_truss.json +6 -6
- package/{shelf → library/architecture/versions/1.0/graphs}/brick_wall.json +8 -8
- package/{shelf → library/architecture/versions/1.0/graphs}/door_frame.json +3 -3
- package/{shelf → library/architecture/versions/1.0/graphs}/hex_grid_floor.json +3 -2
- package/{shelf → library/architecture/versions/1.0/graphs}/house.json +8 -8
- package/library/architecture/versions/1.0/graphs/lineup.json +42 -0
- package/{shelf → library/architecture/versions/1.0/graphs}/pillar.json +3 -2
- package/{shelf → library/architecture/versions/1.0/graphs}/railing.json +5 -5
- package/{shelf → library/architecture/versions/1.0/graphs}/roof_gable.json +2 -2
- package/{shelf → library/architecture/versions/1.0/graphs}/roof_hip.json +2 -2
- package/{shelf → library/architecture/versions/1.0/graphs}/roof_skeleton.json +2 -1
- package/{shelf → library/architecture/versions/1.0/graphs}/scaffold.json +4 -4
- package/{shelf → library/architecture/versions/1.0/graphs}/spiral_stairs.json +3 -2
- package/{shelf → library/architecture/versions/1.0/graphs}/stairs.json +6 -6
- package/{shelf → library/architecture/versions/1.0/graphs}/tile_floor.json +3 -2
- package/{shelf → library/architecture/versions/1.0/graphs}/wall_segment.json +10 -10
- package/{shelf → library/architecture/versions/1.0/graphs}/window_frame.json +2 -2
- package/library/architecture/versions/1.0/version.json +1119 -0
- package/{shelf → library/nature/versions/1.0/graphs}/bush.json +2 -2
- package/{shelf → library/nature/versions/1.0/graphs}/cliff_block.json +4 -3
- package/{shelf → library/nature/versions/1.0/graphs}/forest_patch.json +5 -5
- package/{shelf → library/nature/versions/1.0/graphs}/grass_clumps.json +2 -2
- package/library/nature/versions/1.0/graphs/lineup.json +24 -0
- package/{shelf → library/nature/versions/1.0/graphs}/log.json +6 -6
- package/{shelf → library/nature/versions/1.0/graphs}/rock.json +5 -4
- package/{shelf → library/nature/versions/1.0/graphs}/scatter_rocks.json +5 -5
- package/{shelf → library/nature/versions/1.0/graphs}/tree_lowpoly.json +3 -2
- package/library/nature/versions/1.0/nature.topo +12 -0
- package/library/nature/versions/1.0/version.json +534 -0
- package/{shelf → library/props/versions/1.0/graphs}/barrel.json +5 -4
- package/{shelf → library/props/versions/1.0/graphs}/crate.json +3 -3
- package/library/props/versions/1.0/graphs/lineup.json +18 -0
- package/{shelf → library/props/versions/1.0/graphs}/pallet.json +4 -3
- package/{shelf → library/props/versions/1.0/graphs}/pipe_run.json +3 -3
- package/{shelf → library/props/versions/1.0/graphs}/sandbag_wall.json +5 -5
- package/library/props/versions/1.0/props.topo +12 -0
- package/library/props/versions/1.0/version.json +336 -0
- package/{shelf → library/street/versions/1.0/graphs}/bench.json +5 -5
- package/{shelf → library/street/versions/1.0/graphs}/bollard.json +2 -1
- package/{shelf → library/street/versions/1.0/graphs}/cable.json +4 -4
- package/{shelf → library/street/versions/1.0/graphs}/fence.json +7 -7
- package/{shelf → library/street/versions/1.0/graphs}/lamp_post.json +2 -2
- package/library/street/versions/1.0/graphs/lineup.json +22 -0
- package/{shelf → library/street/versions/1.0/graphs}/road_strip.json +2 -2
- package/{shelf → library/street/versions/1.0/graphs}/sign_post.json +1 -1
- package/library/street/versions/1.0/street.topo +12 -0
- package/library/street/versions/1.0/version.json +421 -0
- package/package.json +17 -8
- package/dist/gallery/app/gallery.css +0 -100
- package/dist/gallery/app/gallery.js +0 -80
- package/dist/gallery/cli.d.ts +0 -4
- package/dist/gallery/cli.js +0 -157
- package/dist/gallery/library.d.ts +0 -124
- package/dist/gallery/library.js +0 -366
- package/dist/gallery/pages.d.ts +0 -94
- package/dist/gallery/pages.js +0 -148
- package/dist/gallery/server.d.ts +0 -21
- package/dist/gallery/server.js +0 -391
- package/dist/graph/migrate.d.ts +0 -23
- package/dist/graph/migrate.js +0 -58
- package/dist/mcp/library.d.ts +0 -12
- package/dist/mcp/library.js +0 -159
- package/shelf/index.json +0 -190
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
@tool
|
|
2
|
+
extends Node
|
|
3
|
+
## Keeps packages current while their files change (graphs saved in TopoTopo's viewer, by an agent over MCP, by hand).
|
|
4
|
+
## Godot cannot see those files (they sit in .gdignore folders), so the watcher polls them: every watch_interval (1 s by
|
|
5
|
+
## default; 0 = only on focus-in) and at once when the editor gets focus, it stats the files the records name. A change
|
|
6
|
+
## waits 0.5 s for the next one, then every stale package cooks in one background process; a change to a package that
|
|
7
|
+
## is being cooked stops that cook and starts it again. What a cook wrote is imported when Godot's focus rule allows
|
|
8
|
+
## (plugin.gd flush). A cook that crashed or timed out is not tried again until its package's files change.
|
|
9
|
+
|
|
10
|
+
const Record := preload("record.gd")
|
|
11
|
+
const Runner := preload("runner.gd")
|
|
12
|
+
const DEBOUNCE_MS := 500
|
|
13
|
+
|
|
14
|
+
## plugin.gd
|
|
15
|
+
var host: Object
|
|
16
|
+
var _next := 0
|
|
17
|
+
## res:// .topo -> [sources stamp, outputs stamp]
|
|
18
|
+
var _stamps := {}
|
|
19
|
+
var _dirty := {}
|
|
20
|
+
var _last_change := 0
|
|
21
|
+
## The background cook, {} when none runs.
|
|
22
|
+
var _run := {}
|
|
23
|
+
## Packages waiting for the running cook to end: res:// .topo -> force.
|
|
24
|
+
var _queued := {}
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
func _process(_delta: float) -> void:
|
|
28
|
+
if host == null:
|
|
29
|
+
return
|
|
30
|
+
host.poll_runs()
|
|
31
|
+
host.poll_viewers()
|
|
32
|
+
if host.headless:
|
|
33
|
+
return
|
|
34
|
+
host.flush()
|
|
35
|
+
var now := Time.get_ticks_msec()
|
|
36
|
+
var interval: float = float(host.runner.settings.get("watch_interval", 1.0))
|
|
37
|
+
if _next == 0 or (interval > 0.0 and now >= _next):
|
|
38
|
+
_next = now + int(maxf(interval, 0.1) * 1000.0) if interval > 0.0 else 0x7fffffffffffffff
|
|
39
|
+
_poll(now)
|
|
40
|
+
if _dirty.size() and now - _last_change >= DEBOUNCE_MS:
|
|
41
|
+
_settle()
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
func _notification(what: int) -> void:
|
|
45
|
+
if what == NOTIFICATION_APPLICATION_FOCUS_IN and host != null:
|
|
46
|
+
_next = 0
|
|
47
|
+
host.queue_flush()
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
static func _stat(p: String) -> String:
|
|
51
|
+
if not FileAccess.file_exists(p):
|
|
52
|
+
return "-"
|
|
53
|
+
return "%d:%d" % [FileAccess.get_modified_time(p), FileAccess.get_size(p)]
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
## The state of a package's sources: its .topo, everything below graphs/, assets/ and inputs/ (and the folders its
|
|
57
|
+
## outputs listed), and the files outside them its record names, by time and size; the .topo and the graphs by their
|
|
58
|
+
## content (hashed again only when they change, which also sees two saves in the same second). Not the .topo's import
|
|
59
|
+
## file, which Godot rewrites on every import of it: changed import options reimport the .topo, and that import cooks.
|
|
60
|
+
func source_stamp(topo: String) -> String:
|
|
61
|
+
var st = host.packages.get(topo)
|
|
62
|
+
if st == null:
|
|
63
|
+
return ""
|
|
64
|
+
var parts := PackedStringArray([host.record.file_content_sha(st.abs)])
|
|
65
|
+
var folders := ["graphs", "assets", "inputs"]
|
|
66
|
+
var rec = st.record
|
|
67
|
+
if typeof(rec) == TYPE_DICTIONARY:
|
|
68
|
+
for f in Record._sorted_keys(rec.get("folders", {})):
|
|
69
|
+
if not folders.has(f):
|
|
70
|
+
folders.append(f)
|
|
71
|
+
for folder in folders:
|
|
72
|
+
var dir := Record.abs_of(st.dir, folder)
|
|
73
|
+
for f in Record.listing(dir):
|
|
74
|
+
var file := dir.path_join(f)
|
|
75
|
+
parts.append("%s/%s=%s" % [folder, f, host.record.file_content_sha(file) if folder == "graphs" else _stat(file)])
|
|
76
|
+
if typeof(rec) == TYPE_DICTIONARY:
|
|
77
|
+
for rel in Record._sorted_keys(rec.get("sources", {})):
|
|
78
|
+
if not (rel.begins_with("graphs/") or rel.begins_with("assets/") or rel.begins_with("inputs/")):
|
|
79
|
+
parts.append("%s=%s" % [rel, _stat(Record.abs_of(st.dir, rel))])
|
|
80
|
+
return "\n".join(parts).md5_text()
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
## The times and sizes of a package's record and output files.
|
|
84
|
+
func output_stamp(topo: String) -> String:
|
|
85
|
+
var st = host.packages.get(topo)
|
|
86
|
+
if st == null:
|
|
87
|
+
return ""
|
|
88
|
+
var parts := PackedStringArray([_stat(st.dir.path_join(Record.RECORD))])
|
|
89
|
+
for f in Record.output_files(st.record):
|
|
90
|
+
parts.append("%s=%s" % [f, _stat(Record.res_to_abs(host.project, f))])
|
|
91
|
+
return "\n".join(parts).md5_text()
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
## Take the packages' files as they are now as seen (after the startup check, and after a package's cook).
|
|
95
|
+
func rebaseline(topo := "") -> void:
|
|
96
|
+
for t in ([topo] if topo != "" else host.packages.keys()):
|
|
97
|
+
if host.packages.has(t):
|
|
98
|
+
_stamps[t] = [source_stamp(t), output_stamp(t)]
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
func _poll(now: int) -> void:
|
|
102
|
+
for topo in host.packages:
|
|
103
|
+
var st = host.packages[topo]
|
|
104
|
+
if st.copy or st.root:
|
|
105
|
+
continue
|
|
106
|
+
var stamp := [source_stamp(topo), output_stamp(topo)]
|
|
107
|
+
var old = _stamps.get(topo)
|
|
108
|
+
_stamps[topo] = stamp
|
|
109
|
+
# a package seen for the first time is new (the startup check took the first ones as seen)
|
|
110
|
+
if old == null or old[0] != stamp[0] or (old[1] != stamp[1] and not st.cooking):
|
|
111
|
+
_dirty[topo] = true
|
|
112
|
+
_last_change = now
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
## After the changes settled: check the changed packages, cook the stale ones.
|
|
116
|
+
func _settle() -> void:
|
|
117
|
+
var stale := []
|
|
118
|
+
for topo in _dirty.keys():
|
|
119
|
+
var st = host.packages.get(topo)
|
|
120
|
+
if st == null:
|
|
121
|
+
continue
|
|
122
|
+
var fr: Dictionary = host.check(topo)
|
|
123
|
+
if host.is_stale(fr) and st.crashed != source_stamp(topo):
|
|
124
|
+
stale.append(topo)
|
|
125
|
+
elif not host.is_stale(fr):
|
|
126
|
+
# current again (a change undone): its .topo import follows
|
|
127
|
+
host.refresh_later(topo)
|
|
128
|
+
_dirty.clear()
|
|
129
|
+
host.packages_changed.emit()
|
|
130
|
+
if stale.is_empty() or not bool(host.runner.settings.get("live_cook", true)):
|
|
131
|
+
return
|
|
132
|
+
if not host.runner.found():
|
|
133
|
+
# the committed outputs stay; the .topo imports say what changed and how to set TopoTopo up
|
|
134
|
+
host.say_missing_once()
|
|
135
|
+
for topo in stale:
|
|
136
|
+
host.refresh_later(topo)
|
|
137
|
+
return
|
|
138
|
+
cook_background(stale, false)
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
## Cook packages in the background (one process). A package the running cook has not finished stops that cook, which
|
|
142
|
+
## starts again with it; other packages wait for the running cook.
|
|
143
|
+
func cook_background(topos: Array, force: bool) -> void:
|
|
144
|
+
if not _run.is_empty() and not _run.exited:
|
|
145
|
+
var restart := false
|
|
146
|
+
for t in topos:
|
|
147
|
+
_queued[t] = bool(_queued.get(t, false)) or force
|
|
148
|
+
var k := Runner._key(host._abs(t))
|
|
149
|
+
if _run.packages.has(k) and not _run.packages[k].done:
|
|
150
|
+
restart = true
|
|
151
|
+
if restart:
|
|
152
|
+
for k in _run.order:
|
|
153
|
+
var pk = _run.packages[k]
|
|
154
|
+
if not pk.done:
|
|
155
|
+
var t: String = host._res(pk.topo)
|
|
156
|
+
_queued[t] = bool(_queued.get(t, false)) or bool(_run.force)
|
|
157
|
+
host.runner.kill(_run, "restart")
|
|
158
|
+
return
|
|
159
|
+
_start(topos, force)
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
func _start(topos: Array, force: bool) -> void:
|
|
163
|
+
var list := []
|
|
164
|
+
for t in topos:
|
|
165
|
+
# a package another cook is on (an import's) is left to it
|
|
166
|
+
if host.runner.run_with(host._abs(t)).is_empty():
|
|
167
|
+
list.append(t)
|
|
168
|
+
if list.is_empty():
|
|
169
|
+
return
|
|
170
|
+
_run = host.cook(list, force, false, true)
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
## A cook ended (plugin.gd collect): start what waited for it.
|
|
174
|
+
func run_ended(run: Dictionary) -> void:
|
|
175
|
+
for k in run.order:
|
|
176
|
+
var t: String = host._res(run.packages[k].topo)
|
|
177
|
+
if host.packages.has(t):
|
|
178
|
+
rebaseline(t)
|
|
179
|
+
var st = host.packages[t]
|
|
180
|
+
if host.is_stale(st.fresh) and st.crashed == "" and run.killed == "" and not _queued.has(t):
|
|
181
|
+
# changed while it cooked: cook it again
|
|
182
|
+
_dirty[t] = true
|
|
183
|
+
_last_change = Time.get_ticks_msec()
|
|
184
|
+
if not is_same(run, _run):
|
|
185
|
+
return
|
|
186
|
+
_run = {}
|
|
187
|
+
if _queued.is_empty():
|
|
188
|
+
return
|
|
189
|
+
var forced := []
|
|
190
|
+
var rest := []
|
|
191
|
+
for t in _queued:
|
|
192
|
+
(forced if _queued[t] else rest).append(t)
|
|
193
|
+
_queued.clear()
|
|
194
|
+
if forced.size():
|
|
195
|
+
for t in rest:
|
|
196
|
+
_queued[t] = false
|
|
197
|
+
_start(forced, true)
|
|
198
|
+
else:
|
|
199
|
+
_start(rest, false)
|
package/kernels/pkg/README.md
CHANGED
|
@@ -548,7 +548,8 @@ tested on the regression corpus, not an exhaustive operating-system/compiler mat
|
|
|
548
548
|
Run `node test/remeshquad.ts`, `node bench/remeshquad.ts` and
|
|
549
549
|
`cargo bench --manifest-path kernels/Cargo.toml --bench remesh_quad`.
|
|
550
550
|
Inspect `examples/renders/quad_remesh.png`: gray inputs and colored results for a
|
|
551
|
-
noisy sphere, bevelled box,
|
|
551
|
+
noisy sphere, bevelled box, rock (topotopo/nature/rock) and capped tube, with every
|
|
552
|
+
polygon edge visible.
|
|
552
553
|
|
|
553
554
|
## Sampled SDF grids
|
|
554
555
|
|
|
@@ -548,7 +548,8 @@ tested on the regression corpus, not an exhaustive operating-system/compiler mat
|
|
|
548
548
|
Run `node test/remeshquad.ts`, `node bench/remeshquad.ts` and
|
|
549
549
|
`cargo bench --manifest-path kernels/Cargo.toml --bench remesh_quad`.
|
|
550
550
|
Inspect `examples/renders/quad_remesh.png`: gray inputs and colored results for a
|
|
551
|
-
noisy sphere, bevelled box,
|
|
551
|
+
noisy sphere, bevelled box, rock (topotopo/nature/rock) and capped tube, with every
|
|
552
|
+
polygon edge visible.
|
|
552
553
|
|
|
553
554
|
## Sampled SDF grids
|
|
554
555
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"graph": "lineup",
|
|
3
|
+
"bake": {},
|
|
4
|
+
"title": "Architecture",
|
|
5
|
+
"description": "TopoTopo's architecture package: 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.",
|
|
6
|
+
"tags": [
|
|
7
|
+
"built-in"
|
|
8
|
+
],
|
|
9
|
+
"links": [],
|
|
10
|
+
"created": "2026-10-28",
|
|
11
|
+
"name": "topotopo/architecture"
|
|
12
|
+
}
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"note": "the opening outline in the XY plane, starting below the ground so the cut is open at the bottom",
|
|
46
46
|
"params": {
|
|
47
47
|
"run_over": "detail",
|
|
48
|
-
"code": "const w =
|
|
48
|
+
"code": "const w = width, h = height, n = Math.max(2, Math.round(segments)), st = style;\nconst P = [[-w / 2, -0.05, 0]];\nif (st === 'pointed') {\n const sh = Math.max(0, h - w * Math.sqrt(3) / 2);\n P.push([-w / 2, sh, 0]);\n for (let i = 1; i < n; i++) { const a = PI - (PI / 3) * i / n; P.push([w / 2 + w * Math.cos(a), sh + w * Math.sin(a), 0]); }\n P.push([0, sh + w * Math.sqrt(3) / 2, 0]);\n for (let i = n - 1; i >= 1; i--) { const a = (PI / 3) * i / n; P.push([-w / 2 + w * Math.cos(a), sh + w * Math.sin(a), 0]); }\n P.push([w / 2, sh, 0]);\n} else if (st === 'flat') {\n P.push([-w / 2, h, 0], [w / 2, h, 0]);\n} else {\n const sh = Math.max(0, h - w / 2);\n for (let i = 0; i <= n; i++) { const a = PI - PI * i / n; P.push([Math.cos(a) * w / 2, sh + Math.sin(a) * w / 2, 0]); }\n}\nP.push([w / 2, -0.05, 0]);\naddprim(0, 'poly', P.map((p) => addpoint(0, p)));"
|
|
49
49
|
}
|
|
50
50
|
},
|
|
51
51
|
"face": {
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"in": ["none"],
|
|
74
74
|
"params": {
|
|
75
75
|
"run_over": "detail",
|
|
76
|
-
"code": "const w =
|
|
76
|
+
"code": "const w = width, h = height, t = thickness, D = depth;\nconst sh = style === 'pointed' ? Math.max(0, h - w * Math.sqrt(3) / 2) : style === 'flat' ? h : Math.max(0, h - w / 2);\nconst add = (p, s) => { const q = addpoint(0, p); setpointattrib(0, 'scale', q, s); };\nadd([0, h + t * 0.55, 0], [Math.min(t * 0.8, w * 0.3), t * 1.1, D + 0.04]);\nif (style !== 'flat') for (const sx of [-1, 1]) add([sx * (w / 2 + t / 2), sh - 0.06, 0], [t + 0.08, 0.12, D + 0.04]);"
|
|
77
77
|
}
|
|
78
78
|
},
|
|
79
79
|
"unit": { "type": "box" },
|
|
@@ -101,8 +101,8 @@
|
|
|
101
101
|
"out": { "type": "attrib_delete", "in": ["paint"], "params": { "names": "copynum", "groups": "*" } }
|
|
102
102
|
},
|
|
103
103
|
"output": "out",
|
|
104
|
+
"outputs": { "arch": { "node": "out", "label": "Arch", "kind": "mesh", "tags": ["arch", "opening", "masonry", "stone", "modular"] } },
|
|
104
105
|
"meta": {
|
|
105
|
-
"shelf_group": "architecture",
|
|
106
106
|
"watertight": true,
|
|
107
107
|
"thumbnail_render": { "azimuth": 25, "elevation": 15 }
|
|
108
108
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 1,
|
|
3
|
-
"description": "Planar truss in the XY plane: top and bottom chords, verticals and diagonals in Warren, Pratt or Howe layout, swept with a steel I-section or a square timber section. Spans x = -
|
|
3
|
+
"description": "Planar truss in the XY plane: top and bottom chords, verticals and diagonals in Warren, Pratt or Howe layout, swept with a steel I-section or a square timber section. Spans x = -span/2 … span/2. Pivot at the centre of the bottom chord's underside. Pieces: truss_chords, truss_web (steel or wood_dark). Every member is closed.",
|
|
4
4
|
"params": {
|
|
5
|
-
"
|
|
5
|
+
"span": { "type": "float", "default": 8, "min": 1, "max": 40, "desc": "span along X (m)" },
|
|
6
6
|
"height": {
|
|
7
7
|
"type": "float",
|
|
8
8
|
"default": 1.2,
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"steel": { "type": "bool", "default": true, "desc": "steel I-sections (false = square timber)" }
|
|
28
28
|
},
|
|
29
|
-
"vars": { "
|
|
29
|
+
"vars": { "span": 8, "height": 1.2, "panels": 6, "member_size": 0.12, "layout": "warren", "steel": true },
|
|
30
30
|
"nodes": {
|
|
31
31
|
"none": { "type": "points", "params": { "positions": [] } },
|
|
32
32
|
"chord_lines": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"in": ["none"],
|
|
35
35
|
"params": {
|
|
36
36
|
"run_over": "detail",
|
|
37
|
-
"code": "const L =
|
|
37
|
+
"code": "const L = span, H = height, y0 = member_size / 2;\nfor (const y of [y0, y0 + H]) addprim(0, 'polyline', [addpoint(0, [-L / 2, y, 0]), addpoint(0, [L / 2, y, 0])]);"
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
40
|
"web_lines": {
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"note": "warren: alternating diagonals; pratt: verticals + diagonals sloping down to the middle; howe: verticals + diagonals sloping up to the middle",
|
|
44
44
|
"params": {
|
|
45
45
|
"run_over": "detail",
|
|
46
|
-
"code": "const L =
|
|
46
|
+
"code": "const L = span, H = height, n = Math.max(2, Math.round(panels)), y0 = member_size / 2, y1 = y0 + H, p = L / n;\nconst line = (x0, ya, x1, yb) => addprim(0, 'polyline', [addpoint(0, [x0, ya, 0]), addpoint(0, [x1, yb, 0])]);\nconst X = (i) => -L / 2 + i * p;\nif (layout === 'warren') {\n for (let i = 0; i < n; i++) i % 2 === 0 ? line(X(i), y0, X(i + 1), y1) : line(X(i), y1, X(i + 1), y0);\n} else {\n for (let i = 0; i <= n; i++) line(X(i), y0, X(i), y1);\n for (let i = 0; i < n; i++) {\n const left = X(i) + p / 2 < 0;\n const downToMiddle = layout === 'pratt';\n if (left === downToMiddle) line(X(i), y1, X(i + 1), y0); else line(X(i), y0, X(i + 1), y1);\n }\n}"
|
|
47
47
|
}
|
|
48
48
|
},
|
|
49
49
|
"i_section": {
|
|
@@ -101,8 +101,8 @@
|
|
|
101
101
|
"out": { "type": "attrib_delete", "in": ["paint"], "params": { "groups": "*" } }
|
|
102
102
|
},
|
|
103
103
|
"output": "out",
|
|
104
|
+
"outputs": { "beam_truss": { "node": "out", "label": "Truss", "kind": "mesh", "tags": ["truss", "beam", "structural", "steel", "timber", "industrial"] } },
|
|
104
105
|
"meta": {
|
|
105
|
-
"shelf_group": "architecture",
|
|
106
106
|
"watertight": true,
|
|
107
107
|
"thumbnail_render": { "azimuth": 12, "elevation": 12, "zoom": 0.95 }
|
|
108
108
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 1,
|
|
3
|
-
"description": "Brick wall from x = 0 to x =
|
|
3
|
+
"description": "Brick wall from x = 0 to x = wall_length: individual bricks in running, stack, English or Flemish bond, cut to the wall ends and top, with random offset, yaw and tint, standing slightly proud of a recessed mortar core. One wythe deep (headers are drawn as half bricks). Pivot at the start of the wall, on the ground, centred in thickness. Pieces: brick_wall_bricks (brick), brick_wall_mortar (mortar). Every piece is a closed box.",
|
|
4
4
|
"params": {
|
|
5
|
-
"
|
|
5
|
+
"wall_length": { "type": "float", "default": 3, "min": 0.3, "max": 40, "desc": "length along X (m)" },
|
|
6
6
|
"height": { "type": "float", "default": 1.8, "min": 0.1, "max": 5, "desc": "height (m)" },
|
|
7
7
|
"brick_length": {
|
|
8
8
|
"type": "float",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"seed": { "type": "int", "default": 0, "min": 0, "max": 1000, "desc": "random seed" }
|
|
30
30
|
},
|
|
31
31
|
"vars": {
|
|
32
|
-
"
|
|
32
|
+
"wall_length": 3,
|
|
33
33
|
"height": 1.8,
|
|
34
34
|
"brick_length": 0.215,
|
|
35
35
|
"brick_height": 0.065,
|
|
@@ -43,10 +43,10 @@
|
|
|
43
43
|
"brick_pts": {
|
|
44
44
|
"type": "wrangle",
|
|
45
45
|
"in": ["none"],
|
|
46
|
-
"note": "lay each course left to right from the bond's unit sequence and start offset, clipping bricks at x = 0, x =
|
|
46
|
+
"note": "lay each course left to right from the bond's unit sequence and start offset, clipping bricks at x = 0, x = wall_length and the top",
|
|
47
47
|
"params": {
|
|
48
48
|
"run_over": "detail",
|
|
49
|
-
"code": "const L =
|
|
49
|
+
"code": "const L = wall_length, H = height, S = brick_length, bh = brick_height, m = mortar, d = (S - m) / 2, hd = (S - m) / 2, s = seed, j = jitter;\nconst rows = Math.ceil((H + m) / (bh + m));\nfor (let r = 0; r < rows; r++) {\n const y0 = r * (bh + m), y1 = Math.min(H, y0 + bh);\n if (y1 - y0 < 0.004) break;\n const odd = r % 2 === 1;\n let units, off;\n if (bond === 'stack') { units = [S]; off = 0; }\n else if (bond === 'english') { units = odd ? [hd] : [S]; off = odd ? -(hd + m) / 2 : 0; }\n else if (bond === 'flemish') { units = [S, hd]; off = odd ? -((S + m) / 2 + (hd + m) / 2) : 0; }\n else { units = [S]; off = odd ? -(S + m) / 2 : 0; }\n let x = off, k = 0;\n while (x < L) {\n const u = units[k % units.length], x0 = Math.max(0, x), x1 = Math.min(L, x + u);\n if (x1 - x0 > 0.01) {\n const id = r * 1000 + k;\n const q = addpoint(0, [(x0 + x1) / 2, (y0 + y1) / 2, (rand(id, s, 1) - 0.5) * 0.004 * j]);\n setpointattrib(0, 'scale', q, [x1 - x0, y1 - y0, d]);\n setpointattrib(0, 'orient', q, quaternion(radians((rand(id, s, 2) - 0.5) * 1.6 * j), [0, 1, 0]));\n setpointattrib(0, 'tint', q, 0.78 + 0.4 * rand(id, s, 3));\n }\n x += u + m; k++;\n }\n}"
|
|
50
50
|
}
|
|
51
51
|
},
|
|
52
52
|
"unit": { "type": "box" },
|
|
@@ -64,8 +64,8 @@
|
|
|
64
64
|
"mortar_geo": {
|
|
65
65
|
"type": "box",
|
|
66
66
|
"params": {
|
|
67
|
-
"size": ["=Math.max(0.001,
|
|
68
|
-
"center": ["=
|
|
67
|
+
"size": ["=Math.max(0.001, wall_length - 0.004)", "=Math.max(0.001, height - 0.004)", "=(brick_length - mortar) / 2 - 0.012"],
|
|
68
|
+
"center": ["=wall_length / 2", "=height / 2", 0]
|
|
69
69
|
}
|
|
70
70
|
},
|
|
71
71
|
"mortar_name": {
|
|
@@ -90,8 +90,8 @@
|
|
|
90
90
|
"out": { "type": "attrib_delete", "in": ["paint"], "params": { "names": "tint scale orient copynum" } }
|
|
91
91
|
},
|
|
92
92
|
"output": "out",
|
|
93
|
+
"outputs": { "brick_wall": { "node": "out", "label": "Brick wall", "kind": "mesh", "tags": ["wall", "brick", "masonry", "modular"] } },
|
|
93
94
|
"meta": {
|
|
94
|
-
"shelf_group": "architecture",
|
|
95
95
|
"watertight": true,
|
|
96
96
|
"thumbnail_render": { "azimuth": 25, "elevation": 15 }
|
|
97
97
|
}
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"in": ["none"],
|
|
30
30
|
"params": {
|
|
31
31
|
"run_over": "detail",
|
|
32
|
-
"code": "const W =
|
|
32
|
+
"code": "const W = width, H = height, D = depth, f = Math.min(frame_width, W / 4);\nconst add = (p, s) => { const q = addpoint(0, p); setpointattrib(0, 'scale', q, s); };\nadd([-(W - f) / 2, H / 2, 0], [f, H, D]); add([(W - f) / 2, H / 2, 0], [f, H, D]); add([0, H - f / 2, 0], [W - 2 * f, f, D]);"
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
35
|
"leaf_pts": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"note": "the leaf, then raised panels on both faces",
|
|
39
39
|
"params": {
|
|
40
40
|
"run_over": "detail",
|
|
41
|
-
"code": "const W =
|
|
41
|
+
"code": "const W = width, H = height, f = Math.min(frame_width, W / 4), t = 0.045;\nconst lw = W - 2 * f - 0.006, lh = H - f - 0.012, n = Math.round(panels), mx = Math.min(0.12, lw * 0.15), my = 0.12;\nconst add = (p, s) => { const q = addpoint(0, p); setpointattrib(0, 'scale', q, s); };\nadd([0, 0.008 + lh / 2, 0], [lw, lh, t]);\nconst ph = (lh - my * (n + 1)) / Math.max(1, n);\nfor (let i = 0; i < n; i++) for (const sz of [-1, 1]) add([0, 0.008 + my + i * (ph + my) + ph / 2, sz * (t / 2 + 0.006)], [lw - 2 * mx, ph, 0.012]);"
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
44
|
"unit": { "type": "box" },
|
|
@@ -103,8 +103,8 @@
|
|
|
103
103
|
"out": { "type": "attrib_delete", "in": ["paint"], "params": { "names": "copynum" } }
|
|
104
104
|
},
|
|
105
105
|
"output": "out",
|
|
106
|
+
"outputs": { "door_frame": { "node": "out", "label": "Door", "kind": "mesh", "tags": ["door", "wall-opening", "modular", "building"] } },
|
|
106
107
|
"meta": {
|
|
107
|
-
"shelf_group": "architecture",
|
|
108
108
|
"watertight": true,
|
|
109
109
|
"thumbnail_render": { "azimuth": 30, "elevation": 12 }
|
|
110
110
|
}
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"note": "flat-topped hex lattice: columns 1.5 r apart, rows sqrt(3) r apart, odd columns shifted half a row",
|
|
34
34
|
"params": {
|
|
35
35
|
"run_over": "detail",
|
|
36
|
-
"code": "const X =
|
|
36
|
+
"code": "const X = size_x, Z = size_z, r = radius, g = Math.min(gap, r), s = seed;\nconst dx = 1.5 * r, dz = Math.sqrt(3) * r, nx = Math.floor(X / 2 / dx) + 1, nz = Math.floor(Z / 2 / dz) + 1;\nconst k = (r - g / Math.sqrt(3)) / r;\nfor (let i = -nx; i <= nx; i++) for (let j = -nz - 1; j <= nz; j++) {\n const x = i * dx, z = j * dz + (Math.abs(i) % 2 ? dz / 2 : 0);\n if (Math.abs(x) > X / 2 || Math.abs(z) > Z / 2) continue;\n const h = Math.max(0.005, height + (rand(i, j, s) - 0.5) * 2 * height_jitter);\n const q = addpoint(0, [x, 0, z]);\n setpointattrib(0, 'scale', q, [r * k, h, r * k]);\n setpointattrib(0, 'tint', q, 0.78 + 0.35 * rand(i, j, s, 2));\n}"
|
|
37
37
|
}
|
|
38
38
|
},
|
|
39
39
|
"hex": {
|
|
@@ -62,5 +62,6 @@
|
|
|
62
62
|
"out": { "type": "attrib_delete", "in": ["paint"], "params": { "names": "tint scale copynum" } }
|
|
63
63
|
},
|
|
64
64
|
"output": "out",
|
|
65
|
-
"
|
|
65
|
+
"outputs": { "hex_grid_floor": { "node": "out", "label": "Hexagonal paving", "kind": "mesh", "tags": ["floor", "paving", "hexagonal", "tiles"] } },
|
|
66
|
+
"meta": { "watertight": true, "thumbnail_render": { "elevation": 40 } }
|
|
66
67
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"description": "House built from a footprint polygon: one wall_segment per footprint edge (facing outward, floors stacked, a door on the first edge), topped with a roof_skeleton hip roof that follows the footprint exactly (straight skeleton: L-shapes, courtyards and any simple polygon get correct valleys and ridges). Input 0 is an optional closed polygon on the XZ ground plane; without it a width × depth rectangle is used. The walls, windows, doors and roof are
|
|
2
|
+
"description": "House built from a footprint polygon: one wall_segment per footprint edge (facing outward, floors stacked, a door on the first edge), topped with a roof_skeleton hip roof that follows the footprint exactly (straight skeleton: L-shapes, courtyards and any simple polygon get correct valleys and ridges). Input 0 is an optional closed polygon on the XZ ground plane; without it a width × depth rectangle is used. The walls, windows, doors and roof are this package's own wall_segment and roof_skeleton outputs, so a change to those changes every house. Pivot: the footprint's origin on the ground. Pieces come from those outputs (wall, window_frame, door_frame, roof).",
|
|
3
3
|
"params": {
|
|
4
4
|
"width": {
|
|
5
5
|
"type": "float",
|
|
@@ -67,7 +67,6 @@
|
|
|
67
67
|
"door": true
|
|
68
68
|
},
|
|
69
69
|
"meta": {
|
|
70
|
-
"shelf_group": "architecture",
|
|
71
70
|
"pivot": "footprint origin, ground",
|
|
72
71
|
"thumbnail_render": {
|
|
73
72
|
"azimuth": 30,
|
|
@@ -134,18 +133,18 @@
|
|
|
134
133
|
}
|
|
135
134
|
},
|
|
136
135
|
"ground": {
|
|
137
|
-
"type": "wall_segment",
|
|
136
|
+
"type": "topotopo/architecture/wall_segment",
|
|
138
137
|
"params": {
|
|
139
|
-
"
|
|
138
|
+
"wall_length": "=prim('piece', 0, 'len')",
|
|
140
139
|
"height": "=floor_height",
|
|
141
140
|
"windows": "=max(0, floor(prim('piece', 0, 'len') / window_spacing))",
|
|
142
141
|
"door": "=door && iteration == 0"
|
|
143
142
|
}
|
|
144
143
|
},
|
|
145
144
|
"upper": {
|
|
146
|
-
"type": "wall_segment",
|
|
145
|
+
"type": "topotopo/architecture/wall_segment",
|
|
147
146
|
"params": {
|
|
148
|
-
"
|
|
147
|
+
"wall_length": "=prim('piece', 0, 'len')",
|
|
149
148
|
"height": "=floor_height",
|
|
150
149
|
"windows": "=max(0, floor(prim('piece', 0, 'len') / window_spacing))",
|
|
151
150
|
"door": false
|
|
@@ -222,7 +221,7 @@
|
|
|
222
221
|
}
|
|
223
222
|
},
|
|
224
223
|
"roof": {
|
|
225
|
-
"type": "roof_skeleton",
|
|
224
|
+
"type": "topotopo/architecture/roof_skeleton",
|
|
226
225
|
"in": [
|
|
227
226
|
"fp"
|
|
228
227
|
],
|
|
@@ -252,5 +251,6 @@
|
|
|
252
251
|
]
|
|
253
252
|
}
|
|
254
253
|
},
|
|
255
|
-
"output": "out"
|
|
254
|
+
"output": "out",
|
|
255
|
+
"outputs": { "house": { "node": "out", "label": "House", "kind": "mesh", "tags": ["house", "building", "residential", "footprint", "modular"] } }
|
|
256
256
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "TopoTopo's architecture package, its 17 outputs side by side at their defaults. The package's default output and its preview, from arch to window_frame along +X, 1 m apart.",
|
|
3
|
+
"nodes": {
|
|
4
|
+
"arch": {"type":"topotopo/architecture/arch"},
|
|
5
|
+
"arch_at": {"type":"transform","in":["arch"],"params":{"translate":[1.54,0,0]}},
|
|
6
|
+
"beam_truss": {"type":"topotopo/architecture/beam_truss"},
|
|
7
|
+
"beam_truss_at": {"type":"transform","in":["beam_truss"],"params":{"translate":[8.11,0,0]}},
|
|
8
|
+
"brick_wall": {"type":"topotopo/architecture/brick_wall"},
|
|
9
|
+
"brick_wall_at": {"type":"transform","in":["brick_wall"],"params":{"translate":[13.14,0,0]}},
|
|
10
|
+
"door_frame": {"type":"topotopo/architecture/door_frame"},
|
|
11
|
+
"door_frame_at": {"type":"transform","in":["door_frame"],"params":{"translate":[17.641,0,0]}},
|
|
12
|
+
"hex_grid_floor": {"type":"topotopo/architecture/hex_grid_floor"},
|
|
13
|
+
"hex_grid_floor_at": {"type":"transform","in":["hex_grid_floor"],"params":{"translate":[21.679,0,0]}},
|
|
14
|
+
"house": {"type":"topotopo/architecture/house"},
|
|
15
|
+
"house_at": {"type":"transform","in":["house"],"params":{"translate":[29.753,0,0]}},
|
|
16
|
+
"pillar": {"type":"topotopo/architecture/pillar"},
|
|
17
|
+
"pillar_at": {"type":"transform","in":["pillar"],"params":{"translate":[35.597,0,0]}},
|
|
18
|
+
"railing": {"type":"topotopo/architecture/railing"},
|
|
19
|
+
"railing_at": {"type":"transform","in":["railing"],"params":{"translate":[36.933,0,0]}},
|
|
20
|
+
"roof_gable": {"type":"topotopo/architecture/roof_gable"},
|
|
21
|
+
"roof_gable_at": {"type":"transform","in":["roof_gable"],"params":{"translate":[46.382,0,0]}},
|
|
22
|
+
"roof_hip": {"type":"topotopo/architecture/roof_hip"},
|
|
23
|
+
"roof_hip_at": {"type":"transform","in":["roof_hip"],"params":{"translate":[56.302,0,0]}},
|
|
24
|
+
"roof_skeleton": {"type":"topotopo/architecture/roof_skeleton"},
|
|
25
|
+
"roof_skeleton_at": {"type":"transform","in":["roof_skeleton"],"params":{"translate":[66.237,0,0]}},
|
|
26
|
+
"scaffold": {"type":"topotopo/architecture/scaffold"},
|
|
27
|
+
"scaffold_at": {"type":"transform","in":["scaffold"],"params":{"translate":[71.822,0,0]}},
|
|
28
|
+
"spiral_stairs": {"type":"topotopo/architecture/spiral_stairs"},
|
|
29
|
+
"spiral_stairs_at": {"type":"transform","in":["spiral_stairs"],"params":{"translate":[80.379,0,0]}},
|
|
30
|
+
"stairs": {"type":"topotopo/architecture/stairs"},
|
|
31
|
+
"stairs_at": {"type":"transform","in":["stairs"],"params":{"translate":[83.086,0,0]}},
|
|
32
|
+
"tile_floor": {"type":"topotopo/architecture/tile_floor"},
|
|
33
|
+
"tile_floor_at": {"type":"transform","in":["tile_floor"],"params":{"translate":[86.686,0,0]}},
|
|
34
|
+
"wall_segment": {"type":"topotopo/architecture/wall_segment"},
|
|
35
|
+
"wall_segment_at": {"type":"transform","in":["wall_segment"],"params":{"translate":[89.686,0,0]}},
|
|
36
|
+
"window_frame": {"type":"topotopo/architecture/window_frame"},
|
|
37
|
+
"window_frame_at": {"type":"transform","in":["window_frame"],"params":{"translate":[95.236,0,0]}},
|
|
38
|
+
"lineup": {"type":"merge","in":["arch_at","beam_truss_at","brick_wall_at","door_frame_at","hex_grid_floor_at","house_at","pillar_at","railing_at","roof_gable_at","roof_hip_at","roof_skeleton_at","scaffold_at","spiral_stairs_at","stairs_at","tile_floor_at","wall_segment_at","window_frame_at"]}
|
|
39
|
+
},
|
|
40
|
+
"output": "lineup",
|
|
41
|
+
"outputs": {"lineup":{"node":"lineup","label":"Architecture line-up","kind":"mesh","tags":["lineup","architecture"]}}
|
|
42
|
+
}
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"type": "wrangle",
|
|
38
38
|
"in": ["round_shaft"],
|
|
39
39
|
"params": {
|
|
40
|
-
"code": "if (
|
|
40
|
+
"code": "if (style !== 'fluted') return; const a = Math.atan2(@P.z, @P.x), r = Math.hypot(@P.x, @P.z), k = 1 - 0.06 * Math.pow(Math.abs(Math.cos(a * flutes / 2)), 2); @P.x = Math.cos(a) * r * k; @P.z = Math.sin(a) * r * k;"
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
43
|
"square_shaft": { "type": "box", "params": { "size": ["=radius * 2", 1, "=radius * 2"], "center": [0, 0.5, 0] } },
|
|
@@ -133,5 +133,6 @@
|
|
|
133
133
|
"out": { "type": "normal", "in": ["paint"], "params": { "cusp_angle": 50 } }
|
|
134
134
|
},
|
|
135
135
|
"output": "out",
|
|
136
|
-
"
|
|
136
|
+
"outputs": { "pillar": { "node": "out", "label": "Pillar", "kind": "mesh", "tags": ["pillar", "column", "classical", "stone"] } },
|
|
137
|
+
"meta": { "watertight": true, "thumbnail_render": { "elevation": 15 } }
|
|
137
138
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 1,
|
|
3
|
-
"description": "Railing along a curve (input 0; without one, a straight run of `
|
|
3
|
+
"description": "Railing along a curve (input 0; without one, a straight run of `run_length` along +X from the origin): posts at even spacing including both ends, a handrail on top, lower rails and balusters. Sits on the curve (pivot = the curve). Pieces: railing_posts, railing_rails, railing_balusters (all metal_dark).",
|
|
4
4
|
"params": {
|
|
5
|
-
"
|
|
5
|
+
"run_length": {
|
|
6
6
|
"type": "float",
|
|
7
7
|
"default": 4,
|
|
8
8
|
"min": 0.5,
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
47
|
"vars": {
|
|
48
|
-
"
|
|
48
|
+
"run_length": 4,
|
|
49
49
|
"height": 1,
|
|
50
50
|
"post_spacing": 1.5,
|
|
51
51
|
"baluster_spacing": 0.15,
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"curve_in": { "type": "input", "params": { "index": 0, "label": "curve to follow (polyline); optional" } },
|
|
57
57
|
"straight": {
|
|
58
58
|
"type": "line",
|
|
59
|
-
"params": { "origin": [0, 0, 0], "direction": [1, 0, 0], "length": "=
|
|
59
|
+
"params": { "origin": [0, 0, 0], "direction": [1, 0, 0], "length": "=run_length", "points": 2 }
|
|
60
60
|
},
|
|
61
61
|
"path": {
|
|
62
62
|
"type": "switch",
|
|
@@ -156,8 +156,8 @@
|
|
|
156
156
|
}
|
|
157
157
|
},
|
|
158
158
|
"output": "out",
|
|
159
|
+
"outputs": { "railing": { "node": "out", "label": "Railing", "kind": "mesh", "tags": ["railing", "balustrade", "along-curve", "metal"] } },
|
|
159
160
|
"meta": {
|
|
160
|
-
"shelf_group": "architecture",
|
|
161
161
|
"pivot": "curve",
|
|
162
162
|
"inputs": ["curve"],
|
|
163
163
|
"thumbnail_render": { "elevation": 25, "zoom": 1.3 }
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"note": "the slab cross-section (a thick Λ) in the ZY plane; its underside passes through the wall-top edges",
|
|
31
31
|
"params": {
|
|
32
32
|
"run_over": "detail",
|
|
33
|
-
"code": "const B =
|
|
33
|
+
"code": "const B = depth / 2 + overhang, s = Math.tan(radians(pitch)), tc = thickness / Math.cos(radians(pitch));\nconst h = depth / 2 * s, ye = -overhang * s;\nconst P = [[0, ye, -B], [0, ye + tc, -B], [0, h + tc, 0], [0, ye + tc, B], [0, ye, B], [0, h, 0]];\naddprim(0, 'poly', P.map((p) => addpoint(0, p)));"
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
"slab": {
|
|
@@ -119,8 +119,8 @@
|
|
|
119
119
|
"out": { "type": "attrib_delete", "in": ["paint"], "params": { "groups": "*" } }
|
|
120
120
|
},
|
|
121
121
|
"output": "out",
|
|
122
|
+
"outputs": { "roof_gable": { "node": "out", "label": "Gable roof", "kind": "mesh", "tags": ["roof", "gable-roof", "building", "modular"] } },
|
|
122
123
|
"meta": {
|
|
123
|
-
"shelf_group": "architecture",
|
|
124
124
|
"watertight": true,
|
|
125
125
|
"pivot": "wall_top",
|
|
126
126
|
"thumbnail_render": { "elevation": 25 }
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"note": "soffit, four fascia quads, two slopes and two hip ends around a ridge along the longer side; prim groups tiles, fascia",
|
|
30
30
|
"params": {
|
|
31
31
|
"run_over": "detail",
|
|
32
|
-
"code": "const swap =
|
|
32
|
+
"code": "const swap = depth > width, a = swap ? depth : width, b = swap ? width : depth, o = overhang;\nconst s = Math.tan(radians(pitch)), tc = thickness / Math.cos(radians(pitch));\nconst A = a / 2 + o, B = b / 2 + o, ye = -o * s, yt = b / 2 * s + tc, rl = Math.max(0, a / 2 - b / 2);\nconst P = (x, y, z) => addpoint(0, swap ? [z, y, x] : [x, y, z]);\nconst b0 = P(-A, ye, -B), b1 = P(A, ye, -B), b2 = P(A, ye, B), b3 = P(-A, ye, B);\nconst e0 = P(-A, ye + tc, -B), e1 = P(A, ye + tc, -B), e2 = P(A, ye + tc, B), e3 = P(-A, ye + tc, B);\nconst r0 = P(-rl, yt, 0), r1 = rl > 1e-6 ? P(rl, yt, 0) : r0;\nconst face = (pts, grp) => { const u = pts.filter((p, i) => pts.indexOf(p) === i); const pr = addprim(0, 'poly', swap ? u.slice().reverse() : u); setprimgroup(0, grp, pr, 1); };\nface([b0, b1, b2, b3], 'fascia');\nface([b3, b2, e2, e3], 'fascia'); face([b1, b0, e0, e1], 'fascia'); face([b2, b1, e1, e2], 'fascia'); face([b0, b3, e3, e0], 'fascia');\nface([e3, e2, r1, r0], 'tiles'); face([e1, e0, r0, r1], 'tiles'); face([e2, e1, r1], 'tiles'); face([e0, e3, r0], 'tiles');"
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
35
|
"solid_name": {
|
|
@@ -86,8 +86,8 @@
|
|
|
86
86
|
"out": { "type": "attrib_delete", "in": ["paint"], "params": { "groups": "*" } }
|
|
87
87
|
},
|
|
88
88
|
"output": "out",
|
|
89
|
+
"outputs": { "roof_hip": { "node": "out", "label": "Hip roof", "kind": "mesh", "tags": ["roof", "hip-roof", "building", "modular"] } },
|
|
89
90
|
"meta": {
|
|
90
|
-
"shelf_group": "architecture",
|
|
91
91
|
"watertight": true,
|
|
92
92
|
"pivot": "wall_top",
|
|
93
93
|
"thumbnail_render": { "elevation": 30 }
|