hotload shader + directional light

This commit is contained in:
2021-02-25 21:36:29 +01:00
parent 26871da22b
commit 8735f2d409
8 changed files with 55 additions and 25 deletions

View File

@@ -250,7 +250,7 @@ impl VulkanRenderer {
let pipelines: Vec<Box<dyn Drawcall>> = vec![
Box::new(DefaultShader::new(device.clone(), render_pass.clone())),
// Box::new(LineShader::new(device.clone(), render_pass.clone(), line_vertex_buffer.clone())),
Box::new(LineShader::new(device.clone(), render_pass.clone(), line_vertex_buffer.clone())),
];
// Dynamic viewports allow us to recreate just the viewport when the window is resized
@@ -269,9 +269,11 @@ impl VulkanRenderer {
projection: Matrix4::identity().into(),
time: 0.0,
light_position: [0.0, 0.0, 0.0],
light_directional_rotation: [0.0, 0.0, 0.0],
camera_position: [0.0, 0.0, 0.0],
_dummy0: [0; 12],
_dummy1: [0; 4],
_dummy2: [0; 4],
};
for _ in 0..swapchain.num_images() {
@@ -347,7 +349,7 @@ impl VulkanRenderer {
self.pipelines = vec![
Box::new(DefaultShader::new(self.device.clone(), self.render_pass.clone())),
// Box::new(LineShader::new(self.device.clone(), self.render_pass.clone(), self.line_vertex_buffer.clone())),
Box::new(LineShader::new(self.device.clone(), self.render_pass.clone(), self.line_vertex_buffer.clone())),
];
self.swapchain = new_swapchain;
@@ -473,6 +475,11 @@ impl VulkanRenderer {
pub fn start_event_loop(mut renderer: VulkanRenderer, mut game: Box<dyn Game>, event_loop: EventLoop<()>) {
event_loop.run(move |event, _, control_flow| {
game.on_window_event(&event);
if renderer.game_data.shutdown {
*control_flow = ControlFlow::Exit;
}
match event {
Event::WindowEvent { event: WindowEvent::CloseRequested, .. } => {
*control_flow = ControlFlow::Exit;