moved over to the enum method of drawing. Not flexible, but type safe
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
use crate::util::vertex_3d::Vertex3D;
|
||||
use std::sync::Arc;
|
||||
use std::collections::HashMap;
|
||||
use std::hash::Hash;
|
||||
@@ -10,11 +9,7 @@ use vulkano::pipeline::vertex::Vertex;
|
||||
use std::any::Any;
|
||||
|
||||
|
||||
// I don't think this is going to work without getting into Box'ing
|
||||
pub trait DrawableTest<VTypes: Into<VertexTypes>, H: Handle + DynHash> {
|
||||
fn get_vertices(&self) -> VTypes;
|
||||
fn get_handle(&self) -> H;
|
||||
}
|
||||
|
||||
|
||||
pub mod dynhash {
|
||||
use std::any::Any;
|
||||
@@ -74,14 +69,19 @@ use crate::canvas::canvas_frame::dynhash::DynHash;
|
||||
use crate::VertexTypes;
|
||||
|
||||
|
||||
// CanvasFrameTest will be drawn to by objects implementing DrawableTest
|
||||
pub struct CanvasFrameTest<VTypes> {
|
||||
pub map: HashMap<Box<dyn DynHash>, VTypes>,
|
||||
|
||||
pub trait DrawableTest {
|
||||
fn get(&self) -> VertexTypes;
|
||||
}
|
||||
|
||||
impl<VTypes> CanvasFrameTest<VTypes> {
|
||||
pub fn draw(&mut self, drawable: VTypes) {
|
||||
self.map.insert(Box::new(10), drawable);
|
||||
#[derive(Default)]
|
||||
pub struct CanvasFrameTest {
|
||||
pub map: Vec<VertexTypes>,
|
||||
}
|
||||
|
||||
impl CanvasFrameTest {
|
||||
pub fn draw(&mut self, drawable: &dyn DrawableTest) {
|
||||
self.map.push(drawable.get());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user