return 0;
}
-void MapblockMeshGenerator::drawLiquidSides()
-{
+namespace {
struct LiquidFaceDesc {
v3s16 dir; // XZ
v3s16 p[2]; // XZ only; 1 means +, 0 means -
struct UV {
int u, v;
};
- static const LiquidFaceDesc base_faces[4] = {
+ static const LiquidFaceDesc liquid_base_faces[4] = {
{v3s16( 1, 0, 0), {v3s16(1, 0, 1), v3s16(1, 0, 0)}},
{v3s16(-1, 0, 0), {v3s16(0, 0, 0), v3s16(0, 0, 1)}},
{v3s16( 0, 0, 1), {v3s16(0, 0, 1), v3s16(1, 0, 1)}},
{v3s16( 0, 0, -1), {v3s16(1, 0, 0), v3s16(0, 0, 0)}},
};
- static const UV base_vertices[4] = {
+ static const UV liquid_base_vertices[4] = {
{0, 1},
{1, 1},
{1, 0},
{0, 0}
};
+}
- for (const auto &face : base_faces) {
+void MapblockMeshGenerator::drawLiquidSides()
+{
+ for (const auto &face : liquid_base_faces) {
const NeighborData &neighbor = liquid_neighbors[face.dir.Z + 1][face.dir.X + 1];
// No face between nodes of the same liquid, unless there is node
video::S3DVertex vertices[4];
for (int j = 0; j < 4; j++) {
- const UV &vertex = base_vertices[j];
+ const UV &vertex = liquid_base_vertices[j];
const v3s16 &base = face.p[vertex.u];
float v = vertex.v;
(def2.getGroup(raillike_groupname) == raillike_group));
}
-void MapblockMeshGenerator::drawRaillikeNode()
-{
- static const v3s16 direction[4] = {
+namespace {
+ static const v3s16 rail_direction[4] = {
v3s16( 0, 0, 1),
v3s16( 0, 0, -1),
v3s16(-1, 0, 0),
v3s16( 1, 0, 0),
};
- static const int slope_angle[4] = {0, 180, 90, -90};
+ static const int rail_slope_angle[4] = {0, 180, 90, -90};
enum RailTile {
straight,
int angle;
};
static const RailDesc rail_kinds[16] = {
- // +x -x -z +z
- //-------------
+ // +x -x -z +z
+ //-------------
{straight, 0}, // . . . .
{straight, 0}, // . . . +Z
{straight, 0}, // . . -Z .
{junction, 270}, // +X -X -Z .
{ cross, 0}, // +X -X -Z +Z
};
+}
+void MapblockMeshGenerator::drawRaillikeNode()
+{
raillike_group = nodedef->get(n).getGroup(raillike_groupname);
int code = 0;
int tile_index;
bool sloped = false;
for (int dir = 0; dir < 4; dir++) {
- bool rail_above = isSameRail(direction[dir] + v3s16(0, 1, 0));
+ bool rail_above = isSameRail(rail_direction[dir] + v3s16(0, 1, 0));
if (rail_above) {
sloped = true;
- angle = slope_angle[dir];
+ angle = rail_slope_angle[dir];
}
if (rail_above ||
- isSameRail(direction[dir]) ||
- isSameRail(direction[dir] + v3s16(0, -1, 0)))
+ isSameRail(rail_direction[dir]) ||
+ isSameRail(rail_direction[dir] + v3s16(0, -1, 0)))
code |= 1 << dir;
}
drawQuad(vertices);
}
-void MapblockMeshGenerator::drawNodeboxNode()
-{
- static const v3s16 tile_dirs[6] = {
+namespace {
+ static const v3s16 nodebox_tile_dirs[6] = {
v3s16(0, 1, 0),
v3s16(0, -1, 0),
v3s16(1, 0, 0),
};
// we have this order for some reason...
- static const v3s16 connection_dirs[6] = {
+ static const v3s16 nodebox_connection_dirs[6] = {
v3s16( 0, 1, 0), // top
v3s16( 0, -1, 0), // bottom
v3s16( 0, 0, -1), // front
v3s16( 0, 0, 1), // back
v3s16( 1, 0, 0), // right
};
+}
+void MapblockMeshGenerator::drawNodeboxNode()
+{
TileSpec tiles[6];
for (int face = 0; face < 6; face++) {
// Handles facedir rotation for textures
- getTile(tile_dirs[face], &tiles[face]);
+ getTile(nodebox_tile_dirs[face], &tiles[face]);
}
// locate possible neighboring nodes to connect to
- int neighbors_set = 0;
+ u8 neighbors_set = 0;
if (f->node_box.type == NODEBOX_CONNECTED) {
for (int dir = 0; dir != 6; dir++) {
- int flag = 1 << dir;
- v3s16 p2 = blockpos_nodes + p + connection_dirs[dir];
+ u8 flag = 1 << dir;
+ v3s16 p2 = blockpos_nodes + p + nodebox_connection_dirs[dir];
MapNode n2 = data->m_vmanip.getNodeNoEx(p2);
if (nodedef->nodeboxConnects(n, n2, flag))
neighbors_set |= flag;