code wiki / (root) / nx_render_core.nx

nx_render_core.nx

buildroot/runtime/nx_render_core.nx

24042 B529 linesdepth 0pulls 0 transitivereach 16 importersview sourcekind librarytopic render
docsdependenciesstructsconstsfunctions

about

nx_render_core.nx -- Implements a fixed-point 3D rendering core with matrix operations and perspective projection for both native and WebAssembly targets.

dependencies 0 imports · 13 importers

nx_render_core.nx nx_explode3d_gate.nx nx_flatraster_gate.nx nx_mechparts_gate.nx nx_meshlit_gate.nx nx_meshrender.nx nx_meshrender_gate.nx nx_meshview_wasm.nx nx_pets3d_wasm.nx nx_rc_probe.nx nx_skin_gate.nx

diagram shows first 10 each side; +0 more imports, +3 more importers in the complete lists below.

imports: none

imported by: nx_explode3d_gate.nxnx_flatraster_gate.nxnx_mechparts_gate.nxnx_meshlit_gate.nxnx_meshrender.nxnx_meshrender_gate.nxnx_meshview_wasm.nxnx_pets3d_wasm.nxnx_rc_probe.nxnx_skin_gate.nxnx_skinnorm_gate.nxnx_spec_gate.nxnx_wasm_explodelab.nx

structs

none

consts

2const RC_MAGIC_40500: i64 = 40500
3const RC_MAGIC_65536: i64 = 65536
4const RC_MAGIC_16777216: i64 = 16777216
5const RC_MAGIC_4096: i64 = 4096
6const RC_MAGIC_31599: i64 = 31599
7const RC_MAGIC_29874: i64 = 29874
8const RC_MAGIC_31183: i64 = 31183
9const RC_MAGIC_29647: i64 = 29647
10const RC_MAGIC_5101: i64 = 5101
11const RC_MAGIC_29671: i64 = 29671
12const RC_MAGIC_31719: i64 = 31719
13const RC_MAGIC_9359: i64 = 9359
14const RC_MAGIC_31727: i64 = 31727
15const RC_MAGIC_29679: i64 = 29679
27const RC_Q: i64 = 16384
28const RC_M4_ELEMS: i64 = 16
29const RC_Z_FAR: i64 = 16384000

functions

32func rc_identity_4x4(out: *i64) -> *i64
42func rc_translation_4x4(tx: i64, ty: i64, tz: i64, out: *i64) -> *i64
52func rc_perspective_cs(cos_h: i64, sin_h: i64, aspect_q14: i64, near_q14: i64, far_q14: i64, out: *i64) -> *i64
75func rc_sin_q14(deg: i64) -> i64
83func rc_cos_q14(deg: i64) -> i64 { return rc_sin_q14(deg + 90) }
85func rc_mat4_mul(a: *i64, b: *i64, out: *i64) -> *i64
101func rc_mat4_vec4(m: *i64, v: *i64, out: *i64) -> *i64
114func rc_min3(a: i64, b: i64, c: i64) -> i64 { var m: i64 = a; if b < m { m = b } if c < m { m = c } return m }
115func rc_max3(a: i64, b: i64, c: i64) -> i64 { var m: i64 = a; if b > m { m = b } if c > m { m = c } return m }
116func rc_clamp(v: i64, lo: i64, hi: i64) -> i64 { if v < lo { return lo } if v > hi { return hi } return v }
117func rc_same_sign_3(a: i64, b: i64, c: i64) -> i64
124func rc_clear(fb: *i64, w: i64, h: i64, color: i64) -> i64
130func rc_zclear(zb: *i64, w: i64, h: i64) -> i64
138func rc_triangle(fb: *i64, zb: *i64, w: i64, h: i64, tri: *i64) -> i64
202func rc_triangle_flat(fb: *i64, zb: *i64, w: i64, h: i64, tri: *i64) -> i64
239func rc_isqrt(n: i64) -> i64
252func rc_pow_q14(base: i64, n: i64) -> i64
called by 1: rc_triangle_phong
263func rc_triangle_phong(fb: *i64, zb: *i64, w: i64, h: i64, pb: *i64) -> i64
339func rc_texel(r: i64, g: i64, b: i64, u: i64, v: i64) -> i64
called by 1: rc_triangle_tex
355func rc_triangle_tex(fb: *i64, zb: *i64, w: i64, h: i64, tri: *i64, baseR: i64, baseG: i64, baseB: i64, bright: i64) -> i64
408func rc_box_quad(fb: *i64, zb: *i64, sw: i64, sh: i64, corn: *i64, ia: i64, ib: i64, ic: i64, id: i64, col: i64, tri: *i64) -> i64
called by 1: rc_draw_box calls 1: rc_triangle
424func rc_draw_box(fb: *i64, zb: *i64, sw: i64, sh: i64, mvp: *i64, x0: i64, y0: i64, z0: i64, hx: i64, hy: i64, hz: i64, col: i64, hw: i64, hh: i64, scratch: *i64) -> i64
457func rc_draw_scene(fb: *i64, zb: *i64, sw: i64, sh: i64, mvp: *i64, ent: *i64, nent: i64, hw: i64, hh: i64, scratch: *i64) -> i64
called by 1: gi_scene_test calls 1: rc_draw_box
468func rc_pow8(r: i64) -> i64 { var v: i64 = 1; var k: i64 = 0; while k < r { v = v * 8; k = k + 1 } return v }
called by 1: rc_draw_digit
469func rc_pow10(r: i64) -> i64 { var v: i64 = 1; var k: i64 = 0; while k < r { v = v * 10; k = k + 1 } return v }
called by 1: rc_draw_number
471func rc_fillrect(fb: *i64, fbw: i64, fbh: i64, x0: i64, y0: i64, rw: i64, rh: i64, col: i64) -> i64
called by 2: gi_hudrc_draw_digit
484func rc_font3x5(d: i64) -> i64
called by 1: rc_draw_digit
497func rc_draw_digit(fb: *i64, fbw: i64, fbh: i64, px: i64, py: i64, d: i64, col: i64, sc: i64) -> i64
515func rc_draw_number(fb: *i64, fbw: i64, fbh: i64, px: i64, py: i64, val: i64, col: i64, sc: i64) -> i64
called by 1: gi_hud calls 2: rc_pow10rc_draw_digit
528func rc_pixel(fb: *i64, w: i64, x: i64, y: i64) -> i64 { return fb[y * w + x] }
529func rc_depth(zb: *i64, w: i64, x: i64, y: i64) -> i64 { return zb[y * w + x] }