webrender::internal_types

Type Alias PlaneSplitter

Source
pub type PlaneSplitter = BspSplitter<PlaneSplitAnchor>;
Expand description

A concrete plane splitter type used in WebRender.

Aliased Type§

struct PlaneSplitter { /* private fields */ }

Implementations

Source§

impl<A> BspSplitter<A>
where A: Copy,

Source

pub fn new() -> BspSplitter<A>

Create a new BSP splitter.

Source§

impl<A> BspSplitter<A>
where A: Copy + Debug + Default,

Source

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.

Source

pub fn add(&mut self, poly: Polygon<A>)

Add a polygon to the plane splitter.

This is where most of the expensive computation happens.

Source

pub fn sort(&mut self, view: Vector3D<f64, UnknownUnit>) -> &[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.

Source

pub fn solve( &mut self, input: &[Polygon<A>], view: Vector3D<f64, UnknownUnit>, ) -> &[Polygon<A>]
where A: Copy,

Process a set of polygons at once.

Source

pub fn order(&self, node: NodeIdx, base: &Polygon<A>, out: &mut Vec<Polygon<A>>)

Build the draw order of this sub-tree into an out vector, so that the contained planes are sorted back to front according to the view vector defined as the base plane front direction.