mirror of
https://github.com/Relintai/voxelman.git
synced 2025-01-29 15:29:18 +01:00
Now the type and isolevel channels are customizable in the meshers.
This commit is contained in:
parent
4921252475
commit
5938f7f783
@ -38,7 +38,7 @@ void VoxelMesherBlocky::_add_chunk(Ref<VoxelChunk> p_chunk) {
|
|||||||
|
|
||||||
float voxel_scale = get_voxel_scale();
|
float voxel_scale = get_voxel_scale();
|
||||||
|
|
||||||
uint8_t *channel_type = chunk->get_channel(VoxelChunkDefault::DEFAULT_CHANNEL_TYPE);
|
uint8_t *channel_type = chunk->get_channel(_channel_index_type);
|
||||||
|
|
||||||
if (!channel_type)
|
if (!channel_type)
|
||||||
return;
|
return;
|
||||||
|
@ -112,6 +112,20 @@ void VoxelCubePoints::set_size(int value) {
|
|||||||
_size = value;
|
_size = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int VoxelCubePoints::get_channel_index_type() const {
|
||||||
|
return _channel_index_type;
|
||||||
|
}
|
||||||
|
void VoxelCubePoints::set_channel_index_type(const int value) {
|
||||||
|
_channel_index_type = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
int VoxelCubePoints::get_channel_index_isolevel() const {
|
||||||
|
return _channel_index_isolevel;
|
||||||
|
}
|
||||||
|
void VoxelCubePoints::set_channel_index_isolevel(const int value) {
|
||||||
|
_channel_index_isolevel = value;
|
||||||
|
}
|
||||||
|
|
||||||
void VoxelCubePoints::refresh_points() {
|
void VoxelCubePoints::refresh_points() {
|
||||||
for (int i = 0; i < POINT_COUNT; ++i) {
|
for (int i = 0; i < POINT_COUNT; ++i) {
|
||||||
recalculate_point(i);
|
recalculate_point(i);
|
||||||
@ -202,25 +216,25 @@ void VoxelCubePoints::refresh_neighbours(Ref<VoxelChunk> chunk) {
|
|||||||
int z = _z;
|
int z = _z;
|
||||||
|
|
||||||
//000
|
//000
|
||||||
if (chunk->get_voxel(x - 1, y, z, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE) != 0)
|
if (chunk->get_voxel(x - 1, y, z, _channel_index_type) != 0)
|
||||||
neighbours = neighbours | VOXEL_NEIGHBOUR_LEFT;
|
neighbours = neighbours | VOXEL_NEIGHBOUR_LEFT;
|
||||||
|
|
||||||
if (chunk->get_voxel(x, y - 1, z, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE) != 0)
|
if (chunk->get_voxel(x, y - 1, z, _channel_index_type) != 0)
|
||||||
neighbours = neighbours | VOXEL_NEIGHBOUR_BOTTOM;
|
neighbours = neighbours | VOXEL_NEIGHBOUR_BOTTOM;
|
||||||
|
|
||||||
if (chunk->get_voxel(x, y, z - 1, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE) != 0)
|
if (chunk->get_voxel(x, y, z - 1, _channel_index_type) != 0)
|
||||||
neighbours = neighbours | VOXEL_NEIGHBOUR_FRONT;
|
neighbours = neighbours | VOXEL_NEIGHBOUR_FRONT;
|
||||||
/*
|
/*
|
||||||
if (chunk->get_voxel(x - 1, y, z - 1, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE) != 0)
|
if (chunk->get_voxel(x - 1, y, z - 1, _channel_index_type) != 0)
|
||||||
neighbours = neighbours | VOXEL_NEIGHBOUR_LEFT_FRONT;
|
neighbours = neighbours | VOXEL_NEIGHBOUR_LEFT_FRONT;
|
||||||
|
|
||||||
if (chunk->get_voxel(x - 1, y - 1, z, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE) != 0)
|
if (chunk->get_voxel(x - 1, y - 1, z, _channel_index_type) != 0)
|
||||||
neighbours = neighbours | VOXEL_NEIGHBOUR_BOTTOM_LEFT;
|
neighbours = neighbours | VOXEL_NEIGHBOUR_BOTTOM_LEFT;
|
||||||
|
|
||||||
if (chunk->get_voxel(x, y - 1, z - 1, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE) != 0)
|
if (chunk->get_voxel(x, y - 1, z - 1, _channel_index_type) != 0)
|
||||||
neighbours = neighbours | VOXEL_NEIGHBOUR_BOTTOM_FRONT;
|
neighbours = neighbours | VOXEL_NEIGHBOUR_BOTTOM_FRONT;
|
||||||
|
|
||||||
if (chunk->get_voxel(x - 1, y - 1, z - 1, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE) != 0)
|
if (chunk->get_voxel(x - 1, y - 1, z - 1, _channel_index_type) != 0)
|
||||||
neighbours = neighbours | VOXEL_NEIGHBOUR_BOTTOM_LEFT_FRONT;*/
|
neighbours = neighbours | VOXEL_NEIGHBOUR_BOTTOM_LEFT_FRONT;*/
|
||||||
|
|
||||||
_point_neighbours[P000] = neighbours;
|
_point_neighbours[P000] = neighbours;
|
||||||
@ -231,25 +245,25 @@ void VoxelCubePoints::refresh_neighbours(Ref<VoxelChunk> chunk) {
|
|||||||
z = _z;
|
z = _z;
|
||||||
|
|
||||||
//100
|
//100
|
||||||
if (chunk->get_voxel(x + 1, y, z, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE) != 0)
|
if (chunk->get_voxel(x + 1, y, z, _channel_index_type) != 0)
|
||||||
neighbours = neighbours | VOXEL_NEIGHBOUR_RIGHT;
|
neighbours = neighbours | VOXEL_NEIGHBOUR_RIGHT;
|
||||||
|
|
||||||
if (chunk->get_voxel(x, y - 1, z, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE) != 0)
|
if (chunk->get_voxel(x, y - 1, z, _channel_index_type) != 0)
|
||||||
neighbours = neighbours | VOXEL_NEIGHBOUR_BOTTOM;
|
neighbours = neighbours | VOXEL_NEIGHBOUR_BOTTOM;
|
||||||
|
|
||||||
if (chunk->get_voxel(x, y, z - 1, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE) != 0)
|
if (chunk->get_voxel(x, y, z - 1, _channel_index_type) != 0)
|
||||||
neighbours = neighbours | VOXEL_NEIGHBOUR_FRONT;
|
neighbours = neighbours | VOXEL_NEIGHBOUR_FRONT;
|
||||||
/*
|
/*
|
||||||
if (chunk->get_voxel(x + 1, y, z - 1, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE) != 0)
|
if (chunk->get_voxel(x + 1, y, z - 1, _channel_index_type) != 0)
|
||||||
neighbours = neighbours | VOXEL_NEIGHBOUR_RIGHT_FRONT;
|
neighbours = neighbours | VOXEL_NEIGHBOUR_RIGHT_FRONT;
|
||||||
|
|
||||||
if (chunk->get_voxel(x + 1, y - 1, z, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE) != 0)
|
if (chunk->get_voxel(x + 1, y - 1, z, _channel_index_type) != 0)
|
||||||
neighbours = neighbours | VOXEL_NEIGHBOUR_BOTTOM_RIGHT;
|
neighbours = neighbours | VOXEL_NEIGHBOUR_BOTTOM_RIGHT;
|
||||||
|
|
||||||
if (chunk->get_voxel(x, y - 1, z - 1, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE) != 0)
|
if (chunk->get_voxel(x, y - 1, z - 1, _channel_index_type) != 0)
|
||||||
neighbours = neighbours | VOXEL_NEIGHBOUR_BOTTOM_FRONT;
|
neighbours = neighbours | VOXEL_NEIGHBOUR_BOTTOM_FRONT;
|
||||||
|
|
||||||
if (chunk->get_voxel(x + 1, y - 1, z - 1, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE) != 0)
|
if (chunk->get_voxel(x + 1, y - 1, z - 1, _channel_index_type) != 0)
|
||||||
neighbours = neighbours | VOXEL_NEIGHBOUR_BOTTOM_RIGHT_FRONT;*/
|
neighbours = neighbours | VOXEL_NEIGHBOUR_BOTTOM_RIGHT_FRONT;*/
|
||||||
|
|
||||||
_point_neighbours[P100] = neighbours;
|
_point_neighbours[P100] = neighbours;
|
||||||
@ -260,25 +274,25 @@ void VoxelCubePoints::refresh_neighbours(Ref<VoxelChunk> chunk) {
|
|||||||
z = _z;
|
z = _z;
|
||||||
|
|
||||||
//010
|
//010
|
||||||
if (chunk->get_voxel(x - 1, y, z, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE) != 0)
|
if (chunk->get_voxel(x - 1, y, z, _channel_index_type) != 0)
|
||||||
neighbours = neighbours | VOXEL_NEIGHBOUR_LEFT;
|
neighbours = neighbours | VOXEL_NEIGHBOUR_LEFT;
|
||||||
|
|
||||||
if (chunk->get_voxel(x, y + 1, z, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE) != 0)
|
if (chunk->get_voxel(x, y + 1, z, _channel_index_type) != 0)
|
||||||
neighbours = neighbours | VOXEL_NEIGHBOUR_TOP;
|
neighbours = neighbours | VOXEL_NEIGHBOUR_TOP;
|
||||||
|
|
||||||
if (chunk->get_voxel(x, y, z - 1, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE) != 0)
|
if (chunk->get_voxel(x, y, z - 1, _channel_index_type) != 0)
|
||||||
neighbours = neighbours | VOXEL_NEIGHBOUR_FRONT;
|
neighbours = neighbours | VOXEL_NEIGHBOUR_FRONT;
|
||||||
/*
|
/*
|
||||||
if (chunk->get_voxel(x - 1, y, z - 1, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE) != 0)
|
if (chunk->get_voxel(x - 1, y, z - 1, _channel_index_type) != 0)
|
||||||
neighbours = neighbours | VOXEL_NEIGHBOUR_LEFT_FRONT;
|
neighbours = neighbours | VOXEL_NEIGHBOUR_LEFT_FRONT;
|
||||||
|
|
||||||
if (chunk->get_voxel(x - 1, y + 1, z, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE) != 0)
|
if (chunk->get_voxel(x - 1, y + 1, z, _channel_index_type) != 0)
|
||||||
neighbours = neighbours | VOXEL_NEIGHBOUR_TOP_LEFT;
|
neighbours = neighbours | VOXEL_NEIGHBOUR_TOP_LEFT;
|
||||||
|
|
||||||
if (chunk->get_voxel(x, y + 1, z - 1, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE) != 0)
|
if (chunk->get_voxel(x, y + 1, z - 1, _channel_index_type) != 0)
|
||||||
neighbours = neighbours | VOXEL_NEIGHBOUR_TOP_FRONT;
|
neighbours = neighbours | VOXEL_NEIGHBOUR_TOP_FRONT;
|
||||||
|
|
||||||
if (chunk->get_voxel(x - 1, y + 1, z - 1, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE) != 0)
|
if (chunk->get_voxel(x - 1, y + 1, z - 1, _channel_index_type) != 0)
|
||||||
neighbours = neighbours | VOXEL_NEIGHBOUR_TOP_LEFT_FRONT;*/
|
neighbours = neighbours | VOXEL_NEIGHBOUR_TOP_LEFT_FRONT;*/
|
||||||
|
|
||||||
_point_neighbours[P010] = neighbours;
|
_point_neighbours[P010] = neighbours;
|
||||||
@ -289,25 +303,25 @@ void VoxelCubePoints::refresh_neighbours(Ref<VoxelChunk> chunk) {
|
|||||||
z = _z;
|
z = _z;
|
||||||
|
|
||||||
//110
|
//110
|
||||||
if (chunk->get_voxel(x + 1, y, z, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE) != 0)
|
if (chunk->get_voxel(x + 1, y, z, _channel_index_type) != 0)
|
||||||
neighbours = neighbours | VOXEL_NEIGHBOUR_RIGHT;
|
neighbours = neighbours | VOXEL_NEIGHBOUR_RIGHT;
|
||||||
|
|
||||||
if (chunk->get_voxel(x, y + 1, z, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE) != 0)
|
if (chunk->get_voxel(x, y + 1, z, _channel_index_type) != 0)
|
||||||
neighbours = neighbours | VOXEL_NEIGHBOUR_TOP;
|
neighbours = neighbours | VOXEL_NEIGHBOUR_TOP;
|
||||||
|
|
||||||
if (chunk->get_voxel(x, y, z - 1, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE) != 0)
|
if (chunk->get_voxel(x, y, z - 1, _channel_index_type) != 0)
|
||||||
neighbours = neighbours | VOXEL_NEIGHBOUR_FRONT;
|
neighbours = neighbours | VOXEL_NEIGHBOUR_FRONT;
|
||||||
/*
|
/*
|
||||||
if (chunk->get_voxel(x + 1, y, z - 1, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE) != 0)
|
if (chunk->get_voxel(x + 1, y, z - 1, _channel_index_type) != 0)
|
||||||
neighbours = neighbours | VOXEL_NEIGHBOUR_RIGHT_FRONT;
|
neighbours = neighbours | VOXEL_NEIGHBOUR_RIGHT_FRONT;
|
||||||
|
|
||||||
if (chunk->get_voxel(x + 1, y + 1, z, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE) != 0)
|
if (chunk->get_voxel(x + 1, y + 1, z, _channel_index_type) != 0)
|
||||||
neighbours = neighbours | VOXEL_NEIGHBOUR_TOP_RIGHT;
|
neighbours = neighbours | VOXEL_NEIGHBOUR_TOP_RIGHT;
|
||||||
|
|
||||||
if (chunk->get_voxel(x, y + 1, z - 1, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE) != 0)
|
if (chunk->get_voxel(x, y + 1, z - 1, _channel_index_type) != 0)
|
||||||
neighbours = neighbours | VOXEL_NEIGHBOUR_TOP_FRONT;
|
neighbours = neighbours | VOXEL_NEIGHBOUR_TOP_FRONT;
|
||||||
|
|
||||||
if (chunk->get_voxel(x + 1, y + 1, z - 1, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE) != 0)
|
if (chunk->get_voxel(x + 1, y + 1, z - 1, _channel_index_type) != 0)
|
||||||
neighbours = neighbours | VOXEL_NEIGHBOUR_TOP_RIGHT_FRONT;*/
|
neighbours = neighbours | VOXEL_NEIGHBOUR_TOP_RIGHT_FRONT;*/
|
||||||
|
|
||||||
_point_neighbours[P110] = neighbours;
|
_point_neighbours[P110] = neighbours;
|
||||||
@ -318,25 +332,25 @@ void VoxelCubePoints::refresh_neighbours(Ref<VoxelChunk> chunk) {
|
|||||||
z = _z + 1;
|
z = _z + 1;
|
||||||
|
|
||||||
//001
|
//001
|
||||||
if (chunk->get_voxel(x - 1, y, z, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE) != 0)
|
if (chunk->get_voxel(x - 1, y, z, _channel_index_type) != 0)
|
||||||
neighbours = neighbours | VOXEL_NEIGHBOUR_LEFT;
|
neighbours = neighbours | VOXEL_NEIGHBOUR_LEFT;
|
||||||
|
|
||||||
if (chunk->get_voxel(x, y - 1, z, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE) != 0)
|
if (chunk->get_voxel(x, y - 1, z, _channel_index_type) != 0)
|
||||||
neighbours = neighbours | VOXEL_NEIGHBOUR_BOTTOM;
|
neighbours = neighbours | VOXEL_NEIGHBOUR_BOTTOM;
|
||||||
|
|
||||||
if (chunk->get_voxel(x, y, z + 1, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE) != 0)
|
if (chunk->get_voxel(x, y, z + 1, _channel_index_type) != 0)
|
||||||
neighbours = neighbours | VOXEL_NEIGHBOUR_BACK;
|
neighbours = neighbours | VOXEL_NEIGHBOUR_BACK;
|
||||||
/*
|
/*
|
||||||
if (chunk->get_voxel(x - 1, y, z + 1, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE) != 0)
|
if (chunk->get_voxel(x - 1, y, z + 1, _channel_index_type) != 0)
|
||||||
neighbours = neighbours | VOXEL_NEIGHBOUR_LEFT_BACK;
|
neighbours = neighbours | VOXEL_NEIGHBOUR_LEFT_BACK;
|
||||||
|
|
||||||
if (chunk->get_voxel(x - 1, y - 1, z, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE) != 0)
|
if (chunk->get_voxel(x - 1, y - 1, z, _channel_index_type) != 0)
|
||||||
neighbours = neighbours | VOXEL_NEIGHBOUR_BOTTOM_LEFT;
|
neighbours = neighbours | VOXEL_NEIGHBOUR_BOTTOM_LEFT;
|
||||||
|
|
||||||
if (chunk->get_voxel(x, y - 1, z + 1, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE) != 0)
|
if (chunk->get_voxel(x, y - 1, z + 1, _channel_index_type) != 0)
|
||||||
neighbours = neighbours | VOXEL_NEIGHBOUR_BOTTOM_BACK;
|
neighbours = neighbours | VOXEL_NEIGHBOUR_BOTTOM_BACK;
|
||||||
|
|
||||||
if (chunk->get_voxel(x - 1, y - 1, z + 1, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE) != 0)
|
if (chunk->get_voxel(x - 1, y - 1, z + 1, _channel_index_type) != 0)
|
||||||
neighbours = neighbours | VOXEL_NEIGHBOUR_BOTTOM_LEFT_BACK;*/
|
neighbours = neighbours | VOXEL_NEIGHBOUR_BOTTOM_LEFT_BACK;*/
|
||||||
|
|
||||||
_point_neighbours[P001] = neighbours;
|
_point_neighbours[P001] = neighbours;
|
||||||
@ -347,25 +361,25 @@ void VoxelCubePoints::refresh_neighbours(Ref<VoxelChunk> chunk) {
|
|||||||
z = _z + 1;
|
z = _z + 1;
|
||||||
|
|
||||||
//101
|
//101
|
||||||
if (chunk->get_voxel(x + 1, y, z, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE) != 0)
|
if (chunk->get_voxel(x + 1, y, z, _channel_index_type) != 0)
|
||||||
neighbours = neighbours | VOXEL_NEIGHBOUR_RIGHT;
|
neighbours = neighbours | VOXEL_NEIGHBOUR_RIGHT;
|
||||||
|
|
||||||
if (chunk->get_voxel(x, y - 1, z, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE) != 0)
|
if (chunk->get_voxel(x, y - 1, z, _channel_index_type) != 0)
|
||||||
neighbours = neighbours | VOXEL_NEIGHBOUR_BOTTOM;
|
neighbours = neighbours | VOXEL_NEIGHBOUR_BOTTOM;
|
||||||
|
|
||||||
if (chunk->get_voxel(x, y, z + 1, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE) != 0)
|
if (chunk->get_voxel(x, y, z + 1, _channel_index_type) != 0)
|
||||||
neighbours = neighbours | VOXEL_NEIGHBOUR_BACK;
|
neighbours = neighbours | VOXEL_NEIGHBOUR_BACK;
|
||||||
/*
|
/*
|
||||||
if (chunk->get_voxel(x + 1, y, z + 1, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE) != 0)
|
if (chunk->get_voxel(x + 1, y, z + 1, _channel_index_type) != 0)
|
||||||
neighbours = neighbours | VOXEL_NEIGHBOUR_RIGHT_BACK;
|
neighbours = neighbours | VOXEL_NEIGHBOUR_RIGHT_BACK;
|
||||||
|
|
||||||
if (chunk->get_voxel(x + 1, y - 1, z, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE) != 0)
|
if (chunk->get_voxel(x + 1, y - 1, z, _channel_index_type) != 0)
|
||||||
neighbours = neighbours | VOXEL_NEIGHBOUR_BOTTOM_RIGHT;
|
neighbours = neighbours | VOXEL_NEIGHBOUR_BOTTOM_RIGHT;
|
||||||
|
|
||||||
if (chunk->get_voxel(x, y - 1, z + 1, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE) != 0)
|
if (chunk->get_voxel(x, y - 1, z + 1, _channel_index_type) != 0)
|
||||||
neighbours = neighbours | VOXEL_NEIGHBOUR_BOTTOM_BACK;
|
neighbours = neighbours | VOXEL_NEIGHBOUR_BOTTOM_BACK;
|
||||||
|
|
||||||
if (chunk->get_voxel(x + 1, y - 1, z + 1, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE) != 0)
|
if (chunk->get_voxel(x + 1, y - 1, z + 1, _channel_index_type) != 0)
|
||||||
neighbours = neighbours | VOXEL_NEIGHBOUR_BOTTOM_RIGHT_BACK;*/
|
neighbours = neighbours | VOXEL_NEIGHBOUR_BOTTOM_RIGHT_BACK;*/
|
||||||
|
|
||||||
_point_neighbours[P101] = neighbours;
|
_point_neighbours[P101] = neighbours;
|
||||||
@ -376,25 +390,25 @@ void VoxelCubePoints::refresh_neighbours(Ref<VoxelChunk> chunk) {
|
|||||||
z = _z + 1;
|
z = _z + 1;
|
||||||
|
|
||||||
//011
|
//011
|
||||||
if (chunk->get_voxel(x - 1, y, z, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE) != 0)
|
if (chunk->get_voxel(x - 1, y, z, _channel_index_type) != 0)
|
||||||
neighbours = neighbours | VOXEL_NEIGHBOUR_LEFT;
|
neighbours = neighbours | VOXEL_NEIGHBOUR_LEFT;
|
||||||
|
|
||||||
if (chunk->get_voxel(x, y + 1, z, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE) != 0)
|
if (chunk->get_voxel(x, y + 1, z, _channel_index_type) != 0)
|
||||||
neighbours = neighbours | VOXEL_NEIGHBOUR_TOP;
|
neighbours = neighbours | VOXEL_NEIGHBOUR_TOP;
|
||||||
|
|
||||||
if (chunk->get_voxel(x, y, z + 1, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE) != 0)
|
if (chunk->get_voxel(x, y, z + 1, _channel_index_type) != 0)
|
||||||
neighbours = neighbours | VOXEL_NEIGHBOUR_BACK;
|
neighbours = neighbours | VOXEL_NEIGHBOUR_BACK;
|
||||||
/*
|
/*
|
||||||
if (chunk->get_voxel(x - 1, y, z + 1, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE) != 0)
|
if (chunk->get_voxel(x - 1, y, z + 1, _channel_index_type) != 0)
|
||||||
neighbours = neighbours | VOXEL_NEIGHBOUR_LEFT_BACK;
|
neighbours = neighbours | VOXEL_NEIGHBOUR_LEFT_BACK;
|
||||||
|
|
||||||
if (chunk->get_voxel(x - 1, y + 1, z, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE) != 0)
|
if (chunk->get_voxel(x - 1, y + 1, z, _channel_index_type) != 0)
|
||||||
neighbours = neighbours | VOXEL_NEIGHBOUR_TOP_LEFT;
|
neighbours = neighbours | VOXEL_NEIGHBOUR_TOP_LEFT;
|
||||||
|
|
||||||
if (chunk->get_voxel(x, y + 1, z + 1, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE) != 0)
|
if (chunk->get_voxel(x, y + 1, z + 1, _channel_index_type) != 0)
|
||||||
neighbours = neighbours | VOXEL_NEIGHBOUR_TOP_BACK;
|
neighbours = neighbours | VOXEL_NEIGHBOUR_TOP_BACK;
|
||||||
|
|
||||||
if (chunk->get_voxel(x - 1, y + 1, z + 1, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE) != 0)
|
if (chunk->get_voxel(x - 1, y + 1, z + 1, _channel_index_type) != 0)
|
||||||
neighbours = neighbours | VOXEL_NEIGHBOUR_TOP_LEFT_BACK;*/
|
neighbours = neighbours | VOXEL_NEIGHBOUR_TOP_LEFT_BACK;*/
|
||||||
|
|
||||||
_point_neighbours[P011] = neighbours;
|
_point_neighbours[P011] = neighbours;
|
||||||
@ -405,25 +419,25 @@ void VoxelCubePoints::refresh_neighbours(Ref<VoxelChunk> chunk) {
|
|||||||
z = _z + 1;
|
z = _z + 1;
|
||||||
|
|
||||||
//111
|
//111
|
||||||
if (chunk->get_voxel(x + 1, y, z, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE) != 0)
|
if (chunk->get_voxel(x + 1, y, z, _channel_index_type) != 0)
|
||||||
neighbours = neighbours | VOXEL_NEIGHBOUR_RIGHT;
|
neighbours = neighbours | VOXEL_NEIGHBOUR_RIGHT;
|
||||||
|
|
||||||
if (chunk->get_voxel(x, y + 1, z, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE) != 0)
|
if (chunk->get_voxel(x, y + 1, z, _channel_index_type) != 0)
|
||||||
neighbours = neighbours | VOXEL_NEIGHBOUR_TOP;
|
neighbours = neighbours | VOXEL_NEIGHBOUR_TOP;
|
||||||
|
|
||||||
if (chunk->get_voxel(x, y, z + 1, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE) != 0)
|
if (chunk->get_voxel(x, y, z + 1, _channel_index_type) != 0)
|
||||||
neighbours = neighbours | VOXEL_NEIGHBOUR_BACK;
|
neighbours = neighbours | VOXEL_NEIGHBOUR_BACK;
|
||||||
/*
|
/*
|
||||||
if (chunk->get_voxel(x + 1, y, z + 1, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE) != 0)
|
if (chunk->get_voxel(x + 1, y, z + 1, _channel_index_type) != 0)
|
||||||
neighbours = neighbours | VOXEL_NEIGHBOUR_RIGHT_BACK;
|
neighbours = neighbours | VOXEL_NEIGHBOUR_RIGHT_BACK;
|
||||||
|
|
||||||
if (chunk->get_voxel(x + 1, y + 1, z, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE) != 0)
|
if (chunk->get_voxel(x + 1, y + 1, z, _channel_index_type) != 0)
|
||||||
neighbours = neighbours | VOXEL_NEIGHBOUR_TOP_RIGHT;
|
neighbours = neighbours | VOXEL_NEIGHBOUR_TOP_RIGHT;
|
||||||
|
|
||||||
if (chunk->get_voxel(x, y + 1, z + 1, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE) != 0)
|
if (chunk->get_voxel(x, y + 1, z + 1, _channel_index_type) != 0)
|
||||||
neighbours = neighbours | VOXEL_NEIGHBOUR_TOP_BACK;
|
neighbours = neighbours | VOXEL_NEIGHBOUR_TOP_BACK;
|
||||||
|
|
||||||
if (chunk->get_voxel(x + 1, y + 1, z + 1, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE) != 0)
|
if (chunk->get_voxel(x + 1, y + 1, z + 1, _channel_index_type) != 0)
|
||||||
neighbours = neighbours | VOXEL_NEIGHBOUR_TOP_RIGHT_BACK;*/
|
neighbours = neighbours | VOXEL_NEIGHBOUR_TOP_RIGHT_BACK;*/
|
||||||
|
|
||||||
_point_neighbours[P111] = neighbours;
|
_point_neighbours[P111] = neighbours;
|
||||||
@ -441,26 +455,26 @@ void VoxelCubePoints::setup(Ref<VoxelChunk> chunk, int x, int y, int z, int size
|
|||||||
_z = z;
|
_z = z;
|
||||||
_size = size;
|
_size = size;
|
||||||
|
|
||||||
_point_types[P000] = chunk->get_voxel(x, y, z, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE);
|
_point_types[P000] = chunk->get_voxel(x, y, z, _channel_index_type);
|
||||||
_point_types[P100] = chunk->get_voxel(x + size, y, z, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE);
|
_point_types[P100] = chunk->get_voxel(x + size, y, z, _channel_index_type);
|
||||||
_point_types[P010] = chunk->get_voxel(x, y + size, z, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE);
|
_point_types[P010] = chunk->get_voxel(x, y + size, z, _channel_index_type);
|
||||||
_point_types[P001] = chunk->get_voxel(x, y, z + size, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE);
|
_point_types[P001] = chunk->get_voxel(x, y, z + size, _channel_index_type);
|
||||||
_point_types[P110] = chunk->get_voxel(x + size, y + size, z, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE);
|
_point_types[P110] = chunk->get_voxel(x + size, y + size, z, _channel_index_type);
|
||||||
_point_types[P011] = chunk->get_voxel(x, y + size, z + size, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE);
|
_point_types[P011] = chunk->get_voxel(x, y + size, z + size, _channel_index_type);
|
||||||
_point_types[P101] = chunk->get_voxel(x + size, y, z + size, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE);
|
_point_types[P101] = chunk->get_voxel(x + size, y, z + size, _channel_index_type);
|
||||||
_point_types[P111] = chunk->get_voxel(x + size, y + size, z + size, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE);
|
_point_types[P111] = chunk->get_voxel(x + size, y + size, z + size, _channel_index_type);
|
||||||
|
|
||||||
if (!has_points())
|
if (!has_points())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_point_fills[P000] = chunk->get_voxel(x, y, z, VoxelChunkDefault::DEFAULT_CHANNEL_ISOLEVEL);
|
_point_fills[P000] = chunk->get_voxel(x, y, z, _channel_index_isolevel);
|
||||||
_point_fills[P100] = chunk->get_voxel(x + size, y, z, VoxelChunkDefault::DEFAULT_CHANNEL_ISOLEVEL);
|
_point_fills[P100] = chunk->get_voxel(x + size, y, z, _channel_index_isolevel);
|
||||||
_point_fills[P010] = chunk->get_voxel(x, y + size, z, VoxelChunkDefault::DEFAULT_CHANNEL_ISOLEVEL);
|
_point_fills[P010] = chunk->get_voxel(x, y + size, z, _channel_index_isolevel);
|
||||||
_point_fills[P001] = chunk->get_voxel(x, y, z + size, VoxelChunkDefault::DEFAULT_CHANNEL_ISOLEVEL);
|
_point_fills[P001] = chunk->get_voxel(x, y, z + size, _channel_index_isolevel);
|
||||||
_point_fills[P110] = chunk->get_voxel(x + size, y + size, z, VoxelChunkDefault::DEFAULT_CHANNEL_ISOLEVEL);
|
_point_fills[P110] = chunk->get_voxel(x + size, y + size, z, _channel_index_isolevel);
|
||||||
_point_fills[P011] = chunk->get_voxel(x, y + size, z + size, VoxelChunkDefault::DEFAULT_CHANNEL_ISOLEVEL);
|
_point_fills[P011] = chunk->get_voxel(x, y + size, z + size, _channel_index_isolevel);
|
||||||
_point_fills[P101] = chunk->get_voxel(x + size, y, z + size, VoxelChunkDefault::DEFAULT_CHANNEL_ISOLEVEL);
|
_point_fills[P101] = chunk->get_voxel(x + size, y, z + size, _channel_index_isolevel);
|
||||||
_point_fills[P111] = chunk->get_voxel(x + size, y + size, z + size, VoxelChunkDefault::DEFAULT_CHANNEL_ISOLEVEL);
|
_point_fills[P111] = chunk->get_voxel(x + size, y + size, z + size, _channel_index_isolevel);
|
||||||
|
|
||||||
_point_aos[P000] = chunk->get_voxel(x, y, z, VoxelChunkDefault::DEFAULT_CHANNEL_AO);
|
_point_aos[P000] = chunk->get_voxel(x, y, z, VoxelChunkDefault::DEFAULT_CHANNEL_AO);
|
||||||
_point_aos[P100] = chunk->get_voxel(x + size, y, z, VoxelChunkDefault::DEFAULT_CHANNEL_AO);
|
_point_aos[P100] = chunk->get_voxel(x + size, y, z, VoxelChunkDefault::DEFAULT_CHANNEL_AO);
|
||||||
@ -776,6 +790,9 @@ int VoxelCubePoints::get_opposite_face(int face) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
VoxelCubePoints::VoxelCubePoints() {
|
VoxelCubePoints::VoxelCubePoints() {
|
||||||
|
_channel_index_type = 0;
|
||||||
|
_channel_index_isolevel = 0;
|
||||||
|
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -800,6 +817,14 @@ void VoxelCubePoints::_bind_methods() {
|
|||||||
ClassDB::bind_method(D_METHOD("set_size", "value"), &VoxelCubePoints::set_size);
|
ClassDB::bind_method(D_METHOD("set_size", "value"), &VoxelCubePoints::set_size);
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "size"), "set_size", "get_size");
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "size"), "set_size", "get_size");
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_channel_index_type"), &VoxelCubePoints::get_channel_index_type);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_channel_index_type", "value"), &VoxelCubePoints::set_channel_index_type);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "channel_index_type"), "set_channel_index_type", "get_channel_index_type");
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_channel_index_isolevel"), &VoxelCubePoints::get_channel_index_isolevel);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_channel_index_isolevel", "value"), &VoxelCubePoints::set_channel_index_isolevel);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "channel_index_isolevel"), "set_channel_index_isolevel", "get_channel_index_isolevel");
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("refresh_points"), &VoxelCubePoints::refresh_points);
|
ClassDB::bind_method(D_METHOD("refresh_points"), &VoxelCubePoints::refresh_points);
|
||||||
ClassDB::bind_method(D_METHOD("setup", "chunk", "x", "y", "z", "size"), &VoxelCubePoints::setup, DEFVAL(1));
|
ClassDB::bind_method(D_METHOD("setup", "chunk", "x", "y", "z", "size"), &VoxelCubePoints::setup, DEFVAL(1));
|
||||||
|
|
||||||
|
@ -110,6 +110,12 @@ public:
|
|||||||
int get_size();
|
int get_size();
|
||||||
void set_size(int value);
|
void set_size(int value);
|
||||||
|
|
||||||
|
int get_channel_index_type() const;
|
||||||
|
void set_channel_index_type(const int value);
|
||||||
|
|
||||||
|
int get_channel_index_isolevel() const;
|
||||||
|
void set_channel_index_isolevel(const int value);
|
||||||
|
|
||||||
void refresh_points();
|
void refresh_points();
|
||||||
void recalculate_point(int point);
|
void recalculate_point(int point);
|
||||||
void refresh_neighbours(Ref<VoxelChunk> chunk);
|
void refresh_neighbours(Ref<VoxelChunk> chunk);
|
||||||
@ -166,6 +172,9 @@ protected:
|
|||||||
static const float uv_direction_table[8][4][2];
|
static const float uv_direction_table[8][4][2];
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
int _channel_index_type;
|
||||||
|
int _channel_index_isolevel;
|
||||||
|
|
||||||
Vector3 _points[POINT_COUNT];
|
Vector3 _points[POINT_COUNT];
|
||||||
|
|
||||||
uint8_t _point_types[POINT_COUNT];
|
uint8_t _point_types[POINT_COUNT];
|
||||||
|
@ -40,6 +40,14 @@ void VoxelMesherCubic::_add_chunk(Ref<VoxelChunk> p_chunk) {
|
|||||||
|
|
||||||
ERR_FAIL_COND(!chunk.is_valid());
|
ERR_FAIL_COND(!chunk.is_valid());
|
||||||
|
|
||||||
|
if (!chunk->get_channel(_channel_index_type)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (chunk->get_channel(VoxelChunkDefault::DEFAULT_CHANNEL_RANDOM_AO)) {
|
||||||
|
chunk->generate_ao();
|
||||||
|
}
|
||||||
|
|
||||||
int x_size = chunk->get_size_x();
|
int x_size = chunk->get_size_x();
|
||||||
int y_size = chunk->get_size_y();
|
int y_size = chunk->get_size_y();
|
||||||
int z_size = chunk->get_size_z();
|
int z_size = chunk->get_size_z();
|
||||||
@ -49,6 +57,8 @@ void VoxelMesherCubic::_add_chunk(Ref<VoxelChunk> p_chunk) {
|
|||||||
|
|
||||||
Ref<VoxelCubePoints> cube_points;
|
Ref<VoxelCubePoints> cube_points;
|
||||||
cube_points.instance();
|
cube_points.instance();
|
||||||
|
cube_points->set_channel_index_type(_channel_index_type);
|
||||||
|
cube_points->set_channel_index_isolevel(_channel_index_isolevel);
|
||||||
|
|
||||||
Color base_light(_base_light_value, _base_light_value, _base_light_value);
|
Color base_light(_base_light_value, _base_light_value, _base_light_value);
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ void VoxelMesherMarchingCubes::set_texture_scale(const int value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void VoxelMesherMarchingCubes::get_voxel_type_array(int *arr, Ref<VoxelChunk> chunk, const int x, const int y, const int z, const int size) {
|
void VoxelMesherMarchingCubes::get_voxel_type_array(int *arr, Ref<VoxelChunk> chunk, const int x, const int y, const int z, const int size) {
|
||||||
uint8_t *channel_type = chunk->get_channel(VoxelChunkDefault::DEFAULT_CHANNEL_TYPE);
|
uint8_t *channel_type = chunk->get_channel(_channel_index_type);
|
||||||
|
|
||||||
if (channel_type == NULL) {
|
if (channel_type == NULL) {
|
||||||
arr[0] = 0;
|
arr[0] = 0;
|
||||||
@ -100,7 +100,7 @@ int VoxelMesherMarchingCubes::get_case_code_from_arr(const int *data) {
|
|||||||
return case_code;
|
return case_code;
|
||||||
}
|
}
|
||||||
int VoxelMesherMarchingCubes::get_case_code(Ref<VoxelChunk> chunk, const int x, const int y, const int z, const int size) {
|
int VoxelMesherMarchingCubes::get_case_code(Ref<VoxelChunk> chunk, const int x, const int y, const int z, const int size) {
|
||||||
uint8_t *channel_type = chunk->get_channel(VoxelChunkDefault::DEFAULT_CHANNEL_TYPE);
|
uint8_t *channel_type = chunk->get_channel(_channel_index_type);
|
||||||
|
|
||||||
if (channel_type == NULL) {
|
if (channel_type == NULL) {
|
||||||
return 0;
|
return 0;
|
||||||
@ -136,7 +136,7 @@ int VoxelMesherMarchingCubes::get_case_code(Ref<VoxelChunk> chunk, const int x,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int VoxelMesherMarchingCubes::get_voxel_type(Ref<VoxelChunk> chunk, const int x, const int y, const int z, const int size) {
|
int VoxelMesherMarchingCubes::get_voxel_type(Ref<VoxelChunk> chunk, const int x, const int y, const int z, const int size) {
|
||||||
uint8_t *channel_type = chunk->get_channel(VoxelChunkDefault::DEFAULT_CHANNEL_TYPE);
|
uint8_t *channel_type = chunk->get_channel(_channel_index_type);
|
||||||
|
|
||||||
if (channel_type == NULL) {
|
if (channel_type == NULL) {
|
||||||
return 0;
|
return 0;
|
||||||
@ -324,7 +324,7 @@ void VoxelMesherMarchingCubes::_add_chunk(Ref<VoxelChunk> p_chunk) {
|
|||||||
Vector3 offs0 = corner_id_to_vertex(fv) * lod_size;
|
Vector3 offs0 = corner_id_to_vertex(fv) * lod_size;
|
||||||
Vector3 offs1 = corner_id_to_vertex(sv) * lod_size;
|
Vector3 offs1 = corner_id_to_vertex(sv) * lod_size;
|
||||||
|
|
||||||
int type = chunk->get_voxel(int(x + offs0.x), int(y + offs0.y), int(z + offs0.z), VoxelChunkDefault::DEFAULT_CHANNEL_TYPE);
|
int type = chunk->get_voxel(int(x + offs0.x), int(y + offs0.y), int(z + offs0.z), _channel_index_type);
|
||||||
|
|
||||||
int fill = 0;
|
int fill = 0;
|
||||||
|
|
||||||
@ -332,12 +332,12 @@ void VoxelMesherMarchingCubes::_add_chunk(Ref<VoxelChunk> p_chunk) {
|
|||||||
Vector3 vert_dir;
|
Vector3 vert_dir;
|
||||||
|
|
||||||
if (type == 0) {
|
if (type == 0) {
|
||||||
fill = chunk->get_voxel(int(x + offs1.x), int(y + offs1.y), int(z + offs1.z), VoxelChunkDefault::DEFAULT_CHANNEL_ISOLEVEL);
|
fill = chunk->get_voxel(int(x + offs1.x), int(y + offs1.y), int(z + offs1.z), _channel_index_isolevel);
|
||||||
|
|
||||||
vert_pos = get_regular_vertex_second_position(case_code, i);
|
vert_pos = get_regular_vertex_second_position(case_code, i);
|
||||||
vert_dir = get_regular_vertex_first_position(case_code, i);
|
vert_dir = get_regular_vertex_first_position(case_code, i);
|
||||||
} else {
|
} else {
|
||||||
fill = chunk->get_voxel(int(x + offs0.x), int(y + offs0.y), int(z + offs0.z), VoxelChunkDefault::DEFAULT_CHANNEL_ISOLEVEL);
|
fill = chunk->get_voxel(int(x + offs0.x), int(y + offs0.y), int(z + offs0.z), _channel_index_isolevel);
|
||||||
|
|
||||||
vert_pos = get_regular_vertex_first_position(case_code, i);
|
vert_pos = get_regular_vertex_first_position(case_code, i);
|
||||||
vert_dir = get_regular_vertex_second_position(case_code, i);
|
vert_dir = get_regular_vertex_second_position(case_code, i);
|
||||||
|
@ -79,6 +79,20 @@ uint32_t VoxelMesher::VertexHasher::hash(const Vertex &p_vtx) {
|
|||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int VoxelMesher::get_channel_index_type() const {
|
||||||
|
return _channel_index_type;
|
||||||
|
}
|
||||||
|
void VoxelMesher::set_channel_index_type(const int value) {
|
||||||
|
_channel_index_type = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
int VoxelMesher::get_channel_index_isolevel() const {
|
||||||
|
return _channel_index_isolevel;
|
||||||
|
}
|
||||||
|
void VoxelMesher::set_channel_index_isolevel(const int value) {
|
||||||
|
_channel_index_isolevel = value;
|
||||||
|
}
|
||||||
|
|
||||||
int VoxelMesher::get_mesher_index() const {
|
int VoxelMesher::get_mesher_index() const {
|
||||||
return _mesher_index;
|
return _mesher_index;
|
||||||
}
|
}
|
||||||
@ -888,6 +902,8 @@ VoxelMesher::VoxelMesher(const Ref<VoxelmanLibrary> &library) {
|
|||||||
_ao_strength = 0.25;
|
_ao_strength = 0.25;
|
||||||
_base_light_value = 0.5;
|
_base_light_value = 0.5;
|
||||||
_uv_margin = Rect2(0, 0, 1, 1);
|
_uv_margin = Rect2(0, 0, 1, 1);
|
||||||
|
_channel_index_type = 0;
|
||||||
|
_channel_index_isolevel = 0;
|
||||||
|
|
||||||
_format = 0;
|
_format = 0;
|
||||||
}
|
}
|
||||||
@ -900,6 +916,8 @@ VoxelMesher::VoxelMesher() {
|
|||||||
_base_light_value = 0.5;
|
_base_light_value = 0.5;
|
||||||
_uv_margin = Rect2(0, 0, 1, 1);
|
_uv_margin = Rect2(0, 0, 1, 1);
|
||||||
_format = 0;
|
_format = 0;
|
||||||
|
_channel_index_type = 0;
|
||||||
|
_channel_index_isolevel = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
VoxelMesher::~VoxelMesher() {
|
VoxelMesher::~VoxelMesher() {
|
||||||
@ -913,6 +931,14 @@ void VoxelMesher::_bind_methods() {
|
|||||||
BIND_VMETHOD(MethodInfo("_bake_colors", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "VoxelChunk")));
|
BIND_VMETHOD(MethodInfo("_bake_colors", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "VoxelChunk")));
|
||||||
BIND_VMETHOD(MethodInfo("_bake_liquid_colors", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "VoxelChunk")));
|
BIND_VMETHOD(MethodInfo("_bake_liquid_colors", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "VoxelChunk")));
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_channel_index_type"), &VoxelMesher::get_channel_index_type);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_channel_index_type", "value"), &VoxelMesher::set_channel_index_type);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "channel_index_type"), "set_channel_index_type", "get_channel_index_type");
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_channel_index_isolevel"), &VoxelMesher::get_channel_index_isolevel);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_channel_index_isolevel", "value"), &VoxelMesher::set_channel_index_isolevel);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "channel_index_isolevel"), "set_channel_index_isolevel", "get_channel_index_isolevel");
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("get_mesher_index"), &VoxelMesher::get_mesher_index);
|
ClassDB::bind_method(D_METHOD("get_mesher_index"), &VoxelMesher::get_mesher_index);
|
||||||
ClassDB::bind_method(D_METHOD("set_mesher_index", "value"), &VoxelMesher::set_mesher_index);
|
ClassDB::bind_method(D_METHOD("set_mesher_index", "value"), &VoxelMesher::set_mesher_index);
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "mesher_index"), "set_mesher_index", "get_mesher_index");
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "mesher_index"), "set_mesher_index", "get_mesher_index");
|
||||||
|
@ -87,6 +87,12 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
int get_channel_index_type() const;
|
||||||
|
void set_channel_index_type(const int value);
|
||||||
|
|
||||||
|
int get_channel_index_isolevel() const;
|
||||||
|
void set_channel_index_isolevel(const int value);
|
||||||
|
|
||||||
int get_mesher_index() const;
|
int get_mesher_index() const;
|
||||||
void set_mesher_index(const int value);
|
void set_mesher_index(const int value);
|
||||||
|
|
||||||
@ -182,6 +188,9 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
|
|
||||||
|
int _channel_index_type;
|
||||||
|
int _channel_index_isolevel;
|
||||||
|
|
||||||
int _mesher_index;
|
int _mesher_index;
|
||||||
|
|
||||||
int _format;
|
int _format;
|
||||||
|
@ -38,7 +38,12 @@ void VoxelChunkCubic::_setup_channels() {
|
|||||||
|
|
||||||
void VoxelChunkCubic::_create_meshers() {
|
void VoxelChunkCubic::_create_meshers() {
|
||||||
set_prop_mesher(Ref<VoxelMesher>(memnew(VoxelMesherCubic)));
|
set_prop_mesher(Ref<VoxelMesher>(memnew(VoxelMesherCubic)));
|
||||||
add_mesher(Ref<VoxelMesher>(memnew(VoxelMesherCubic())));
|
|
||||||
|
Ref<VoxelMesher> m = Ref<VoxelMesher>(memnew(VoxelMesherCubic()));
|
||||||
|
m->set_channel_index_type(VoxelChunkDefault::DEFAULT_CHANNEL_TYPE);
|
||||||
|
m->set_channel_index_isolevel(VoxelChunkDefault::DEFAULT_CHANNEL_ISOLEVEL);
|
||||||
|
add_mesher(m);
|
||||||
|
|
||||||
//add_liquid_mesher(Ref<VoxelMesher>(memnew(VoxelMesherLiquiCubic())));
|
//add_liquid_mesher(Ref<VoxelMesher>(memnew(VoxelMesherLiquiCubic())));
|
||||||
|
|
||||||
for (int i = 0; i < _meshers.size(); ++i) {
|
for (int i = 0; i < _meshers.size(); ++i) {
|
||||||
|
@ -38,7 +38,12 @@ void VoxelChunkMarchingCubes::_setup_channels() {
|
|||||||
|
|
||||||
void VoxelChunkMarchingCubes::_create_meshers() {
|
void VoxelChunkMarchingCubes::_create_meshers() {
|
||||||
set_prop_mesher(Ref<VoxelMesher>(memnew(VoxelMesherMarchingCubes)));
|
set_prop_mesher(Ref<VoxelMesher>(memnew(VoxelMesherMarchingCubes)));
|
||||||
add_mesher(Ref<VoxelMesher>(memnew(VoxelMesherMarchingCubes())));
|
|
||||||
|
Ref<VoxelMesher> m = Ref<VoxelMesher>(memnew(VoxelMesherMarchingCubes()));
|
||||||
|
m->set_channel_index_type(VoxelChunkDefault::DEFAULT_CHANNEL_TYPE);
|
||||||
|
m->set_channel_index_isolevel(VoxelChunkDefault::DEFAULT_CHANNEL_ISOLEVEL);
|
||||||
|
add_mesher(m);
|
||||||
|
|
||||||
//add_liquid_mesher(Ref<VoxelMesher>(memnew(VoxelMesherLiquidMarchingCubes())));
|
//add_liquid_mesher(Ref<VoxelMesher>(memnew(VoxelMesherLiquidMarchingCubes())));
|
||||||
|
|
||||||
for (int i = 0; i < _meshers.size(); ++i) {
|
for (int i = 0; i < _meshers.size(); ++i) {
|
||||||
|
Loading…
Reference in New Issue
Block a user