|
|
|
@ -112,6 +112,20 @@ void VoxelCubePoints::set_size(int 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() {
|
|
|
|
|
for (int i = 0; i < POINT_COUNT; ++i) {
|
|
|
|
|
recalculate_point(i);
|
|
|
|
@ -202,25 +216,25 @@ void VoxelCubePoints::refresh_neighbours(Ref<VoxelChunk> chunk) {
|
|
|
|
|
int z = _z;
|
|
|
|
|
|
|
|
|
|
//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;
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
/*
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
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;*/
|
|
|
|
|
|
|
|
|
|
_point_neighbours[P000] = neighbours;
|
|
|
|
@ -231,25 +245,25 @@ void VoxelCubePoints::refresh_neighbours(Ref<VoxelChunk> chunk) {
|
|
|
|
|
z = _z;
|
|
|
|
|
|
|
|
|
|
//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;
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
/*
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
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;*/
|
|
|
|
|
|
|
|
|
|
_point_neighbours[P100] = neighbours;
|
|
|
|
@ -260,25 +274,25 @@ void VoxelCubePoints::refresh_neighbours(Ref<VoxelChunk> chunk) {
|
|
|
|
|
z = _z;
|
|
|
|
|
|
|
|
|
|
//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;
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
/*
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
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;*/
|
|
|
|
|
|
|
|
|
|
_point_neighbours[P010] = neighbours;
|
|
|
|
@ -289,25 +303,25 @@ void VoxelCubePoints::refresh_neighbours(Ref<VoxelChunk> chunk) {
|
|
|
|
|
z = _z;
|
|
|
|
|
|
|
|
|
|
//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;
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
/*
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
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;*/
|
|
|
|
|
|
|
|
|
|
_point_neighbours[P110] = neighbours;
|
|
|
|
@ -318,25 +332,25 @@ void VoxelCubePoints::refresh_neighbours(Ref<VoxelChunk> chunk) {
|
|
|
|
|
z = _z + 1;
|
|
|
|
|
|
|
|
|
|
//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;
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
/*
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
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;*/
|
|
|
|
|
|
|
|
|
|
_point_neighbours[P001] = neighbours;
|
|
|
|
@ -347,25 +361,25 @@ void VoxelCubePoints::refresh_neighbours(Ref<VoxelChunk> chunk) {
|
|
|
|
|
z = _z + 1;
|
|
|
|
|
|
|
|
|
|
//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;
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
/*
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
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;*/
|
|
|
|
|
|
|
|
|
|
_point_neighbours[P101] = neighbours;
|
|
|
|
@ -376,25 +390,25 @@ void VoxelCubePoints::refresh_neighbours(Ref<VoxelChunk> chunk) {
|
|
|
|
|
z = _z + 1;
|
|
|
|
|
|
|
|
|
|
//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;
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
/*
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
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;*/
|
|
|
|
|
|
|
|
|
|
_point_neighbours[P011] = neighbours;
|
|
|
|
@ -405,25 +419,25 @@ void VoxelCubePoints::refresh_neighbours(Ref<VoxelChunk> chunk) {
|
|
|
|
|
z = _z + 1;
|
|
|
|
|
|
|
|
|
|
//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;
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
/*
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
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;*/
|
|
|
|
|
|
|
|
|
|
_point_neighbours[P111] = neighbours;
|
|
|
|
@ -441,26 +455,26 @@ void VoxelCubePoints::setup(Ref<VoxelChunk> chunk, int x, int y, int z, int size
|
|
|
|
|
_z = z;
|
|
|
|
|
_size = size;
|
|
|
|
|
|
|
|
|
|
_point_types[P000] = chunk->get_voxel(x, y, z, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE);
|
|
|
|
|
_point_types[P100] = chunk->get_voxel(x + size, y, z, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE);
|
|
|
|
|
_point_types[P010] = chunk->get_voxel(x, y + size, z, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE);
|
|
|
|
|
_point_types[P001] = chunk->get_voxel(x, y, z + size, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE);
|
|
|
|
|
_point_types[P110] = chunk->get_voxel(x + size, y + size, z, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE);
|
|
|
|
|
_point_types[P011] = chunk->get_voxel(x, y + size, z + size, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE);
|
|
|
|
|
_point_types[P101] = chunk->get_voxel(x + size, y, z + size, VoxelChunkDefault::DEFAULT_CHANNEL_TYPE);
|
|
|
|
|
_point_types[P111] = chunk->get_voxel(x + size, y + size, z + size, 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, _channel_index_type);
|
|
|
|
|
_point_types[P010] = chunk->get_voxel(x, y + size, z, _channel_index_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, _channel_index_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, _channel_index_type);
|
|
|
|
|
_point_types[P111] = chunk->get_voxel(x + size, y + size, z + size, _channel_index_type);
|
|
|
|
|
|
|
|
|
|
if (!has_points())
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
_point_fills[P000] = chunk->get_voxel(x, y, z, VoxelChunkDefault::DEFAULT_CHANNEL_ISOLEVEL);
|
|
|
|
|
_point_fills[P100] = chunk->get_voxel(x + size, y, z, VoxelChunkDefault::DEFAULT_CHANNEL_ISOLEVEL);
|
|
|
|
|
_point_fills[P010] = chunk->get_voxel(x, y + size, z, VoxelChunkDefault::DEFAULT_CHANNEL_ISOLEVEL);
|
|
|
|
|
_point_fills[P001] = chunk->get_voxel(x, y, z + size, VoxelChunkDefault::DEFAULT_CHANNEL_ISOLEVEL);
|
|
|
|
|
_point_fills[P110] = chunk->get_voxel(x + size, y + size, z, VoxelChunkDefault::DEFAULT_CHANNEL_ISOLEVEL);
|
|
|
|
|
_point_fills[P011] = chunk->get_voxel(x, y + size, z + size, VoxelChunkDefault::DEFAULT_CHANNEL_ISOLEVEL);
|
|
|
|
|
_point_fills[P101] = chunk->get_voxel(x + size, y, z + size, VoxelChunkDefault::DEFAULT_CHANNEL_ISOLEVEL);
|
|
|
|
|
_point_fills[P111] = chunk->get_voxel(x + size, y + size, z + size, 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, _channel_index_isolevel);
|
|
|
|
|
_point_fills[P010] = chunk->get_voxel(x, y + size, z, _channel_index_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, _channel_index_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, _channel_index_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[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() {
|
|
|
|
|
_channel_index_type = 0;
|
|
|
|
|
_channel_index_isolevel = 0;
|
|
|
|
|
|
|
|
|
|
reset();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -800,6 +817,14 @@ void VoxelCubePoints::_bind_methods() {
|
|
|
|
|
ClassDB::bind_method(D_METHOD("set_size", "value"), &VoxelCubePoints::set_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("setup", "chunk", "x", "y", "z", "size"), &VoxelCubePoints::setup, DEFVAL(1));
|
|
|
|
|
|
|
|
|
|