mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Block-hopping fix, better dusk shaders
This commit is contained in:
parent
f1ba97ae7a
commit
f2df3a9d18
@ -260,10 +260,8 @@ impl<'a> System<'a> for Sys {
|
|||||||
// If the space above is free...
|
// If the space above is free...
|
||||||
if !collision_with(pos.0 + Vec3::unit_z() * 1.1, near_iter.clone())
|
if !collision_with(pos.0 + Vec3::unit_z() * 1.1, near_iter.clone())
|
||||||
&& resolve_dir.z == 0.0
|
&& resolve_dir.z == 0.0
|
||||||
&& terrain
|
&& vel.0.z <= 0.0
|
||||||
.get((pos.0 - Vec3::unit_z()).map(|e| e.floor() as i32)) // Make sure we're close to the ground
|
&& collision_with(pos.0 + resolve_dir - Vec3::unit_z() * 1.05, near_iter.clone())
|
||||||
.map(|vox| !vox.is_empty())
|
|
||||||
.unwrap_or(false)
|
|
||||||
{
|
{
|
||||||
// ...block-hop!
|
// ...block-hop!
|
||||||
pos.0.z = (pos.0.z + 1.0).ceil();
|
pos.0.z = (pos.0.z + 1.0).ceil();
|
||||||
@ -284,7 +282,7 @@ impl<'a> System<'a> for Sys {
|
|||||||
if on_ground {
|
if on_ground {
|
||||||
on_grounds.insert(entity, OnGround);
|
on_grounds.insert(entity, OnGround);
|
||||||
// If we're not on the ground but the space below us is free, then "snap" to the ground
|
// If we're not on the ground but the space below us is free, then "snap" to the ground
|
||||||
} else if collision_with(pos.0 - Vec3::unit_z() * 1.0, near_iter.clone())
|
} else if collision_with(pos.0 - Vec3::unit_z() * 1.05, near_iter.clone())
|
||||||
&& vel.0.z < 0.0
|
&& vel.0.z < 0.0
|
||||||
&& vel.0.z > -1.0
|
&& vel.0.z > -1.0
|
||||||
&& was_on_ground
|
&& was_on_ground
|
||||||
|
@ -45,9 +45,9 @@ vec3 get_sun_diffuse(vec3 norm, float time_of_day) {
|
|||||||
),
|
),
|
||||||
DAY_LIGHT,
|
DAY_LIGHT,
|
||||||
clamp(-sun_dir.z, 0, 1)
|
clamp(-sun_dir.z, 0, 1)
|
||||||
)) / 2.0 + 0.5;
|
));
|
||||||
|
|
||||||
vec3 diffuse_light = (SUN_AMBIANCE + max(dot(-norm, sun_dir), 0.0)) * sun_light * sun_color + PERSISTENT_AMBIANCE;
|
vec3 diffuse_light = (SUN_AMBIANCE + max(dot(-norm, sun_dir), 0.0) * sun_color) * sun_light + PERSISTENT_AMBIANCE;
|
||||||
|
|
||||||
return diffuse_light;
|
return diffuse_light;
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ impl World {
|
|||||||
|
|
||||||
pub fn generate_chunk(&self, chunk_pos: Vec2<i32>) -> TerrainChunk {
|
pub fn generate_chunk(&self, chunk_pos: Vec2<i32>) -> TerrainChunk {
|
||||||
let air = Block::empty();
|
let air = Block::empty();
|
||||||
let stone = Block::new(1, Rgb::new(200, 220, 255));
|
let stone = Block::new(2, Rgb::new(200, 220, 255));
|
||||||
let water = Block::new(5, Rgb::new(100, 150, 255));
|
let water = Block::new(5, Rgb::new(100, 150, 255));
|
||||||
|
|
||||||
let chunk_size2d = Vec2::from(TerrainChunkSize::SIZE);
|
let chunk_size2d = Vec2::from(TerrainChunkSize::SIZE);
|
||||||
|
Loading…
Reference in New Issue
Block a user