code wiki / (root) / nx_obj_export.nx

nx_obj_export.nx

buildroot/runtime/nx_obj_export.nx

3899 B77 linesdepth 2pulls 2 transitivereach 1 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_obj_export.nx -- sovereign Wavefront OBJ writer for the bestiary meshes (game/DCC reuse: engines + Blender import OBJ+normals far cleaner than the print-only STL). Takes the nx_meshgen verts+tris, computes SMOOTH per-vertex normals (accumulate face normals -> normalize), and emits v / vn / f (with //vn indices), 1-indexed. Buffered (one write). Verts stay in the mesh's fx1024 units (importers rescale). license_tier: ORIGINAL

dependencies 1 imports · 1 importers

nx_syscalls.nx nx_obj_export.nx nx_obj_export_gate.nx

imports: nx_syscalls.nx

imported by: nx_obj_export_gate.nx

structs

none

consts

none

functions

7func oe_isqrt(v: i64) -> i64 { if v <= 0 { return 0 } var x: i64 = v; var y: i64 = (x + 1) / 2; while y < x { x = y; y = (x + v / x) / 2 } return x }
called by 1: write_obj
8func oe_cat(d: *u8, o: i64, s: *u8) -> i64 { var i: i64=0; while s[i]!=(0 as u8){d[o+i]=s[i]; i=i+1} return o+i }
called by 1: write_obj
9func oe_num(d: *u8, o: i64, v: i64) -> i64
called by 1: write_obj calls 1: sys_mmap
21func write_obj(vbuf: *i64, fbuf: *i64, nv: i64, nf: i64, path: *u8) -> i64
called by 1: main calls 4: sys_mmapoe_catoe_numoe_isqrt