diff options
author | Perttu Ahola <celeron55@gmail.com> | 2011-04-23 16:01:32 +0300 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2011-04-23 16:01:32 +0300 |
commit | bda468124249acac7f5de884c31946ce66bf0fda (patch) | |
tree | 9751e158b87c986c985ad935715b2c85ac9bd096 /src | |
parent | bbe47f845b887899065f6daca4cd16060d80553f (diff) | |
download | minetest-bda468124249acac7f5de884c31946ce66bf0fda.tar.gz minetest-bda468124249acac7f5de884c31946ce66bf0fda.tar.bz2 minetest-bda468124249acac7f5de884c31946ce66bf0fda.zip |
fixed flowing water lighting when it is below a solid block
Diffstat (limited to 'src')
-rw-r--r-- | src/mapblock.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/mapblock.cpp b/src/mapblock.cpp index 6f7e7533e..6cf816dbe 100644 --- a/src/mapblock.cpp +++ b/src/mapblock.cpp @@ -851,11 +851,17 @@ scene::SMesh* makeMapBlockMesh(MeshMakeData *data) else if(n.d == CONTENT_WATER) { bool top_is_water = false; - MapNode n = data->m_vmanip.getNodeNoEx(blockpos_nodes + v3s16(x,y+1,z)); - if(n.d == CONTENT_WATER || n.d == CONTENT_WATERSOURCE) + MapNode ntop = data->m_vmanip.getNodeNoEx(blockpos_nodes + v3s16(x,y+1,z)); + if(ntop.d == CONTENT_WATER || ntop.d == CONTENT_WATERSOURCE) top_is_water = true; - u8 l = decode_light(n.getLightBlend(data->m_daynight_ratio)); + u8 l = 0; + // Use the light of the node on top if possible + if(content_features(ntop.d).param_type == CPT_LIGHT) + l = decode_light(ntop.getLightBlend(data->m_daynight_ratio)); + // Otherwise use the light of this node (the water) + else + l = decode_light(n.getLightBlend(data->m_daynight_ratio)); video::SColor c(WATER_ALPHA,l,l,l); // Neighbor water levels (key = relative position) |