Added template dynamic vertex.

This commit is contained in:
2019-10-15 16:08:17 -07:00
parent 554e8d551e
commit c4b20bcd79
5 changed files with 134 additions and 22 deletions

View File

@@ -80,20 +80,20 @@ impl Pair<GlyphInstance> {
pub struct GenericCanvasFrame<H, V, In> {
frame_data: HashMap<H, Vec<(Vec<V>, Vec<In>)>>
}
impl<V, In> GenericCanvasFrame<Vertex3D, V, In> {
/// Creates a bare canvas frame with empty accumulators
pub fn new() -> GenericCanvasFrame<Vertex3D, V, In> {
GenericCanvasFrame {
frame_data: Default::default()
}
}
pub fn draw(&mut self, drawable: &dyn DrawableTest<V, Vertex3D, In>) {
self.frame_data
.entry(drawable.get_handle().clone())
.or_insert(Vec::new())
.push((drawable.get_vertices(), drawable.get_instances()));
}
}
//
//impl<V, In> GenericCanvasFrame<Vertex3D, V, In> {
//
// /// Creates a bare canvas frame with empty accumulators
// pub fn new() -> GenericCanvasFrame<Vertex3D, V, In> {
// GenericCanvasFrame {
// frame_data: Default::default()
// }
// }
//
// pub fn draw(&mut self, drawable: &dyn DrawableTest<V, Vertex3D, In>) {
// self.frame_data
// .entry(drawable.get_handle().clone())
// .or_insert(Vec::new())
// .push((drawable.get_vertices(), drawable.get_instances()));
// }
//}