diff options
Diffstat (limited to 'client/src/interfaces')
-rw-r--r-- | client/src/interfaces/graphicsconfig.rs | 49 | ||||
-rw-r--r-- | client/src/interfaces/mod.rs | 15 |
2 files changed, 63 insertions, 1 deletions
diff --git a/client/src/interfaces/graphicsconfig.rs b/client/src/interfaces/graphicsconfig.rs new file mode 100644 index 0000000..8832e8d --- /dev/null +++ b/client/src/interfaces/graphicsconfig.rs @@ -0,0 +1,49 @@ +/* + wearechat - generic multiplayer game with voip + Copyright (C) 2025 metamuffin + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, version 3 of the License only. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. +*/ +use super::InterfaceData; +use egui::{Grid, Slider, Widget}; +use std::sync::Arc; + +pub struct GraphicsConfigInterface { + pub idata: Arc<InterfaceData>, +} + +impl Widget for &mut GraphicsConfigInterface { + fn ui(self, ui: &mut egui::Ui) -> egui::Response { + let mut conf = self.idata.graphics_config.lock().unwrap(); + Grid::new("gconf").show(ui, |ui| { + ui.label("Primitive Multisampling AA"); + ui.horizontal(|ui| { + ui.radio_value(&mut conf.1.sample_count, 1, "No MSAA"); + ui.radio_value(&mut conf.1.sample_count, 2, "MSAAx2"); + ui.radio_value(&mut conf.1.sample_count, 4, "MSAAx4"); + ui.radio_value(&mut conf.1.sample_count, 8, "MSAAx8"); + }); + ui.end_row(); + ui.label("Mipmap Levels"); + ui.add(Slider::new(&mut conf.1.max_mip_count, 1..=32).show_value(true)); + ui.end_row(); + ui.label("Maximum Anisotropy"); + ui.add(Slider::new(&mut conf.1.max_anisotropy, 1..=32).show_value(true)); + ui.end_row(); + }); + if ui.button("Apply").clicked() { + conf.0 = true; + } + ui.response() + } +} diff --git a/client/src/interfaces/mod.rs b/client/src/interfaces/mod.rs index 5fb9e6e..9cbfbe3 100644 --- a/client/src/interfaces/mod.rs +++ b/client/src/interfaces/mod.rs @@ -14,15 +14,17 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. */ +pub mod graphicsconfig; pub mod prefabindex; pub mod profiler; use crate::{ download::Downloader, network::Network, - render::{scene::ScenePreparer, ui::UI_POSITION_OFFSET}, + render::{GraphicsConfig, scene::ScenePreparer, ui::UI_POSITION_OFFSET}, }; use egui::{Pos2, Widget}; +use graphicsconfig::GraphicsConfigInterface; use prefabindex::PrefabIndexInterface; use profiler::{Profiler, TimingProfiler}; use std::sync::{Arc, Mutex}; @@ -33,6 +35,7 @@ enum Interface { Selector, Profiler(Profiler), PrefabIndex(PrefabIndexInterface), + GraphicsConfig(GraphicsConfigInterface), } pub struct InterfaceData { @@ -42,6 +45,7 @@ pub struct InterfaceData { pub prefab_index: Arc<PrefabIndex>, pub render_timing: Arc<Mutex<TimingProfiler>>, pub adapter_info: Arc<AdapterInfo>, + pub graphics_config: Arc<Mutex<(bool, GraphicsConfig)>>, } pub fn ui_selector(idata: Arc<InterfaceData>) -> impl Fn(&egui::Context) -> bool { @@ -53,6 +57,7 @@ pub fn ui_selector(idata: Arc<InterfaceData>) -> impl Fn(&egui::Context) -> bool Interface::Selector => "Select Interface", Interface::Profiler(_) => "Profiler", Interface::PrefabIndex(_) => "Prefab Index", + Interface::GraphicsConfig(_) => "Graphics Configuration", }) .open(&mut open) .default_pos(Pos2::new(UI_POSITION_OFFSET, UI_POSITION_OFFSET)) @@ -68,10 +73,18 @@ pub fn ui_selector(idata: Arc<InterfaceData>) -> impl Fn(&egui::Context) -> bool idata: idata.clone(), }) } + if ui.button("Graphics Config").clicked() { + *state = Interface::GraphicsConfig(GraphicsConfigInterface { + idata: idata.clone(), + }) + } ui.response() } Interface::Profiler(profiler) => profiler.ui(ui), Interface::PrefabIndex(prefab_index_interface) => prefab_index_interface.ui(ui), + Interface::GraphicsConfig(graphics_config_interface) => { + graphics_config_interface.ui(ui) + } }); open } |