Fixed shadow distance culling

This commit is contained in:
Joshua Barretto 2019-09-25 14:38:58 +01:00
parent 7e6eede740
commit b0a1619698
2 changed files with 2 additions and 1 deletions

View File

@ -223,7 +223,7 @@ impl Scene {
.join()
.filter(|(pos, _)| {
(pos.0.distance_squared(player_pos) as f32)
< self.loaded_distance.powf(2.0).min(SHADOW_MAX_DIST) + SHADOW_DIST_RADIUS
< (self.loaded_distance.min(SHADOW_MAX_DIST) + SHADOW_DIST_RADIUS).powf(2.0)
})
.map(|(pos, scale)| Shadow::new(pos.0, scale.map(|s| s.0).unwrap_or(1.0)))
.collect::<Vec<_>>();

View File

@ -207,6 +207,7 @@ impl<'a> Sampler<'a> for ColumnGen<'a> {
let wposf3d = Vec3::new(wposf.x, wposf.y, alt as f64);
let marble_small = (sim.gen_ctx.hill_nz.get((wposf3d.div(3.0)).into_array()) as f32)
.powf(3.0)
.add(1.0)
.mul(0.5);
let marble = (sim.gen_ctx.hill_nz.get((wposf3d.div(48.0)).into_array()) as f32)