X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Fclient%2Fcontent_mapblock.cpp;h=ce7235bca71e9e75e6eca93b0bcb73d0b2e69697;hb=734fb2c811cdb0c26153c2bd5b62e458343963e7;hp=f7d20001f41d33eb3c494d31c225260efd2a71e4;hpb=e746607d0f8531e3a8b12cc45294aecf36217b17;p=minetest.git diff --git a/src/client/content_mapblock.cpp b/src/client/content_mapblock.cpp index f7d20001f..ce7235bca 100644 --- a/src/client/content_mapblock.cpp +++ b/src/client/content_mapblock.cpp @@ -17,6 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#include #include "content_mapblock.h" #include "util/numeric.h" #include "util/directiontables.h" @@ -512,10 +513,10 @@ f32 MapblockMeshGenerator::getCornerLevel(int i, int k) count++; } else if (content == CONTENT_AIR) { air_count++; - if (air_count >= 2) - return -0.5 * BS + 0.2; } } + if (air_count >= 2) + return -0.5 * BS + 0.2; if (count > 0) return sum / count; return 0; @@ -722,7 +723,8 @@ void MapblockMeshGenerator::drawGlasslikeFramedNode() for (auto &glass_tile : glass_tiles) glass_tile = tiles[4]; - u8 param2 = n.getParam2(); + // Only respect H/V merge bits when paramtype2 = "glasslikeliquidlevel" (liquid tank) + u8 param2 = (f->param_type_2 == CPT2_GLASSLIKE_LIQUID_LEVEL) ? n.getParam2() : 0; bool H_merge = !(param2 & 128); bool V_merge = !(param2 & 64); param2 &= 63; @@ -966,7 +968,7 @@ void MapblockMeshGenerator::drawPlantlike() draw_style = PLANT_STYLE_CROSS; scale = BS / 2 * f->visual_scale; offset = v3f(0, 0, 0); - rotate_degree = 0; + rotate_degree = 0.0f; random_offset_Y = false; face_num = 0; plant_height = 1.0; @@ -986,7 +988,8 @@ void MapblockMeshGenerator::drawPlantlike() break; case CPT2_DEGROTATE: - rotate_degree = n.param2 * 2; + case CPT2_COLORED_DEGROTATE: + rotate_degree = 1.5f * n.getDegRotate(nodedef); break; case CPT2_LEVELED: @@ -1341,6 +1344,7 @@ void MapblockMeshGenerator::drawMeshNode() u8 facedir = 0; scene::IMesh* mesh; bool private_mesh; // as a grab/drop pair is not thread-safe + int degrotate = 0; if (f->param_type_2 == CPT2_FACEDIR || f->param_type_2 == CPT2_COLORED_FACEDIR) { @@ -1352,9 +1356,12 @@ void MapblockMeshGenerator::drawMeshNode() facedir = n.getWallMounted(nodedef); if (!enable_mesh_cache) facedir = wallmounted_to_facedir[facedir]; + } else if (f->param_type_2 == CPT2_DEGROTATE || + f->param_type_2 == CPT2_COLORED_DEGROTATE) { + degrotate = n.getDegRotate(nodedef); } - if (!data->m_smooth_lighting && f->mesh_ptr[facedir]) { + if (!data->m_smooth_lighting && f->mesh_ptr[facedir] && !degrotate) { // use cached meshes private_mesh = false; mesh = f->mesh_ptr[facedir]; @@ -1362,7 +1369,10 @@ void MapblockMeshGenerator::drawMeshNode() // no cache, clone and rotate mesh private_mesh = true; mesh = cloneMesh(f->mesh_ptr[0]); - rotateMeshBy6dFacedir(mesh, facedir); + if (facedir) + rotateMeshBy6dFacedir(mesh, facedir); + else if (degrotate) + rotateMeshXZby(mesh, 1.5f * degrotate); recalculateBoundingBox(mesh); meshmanip->recalculateNormals(mesh, true, false); } else @@ -1453,10 +1463,10 @@ void MapblockMeshGenerator::generate() } } -void MapblockMeshGenerator::renderSingle(content_t node) +void MapblockMeshGenerator::renderSingle(content_t node, u8 param2) { p = {0, 0, 0}; - n = MapNode(node, 0xff, 0x00); + n = MapNode(node, 0xff, param2); f = &nodedef->get(n); drawNode(); }