pub struct ScalarRasterizer<'a> { /* private fields */ }Expand description
Scalar rasterizer that writes pixels and a z-buffer entry per screen position.
Borrows the framebuffer + zbuffer for the duration of one
opticast call; SDL hosts allocate these once and reuse across
frames, see roxlap-host.
Implementations§
Source§impl<'a> ScalarRasterizer<'a>
impl<'a> ScalarRasterizer<'a>
Sourcepub fn new(
framebuffer: &'a mut [u32],
zbuffer: &'a mut [f32],
pitch_pixels: usize,
slab_buf: &'a [u8],
column_offsets: &'a [u32],
mip_base_offsets: &'a [usize],
vsid: u32,
) -> Self
pub fn new( framebuffer: &'a mut [u32], zbuffer: &'a mut [f32], pitch_pixels: usize, slab_buf: &'a [u8], column_offsets: &'a [u32], mip_base_offsets: &'a [usize], vsid: u32, ) -> Self
Create a rasterizer that will write into the supplied
framebuffer + zbuffer pair. pitch_pixels must satisfy
pitch_pixels * height ≤ framebuffer.len() for the height
the engine renders into; the frame_setup hook does not
validate sizes (it has no height to check against).
slab_buf / column_offsets / mip_base_offsets / vsid
describe the world the renderer reads from. Pass the matching
fields from a roxlap_formats::vxl::Vxl (or, for tests,
&[0, vsid² + 1] as the single-mip placeholder).
ray_step is initialised to a zero placeholder; the real
values get stamped on the first Rasterizer::frame_setup
call before any per-pixel work runs.
Sourcepub fn with_sky(self, sky: &'a Sky) -> Self
pub fn with_sky(self, sky: &'a Sky) -> Self
Bind a sky texture for the lifetime of this rasterizer
instance. Hosts call this when crate::Engine::sky is
Some(_). Without it, the rasterizer keeps the legacy
solid-fill skycast behaviour.
Trait Implementations§
Source§impl<'a> Clone for ScalarRasterizer<'a>
impl<'a> Clone for ScalarRasterizer<'a>
Source§fn clone(&self) -> ScalarRasterizer<'a>
fn clone(&self) -> ScalarRasterizer<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Rasterizer for ScalarRasterizer<'_>
impl Rasterizer for ScalarRasterizer<'_>
Source§fn frame_setup(&mut self, ctx: &ScanContext<'_>)
fn frame_setup(&mut self, ctx: &ScanContext<'_>)
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, )
Auto Trait Implementations§
impl<'a> Freeze for ScalarRasterizer<'a>
impl<'a> RefUnwindSafe for ScalarRasterizer<'a>
impl<'a> Send for ScalarRasterizer<'a>
impl<'a> Sync for ScalarRasterizer<'a>
impl<'a> Unpin for ScalarRasterizer<'a>
impl<'a> UnsafeUnpin for ScalarRasterizer<'a>
impl<'a> !UnwindSafe for ScalarRasterizer<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more