Fixed shadows, better pathfinding cap

This commit is contained in:
Joshua Barretto 2020-01-24 09:50:03 +00:00
parent f92371101c
commit 7167320c92
2 changed files with 7 additions and 2 deletions

View File

@ -66,7 +66,7 @@ float shadow_at(vec3 wpos, vec3 wnorm) {
vec3 diff = shadow_pos - wpos;
if (diff.z >= 0.0) {
diff.z = sign(diff.z) * 0.1;
diff.z = -sign(diff.z) * diff.z * 0.1;
}
float shade = max(pow(diff.x * diff.x + diff.y * diff.y + diff.z * diff.z, 0.25) / pow(radius * radius * 0.5, 0.25), 0.5);

View File

@ -205,7 +205,12 @@ where
let satisfied = |pos: &Vec3<i32>| pos == &end;
let mut new_astar = match astar.take() {
None => Astar::new(50000, start, heuristic.clone()),
None => {
let max_iters = ((Vec2::<f32>::from(start).distance(Vec2::from(end)) + 10.0).powf(2.0)
as usize)
.min(25_000);
Astar::new(max_iters, start, heuristic.clone())
}
Some(astar) => astar,
};