Skip to main content

render_scene

Function render_scene 

Source
pub fn render_scene(
    fb: &mut [u32],
    zb: &mut [f32],
    pitch_pixels: usize,
    width: u32,
    height: u32,
    pool: &mut ScratchPool,
    scene: &mut Scene,
    camera: &Camera,
    settings: &OpticastSettings,
    sky: Option<&Sky>,
) -> RenderOutcome
Expand description

Render every grid in scene directly into (fb, zb) — no per-grid temp buffer, no compose merge. For multi-grid scenes this is last-grid-wins (later grids’ opticast writes overwrite earlier grids’ pixels indiscriminately, including sky), so it’s only correct for single-grid scenes.

Use this when you have one grid and want the byte-stable matches-direct-opticast property — the test suite uses it as a sanity check that the combined-world stitch + render harness doesn’t drift vs. a raw opticast call.

Caller pre-fills fb with the desired sky colour and zb with any value (typically 0.0 matching the per-chunk renderer’s convention or f32::INFINITY for compose-friendly init); the rasterizer overwrites both per pixel that gets a hit.