Fix material assignments being shifted if one of the surfaces has no vertex

master
Marc Gilleron 2019-09-10 20:04:08 +01:00
parent 13e909fb0d
commit f59b34f1a0
2 changed files with 5 additions and 0 deletions

View File

@ -388,6 +388,10 @@ void VoxelMesherBlocky::build(VoxelMesher::Output &output, const VoxelBuffer &bu
}
output.surfaces.push_back(mesh_arrays);
} else {
// Empty
output.surfaces.push_back(Array());
}
}

View File

@ -8,6 +8,7 @@ class VoxelMesher : public Reference {
GDCLASS(VoxelMesher, Reference)
public:
struct Output {
// Each surface correspond to a different material
Vector<Array> surfaces;
Mesh::PrimitiveType primitive_type;
};