Return empty mesh if blocky mesher doesnt find a type channel

This commit is contained in:
Marc Gilleron 2019-04-25 00:56:51 +01:00
parent fdb40ef3f4
commit 9e13c68da7
2 changed files with 7 additions and 2 deletions

View File

@ -129,7 +129,12 @@ Array VoxelMesher::build(const VoxelBuffer &buffer, unsigned int channel, Vector
// | | )
// \ | |
// \ /
CRASH_COND(type_buffer == NULL);
if (type_buffer == nullptr) {
// No data to read, the channel is probably uniform
// TODO This is an invalid behavior IF sending a full block of uniformly opaque cubes,
// however not likely for terrains because with neighbor padding, such a case means no face would be generated anyways
return Array();
}
//CRASH_COND(memarr_len(type_buffer) != buffer.get_volume() * sizeof(uint8_t));

View File

@ -8,7 +8,7 @@
#include <core/reference.h>
#include <scene/resources/mesh.h>
// TODO Should be renamed VoxelMesherModel or something like that
// TODO Should be renamed VoxelMesherBlocky or something like that
class VoxelMesher : public Reference {
GDCLASS(VoxelMesher, Reference)