topotopo 0.4.0 → 0.5.1
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 +327 -147
- 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 +198 -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 +57 -5
- package/dist/render/preview.d.ts +17 -4
- package/dist/render/preview.js +6 -4
- package/dist/render/raster.d.ts +74 -5
- package/dist/render/raster.js +527 -143
- 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 +13 -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
package/dist/host/node.d.ts
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import type { Host } from './types.ts';
|
|
2
2
|
import type { NodePoolOptions } from './pool.ts';
|
|
3
|
-
/**
|
|
4
|
-
* The repository's asset shelf (shelf/index.json + one graph per asset). Paths relative to this module hold for the
|
|
5
|
-
* sources (src/host) and for the built package (dist/host): both sit two levels below the package root.
|
|
6
|
-
*/
|
|
7
|
-
export declare const SHELF_DIR: string;
|
|
8
3
|
/** Executable lookup shared by conversion and integration tests. An unavailable installation returns null. */
|
|
9
4
|
export declare function findBlender(): Promise<string | null>;
|
|
5
|
+
/**
|
|
6
|
+
* The folder relative file paths resolve against, for a graph (or a session's folder) in `dir`: its package folder, the nearest
|
|
7
|
+
* folder at or above `dir` with a .topo file, else `dir` itself. One rule for the CLI (the graph file's folder), the
|
|
8
|
+
* MCP server (its folder) and the viewer (the graph file's folder): a graph in a package's graphs/ reads
|
|
9
|
+
* "inputs/ref.png" from the package's inputs/, wherever it is cooked from, and exports into the package's exports/
|
|
10
|
+
* (export-targets.ts exportsFolderFor).
|
|
11
|
+
*/
|
|
12
|
+
export declare function packageBaseDir(dir: string): string;
|
|
10
13
|
export interface NodeHostOptions {
|
|
14
|
+
/** the graph's (or the session's) folder: relative paths resolve against its package folder (packageBaseDir) */
|
|
11
15
|
baseDir?: string;
|
|
12
|
-
/** shelf directory (default SHELF_DIR), or false for an engine without the shelf */
|
|
13
|
-
shelf?: string | false;
|
|
14
16
|
/**
|
|
15
17
|
* Worker threads for Host.pool. Default: TOPOTOPO_WORKERS (availableParallelism() - 1 when unset), shared by every
|
|
16
18
|
* host of the process; a number gives this host its own pool (0 = none).
|
|
@@ -26,3 +28,6 @@ export interface NodeHostOptions {
|
|
|
26
28
|
}) => void;
|
|
27
29
|
}
|
|
28
30
|
export declare function createNodeHost(opts?: NodeHostOptions): Host;
|
|
31
|
+
export { openPackage } from '../open.ts';
|
|
32
|
+
export type { OpenOptions, Opened } from '../open.ts';
|
|
33
|
+
export { openPackages, PackageUses } from '../packages/registry.ts';
|
package/dist/host/node.js
CHANGED
|
@@ -7,6 +7,7 @@ import { execFile } from 'node:child_process';
|
|
|
7
7
|
import { createHash } from 'node:crypto';
|
|
8
8
|
import { fileURLToPath } from 'node:url';
|
|
9
9
|
import { createNodePool, poolOptionsFromEnv } from './pool.js';
|
|
10
|
+
import { packageFolderOf } from './export-targets.js';
|
|
10
11
|
import { REALM_CONTROL, SCRIPT_REALM_SETUP } from '../core/snippet-lib.js';
|
|
11
12
|
import { makeCurl, makeNoise } from '../core/noise.js';
|
|
12
13
|
import { randN } from '../core/random.js';
|
|
@@ -30,11 +31,6 @@ function filterRealmRejections() {
|
|
|
30
31
|
throw reason;
|
|
31
32
|
});
|
|
32
33
|
}
|
|
33
|
-
/**
|
|
34
|
-
* The repository's asset shelf (shelf/index.json + one graph per asset). Paths relative to this module hold for the
|
|
35
|
-
* sources (src/host) and for the built package (dist/host): both sit two levels below the package root.
|
|
36
|
-
*/
|
|
37
|
-
export const SHELF_DIR = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../shelf');
|
|
38
34
|
/** No shell: executable paths and file names are passed as separate arguments on every platform. */
|
|
39
35
|
function runBlender(executable, args, timeout) {
|
|
40
36
|
return new Promise((resolve, reject) => {
|
|
@@ -78,11 +74,21 @@ function blenderScript() {
|
|
|
78
74
|
}
|
|
79
75
|
throw new Error('Blender conversion script export_scene.py is missing from this TopoTopo installation');
|
|
80
76
|
}
|
|
81
|
-
/** opts.shelf: shelf directory (default SHELF_DIR), or false for an engine without the shelf. */
|
|
82
77
|
/** The process-wide pool of hosts created with the environment's settings (created lazily: no thread until used). */
|
|
83
78
|
let envPool = null;
|
|
79
|
+
/**
|
|
80
|
+
* The folder relative file paths resolve against, for a graph (or a session's folder) in `dir`: its package folder, the nearest
|
|
81
|
+
* folder at or above `dir` with a .topo file, else `dir` itself. One rule for the CLI (the graph file's folder), the
|
|
82
|
+
* MCP server (its folder) and the viewer (the graph file's folder): a graph in a package's graphs/ reads
|
|
83
|
+
* "inputs/ref.png" from the package's inputs/, wherever it is cooked from, and exports into the package's exports/
|
|
84
|
+
* (export-targets.ts exportsFolderFor).
|
|
85
|
+
*/
|
|
86
|
+
export function packageBaseDir(dir) {
|
|
87
|
+
// the package lookup is the one export targets use (exports/ of the same folder): one function for both rules
|
|
88
|
+
return packageFolderOf(dir) ?? path.resolve(dir);
|
|
89
|
+
}
|
|
84
90
|
export function createNodeHost(opts = {}) {
|
|
85
|
-
const baseDir = opts.baseDir ?? process.cwd();
|
|
91
|
+
const baseDir = packageBaseDir(opts.baseDir ?? process.cwd());
|
|
86
92
|
const conversions = new Map();
|
|
87
93
|
let pool;
|
|
88
94
|
if (opts.workers === undefined && !opts.pool) {
|
|
@@ -201,6 +207,7 @@ export function createNodeHost(opts = {}) {
|
|
|
201
207
|
const defaults = ['arial.ttf', 'Arial.ttf', 'segoeui.ttf', 'DejaVuSans.ttf', 'LiberationSans-Regular.ttf', 'Roboto-Regular.ttf', 'NotoSans-Regular.ttf'];
|
|
202
208
|
// The bundled font makes the text node deterministic across machines; system fonts only serve explicit names.
|
|
203
209
|
const bundledFont = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../assets/fonts/DejaVuSans.ttf');
|
|
210
|
+
const resolveIn = (dir) => (p) => (/^https?:\/\//.test(p) || path.isAbsolute(p) ? p : path.resolve(dir, p));
|
|
204
211
|
const findIn = (dir, pred, depth = 0) => {
|
|
205
212
|
let entries;
|
|
206
213
|
try {
|
|
@@ -223,9 +230,8 @@ export function createNodeHost(opts = {}) {
|
|
|
223
230
|
};
|
|
224
231
|
return {
|
|
225
232
|
name: 'node',
|
|
226
|
-
shelfPath: opts.shelf === false ? undefined : opts.shelf ?? SHELF_DIR,
|
|
227
233
|
pool,
|
|
228
|
-
resolvePath: (
|
|
234
|
+
resolvePath: resolveIn(baseDir),
|
|
229
235
|
async readFile(p) {
|
|
230
236
|
const rp = this.resolvePath(p);
|
|
231
237
|
if (/^https?:\/\//.test(rp)) {
|
|
@@ -316,6 +322,12 @@ export function createNodeHost(opts = {}) {
|
|
|
316
322
|
conversions.delete(key);
|
|
317
323
|
}
|
|
318
324
|
},
|
|
325
|
+
filesAt(dir) {
|
|
326
|
+
// every file method resolves its paths with this.resolvePath, so next to another resolvePath it reads that folder;
|
|
327
|
+
// conversions are still cached under baseDir
|
|
328
|
+
const { readFile, fileStamp, isDirectory, listDir, convertFile, findFont, fontCandidates } = this;
|
|
329
|
+
return { resolvePath: resolveIn(path.resolve(baseDir, dir)), readFile, fileStamp, isDirectory, listDir, convertFile, findFont, fontCandidates };
|
|
330
|
+
},
|
|
319
331
|
compile(source) {
|
|
320
332
|
if (source === 'globalThis')
|
|
321
333
|
return realmGlobal;
|
|
@@ -433,3 +445,9 @@ export function createNodeHost(opts = {}) {
|
|
|
433
445
|
},
|
|
434
446
|
};
|
|
435
447
|
}
|
|
448
|
+
// Packages and the packages they use, for scripts that cook outside the CLI and the MCP server (a world generator): open a
|
|
449
|
+
// package (its packages, graphs and assets in the engine's root scope), add what a graph names on first use, cook.
|
|
450
|
+
// const engine = new Engine(createNodeHost({ baseDir: dir })); await engine.init();
|
|
451
|
+
// const { packages } = openPackage(engine, dir); packages.addFor(graph); await engine.cook(graph);
|
|
452
|
+
export { openPackage } from '../open.js';
|
|
453
|
+
export { openPackages, PackageUses } from '../packages/registry.js';
|
package/dist/host/pool.js
CHANGED
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
//
|
|
8
8
|
// Workers start on demand (no thread exists until the first task), one task each at a time. Idle workers do not
|
|
9
9
|
// keep the process alive (unref) and stop after the idle time. A kernel error rejects its task with the kernel's
|
|
10
|
-
// name; a worker that crashes or exceeds the task's timeoutMs fails only that task and is replaced on demand.
|
|
10
|
+
// name; a worker that crashes or exceeds the task's timeoutMs fails only that task and is replaced on demand. A task
|
|
11
|
+
// whose stop signal is aborted (a stopped cook) fails with code STOPPED; its worker, if it had started, is replaced.
|
|
11
12
|
// If workers cannot start at all, tasks reject with code POOL_UNAVAILABLE (parallelMap then runs on the caller).
|
|
12
13
|
import os from 'node:os';
|
|
13
14
|
import { Worker } from 'node:worker_threads';
|
|
@@ -22,6 +23,7 @@ export function workersFromEnv(env = process.env) {
|
|
|
22
23
|
return Number.isFinite(n) && n > 0 ? n : 0;
|
|
23
24
|
}
|
|
24
25
|
const unavailable = (msg) => Object.assign(new Error(msg), { code: 'POOL_UNAVAILABLE' });
|
|
26
|
+
const stopped = (kernel) => Object.assign(new Error(`kernel "${kernel}" stopped`), { code: 'STOPPED' });
|
|
25
27
|
class NodeWorkerPool {
|
|
26
28
|
size;
|
|
27
29
|
minElements;
|
|
@@ -30,7 +32,8 @@ class NodeWorkerPool {
|
|
|
30
32
|
slots = [];
|
|
31
33
|
queue = [];
|
|
32
34
|
nextId = 1;
|
|
33
|
-
counters = { started: 0, tasks: 0, crashes: 0, timeouts: 0 };
|
|
35
|
+
counters = { started: 0, tasks: 0, crashes: 0, timeouts: 0, stops: 0 };
|
|
36
|
+
stopTimer;
|
|
34
37
|
/** consecutive workers that died before becoming ready */
|
|
35
38
|
startFailures = 0;
|
|
36
39
|
broken = null;
|
|
@@ -48,12 +51,56 @@ class NodeWorkerPool {
|
|
|
48
51
|
return Promise.reject(unavailable(`worker pool unavailable: ${this.broken.message}`));
|
|
49
52
|
if (!(this.size > 0))
|
|
50
53
|
return Promise.reject(unavailable('worker pool has no threads'));
|
|
54
|
+
if (task.signal?.aborted)
|
|
55
|
+
return Promise.reject(stopped(task.kernel));
|
|
51
56
|
return new Promise((resolve, reject) => {
|
|
52
57
|
this.queue.push({ id: this.nextId++, task, resolve, reject });
|
|
53
58
|
this.pump();
|
|
54
59
|
this.refresh();
|
|
60
|
+
if (task.signal)
|
|
61
|
+
this.watchStops();
|
|
55
62
|
});
|
|
56
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* Tasks with a stop signal are looked at every 50 ms while there are any: a stopped one leaves the queue, or its
|
|
66
|
+
* worker is replaced (the work it was doing is dropped).
|
|
67
|
+
*/
|
|
68
|
+
watchStops() {
|
|
69
|
+
if (this.stopTimer)
|
|
70
|
+
return;
|
|
71
|
+
this.stopTimer = setInterval(() => {
|
|
72
|
+
let watched = false;
|
|
73
|
+
for (const j of [...this.queue]) {
|
|
74
|
+
if (!j.task.signal)
|
|
75
|
+
continue;
|
|
76
|
+
watched = true;
|
|
77
|
+
if (j.task.signal.aborted) {
|
|
78
|
+
this.queue.splice(this.queue.indexOf(j), 1);
|
|
79
|
+
j.reject(stopped(j.task.kernel));
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
for (const s of [...this.slots]) {
|
|
83
|
+
const j = s.busy;
|
|
84
|
+
if (!j?.task.signal)
|
|
85
|
+
continue;
|
|
86
|
+
watched = true;
|
|
87
|
+
if (!j.task.signal.aborted)
|
|
88
|
+
continue;
|
|
89
|
+
clearTimeout(j.timer);
|
|
90
|
+
s.busy = null;
|
|
91
|
+
this.counters.stops++;
|
|
92
|
+
j.reject(stopped(j.task.kernel));
|
|
93
|
+
this.retire(s);
|
|
94
|
+
}
|
|
95
|
+
if (!watched) {
|
|
96
|
+
clearInterval(this.stopTimer);
|
|
97
|
+
this.stopTimer = undefined;
|
|
98
|
+
}
|
|
99
|
+
this.pump();
|
|
100
|
+
this.refresh();
|
|
101
|
+
}, 50);
|
|
102
|
+
this.stopTimer.unref?.();
|
|
103
|
+
}
|
|
57
104
|
stats() {
|
|
58
105
|
return {
|
|
59
106
|
workers: this.slots.length, busy: this.slots.filter((s) => s.busy).length, queued: this.queue.length,
|
|
@@ -83,6 +130,8 @@ class NodeWorkerPool {
|
|
|
83
130
|
}
|
|
84
131
|
async close() {
|
|
85
132
|
const err = new Error('worker pool closed');
|
|
133
|
+
clearInterval(this.stopTimer);
|
|
134
|
+
this.stopTimer = undefined;
|
|
86
135
|
for (const j of this.queue.splice(0))
|
|
87
136
|
j.reject(err);
|
|
88
137
|
const exits = this.slots.map((s) => {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Sidecar } from '../io/sidecars.ts';
|
|
2
|
+
/** The "format" a JSON file declares at its start, or null (not JSON, no format, unreadable). */
|
|
3
|
+
export declare function fileFormat(file: string): string | null;
|
|
4
|
+
/**
|
|
5
|
+
* Is the file at `file` (absolute) a sidecar, and of what (an absolute path)? `exists` tells whether a path is there
|
|
6
|
+
* (default: on disk).
|
|
7
|
+
*/
|
|
8
|
+
export declare function sidecarFile(file: string, exists?: (p: string) => boolean): Sidecar | null;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// Export sidecars on disk (io/sidecars.ts): which JSON files beside an export are its metadata, read from their first
|
|
2
|
+
// bytes. Session.listInputs, ArtifactStore.list and the viewer's Outputs list ask here. The format a file declares
|
|
3
|
+
// is cached by its size and modification time, so listings read each file once.
|
|
4
|
+
import fs from 'node:fs';
|
|
5
|
+
import path from 'node:path';
|
|
6
|
+
import { SIDECAR_HEAD_BYTES, jsonFormat, maybeSidecar, sidecarOf } from '../io/sidecars.js';
|
|
7
|
+
const formats = new Map();
|
|
8
|
+
/** The "format" a JSON file declares at its start, or null (not JSON, no format, unreadable). */
|
|
9
|
+
export function fileFormat(file) {
|
|
10
|
+
let st;
|
|
11
|
+
try {
|
|
12
|
+
st = fs.statSync(file, { throwIfNoEntry: false });
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
if (!st?.isFile())
|
|
18
|
+
return null;
|
|
19
|
+
const stamp = `${st.size}:${st.mtimeMs}`, hit = formats.get(file);
|
|
20
|
+
if (hit?.stamp === stamp)
|
|
21
|
+
return hit.format;
|
|
22
|
+
let format = null;
|
|
23
|
+
try {
|
|
24
|
+
const fd = fs.openSync(file, 'r');
|
|
25
|
+
try {
|
|
26
|
+
const head = new Uint8Array(Math.min(SIDECAR_HEAD_BYTES, st.size));
|
|
27
|
+
fs.readSync(fd, head, 0, head.length, 0);
|
|
28
|
+
format = jsonFormat(head);
|
|
29
|
+
}
|
|
30
|
+
finally {
|
|
31
|
+
fs.closeSync(fd);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
catch { /* gone or unreadable: not a sidecar */ }
|
|
35
|
+
if (formats.size > 4096)
|
|
36
|
+
formats.clear();
|
|
37
|
+
formats.set(file, { stamp, format });
|
|
38
|
+
return format;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Is the file at `file` (absolute) a sidecar, and of what (an absolute path)? `exists` tells whether a path is there
|
|
42
|
+
* (default: on disk).
|
|
43
|
+
*/
|
|
44
|
+
export function sidecarFile(file, exists = (p) => fs.existsSync(p)) {
|
|
45
|
+
if (!maybeSidecar(file))
|
|
46
|
+
return null;
|
|
47
|
+
const posix = (p) => p.split(path.sep).join('/'), native = (p) => p.split('/').join(path.sep);
|
|
48
|
+
const s = sidecarOf(posix(file), fileFormat(file), (p) => exists(native(p)));
|
|
49
|
+
return s && { role: s.role, of: s.of === null ? null : native(s.of) };
|
|
50
|
+
}
|
package/dist/host/types.d.ts
CHANGED
|
@@ -26,6 +26,15 @@ export interface PoolTask {
|
|
|
26
26
|
};
|
|
27
27
|
/** wall-clock limit in ms (0 / absent = none): the task fails with a "timed out" error and its worker is replaced */
|
|
28
28
|
timeoutMs?: number;
|
|
29
|
+
/**
|
|
30
|
+
* Stops the task once `aborted` is true (a stopped cook): a waiting task leaves the queue, a running one's worker is
|
|
31
|
+
* replaced. Either way it fails with an error whose code is "STOPPED".
|
|
32
|
+
*/
|
|
33
|
+
signal?: StopSignal;
|
|
34
|
+
}
|
|
35
|
+
/** What stops a cook or a task: an AbortSignal, or any object whose `aborted` turns true. */
|
|
36
|
+
export interface StopSignal {
|
|
37
|
+
readonly aborted: boolean;
|
|
29
38
|
}
|
|
30
39
|
/** What a pool task resolves with: the kernel's return value and the task's non-shared arrays, handed back. */
|
|
31
40
|
export interface PoolResult<V = any> {
|
|
@@ -52,7 +61,7 @@ export interface WorkerPool {
|
|
|
52
61
|
run<T = PoolResult>(task: PoolTask): Promise<T>;
|
|
53
62
|
/** stop all workers; pending tasks fail. The pool restarts on the next run. */
|
|
54
63
|
close(): Promise<void>;
|
|
55
|
-
/** counters for tests and diagnostics */
|
|
64
|
+
/** counters for tests and diagnostics (stops: running tasks stopped by their signal) */
|
|
56
65
|
stats(): {
|
|
57
66
|
workers: number;
|
|
58
67
|
busy: number;
|
|
@@ -61,6 +70,7 @@ export interface WorkerPool {
|
|
|
61
70
|
tasks: number;
|
|
62
71
|
crashes: number;
|
|
63
72
|
timeouts: number;
|
|
73
|
+
stops: number;
|
|
64
74
|
};
|
|
65
75
|
}
|
|
66
76
|
/**
|
|
@@ -87,11 +97,6 @@ export interface Host {
|
|
|
87
97
|
name: string;
|
|
88
98
|
/** Read a file (or URL) as bytes. */
|
|
89
99
|
readFile(path: string): Promise<Uint8Array>;
|
|
90
|
-
/**
|
|
91
|
-
* Directory (path or URL, read with readFile) of the shipped asset shelf: `index.json` there lists the asset files.
|
|
92
|
-
* The engine registers them as node types of category "shelf" on init. Absent = no shelf.
|
|
93
|
-
*/
|
|
94
|
-
shelfPath?: string;
|
|
95
100
|
/** A string that changes when the file changes (mtime+size), for cache keys. */
|
|
96
101
|
fileStamp(path: string): string;
|
|
97
102
|
resolvePath(path: string): string;
|
|
@@ -100,6 +105,12 @@ export interface Host {
|
|
|
100
105
|
listDir?(path: string): string[];
|
|
101
106
|
/** Convert a local source file to GLB (Node: .blend through headless Blender). Absent in browser/kernel hosts. */
|
|
102
107
|
convertFile?(path: string, target: 'glb'): Promise<Uint8Array>;
|
|
108
|
+
/**
|
|
109
|
+
* The file operations for another folder (absolute, or relative to this host's own): relative paths resolve against
|
|
110
|
+
* it, for a cook scope with a folder of its own (Engine.createScope). Converted files are still cached in this host's
|
|
111
|
+
* folder. Absent: no scope can have a folder of its own.
|
|
112
|
+
*/
|
|
113
|
+
filesAt?(dir: string): HostFiles;
|
|
103
114
|
/**
|
|
104
115
|
* Compile JS source inside the scripting realm (which has the snippet library
|
|
105
116
|
* installed) and return the resulting value (usually a function). The realm is set up with
|
|
@@ -144,3 +155,5 @@ export interface Host {
|
|
|
144
155
|
*/
|
|
145
156
|
pool?: WorkerPool;
|
|
146
157
|
}
|
|
158
|
+
/** What nodes read files with (a cook scope's files, src/graph/scope.ts): relative paths resolve against one folder. */
|
|
159
|
+
export type HostFiles = Pick<Host, 'readFile' | 'fileStamp' | 'resolvePath' | 'isDirectory' | 'listDir' | 'convertFile' | 'findFont' | 'fontCandidates'>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const TOPOTOPO_VERSION: string;
|
package/dist/host/worker.js
CHANGED
|
@@ -47,12 +47,15 @@ async function wrangleChunk(a, arrays, start, end) {
|
|
|
47
47
|
if (!realm)
|
|
48
48
|
realm = (await import('./node.js')).createNodeHost({ workers: 0 });
|
|
49
49
|
const { wrangleRunError } = await import('../core/wrangle.js');
|
|
50
|
-
const { runUserCode } = await import('../core/usercode.js');
|
|
50
|
+
const { deepFreeze, runUserCode } = await import('../core/usercode.js');
|
|
51
|
+
const { scriptVarsGuard } = await import('../core/snippet-lib.js');
|
|
51
52
|
const kernel = realm.compile(a.source);
|
|
52
53
|
const B = Array.from({ length: a.bindings }, (_, i) => ({ data: arrays['b' + i] }));
|
|
53
54
|
const env = {
|
|
54
55
|
n: a.n, s: start, e: end, mask: arrays.mask ?? null, vp: null, vprim: null, B,
|
|
55
|
-
numpt: a.numpt, numprim: a.numprim, numvtx: a.numvtx, frame: a.frame, time: a.time, timeInc: a.timeInc,
|
|
56
|
+
numpt: a.numpt, numprim: a.numprim, numvtx: a.numvtx, frame: a.frame, time: a.time, timeInc: a.timeInc,
|
|
57
|
+
// the graph vars the snippet reads, read-only as on the cooking thread
|
|
58
|
+
vars: deepFreeze(a.vars), varsGuard: scriptVarsGuard(realm),
|
|
56
59
|
centroid: () => { throw new Error('centroid is not available in a point wrangle'); },
|
|
57
60
|
};
|
|
58
61
|
// the geometry API stays null in workers (point wrangles that call geometry functions run on the cooking thread)
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './nodes/index.ts';
|
|
2
|
-
export { Engine } from './graph/engine.ts';
|
|
3
|
-
export type { CookReport, NodeResult, Issue } from './graph/engine.ts';
|
|
2
|
+
export { Engine, STOPPED } from './graph/engine.ts';
|
|
3
|
+
export type { CookOptions, CookReport, NodeProgress, NodeResult, Issue, StopSignal } from './graph/engine.ts';
|
|
4
4
|
export type { GraphSpec, NodeSpec, NodeDef, ParamDef } from './graph/types.ts';
|
|
5
5
|
export { allNodeDefs, getNodeDef, CATEGORY_ORDER } from './graph/registry.ts';
|
|
6
6
|
export { Geometry, GeoBuilder } from './core/geometry.ts';
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Public API of the engine core (host-agnostic). The MCP server, CLI and a future
|
|
2
2
|
// browser GUI all build on this.
|
|
3
3
|
import './nodes/index.js';
|
|
4
|
-
export { Engine } from './graph/engine.js';
|
|
4
|
+
export { Engine, STOPPED } from './graph/engine.js';
|
|
5
5
|
export { allNodeDefs, getNodeDef, CATEGORY_ORDER } from './graph/registry.js';
|
|
6
6
|
export { Geometry, GeoBuilder } from './core/geometry.js';
|
|
7
7
|
export { renderGeometry, renderGeometryAsync } from './render/raster.js';
|
package/dist/inspect.d.ts
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import { Geometry } from './core/geometry.ts';
|
|
2
2
|
export declare function summarize(g: Geometry): string;
|
|
3
|
+
/** One line for the images: name, size and layers of each (inspect detail "attributes" gives each layer's range). */
|
|
4
|
+
export declare function imagesLine(g: Geometry, max?: number): string | null;
|
|
5
|
+
/** The bbox in metres to the millimetre: min, max, size, centre. */
|
|
6
|
+
export declare function bboxLine(g: Geometry): string | null;
|
|
3
7
|
export interface InspectOptions {
|
|
4
|
-
/**
|
|
5
|
-
|
|
8
|
+
/**
|
|
9
|
+
* 'summary' (default): one screen; 'uv': the structured uv report (core/uvreport.ts); 'budget': triangles per part,
|
|
10
|
+
* LOD and node (budget.nodes gives the per-node rows); 'uv' and 'budget' are not part of 'all'. The export's scene
|
|
11
|
+
* (detail "scene") needs the export itself: io/inspect-scene.ts.
|
|
12
|
+
*/
|
|
13
|
+
detail?: 'summary' | 'attributes' | 'topology' | 'elements' | 'all' | 'uv' | 'budget';
|
|
6
14
|
cls?: 'point' | 'prim' | 'vertex' | 'detail' | 'edge';
|
|
7
15
|
attribs?: string[];
|
|
8
16
|
start?: number;
|
|
@@ -12,5 +20,75 @@ export interface InspectOptions {
|
|
|
12
20
|
uvAttrib?: string;
|
|
13
21
|
uvResolution?: number | [number, number];
|
|
14
22
|
json?: boolean;
|
|
23
|
+
/** detail 'budget': the cooked nodes upstream of the result (nodeBudgetInput), for the per-node rows */
|
|
24
|
+
nodes?: NodeBudgetInput[];
|
|
15
25
|
}
|
|
16
26
|
export declare function inspect(g: Geometry, o?: InspectOptions): string;
|
|
27
|
+
/**
|
|
28
|
+
* One screen: counts with the triangles export and render draw, bbox in metres to the millimetre, parts (prim "name"),
|
|
29
|
+
* materials with their maps, images, the uv state (charts, in-tile overlap, outside 0..1, tiling, utilization) and
|
|
30
|
+
* whether it is a closed solid (open edges after welding seam splits), then attributes and groups.
|
|
31
|
+
*/
|
|
32
|
+
export declare function summaryLines(g: Geometry): string[];
|
|
33
|
+
/** A cooked node for the per-node budget: its name, type, output and the nodes it reads. */
|
|
34
|
+
export interface NodeBudgetInput {
|
|
35
|
+
node: string;
|
|
36
|
+
type: string;
|
|
37
|
+
geo: Geometry | null;
|
|
38
|
+
inputs: string[];
|
|
39
|
+
}
|
|
40
|
+
export interface BudgetPart {
|
|
41
|
+
name: string;
|
|
42
|
+
lod: number;
|
|
43
|
+
triangles: number;
|
|
44
|
+
prims: number;
|
|
45
|
+
instances: number;
|
|
46
|
+
}
|
|
47
|
+
export interface BudgetLod {
|
|
48
|
+
lod: number;
|
|
49
|
+
triangles: number;
|
|
50
|
+
parts: BudgetPart[];
|
|
51
|
+
}
|
|
52
|
+
export interface BudgetNode {
|
|
53
|
+
node: string;
|
|
54
|
+
type: string;
|
|
55
|
+
triangles: number;
|
|
56
|
+
added: number;
|
|
57
|
+
}
|
|
58
|
+
export interface BudgetReport {
|
|
59
|
+
/** triangles drawn: polygons (fan split) plus the triangles of packed instances, expanded */
|
|
60
|
+
triangles: number;
|
|
61
|
+
polygonTriangles: number;
|
|
62
|
+
instanceTriangles: number;
|
|
63
|
+
instances: number;
|
|
64
|
+
/** by prim "name" (what each exported mesh holds), largest first; instances by their packed prim "name" or source */
|
|
65
|
+
parts: BudgetPart[];
|
|
66
|
+
/** the parts by LOD when names carry a _lodN suffix (lod -1: names without one), LOD 0 first */
|
|
67
|
+
lods: BudgetLod[];
|
|
68
|
+
/** per node upstream of the result: its triangles and what it adds over its inputs, largest addition first */
|
|
69
|
+
nodes: BudgetNode[];
|
|
70
|
+
}
|
|
71
|
+
/** Triangle budget: per part, per LOD and per node (see BudgetReport). */
|
|
72
|
+
export declare function budgetReport(g: Geometry, nodes?: NodeBudgetInput[]): BudgetReport;
|
|
73
|
+
/** The budget as text: totals, parts (per LOD when names carry one), nodes. */
|
|
74
|
+
export declare function budgetText(b: BudgetReport): string[];
|
|
75
|
+
/** The cooked nodes of a graph for the per-node budget (graph spec, the cook's results). */
|
|
76
|
+
export declare function nodeBudgetInput(spec: {
|
|
77
|
+
nodes: Record<string, {
|
|
78
|
+
type: string;
|
|
79
|
+
in?: unknown;
|
|
80
|
+
}>;
|
|
81
|
+
}, results: Map<string, {
|
|
82
|
+
geo: Geometry | null;
|
|
83
|
+
}>): NodeBudgetInput[];
|
|
84
|
+
/**
|
|
85
|
+
* The topology section: closed solid or not and why (open edges after welding uv/normal seam splits, non-manifold
|
|
86
|
+
* edges, winding flips, inward pieces, degenerate faces: each with the first one's part and position and the fix),
|
|
87
|
+
* pieces, render/export triangle health, area, volume, genus.
|
|
88
|
+
*/
|
|
89
|
+
export declare function topologyLines(g: Geometry): string[];
|
|
90
|
+
/**
|
|
91
|
+
* Faces of a closed mesh that cross each other ("" when none): booleans reject such a mesh even though every edge is
|
|
92
|
+
* shared by two faces. Meshes above CROSSING_CHECK_MAX triangles are not searched.
|
|
93
|
+
*/
|
|
94
|
+
export declare function crossingText(g: Geometry): string;
|