mirror of
https://github.com/Relintai/godot_voxel.git
synced 2025-01-12 20:01:18 +01:00
Dual marching cubes WIP (only octree and dual grid extraction, untested)
This commit is contained in:
parent
6fc70a66c1
commit
1181cfa59f
1
SCsub
1
SCsub
@ -2,4 +2,5 @@ Import('env')
|
|||||||
|
|
||||||
env.add_source_files(env.modules_sources,"*.cpp")
|
env.add_source_files(env.modules_sources,"*.cpp")
|
||||||
env.add_source_files(env.modules_sources,"transvoxel/*.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
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
21
dmc/voxel_mesher_dmc.h
Normal 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
|
@ -1,13 +1,14 @@
|
|||||||
#include "register_types.h"
|
#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_buffer.h"
|
||||||
#include "voxel_mesher.h"
|
|
||||||
#include "voxel_library.h"
|
#include "voxel_library.h"
|
||||||
#include "voxel_map.h"
|
#include "voxel_map.h"
|
||||||
#include "voxel_terrain.h"
|
#include "voxel_mesher.h"
|
||||||
#include "voxel_provider_test.h"
|
|
||||||
#include "voxel_provider_image.h"
|
#include "voxel_provider_image.h"
|
||||||
#include "voxel_box_mover.h"
|
#include "voxel_provider_test.h"
|
||||||
#include "transvoxel/voxel_mesher_smooth.h"
|
#include "voxel_terrain.h"
|
||||||
|
|
||||||
void register_voxel_types() {
|
void register_voxel_types() {
|
||||||
|
|
||||||
@ -23,9 +24,8 @@ void register_voxel_types() {
|
|||||||
ClassDB::register_class<VoxelMesherSmooth>();
|
ClassDB::register_class<VoxelMesherSmooth>();
|
||||||
ClassDB::register_class<VoxelBoxMover>();
|
ClassDB::register_class<VoxelBoxMover>();
|
||||||
|
|
||||||
|
ClassDB::register_class<VoxelMesherDMC>();
|
||||||
}
|
}
|
||||||
|
|
||||||
void unregister_voxel_types() {
|
void unregister_voxel_types() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,8 +114,7 @@ void VoxelBuffer::fill(int defval, unsigned int channel_index) {
|
|||||||
channel.defval = defval;
|
channel.defval = defval;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
create_channel_noinit(channel_index, _size);
|
create_channel_noinit(channel_index, _size);
|
||||||
|
|
||||||
unsigned int volume = get_volume();
|
unsigned int volume = get_volume();
|
||||||
|
@ -110,8 +110,9 @@ private:
|
|||||||
// Default value when data is null
|
// Default value when data is null
|
||||||
uint8_t defval;
|
uint8_t defval;
|
||||||
|
|
||||||
Channel()
|
Channel() :
|
||||||
: data(NULL), defval(0) {}
|
data(NULL),
|
||||||
|
defval(0) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Each channel can store arbitary data.
|
// Each channel can store arbitary data.
|
||||||
|
Loading…
Reference in New Issue
Block a user