This commit is contained in:
StephenAdamson
2025-01-21 21:02:40 +00:00
parent 53b95f452f
commit bb3905e6b9
3 changed files with 8 additions and 4 deletions
+5 -1
View File
@@ -86,7 +86,7 @@ pub fn calculate_visibility(pos: IVec3, tilemap: &TileMap) -> [u32; 8] {
let mut is_occluded = false;
'vertical_check: for z_offset in 1..=35 {
'vertical_check: for z_offset in 1..5 {
let above_pos = IVec3::new(pos.x, pos.y, pos.z + (z_offset * tile_size));
if above_pos.z <= camera_z {
if let Some(&(_, opaque, _, _, _)) = tilemap.floor_tiles.get(&above_pos) {
@@ -95,6 +95,10 @@ pub fn calculate_visibility(pos: IVec3, tilemap: &TileMap) -> [u32; 8] {
break 'vertical_check;
}
}
if z_offset >= 4 {
is_occluded = true;
break 'vertical_check;
}
// if let Some(&(_, solid, _)) = tilemap.fixtures.get(&above_pos) {
// if solid {
// is_occluded = true;