mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'zesterer/tiny-fixes' into 'master'
Addressing criticisms See merge request veloren/veloren!3121
This commit is contained in:
commit
8a684973b4
@ -105,6 +105,7 @@
|
||||
"hud.settings.save_window_size": "Save window size",
|
||||
"hud.settings.reset_graphics": "Reset to Defaults",
|
||||
"hud.settings.bloom": "Bloom",
|
||||
"hud.settings.point_glow": "Point Glow",
|
||||
|
||||
"hud.settings.master_volume": "Master Volume",
|
||||
"hud.settings.inactive_master_volume_perc": "Inactive Window Volume",
|
||||
|
@ -70,9 +70,7 @@ void main() {
|
||||
#if (CLOUD_MODE != CLOUD_MODE_NONE)
|
||||
color.rgb = get_cloud_color(color.rgb, dir, cam_pos.xyz, time_of_day.x, dist, 1.0);
|
||||
#else
|
||||
#ifdef BLOOM_FACTOR
|
||||
color.rgb = apply_point_glow(cam_pos.xyz + focus_off.xyz, dir, dist, color.rgb, BLOOM_FACTOR);
|
||||
#endif
|
||||
color.rgb = apply_point_glow(cam_pos.xyz + focus_off.xyz, dir, dist, color.rgb, BLOOM_FACTOR);
|
||||
#endif
|
||||
|
||||
tgt_color = vec4(color.rgb, 1);
|
||||
|
@ -265,9 +265,7 @@ vec3 get_cloud_color(vec3 surf_color, vec3 dir, vec3 origin, const float time_of
|
||||
}
|
||||
|
||||
// Apply point glow
|
||||
#ifdef BLOOM_FACTOR
|
||||
surf_color = apply_point_glow(origin, dir, max_dist, surf_color, BLOOM_FACTOR);
|
||||
#endif
|
||||
surf_color = apply_point_glow(origin, dir, max_dist, surf_color);
|
||||
|
||||
return surf_color;
|
||||
}
|
||||
|
@ -54,6 +54,12 @@
|
||||
#define SHADOW_MODE <mode>
|
||||
*/
|
||||
|
||||
/* Constants possibly defined automatically by configuration: */
|
||||
|
||||
/*
|
||||
#define POINT_GLOW_FACTOR <0.0..1.0>
|
||||
*/
|
||||
|
||||
/* Constants expected to be defined by any shader that needs to perform lighting calculations
|
||||
* (but whose values may take automatically defined constants into account): */
|
||||
|
||||
|
@ -318,9 +318,13 @@ vec3 lod_norm(vec2 f_pos/*vec3 pos*/) {
|
||||
#ifdef EXPERIMENTAL_PROCEDURALLODDETAIL
|
||||
vec2 wpos = f_pos + focus_off.xy;
|
||||
norm.xy += vec2(
|
||||
textureLod(sampler2D(t_noise, s_noise), wpos / 200, 0).x - 0.5,
|
||||
textureLod(sampler2D(t_noise, s_noise), wpos / 200 + 0.5, 0).x - 0.5
|
||||
) * 0.35;
|
||||
textureLod(sampler2D(t_noise, s_noise), wpos / 250, 0).x - 0.5,
|
||||
textureLod(sampler2D(t_noise, s_noise), wpos / 250 + 0.5, 0).x - 0.5
|
||||
) * 0.25 / pow(norm.z + 0.1, 3);
|
||||
norm.xy += vec2(
|
||||
textureLod(sampler2D(t_noise, s_noise), wpos / 100, 0).x - 0.5,
|
||||
textureLod(sampler2D(t_noise, s_noise), wpos / 100 + 0.5, 0).x - 0.5
|
||||
) * 0.15 / pow(norm.z + 0.1, 3);
|
||||
norm = normalize(norm);
|
||||
#endif
|
||||
|
||||
@ -356,7 +360,10 @@ vec3 lod_col(vec2 pos) {
|
||||
vec2 shift = vec2(
|
||||
textureLod(sampler2D(t_noise, s_noise), wpos / 200, 0).x - 0.5,
|
||||
textureLod(sampler2D(t_noise, s_noise), wpos / 200 + 0.5, 0).x - 0.5
|
||||
) * 64;
|
||||
) * 64 + vec2(
|
||||
textureLod(sampler2D(t_noise, s_noise), wpos / 50, 0).x - 0.5,
|
||||
textureLod(sampler2D(t_noise, s_noise), wpos / 50 + 0.5, 0).x - 0.5
|
||||
) * 48;
|
||||
pos += shift;
|
||||
wpos += shift;
|
||||
#endif
|
||||
@ -365,10 +372,10 @@ vec3 lod_col(vec2 pos) {
|
||||
|
||||
#ifdef EXPERIMENTAL_PROCEDURALLODDETAIL
|
||||
col *= pow(vec3(
|
||||
textureLod(sampler2D(t_noise, s_noise), wpos / 40, 0).x,
|
||||
textureLod(sampler2D(t_noise, s_noise), wpos / 50 + 0.5, 0).x,
|
||||
textureLod(sampler2D(t_noise, s_noise), wpos / 45 + 0.75, 0).x
|
||||
), vec3(0.5));
|
||||
textureLod(sampler2D(t_noise, s_noise), wpos / 40, 0).x - 0.5,
|
||||
textureLod(sampler2D(t_noise, s_noise), wpos / 50 + 0.5, 0).x - 0.5,
|
||||
textureLod(sampler2D(t_noise, s_noise), wpos / 45 + 0.75, 0).x - 0.5
|
||||
) + 1.0, vec3(0.5));
|
||||
#endif
|
||||
|
||||
return col;
|
||||
|
@ -1,8 +1,10 @@
|
||||
#ifndef POINT_GLOW_GLSL
|
||||
#define POINT_GLOW_GLSL
|
||||
|
||||
vec3 apply_point_glow(vec3 wpos, vec3 dir, float max_dist, vec3 color, const float factor) {
|
||||
#ifndef EXPERIMENTAL_NOPOINTGLOW
|
||||
vec3 apply_point_glow(vec3 wpos, vec3 dir, float max_dist, vec3 color) {
|
||||
#ifndef POINT_GLOW_FACTOR
|
||||
return color;
|
||||
#else
|
||||
for (uint i = 0u; i < light_shadow_count.x; i ++) {
|
||||
// Only access the array once
|
||||
Light L = lights[i];
|
||||
@ -32,9 +34,9 @@ vec3 apply_point_glow(vec3 wpos, vec3 dir, float max_dist, vec3 color, const flo
|
||||
|
||||
const float LIGHT_AMBIANCE = 0.025;
|
||||
color += light_color
|
||||
* 0.025
|
||||
* 0.05
|
||||
// Constant, *should* const fold
|
||||
* pow(factor, 0.65);
|
||||
* POINT_GLOW_FACTOR;
|
||||
}
|
||||
#endif
|
||||
return color;
|
||||
|
@ -245,8 +245,8 @@ impl CharacterState {
|
||||
self,
|
||||
CharacterState::Idle(_)
|
||||
| CharacterState::Sit
|
||||
| CharacterState::Dance
|
||||
| CharacterState::Talk
|
||||
| CharacterState::GlideWield(_)
|
||||
| CharacterState::Stunned(_)
|
||||
| CharacterState::BasicBlock(_)
|
||||
| CharacterState::Equipping(_)
|
||||
|
@ -74,6 +74,9 @@ widget_ids! {
|
||||
bloom_intensity_text,
|
||||
bloom_intensity_slider,
|
||||
bloom_intensity_value,
|
||||
point_glow_text,
|
||||
point_glow_slider,
|
||||
point_glow_value,
|
||||
//
|
||||
upscale_factor_text,
|
||||
upscale_factor_list,
|
||||
@ -727,7 +730,6 @@ impl<'a> Widget for Video<'a> {
|
||||
BloomMode::On(bloom) => bloom.factor.fraction(),
|
||||
};
|
||||
let max_bloom = 0.3;
|
||||
let bloom_value = ((bloom_intensity * 100.0 / max_bloom) as i32).to_string();
|
||||
|
||||
Text::new(self.localized_strings.get("hud.settings.bloom"))
|
||||
.font_size(self.fonts.cyri.scale(14))
|
||||
@ -769,12 +771,55 @@ impl<'a> Widget for Video<'a> {
|
||||
})))
|
||||
}
|
||||
}
|
||||
Text::new(&format!("{}%", &bloom_value))
|
||||
.right_from(state.ids.bloom_intensity_slider, 8.0)
|
||||
Text::new(&if bloom_intensity <= f32::EPSILON {
|
||||
"Off".to_string()
|
||||
} else {
|
||||
format!("{}%", (bloom_intensity * 100.0 / max_bloom) as i32)
|
||||
})
|
||||
.right_from(state.ids.bloom_intensity_slider, 8.0)
|
||||
.font_size(self.fonts.cyri.scale(14))
|
||||
.font_id(self.fonts.cyri.conrod_id)
|
||||
.color(TEXT_COLOR)
|
||||
.set(state.ids.bloom_intensity_value, ui);
|
||||
|
||||
// Point Glow
|
||||
Text::new(self.localized_strings.get("hud.settings.point_glow"))
|
||||
.font_size(self.fonts.cyri.scale(14))
|
||||
.font_id(self.fonts.cyri.conrod_id)
|
||||
.down_from(state.ids.aa_mode_list, 10.0)
|
||||
.right_from(state.ids.bloom_intensity_value, 10.0)
|
||||
.color(TEXT_COLOR)
|
||||
.set(state.ids.bloom_intensity_value, ui);
|
||||
.set(state.ids.point_glow_text, ui);
|
||||
if let Some(new_val) = ImageSlider::continuous(
|
||||
render_mode.point_glow,
|
||||
0.0,
|
||||
1.0,
|
||||
self.imgs.slider_indicator,
|
||||
self.imgs.slider,
|
||||
)
|
||||
.w_h(104.0, 22.0)
|
||||
.down_from(state.ids.point_glow_text, 8.0)
|
||||
.track_breadth(12.0)
|
||||
.slider_length(10.0)
|
||||
.pad_track((5.0, 5.0))
|
||||
.set(state.ids.point_glow_slider, ui)
|
||||
{
|
||||
// Toggle Bloom On and set Custom value to new_val
|
||||
events.push(GraphicsChange::ChangeRenderMode(Box::new(RenderMode {
|
||||
point_glow: new_val,
|
||||
..render_mode.clone()
|
||||
})));
|
||||
}
|
||||
Text::new(&if render_mode.point_glow <= f32::EPSILON {
|
||||
"Off".to_string()
|
||||
} else {
|
||||
format!("{}%", (render_mode.point_glow * 100.0) as i32)
|
||||
})
|
||||
.right_from(state.ids.point_glow_slider, 8.0)
|
||||
.font_size(self.fonts.cyri.scale(14))
|
||||
.font_id(self.fonts.cyri.conrod_id)
|
||||
.color(TEXT_COLOR)
|
||||
.set(state.ids.point_glow_value, ui);
|
||||
|
||||
// Upscaling factor
|
||||
Text::new(self.localized_strings.get("hud.settings.upscale_factor"))
|
||||
|
@ -332,7 +332,7 @@ impl BloomMode {
|
||||
}
|
||||
|
||||
/// Render modes
|
||||
#[derive(PartialEq, Clone, Debug, Default, Serialize, Deserialize)]
|
||||
#[derive(PartialEq, Clone, Debug, Serialize, Deserialize)]
|
||||
#[serde(default)]
|
||||
pub struct RenderMode {
|
||||
pub aa: AaMode,
|
||||
@ -341,6 +341,8 @@ pub struct RenderMode {
|
||||
pub lighting: LightingMode,
|
||||
pub shadow: ShadowMode,
|
||||
pub bloom: BloomMode,
|
||||
/// 0.0..1.0
|
||||
pub point_glow: f32,
|
||||
|
||||
pub experimental_shaders: HashSet<ExperimentalShader>,
|
||||
|
||||
@ -349,6 +351,24 @@ pub struct RenderMode {
|
||||
pub profiler_enabled: bool,
|
||||
}
|
||||
|
||||
impl Default for RenderMode {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
aa: AaMode::default(),
|
||||
cloud: CloudMode::default(),
|
||||
fluid: FluidMode::default(),
|
||||
lighting: LightingMode::default(),
|
||||
shadow: ShadowMode::default(),
|
||||
bloom: BloomMode::default(),
|
||||
point_glow: 0.35,
|
||||
experimental_shaders: HashSet::default(),
|
||||
upscale_mode: UpscaleMode::default(),
|
||||
present_mode: PresentMode::default(),
|
||||
profiler_enabled: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl RenderMode {
|
||||
fn split(self) -> (PipelineModes, OtherModes) {
|
||||
(
|
||||
@ -359,6 +379,7 @@ impl RenderMode {
|
||||
lighting: self.lighting,
|
||||
shadow: self.shadow,
|
||||
bloom: self.bloom,
|
||||
point_glow: self.point_glow,
|
||||
experimental_shaders: self.experimental_shaders,
|
||||
},
|
||||
OtherModes {
|
||||
@ -380,6 +401,7 @@ pub struct PipelineModes {
|
||||
lighting: LightingMode,
|
||||
pub shadow: ShadowMode,
|
||||
bloom: BloomMode,
|
||||
point_glow: f32,
|
||||
experimental_shaders: HashSet<ExperimentalShader>,
|
||||
}
|
||||
|
||||
@ -403,9 +425,6 @@ pub enum ExperimentalShader {
|
||||
NoNoise,
|
||||
/// Simulated a curved world.
|
||||
CurvedWorld,
|
||||
/// Remove the glow effect around point lights (this is *not* the same thing
|
||||
/// as bloom).
|
||||
NoPointGlow,
|
||||
/// Adds extra detail to distant LoD (Level of Detail) terrain procedurally.
|
||||
ProceduralLodDetail,
|
||||
}
|
||||
|
@ -182,6 +182,13 @@ impl ShaderModules {
|
||||
},
|
||||
);
|
||||
|
||||
if pipeline_modes.point_glow > f32::EPSILON {
|
||||
constants += &format!(
|
||||
"\n#define POINT_GLOW_FACTOR {}\n",
|
||||
pipeline_modes.point_glow
|
||||
);
|
||||
}
|
||||
|
||||
for shader in pipeline_modes.experimental_shaders.iter() {
|
||||
constants += &format!(
|
||||
"#define EXPERIMENTAL_{}\n",
|
||||
|
@ -10,6 +10,8 @@ use client::Client;
|
||||
use common::{
|
||||
comp,
|
||||
consts::MAX_PICKUP_RANGE,
|
||||
link::Is,
|
||||
mounting::Mount,
|
||||
terrain::Block,
|
||||
util::find_dist::{Cube, Cylinder, FindDist},
|
||||
vol::ReadVol,
|
||||
@ -121,6 +123,7 @@ pub(super) fn select_interactable(
|
||||
let scales = ecs.read_storage::<comp::Scale>();
|
||||
let colliders = ecs.read_storage::<comp::Collider>();
|
||||
let char_states = ecs.read_storage::<comp::CharacterState>();
|
||||
let is_mount = ecs.read_storage::<Is<Mount>>();
|
||||
|
||||
let player_cylinder = Cylinder::from_components(
|
||||
player_pos,
|
||||
@ -135,10 +138,11 @@ pub(super) fn select_interactable(
|
||||
scales.maybe(),
|
||||
colliders.maybe(),
|
||||
char_states.maybe(),
|
||||
!&is_mount,
|
||||
)
|
||||
.join()
|
||||
.filter(|(e, _, _, _, _)| *e != player_entity)
|
||||
.map(|(e, p, s, c, cs)| {
|
||||
.filter(|(e, _, _, _, _, _)| *e != player_entity)
|
||||
.map(|(e, p, s, c, cs, _)| {
|
||||
let cylinder = Cylinder::from_components(p.0, s.copied(), c, cs);
|
||||
(e, cylinder)
|
||||
})
|
||||
|
@ -5,6 +5,8 @@ use client::{self, Client};
|
||||
use common::{
|
||||
comp,
|
||||
consts::MAX_PICKUP_RANGE,
|
||||
link::Is,
|
||||
mounting::Mount,
|
||||
terrain::Block,
|
||||
util::find_dist::{Cylinder, FindDist},
|
||||
vol::ReadVol,
|
||||
@ -123,10 +125,11 @@ pub(super) fn targets_under_cursor(
|
||||
scales.maybe(),
|
||||
&ecs.read_storage::<comp::Body>(),
|
||||
ecs.read_storage::<comp::Item>().maybe(),
|
||||
!&ecs.read_storage::<Is<Mount>>(),
|
||||
)
|
||||
.join()
|
||||
.filter(|(e, _, _, _, _)| *e != player_entity)
|
||||
.filter_map(|(e, p, s, b, i)| {
|
||||
.filter(|(e, _, _, _, _, _)| *e != player_entity)
|
||||
.filter_map(|(e, p, s, b, i, _)| {
|
||||
const RADIUS_SCALE: f32 = 3.0;
|
||||
// TODO: use collider radius instead of body radius?
|
||||
let radius = s.map_or(1.0, |s| s.0) * b.max_radius() * RADIUS_SCALE;
|
||||
|
Loading…
Reference in New Issue
Block a user