Fix empty result when a generator is used with an empty stream in VoxelLodTerrain

This commit is contained in:
Marc Gilleron 2022-07-19 22:55:02 +01:00
parent 151b795357
commit 2d98510543

View File

@ -63,7 +63,8 @@ void LoadBlockDataTask::run(zylann::ThreadedTaskContext ctx) {
if (voxel_query_data.result == VoxelStream::RESULT_ERROR) {
ERR_PRINT("Error loading voxel block");
} else if (voxel_query_data.result == VoxelStream::RESULT_BLOCK_NOT_FOUND && _generate_cache_data) {
} else if (voxel_query_data.result == VoxelStream::RESULT_BLOCK_NOT_FOUND) {
if (_generate_cache_data) {
Ref<VoxelGenerator> generator = _stream_dependency->generator;
if (generator.is_valid()) {
@ -85,6 +86,9 @@ void LoadBlockDataTask::run(zylann::ThreadedTaskContext ctx) {
// end up in the volume and that can cause errors.
// TODO Define format on volume?
}
} else {
_voxels.reset();
}
}
if (_request_instances && stream->supports_instance_blocks()) {