diff options
| author | HampusM <hampus@hampusmat.com> | 2026-04-21 16:08:09 +0200 |
|---|---|---|
| committer | HampusM <hampus@hampusmat.com> | 2026-04-21 16:08:26 +0200 |
| commit | 9b49aa0e17d6949b76fcdd8bc861d4d21ad749cb (patch) | |
| tree | 64630645bbd19c2f01bca34ac71f92b950fdb1f9 /engine/src/renderer | |
| parent | 3e8cd3c82f38a2ecc43e1106a5aac89bcbeeda7b (diff) | |
refactor(engine): make renderer::GraphicsProperties a singleton
Diffstat (limited to 'engine/src/renderer')
| -rw-r--r-- | engine/src/renderer/opengl.rs | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/engine/src/renderer/opengl.rs b/engine/src/renderer/opengl.rs index 4e865fb..d744da4 100644 --- a/engine/src/renderer/opengl.rs +++ b/engine/src/renderer/opengl.rs @@ -218,11 +218,7 @@ struct SetupFailed; fn prepare_windows( window_query: Query< - ( - Option<&Window>, - &mut WindowCreationAttributes, - Option<&GraphicsProperties>, - ), + (Option<&Window>, &mut WindowCreationAttributes), ( Without<CreationReady>, Without<WindowGlConfig>, @@ -231,6 +227,7 @@ fn prepare_windows( ), >, windowing_context: Single<WindowingContext>, + graphics_props: Single<GraphicsProperties>, mut actions: Actions, ) { @@ -238,7 +235,7 @@ fn prepare_windows( return; }; - for (window_ent_id, (window, mut window_creation_attrs, graphics_props)) in + for (window_ent_id, (window, mut window_creation_attrs)) in window_query.iter_with_euids() { tracing::debug!("Preparing window entity {window_ent_id} for use in rendering"); @@ -246,15 +243,6 @@ fn prepare_windows( let mut glutin_config_template_builder = glutin::config::ConfigTemplateBuilder::new(); - let graphics_props = match graphics_props.as_ref() { - Some(graphics_props) => &*graphics_props, - None => { - actions.add_components(window_ent_id, (GraphicsProperties::default(),)); - - &GraphicsProperties::default() - } - }; - if let Some(multisampling_sample_cnt) = graphics_props.multisampling_sample_cnt { glutin_config_template_builder = glutin_config_template_builder .with_multisampling(multisampling_sample_cnt); @@ -311,16 +299,15 @@ fn prepare_windows( #[tracing::instrument(skip_all)] fn init_window_graphics( window_query: Query< - (&Window, &WindowGlConfig, &GraphicsProperties), + (&Window, &WindowGlConfig), (Without<SurfaceSpec>, Without<SetupFailed>), >, - mut actions: Actions, windowing_context: Single<WindowingContext>, + graphics_props: Single<GraphicsProperties>, + mut actions: Actions, ) { - for (window_ent_id, (window, window_gl_config, graphics_props)) in - window_query.iter_with_euids() - { + for (window_ent_id, (window, window_gl_config)) in window_query.iter_with_euids() { tracing::info!("Initializing graphics for window {window_ent_id}"); let display = window_gl_config.gl_config.display(); |
