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.
glineis voxlap’sgline(R4.3 = grouscan): casts a ray oflengthcells from(x0, y0)to(x1, y1)in screen space, writing hit records intoscratch.radarstarting atscratch.gscanptr.hrendis the horizontal-scan rasterizer (hrendzsseetc.): given a rowsyand column rangesx..p1, looks up the rightangstartentries inscratchand writes a band of pixels.vrendis the vertical-scan rasterizer (vrendzsseetc.).
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§
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 Methods§
Sourcefn frame_setup(&mut self, _ctx: &ScanContext<'_>)
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).