Fixed bounds being snapped too large

master
Marc Gilleron 2020-10-24 00:06:09 +01:00
parent 4e65c8d937
commit e70f87e4a7
1 changed files with 1 additions and 1 deletions

View File

@ -1483,7 +1483,7 @@ void VoxelLodTerrain::set_voxel_bounds(Rect3i p_box) {
_bounds_in_voxels =
p_box.clipped(Rect3i::from_center_extents(Vector3i(), Vector3i(VoxelConstants::MAX_VOLUME_EXTENT)));
// Round to octree size
int octree_size = get_block_size() << get_lod_count();
const int octree_size = get_block_size() << (get_lod_count() - 1);
_bounds_in_voxels = _bounds_in_voxels.snapped(octree_size);
// Can't have a smaller region than one octree
for (unsigned i = 0; i < Vector3i::AXIS_COUNT; ++i) {