2019-04-20 18:32:10 +02:00
|
|
|
#ifndef VOXEL_MESHER_DMC_H
|
|
|
|
#define VOXEL_MESHER_DMC_H
|
|
|
|
|
|
|
|
#include "../voxel_buffer.h"
|
2019-04-21 02:14:28 +02:00
|
|
|
#include "mesh_builder.h"
|
2019-04-20 18:32:10 +02:00
|
|
|
#include "scene/resources/mesh.h"
|
|
|
|
|
|
|
|
class VoxelMesherDMC : public Reference {
|
|
|
|
GDCLASS(VoxelMesherDMC, Reference)
|
|
|
|
public:
|
2019-04-20 22:21:45 +02:00
|
|
|
enum Mode {
|
|
|
|
MODE_NORMAL,
|
|
|
|
MODE_WIREFRAME,
|
|
|
|
MODE_DEBUG_OCTREE,
|
|
|
|
MODE_DEBUG_DUAL_GRID
|
|
|
|
};
|
|
|
|
|
2019-04-21 20:31:35 +02:00
|
|
|
Ref<ArrayMesh> build_mesh(const VoxelBuffer &voxels, real_t geometric_error, Mode mode);
|
2019-04-23 00:03:57 +02:00
|
|
|
Dictionary get_stats() const;
|
2019-04-20 18:32:10 +02:00
|
|
|
|
|
|
|
protected:
|
|
|
|
static void _bind_methods();
|
2019-04-21 20:31:35 +02:00
|
|
|
Ref<ArrayMesh> _build_mesh_b(Ref<VoxelBuffer> voxels, real_t geometric_error, Mode mode);
|
2019-04-21 02:14:28 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
dmc::MeshBuilder _mesh_builder;
|
2019-04-23 00:03:57 +02:00
|
|
|
|
|
|
|
struct Stats {
|
|
|
|
real_t octree_build_time;
|
|
|
|
real_t dualgrid_derivation_time;
|
|
|
|
real_t meshing_time;
|
|
|
|
real_t commit_time;
|
|
|
|
};
|
|
|
|
|
|
|
|
Stats _stats;
|
2019-04-20 18:32:10 +02:00
|
|
|
};
|
|
|
|
|
2019-04-20 22:21:45 +02:00
|
|
|
VARIANT_ENUM_CAST(VoxelMesherDMC::Mode)
|
|
|
|
|
2019-04-20 18:32:10 +02:00
|
|
|
#endif // VOXEL_MESHER_DMC_H
|