Made LOD setting slider exponential

This commit is contained in:
Treeco 2020-02-24 16:48:05 +00:00
parent 2fa7b2d20d
commit 4c65a5aed3
2 changed files with 6 additions and 6 deletions

View File

@ -1571,9 +1571,9 @@ impl<'a> Widget for SettingsWindow<'a> {
.set(state.ids.lod_detail_text, ui); .set(state.ids.lod_detail_text, ui);
if let Some(new_val) = ImageSlider::discrete( if let Some(new_val) = ImageSlider::discrete(
self.global_state.settings.graphics.lod_detail, ((self.global_state.settings.graphics.lod_detail as f32 / 100.0).log(5.0) * 10.0).round() as i32,
100, 0,
2000, 20,
self.imgs.slider_indicator, self.imgs.slider_indicator,
self.imgs.slider, self.imgs.slider,
) )
@ -1584,7 +1584,7 @@ impl<'a> Widget for SettingsWindow<'a> {
.pad_track((5.0, 5.0)) .pad_track((5.0, 5.0))
.set(state.ids.lod_detail_slider, ui) .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!( Text::new(&format!(

View File

@ -24,11 +24,11 @@ impl Lod {
map: renderer map: renderer
.create_texture(&client.world_map.0, Some(FilterMethod::Trilinear), None) .create_texture(&client.world_map.0, Some(FilterMethod::Trilinear), None)
.expect("Failed to generate map texture"), .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) { pub fn maintain(&mut self, renderer: &mut Renderer) {
if self if self