code wiki / (root) / nx_gltf_export.nx

nx_gltf_export.nx

buildroot/runtime/nx_gltf_export.nx

13721 B226 linesdepth 2pulls 2 transitivereach 6 importersview sourcekind librarytopic gltf
docsdependenciesstructsconstsfunctions

about

nx_gltf_export.nx -- export a bestiary mesh as binary glTF (.glb), roadmap R7 / the VRM foundation. glTF 2.0 is THE modern interchange format (web three.js/babylon, Unity/Godot/Blender, and the container VRM extends for riggable avatars). Extends the STL/OBJ export (nx_meshgen verts+tris) to a real scene-graph format: a JSON chunk (scene/node/mesh/accessors) + a BIN chunk (float32 positions + uint32 indices). Positions are the fx1024 integer verts encoded as float32, with a node scale of 1/1024 so the imported mesh is correctly sized. v0 = static mesh; the skeleton + skin + VRM humanoid extension are the next layer. license_tier: ORIGINAL

dependencies 1 imports · 5 importers

nx_syscalls.nx nx_gltf_export.nx nx_char_asset.nx nx_faceanat_hires_gate.nx nx_faceanat_mesh_gate.nx nx_faceanat_texbake_gate.nx nx_gltf_export_gate.nx

imports: nx_syscalls.nx

imported by: nx_char_asset.nxnx_faceanat_hires_gate.nxnx_faceanat_mesh_gate.nxnx_faceanat_texbake_gate.nxnx_gltf_export_gate.nx

structs

none

consts

8const K_MAGIC_8192: i64 = 8192

functions

11func gl_i2f32(v: i64) -> i64
25func gl_wr32(buf: *u8, o: i64, v: i64) -> i64
29func gl_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 }
30func gl_num(d: *u8, o: i64, v: i64) -> i64
called by 2: write_glb_coloredwrite_glb calls 1: sys_mmap
40func gl_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: gl_vnormals
42func gl_vnormals(vbuf: *i64, fbuf: *i64, nv: i64, nf: i64, nrm: *i64) -> i64
called by 2: write_glb_coloredwrite_glb calls 1: gl_isqrt
69func write_glb_colored(vbuf: *i64, fbuf: *i64, cbuf: *i64, nv: i64, nf: i64, path: *u8) -> i64
150func write_glb(vbuf: *i64, fbuf: *i64, nv: i64, nf: i64, path: *u8) -> i64