code wiki / (root) / nx_modelfacts_lib.nx

nx_modelfacts_lib.nx

buildroot/runtime/nx_modelfacts_lib.nx

7449 B185 linesdepth 2pulls 2 transitivereach 4 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_modelfacts_lib.nx -- 3D MODEL FACT EXTRACTION CORE (C1 of the conversion tier, knowledge/render_docs_ingest_program.txt). GLB / STL / OBJ / PLY headers -> closed-vocabulary integer measurements for the refcorpus plane. Completes the MEASURE half of mesh rung R2 and the twice-queued glb fact-extractor in one composer. Same walls as nx_mediafacts_lib: no byte from the model file ever flows to output (computed integers + fixed labels only), and -1 means NOT MEASURED -- never a fabricated zero. ★TRUNCATION HONESTY: text-format counts (OBJ/PLY/ascii-STL) and GLB token counts are only emitted when the RELEVANT REGION fits the read window; a count over a truncated file would be a plausible undercount, which is worse than absence. Binary STL's count comes from its HEADER and is verified against the true file size, so it is window-safe. Fact slots (flat i64, MDL_N_SLOTS): [0] format 0=unknown 1=glb 2=stl 3=obj 4=ply [1] tris (stl) [2] verts (obj/ply) [3] faces (obj/ply) [4] uv_present [5] glb_json_bytes [6] glb_bin_bytes [7] glb_accessors [8] glb_skinned_prims [9] vrm_present license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 1 imports · 3 importers

nx_syscalls.nx nx_modelfacts_lib.nx nx_ingest_audit.nx nx_modelfacts.nx nx_modelfacts_gate.nx

imports: nx_syscalls.nx

imported by: nx_ingest_audit.nxnx_modelfacts.nxnx_modelfacts_gate.nx

structs

none

consts

20const MDL_MAGIC_4096: i64 = 4096
21const MDL_MAGIC_65536: i64 = 65536
23const MDL_N_SLOTS: i64 = 10
24const MDL_FMT_UNKNOWN: i64 = 0
25const MDL_FMT_GLB: i64 = 1
26const MDL_FMT_STL: i64 = 2
27const MDL_FMT_OBJ: i64 = 3
28const MDL_FMT_PLY: i64 = 4

functions

30func mdl_b(buf: *u8, o: i64) -> i64 { return buf[o] as i64 & 0xff }
31func mdl_u32le(b: *u8, o: i64) -> i64 { return (b[o] as i64 & 0xff) | ((b[o+1] as i64 & 0xff) << 8) | ((b[o+2] as i64 & 0xff) << 16) | ((b[o+3] as i64 & 0xff) << 24) }
called by 1: mdl_probe
32func mdl_align4(x: i64) -> i64 { return (x + 3) / 4 * 4 }
called by 1: mdl_probe
33func mdl_nlen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
36func mdl_count(buf: *u8, start: i64, end: i64, needle: *u8) -> i64
called by 1: mdl_probe calls 1: mdl_nlen
49func mdl_num_after(buf: *u8, start: i64, end: i64, needle: *u8) -> i64
called by 1: mdl_probe calls 1: mdl_nlen
77func mdl_starts(buf: *u8, n: i64, s: *u8) -> i64
called by 1: mdl_probe calls 1: mdl_nlen
86func mdl_lines(buf: *u8, end: i64, c0: i64, c1: i64) -> i64
104func mdl_looks_obj(buf: *u8, n: i64) -> i64
called by 1: mdl_probe calls 1: mdl_lines
113func mdl_probe(buf: *u8, n: i64, file_size: i64, facts: *i64) -> i64