]> git.lizzy.rs Git - minetest.git/blobdiff - src/nodedef.cpp
Minimap: Optimise
[minetest.git] / src / nodedef.cpp
index 98f795c7a79c9129ba9abe4687f7fc3b75fb9dc2..c717b62b9fe4462e3ad694052fc303db164b9ba2 100644 (file)
@@ -269,10 +269,15 @@ void TextureSettings::readSettings()
        bool enable_shaders            = g_settings->getBool("enable_shaders");
        bool enable_bumpmapping        = g_settings->getBool("enable_bumpmapping");
        bool enable_parallax_occlusion = g_settings->getBool("enable_parallax_occlusion");
+       bool smooth_lighting           = g_settings->getBool("smooth_lighting");
        enable_mesh_cache              = g_settings->getBool("enable_mesh_cache");
        enable_minimap                 = g_settings->getBool("enable_minimap");
        std::string leaves_style_str   = g_settings->get("leaves_style");
 
+       // Mesh cache is not supported in combination with smooth lighting
+       if (smooth_lighting)
+               enable_mesh_cache = false;
+
        use_normal_texture = enable_shaders &&
                (enable_bumpmapping || enable_parallax_occlusion);
        if (leaves_style_str == "fancy") {
@@ -1606,6 +1611,10 @@ void ContentFeatures::serializeOld(std::ostream &os, u16 protocol_version) const
                        compatible_param_type_2 = CPT2_WALLMOUNTED;
        }
 
+       float compatible_visual_scale = visual_scale;
+       if (protocol_version < 30 && drawtype == NDT_PLANTLIKE)
+               compatible_visual_scale = sqrt(visual_scale);
+
        if (protocol_version == 13)
        {
                writeU8(os, 5); // version
@@ -1617,7 +1626,7 @@ void ContentFeatures::serializeOld(std::ostream &os, u16 protocol_version) const
                        writeS16(os, i->second);
                }
                writeU8(os, drawtype);
-               writeF1000(os, visual_scale);
+               writeF1000(os, compatible_visual_scale);
                writeU8(os, 6);
                for (u32 i = 0; i < 6; i++)
                        tiledef[i].serialize(os, protocol_version);
@@ -1665,7 +1674,7 @@ void ContentFeatures::serializeOld(std::ostream &os, u16 protocol_version) const
                        writeS16(os, i->second);
                }
                writeU8(os, drawtype);
-               writeF1000(os, visual_scale);
+               writeF1000(os, compatible_visual_scale);
                writeU8(os, 6);
                for (u32 i = 0; i < 6; i++)
                        tiledef[i].serialize(os, protocol_version);
@@ -1719,7 +1728,7 @@ void ContentFeatures::serializeOld(std::ostream &os, u16 protocol_version) const
                        writeS16(os, i->second);
                }
                writeU8(os, drawtype);
-               writeF1000(os, visual_scale);
+               writeF1000(os, compatible_visual_scale);
                writeU8(os, 6);
                for (u32 i = 0; i < 6; i++)
                        tiledef[i].serialize(os, protocol_version);