Trait lyon::tessellation::geometry_builder::GeometryBuilder
[−]
[src]
pub trait GeometryBuilder<Input> { fn begin_geometry(&mut self); fn end_geometry(&mut self) -> Count; fn add_vertex(&mut self, vertex: Input) -> VertexId; fn add_triangle(&mut self, a: VertexId, b: VertexId, c: VertexId); fn abort_geometry(&mut self); }
An interface separating tessellators and other geometry generation algorithms from the actual vertex construction.
Required Methods
fn begin_geometry(&mut self)
Called at the beginning of a generation.
end_geometry must be called before begin_geometry is called again.
fn end_geometry(&mut self) -> Count
Called at the end of a generation. Returns the number of vertices and indices added since the last time begin_geometry was called.
fn add_vertex(&mut self, vertex: Input) -> VertexId
Inserts a vertex, providing its position, and optionally a normal. Retuns a vertex id that is only valid between begin_geometry and end_geometry.
This method can only be called between begin_geometry and end_geometry.
fn add_triangle(&mut self, a: VertexId, b: VertexId, c: VertexId)
Insert a triangle made of vertices that were added after the last call to begin_geometry.
This method can only be called between begin_geometry and end_geometry.
fn abort_geometry(&mut self)
abort_geometry is called instead of end_geometry if an error occured while producing the geometry and we won't be able to finish.
The implementation is expected to discard the geometry that was generated since the last time begin_geometry was called, and to remain in a usable state.
Implementors
impl<'l, VertexType, Input, Ctor> GeometryBuilder<Input> for BuffersBuilder<'l, VertexType, Input, Ctor> where Ctor: VertexConstructor<Input, VertexType>, VertexType: 'l + Clone