code wiki / (root) / nx_depth_tri.nx

nx_depth_tri.nx

buildroot/runtime/nx_depth_tri.nx

3029 B73 linesdepth 5pulls 6 transitivereach 7 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_depth_tri.nx -- Z-BUFFERED triangle rasterizer: the primitive that turns a flat textured quad into a real 3D scene. Barycentric depth interpolation (SAME DDA math as UV), a per-fragment DEPTH TEST against a z-buffer, so overlapping triangles resolve OCCLUSION order-independently -- the gateway from 2D blit to 3D (procgen worlds + beings render with correct visibility). Pure integer, deterministic. license_tier: ORIGINAL zbuf: i64 per pixel, SMALLER z == NEARER (init to a large "far" sentinel via depth_clear). depth_on=1 => depth-tested (order-independent). depth_on=0 => painter's (last-writer-wins) = neg-control. z0/z1/z2 = per-vertex depth (any fixed-point scale); interpolated barycentrically like UV.

dependencies 2 imports · 5 importers

nx_syscalls.nx nx_image.nx nx_depth_tri.nx nx_cube3d_gate.nx nx_cube3d_lit_gate.nx nx_cube3d_spin_gate.nx nx_depth_tri_gate.nx nx_scene3d.nx

imports: nx_syscalls.nxnx_image.nx

imported by: nx_cube3d_gate.nxnx_cube3d_lit_gate.nxnx_cube3d_spin_gate.nxnx_depth_tri_gate.nxnx_scene3d.nx

structs

none

consts

none

functions

11func dt_edge(ax: i64, ay: i64, bx: i64, by: i64, px: i64, py: i64) -> i64
called by 1: depth_tri_render
15func depth_clear(zbuf: *i64, n: i64, val: i64) -> i64
21func depth_tri_render(fb: *Image, zbuf: *i64, x0: i64, y0: i64, z0: i64, x1: i64, y1: i64, z1: i64, x2: i64, y2: i64, z2: i64, rr: i64, gg: i64, bb: i64, depth_on: i64) -> i64
called by 5: faceface_rfacemainsc_face calls 1: dt_edge