summaryrefslogtreecommitdiff
path: root/src/content_mapblock.cpp
diff options
context:
space:
mode:
authornumber Zero <silverunicorn2011@yandex.ru>2017-03-25 21:01:27 +0300
committerparamat <mat.gregory@virginmedia.com>2017-04-01 10:08:28 +0100
commit813a9a36b22a4e2d7383622311b6f52e31a94733 (patch)
treefe449783d4d75045900ca5500215e078eefb3464 /src/content_mapblock.cpp
parent773efc19b1d05e573d5bc811c0175d192f7c12c5 (diff)
downloadminetest-813a9a36b22a4e2d7383622311b6f52e31a94733.tar.gz
minetest-813a9a36b22a4e2d7383622311b6f52e31a94733.tar.bz2
minetest-813a9a36b22a4e2d7383622311b6f52e31a94733.zip
Signlike, glasslike drawtypes: Fix inverted textures
Diffstat (limited to 'src/content_mapblock.cpp')
-rw-r--r--src/content_mapblock.cpp56
1 files changed, 28 insertions, 28 deletions
diff --git a/src/content_mapblock.cpp b/src/content_mapblock.cpp
index d18aff879..153dacf42 100644
--- a/src/content_mapblock.cpp
+++ b/src/content_mapblock.cpp
@@ -98,7 +98,7 @@ TileSpec MapblockMeshGenerator::getTile(const v3s16& direction)
void MapblockMeshGenerator::drawQuad(v3f *coords, const v3s16 &normal)
{
- static const v2f tcoords[4] = {v2f(0, 1), v2f(1, 1), v2f(1, 0), v2f(0, 0)};
+ static const v2f tcoords[4] = {v2f(0, 0), v2f(1, 0), v2f(1, 1), v2f(0, 1)};
video::S3DVertex vertices[4];
bool shade_face = !f->light_source && (normal != v3s16(0, 0, 0));
v3f normal2(normal.X, normal.Y, normal.Z);
@@ -631,22 +631,22 @@ void MapblockMeshGenerator::drawGlasslikeNode()
// Don't make face if neighbor is of same type
if (neighbor.getContent() == n.getContent())
continue;
+ // Face at Z-
v3f vertices[4] = {
- v3f(-BS / 2, -BS / 2, BS / 2),
- v3f( BS / 2, -BS / 2, BS / 2),
- v3f( BS / 2, BS / 2, BS / 2),
- v3f(-BS / 2, BS / 2, BS / 2),
+ v3f(-BS / 2, BS / 2, -BS / 2),
+ v3f( BS / 2, BS / 2, -BS / 2),
+ v3f( BS / 2, -BS / 2, -BS / 2),
+ v3f(-BS / 2, -BS / 2, -BS / 2),
};
for (int i = 0; i < 4; i++) {
- // Rotations in the g_6dirs format
switch (face) {
- case 0: vertices[i].rotateXZBy( 0); break; // Z+
- case 1: vertices[i].rotateYZBy(-90); break; // Y+
- case 2: vertices[i].rotateXZBy(-90); break; // X+
- case 3: vertices[i].rotateXZBy(180); break; // Z-
- case 4: vertices[i].rotateYZBy( 90); break; // Y-
- case 5: vertices[i].rotateXZBy( 90); break; // X-
- };
+ case D6D_ZP: vertices[i].rotateXZBy(180); break;
+ case D6D_YP: vertices[i].rotateYZBy( 90); break;
+ case D6D_XP: vertices[i].rotateXZBy( 90); break;
+ case D6D_ZN: vertices[i].rotateXZBy( 0); break;
+ case D6D_YN: vertices[i].rotateYZBy(-90); break;
+ case D6D_XN: vertices[i].rotateXZBy(-90); break;
+ }
}
drawQuad(vertices, dir);
}
@@ -797,10 +797,10 @@ void MapblockMeshGenerator::drawTorchlikeNode()
float size = BS / 2 * f->visual_scale;
v3f vertices[4] = {
- v3f(-size, -size, 0),
- v3f( size, -size, 0),
- v3f( size, size, 0),
v3f(-size, size, 0),
+ v3f( size, size, 0),
+ v3f( size, -size, 0),
+ v3f(-size, -size, 0),
};
for (int i = 0; i < 4; i++) {
switch (wall) {
@@ -845,19 +845,19 @@ void MapblockMeshGenerator::drawPlantlikeQuad(float rotation, float quad_offset,
bool offset_top_only)
{
v3f vertices[4] = {
- v3f(-scale, -BS / 2, 0),
- v3f( scale, -BS / 2, 0),
- v3f( scale, -BS / 2 + scale * 2, 0),
v3f(-scale, -BS / 2 + scale * 2, 0),
+ v3f( scale, -BS / 2 + scale * 2, 0),
+ v3f( scale, -BS / 2, 0),
+ v3f(-scale, -BS / 2, 0),
};
if (random_offset_Y) {
PseudoRandom yrng(face_num++ | p.X << 16 | p.Z << 8 | p.Y << 24);
offset.Y = BS * ((yrng.next() % 16 / 16.0) * 0.125);
}
- int offset_first_index = offset_top_only ? 2 : 0;
+ int offset_count = offset_top_only ? 2 : 4;
+ for (int i = 0; i < offset_count; i++)
+ vertices[i].Z += quad_offset;
for (int i = 0; i < 4; i++) {
- if (i >= offset_first_index)
- vertices[i].Z += quad_offset;
vertices[i].rotateXZBy(rotation + rotate_degree);
vertices[i] += offset;
}
@@ -933,10 +933,10 @@ void MapblockMeshGenerator::drawFirelikeQuad(float rotation, float opening_angle
float offset_h, float offset_v)
{
v3f vertices[4] = {
- v3f(-scale, -BS / 2, 0),
- v3f( scale, -BS / 2, 0),
- v3f( scale, -BS / 2 + scale * 2, 0),
v3f(-scale, -BS / 2 + scale * 2, 0),
+ v3f( scale, -BS / 2 + scale * 2, 0),
+ v3f( scale, -BS / 2, 0),
+ v3f(-scale, -BS / 2, 0),
};
for (int i = 0; i < 4; i++) {
vertices[i].rotateYZBy(opening_angle);
@@ -1151,10 +1151,10 @@ void MapblockMeshGenerator::drawRaillikeNode()
static const float size = BS / 2;
float y2 = sloped ? size : -size;
v3f vertices[4] = {
- v3f(-size, -size + offset, -size),
- v3f( size, -size + offset, -size),
- v3f( size, y2 + offset, size),
v3f(-size, y2 + offset, size),
+ v3f( size, y2 + offset, size),
+ v3f( size, -size + offset, -size),
+ v3f(-size, -size + offset, -size),
};
if (angle)
for (int i = 0; i < 4; i++)