From 4c65a5aed353b119aea65a2aaeb94549b67beb42 Mon Sep 17 00:00:00 2001 From: Treeco <5021038-Treeco@users.noreply.gitlab.com> Date: Mon, 24 Feb 2020 16:48:05 +0000 Subject: [PATCH] Made LOD setting slider exponential --- voxygen/src/hud/settings_window.rs | 8 ++++---- voxygen/src/scene/lod.rs | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/voxygen/src/hud/settings_window.rs b/voxygen/src/hud/settings_window.rs index 0a12ba9a6b..1292e42491 100644 --- a/voxygen/src/hud/settings_window.rs +++ b/voxygen/src/hud/settings_window.rs @@ -1571,9 +1571,9 @@ impl<'a> Widget for SettingsWindow<'a> { .set(state.ids.lod_detail_text, ui); if let Some(new_val) = ImageSlider::discrete( - self.global_state.settings.graphics.lod_detail, - 100, - 2000, + ((self.global_state.settings.graphics.lod_detail as f32 / 100.0).log(5.0) * 10.0).round() as i32, + 0, + 20, self.imgs.slider_indicator, self.imgs.slider, ) @@ -1584,7 +1584,7 @@ impl<'a> Widget for SettingsWindow<'a> { .pad_track((5.0, 5.0)) .set(state.ids.lod_detail_slider, ui) { - events.push(Event::AdjustLodDetail(new_val as u32)); + events.push(Event::AdjustLodDetail((5.0f32.powf(new_val as f32 / 10.0) * 100.0) as u32)); } Text::new(&format!( diff --git a/voxygen/src/scene/lod.rs b/voxygen/src/scene/lod.rs index 290bdd9a76..e370545fc1 100644 --- a/voxygen/src/scene/lod.rs +++ b/voxygen/src/scene/lod.rs @@ -24,11 +24,11 @@ impl Lod { map: renderer .create_texture(&client.world_map.0, Some(FilterMethod::Trilinear), None) .expect("Failed to generate map texture"), - tgt_detail: settings.graphics.lod_detail, + tgt_detail: settings.graphics.lod_detail.max(100).min(2500), } } - pub fn set_detail(&mut self, detail: u32) { self.tgt_detail = detail.max(100).min(2000); } + pub fn set_detail(&mut self, detail: u32) { self.tgt_detail = detail.max(100).min(2500); } pub fn maintain(&mut self, renderer: &mut Renderer) { if self