code wiki / _hdl_build / nx_f32_voxel_gate.nx

nx_f32_voxel_gate.nx

buildroot/runtime/_hdl_build/nx_f32_voxel_gate.nx

10087 B260 linesdepth 2pulls 3 transitivereach 0 importersview sourcekind gate/prooftopic f32
docsdependenciesstructsconstsfunctions

about

nx_f32_voxel_gate.nx -- R4b/R4c: a PERSPECTIVE, TEXTURED, Z-BUFFERED procedural voxel LANDSCAPE on the sovereign hardware-f32 software path (NishiLang -> nx_cc_sovereign(f32) -> nxasm -> native ELF; NO gcc/GPU/ wasm/VM). Value-noise terrain, neighbour face-culling, height biomes (water/grass/stone/snow), directional shade, f32 mat4 camera + f32 perspective divide, per-pixel z-buffer, 24-bit BMP out. exit 0 = rendered. license_tier: ORIGINAL

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_f32_hw.nx nx_f32_voxel_gate.nx

imports: nx_syscalls.nxnx_f32_hw.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_mmap m4_roty m4_identity f32_of f32_neg fratio f32_div f32_of ↻ m4_rotx m4_identity ↻ f32_neg ↻ f32_neg ↻ m4_mul f32_of ↻ f32_add f32_mul draw_col terrain_h lat sys_mmap ↻ project sys_mmap ↻ f32_sub f32_neg ↻ f32_of ↻ fratio ↻ m4_vec4 f32_of ↻ f32_add ↻ f32_mul ↻ f32_add ↻ f32_int f32_mul ↻ f32_div ↻ top_color side_color draw_face shade_local clamp255

structs

none

consts

9const W: i64 = 320
10const H: i64 = 240
11const HW: i64 = 160
12const HH: i64 = 120
13const N: i64 = 14
14const TN: i64 = 4
15const FOCAL: i64 = 300
16const PUSH: i64 = 24
17const ZFAR: i64 = 1073741824

functions

19func imin(a: i64, b: i64) -> i64 { if a < b { return a } return b }
called by 2: min3fill_ztex
20func imax(a: i64, b: i64) -> i64 { if a > b { return a } return b }
called by 2: max3fill_ztex
21func min3(a: i64, b: i64, c: i64) -> i64 { return imin(a, imin(b, c)) }
called by 1: fill_ztex calls 1: imin
22func max3(a: i64, b: i64, c: i64) -> i64 { return imax(a, imax(b, c)) }
called by 1: fill_ztex calls 1: imax
23func iabs(a: i64) -> i64 { if a < 0 { return 0 - a } return a }
24func clamp255(v: i64) -> i64 { if v < 0 { return 0 } if v > 255 { return 255 } return v }
25func same_sign3(a: i64, b: i64, c: i64) -> i64
called by 1: fill_ztex
30func fratio(num: i64, den: i64) -> i64 { return f32_div(f32_of(num), f32_of(den)) }
called by 2: projectmain calls 2: f32_divf32_of
33func lat(ix: i64, iz: i64) -> i64 { var n: i64 = (ix * 71 + iz * 191 + ix * iz * 7) % 6; if n < 0 { n = n + 6 } return n }
called by 1: terrain_h
34func terrain_h(gx: i64, gz: i64) -> i64
called by 2: hNdraw_col calls 1: lat
54func hN(gx: i64, gz: i64) -> i64
called by 1: draw_col calls 1: terrain_h
62func top_color(h: i64) -> i64
called by 1: draw_col
68func side_color(h: i64) -> i64
called by 1: draw_col
74func texel_col(baseR: i64, baseG: i64, baseB: i64, u: i64, v: i64, bright: i64) -> i64
called by 1: fill_ztex calls 1: clamp255
82func fill_ztex(fb: *i64, zb: *i64, t: *i64, br: i64, bg: i64, bb: i64, bright: i64) -> i64
116func project(R: *i64, iwx: i64, iwy: i64, iwz: i64, out: *i64) -> i64
135func shade_local(lnx: i64, lny: i64, lnz: i64) -> i64
called by 1: draw_face calls 1: clamp255
141func draw_face(fb: *i64, zb: *i64, sx: *i64, sy: *i64, sd: *i64, sok: *i64,
163func draw_col(fb: *i64, zb: *i64, R: *i64, gx: i64, gz: i64) -> i64
189func put_u32le(b: *u8, o: i64, v: i64) -> i64
called by 1: write_bmp
196func write_bmp(fb: *i64, path: *u8) -> i64
232func main() -> i64