code wiki / _hdl_build / nx_mesh2glb.nx
nx_mesh2glb.nx
buildroot/runtime/_hdl_build/nx_mesh2glb.nx
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
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
| 12 | const MG_MAGIC_65536: i64 = 65536 |
| 13 | const MG_MAGIC_32767: i64 = 32767 |
| 14 | const MG_MAGIC_65535: i64 = 65535 |
| 15 | const MG_MAGIC_100000: i64 = 100000 |
| 16 | const MG_MAGIC_8192: i64 = 8192 |
| 18 | const MG_CAP: i64 = 33554432 |
| 19 | const MG_OCAP: i64 = 25165824 |
| 20 | const MG_MAXTRI: i64 = 400000 |
| 21 | const MG_M8388607: i64 = 8388607 |
| 22 | const MG_M8388608: i64 = 8388608 |
| 23 | const MG_BIG: i64 = 4611686018427387903 |
functions
| 25 | 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 } |
| 26 | 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 } |
| 27 | func 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) } |
| 28 | func mg_w8(b: *u8, o: i64, v: i64) -> i64 { b[o] = (v&255) as u8; return o+1 } called by 1: mg_convert |
| 29 | func 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 |
| 30 | func 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 } |
| 31 | func mg_align4(x: i64) -> i64 { return (x+3)/4*4 } called by 1: mg_convert |
| 32 | func 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 |
| 33 | func mg_num(o: *u8, at: i64, v: i64) -> i64 |
| 48 | func mg_f32i(w: i64, scale: i64) -> i64 called by 1: mg_convert |
| 62 | func mg_refuse(reason: *u8) -> i64 { hw("MESH2GLB REFUSED: " as *u8); hw(reason); hw("\n" as *u8); return 0 } |
| 64 | func mg_convert(inp: *u8, outp: *u8) -> i64 |
| 250 | func st_enc1000(v: i64) -> i64 called by 1: st_fix |
| 265 | func st_fix(path: *u8) -> i64 |
| 290 | func mg_hasstr(b: *u8, n: i64, lit: *u8) -> i64 called by 1: mg_selftest |
| 303 | func mg_selftest() -> i64 |
| 326 | func main(argc: i64, argv: *i64) -> i64 |