pub struct DepthQueue { /* private fields */ }Expand description
Deferred depth-sorted draw queue.
Implementations§
Source§impl DepthQueue
impl DepthQueue
Sourcepub fn set_state(&mut self, mode: u8, alpha: f32)
pub fn set_state(&mut self, mode: u8, alpha: f32)
Mirror the live pen blend mode + alpha so the next pushes capture them.
Call after std::mem::take so an active blend survives a mid-frame flush.
Sourcepub fn push_triangle(
&mut self,
depth: f32,
color: u32,
x0: f32,
y0: f32,
x1: f32,
y1: f32,
x2: f32,
y2: f32,
)
pub fn push_triangle( &mut self, depth: f32, color: u32, x0: f32, y0: f32, x1: f32, y1: f32, x2: f32, y2: f32, )
Queue a filled triangle (flat per-vertex depth = the sort key).
Sourcepub fn push_triangle_zv(
&mut self,
color: u32,
x0: f32,
y0: f32,
z0: f32,
x1: f32,
y1: f32,
z1: f32,
x2: f32,
y2: f32,
z2: f32,
)
pub fn push_triangle_zv( &mut self, color: u32, x0: f32, y0: f32, z0: f32, x1: f32, y1: f32, z1: f32, x2: f32, y2: f32, z2: f32, )
Queue a filled triangle with true per-vertex camera-space depth, so the per-pixel z-buffer can resolve interpenetration.
Sourcepub fn push_triangle_g(
&mut self,
depth: f32,
x0: f32,
y0: f32,
c0: u32,
x1: f32,
y1: f32,
c1: u32,
x2: f32,
y2: f32,
c2: u32,
bands: u32,
)
pub fn push_triangle_g( &mut self, depth: f32, x0: f32, y0: f32, c0: u32, x1: f32, y1: f32, c1: u32, x2: f32, y2: f32, c2: u32, bands: u32, )
Queue a Gouraud + posterised triangle (smooth cel), flat per-vertex depth.
Sourcepub fn push_triangle_g_zv(
&mut self,
x0: f32,
y0: f32,
z0: f32,
c0: u32,
x1: f32,
y1: f32,
z1: f32,
c1: u32,
x2: f32,
y2: f32,
z2: f32,
c2: u32,
bands: u32,
)
pub fn push_triangle_g_zv( &mut self, x0: f32, y0: f32, z0: f32, c0: u32, x1: f32, y1: f32, z1: f32, c1: u32, x2: f32, y2: f32, z2: f32, c2: u32, bands: u32, )
Gouraud triangle with true per-vertex depth (for the z-buffer path).
Sourcepub fn push_line(
&mut self,
depth: f32,
color: u32,
x0: f32,
y0: f32,
x1: f32,
y1: f32,
)
pub fn push_line( &mut self, depth: f32, color: u32, x0: f32, y0: f32, x1: f32, y1: f32, )
Queue a line segment (flat per-vertex depth).
Sourcepub fn flush(
self,
buf: &mut Vec<u32>,
zbuf: Option<&mut Vec<f32>>,
width: usize,
height: usize,
)
pub fn flush( self, buf: &mut Vec<u32>, zbuf: Option<&mut Vec<f32>>, width: usize, height: usize, )
Sort back-to-front and rasterise everything into buf.
zbuf: when Some, a per-pixel depth buffer (camera-space z, smaller =
nearer) is used so interpenetrating triangles resolve correctly — a true
z-buffer on top of the painter’s sort. When None, pure painter’s
algorithm (the default/legacy path).
Opaque calls (mode 0, alpha ≈ 1) take the fast direct-write path; calls
with a blend mode or alpha < 1 composite via composite_pixel. In the
z-buffer path, translucent calls test depth but do not write it, so they
layer over the opaque scene (back-to-front sort handles their ordering).
Consumes self — call site does mem::take to avoid borrow conflict.
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl Debug for DepthQueue
impl Debug for DepthQueue
Auto Trait Implementations§
impl Freeze for DepthQueue
impl RefUnwindSafe for DepthQueue
impl Send for DepthQueue
impl Sync for DepthQueue
impl Unpin for DepthQueue
impl UnsafeUnpin for DepthQueue
impl UnwindSafe for DepthQueue
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
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