camera sorta works using the old voxel-raycaster style of spherical coords
This commit is contained in:
@@ -12,6 +12,7 @@ use winit::event::{
|
||||
use winit::window::{Theme, WindowId};
|
||||
|
||||
use crate::camera::{Camera, CameraController};
|
||||
use crate::owned_event::OwnedWindowEvent::MouseWheel;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub enum OwnedUIEvent<T> {
|
||||
@@ -249,44 +250,41 @@ pub fn event_dispatch(
|
||||
for event in event_stack {
|
||||
match event {
|
||||
OwnedEvent::DeviceEvent {
|
||||
event: MouseMotion { delta },
|
||||
event: winit::event::DeviceEvent::MouseMotion { delta },
|
||||
..
|
||||
} => {
|
||||
let mut query = <(&mut CameraController)>::query();
|
||||
for (camera_controller) in query.iter_mut(world) {
|
||||
camera_controller.process_mouse(delta.0, delta.1);
|
||||
}
|
||||
}
|
||||
|
||||
OwnedEvent::DeviceEvent { device_id, event } => {
|
||||
match event {
|
||||
winit::event::DeviceEvent::Key(keyboard_input) => {
|
||||
let mut query = <(&mut CameraController)>::query();
|
||||
for (camera_controller) in query.iter_mut(world) {
|
||||
camera_controller.process_keyboard(
|
||||
keyboard_input.virtual_keycode.unwrap(),
|
||||
keyboard_input.state,
|
||||
);
|
||||
}
|
||||
|
||||
// match keyboard_input.virtual_keycode.unwrap() {
|
||||
// VirtualKeyCode::A => {
|
||||
// if keyboard_input.state == ElementState::Pressed {}
|
||||
// }
|
||||
// VirtualKeyCode::S => {
|
||||
// if keyboard_input.state == ElementState::Pressed {}
|
||||
// }
|
||||
// VirtualKeyCode::P => {
|
||||
// if keyboard_input.state == ElementState::Pressed {
|
||||
// let data = world.write_resource::<VkProcessor>().read_compute_buffer(compute_buffer.clone());
|
||||
// image::save_buffer(&Path::new("image.png"), data.as_slice(), (image_data.1).0, (image_data.1).1, image::RGBA(8));
|
||||
// }
|
||||
// }
|
||||
// _ => ()
|
||||
// }
|
||||
}
|
||||
_ => {}
|
||||
},
|
||||
OwnedEvent::DeviceEvent {
|
||||
event: winit::event::DeviceEvent::Key(keyboard_input),
|
||||
..
|
||||
} => {
|
||||
let mut query = <(&mut CameraController)>::query();
|
||||
for (camera_controller) in query.iter_mut(world) {
|
||||
camera_controller.process_keyboard(
|
||||
keyboard_input.virtual_keycode.unwrap(),
|
||||
keyboard_input.state,
|
||||
);
|
||||
}
|
||||
|
||||
// match keyboard_input.virtual_keycode.unwrap() {
|
||||
// VirtualKeyCode::A => {
|
||||
// if keyboard_input.state == ElementState::Pressed {}
|
||||
// }
|
||||
// VirtualKeyCode::S => {
|
||||
// if keyboard_input.state == ElementState::Pressed {}
|
||||
// }
|
||||
// VirtualKeyCode::P => {
|
||||
// if keyboard_input.state == ElementState::Pressed {
|
||||
// let data = world.write_resource::<VkProcessor>().read_compute_buffer(compute_buffer.clone());
|
||||
// image::save_buffer(&Path::new("image.png"), data.as_slice(), (image_data.1).0, (image_data.1).1, image::RGBA(8));
|
||||
// }
|
||||
// }
|
||||
// _ => ()
|
||||
// }
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user