Got the vertex definition into the load function. Which is something

This commit is contained in:
2019-10-15 00:08:43 -07:00
parent 595937d68f
commit 554e8d551e
9 changed files with 50 additions and 21 deletions

View File

@@ -53,20 +53,44 @@ impl CanvasFrame {
}
}
struct Pair<T> {
x: T,
y: T,
}
impl Pair<Vertex3D> {
fn new(x: Vertex3D, y: Vertex3D) -> Self {
Self {
x,
y,
}
}
}
impl Pair<GlyphInstance> {
fn new(x: GlyphInstance, y: GlyphInstance) -> Self {
Self {
x,
y,
}
}
}
pub struct GenericCanvasFrame<H, V, In> {
frame_data: HashMap<H, Vec<(Vec<V>, Vec<In>)>>
}
impl<H, V, In> GenericCanvasFrame<H, V, In> {
impl<V, In> GenericCanvasFrame<Vertex3D, V, In> {
/// Creates a bare canvas frame with empty accumulators
pub fn new() -> GenericCanvasFrame<H, V, In> where H: Eq + Hash {
pub fn new() -> GenericCanvasFrame<Vertex3D, V, In> {
GenericCanvasFrame {
frame_data: Default::default()
}
}
pub fn draw(&mut self, drawable: &dyn DrawableTest<V, H, In>) where H: Eq + Hash + Clone {
pub fn draw(&mut self, drawable: &dyn DrawableTest<V, Vertex3D, In>) {
self.frame_data
.entry(drawable.get_handle().clone())
.or_insert(Vec::new())