oh my god it compiles. A month of brainstorming comes out to a single enum
This commit is contained in:
@@ -18,7 +18,7 @@ use vulkano::swapchain::Capabilities;
|
||||
use winit::Window;
|
||||
use vulkano::pipeline::viewport::Viewport;
|
||||
use vulkano::descriptor::descriptor::DescriptorDescTy::TexelBuffer;
|
||||
use crate::canvas::canvas_frame::{CanvasFrame, CanvasFrameTest, VertexData};
|
||||
use crate::canvas::canvas_frame::{CanvasFrame, CanvasFrameTest};
|
||||
use std::hash::Hash;
|
||||
use crate::util::vertex_3d::{Vertex3D, TextVertex3D};
|
||||
use vulkano::pipeline::depth_stencil::{StencilFaceFlags, DynamicStencilValue};
|
||||
@@ -69,6 +69,7 @@ pub struct CanvasState {
|
||||
}
|
||||
|
||||
|
||||
|
||||
impl CanvasState {
|
||||
/// This method is called once during initialization, then again whenever the window is resized
|
||||
pub fn window_size_dependent_setup(&mut self, images: &[Arc<SwapchainImage<Window>>])
|
||||
@@ -484,22 +485,61 @@ impl CanvasState {
|
||||
o
|
||||
}
|
||||
|
||||
|
||||
// This is taking in a canvas frame, which should be some sort of matrix of vertices of generic
|
||||
// types and handles
|
||||
pub fn draw_commands_test<V: 'static + VertexData + Sized + Clone + Send + Sync, H: Handle + Sized>
|
||||
(&mut self,
|
||||
pub fn draw_commands_test<T: 'static + Send + Sync + Clone>(&mut self,
|
||||
mut command_buffer: AutoCommandBufferBuilder,
|
||||
framebuffers: Vec<Arc<dyn FramebufferAbstract + Send + Sync>>,
|
||||
image_num: usize,
|
||||
canvas_frame: CanvasFrameTest<V, H>) -> AutoCommandBufferBuilder {
|
||||
canvas_frame: CanvasFrameTest<T>) -> AutoCommandBufferBuilder {
|
||||
|
||||
let v = Vec::<V>::new();
|
||||
// Specify the color to clear the framebuffer with i.e. blue
|
||||
let clear_values = vec!(
|
||||
ClearValue::Float([0.0, 0.0, 1.0, 1.0]),
|
||||
ClearValue::DepthStencil((1.0, 0x00)),
|
||||
);
|
||||
|
||||
let x = ImmutableBuffer::from_iter(
|
||||
v.iter().cloned(),
|
||||
BufferUsage::all(),
|
||||
self.queue.clone(),
|
||||
).unwrap().0;
|
||||
self.dynamic_state = DynamicState {
|
||||
line_width: None,
|
||||
viewports: self.dynamic_state.viewports.clone(),
|
||||
scissors: None,
|
||||
compare_mask: None,
|
||||
write_mask: None,
|
||||
reference: None,
|
||||
};
|
||||
|
||||
let mut command_buffer = command_buffer.begin_render_pass(
|
||||
framebuffers[image_num].clone(), false, clear_values.clone(),
|
||||
).unwrap();
|
||||
|
||||
// Solid colors
|
||||
let mut shader = self.shader_buffers.get(
|
||||
self.get_shader_handle(String::from("color-passthrough"))
|
||||
.unwrap().clone().get_handle() as usize
|
||||
).unwrap();
|
||||
|
||||
|
||||
|
||||
for (k,v) in canvas_frame.map {
|
||||
|
||||
let value : Vec<T> = v.iter().map(|v| v.clone()).collect();
|
||||
|
||||
let buffer : Arc<(dyn BufferAccess + Send + Sync)> = ImmutableBuffer::from_iter(
|
||||
value.iter().cloned(),
|
||||
BufferUsage::vertex_buffer(),
|
||||
self.queue.clone(),
|
||||
).unwrap().0;
|
||||
|
||||
if !self.colored_vertex_buffer.is_empty() {
|
||||
command_buffer = command_buffer.draw(
|
||||
shader.get_pipeline().clone(),
|
||||
&self.dynamic_state.clone(),
|
||||
vec![buffer.clone()],
|
||||
(), (),
|
||||
).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
command_buffer
|
||||
|
||||
|
||||
Reference in New Issue
Block a user