Skip to content

Commit

Permalink
Offset cuboid origin after scaling the cuboid. (minetest#12558)
Browse files Browse the repository at this point in the history
This avoids the problem of offset nodes with visual_scale > 1.
  • Loading branch information
x2048 committed Jul 19, 2022
1 parent d400a98 commit b270a46
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/client/content_mapblock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
Expand Down

0 comments on commit b270a46

Please sign in to comment.