aboutsummaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2022-04-24 12:26:06 +0200
committersfan5 <sfan5@live.de>2022-04-24 21:11:24 +0200
commitb55d7cd45a304a8a5b8337a3c61defb6e5c27dd9 (patch)
tree2469e3838fea90c0d4b9667e527e8fa143354e00 /src/client
parent23f981c45817664c53d70ef0d3bd5c1b46675641 (diff)
downloadminetest-b55d7cd45a304a8a5b8337a3c61defb6e5c27dd9.tar.gz
minetest-b55d7cd45a304a8a5b8337a3c61defb6e5c27dd9.tar.bz2
minetest-b55d7cd45a304a8a5b8337a3c61defb6e5c27dd9.zip
Fix worldaligned textures
As reported in #12197, b0b9732359d43325c8bd820abeb8417353365a0c introduces a regression in worldalign textures. The specific change that seems to be responsible for this issue is the change in order between the computation of the cuboid texture coordinates and the box edge correction. Fix #12197 by moving the box edge correction back to before the cuboid texture coordinates, as it used to be.
Diffstat (limited to 'src/client')
-rw-r--r--src/client/content_mapblock.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/client/content_mapblock.cpp b/src/client/content_mapblock.cpp
index 947793ed0..b13ae86f4 100644
--- a/src/client/content_mapblock.cpp
+++ b/src/client/content_mapblock.cpp
@@ -373,6 +373,10 @@ void MapblockMeshGenerator::drawAutoLightedCuboid(aabb3f box, const f32 *txc,
f32 dx2 = box.MaxEdge.X;
f32 dy2 = box.MaxEdge.Y;
f32 dz2 = box.MaxEdge.Z;
+
+ box.MinEdge += origin;
+ box.MaxEdge += origin;
+
if (scale) {
if (!txc) { // generate texture coords before scaling
generateCuboidTextureCoords(box, texture_coord_buf);
@@ -385,8 +389,7 @@ void MapblockMeshGenerator::drawAutoLightedCuboid(aabb3f box, const f32 *txc,
generateCuboidTextureCoords(box, texture_coord_buf);
txc = texture_coord_buf;
}
- box.MinEdge += origin;
- box.MaxEdge += origin;
+
if (!tiles) {
tiles = &tile;
tile_count = 1;