code wiki / (root) / nx_meshgen.nx

nx_meshgen.nx

buildroot/runtime/nx_meshgen.nx

9304 B176 linesdepth 3pulls 4 transitivereach 27 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_meshgen.nx -- sovereign SURFACE NETS: turn ANY signed-distance FIELD into a watertight triangle MESH (generator-path R1, operator 2026-07-04: the ecosystem must EMIT geometry, not hand-craft). This is the BRIDGE: the pioneer SDF (sdf_body/sdf_head) -- or a t2mesh/i2mesh-generated field -- becomes real emitted verts+faces. Dual method (naive surface nets): (1) each grid CUBE straddling the 0-surface gets ONE vertex at the mean of its edge zero-crossings; (2) each grid EDGE that crosses the surface emits a QUAD (2 tris) linking the 4 cubes around it. Integer fx1024; deterministic. license_tier: ORIGINAL

dependencies 2 imports · 20 importers

nx_syscalls.nx nx_sdfrender.nx nx_meshgen.nx nx_char_asset.nx nx_faceanat_hires_gate.nx nx_faceanat_mesh_gate.nx nx_faceanat_morph_gate.nx nx_faceanat_texbake_gate.nx nx_gen_orchestrator.nx nx_genloop_gate.nx nx_gltf_export_gate.nx nx_gsplat_aniso_gate.nx nx_gsplat_face_gate.nx

diagram shows first 10 each side; +0 more imports, +10 more importers in the complete lists below.

imports: nx_syscalls.nxnx_sdfrender.nx

imported by: nx_char_asset.nxnx_faceanat_hires_gate.nxnx_faceanat_mesh_gate.nxnx_faceanat_morph_gate.nxnx_faceanat_texbake_gate.nxnx_gen_orchestrator.nxnx_genloop_gate.nxnx_gltf_export_gate.nxnx_gsplat_aniso_gate.nxnx_gsplat_face_gate.nxnx_gsplat_photofit_gate.nxnx_gsplat_showcase.nxnx_i2mesh.nxnx_i2mesh_gate.nxnx_meshgen_gate.nxnx_obj_export_gate.nxnx_persongen_render_gate.nxnx_recombine_novelty_gate.nxnx_t2mesh_gate.nxnx_variant_mesh_gate.nx

structs

none

consts

10const MG_N: i64 = 56 // grid resolution (cells per axis)
11const MG_GR: i64 = 1500 // world half-range fx1024 (body fits [-1500,1500])
12const MG_MAXV: i64 = 200000
13const MG_MAXF: i64 = 400000

functions

15func mg_step() -> i64 { return 2 * MG_GR / MG_N }
called by 2: mg_wcmg_extract
17func mg_fi(i: i64, j: i64, k: i64) -> i64 { return (i * (MG_N + 1) + j) * (MG_N + 1) + k }
18func mg_ci(i: i64, j: i64, k: i64) -> i64 { return (i * MG_N + j) * MG_N + k }
called by 1: mg_extract
19func mg_wc(idx: i64) -> i64 { return 0 - MG_GR + idx * mg_step() } // grid idx -> world coord fx1024
24func mg_sample_sdf(base: i64, F: *i64) -> i64
called by 1: mg_build calls 3: mg_fisdf_evalmg_wc
42func mg_extract(F: *i64, cubevi: *i64, vbuf: *i64, fbuf: *i64, out: *i64) -> i64
172func mg_build(base: i64, F: *i64, cubevi: *i64, vbuf: *i64, fbuf: *i64, out: *i64) -> i64