mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Gamma setting now works
This commit is contained in:
parent
aaf1de9f9b
commit
abe47d8621
@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- Allow spawning individual pet species, not just generic body kinds.
|
- Allow spawning individual pet species, not just generic body kinds.
|
||||||
- Configurable fonts
|
- Configurable fonts
|
||||||
- Tanslation status tracking
|
- Tanslation status tracking
|
||||||
|
- Added gamma setting
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
@ -208,6 +208,7 @@ Enjoy your stay in the World of Veloren."#,
|
|||||||
"hud.settings.view_distance": "View Distance",
|
"hud.settings.view_distance": "View Distance",
|
||||||
"hud.settings.maximum_fps": "Maximum FPS",
|
"hud.settings.maximum_fps": "Maximum FPS",
|
||||||
"hud.settings.fov": "Field of View (deg)",
|
"hud.settings.fov": "Field of View (deg)",
|
||||||
|
"hud.settings.gamma": "Gamma",
|
||||||
"hud.settings.antialiasing_mode": "AntiAliasing Mode",
|
"hud.settings.antialiasing_mode": "AntiAliasing Mode",
|
||||||
"hud.settings.cloud_rendering_mode": "Cloud Rendering Mode",
|
"hud.settings.cloud_rendering_mode": "Cloud Rendering Mode",
|
||||||
"hud.settings.fluid_rendering_mode": "Fluid Rendering Mode",
|
"hud.settings.fluid_rendering_mode": "Fluid Rendering Mode",
|
||||||
|
@ -12,4 +12,5 @@ uniform u_globals {
|
|||||||
uvec4 light_shadow_count;
|
uvec4 light_shadow_count;
|
||||||
uvec4 medium;
|
uvec4 medium;
|
||||||
ivec4 select_pos;
|
ivec4 select_pos;
|
||||||
|
vec4 gamma;
|
||||||
};
|
};
|
||||||
|
@ -45,8 +45,6 @@ void main() {
|
|||||||
//hsva_color.z = 1.0 - 1.0 / (1.0 * hsva_color.z + 1.0);
|
//hsva_color.z = 1.0 - 1.0 / (1.0 * hsva_color.z + 1.0);
|
||||||
//vec4 final_color = vec4(hsv2rgb(hsva_color.rgb), hsva_color.a);
|
//vec4 final_color = vec4(hsv2rgb(hsva_color.rgb), hsva_color.a);
|
||||||
|
|
||||||
vec4 gamma = vec4(1.0);
|
|
||||||
|
|
||||||
vec4 final_color = pow(aa_color, gamma);
|
vec4 final_color = pow(aa_color, gamma);
|
||||||
|
|
||||||
if (medium.x == 1u) {
|
if (medium.x == 1u) {
|
||||||
|
@ -1566,10 +1566,10 @@ impl<'a> Widget for SettingsWindow<'a> {
|
|||||||
.color(TEXT_COLOR)
|
.color(TEXT_COLOR)
|
||||||
.set(state.ids.gamma_text, ui);
|
.set(state.ids.gamma_text, ui);
|
||||||
|
|
||||||
if let Some(new_val) = ImageSlider::continuous(
|
if let Some(new_val) = ImageSlider::discrete(
|
||||||
self.global_state.settings.graphics.gamma,
|
(self.global_state.settings.graphics.gamma.log2() * 8.0).round() as i32,
|
||||||
0.5,
|
8,
|
||||||
2.0,
|
-8,
|
||||||
self.imgs.slider_indicator,
|
self.imgs.slider_indicator,
|
||||||
self.imgs.slider,
|
self.imgs.slider,
|
||||||
)
|
)
|
||||||
@ -1580,7 +1580,7 @@ impl<'a> Widget for SettingsWindow<'a> {
|
|||||||
.pad_track((5.0, 5.0))
|
.pad_track((5.0, 5.0))
|
||||||
.set(state.ids.gamma_slider, ui)
|
.set(state.ids.gamma_slider, ui)
|
||||||
{
|
{
|
||||||
events.push(Event::AdjustGamma(new_val));
|
events.push(Event::AdjustGamma(2.0f32.powf(new_val as f32 / 8.0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
Text::new(&format!("{}", self.global_state.settings.graphics.gamma))
|
Text::new(&format!("{}", self.global_state.settings.graphics.gamma))
|
||||||
|
@ -99,6 +99,7 @@ impl PlayState for CharSelectionState {
|
|||||||
global_state.window.renderer_mut(),
|
global_state.window.renderer_mut(),
|
||||||
&self.client.borrow(),
|
&self.client.borrow(),
|
||||||
humanoid_body.clone(),
|
humanoid_body.clone(),
|
||||||
|
global_state.settings.graphics.gamma,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Render the scene.
|
// Render the scene.
|
||||||
|
@ -119,6 +119,7 @@ impl Scene {
|
|||||||
renderer: &mut Renderer,
|
renderer: &mut Renderer,
|
||||||
client: &Client,
|
client: &Client,
|
||||||
body: Option<humanoid::Body>,
|
body: Option<humanoid::Body>,
|
||||||
|
gamma: f32,
|
||||||
) {
|
) {
|
||||||
self.camera.set_focus_pos(Vec3::unit_z() * 1.5);
|
self.camera.set_focus_pos(Vec3::unit_z() * 1.5);
|
||||||
self.camera.update(client.state().get_time());
|
self.camera.update(client.state().get_time());
|
||||||
@ -142,6 +143,7 @@ impl Scene {
|
|||||||
0,
|
0,
|
||||||
BlockKind::Air,
|
BlockKind::Air,
|
||||||
None,
|
None,
|
||||||
|
gamma,
|
||||||
)]) {
|
)]) {
|
||||||
error!("Renderer failed to update: {:?}", err);
|
error!("Renderer failed to update: {:?}", err);
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ gfx_defines! {
|
|||||||
light_shadow_count: [u32; 4] = "light_shadow_count",
|
light_shadow_count: [u32; 4] = "light_shadow_count",
|
||||||
medium: [u32; 4] = "medium",
|
medium: [u32; 4] = "medium",
|
||||||
select_pos: [i32; 4] = "select_pos",
|
select_pos: [i32; 4] = "select_pos",
|
||||||
|
gamma: [f32; 4] = "gamma",
|
||||||
}
|
}
|
||||||
|
|
||||||
constant Light {
|
constant Light {
|
||||||
@ -53,6 +54,7 @@ impl Globals {
|
|||||||
shadow_count: usize,
|
shadow_count: usize,
|
||||||
medium: BlockKind,
|
medium: BlockKind,
|
||||||
select_pos: Option<Vec3<i32>>,
|
select_pos: Option<Vec3<i32>>,
|
||||||
|
gamma: f32,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
view_mat: arr_to_mat(view_mat.into_col_array()),
|
view_mat: arr_to_mat(view_mat.into_col_array()),
|
||||||
@ -70,6 +72,7 @@ impl Globals {
|
|||||||
.map(|sp| Vec4::from(sp) + Vec4::unit_w())
|
.map(|sp| Vec4::from(sp) + Vec4::unit_w())
|
||||||
.unwrap_or(Vec4::zero())
|
.unwrap_or(Vec4::zero())
|
||||||
.into_array(),
|
.into_array(),
|
||||||
|
gamma: [gamma; 4],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -89,6 +92,7 @@ impl Default for Globals {
|
|||||||
0,
|
0,
|
||||||
BlockKind::Air,
|
BlockKind::Air,
|
||||||
None,
|
None,
|
||||||
|
1.0,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -149,6 +149,7 @@ impl Scene {
|
|||||||
renderer: &mut Renderer,
|
renderer: &mut Renderer,
|
||||||
audio: &mut AudioFrontend,
|
audio: &mut AudioFrontend,
|
||||||
client: &Client,
|
client: &Client,
|
||||||
|
gamma: f32,
|
||||||
) {
|
) {
|
||||||
// Get player position.
|
// Get player position.
|
||||||
let player_pos = client
|
let player_pos = client
|
||||||
@ -296,6 +297,7 @@ impl Scene {
|
|||||||
.map(|b| b.kind())
|
.map(|b| b.kind())
|
||||||
.unwrap_or(BlockKind::Air),
|
.unwrap_or(BlockKind::Air),
|
||||||
self.select_pos,
|
self.select_pos,
|
||||||
|
gamma,
|
||||||
)])
|
)])
|
||||||
.expect("Failed to update global constants");
|
.expect("Failed to update global constants");
|
||||||
|
|
||||||
|
@ -614,6 +614,7 @@ impl PlayState for SessionState {
|
|||||||
global_state.window.renderer_mut(),
|
global_state.window.renderer_mut(),
|
||||||
&mut global_state.audio,
|
&mut global_state.audio,
|
||||||
&self.client.borrow(),
|
&self.client.borrow(),
|
||||||
|
global_state.settings.graphics.gamma,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Render the session.
|
// Render the session.
|
||||||
|
Loading…
Reference in New Issue
Block a user