Merge branch 'zesterer/small-fixes' into 'master'

Small Fixes

See merge request veloren/veloren!566
This commit is contained in:
Joshua Barretto 2019-10-08 12:34:43 +00:00
commit 05cecf5ee2
7 changed files with 15 additions and 8 deletions

View File

@ -29,7 +29,7 @@ out vec4 tgt_color;
void main() {
vec3 light, diffuse_light, ambient_light;
get_sun_diffuse(f_norm, time_of_day.x, light, diffuse_light, ambient_light);
get_sun_diffuse(f_norm, time_of_day.x, light, diffuse_light, ambient_light, 1.0);
float point_shadow = shadow_at(f_pos, f_norm);
diffuse_light *= point_shadow;
ambient_light *= point_shadow;

View File

@ -39,7 +39,7 @@ void main() {
vec3 norm = warp_normal(f_norm, f_pos, tick.x);
vec3 light, diffuse_light, ambient_light;
get_sun_diffuse(f_norm, time_of_day.x, light, diffuse_light, ambient_light);
get_sun_diffuse(f_norm, time_of_day.x, light, diffuse_light, ambient_light, 0.0);
float point_shadow = shadow_at(f_pos, f_norm);
diffuse_light *= f_light * point_shadow;
ambient_light *= f_light, point_shadow;
@ -60,7 +60,7 @@ void main() {
// 0 = 100% reflection, 1 = translucent water
float passthrough = pow(dot(faceforward(norm, norm, cam_to_frag), -cam_to_frag), 1.0);
vec4 color = mix(vec4(reflect_color, 1.0), vec4(surf_color, 0.5 / (1.0 + diffuse_light * 2.0)), passthrough);
vec4 color = mix(vec4(reflect_color, 1.0), vec4(surf_color, 3.0 / (1.0 + diffuse_light * 2.0)), passthrough);
tgt_color = mix(color, vec4(fog_color, 0.0), fog_level);
}

View File

@ -34,7 +34,7 @@ float get_sun_brightness(vec3 sun_dir) {
return max(-sun_dir.z + 0.6, 0.0);
}
void get_sun_diffuse(vec3 norm, float time_of_day, out vec3 light, out vec3 diffuse_light, out vec3 ambient_light) {
void get_sun_diffuse(vec3 norm, float time_of_day, out vec3 light, out vec3 diffuse_light, out vec3 ambient_light, float diffusion) {
const float SUN_AMBIANCE = 0.0;
vec3 sun_dir = get_sun_dir(time_of_day);
@ -56,7 +56,7 @@ void get_sun_diffuse(vec3 norm, float time_of_day, out vec3 light, out vec3 diff
vec3 sun_chroma = sun_color * sun_light;
light = sun_chroma + PERSISTENT_AMBIANCE;
diffuse_light = sun_chroma * (dot(-norm, sun_dir) * 0.5 + 0.5) + PERSISTENT_AMBIANCE;
diffuse_light = sun_chroma * mix(1.0, dot(-norm, sun_dir) * 0.5 + 0.5, diffusion) + PERSISTENT_AMBIANCE;
ambient_light = vec3(SUN_AMBIANCE * sun_light);
}

View File

@ -17,7 +17,7 @@ const float FADE_DIST = 32.0;
void main() {
vec3 light, diffuse_light, ambient_light;
get_sun_diffuse(f_norm, time_of_day.x, light, diffuse_light, ambient_light);
get_sun_diffuse(f_norm, time_of_day.x, light, diffuse_light, ambient_light, 1.0);
float point_shadow = shadow_at(f_pos, f_norm);
diffuse_light *= f_light * point_shadow;
ambient_light *= f_light, point_shadow;

View File

@ -20,7 +20,7 @@ out vec4 tgt_color;
void main() {
vec3 light, diffuse_light, ambient_light;
get_sun_diffuse(f_norm, time_of_day.x, light, diffuse_light, ambient_light);
get_sun_diffuse(f_norm, time_of_day.x, light, diffuse_light, ambient_light, 1.0);
float point_shadow = shadow_at(f_pos, f_norm);
diffuse_light *= f_light * point_shadow;
ambient_light *= f_light * point_shadow;

View File

@ -302,6 +302,13 @@ impl<'a> System<'a> for Sys {
) && vel.0.z < 0.0
&& vel.0.z > -1.5
&& was_on_ground
&& !terrain
.get(
Vec3::new(pos.0.x, pos.0.y, (pos.0.z - 0.05).floor())
.map(|e| e.floor() as i32),
)
.map(|vox| vox.is_solid())
.unwrap_or(false)
{
pos.0.z = (pos.0.z - 0.05).floor();
physics_state.on_ground = true;

View File

@ -233,7 +233,7 @@ impl<V: RectRasterableVol<Vox = Block> + ReadVol + Debug> Meshable<TerrainPipeli
offs,
&colors,
|pos, norm, col, ao, light| {
FluidVertex::new(pos, norm, col, light.min(ao), 0.3)
FluidVertex::new(pos, norm, col, light, 0.3)
},
false,
&lights,