diff options
author | Vitaliy <numzer0@yandex.ru> | 2020-06-06 23:25:18 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-06 22:25:18 +0200 |
commit | e746607d0f8531e3a8b12cc45294aecf36217b17 (patch) | |
tree | 9f14362bb55c0e167a12f03b2e2803f04c60cf93 /src/client | |
parent | 36099ba947e6a54429c9fdd45ef1fc6dcc86389b (diff) | |
download | minetest-e746607d0f8531e3a8b12cc45294aecf36217b17.tar.gz minetest-e746607d0f8531e3a8b12cc45294aecf36217b17.tar.bz2 minetest-e746607d0f8531e3a8b12cc45294aecf36217b17.zip |
Restore visual_scale support for nodeboxes (and allfaces) (#9906)
Diffstat (limited to 'src/client')
-rw-r--r-- | src/client/content_mapblock.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/client/content_mapblock.cpp b/src/client/content_mapblock.cpp index 50efd2e40..f7d20001f 100644 --- a/src/client/content_mapblock.cpp +++ b/src/client/content_mapblock.cpp @@ -366,6 +366,7 @@ void MapblockMeshGenerator::generateCuboidTextureCoords(const aabb3f &box, f32 * void MapblockMeshGenerator::drawAutoLightedCuboid(aabb3f box, const f32 *txc, TileSpec *tiles, int tile_count) { + bool scale = std::fabs(f->visual_scale - 1.0f) > 1e-3f; f32 texture_coord_buf[24]; f32 dx1 = box.MinEdge.X; f32 dy1 = box.MinEdge.Y; @@ -373,6 +374,14 @@ void MapblockMeshGenerator::drawAutoLightedCuboid(aabb3f box, const f32 *txc, f32 dx2 = box.MaxEdge.X; f32 dy2 = box.MaxEdge.Y; f32 dz2 = box.MaxEdge.Z; + if (scale) { + if (!txc) { // generate texture coords before scaling + generateCuboidTextureCoords(box, texture_coord_buf); + txc = texture_coord_buf; + } + box.MinEdge *= f->visual_scale; + box.MaxEdge *= f->visual_scale; + } box.MinEdge += origin; box.MaxEdge += origin; if (!txc) { @@ -1323,7 +1332,7 @@ void MapblockMeshGenerator::drawNodeboxNode() std::vector<aabb3f> boxes; n.getNodeBoxes(nodedef, &boxes, neighbors_set); - for (const auto &box : boxes) + for (auto &box : boxes) drawAutoLightedCuboid(box, nullptr, tiles, 6); } |