Skip to main content

gpu_render_pixels

Function gpu_render_pixels 

Source
pub fn gpu_render_pixels(
    triangles: &[GpuTriangle],
    camera_pos: [f32; 3],
    nx: usize,
    ny: usize,
) -> Vec<[f32; 3]>
Expand description

Render a scene with orthographic projection, returning one RGB pixel per sample.

  • camera_pos — origin of all primary rays (ortho camera).
  • nx, ny — image dimensions in pixels.
  • Returns a flat Vec of [r, g, b] triples (row-major).

Each pixel fires one ray in the -Z direction; hit pixels get the absolute-value of the triangle normal as colour, miss pixels return black.