code wiki / (root) / nx_scene3d.nx

nx_scene3d.nx

buildroot/runtime/nx_scene3d.nx

5004 B132 linesdepth 6pulls 7 transitivereach 2 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_scene3d.nx -- reusable 3D scene primitives: integer trig (Bhaskara Q10) + rotate + perspective project + per-face Lambert-shaded, depth-sorted cube. Extracted from the proven cube gates so the native game window and the gates share ONE implementation of the 3D math (no duplicate sprawl). Composes nx_depth_tri. Pure integer, deterministic, no gcc/GL. license_tier: ORIGINAL

dependencies 3 imports · 2 importers

nx_syscalls.nx nx_image.nx nx_depth_tri.nx nx_scene3d.nx nishi_game.nx nx_scene3d_gate.nx

imports: nx_syscalls.nxnx_image.nxnx_depth_tri.nx

imported by: nishi_game.nxnx_scene3d_gate.nx

structs

21struct Cube3D

consts

9const SC_AMB: i64 = 105 // ambient floor (~41%)
28const CUBE3D_BYTES: i64 = 128

functions

11func sc_isin(deg: i64) -> i64
called by 2: sc_icossc_cube_draw
19func sc_icos(deg: i64) -> i64 { return sc_isin(deg + 90) }
called by 1: sc_cube_draw calls 1: sc_isin
30func sc_cube_new(S: i64, focal: i64, dist: i64) -> *Cube3D
called by 2: mainmain calls 1: sys_mmap
58func sc_ndotl(rx: *i64, ry: *i64, rz: *i64, ia: i64, ib: i64, ic: i64, id: i64) -> i64
called by 1: sc_face
70func sc_shade(ndl: i64, nlmax: i64) -> i64
called by 1: sc_face
76func sc_face(c: *Cube3D, fb: *Image, zb: *i64, ia: i64, ib: i64, ic: i64, id: i64, r: i64, g: i64, b: i64, nlmax: i64) -> i64
93func sc_cube_draw(c: *Cube3D, fb: *Image, zb: *i64, cx: i64, cy: i64, ay: i64, ax: i64) -> i64
called by 2: mainmain calls 3: sc_isinsc_icossc_face