Moved is_mesh_empty() to utility.h

This commit is contained in:
Marc Gilleron 2019-04-29 21:32:28 +01:00
parent d1c21bdf5d
commit c80a24ef0b
2 changed files with 12 additions and 11 deletions

View File

@ -525,17 +525,6 @@ static void remove_positions_outside_box(
}
}
static inline bool is_mesh_empty(Ref<Mesh> mesh_ref) {
if (mesh_ref.is_null())
return true;
const Mesh &mesh = **mesh_ref;
if (mesh.get_surface_count() == 0)
return true;
if (mesh.surface_get_array_len(0) == 0)
return true;
return false;
}
void VoxelTerrain::_process() {
// TODO Should be able to run without library, tho!

View File

@ -5,6 +5,7 @@
#include <core/pool_vector.h>
#include <core/ustring.h>
#include <core/vector.h>
#include <scene/resources/mesh.h>
#include <vector>
// Takes elements starting from a given position and moves them at the beginning,
@ -79,4 +80,15 @@ inline float max(const float &a, const float &b) {
return a > b ? a : b;
}
inline bool is_mesh_empty(Ref<Mesh> mesh_ref) {
if (mesh_ref.is_null())
return true;
const Mesh &mesh = **mesh_ref;
if (mesh.get_surface_count() == 0)
return true;
if (mesh.surface_get_array_len(0) == 0)
return true;
return false;
}
#endif // HEADER_VOXEL_UTILITY_H