more documentation. Image base impl

This commit is contained in:
2019-09-09 21:52:52 -07:00
parent e8ddb67b9e
commit bf3abfe29d
7 changed files with 201 additions and 122 deletions

View File

@@ -1,4 +1,3 @@
#![allow(dead_code)]
#![allow(unused_variables)]
#![allow(unused_mut)]
@@ -14,7 +13,7 @@ extern crate hprof;
use sfml::system::*;
use vulkano::sync;
use crate::timer::Timer;
use vulkano::instance::{Instance};
use vulkano::instance::Instance;
use vulkano::sync::GpuFuture;
use winit::{EventsLoop, WindowBuilder, WindowEvent, Event, DeviceEvent, VirtualKeyCode, ElementState};
use winit::dpi::LogicalSize;
@@ -59,7 +58,6 @@ Canvas works, but I want to use CPU accessible buffer instead of immutable buffe
/// Main Entry
pub fn main() {
hprof::start_frame();
let q1 = hprof::enter("setup");
@@ -96,12 +94,12 @@ pub fn main() {
let mut accumulator_time: f32 = 0.0;
let mut current_time: f32 = timer.elap_time();
let mut mouse_xy = Vector2i::new(0,0);
let mut mouse_xy = Vector2i::new(0, 0);
let sprite = Sprite::new_with_color((0.,0.), (0.1,0.1), (1.,0.,0.,1.));
let sprite2 = Sprite::new_with_color((-1.,-0.5), (0.1,0.1), (0.,1.,0.,1.));
let sprite = Sprite::new_with_color((0., 0.), (0.1, 0.1), (1., 0., 0., 1.));
let sprite2 = Sprite::new_with_color((-1., -0.5), (0.1, 0.1), (0., 1., 0., 1.));
let compu_sprite1 = CompuSprite::new((-1.,-0.5), (0.1,0.1),
let compu_sprite1 = CompuSprite::new((-1., -0.5), (0.1, 0.1),
// This swap image needs to match the size of the compute
processor.new_swap_image((720, 756)));
@@ -113,7 +111,7 @@ pub fn main() {
let handle = processor.get_texture_handle(String::from("funky-bird.jpg")).unwrap();
let sprite3 = Sprite::new_with_texture((0.3, 0.5), (0.1,0.1), handle.clone());
let sprite3 = Sprite::new_with_texture((0.3, 0.5), (0.1, 0.1), handle.clone());
drop(q2);
drop(q1);
@@ -141,10 +139,10 @@ pub fn main() {
Event::WindowEvent { event: WindowEvent::CloseRequested, .. } =>
{
exit = true;
},
}
Event::WindowEvent { event: WindowEvent::Resized(_), .. } => {
processor.recreate_swapchain(&surface);
},
}
Event::DeviceEvent { event: DeviceEvent::Key(keyboard_input), .. } => {
match keyboard_input.virtual_keycode.unwrap() {
VirtualKeyCode::A => {
@@ -154,7 +152,7 @@ pub fn main() {
}
_ => ()
}
},
}
// Event::DeviceEvent { event: DeviceEvent::Button(mouse_input), .. } => {
// mouse_xy.x
// },
@@ -178,9 +176,8 @@ pub fn main() {
{
let g = hprof::enter("Run");
processor.run(&surface,
//frame_future,
canvas,
compu_frame);
canvas,
compu_frame);
}
}