From d51e783a508c6656dcf6b9253ccf1de0740637d6 Mon Sep 17 00:00:00 2001 From: SeanOMik Date: Wed, 7 Jun 2023 00:53:33 -0400 Subject: [PATCH] fix some issues caused by the rebase --- src/game.rs | 2 +- src/render/renderer.rs | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/game.rs b/src/game.rs index aac1542..2cfee78 100755 --- a/src/game.rs +++ b/src/game.rs @@ -13,7 +13,7 @@ use tracing_subscriber::{ use winit::{window::{WindowBuilder, Window}, event::{Event, WindowEvent, KeyboardInput, ElementState, VirtualKeyCode}, event_loop::{EventLoop, ControlFlow}}; -use crate::{render::{renderer::{Renderer, BasicRenderer}, render_job::RenderJob}, input_event::InputEvent, ecs::components::{mesh::MeshComponent, transform::TransformComponent}}; +use crate::{render::{renderer::{Renderer, BasicRenderer}, render_job::RenderJob}, input_event::InputEvent, ecs::{components::{mesh::MeshComponent, transform::TransformComponent}, SystemFnExecutor, SimpleSystem}}; struct TickCounter { counter: u32, diff --git a/src/render/renderer.rs b/src/render/renderer.rs index a00c31e..99ea17a 100755 --- a/src/render/renderer.rs +++ b/src/render/renderer.rs @@ -358,6 +358,14 @@ impl Renderer for BasicRenderer { self.buffer_storage.insert(entity, buffers); } } + + // Find the active camera + if let Some((_e, (camera,))) = main_world.query_mut::<(&mut CameraComponent,)>().into_iter().next() { + let view_proj = self.inuse_camera.update_view_projection(camera); + self.queue.write_buffer(&self.camera_buffer, 0, bytemuck::cast_slice(&[view_proj.clone()])); + } else { + warn!("Missing camera!"); + } } async fn render(&mut self) -> Result<(), wgpu::SurfaceError> {