Huge input update, FPS Camera controls system
Long day. I now store winit:🪟:Window in a mutex.
This commit is contained in:
parent
1e9b997aeb
commit
46c8c32819
15 changed files with 307 additions and 39 deletions
|
|
@ -1,6 +1,7 @@
|
|||
use std::any::TypeId;
|
||||
use std::cell::RefCell;
|
||||
use std::rc::Rc;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use indexmap::IndexMap;
|
||||
use glium::{Display, Frame};
|
||||
use glium::glutin::surface::WindowSurface;
|
||||
|
|
@ -12,7 +13,7 @@ use glam::Vec3;
|
|||
pub struct RenderingContext<'a> {
|
||||
pub scene: &'a Scene,
|
||||
pub target: &'a mut Frame,
|
||||
pub window: &'a mut glium::winit::window::Window,
|
||||
pub window: Arc<Mutex<glium::winit::window::Window>>,
|
||||
pub asset_manager: ModelManagerRef,
|
||||
pub debug_ui_buffer: Rc<RefCell<DebugUIBuffer>>,
|
||||
pub env_light_dir: Vec3,
|
||||
|
|
@ -23,13 +24,13 @@ pub struct RenderingContext<'a> {
|
|||
pub trait RenderingSystem {
|
||||
fn handle_event(
|
||||
&mut self,
|
||||
_window: &mut glium::winit::window::Window,
|
||||
_window: Arc<Mutex<glium::winit::window::Window>>,
|
||||
_event: winit::event::Event<()>,
|
||||
) {
|
||||
}
|
||||
fn prepare_frame(&mut self, _window: &mut glium::winit::window::Window) {}
|
||||
fn prepare_frame(&mut self, _window: Arc<Mutex<glium::winit::window::Window>>) {}
|
||||
fn render(&mut self, ctx: &mut RenderingContext);
|
||||
fn initialize(display: &Display<WindowSurface>, window: &glium::winit::window::Window) -> Self
|
||||
fn initialize(display: &Display<WindowSurface>, window: Arc<Mutex<glium::winit::window::Window>>) -> Self
|
||||
where
|
||||
Self: Sized;
|
||||
}
|
||||
|
|
@ -45,7 +46,7 @@ impl RenderingSystemManager {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn add<R>(&mut self, display: &Display<WindowSurface>, window: &glium::winit::window::Window)
|
||||
pub fn add<R>(&mut self, display: &Display<WindowSurface>, window: Arc<Mutex<glium::winit::window::Window>>)
|
||||
where
|
||||
R: RenderingSystem + 'static,
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue