]> git.lizzy.rs Git - minetest.git/blobdiff - src/mapblock_mesh.cpp
Do not allow the m_transforming_liquid queue to increase until all RAM is consumed
[minetest.git] / src / mapblock_mesh.cpp
index e4c561a64d9187c75c789e576bc507e78fcca99e..29b0e92f5855a117f3a113d3536bebd53aed5d48 100644 (file)
@@ -259,8 +259,8 @@ static u16 getSmoothLightCombined(v3s16 p, MeshMakeData *data)
                        light_source_max = f.light_source;
                // Check f.solidness because fast-style leaves look better this way
                if (f.param_type == CPT_LIGHT && f.solidness != 2) {
-                       light_day += decode_light(n.getLight(LIGHTBANK_DAY, ndef));
-                       light_night += decode_light(n.getLight(LIGHTBANK_NIGHT, ndef));
+                       light_day += decode_light(n.getLightNoChecks(LIGHTBANK_DAY, &f));
+                       light_night += decode_light(n.getLightNoChecks(LIGHTBANK_NIGHT, &f));
                        light_count++;
                } else {
                        ambient_occlusion++;
@@ -1162,12 +1162,16 @@ MapBlockMesh::MapBlockMesh(MeshMakeData *data, v3s16 camera_offset):
                                        applyFacesShading (vc, 0.836660);
                                }
                        }
-                       // - Classic lighting
-                       // Set initial real color and store for later updates
-                       u8 day = vc.getRed();
-                       u8 night = vc.getGreen();
-                       finalColorBlend(vc, day, night, 1000);
-                       m_daynight_diffs[i][j] = std::make_pair(day, night);
+                       if(!m_enable_shaders)
+                       {
+                               // - Classic lighting (shaders handle this by themselves)
+                               // Set initial real color and store for later updates
+                               u8 day = vc.getRed();
+                               u8 night = vc.getGreen();
+                               finalColorBlend(vc, day, night, 1000);
+                               if(day != night)
+                                       m_daynight_diffs[i][j] = std::make_pair(day, night);
+                       }
                }
 
                // Create material
@@ -1331,7 +1335,7 @@ bool MapBlockMesh::animate(bool faraway, float time, int crack, u32 daynight_rat
        }
 
        // Day-night transition
-       if(daynight_ratio != m_last_daynight_ratio)
+       if(!m_enable_shaders && (daynight_ratio != m_last_daynight_ratio))
        {
                for(std::map<u32, std::map<u32, std::pair<u8, u8> > >::iterator
                                i = m_daynight_diffs.begin();