Temporarily use push constants to set view/projection matrices

This commit is contained in:
2020-06-26 03:40:03 +02:00
parent e755d3b1d8
commit 4121b5e657
3 changed files with 9 additions and 2 deletions

View File

@@ -68,6 +68,8 @@ impl Game for TestGame {
renderer.game_data.line_push_constants.view = view.into();
renderer.game_data.line_push_constants.projection = proj.into();
renderer.game_data.push_constants.view = view.into();
renderer.game_data.push_constants.projection = proj.into();
self.input.frame_end();

View File

@@ -32,7 +32,7 @@ use vs::ty::PushConstants;
use crate::mesh::CPUMesh;
const VALIDATION_LAYERS: &[&str] = &[
const VALIDATION_LAYERS: &[&str] = &[
"VK_LAYER_LUNARG_standard_validation"
];
@@ -111,6 +111,8 @@ impl VulkanRenderer {
let mut data = GameData {
push_constants: PushConstants {
model: Matrix4::identity().into(),
view: Matrix4::identity().into(),
projection: Matrix4::identity().into(),
},
line_push_constants: LinePushConstants {
model: Matrix4::identity().into(),
@@ -469,6 +471,7 @@ pub fn start_event_loop(mut renderer: VulkanRenderer, mut game: Box<dyn Game>, e
let ubo = game.update(&mut renderer);
event_loop.run(move |event, _, control_flow| {
game.on_window_event(&event);
match event {
Event::WindowEvent { event: WindowEvent::CloseRequested, .. } => {
*control_flow = ControlFlow::Exit;