Skip to main content

DepthQueue

Struct DepthQueue 

Source
pub struct DepthQueue { /* private fields */ }
Expand description

Deferred depth-sorted draw queue.

Implementations§

Source§

impl DepthQueue

Source

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.

Source

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).

Source

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.

Source

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.

Source

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).

Source

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).

Source

pub fn flush( self, buf: &mut Vec<u32>, zbuf: Option<&mut Vec<f32>>, reset_z: bool, 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.

Source

pub fn is_empty(&self) -> bool

Trait Implementations§

Source§

impl Debug for DepthQueue

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for DepthQueue

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V