Struct plane_split::BspSplitter
source · pub struct BspSplitter<A: Copy> {
result: Vec<Polygon<A>>,
nodes: Vec<BspNode>,
polygons: Vec<Polygon<A>>,
}
Expand description
Binary Space Partitioning splitter, uses a BSP tree.
Fields§
§result: Vec<Polygon<A>>
§nodes: Vec<BspNode>
§polygons: Vec<Polygon<A>>
Implementations§
source§impl<A> BspSplitter<A>
impl<A> BspSplitter<A>
sourcepub fn reset(&mut self)
pub fn reset(&mut self)
Put the splitter back in it initial state.
Call this at the beginning of every frame when reusing the splitter.
sourcepub fn add(&mut self, poly: Polygon<A>)
pub fn add(&mut self, poly: Polygon<A>)
Add a polygon to the plane splitter.
This is where most of the expensive computation happens.
sourcepub fn sort(&mut self, view: Vector3D<f64>) -> &[Polygon<A>]
pub fn sort(&mut self, view: Vector3D<f64>) -> &[Polygon<A>]
Sort the added and split polygons against the view vector.
Call this towards the end of the frame after having added all polygons.
sourcepub fn solve(
&mut self,
input: &[Polygon<A>],
view: Vector3D<f64>,
) -> &[Polygon<A>]where
A: Copy,
pub fn solve(
&mut self,
input: &[Polygon<A>],
view: Vector3D<f64>,
) -> &[Polygon<A>]where
A: Copy,
Process a set of polygons at once.
Auto Trait Implementations§
impl<A> Freeze for BspSplitter<A>
impl<A> RefUnwindSafe for BspSplitter<A>where
A: RefUnwindSafe,
impl<A> Send for BspSplitter<A>where
A: Send,
impl<A> Sync for BspSplitter<A>where
A: Sync,
impl<A> Unpin for BspSplitter<A>where
A: Unpin,
impl<A> UnwindSafe for BspSplitter<A>where
A: 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