summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorx2048 <codeforsmile@gmail.com>2022-07-19 10:48:00 +0200
committerGitHub <noreply@github.com>2022-07-19 10:48:00 +0200
commitb270a46e533eaec289a65440f63eb227f0872286 (patch)
treeb96a24cef1e4f4ee9b38300ed63806d0a1c494b6 /src
parentd400a98ef0408ccbd2cc4c72f8b48c3813dfce41 (diff)
downloadminetest-b270a46e533eaec289a65440f63eb227f0872286.tar.gz
minetest-b270a46e533eaec289a65440f63eb227f0872286.tar.bz2
minetest-b270a46e533eaec289a65440f63eb227f0872286.zip
Offset cuboid origin after scaling the cuboid. (#12558)
This avoids the problem of offset nodes with visual_scale > 1.
Diffstat (limited to 'src')
-rw-r--r--src/client/content_mapblock.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/client/content_mapblock.cpp b/src/client/content_mapblock.cpp
index 8675275aa..0bac5e827 100644
--- a/src/client/content_mapblock.cpp
+++ b/src/client/content_mapblock.cpp
@@ -377,10 +377,6 @@ 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);
@@ -389,11 +385,12 @@ void MapblockMeshGenerator::drawAutoLightedCuboid(aabb3f box, const f32 *txc,
box.MinEdge *= f->visual_scale;
box.MaxEdge *= f->visual_scale;
}
+ box.MinEdge += origin;
+ box.MaxEdge += origin;
if (!txc) {
generateCuboidTextureCoords(box, texture_coord_buf);
txc = texture_coord_buf;
}
-
if (!tiles) {
tiles = &tile;
tile_count = 1;