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

Small Fixes

See merge request veloren/veloren!851
This commit is contained in:
Joshua Barretto 2020-03-17 17:48:43 +00:00
commit f83b223178
2 changed files with 21 additions and 3 deletions

View File

@ -25,7 +25,7 @@ vec3 illuminate(vec3 color, vec3 light, vec3 diffuse, vec3 ambience) {
}
float attenuation_strength(vec3 rpos) {
return 1.0 / (rpos.x * rpos.x + rpos.y * rpos.y + rpos.z * rpos.z);
return 1.0 / pow(rpos.x * rpos.x + rpos.y * rpos.y + rpos.z * rpos.z, 0.6);
}
vec3 light_at(vec3 wpos, vec3 wnorm) {

View File

@ -218,8 +218,26 @@ where
];
DIRS.iter()
.map(move |dir| pos + dir)
.filter(move |pos| is_walkable(pos))
.map(move |dir| (pos, dir))
.filter(move |(pos, dir)| {
is_walkable(pos)
&& ((dir.z < 1
|| vol
.get(pos + Vec3::unit_z() * 2)
.map(|b| !b.is_solid())
.unwrap_or(true))
&& (dir.z < 2
|| vol
.get(pos + Vec3::unit_z() * 3)
.map(|b| !b.is_solid())
.unwrap_or(true))
&& (dir.z >= 0
|| vol
.get(pos + *dir + Vec3::unit_z() * 2)
.map(|b| !b.is_solid())
.unwrap_or(true)))
})
.map(move |(pos, dir)| pos + dir)
.chain(
DIAGONALS
.iter()