Fixed VoxelMap.get_buffer_copy() introducing voxels in channel 0 even if they don't exist

This commit is contained in:
Marc Gilleron 2019-04-27 02:03:08 +01:00
parent 8c6defee09
commit c86a5c53e1

View File

@ -120,6 +120,7 @@ void VoxelMap::get_buffer_copy(Vector3i min_pos, VoxelBuffer &dst_buffer, unsign
Vector3i min_block_pos = voxel_to_block(min_pos);
Vector3i max_block_pos = voxel_to_block(max_pos - Vector3i(1, 1, 1)) + Vector3i(1, 1, 1);
// TODO Why is this function limited by this check?
ERR_FAIL_COND((max_block_pos - min_block_pos) != Vector3i(3, 3, 3));
const Vector3i block_size_v(_block_size, _block_size, _block_size);
@ -148,7 +149,8 @@ void VoxelMap::get_buffer_copy(Vector3i min_pos, VoxelBuffer &dst_buffer, unsign
dst_buffer.fill_area(
_default_voxel[channel],
offset - min_pos,
offset - min_pos + block_size_v);
offset - min_pos + block_size_v,
channel);
}
}
}