mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Settings button to turn off weapon trails.
This commit is contained in:
parent
f4abe4f275
commit
c6dc96b795
@ -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",
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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,
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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,
|
||||
};
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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),
|
||||
|
Loading…
Reference in New Issue
Block a user