code wiki / _hdl_build / nx_gltf2mesh.nx

nx_gltf2mesh.nx

buildroot/runtime/_hdl_build/nx_gltf2mesh.nx

39933 B855 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_gltf2mesh.nx -- GLB/VRM -> NXMSH2 mesh-oracle extractor (debt 1785902685, the D2 POSITION slice). The whole bench suite (nx_bodybench / nx_twinbench / nx_curvebench / nx_facemark) judges .nxmesh oracles, but NO organ could turn a donor .glb/.vrm into one -- donor FORM was invisible to every instrument we own (operator 2026-08-05: the T2 being is still a clay blob because the ruler only reads skeletons). This organ reads ONLY what a form oracle needs: every TRIANGLES primitive's POSITION + indices (u16 AND u32, tight or strided bufferViews), multi-mesh multi-primitive concat. FAIL-CLOSED at every offset (D1): a file this cannot parse REFUSES with a named reason and a nonzero exit -- never a segfault, never a silent empty mesh (zero accepted tris = REFUSAL). Morph-target POSITIONs are excluded by scoping the attribute scan to the primitive's attributes{}. Skinned bind-pose positions are model-space per the glTF spec (node transforms ignored for skinned meshes); VRM avatars are skinned throughout -- reported in the status line, never silent. nx_gltf2mesh <in.glb|.vrm> <out.nxmesh> | nx_gltf2mesh selftest license_tier: ORIGINAL expect_exit: 0

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_gltf2mesh.nx

imports: nx_syscalls.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main g2_lit_at g2_selftest sys_mmap st_mkglb g2_wr32 g2_enc st_wr sys_openat_wr sys_write sys_close g2_convert sys_openat_rd g2_refuse hw sys_write ↻ sys_mmap ↻ sys_read sys_close ↻ g2_u32 hw ↻ pn sys_mmap ↻ sys_write ↻ g2_topkey g2_lit_at ↻ g2_elems g2_ifield g2_key g2_lit_at ↻ g2_hasstr g2_lit_at ↻ g2_key ↻ g2_intarray g2_nodename g2_key ↻ g2_name_has g2_key ↻ g2_hasstr ↻ g2_objend

structs

none

consts

15const G2_MAGIC_2000000000: i64 = 2000000000
16const G2_MAGIC_2500: i64 = 2500
17const G2_MAGIC_500000: i64 = 500000
18const G2_MAGIC_2500000: i64 = 2500000
19const G2_MAGIC_4096: i64 = 4096
21const G2_CAP: i64 = 33554432
22const G2_MAXEL: i64 = 1024
23const G2_MAXTRI: i64 = 400000
24const G2_Q14: i64 = 16384
25const G2_M8388607: i64 = 8388607
26const G2_M8388608: i64 = 8388608
27const G2_GREY: i64 = 780
28const G2_CT_F32: i64 = 5126
29const G2_CT_U16: i64 = 5123
30const G2_CT_U32: i64 = 5125
31const G2_MODE_TRIS: i64 = 4
32const G2_HDR: i64 = 16
33const G2_LAYROW: i64 = 24
34const G2_TRIREC: i64 = 84

functions

36func hw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
37func pn(v: i64) -> i64 { let b: *u8=sys_mmap(32) as *u8; var x: i64=v; var ng: i64=0; if x<0{ng=1;x=0-x} var i: i64=31; if x==0{b[i]=48 as u8;i=i-1} while x>0{b[i]=(48+x%10) as u8;x=x/10;i=i-1} if ng==1{b[i]=45 as u8;i=i-1} sys_write(1,(b as i64+i+1) as *u8,31-i); return 0 }
42func g2_u16(b: *u8, o: i64) -> i64
called by 1: g2_convert
47func g2_u32(b: *u8, o: i64) -> i64
called by 1: g2_convert
53func g2_f32mm(w: i64) -> i64
called by 1: g2_convert
68func g2_enc(v: i64, scale: i64) -> i64
called by 2: g2_convertst_mkglb
83func g2_wr32(b: *u8, o: i64, v: i64) -> i64
called by 2: g2_convertst_mkglb
87func g2_isqrt(x: i64) -> i64
called by 1: g2_convert
96func g2_lit_at(b: *u8, o: i64, e: i64, lit: *u8) -> i64
105func g2_topkey(b: *u8, s: i64, e: i64, lit: *u8) -> i64
called by 1: g2_convert calls 1: g2_lit_at
132func g2_elems(b: *u8, arr: i64, e: i64, starts: *i64, ends: *i64, maxn: i64) -> i64
called by 1: g2_convert
171func g2_key(b: *u8, s: i64, e: i64, lit: *u8) -> i64
190func g2_ifield(b: *u8, s: i64, e: i64, lit: *u8, def: i64) -> i64
called by 1: g2_convert calls 1: g2_key
211func g2_objend(b: *u8, off: i64, e: i64) -> i64
called by 1: g2_convert
237func g2_hasstr(b: *u8, s: i64, e: i64, lit: *u8) -> i64
called by 2: g2_name_hasg2_convert calls 1: g2_lit_at
243func g2_refuse(reason: *u8) -> i64
called by 1: g2_convert calls 1: hw
251func g2_name_has(b: *u8, s: i64, e: i64, skip: *u8) -> i64
called by 1: g2_convert calls 2: g2_keyg2_hasstr
272func g2_filter(f: *u8) -> i64
called by 1: main calls 2: sys_mmapg2_lit_at
297func g2_intarray(b: *u8, arr: i64, e: i64, out: *i64, maxn: i64) -> i64
called by 1: g2_convert
328func g2_nodename(b: *u8, s: i64, e: i64, out: *i64) -> i64
called by 1: g2_convert calls 1: g2_key
347func g2_convert(inp: *u8, outp: *u8, skip: *u8) -> i64
774func st_wr(path: *u8, buf: *u8, n: i64) -> i64
781func st_mkglb(buf: *u8, breakmode: i64) -> i64
called by 1: g2_selftest calls 2: g2_wr32g2_enc
812func g2_selftest() -> i64
839func main(argc: i64, argv: *i64) -> i64