use vertex::Vertex;
#[derive(Copy, Clone, Debug)]
pub enum Mode {
Point
, Line
, LineStrip
, Triangle
, TriangleFan
, TriangleStrip
}
pub trait HasTessellation {
type Tessellation;
fn new<T>(mode: Mode, vertices: &[T], indices: Option<&[u32]>) -> Self::Tessellation where T: Vertex;
fn destroy(tessellation: &mut Self::Tessellation);
}
#[derive(Debug)]
pub struct Tessellation<C> where C: HasTessellation {
pub repr: C::Tessellation
}
impl<C> Drop for Tessellation<C> where C: HasTessellation {
fn drop(&mut self) {
C::destroy(&mut self.repr);
}
}
impl<C> Tessellation<C> where C: HasTessellation {
pub fn new<T>(mode: Mode, vertices: &[T], indices: Option<&[u32]>) -> Tessellation<C> where T: Vertex {
Tessellation {
repr: C::new(mode, vertices, indices)
}
}
}