pub struct FrontToBackBuilder<K> {
opaque_items: Vec<Item<K>>,
alpha_items: Vec<Item<K>>,
}
Expand description
A builder that applies occlusion culling with rectangles provided in front-to-back order.
Fields§
§opaque_items: Vec<Item<K>>
§alpha_items: Vec<Item<K>>
Implementations§
Source§impl<K> FrontToBackBuilder<K>where
K: Copy,
impl<K> FrontToBackBuilder<K>where
K: Copy,
Sourcepub fn with_capacity(opaque: usize, alpha: usize) -> Self
pub fn with_capacity(opaque: usize, alpha: usize) -> Self
Pre-allocating constructor.
Sourcepub fn add(&mut self, rect: &DeviceBox2D, is_opaque: bool, key: K) -> bool
pub fn add(&mut self, rect: &DeviceBox2D, is_opaque: bool, key: K) -> bool
Add a rectangle, potentially splitting it and discarding the occluded parts if any.
Returns true the rectangle is at least partially visible.
Sourcepub fn test(&self, rect: &DeviceBox2D) -> bool
pub fn test(&self, rect: &DeviceBox2D) -> bool
Returns true if the provided rect is at least partially visible, without adding it.
Sourcepub fn opaque_items(&self) -> &[Item<K>]
pub fn opaque_items(&self) -> &[Item<K>]
The visible opaque rectangles (front-to-back order).
Sourcepub fn alpha_items(&self) -> &[Item<K>]
pub fn alpha_items(&self) -> &[Item<K>]
The visible non-opaque rectangles (front-to-back order).
Auto Trait Implementations§
impl<K> Freeze for FrontToBackBuilder<K>
impl<K> RefUnwindSafe for FrontToBackBuilder<K>where
K: RefUnwindSafe,
impl<K> Send for FrontToBackBuilder<K>where
K: Send,
impl<K> Sync for FrontToBackBuilder<K>where
K: Sync,
impl<K> Unpin for FrontToBackBuilder<K>where
K: Unpin,
impl<K> UnwindSafe for FrontToBackBuilder<K>where
K: UnwindSafe,
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
Mutably borrows from an owned value. Read more
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>
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 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>
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