Removed dead code

This commit is contained in:
Joshua Barretto 2021-02-15 01:23:16 +00:00
parent 7939442231
commit 770328bf69

View File

@ -127,46 +127,26 @@ fn calc_light<V: RectRasterableVol<Vox = Block> + ReadVol + Debug>(
let pos = Vec3::new(pos.0 as i32, pos.1 as i32, pos.2 as i32); let pos = Vec3::new(pos.0 as i32, pos.1 as i32, pos.2 as i32);
let light = light_map[lm_idx(pos.x, pos.y, pos.z)]; let light = light_map[lm_idx(pos.x, pos.y, pos.z)];
// If ray propagate downwards at full strength // Up
if is_sunlight && light == SUNLIGHT && false { // Bounds checking
// Down is special cased and we know up is a ray if pos.z + 1 < outer.size().d {
// Special cased ray propagation propagate(
let pos = Vec3::new(pos.x, pos.y, pos.z - 1); light,
let (is_air, is_liquid) = vol_cached light_map.get_mut(lm_idx(pos.x, pos.y, pos.z + 1)).unwrap(),
.get(outer.min + pos) Vec3::new(pos.x, pos.y, pos.z + 1),
.ok() &mut prop_que,
.map_or((false, false), |b| (b.is_air(), b.is_liquid())); &mut vol_cached,
light_map[lm_idx(pos.x, pos.y, pos.z)] = if is_air { )
prop_que.push_back((pos.x as u8, pos.y as u8, pos.z as u16)); }
SUNLIGHT // Down
} else if is_liquid { if pos.z > 0 {
prop_que.push_back((pos.x as u8, pos.y as u8, pos.z as u16)); propagate(
SUNLIGHT - 1 light,
} else { light_map.get_mut(lm_idx(pos.x, pos.y, pos.z - 1)).unwrap(),
OPAQUE Vec3::new(pos.x, pos.y, pos.z - 1),
} &mut prop_que,
} else { &mut vol_cached,
// Up )
// Bounds checking
if pos.z + 1 < outer.size().d {
propagate(
light,
light_map.get_mut(lm_idx(pos.x, pos.y, pos.z + 1)).unwrap(),
Vec3::new(pos.x, pos.y, pos.z + 1),
&mut prop_que,
&mut vol_cached,
)
}
// Down
if pos.z > 0 {
propagate(
light,
light_map.get_mut(lm_idx(pos.x, pos.y, pos.z - 1)).unwrap(),
Vec3::new(pos.x, pos.y, pos.z - 1),
&mut prop_que,
&mut vol_cached,
)
}
} }
// The XY directions // The XY directions
if pos.y + 1 < outer.size().h { if pos.y + 1 < outer.size().h {