Added sprite and better vertex format. works, but now I lost texturing
This commit is contained in:
@@ -48,44 +48,8 @@ mod compute_image;
|
||||
use crate::vkprocessor::compute_image::ComputeImage;
|
||||
|
||||
use vulkano::descriptor::descriptor::DescriptorDesc;
|
||||
use crate::vertex_2d::ColoredVertex2D;
|
||||
|
||||
//
|
||||
//#[derive(Clone)]
|
||||
//struct ImageBuffers {
|
||||
// pub image_buffers : Vec<Box<ImageAccess + Send + Sync>>,
|
||||
//}
|
||||
//
|
||||
//impl ImageBuffers {
|
||||
//
|
||||
// pub fn new() -> ImageBuffers {
|
||||
// ImageBuffers {
|
||||
// image_buffers: vec![]
|
||||
// }
|
||||
// }
|
||||
// pub fn add_image(self) -> Self {
|
||||
//
|
||||
// self
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//unsafe impl DescriptorSetsCollection for ImageBuffers {
|
||||
// fn into_vec(self) -> Vec<Box<DescriptorSet>> {
|
||||
// unimplemented!()
|
||||
// }
|
||||
//
|
||||
// fn num_bindings_in_set(&self, set: usize) -> Option<usize> {
|
||||
// unimplemented!()
|
||||
// }
|
||||
//
|
||||
// fn descriptor(&self, set: usize, binding: usize) -> Option<DescriptorDesc> {
|
||||
// unimplemented!()
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
|
||||
#[derive(Default, Debug, Clone)]
|
||||
struct tVertex { position: [f32; 2] }
|
||||
|
||||
/// This method is called once during initialization, then again whenever the window is resized
|
||||
fn window_size_dependent_setup(
|
||||
@@ -337,24 +301,25 @@ impl<'a> VkProcessor<'a> {
|
||||
|
||||
println!("Allocating Buffers...");
|
||||
|
||||
let color = [0.,0.,0.,0.];
|
||||
|
||||
let vertex_buffer = {
|
||||
vulkano::impl_vertex!(tVertex, position);
|
||||
|
||||
CpuAccessibleBuffer::from_iter(self.device.clone(), BufferUsage::all(), [
|
||||
tVertex { position: [ 1.0, 1.0 ] },
|
||||
tVertex { position: [ 1.0, 0.5 ] },
|
||||
tVertex { position: [ 0.5, 0.5 ] },
|
||||
tVertex { position: [ 0.5, 1.0 ] },
|
||||
ColoredVertex2D { position: [ 1.0, 1.0 ], color },
|
||||
ColoredVertex2D { position: [ 1.0, 0.5 ], color },
|
||||
ColoredVertex2D { position: [ 0.5, 0.5 ], color },
|
||||
ColoredVertex2D { position: [ 0.5, 1.0 ], color },
|
||||
].iter().cloned()).unwrap()
|
||||
};
|
||||
|
||||
let vertex_buffer2 = {
|
||||
|
||||
CpuAccessibleBuffer::from_iter(self.device.clone(), BufferUsage::all(), [
|
||||
tVertex { position: [-1.0, -1.0 ] },
|
||||
tVertex { position: [-1.0, -0.5 ] },
|
||||
tVertex { position: [-0.5, -0.5 ] },
|
||||
tVertex { position: [-0.5, -1.0 ] },
|
||||
ColoredVertex2D { position: [-1.0, -1.0 ], color },
|
||||
ColoredVertex2D { position: [-1.0, -0.5 ], color },
|
||||
ColoredVertex2D { position: [-0.5, -0.5 ], color },
|
||||
ColoredVertex2D { position: [-0.5, -1.0 ], color },
|
||||
].iter().cloned()).unwrap()
|
||||
};
|
||||
|
||||
@@ -407,6 +372,8 @@ impl<'a> VkProcessor<'a> {
|
||||
self.compute_image.clone().unwrap().clone().save_image();
|
||||
}
|
||||
|
||||
|
||||
|
||||
pub fn run(&mut self, surface: &'a Arc<Surface<Window>>, mut frame_future: Box<dyn GpuFuture>) -> Box<dyn GpuFuture> {
|
||||
|
||||
let mut framebuffers = window_size_dependent_setup(&self.shader_kernels.clone().unwrap().swapchain_images.clone(),
|
||||
@@ -423,7 +390,8 @@ impl<'a> VkProcessor<'a> {
|
||||
if recreate_swapchain {
|
||||
self.shader_kernels = Some(self.shader_kernels.clone().unwrap().recreate_swapchain(surface));
|
||||
framebuffers = window_size_dependent_setup(&self.shader_kernels.clone().unwrap().swapchain_images.clone(),
|
||||
self.render_pass.clone().unwrap().clone(),
|
||||
self.shader_kernels.clone().unwrap().render_pass.clone(),
|
||||
//self.render_pass.clone().unwrap().clone(),
|
||||
&mut self.dynamic_state);
|
||||
recreate_swapchain = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user