in the middle of expirimenting with was to implement this drawable api

This commit is contained in:
2019-10-11 22:46:35 -07:00
parent 1551a53d1e
commit 595937d68f
4 changed files with 63 additions and 20 deletions

View File

@@ -31,19 +31,23 @@ use crate::canvas::shader::text_shader::GlyphInstance;
use std::fs::File;
use std::io::Read;
use rusttype::{Font, PositionedGlyph, Scale, Rect, point, GlyphId};
// I don't think this is going to work without getting into Box'ing
pub trait DrawableTest<V, H, In> {
fn get_vertices(&self) -> Vec<V>;
fn get_instances(&self) -> Vec<In>;
fn get_handle(&self) -> H;
}
/// A drawable object can be passed into a CanvasFrame to be rendered
/// Very generic implementation. (N % 2 == 0) vertices, ditto for texture coords, and rgba color
/// Provides Image and Texture handles for drawing
/// Split out to two drawables?
///
//
pub trait DrawableTest<V, H> {
fn get_vertices(&self) -> Vec<V>;
fn get_handle(&self) -> Vec<H>;
}
pub trait Drawable {
fn get_vertices(&self) -> Vec<(f32, f32, f32)>;
fn get_color(&self) -> (f32, f32, f32, f32);
fn get_ti_coords(&self) -> Vec<(f32, f32)>;