code wiki / _hdl_build / nx_mesh2glb.nx

nx_mesh2glb.nx

buildroot/runtime/_hdl_build/nx_mesh2glb.nx

15086 B338 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_mesh2glb.nx -- NXMSH2 -> INTERACTIVE .glb (operator 2026-08-05: "a picture vs the other files' full interactivity panel -- that's dumb"). The measurement organs emit NXMSH2 (per-tri colour = the deviation heatmap lives there); the showcase viewer consumes .glb. This organ closes that seam, so a FITTED body and a PAINTED HEATMAP both become drag-to-rotate panels, not screenshots -- an interactive deviation map is a capability the reference industrial tools ship as static report pages. Positions PASS THROUGH as raw f32 bits (zero re-quantisation); per-tri colour is replicated to the tri's 3 vertices as normalized u8 VEC4; per-vertex normals transcode to normalized i16 -- the exact accessor types our proven nishi_walk.glb already uses, so the viewer needs nothing new. nx_mesh2glb <in.nxmesh> <out.glb> | selftest license_tier: ORIGINAL expect_exit: 0

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_mesh2glb.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 hw sys_write sys_exit mg_selftest st_fix sys_mmap mg_w32 st_enc1000 sys_openat_wr sys_write ↻ sys_close hw ↻ mg_convert sys_openat_rd mg_refuse hw ↻ sys_mmap ↻ sys_read sys_close ↻ mg_u32 mg_align4 mg_w32 ↻ mg_f32i mg_w16 mg_w8 mg_cat mg_num sys_mmap ↻ sys_openat_wr ↻ sys_write ↻ hw ↻ pn sys_mmap ↻ sys_write ↻ sys_mmap ↻ sys_openat_rd ↻ sys_read ↻ sys_close ↻ mg_u32 ↻

structs

none

consts

12const MG_MAGIC_65536: i64 = 65536
13const MG_MAGIC_32767: i64 = 32767
14const MG_MAGIC_65535: i64 = 65535
15const MG_MAGIC_100000: i64 = 100000
16const MG_MAGIC_8192: i64 = 8192
18const MG_CAP: i64 = 33554432
19const MG_OCAP: i64 = 25165824
20const MG_MAXTRI: i64 = 400000
21const MG_M8388607: i64 = 8388607
22const MG_M8388608: i64 = 8388608
23const MG_BIG: i64 = 4611686018427387903

functions

25func hw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
26func 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 }
27func mg_u32(b: *u8, o: i64) -> i64 { return (b[o] as i64) + ((b[o+1] as i64)<<8) + ((b[o+2] as i64)<<16) + ((b[o+3] as i64)<<24) }
28func mg_w8(b: *u8, o: i64, v: i64) -> i64 { b[o] = (v&255) as u8; return o+1 }
called by 1: mg_convert
29func mg_w16(b: *u8, o: i64, v: i64) -> i64 { b[o]=(v&255) as u8; b[o+1]=((v>>8)&255) as u8; return o+2 }
called by 1: mg_convert
30func mg_w32(b: *u8, o: i64, v: i64) -> i64 { b[o]=(v&255) as u8; b[o+1]=((v>>8)&255) as u8; b[o+2]=((v>>16)&255) as u8; b[o+3]=((v>>24)&255) as u8; return o+4 }
called by 2: mg_convertst_fix
31func mg_align4(x: i64) -> i64 { return (x+3)/4*4 }
called by 1: mg_convert
32func mg_cat(o: *u8, at: i64, s: *u8) -> i64 { var i: i64=0; var a: i64=at; while s[i]!=(0 as u8){o[a]=s[i]; a=a+1; i=i+1} return a }
called by 1: mg_convert
33func mg_num(o: *u8, at: i64, v: i64) -> i64
called by 1: mg_convert calls 1: sys_mmap
48func mg_f32i(w: i64, scale: i64) -> i64
called by 1: mg_convert
62func mg_refuse(reason: *u8) -> i64 { hw("MESH2GLB REFUSED: " as *u8); hw(reason); hw("\n" as *u8); return 0 }
called by 1: mg_convert calls 1: hw
64func mg_convert(inp: *u8, outp: *u8) -> i64
250func st_enc1000(v: i64) -> i64
called by 1: st_fix
265func st_fix(path: *u8) -> i64
290func mg_hasstr(b: *u8, n: i64, lit: *u8) -> i64
called by 1: mg_selftest
303func mg_selftest() -> i64
326func main(argc: i64, argv: *i64) -> i64