code wiki / _hdl_build / nx_gltf2mesh.nx
nx_gltf2mesh.nx
buildroot/runtime/_hdl_build/nx_gltf2mesh.nx
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
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
structs
| none |
consts
| 15 | const G2_MAGIC_2000000000: i64 = 2000000000 |
| 16 | const G2_MAGIC_2500: i64 = 2500 |
| 17 | const G2_MAGIC_500000: i64 = 500000 |
| 18 | const G2_MAGIC_2500000: i64 = 2500000 |
| 19 | const G2_MAGIC_4096: i64 = 4096 |
| 21 | const G2_CAP: i64 = 33554432 |
| 22 | const G2_MAXEL: i64 = 1024 |
| 23 | const G2_MAXTRI: i64 = 400000 |
| 24 | const G2_Q14: i64 = 16384 |
| 25 | const G2_M8388607: i64 = 8388607 |
| 26 | const G2_M8388608: i64 = 8388608 |
| 27 | const G2_GREY: i64 = 780 |
| 28 | const G2_CT_F32: i64 = 5126 |
| 29 | const G2_CT_U16: i64 = 5123 |
| 30 | const G2_CT_U32: i64 = 5125 |
| 31 | const G2_MODE_TRIS: i64 = 4 |
| 32 | const G2_HDR: i64 = 16 |
| 33 | const G2_LAYROW: i64 = 24 |
| 34 | const G2_TRIREC: i64 = 84 |
functions
| 36 | func hw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 37 | func 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 } |
| 42 | func g2_u16(b: *u8, o: i64) -> i64 called by 1: g2_convert |
| 47 | func g2_u32(b: *u8, o: i64) -> i64 called by 1: g2_convert |
| 53 | func g2_f32mm(w: i64) -> i64 called by 1: g2_convert |
| 68 | func g2_enc(v: i64, scale: i64) -> i64 |
| 83 | func g2_wr32(b: *u8, o: i64, v: i64) -> i64 |
| 87 | func g2_isqrt(x: i64) -> i64 called by 1: g2_convert |
| 96 | func g2_lit_at(b: *u8, o: i64, e: i64, lit: *u8) -> i64 |
| 105 | func g2_topkey(b: *u8, s: i64, e: i64, lit: *u8) -> i64 |
| 132 | func g2_elems(b: *u8, arr: i64, e: i64, starts: *i64, ends: *i64, maxn: i64) -> i64 called by 1: g2_convert |
| 171 | func g2_key(b: *u8, s: i64, e: i64, lit: *u8) -> i64 |
| 190 | func g2_ifield(b: *u8, s: i64, e: i64, lit: *u8, def: i64) -> i64 |
| 211 | func g2_objend(b: *u8, off: i64, e: i64) -> i64 called by 1: g2_convert |
| 237 | func g2_hasstr(b: *u8, s: i64, e: i64, lit: *u8) -> i64 |
| 243 | func g2_refuse(reason: *u8) -> i64 |
| 251 | func g2_name_has(b: *u8, s: i64, e: i64, skip: *u8) -> i64 |
| 272 | func g2_filter(f: *u8) -> i64 |
| 297 | func g2_intarray(b: *u8, arr: i64, e: i64, out: *i64, maxn: i64) -> i64 called by 1: g2_convert |
| 328 | func g2_nodename(b: *u8, s: i64, e: i64, out: *i64) -> i64 |
| 347 | func g2_convert(inp: *u8, outp: *u8, skip: *u8) -> i64 |
| 774 | func st_wr(path: *u8, buf: *u8, n: i64) -> i64 |
| 781 | func st_mkglb(buf: *u8, breakmode: i64) -> i64 |
| 812 | func g2_selftest() -> i64 |
| 839 | func main(argc: i64, argv: *i64) -> i64 |