voxelman/meshers/cubic_mesher/voxel_cube_points.cpp

874 lines
32 KiB
C++
Raw Normal View History

#include "voxel_cube_points.h"
2019-07-13 22:03:23 +02:00
const unsigned int VoxelCubePoints::index_table[6][4] = {
{ P000, P010, P110, P100 }, //VOXEL_FACE_FRONT 0
{ P100, P110, P111, P101 }, //VOXEL_FACE_RIGHT 1
{ P101, P111, P011, P001 }, //VOXEL_FACE_BACK 2
{ P001, P011, P010, P000 }, //VOXEL_FACE_LEFT 3
{ P111, P110, P010, P011 }, //VOXEL_FACE_TOP 4
{ P001, P000, P100, P101 }, //VOXEL_FACE_BOTTOM 5
};
2019-07-16 01:49:01 +02:00
const unsigned int VoxelCubePoints::visibility_check_table[6] = {
VOXEL_NEIGHBOUR_FRONT, //VOXEL_FACE_FRONT 0
VOXEL_NEIGHBOUR_RIGHT, //VOXEL_FACE_RIGHT 1
VOXEL_NEIGHBOUR_BACK, //VOXEL_FACE_BACK 2
VOXEL_NEIGHBOUR_LEFT, //VOXEL_FACE_LEFT 3
VOXEL_NEIGHBOUR_TOP, //VOXEL_FACE_TOP 4
VOXEL_NEIGHBOUR_BOTTOM //VOXEL_FACE_BOTTOM 5
};
const int VoxelCubePoints::face_light_direction_table[6][3] = {
{ 0, 0, -1 }, //VOXEL_FACE_FRONT 0
{ -1, 0, 0 }, //VOXEL_FACE_RIGHT 1
{ 0, 0, 1 }, //VOXEL_FACE_BACK 2
{ 1, 0, 0 }, //VOXEL_FACE_LEFT 3
{ 0, -1, 0 }, //VOXEL_FACE_TOP 4
{ 0, 1, 0 } //VOXEL_FACE_BOTTOM 5
};
2019-07-16 01:49:01 +02:00
const float VoxelCubePoints::point_direction_table[8][3] = {
{ -0.5, -0.5, -0.5 }, //P000
{ 0.5, -0.5, -0.5 }, //P100
{ -0.5, 0.5, -0.5 }, //P010
{ -0.5, -0.5, 0.5 }, //P001
{ 0.5, 0.5, -0.5 }, //P110
{ -0.5, 0.5, 0.5 }, //P011
{ 0.5, -0.5, 0.5 }, //P101
{ 0.5, 0.5, 0.5 }, //P111
};
const unsigned int VoxelCubePoints::point_direction_neighbour_table[8][3] = {
{ VOXEL_NEIGHBOUR_LEFT, VOXEL_NEIGHBOUR_BOTTOM, VOXEL_NEIGHBOUR_FRONT }, //P000
{ VOXEL_NEIGHBOUR_RIGHT, VOXEL_NEIGHBOUR_BOTTOM, VOXEL_NEIGHBOUR_FRONT }, //P100
{ VOXEL_NEIGHBOUR_LEFT, VOXEL_NEIGHBOUR_TOP, VOXEL_NEIGHBOUR_FRONT }, //P010
{ VOXEL_NEIGHBOUR_LEFT, VOXEL_NEIGHBOUR_BOTTOM, VOXEL_NEIGHBOUR_BACK }, //P001
{ VOXEL_NEIGHBOUR_RIGHT, VOXEL_NEIGHBOUR_TOP, VOXEL_NEIGHBOUR_FRONT }, //P110
{ VOXEL_NEIGHBOUR_LEFT, VOXEL_NEIGHBOUR_TOP, VOXEL_NEIGHBOUR_BACK }, //P011
{ VOXEL_NEIGHBOUR_RIGHT, VOXEL_NEIGHBOUR_BOTTOM, VOXEL_NEIGHBOUR_BACK }, //P101
{ VOXEL_NEIGHBOUR_RIGHT, VOXEL_NEIGHBOUR_TOP, VOXEL_NEIGHBOUR_BACK }, //P111
};
2019-07-16 11:11:47 +02:00
const float VoxelCubePoints::uv_direction_table[8][4][2] = {
{ { -0.5, -0.5 }, { 0.5, -0.5 }, { 0.5, 0.5 }, { 0.5, -0.5 } }, //VOXEL_FACE_FRONT 0, P000, P010, P110, P100
{ { -0.5, -0.5 }, { 0.5, -0.5 }, { 0.5, 0.5 }, { 0.5, -0.5 } }, //VOXEL_FACE_RIGHT 1, P100, P110, P111, P101
{ { -0.5, -0.5 }, { 0.5, -0.5 }, { 0.5, 0.5 }, { 0.5, -0.5 } }, //VOXEL_FACE_BACK 2, P101, P111, P011, P001
{ { -0.5, -0.5 }, { 0.5, -0.5 }, { 0.5, 0.5 }, { 0.5, -0.5 } }, //VOXEL_FACE_LEFT 3, P001, P011, P010, P000
{ { -0.5, -0.5 }, { 0.5, -0.5 }, { 0.5, 0.5 }, { 0.5, -0.5 } }, //VOXEL_FACE_TOP 4, P111, P110, P010, P011
{ { -0.5, -0.5 }, { 0.5, -0.5 }, { 0.5, 0.5 }, { 0.5, -0.5 } }, //VOXEL_FACE_BOTTOM 5, P001, P000, P100, P101
};
int VoxelCubePoints::get_x() {
return _x;
}
void VoxelCubePoints::set_x(int value) {
_x = value;
2019-07-13 22:03:23 +02:00
}
int VoxelCubePoints::get_y() {
return _y;
}
void VoxelCubePoints::set_y(int value) {
_y = value;
2019-07-13 22:03:23 +02:00
}
int VoxelCubePoints::get_z() {
return _z;
}
void VoxelCubePoints::set_z(int value) {
_z = value;
}
int VoxelCubePoints::get_size() {
return _size;
}
void VoxelCubePoints::set_size(int value) {
_size = value;
2019-07-13 22:03:23 +02:00
}
void VoxelCubePoints::refresh_points() {
2019-07-16 01:49:01 +02:00
for (int i = 0; i < POINT_COUNT; ++i) {
recalculate_point(i);
}
/*
2019-07-13 22:03:23 +02:00
//Front
//Bottom Left
refresh_point(P000, 0, 0, 0,
VOXEL_NEIGHBOUR_LEFT, VOXEL_NEIGHBOUR_BOTTOM_LEFT, VOXEL_NEIGHBOUR_LEFT, VOXEL_NEIGHBOUR_FRONT,
VOXEL_NEIGHBOUR_BOTTOM, VOXEL_NEIGHBOUR_BOTTOM_LEFT, VOXEL_NEIGHBOUR_BOTTOM_FRONT, VOXEL_NEIGHBOUR_BOTTOM_LEFT_FRONT,
VOXEL_NEIGHBOUR_FRONT, VOXEL_NEIGHBOUR_BOTTOM_FRONT, VOXEL_NEIGHBOUR_LEFT, VOXEL_NEIGHBOUR_FRONT);
2019-07-13 22:03:23 +02:00
//Bottom Right
refresh_point(P100, 255, 0, 0,
VOXEL_NEIGHBOUR_RIGHT, VOXEL_NEIGHBOUR_BOTTOM_RIGHT, VOXEL_NEIGHBOUR_RIGHT, VOXEL_NEIGHBOUR_FRONT,
VOXEL_NEIGHBOUR_BOTTOM, VOXEL_NEIGHBOUR_BOTTOM_RIGHT, VOXEL_NEIGHBOUR_BOTTOM_FRONT, VOXEL_NEIGHBOUR_BOTTOM_RIGHT_FRONT,
VOXEL_NEIGHBOUR_FRONT, VOXEL_NEIGHBOUR_BOTTOM_FRONT, VOXEL_NEIGHBOUR_RIGHT, VOXEL_NEIGHBOUR_FRONT);
2019-07-13 22:03:23 +02:00
//Top Left
refresh_point(P010, 0, 255, 0,
VOXEL_NEIGHBOUR_LEFT, VOXEL_NEIGHBOUR_TOP_LEFT, VOXEL_NEIGHBOUR_LEFT, VOXEL_NEIGHBOUR_FRONT,
VOXEL_NEIGHBOUR_TOP, VOXEL_NEIGHBOUR_TOP_LEFT, VOXEL_NEIGHBOUR_TOP_FRONT, VOXEL_NEIGHBOUR_TOP_LEFT_FRONT,
VOXEL_NEIGHBOUR_FRONT, VOXEL_NEIGHBOUR_TOP_FRONT, VOXEL_NEIGHBOUR_LEFT, VOXEL_NEIGHBOUR_FRONT);
2019-07-13 22:03:23 +02:00
//Top Right
refresh_point(P110, 255, 255, 0,
VOXEL_NEIGHBOUR_RIGHT, VOXEL_NEIGHBOUR_TOP_RIGHT, VOXEL_NEIGHBOUR_RIGHT, VOXEL_NEIGHBOUR_FRONT,
VOXEL_NEIGHBOUR_TOP, VOXEL_NEIGHBOUR_TOP_RIGHT, VOXEL_NEIGHBOUR_TOP_FRONT, VOXEL_NEIGHBOUR_TOP_RIGHT_FRONT,
VOXEL_NEIGHBOUR_FRONT, VOXEL_NEIGHBOUR_TOP_FRONT, VOXEL_NEIGHBOUR_RIGHT, VOXEL_NEIGHBOUR_FRONT);
2019-07-13 22:03:23 +02:00
//Back
//Bottom Left
refresh_point(P001, 0, 0, 255,
VOXEL_NEIGHBOUR_LEFT, VOXEL_NEIGHBOUR_BOTTOM_LEFT, VOXEL_NEIGHBOUR_LEFT, VOXEL_NEIGHBOUR_BACK,
VOXEL_NEIGHBOUR_BOTTOM, VOXEL_NEIGHBOUR_BOTTOM_LEFT, VOXEL_NEIGHBOUR_BOTTOM_BACK, VOXEL_NEIGHBOUR_BOTTOM_LEFT_BACK,
VOXEL_NEIGHBOUR_BACK, VOXEL_NEIGHBOUR_BOTTOM_BACK, VOXEL_NEIGHBOUR_LEFT, VOXEL_NEIGHBOUR_BACK);
2019-07-13 22:03:23 +02:00
//Bottom Right
refresh_point(P101, 255, 0, 255,
VOXEL_NEIGHBOUR_RIGHT, VOXEL_NEIGHBOUR_BOTTOM_RIGHT, VOXEL_NEIGHBOUR_RIGHT, VOXEL_NEIGHBOUR_BACK,
VOXEL_NEIGHBOUR_BOTTOM, VOXEL_NEIGHBOUR_BOTTOM_RIGHT, VOXEL_NEIGHBOUR_BOTTOM_BACK, VOXEL_NEIGHBOUR_BOTTOM_RIGHT_BACK,
VOXEL_NEIGHBOUR_BACK, VOXEL_NEIGHBOUR_BOTTOM_BACK, VOXEL_NEIGHBOUR_RIGHT, VOXEL_NEIGHBOUR_BACK);
2019-07-13 22:03:23 +02:00
//Top Left
refresh_point(P011, 0, 255, 255,
VOXEL_NEIGHBOUR_LEFT, VOXEL_NEIGHBOUR_TOP_LEFT, VOXEL_NEIGHBOUR_LEFT, VOXEL_NEIGHBOUR_BACK,
VOXEL_NEIGHBOUR_TOP, VOXEL_NEIGHBOUR_TOP_LEFT, VOXEL_NEIGHBOUR_TOP_BACK, VOXEL_NEIGHBOUR_TOP_LEFT_BACK,
VOXEL_NEIGHBOUR_BACK, VOXEL_NEIGHBOUR_TOP_BACK, VOXEL_NEIGHBOUR_LEFT, VOXEL_NEIGHBOUR_BACK);
2019-07-13 22:03:23 +02:00
//Top Right
refresh_point(P111, 255, 255, 255,
VOXEL_NEIGHBOUR_RIGHT, VOXEL_NEIGHBOUR_TOP_RIGHT, VOXEL_NEIGHBOUR_RIGHT, VOXEL_NEIGHBOUR_BACK,
VOXEL_NEIGHBOUR_TOP, VOXEL_NEIGHBOUR_TOP_RIGHT, VOXEL_NEIGHBOUR_TOP_BACK, VOXEL_NEIGHBOUR_TOP_RIGHT_BACK,
2019-07-16 01:49:01 +02:00
VOXEL_NEIGHBOUR_BACK, VOXEL_NEIGHBOUR_TOP_BACK, VOXEL_NEIGHBOUR_RIGHT, VOXEL_NEIGHBOUR_BACK);*/
2019-07-13 22:03:23 +02:00
}
2019-07-16 01:49:01 +02:00
void VoxelCubePoints::recalculate_point(int point) {
ERR_FAIL_INDEX(point, POINT_COUNT);
2019-07-13 22:03:23 +02:00
2019-07-16 01:49:01 +02:00
Vector3 static_offset;
Vector3 dynamic_offset;
2019-07-13 22:03:23 +02:00
2019-07-16 01:49:01 +02:00
for (int i = 0; i < 3; ++i) {
int neighbour_check = point_direction_neighbour_table[point][i];
2019-07-13 22:03:23 +02:00
2019-07-16 01:49:01 +02:00
if ((_point_neighbours[point] & neighbour_check) == 0) {
dynamic_offset[i] = point_direction_table[point][i];
2019-07-13 22:03:23 +02:00
} else {
2019-07-16 01:49:01 +02:00
static_offset[i] = point_direction_table[point][i];
2019-07-13 22:03:23 +02:00
}
}
2019-07-16 01:49:01 +02:00
dynamic_offset *= (_point_fills[point] / 255.0);
dynamic_offset += static_offset;
dynamic_offset += Vector3(0.5 * _size, 0.5 * _size, 0.5 * _size);
2019-07-13 22:03:23 +02:00
2019-07-16 01:49:01 +02:00
_points[point] = dynamic_offset;
2019-07-13 22:03:23 +02:00
}
2019-11-18 20:03:40 +01:00
void VoxelCubePoints::refresh_neighbours(const VoxelChunk *buffer) {
int neighbours = 0;
int x = _x;
int y = _y;
int z = _z;
//000
if (buffer->get_voxel(x - 1, y, z, VoxelChunk::DEFAULT_CHANNEL_TYPE) != 0)
neighbours = neighbours | VOXEL_NEIGHBOUR_LEFT;
if (buffer->get_voxel(x, y - 1, z, VoxelChunk::DEFAULT_CHANNEL_TYPE) != 0)
neighbours = neighbours | VOXEL_NEIGHBOUR_BOTTOM;
if (buffer->get_voxel(x, y, z - 1, VoxelChunk::DEFAULT_CHANNEL_TYPE) != 0)
neighbours = neighbours | VOXEL_NEIGHBOUR_FRONT;
/*
if (buffer->get_voxel(x - 1, y, z - 1, VoxelChunk::DEFAULT_CHANNEL_TYPE) != 0)
neighbours = neighbours | VOXEL_NEIGHBOUR_LEFT_FRONT;
if (buffer->get_voxel(x - 1, y - 1, z, VoxelChunk::DEFAULT_CHANNEL_TYPE) != 0)
neighbours = neighbours | VOXEL_NEIGHBOUR_BOTTOM_LEFT;
if (buffer->get_voxel(x, y - 1, z - 1, VoxelChunk::DEFAULT_CHANNEL_TYPE) != 0)
neighbours = neighbours | VOXEL_NEIGHBOUR_BOTTOM_FRONT;
if (buffer->get_voxel(x - 1, y - 1, z - 1, VoxelChunk::DEFAULT_CHANNEL_TYPE) != 0)
neighbours = neighbours | VOXEL_NEIGHBOUR_BOTTOM_LEFT_FRONT;*/
_point_neighbours[P000] = neighbours;
neighbours = 0;
2019-07-18 18:56:42 +02:00
x = _x + 1;
y = _y;
z = _z;
//100
if (buffer->get_voxel(x + 1, y, z, VoxelChunk::DEFAULT_CHANNEL_TYPE) != 0)
neighbours = neighbours | VOXEL_NEIGHBOUR_RIGHT;
if (buffer->get_voxel(x, y - 1, z, VoxelChunk::DEFAULT_CHANNEL_TYPE) != 0)
neighbours = neighbours | VOXEL_NEIGHBOUR_BOTTOM;
if (buffer->get_voxel(x, y, z - 1, VoxelChunk::DEFAULT_CHANNEL_TYPE) != 0)
neighbours = neighbours | VOXEL_NEIGHBOUR_FRONT;
/*
if (buffer->get_voxel(x + 1, y, z - 1, VoxelChunk::DEFAULT_CHANNEL_TYPE) != 0)
neighbours = neighbours | VOXEL_NEIGHBOUR_RIGHT_FRONT;
if (buffer->get_voxel(x + 1, y - 1, z, VoxelChunk::DEFAULT_CHANNEL_TYPE) != 0)
2019-07-16 01:49:01 +02:00
neighbours = neighbours | VOXEL_NEIGHBOUR_BOTTOM_RIGHT;
if (buffer->get_voxel(x, y - 1, z - 1, VoxelChunk::DEFAULT_CHANNEL_TYPE) != 0)
neighbours = neighbours | VOXEL_NEIGHBOUR_BOTTOM_FRONT;
if (buffer->get_voxel(x + 1, y - 1, z - 1, VoxelChunk::DEFAULT_CHANNEL_TYPE) != 0)
neighbours = neighbours | VOXEL_NEIGHBOUR_BOTTOM_RIGHT_FRONT;*/
_point_neighbours[P100] = neighbours;
neighbours = 0;
x = _x;
2019-07-18 18:56:42 +02:00
y = _y + 1;
z = _z;
//010
if (buffer->get_voxel(x - 1, y, z, VoxelChunk::DEFAULT_CHANNEL_TYPE) != 0)
neighbours = neighbours | VOXEL_NEIGHBOUR_LEFT;
if (buffer->get_voxel(x, y + 1, z, VoxelChunk::DEFAULT_CHANNEL_TYPE) != 0)
neighbours = neighbours | VOXEL_NEIGHBOUR_TOP;
if (buffer->get_voxel(x, y, z - 1, VoxelChunk::DEFAULT_CHANNEL_TYPE) != 0)
neighbours = neighbours | VOXEL_NEIGHBOUR_FRONT;
/*
if (buffer->get_voxel(x - 1, y, z - 1, VoxelChunk::DEFAULT_CHANNEL_TYPE) != 0)
neighbours = neighbours | VOXEL_NEIGHBOUR_LEFT_FRONT;
if (buffer->get_voxel(x - 1, y + 1, z, VoxelChunk::DEFAULT_CHANNEL_TYPE) != 0)
neighbours = neighbours | VOXEL_NEIGHBOUR_TOP_LEFT;
if (buffer->get_voxel(x, y + 1, z - 1, VoxelChunk::DEFAULT_CHANNEL_TYPE) != 0)
neighbours = neighbours | VOXEL_NEIGHBOUR_TOP_FRONT;
if (buffer->get_voxel(x - 1, y + 1, z - 1, VoxelChunk::DEFAULT_CHANNEL_TYPE) != 0)
neighbours = neighbours | VOXEL_NEIGHBOUR_TOP_LEFT_FRONT;*/
_point_neighbours[P010] = neighbours;
neighbours = 0;
2019-07-18 18:56:42 +02:00
x = _x + 1;
y = _y + 1;
z = _z;
//110
if (buffer->get_voxel(x + 1, y, z, VoxelChunk::DEFAULT_CHANNEL_TYPE) != 0)
neighbours = neighbours | VOXEL_NEIGHBOUR_RIGHT;
if (buffer->get_voxel(x, y + 1, z, VoxelChunk::DEFAULT_CHANNEL_TYPE) != 0)
neighbours = neighbours | VOXEL_NEIGHBOUR_TOP;
if (buffer->get_voxel(x, y, z - 1, VoxelChunk::DEFAULT_CHANNEL_TYPE) != 0)
neighbours = neighbours | VOXEL_NEIGHBOUR_FRONT;
/*
if (buffer->get_voxel(x + 1, y, z - 1, VoxelChunk::DEFAULT_CHANNEL_TYPE) != 0)
neighbours = neighbours | VOXEL_NEIGHBOUR_RIGHT_FRONT;
if (buffer->get_voxel(x + 1, y + 1, z, VoxelChunk::DEFAULT_CHANNEL_TYPE) != 0)
2019-07-16 01:49:01 +02:00
neighbours = neighbours | VOXEL_NEIGHBOUR_TOP_RIGHT;
if (buffer->get_voxel(x, y + 1, z - 1, VoxelChunk::DEFAULT_CHANNEL_TYPE) != 0)
neighbours = neighbours | VOXEL_NEIGHBOUR_TOP_FRONT;
if (buffer->get_voxel(x + 1, y + 1, z - 1, VoxelChunk::DEFAULT_CHANNEL_TYPE) != 0)
neighbours = neighbours | VOXEL_NEIGHBOUR_TOP_RIGHT_FRONT;*/
_point_neighbours[P110] = neighbours;
neighbours = 0;
x = _x;
y = _y;
2019-07-18 18:56:42 +02:00
z = _z + 1;
//001
if (buffer->get_voxel(x - 1, y, z, VoxelChunk::DEFAULT_CHANNEL_TYPE) != 0)
neighbours = neighbours | VOXEL_NEIGHBOUR_LEFT;
if (buffer->get_voxel(x, y - 1, z, VoxelChunk::DEFAULT_CHANNEL_TYPE) != 0)
neighbours = neighbours | VOXEL_NEIGHBOUR_BOTTOM;
if (buffer->get_voxel(x, y, z + 1, VoxelChunk::DEFAULT_CHANNEL_TYPE) != 0)
neighbours = neighbours | VOXEL_NEIGHBOUR_BACK;
/*
if (buffer->get_voxel(x - 1, y, z + 1, VoxelChunk::DEFAULT_CHANNEL_TYPE) != 0)
neighbours = neighbours | VOXEL_NEIGHBOUR_LEFT_BACK;
if (buffer->get_voxel(x - 1, y - 1, z, VoxelChunk::DEFAULT_CHANNEL_TYPE) != 0)
neighbours = neighbours | VOXEL_NEIGHBOUR_BOTTOM_LEFT;
if (buffer->get_voxel(x, y - 1, z + 1, VoxelChunk::DEFAULT_CHANNEL_TYPE) != 0)
neighbours = neighbours | VOXEL_NEIGHBOUR_BOTTOM_BACK;
if (buffer->get_voxel(x - 1, y - 1, z + 1, VoxelChunk::DEFAULT_CHANNEL_TYPE) != 0)
neighbours = neighbours | VOXEL_NEIGHBOUR_BOTTOM_LEFT_BACK;*/
_point_neighbours[P001] = neighbours;
neighbours = 0;
2019-07-18 18:56:42 +02:00
x = _x + 1;
y = _y;
2019-07-18 18:56:42 +02:00
z = _z + 1;
//101
if (buffer->get_voxel(x + 1, y, z, VoxelChunk::DEFAULT_CHANNEL_TYPE) != 0)
neighbours = neighbours | VOXEL_NEIGHBOUR_RIGHT;
if (buffer->get_voxel(x, y - 1, z, VoxelChunk::DEFAULT_CHANNEL_TYPE) != 0)
neighbours = neighbours | VOXEL_NEIGHBOUR_BOTTOM;
if (buffer->get_voxel(x, y, z + 1, VoxelChunk::DEFAULT_CHANNEL_TYPE) != 0)
neighbours = neighbours | VOXEL_NEIGHBOUR_BACK;
/*
if (buffer->get_voxel(x + 1, y, z + 1, VoxelChunk::DEFAULT_CHANNEL_TYPE) != 0)
neighbours = neighbours | VOXEL_NEIGHBOUR_RIGHT_BACK;
if (buffer->get_voxel(x + 1, y - 1, z, VoxelChunk::DEFAULT_CHANNEL_TYPE) != 0)
2019-07-16 01:49:01 +02:00
neighbours = neighbours | VOXEL_NEIGHBOUR_BOTTOM_RIGHT;
if (buffer->get_voxel(x, y - 1, z + 1, VoxelChunk::DEFAULT_CHANNEL_TYPE) != 0)
neighbours = neighbours | VOXEL_NEIGHBOUR_BOTTOM_BACK;
if (buffer->get_voxel(x + 1, y - 1, z + 1, VoxelChunk::DEFAULT_CHANNEL_TYPE) != 0)
neighbours = neighbours | VOXEL_NEIGHBOUR_BOTTOM_RIGHT_BACK;*/
_point_neighbours[P101] = neighbours;
neighbours = 0;
x = _x;
2019-07-18 18:56:42 +02:00
y = _y + 1;
z = _z + 1;
//011
if (buffer->get_voxel(x - 1, y, z, VoxelChunk::DEFAULT_CHANNEL_TYPE) != 0)
neighbours = neighbours | VOXEL_NEIGHBOUR_LEFT;
if (buffer->get_voxel(x, y + 1, z, VoxelChunk::DEFAULT_CHANNEL_TYPE) != 0)
neighbours = neighbours | VOXEL_NEIGHBOUR_TOP;
if (buffer->get_voxel(x, y, z + 1, VoxelChunk::DEFAULT_CHANNEL_TYPE) != 0)
neighbours = neighbours | VOXEL_NEIGHBOUR_BACK;
/*
if (buffer->get_voxel(x - 1, y, z + 1, VoxelChunk::DEFAULT_CHANNEL_TYPE) != 0)
neighbours = neighbours | VOXEL_NEIGHBOUR_LEFT_BACK;
if (buffer->get_voxel(x - 1, y + 1, z, VoxelChunk::DEFAULT_CHANNEL_TYPE) != 0)
neighbours = neighbours | VOXEL_NEIGHBOUR_TOP_LEFT;
if (buffer->get_voxel(x, y + 1, z + 1, VoxelChunk::DEFAULT_CHANNEL_TYPE) != 0)
neighbours = neighbours | VOXEL_NEIGHBOUR_TOP_BACK;
if (buffer->get_voxel(x - 1, y + 1, z + 1, VoxelChunk::DEFAULT_CHANNEL_TYPE) != 0)
neighbours = neighbours | VOXEL_NEIGHBOUR_TOP_LEFT_BACK;*/
_point_neighbours[P011] = neighbours;
neighbours = 0;
2019-07-18 18:56:42 +02:00
x = _x + 1;
y = _y + 1;
z = _z + 1;
//111
if (buffer->get_voxel(x + 1, y, z, VoxelChunk::DEFAULT_CHANNEL_TYPE) != 0)
neighbours = neighbours | VOXEL_NEIGHBOUR_RIGHT;
if (buffer->get_voxel(x, y + 1, z, VoxelChunk::DEFAULT_CHANNEL_TYPE) != 0)
neighbours = neighbours | VOXEL_NEIGHBOUR_TOP;
if (buffer->get_voxel(x, y, z + 1, VoxelChunk::DEFAULT_CHANNEL_TYPE) != 0)
neighbours = neighbours | VOXEL_NEIGHBOUR_BACK;
/*
if (buffer->get_voxel(x + 1, y, z + 1, VoxelChunk::DEFAULT_CHANNEL_TYPE) != 0)
neighbours = neighbours | VOXEL_NEIGHBOUR_RIGHT_BACK;
if (buffer->get_voxel(x + 1, y + 1, z, VoxelChunk::DEFAULT_CHANNEL_TYPE) != 0)
neighbours = neighbours | VOXEL_NEIGHBOUR_TOP_RIGHT;
if (buffer->get_voxel(x, y + 1, z + 1, VoxelChunk::DEFAULT_CHANNEL_TYPE) != 0)
neighbours = neighbours | VOXEL_NEIGHBOUR_TOP_BACK;
if (buffer->get_voxel(x + 1, y + 1, z + 1, VoxelChunk::DEFAULT_CHANNEL_TYPE) != 0)
neighbours = neighbours | VOXEL_NEIGHBOUR_TOP_RIGHT_BACK;*/
_point_neighbours[P111] = neighbours;
}
2019-11-18 20:03:40 +01:00
void VoxelCubePoints::setup(const VoxelChunk *buffer, int x, int y, int z, int size) {
ERR_FAIL_COND(size <= 0);
2019-07-16 01:49:01 +02:00
ERR_FAIL_COND(!buffer->validate_pos(x + size, y + size, z + size) || !buffer->validate_pos(x, y, z));
reset();
_x = x;
_y = y;
_z = z;
_size = size;
_point_types[P000] = buffer->get_voxel(x, y, z, VoxelChunk::DEFAULT_CHANNEL_TYPE);
_point_types[P100] = buffer->get_voxel(x + size, y, z, VoxelChunk::DEFAULT_CHANNEL_TYPE);
_point_types[P010] = buffer->get_voxel(x, y + size, z, VoxelChunk::DEFAULT_CHANNEL_TYPE);
_point_types[P001] = buffer->get_voxel(x, y, z + size, VoxelChunk::DEFAULT_CHANNEL_TYPE);
_point_types[P110] = buffer->get_voxel(x + size, y + size, z, VoxelChunk::DEFAULT_CHANNEL_TYPE);
_point_types[P011] = buffer->get_voxel(x, y + size, z + size, VoxelChunk::DEFAULT_CHANNEL_TYPE);
_point_types[P101] = buffer->get_voxel(x + size, y, z + size, VoxelChunk::DEFAULT_CHANNEL_TYPE);
_point_types[P111] = buffer->get_voxel(x + size, y + size, z + size, VoxelChunk::DEFAULT_CHANNEL_TYPE);
if (!has_points())
return;
_point_fills[P000] = buffer->get_voxel(x, y, z, VoxelChunk::DEFAULT_CHANNEL_ISOLEVEL);
_point_fills[P100] = buffer->get_voxel(x + size, y, z, VoxelChunk::DEFAULT_CHANNEL_ISOLEVEL);
_point_fills[P010] = buffer->get_voxel(x, y + size, z, VoxelChunk::DEFAULT_CHANNEL_ISOLEVEL);
_point_fills[P001] = buffer->get_voxel(x, y, z + size, VoxelChunk::DEFAULT_CHANNEL_ISOLEVEL);
_point_fills[P110] = buffer->get_voxel(x + size, y + size, z, VoxelChunk::DEFAULT_CHANNEL_ISOLEVEL);
_point_fills[P011] = buffer->get_voxel(x, y + size, z + size, VoxelChunk::DEFAULT_CHANNEL_ISOLEVEL);
_point_fills[P101] = buffer->get_voxel(x + size, y, z + size, VoxelChunk::DEFAULT_CHANNEL_ISOLEVEL);
_point_fills[P111] = buffer->get_voxel(x + size, y + size, z + size, VoxelChunk::DEFAULT_CHANNEL_ISOLEVEL);
_point_aos[P000] = buffer->get_voxel(x, y, z, VoxelChunk::DEFAULT_CHANNEL_AO);
_point_aos[P100] = buffer->get_voxel(x + size, y, z, VoxelChunk::DEFAULT_CHANNEL_AO);
_point_aos[P010] = buffer->get_voxel(x, y + size, z, VoxelChunk::DEFAULT_CHANNEL_AO);
_point_aos[P001] = buffer->get_voxel(x, y, z + size, VoxelChunk::DEFAULT_CHANNEL_AO);
_point_aos[P110] = buffer->get_voxel(x + size, y + size, z, VoxelChunk::DEFAULT_CHANNEL_AO);
_point_aos[P011] = buffer->get_voxel(x, y + size, z + size, VoxelChunk::DEFAULT_CHANNEL_AO);
_point_aos[P101] = buffer->get_voxel(x + size, y, z + size, VoxelChunk::DEFAULT_CHANNEL_AO);
_point_aos[P111] = buffer->get_voxel(x + size, y + size, z + size, VoxelChunk::DEFAULT_CHANNEL_AO);
_point_colors[P000] = Color(buffer->get_voxel(x, y, z, VoxelChunk::DEFAULT_CHANNEL_LIGHT_COLOR_R) / 255.0, buffer->get_voxel(x, y, z, VoxelChunk::DEFAULT_CHANNEL_LIGHT_COLOR_G) / 255.0, buffer->get_voxel(x, y, z, VoxelChunk::DEFAULT_CHANNEL_LIGHT_COLOR_B) / 255.0);
_point_colors[P100] = Color(buffer->get_voxel(x + size, y, z, VoxelChunk::DEFAULT_CHANNEL_LIGHT_COLOR_R) / 255.0, buffer->get_voxel(x + size, y, z, VoxelChunk::DEFAULT_CHANNEL_LIGHT_COLOR_G) / 255.0, buffer->get_voxel(x + size, y, z, VoxelChunk::DEFAULT_CHANNEL_LIGHT_COLOR_B) / 255.0);
_point_colors[P010] = Color(buffer->get_voxel(x, y + size, z, VoxelChunk::DEFAULT_CHANNEL_LIGHT_COLOR_R) / 255.0, buffer->get_voxel(x, y + size, z, VoxelChunk::DEFAULT_CHANNEL_LIGHT_COLOR_G) / 255.0, buffer->get_voxel(x, y + size, z, VoxelChunk::DEFAULT_CHANNEL_LIGHT_COLOR_B) / 255.0);
_point_colors[P001] = Color(buffer->get_voxel(x, y, z + size, VoxelChunk::DEFAULT_CHANNEL_LIGHT_COLOR_R) / 255.0, buffer->get_voxel(x, y, z + size, VoxelChunk::DEFAULT_CHANNEL_LIGHT_COLOR_G) / 255.0, buffer->get_voxel(x, y, z + size, VoxelChunk::DEFAULT_CHANNEL_LIGHT_COLOR_B) / 255.0);
_point_colors[P110] = Color(buffer->get_voxel(x + size, y + size, z, VoxelChunk::DEFAULT_CHANNEL_LIGHT_COLOR_R) / 255.0, buffer->get_voxel(x + size, y + size, z, VoxelChunk::DEFAULT_CHANNEL_LIGHT_COLOR_G) / 255.0, buffer->get_voxel(x + size, y + size, z, VoxelChunk::DEFAULT_CHANNEL_LIGHT_COLOR_B) / 255.0);
_point_colors[P011] = Color(buffer->get_voxel(x, y + size, z + size, VoxelChunk::DEFAULT_CHANNEL_LIGHT_COLOR_R) / 255.0, buffer->get_voxel(x, y + size, z + size, VoxelChunk::DEFAULT_CHANNEL_LIGHT_COLOR_G) / 255.0, buffer->get_voxel(x, y + size, z + size, VoxelChunk::DEFAULT_CHANNEL_LIGHT_COLOR_B) / 255.0);
_point_colors[P101] = Color(buffer->get_voxel(x + size, y, z + size, VoxelChunk::DEFAULT_CHANNEL_LIGHT_COLOR_R) / 255.0, buffer->get_voxel(x + size, y, z + size, VoxelChunk::DEFAULT_CHANNEL_LIGHT_COLOR_G) / 255.0, buffer->get_voxel(x + size, y, z + size, VoxelChunk::DEFAULT_CHANNEL_LIGHT_COLOR_B) / 255.0);
_point_colors[P111] = Color(buffer->get_voxel(x + size, y + size, z + size, VoxelChunk::DEFAULT_CHANNEL_LIGHT_COLOR_R) / 255.0, buffer->get_voxel(x + size, y + size, z + size, VoxelChunk::DEFAULT_CHANNEL_LIGHT_COLOR_G) / 255.0, buffer->get_voxel(x + size, y + size, z + size, VoxelChunk::DEFAULT_CHANNEL_LIGHT_COLOR_B) / 255.0);
refresh_neighbours(buffer);
refresh_points();
2019-07-13 22:03:23 +02:00
}
void VoxelCubePoints::reset() {
for (int i = 0; i < POINT_COUNT; ++i) {
_point_types[i] = 0;
_point_fills[i] = 0;
_point_neighbours[i] = 0;
2019-07-13 22:03:23 +02:00
}
_x = 0;
_y = 0;
_z = 0;
_size = 1;
2019-07-13 22:03:23 +02:00
}
int VoxelCubePoints::get_point_index(int face, int index) {
ERR_FAIL_INDEX_V(face, VOXEL_FACE_COUNT, 0);
ERR_FAIL_INDEX_V(index, 4, 0);
return index_table[face][index];
2019-07-13 22:03:23 +02:00
}
2019-07-16 11:11:47 +02:00
Vector2 VoxelCubePoints::get_point_uv_direction(int face, int index) {
ERR_FAIL_INDEX_V(face, VOXEL_FACE_COUNT, Vector2());
ERR_FAIL_INDEX_V(index, 4, Vector2());
return Vector2(uv_direction_table[face][index][0], uv_direction_table[face][index][1]);
}
2019-07-16 01:49:01 +02:00
Vector3 VoxelCubePoints::get_points_for_face(int face, int index) {
return _points[get_point_index(face, index)];
}
2019-07-13 22:03:23 +02:00
bool VoxelCubePoints::is_face_visible(int face) {
ERR_FAIL_INDEX_V(face, VOXEL_FACE_COUNT, false);
2019-07-16 01:49:01 +02:00
int target_neighbour = visibility_check_table[face];
for (int i = 0; i < 4; ++i) {
int indx = get_point_index(face, i);
int neighbour_mask = _point_neighbours[indx];
2019-07-13 22:03:23 +02:00
if ((neighbour_mask & target_neighbour) == 0)
return true;
}
2019-07-13 22:03:23 +02:00
return false;
2019-07-13 22:03:23 +02:00
}
2019-11-18 20:03:40 +01:00
bool VoxelCubePoints::is_sub_voxel_point_vec(Vector3 point) {
2019-07-13 22:03:23 +02:00
for (int i = 0; i < POINT_COUNT; i += 1) {
if (get_point(i) == (point)) {
return true;
}
}
return false;
}
bool VoxelCubePoints::is_sub_voxel_point(int x, int y, int z) {
2019-07-13 22:03:23 +02:00
for (int i = 0; i < POINT_COUNT; i += 1) {
2019-11-18 20:03:40 +01:00
if (get_point(i) == Vector3(x, y, z)) {
2019-07-13 22:03:23 +02:00
return true;
}
}
return false;
}
void VoxelCubePoints::set_point(int point, int x, int y, int z) {
2019-07-16 01:49:01 +02:00
_points[point] = Vector3(x, y, z);
2019-07-13 22:03:23 +02:00
}
2019-11-18 20:03:40 +01:00
int VoxelCubePoints::get_point_id_vec(Vector3 point) {
2019-07-13 22:03:23 +02:00
for (int i = 0; i < POINT_COUNT; ++i) {
if (get_point(i) == point) {
return i;
}
}
return 0;
}
int VoxelCubePoints::get_point_id(int x, int y, int z) {
2019-07-13 22:03:23 +02:00
for (int i = 0; i < POINT_COUNT; ++i) {
if (get_point(i) == Vector3i(x, y, z)) {
return i;
}
}
return 0;
}
2019-07-16 01:49:01 +02:00
Vector3 VoxelCubePoints::get_point_for_face(int face, int index) {
int indx = get_point_index(face, index);
2019-07-16 01:49:01 +02:00
return _points[indx];
}
Vector3 VoxelCubePoints::get_vertex_vector3_for_point(int face, int index) {
int point_index = get_point_index(face, index);
2019-07-16 01:49:01 +02:00
Vector3 a = get_point(point_index);
Vector3 vector(a.x, a.y, a.z);
float num = (float)255;
float num2 = num / (float)2;
vector.x -= num2;
vector.y -= num2;
vector.z -= num2;
vector /= num;
2019-07-16 01:49:01 +02:00
return vector;
}
2019-07-16 11:11:47 +02:00
int VoxelCubePoints::get_point_type(int index) {
ERR_FAIL_INDEX_V(index, POINT_COUNT, 0);
return _point_types[index];
}
int VoxelCubePoints::get_point_fill(int index) {
ERR_FAIL_INDEX_V(index, POINT_COUNT, 0);
return _point_fills[index];
}
int VoxelCubePoints::get_point_neighbours(int index) {
ERR_FAIL_INDEX_V(index, POINT_COUNT, 0);
return _point_neighbours[index];
}
int VoxelCubePoints::get_point_ao(int index) {
ERR_FAIL_INDEX_V(index, POINT_COUNT, 0);
return _point_aos[index];
}
int VoxelCubePoints::get_face_point_ao(int face, int index) {
int indx = get_point_index(face, index);
return _point_aos[indx];
}
2019-07-17 02:28:16 +02:00
Color VoxelCubePoints::get_face_point_ao_color(int face, int index) {
int indx = get_point_index(face, index);
float ao_value = (_point_aos[indx] / 255.0) * 0.75;
return Color(ao_value, ao_value, ao_value);
}
Color VoxelCubePoints::get_face_point_light_color(int face, int index) {
int indx = get_point_index(face, index);
return _point_colors[indx];
}
Color VoxelCubePoints::get_face_point_color_mixed(int face, int index) {
int indx = get_point_index(face, index);
float ao_value = (_point_aos[indx] / 255.0) * 0.75;
return _point_colors[indx] - Color(ao_value, ao_value, ao_value);
}
Vector3 VoxelCubePoints::get_face_light_direction(int face) {
ERR_FAIL_INDEX_V(face, VOXEL_FACE_COUNT, Vector3());
return Vector3(face_light_direction_table[face][0], face_light_direction_table[face][1], face_light_direction_table[face][2]);
}
2019-07-16 01:49:01 +02:00
Vector3 VoxelCubePoints::get_point(int index) {
2019-07-16 11:11:47 +02:00
ERR_FAIL_INDEX_V(index, POINT_COUNT, Vector3());
return _points[index];
}
2019-07-16 01:49:01 +02:00
Vector3 VoxelCubePoints::get_top_left_point(int face) {
if (face == VOXEL_FACE_BACK) {
return _points[P011];
2019-07-13 22:03:23 +02:00
}
if (face == VOXEL_FACE_FRONT) {
return _points[P010];
2019-07-13 22:03:23 +02:00
}
if (face == VOXEL_FACE_RIGHT) {
return _points[P111];
2019-07-13 22:03:23 +02:00
}
if (face == VOXEL_FACE_LEFT) {
return _points[P010];
2019-07-13 22:03:23 +02:00
}
if (face == VOXEL_FACE_TOP) {
return _points[P010];
2019-07-13 22:03:23 +02:00
}
if (face == VOXEL_FACE_BOTTOM) {
return _points[P000];
2019-07-13 22:03:23 +02:00
}
return _points[0];
2019-07-13 22:03:23 +02:00
}
2019-07-16 01:49:01 +02:00
Vector3 VoxelCubePoints::get_top_right_point(int face) {
if (face == VOXEL_FACE_BACK) {
return _points[P111];
2019-07-13 22:03:23 +02:00
}
if (face == VOXEL_FACE_FRONT) {
return _points[P110];
2019-07-13 22:03:23 +02:00
}
if (face == VOXEL_FACE_RIGHT) {
return _points[P110];
2019-07-13 22:03:23 +02:00
}
if (face == VOXEL_FACE_LEFT) {
return _points[P011];
2019-07-13 22:03:23 +02:00
}
if (face == VOXEL_FACE_TOP) {
return _points[P110];
2019-07-13 22:03:23 +02:00
}
if (face == VOXEL_FACE_BOTTOM) {
return _points[P100];
2019-07-13 22:03:23 +02:00
}
return _points[0];
2019-07-13 22:03:23 +02:00
}
2019-07-16 01:49:01 +02:00
Vector3 VoxelCubePoints::get_bottom_left_point(int face) {
if (face == VOXEL_FACE_BACK) {
return _points[P001];
2019-07-13 22:03:23 +02:00
}
if (face == VOXEL_FACE_FRONT) {
return _points[P000];
2019-07-13 22:03:23 +02:00
}
if (face == VOXEL_FACE_RIGHT) {
return _points[P101];
2019-07-13 22:03:23 +02:00
}
if (face == VOXEL_FACE_LEFT) {
return _points[P001];
2019-07-13 22:03:23 +02:00
}
if (face == VOXEL_FACE_TOP) {
return _points[P011];
2019-07-13 22:03:23 +02:00
}
if (face == VOXEL_FACE_BOTTOM) {
return _points[P001];
2019-07-13 22:03:23 +02:00
}
return _points[0];
2019-07-13 22:03:23 +02:00
}
2019-07-16 01:49:01 +02:00
Vector3 VoxelCubePoints::get_bottom_right_point(int face) {
if (face == VOXEL_FACE_BACK) {
return _points[P101];
2019-07-13 22:03:23 +02:00
}
if (face == VOXEL_FACE_FRONT) {
return _points[P100];
2019-07-13 22:03:23 +02:00
}
if (face == VOXEL_FACE_RIGHT) {
return _points[P100];
2019-07-13 22:03:23 +02:00
}
if (face == VOXEL_FACE_LEFT) {
return _points[P001];
2019-07-13 22:03:23 +02:00
}
if (face == VOXEL_FACE_TOP) {
return _points[P111];
2019-07-13 22:03:23 +02:00
}
if (face == VOXEL_FACE_BOTTOM) {
return _points[P101];
2019-07-13 22:03:23 +02:00
}
return _points[P000];
2019-07-13 22:03:23 +02:00
}
bool VoxelCubePoints::has_points() {
return (_point_types[P000] != 0 && _point_types[P100] != 0 && _point_types[P010] != 0 && _point_types[P001] != 0 &&
_point_types[P110] != 0 && _point_types[P011] != 0 && _point_types[P101] != 0 && _point_types[P111] != 0);
2019-07-13 22:03:23 +02:00
}
int VoxelCubePoints::get_opposite_face(int face) {
if (face == VOXEL_FACE_FRONT) {
return VOXEL_FACE_BACK;
2019-07-13 22:03:23 +02:00
}
if (face == VOXEL_FACE_BACK) {
return VOXEL_FACE_FRONT;
2019-07-13 22:03:23 +02:00
}
if (face == VOXEL_FACE_LEFT) {
return VOXEL_FACE_RIGHT;
2019-07-13 22:03:23 +02:00
}
if (face == VOXEL_FACE_RIGHT) {
return VOXEL_FACE_LEFT;
2019-07-13 22:03:23 +02:00
}
if (face == VOXEL_FACE_TOP) {
return VOXEL_FACE_BOTTOM;
2019-07-13 22:03:23 +02:00
}
return VOXEL_FACE_BOTTOM;
2019-07-13 22:03:23 +02:00
}
VoxelCubePoints::VoxelCubePoints() {
reset();
}
VoxelCubePoints::~VoxelCubePoints() {
}
void VoxelCubePoints::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_x"), &VoxelCubePoints::get_x);
ClassDB::bind_method(D_METHOD("set_x", "value"), &VoxelCubePoints::set_x);
ADD_PROPERTY(PropertyInfo(Variant::INT, "x"), "set_x", "get_x");
ClassDB::bind_method(D_METHOD("get_y"), &VoxelCubePoints::get_y);
ClassDB::bind_method(D_METHOD("set_y", "value"), &VoxelCubePoints::set_y);
ADD_PROPERTY(PropertyInfo(Variant::INT, "y"), "set_y", "get_y");
ClassDB::bind_method(D_METHOD("get_z"), &VoxelCubePoints::get_z);
ClassDB::bind_method(D_METHOD("set_z", "value"), &VoxelCubePoints::set_z);
ADD_PROPERTY(PropertyInfo(Variant::INT, "z"), "set_z", "get_z");
ClassDB::bind_method(D_METHOD("get_size"), &VoxelCubePoints::get_size);
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("refresh_points"), &VoxelCubePoints::refresh_points);
ClassDB::bind_method(D_METHOD("setup", "buffer", "x", "y", "z", "size"), &VoxelCubePoints::setup, DEFVAL(1));
ClassDB::bind_method(D_METHOD("get_point_index", "face", "index"), &VoxelCubePoints::get_point_index);
2019-07-16 11:11:47 +02:00
ClassDB::bind_method(D_METHOD("get_point_uv_direction", "face", "index"), &VoxelCubePoints::get_point_uv_direction);
2019-07-16 01:49:01 +02:00
ClassDB::bind_method(D_METHOD("get_points_for_face", "face", "index"), &VoxelCubePoints::get_points_for_face);
2019-07-16 01:49:01 +02:00
ClassDB::bind_method(D_METHOD("is_face_visible", "face"), &VoxelCubePoints::is_face_visible);
ClassDB::bind_method(D_METHOD("is_sub_voxel_point", "x", "y", "z"), &VoxelCubePoints::is_sub_voxel_point);
ClassDB::bind_method(D_METHOD("set_point", "point", "x", "y", "z"), &VoxelCubePoints::set_point);
ClassDB::bind_method(D_METHOD("get_point_id", "x", "y", "z"), &VoxelCubePoints::get_point_id);
2019-07-16 01:49:01 +02:00
ClassDB::bind_method(D_METHOD("get_point_for_face", "face", "index"), &VoxelCubePoints::get_point_for_face);
ClassDB::bind_method(D_METHOD("get_vertex_vector3_for_point", "face", "index"), &VoxelCubePoints::get_vertex_vector3_for_point);
2019-07-16 11:11:47 +02:00
ClassDB::bind_method(D_METHOD("get_point_type", "index"), &VoxelCubePoints::get_point_type);
ClassDB::bind_method(D_METHOD("get_point_fill", "index"), &VoxelCubePoints::get_point_fill);
ClassDB::bind_method(D_METHOD("get_point_neighbours", "index"), &VoxelCubePoints::get_point_neighbours);
ClassDB::bind_method(D_METHOD("get_point_ao", "index"), &VoxelCubePoints::get_point_ao);
ClassDB::bind_method(D_METHOD("get_face_point_ao", "face", "index"), &VoxelCubePoints::get_face_point_ao);
2019-07-17 02:28:16 +02:00
ClassDB::bind_method(D_METHOD("get_face_point_ao_color", "face", "index"), &VoxelCubePoints::get_face_point_ao_color);
ClassDB::bind_method(D_METHOD("get_face_point_light_color", "face", "index"), &VoxelCubePoints::get_face_point_light_color);
ClassDB::bind_method(D_METHOD("get_face_point_color_mixed", "face", "index"), &VoxelCubePoints::get_face_point_color_mixed);
ClassDB::bind_method(D_METHOD("get_face_light_direction", "face"), &VoxelCubePoints::get_face_light_direction);
2019-07-16 01:49:01 +02:00
ClassDB::bind_method(D_METHOD("get_point", "index"), &VoxelCubePoints::get_point);
2019-07-16 01:49:01 +02:00
ClassDB::bind_method(D_METHOD("get_top_left_point", "face"), &VoxelCubePoints::get_top_left_point);
ClassDB::bind_method(D_METHOD("get_top_right_point", "face"), &VoxelCubePoints::get_top_right_point);
ClassDB::bind_method(D_METHOD("get_bottom_left_point", "face"), &VoxelCubePoints::get_bottom_left_point);
ClassDB::bind_method(D_METHOD("get_bottom_right_point", "face"), &VoxelCubePoints::get_bottom_right_point);
ClassDB::bind_method(D_METHOD("has_points"), &VoxelCubePoints::has_points);
ClassDB::bind_method(D_METHOD("get_opposite_face", "face"), &VoxelCubePoints::get_opposite_face);
BIND_ENUM_CONSTANT(P000);
BIND_ENUM_CONSTANT(P100);
BIND_ENUM_CONSTANT(P010);
BIND_ENUM_CONSTANT(P001);
BIND_ENUM_CONSTANT(P110);
BIND_ENUM_CONSTANT(P011);
BIND_ENUM_CONSTANT(P101);
BIND_ENUM_CONSTANT(P111);
BIND_ENUM_CONSTANT(POINT_COUNT);
BIND_ENUM_CONSTANT(VOXEL_FACE_FRONT);
BIND_ENUM_CONSTANT(VOXEL_FACE_RIGHT);
BIND_ENUM_CONSTANT(VOXEL_FACE_BACK);
BIND_ENUM_CONSTANT(VOXEL_FACE_LEFT);
BIND_ENUM_CONSTANT(VOXEL_FACE_TOP);
BIND_ENUM_CONSTANT(VOXEL_FACE_BOTTOM);
BIND_ENUM_CONSTANT(VOXEL_FACE_COUNT);
BIND_ENUM_CONSTANT(VOXEL_NEIGHBOUR_NONE);
BIND_ENUM_CONSTANT(VOXEL_NEIGHBOUR_LEFT);
BIND_ENUM_CONSTANT(VOXEL_NEIGHBOUR_RIGHT);
BIND_ENUM_CONSTANT(VOXEL_NEIGHBOUR_FRONT);
BIND_ENUM_CONSTANT(VOXEL_NEIGHBOUR_BACK);
BIND_ENUM_CONSTANT(VOXEL_NEIGHBOUR_TOP);
BIND_ENUM_CONSTANT(VOXEL_NEIGHBOUR_BOTTOM);
BIND_ENUM_CONSTANT(VOXEL_NEIGHBOUR_LEFT_FRONT);
BIND_ENUM_CONSTANT(VOXEL_NEIGHBOUR_LEFT_BACK);
BIND_ENUM_CONSTANT(VOXEL_NEIGHBOUR_RIGHT_FRONT);
BIND_ENUM_CONSTANT(VOXEL_NEIGHBOUR_RIGHT_BACK);
BIND_ENUM_CONSTANT(VOXEL_NEIGHBOUR_TOP_LEFT);
BIND_ENUM_CONSTANT(VOXEL_NEIGHBOUR_TOP_RIGHT);
BIND_ENUM_CONSTANT(VOXEL_NEIGHBOUR_TOP_FRONT);
BIND_ENUM_CONSTANT(VOXEL_NEIGHBOUR_TOP_BACK);
BIND_ENUM_CONSTANT(VOXEL_NEIGHBOUR_BOTTOM_LEFT);
BIND_ENUM_CONSTANT(VOXEL_NEIGHBOUR_BOTTOM_RIGHT);
BIND_ENUM_CONSTANT(VOXEL_NEIGHBOUR_BOTTOM_FRONT);
BIND_ENUM_CONSTANT(VOXEL_NEIGHBOUR_BOTTOM_BACK);
BIND_ENUM_CONSTANT(VOXEL_NEIGHBOUR_BOTTOM_LEFT_FRONT);
BIND_ENUM_CONSTANT(VOXEL_NEIGHBOUR_BOTTOM_LEFT_BACK);
BIND_ENUM_CONSTANT(VOXEL_NEIGHBOUR_BOTTOM_RIGHT_FRONT);
BIND_ENUM_CONSTANT(VOXEL_NEIGHBOUR_BOTTOM_RIGHT_BACK);
BIND_ENUM_CONSTANT(VOXEL_NEIGHBOUR_TOP_LEFT_FRONT);
BIND_ENUM_CONSTANT(VOXEL_NEIGHBOUR_TOP_LEFT_BACK);
BIND_ENUM_CONSTANT(VOXEL_NEIGHBOUR_TOP_RIGHT_FRONT);
BIND_ENUM_CONSTANT(VOXEL_NEIGHBOUR_TOP_RIGHT_BACK);
BIND_ENUM_CONSTANT(VOXEL_FULL_NEIGHBOURS_CROSS);
BIND_ENUM_CONSTANT(VOXEL_FULL_SIDE_NEIGHBOURS);
BIND_ENUM_CONSTANT(VOXEL_FULL_SIDE_NEIGHBOURS_TOP);
BIND_ENUM_CONSTANT(VOXEL_FULL_SIDE_NEIGHBOURS_DOWN);
}