diff --git a/assets/voxygen/i18n/en/hud/settings.ron b/assets/voxygen/i18n/en/hud/settings.ron index 8a86db6ac4..cfe5ffab23 100644 --- a/assets/voxygen/i18n/en/hud/settings.ron +++ b/assets/voxygen/i18n/en/hud/settings.ron @@ -89,6 +89,7 @@ "hud.settings.gpu_profiler": "Enable GPU timing (not supported everywhere)", "hud.settings.particles": "Particles", "hud.settings.lossy_terrain_compression": "Lossy terrain compression", + "hud.settings.weapon_trails": "Weapon trails", "hud.settings.resolution": "Resolution", "hud.settings.bit_depth": "Bit Depth", "hud.settings.refresh_rate": "Refresh Rate", diff --git a/assets/voxygen/shaders/trail-frag.glsl b/assets/voxygen/shaders/trail-frag.glsl index ccdb98ede3..52b2aff293 100644 --- a/assets/voxygen/shaders/trail-frag.glsl +++ b/assets/voxygen/shaders/trail-frag.glsl @@ -5,5 +5,5 @@ layout(location = 0) in vec3 f_pos; layout(location = 0) out vec4 tgt_color; void main() { - tgt_color = vec4(vec3(0.5), 1); + tgt_color = vec4(vec3(1), .25); } diff --git a/voxygen/src/hud/settings_window/video.rs b/voxygen/src/hud/settings_window/video.rs index 4a4185d651..0d85de8537 100644 --- a/voxygen/src/hud/settings_window/video.rs +++ b/voxygen/src/hud/settings_window/video.rs @@ -101,6 +101,8 @@ widget_ids! { particles_label, lossy_terrain_compression_button, lossy_terrain_compression_label, + weapon_trails_button, + weapon_trails_label, // fullscreen_button, fullscreen_label, @@ -1164,6 +1166,31 @@ impl<'a> Widget for Video<'a> { )); } + // Weapon trails + Text::new(self.localized_strings.get("hud.settings.weapon_trails")) + .font_size(self.fonts.cyri.scale(14)) + .font_id(self.fonts.cyri.conrod_id) + .right_from(state.ids.lossy_terrain_compression_label, 64.0) + .color(TEXT_COLOR) + .set(state.ids.weapon_trails_label, ui); + + let weapon_trails_enabled = ToggleButton::new( + self.global_state.settings.graphics.weapon_trails_enabled, + self.imgs.checkbox, + self.imgs.checkbox_checked, + ) + .w_h(18.0, 18.0) + .right_from(state.ids.weapon_trails_label, 10.0) + .hover_images(self.imgs.checkbox_mo, self.imgs.checkbox_checked_mo) + .press_images(self.imgs.checkbox_press, self.imgs.checkbox_checked) + .set(state.ids.weapon_trails_button, ui); + + if self.global_state.settings.graphics.weapon_trails_enabled != weapon_trails_enabled { + events.push(GraphicsChange::ToggleWeaponTrailsEnabled( + weapon_trails_enabled, + )); + } + // Resolution let resolutions: Vec<[u16; 2]> = state .video_modes diff --git a/voxygen/src/scene/mod.rs b/voxygen/src/scene/mod.rs index 6ea249b7d8..53dd9c1e5f 100644 --- a/voxygen/src/scene/mod.rs +++ b/voxygen/src/scene/mod.rs @@ -118,7 +118,7 @@ pub struct SceneData<'a> { pub mouse_smoothing: bool, pub sprite_render_distance: f32, pub particles_enabled: bool, - pub trails_enabled: bool, + pub weapon_trails_enabled: bool, pub figure_lod_render_distance: f32, pub is_aiming: bool, } diff --git a/voxygen/src/scene/trail.rs b/voxygen/src/scene/trail.rs index b2ce433eaf..e964e0c36e 100644 --- a/voxygen/src/scene/trail.rs +++ b/voxygen/src/scene/trail.rs @@ -33,7 +33,7 @@ impl TrailMgr { pub fn maintain(&mut self, renderer: &mut Renderer, scene_data: &SceneData) { span!(_guard, "maintain", "TrailMgr::maintain"); - if scene_data.particles_enabled { + if scene_data.weapon_trails_enabled { // remove dead Trails // self.trails // .retain(|t| t.alive_until > scene_data.state.get_time()); @@ -72,7 +72,7 @@ impl TrailMgr { pub fn render<'a>(&'a self, drawer: &mut TrailDrawer<'_, 'a>, scene_data: &SceneData) { span!(_guard, "render", "TrailMgr::render"); - if scene_data.trails_enabled { + if scene_data.weapon_trails_enabled { for dynamic_model in self.dynamic_models.values() { drawer.draw(dynamic_model); } diff --git a/voxygen/src/session/mod.rs b/voxygen/src/session/mod.rs index 61290c519b..b63353a389 100644 --- a/voxygen/src/session/mod.rs +++ b/voxygen/src/session/mod.rs @@ -1474,7 +1474,7 @@ impl PlayState for SessionState { sprite_render_distance: global_state.settings.graphics.sprite_render_distance as f32, particles_enabled: global_state.settings.graphics.particles_enabled, - trails_enabled: global_state.settings.graphics.trails_enabled, + weapon_trails_enabled: global_state.settings.graphics.weapon_trails_enabled, figure_lod_render_distance: global_state .settings .graphics @@ -1548,7 +1548,7 @@ impl PlayState for SessionState { sprite_render_distance: settings.graphics.sprite_render_distance as f32, figure_lod_render_distance: settings.graphics.figure_lod_render_distance as f32, particles_enabled: settings.graphics.particles_enabled, - trails_enabled: settings.graphics.trails_enabled, + weapon_trails_enabled: settings.graphics.weapon_trails_enabled, is_aiming: self.is_aiming, }; diff --git a/voxygen/src/session/settings_change.rs b/voxygen/src/session/settings_change.rs index b164acade5..79608fab23 100644 --- a/voxygen/src/session/settings_change.rs +++ b/voxygen/src/session/settings_change.rs @@ -86,6 +86,7 @@ pub enum Graphics { ChangeFullscreenMode(FullScreenSettings), ToggleParticlesEnabled(bool), ToggleLossyTerrainCompression(bool), + ToggleWeaponTrailsEnabled(bool), AdjustWindowSize([u16; 2]), ResetGraphicsSettings, @@ -402,6 +403,9 @@ impl SettingsChange { .borrow_mut() .request_lossy_terrain_compression(lossy_terrain_compression); }, + Graphics::ToggleWeaponTrailsEnabled(weapon_trails_enabled) => { + settings.graphics.weapon_trails_enabled = weapon_trails_enabled; + }, Graphics::AdjustWindowSize(new_size) => { global_state.window.set_size(new_size.into()); settings.graphics.window_size = new_size; diff --git a/voxygen/src/settings/graphics.rs b/voxygen/src/settings/graphics.rs index 61de6bcc03..5c9b8b5f4a 100644 --- a/voxygen/src/settings/graphics.rs +++ b/voxygen/src/settings/graphics.rs @@ -32,8 +32,8 @@ pub struct GraphicsSettings { pub view_distance: u32, pub sprite_render_distance: u32, pub particles_enabled: bool, - pub trails_enabled: bool, pub lossy_terrain_compression: bool, + pub weapon_trails_enabled: bool, pub figure_lod_render_distance: u32, pub max_fps: Fps, pub max_background_fps: Fps, @@ -53,8 +53,8 @@ impl Default for GraphicsSettings { view_distance: 10, sprite_render_distance: 100, particles_enabled: true, - trails_enabled: true, lossy_terrain_compression: false, + weapon_trails_enabled: true, figure_lod_render_distance: 300, max_fps: Fps::Max(60), max_background_fps: Fps::Max(30),