pub struct RasterTarget<'a> { /* private fields */ }Implementations§
Source§impl<'a> RasterTarget<'a>
impl<'a> RasterTarget<'a>
Sourcepub fn new(framebuffer: &'a mut [u32], zbuffer: &'a mut [f32]) -> Self
pub fn new(framebuffer: &'a mut [u32], zbuffer: &'a mut [f32]) -> Self
Build a target from exclusive slice borrows. The slices are
consumed (their &'a mut reborrow is the load-bearing thing —
this constructor is the only way to mint a RasterTarget
from safe code).
Sourcepub fn fb_ptr(self) -> *mut u32
pub fn fb_ptr(self) -> *mut u32
Raw mutable framebuffer pointer. Used by SSE blocks that do their own arithmetic + bounds reasoning.
§Safety
Callers must respect fb_len and the parallel-use invariant.
Sourcepub fn zb_ptr(self) -> *mut f32
pub fn zb_ptr(self) -> *mut f32
Raw mutable zbuffer pointer. Same contract as
Self::fb_ptr.
Sourcepub unsafe fn write_color(self, idx: usize, color: u32)
pub unsafe fn write_color(self, idx: usize, color: u32)
Sourcepub unsafe fn write_depth(self, idx: usize, z: f32)
pub unsafe fn write_depth(self, idx: usize, z: f32)
Write one z-buffer entry.
§Safety
idx < self.fb_len() (zbuffer length matches fb), plus the
parallel-use invariant.
Sourcepub unsafe fn z_test_write(self, idx: usize, color: u32, z: f32) -> bool
pub unsafe fn z_test_write(self, idx: usize, color: u32, z: f32) -> bool
Depth-tested write: store (color, z) only if z is strictly
closer (smaller) than the current z-buffer entry. Returns whether
the pixel was written. The compositing primitive the DDA sprite
raycaster uses to occlude sprites against terrain.
§Safety
idx < self.fb_len(), plus the parallel-use invariant.
Trait Implementations§
Source§impl<'a> Clone for RasterTarget<'a>
impl<'a> Clone for RasterTarget<'a>
Source§fn clone(&self) -> RasterTarget<'a>
fn clone(&self) -> RasterTarget<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl<'a> Copy for RasterTarget<'a>
Source§impl<'a> Debug for RasterTarget<'a>
impl<'a> Debug for RasterTarget<'a>
impl Send for RasterTarget<'_>
impl Sync for RasterTarget<'_>
Auto Trait Implementations§
impl<'a> !UnwindSafe for RasterTarget<'a>
impl<'a> Freeze for RasterTarget<'a>
impl<'a> RefUnwindSafe for RasterTarget<'a>
impl<'a> Unpin for RasterTarget<'a>
impl<'a> UnsafeUnpin for RasterTarget<'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