code wiki / (root) / nx_gltf_load.nx

nx_gltf_load.nx

buildroot/runtime/nx_gltf_load.nx

16421 B390 linesdepth 3pulls 4 transitivereach 5 importersview sourcekind librarytopic gltf
docsdependenciesstructsconstsfunctions

about

nx_gltf_load.nx -- ★sovereign glTF (.glb) LOADER: parse a binary glTF back into nx_trimesh buffers, so the Nishi stack (Nishi OS / Nishi browser) can NATIVELY VIEW a .glb -- and so we can render our own exports on our own renderer to prove the round-trip (the honest-scope gap: "eyeball the model sovereignly"). Inverse of nx_gltf_mesh: includes an integer IEEE-754 float32 DECODER. Loads POSITION + COLOR_0 + indices from our exporter's layout; recomputes normals. license_tier: ORIGINAL

dependencies 2 imports · 5 importers

nx_syscalls.nx nx_trimesh.nx nx_gltf_load.nx nx_boxtex_gate.nx nx_donor_native.nx nx_gltf_load_gate.nx nx_native_turntable.nx nx_stdassets_gate.nx

imports: nx_syscalls.nxnx_trimesh.nx

imported by: nx_boxtex_gate.nxnx_donor_native.nxnx_gltf_load_gate.nxnx_native_turntable.nxnx_stdassets_gate.nx

structs

none

consts

7const K_MAGIC_8388607: i64 = 8388607
8const K_MAGIC_8388608: i64 = 8388608
9const K_MAGIC_65536: i64 = 65536
10const K_MAGIC_2147483647: i64 = 2147483647
11const K_MAGIC_2000000000: i64 = 2000000000
12const K_MAGIC_1024: i64 = 1024
13const K_MAGIC_5123: i64 = 5123

functions

16func gll_f32i(bits: i64) -> i64
called by 2: gltf_loadgls_f32s
30func gll_ru8(buf: *u8, at: i64) -> i64 { return buf[at] as i64 }
called by 1: gltf_load
31func gll_ru32(buf: *u8, at: i64) -> i64 { return (buf[at] as i64) + ((buf[at+1] as i64)<<8) + ((buf[at+2] as i64)<<16) + ((buf[at+3] as i64)<<24) }
32func gll_align4(x: i64) -> i64 { return (x+3)/4*4 }
called by 1: gltf_load
33func gll_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
35func gll_nth_num(buf: *u8, start: i64, end: i64, needle: *u8, n: i64) -> i64
called by 1: gltf_load calls 1: gll_slen
61func gltf_load(path: *u8) -> i64
114func gls_ru16(buf: *u8, at: i64) -> i64 { return (buf[at] as i64) + ((buf[at+1] as i64)<<8) }
called by 1: gltf_load_std
116func gls_f32s(bits: i64, k: i64) -> i64 { if (bits & K_MAGIC_2147483647) == 0 { return 0 } return gll_f32i(bits + (k<<23)) }
called by 1: gltf_load_std calls 1: gll_f32i
117func gls_find(buf: *u8, end: i64, from: i64, needle: *u8) -> i64
129func gls_key_int(buf: *u8, s: i64, e: i64, key: *u8) -> i64
154func gls_arr_obj(buf: *u8, end: i64, arrName: *u8, k: i64, out: *i64) -> i64
181func gls_accessor(buf: *u8, jE: i64, A: i64, out: *i64) -> i64
195func gls_bufview(buf: *u8, jE: i64, B: i64, out: *i64) -> i64
207func gls_image_slice(buf: *u8, size: i64, out: *i64) -> i64
225func gls_basecolor(buf: *u8, jE: i64, out: *i64) -> i64
called by 1: gltf_load_std calls 1: gls_find
275func gltf_load_std(path: *u8, target: i64) -> i64