2017-08-19 12:10:31 -07:00
|
|
|
#ifndef CUBE_TABLES_H
|
|
|
|
#define CUBE_TABLES_H
|
|
|
|
|
2022-02-13 16:11:41 -08:00
|
|
|
#include "../util/math/vector3f.h"
|
2021-02-21 15:58:00 -08:00
|
|
|
#include "../util/math/vector3i.h"
|
2017-08-19 12:10:31 -07:00
|
|
|
|
2022-01-08 19:27:30 -08:00
|
|
|
namespace zylann::voxel::Cube {
|
2017-08-19 12:10:31 -07:00
|
|
|
|
2018-09-30 11:37:39 -07:00
|
|
|
// Index convention used in some lookup tables
|
|
|
|
enum Side {
|
|
|
|
SIDE_LEFT = 0,
|
|
|
|
SIDE_RIGHT,
|
|
|
|
SIDE_BOTTOM,
|
|
|
|
SIDE_TOP,
|
2019-12-28 13:38:32 -08:00
|
|
|
// TODO I would like to swap the Z ones because it's inconsistent with coordinates...
|
2018-09-30 11:37:39 -07:00
|
|
|
SIDE_BACK,
|
|
|
|
SIDE_FRONT,
|
|
|
|
|
|
|
|
SIDE_COUNT
|
|
|
|
};
|
2019-12-31 08:48:46 -08:00
|
|
|
// Alias to the above for clarity, fixing some interpretation problems regarding the side_normals table...
|
2019-12-28 13:38:32 -08:00
|
|
|
enum SideAxis {
|
2019-12-31 08:48:46 -08:00
|
|
|
SIDE_POSITIVE_X = 0,
|
|
|
|
SIDE_NEGATIVE_X,
|
2019-12-28 13:38:32 -08:00
|
|
|
SIDE_NEGATIVE_Y,
|
|
|
|
SIDE_POSITIVE_Y,
|
2019-12-31 08:48:46 -08:00
|
|
|
SIDE_NEGATIVE_Z,
|
|
|
|
SIDE_POSITIVE_Z
|
2019-12-28 13:38:32 -08:00
|
|
|
};
|
2018-09-30 11:37:39 -07:00
|
|
|
|
|
|
|
// Index convention used in some lookup tables
|
|
|
|
enum Edge {
|
|
|
|
EDGE_BOTTOM_BACK = 0,
|
|
|
|
EDGE_BOTTOM_RIGHT,
|
|
|
|
EDGE_BOTTOM_FRONT,
|
|
|
|
EDGE_BOTTOM_LEFT,
|
|
|
|
EDGE_BACK_LEFT,
|
|
|
|
EDGE_BACK_RIGHT,
|
|
|
|
EDGE_FRONT_RIGHT,
|
|
|
|
EDGE_FRONT_LEFT,
|
|
|
|
EDGE_TOP_BACK,
|
|
|
|
EDGE_TOP_RIGHT,
|
|
|
|
EDGE_TOP_FRONT,
|
|
|
|
EDGE_TOP_LEFT,
|
|
|
|
|
|
|
|
EDGE_COUNT
|
|
|
|
};
|
|
|
|
|
|
|
|
// Index convention used in some lookup tables
|
|
|
|
enum Corner {
|
|
|
|
CORNER_BOTTOM_BACK_LEFT = 0,
|
|
|
|
CORNER_BOTTOM_BACK_RIGHT,
|
|
|
|
CORNER_BOTTOM_FRONT_RIGHT,
|
|
|
|
CORNER_BOTTOM_FRONT_LEFT,
|
|
|
|
CORNER_TOP_BACK_LEFT,
|
|
|
|
CORNER_TOP_BACK_RIGHT,
|
|
|
|
CORNER_TOP_FRONT_RIGHT,
|
|
|
|
CORNER_TOP_FRONT_LEFT,
|
|
|
|
|
|
|
|
CORNER_COUNT
|
|
|
|
};
|
2017-08-19 12:10:31 -07:00
|
|
|
|
2022-02-13 16:11:41 -08:00
|
|
|
extern const Vector3f g_corner_position[CORNER_COUNT];
|
2017-08-19 12:10:31 -07:00
|
|
|
|
2018-09-30 11:37:39 -07:00
|
|
|
extern const int g_side_quad_triangles[SIDE_COUNT][6];
|
2017-08-19 12:10:31 -07:00
|
|
|
|
2018-10-05 15:51:55 -07:00
|
|
|
//extern const unsigned int g_side_coord[SIDE_COUNT];
|
|
|
|
//extern const unsigned int g_side_sign[SIDE_COUNT];
|
2017-08-19 12:10:31 -07:00
|
|
|
|
2018-09-30 11:37:39 -07:00
|
|
|
extern const Vector3i g_side_normals[SIDE_COUNT];
|
2021-01-22 11:18:26 -08:00
|
|
|
extern const float g_side_tangents[SIDE_COUNT][4];
|
2017-08-19 12:10:31 -07:00
|
|
|
|
2018-09-30 11:37:39 -07:00
|
|
|
extern const unsigned int g_side_corners[SIDE_COUNT][4];
|
|
|
|
extern const unsigned int g_side_edges[SIDE_COUNT][4];
|
2017-08-19 12:10:31 -07:00
|
|
|
|
|
|
|
extern const Vector3i g_corner_inormals[CORNER_COUNT];
|
|
|
|
|
|
|
|
extern const Vector3i g_edge_inormals[EDGE_COUNT];
|
|
|
|
|
|
|
|
extern const unsigned int g_edge_corners[EDGE_COUNT][2];
|
|
|
|
|
2018-09-30 11:37:39 -07:00
|
|
|
const unsigned int MOORE_NEIGHBORING_3D_COUNT = 26;
|
2018-09-24 16:53:12 -07:00
|
|
|
extern const Vector3i g_moore_neighboring_3d[MOORE_NEIGHBORING_3D_COUNT];
|
2017-08-20 06:37:07 -07:00
|
|
|
|
2020-08-29 14:09:54 -07:00
|
|
|
const unsigned int MOORE_AREA_3D_COUNT = 27;
|
|
|
|
const unsigned int MOORE_AREA_3D_CENTRAL_INDEX = 13;
|
|
|
|
extern const Vector3i g_ordered_moore_area_3d[MOORE_AREA_3D_COUNT];
|
|
|
|
|
2022-01-08 19:27:30 -08:00
|
|
|
} // namespace zylann::voxel::Cube
|
2017-08-19 12:10:31 -07:00
|
|
|
|
|
|
|
#endif // CUBE_TABLES_H
|