diagramming out what I want to do here. CanvasFont will live with the buffers. Need to figure out how and where I'm going to query the font data for rendering

This commit is contained in:
2019-10-09 20:44:56 -07:00
parent b1b081af87
commit e5ba27c353
7 changed files with 136 additions and 208 deletions

View File

@@ -36,6 +36,13 @@ use crate::canvas::shader::text_shader::GlyphInstance;
/// 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);
@@ -68,6 +75,12 @@ pub struct CanvasImageHandle {
pub handle: u32
}
/// Typed wrapper for a u32 font handle (index id)
#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)]
pub struct CanvasFontHandle {
pub handle: u32
}
/// Canvas state is used for storage of texture and image buffers in addition to vertex buffers
/// Canvas state also contains logic for writing the stored buffers to the command_buffer
#[derive(Clone)]
@@ -77,14 +90,13 @@ pub struct CanvasState {
/// Generated during new()
sampler: Arc<Sampler>,
// hold the image, texture, and shader buffers the same was as we do CompuState
// hold the image, texture, and Fonts the same was as we do CompuState
image_buffers: Vec<Arc<CanvasImage>>,
texture_buffers: Vec<Arc<CanvasTexture>>,
shader_buffers: Vec<Arc<Box<dyn CompiledGraphicsPipeline>>>,
// Individually hold onto the Fonts
font_buffers: Vec<Arc<CanvasFont>>,
shader_buffers: Vec<Arc<Box<dyn CompiledGraphicsPipeline>>>,
// Hold onto the vertices we get from the Compu and Canvas Frames
// When the run comes around, push the vertices to the GPU
colored_vertex_buffer: Vec<Arc<(dyn BufferAccess + Send + Sync)>>,