code wiki / _hdl_build / nx_f32_voxel_gate.nx
nx_f32_voxel_gate.nx
buildroot/runtime/_hdl_build/nx_f32_voxel_gate.nx
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
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
structs
| none |
consts
| 9 | const W: i64 = 320 |
| 10 | const H: i64 = 240 |
| 11 | const HW: i64 = 160 |
| 12 | const HH: i64 = 120 |
| 13 | const N: i64 = 14 |
| 14 | const TN: i64 = 4 |
| 15 | const FOCAL: i64 = 300 |
| 16 | const PUSH: i64 = 24 |
| 17 | const ZFAR: i64 = 1073741824 |
functions
| 19 | func imin(a: i64, b: i64) -> i64 { if a < b { return a } return b } |
| 20 | func imax(a: i64, b: i64) -> i64 { if a > b { return a } return b } |
| 21 | func min3(a: i64, b: i64, c: i64) -> i64 { return imin(a, imin(b, c)) } |
| 22 | func max3(a: i64, b: i64, c: i64) -> i64 { return imax(a, imax(b, c)) } |
| 23 | func iabs(a: i64) -> i64 { if a < 0 { return 0 - a } return a } |
| 24 | func clamp255(v: i64) -> i64 { if v < 0 { return 0 } if v > 255 { return 255 } return v } |
| 25 | func same_sign3(a: i64, b: i64, c: i64) -> i64 called by 1: fill_ztex |
| 30 | func fratio(num: i64, den: i64) -> i64 { return f32_div(f32_of(num), f32_of(den)) } |
| 33 | func 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 |
| 34 | func terrain_h(gx: i64, gz: i64) -> i64 |
| 54 | func hN(gx: i64, gz: i64) -> i64 |
| 62 | func top_color(h: i64) -> i64 called by 1: draw_col |
| 68 | func side_color(h: i64) -> i64 called by 1: draw_col |
| 74 | func texel_col(baseR: i64, baseG: i64, baseB: i64, u: i64, v: i64, bright: i64) -> i64 |
| 82 | func fill_ztex(fb: *i64, zb: *i64, t: *i64, br: i64, bg: i64, bb: i64, bright: i64) -> i64 |
| 116 | func project(R: *i64, iwx: i64, iwy: i64, iwz: i64, out: *i64) -> i64 |
| 135 | func shade_local(lnx: i64, lny: i64, lnz: i64) -> i64 |
| 141 | func draw_face(fb: *i64, zb: *i64, sx: *i64, sy: *i64, sd: *i64, sok: *i64, |
| 163 | func draw_col(fb: *i64, zb: *i64, R: *i64, gx: i64, gz: i64) -> i64 |
| 189 | func put_u32le(b: *u8, o: i64, v: i64) -> i64 called by 1: write_bmp |
| 196 | func write_bmp(fb: *i64, path: *u8) -> i64 |
| 232 | func main() -> i64 |