doing some hardcore storming on this dynamic vertex situation

This commit is contained in:
2019-10-16 23:29:49 -07:00
parent c4b20bcd79
commit ffa04d0bb1
7 changed files with 120 additions and 72 deletions

View File

@@ -13,6 +13,70 @@ pub struct CanvasFrame {
pub text_drawables: HashMap<Arc<CanvasFontHandle>, Vec<GlyphInstance>>
}
/*
This is sort of the beginning of our interface with the user definable sprites.
Will be taking in multiple type of items
TEXT
FontHandle
VertexDefintion
color
position
instances (string)
Textured
TextureHandle
VertexDefintion
position
coords
size
Vertex definition is directly correlated to the compiled code. How do I bucket these
I guess I could store them and set handles like I do textures
The only ent that can create these vertex handles is the vkprocessor.
So Text can only get a vertex definition by going like shader.get_definition()
Text
FontHandle
VertexHandle
Drawable must include
shader_handle (but how to I get this to the text? this is runtime)
Okay, no. Maybe a default shader type of setup. With a shader handle override????
Type: Text
Textured
Img
Color
frame.draw(text) {
text.type == TEXT { // When it matches to default text shader
text_shader.get_definition()
text_shader.get_pipeline()
}
...
else { // When the user passes in a shader
text.shader_handle.get_definition()
text.shader_handle.get_pipeline()
}
}
// Has default shader
let text = Text::new("asdoif");
let frame = CanvasFrame::new();
frame.draw(text);
vkprocessor.run(frame);
*/
impl CanvasFrame {
/// Creates a bare canvas frame with empty accumulators
@@ -53,30 +117,6 @@ 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>)>>
}