Skip to main content

Rasterizer

Trait Rasterizer 

Source
pub trait Rasterizer {
    // Required methods
    fn gline(
        &mut self,
        scratch: &mut ScanScratch,
        length: u32,
        x0: f32,
        y0: f32,
        x1: f32,
        y1: f32,
    );
    fn hrend(
        &mut self,
        scratch: &mut ScanScratch,
        sx: i32,
        sy: i32,
        p1: i32,
        plc: i32,
        incr: i32,
        j: i32,
    );
    fn vrend(
        &mut self,
        scratch: &mut ScanScratch,
        sx: i32,
        sy: i32,
        p1: i32,
        iplc: i32,
        iinc: i32,
    );

    // Provided method
    fn frame_setup(&mut self, _ctx: &ScanContext<'_>) { ... }
}
Expand description

Callback surface for the column-scan loop dispatch.

  • gline is voxlap’s gline (R4.3 = grouscan): casts a ray of length cells from (x0, y0) to (x1, y1) in screen space, writing hit records into scratch.radar starting at scratch.gscanptr.
  • hrend is the horizontal-scan rasterizer (hrendzsse etc.): given a row sy and column range sx..p1, looks up the right angstart entries in scratch and writes a band of pixels.
  • vrend is the vertical-scan rasterizer (vrendzsse etc.).

Test code can implement a recording stub that just remembers the arguments — useful for verifying the scan loops dispatch the right calls without involving any rasterization.

Required Methods§

Source

fn gline( &mut self, scratch: &mut ScanScratch, length: u32, x0: f32, y0: f32, x1: f32, y1: f32, )

Source

fn hrend( &mut self, scratch: &mut ScanScratch, sx: i32, sy: i32, p1: i32, plc: i32, incr: i32, j: i32, )

Source

fn vrend( &mut self, scratch: &mut ScanScratch, sx: i32, sy: i32, p1: i32, iplc: i32, iinc: i32, )

Provided Methods§

Source

fn frame_setup(&mut self, _ctx: &ScanContext<'_>)

Called once per frame, before the four-quadrant scan loops run, with the per-frame derived state. Concrete rasterizers override this to cache whatever they need from the projection / ray-step / prelude triple (a default-noop stub is fine for recording / counting test rasterizers).

Implementors§