Dual marching cubes WIP (only octree and dual grid extraction, untested)

This commit is contained in:
Marc Gilleron 2019-04-20 17:32:10 +01:00
parent 6fc70a66c1
commit 1181cfa59f
6 changed files with 1114 additions and 14 deletions

1
SCsub
View File

@ -2,4 +2,5 @@ Import('env')
env.add_source_files(env.modules_sources,"*.cpp")
env.add_source_files(env.modules_sources,"transvoxel/*.cpp")
env.add_source_files(env.modules_sources,"dmc/*.cpp")

1078
dmc/voxel_mesher_dmc.cpp Normal file

File diff suppressed because it is too large Load Diff

21
dmc/voxel_mesher_dmc.h Normal file
View File

@ -0,0 +1,21 @@
#ifndef VOXEL_MESHER_DMC_H
#define VOXEL_MESHER_DMC_H
#include "../voxel_buffer.h"
#include "scene/resources/mesh.h"
namespace dmc {
Ref<ArrayMesh> polygonize(const VoxelBuffer &voxels, float geometric_error);
}
class VoxelMesherDMC : public Reference {
GDCLASS(VoxelMesherDMC, Reference)
public:
Ref<ArrayMesh> build_mesh(Ref<VoxelBuffer> voxels, real_t geometric_error);
protected:
static void _bind_methods();
};
#endif // VOXEL_MESHER_DMC_H

View File

@ -1,13 +1,14 @@
#include "register_types.h"
#include "dmc/voxel_mesher_dmc.h"
#include "transvoxel/voxel_mesher_smooth.h"
#include "voxel_box_mover.h"
#include "voxel_buffer.h"
#include "voxel_mesher.h"
#include "voxel_library.h"
#include "voxel_map.h"
#include "voxel_terrain.h"
#include "voxel_provider_test.h"
#include "voxel_mesher.h"
#include "voxel_provider_image.h"
#include "voxel_box_mover.h"
#include "transvoxel/voxel_mesher_smooth.h"
#include "voxel_provider_test.h"
#include "voxel_terrain.h"
void register_voxel_types() {
@ -23,9 +24,8 @@ void register_voxel_types() {
ClassDB::register_class<VoxelMesherSmooth>();
ClassDB::register_class<VoxelBoxMover>();
ClassDB::register_class<VoxelMesherDMC>();
}
void unregister_voxel_types() {
}

View File

@ -114,8 +114,7 @@ void VoxelBuffer::fill(int defval, unsigned int channel_index) {
channel.defval = defval;
return;
}
}
else
} else
create_channel_noinit(channel_index, _size);
unsigned int volume = get_volume();

View File

@ -110,8 +110,9 @@ private:
// Default value when data is null
uint8_t defval;
Channel()
: data(NULL), defval(0) {}
Channel() :
data(NULL),
defval(0) {}
};
// Each channel can store arbitary data.