summaryrefslogtreecommitdiff
path: root/src/mapblock.cpp
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2010-12-26 14:34:34 +0200
committerPerttu Ahola <celeron55@gmail.com>2010-12-26 14:34:34 +0200
commit847a4227b850bc943d11c5b8191fb6bcbce1920a (patch)
tree1a8d1eb93cb63f89a7a669d5bc3c3d7ccfcb9135 /src/mapblock.cpp
parentc32da52104cc6bbe8ed0bf1ba1a7874f015cb738 (diff)
downloadminetest-847a4227b850bc943d11c5b8191fb6bcbce1920a.tar.gz
minetest-847a4227b850bc943d11c5b8191fb6bcbce1920a.tar.bz2
minetest-847a4227b850bc943d11c5b8191fb6bcbce1920a.zip
better grass generation (integration to sunlight propagation algorithms)
Diffstat (limited to 'src/mapblock.cpp')
-rw-r--r--src/mapblock.cpp23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/mapblock.cpp b/src/mapblock.cpp
index 60efa2fcf..202877322 100644
--- a/src/mapblock.cpp
+++ b/src/mapblock.cpp
@@ -860,7 +860,9 @@ void MapBlock::updateMesh(u32 daynight_ratio)
is_underground is set.
At the moment, all sunlighted nodes are added to light_sources.
- TODO: This could be optimized.
+ - SUGG: This could be optimized
+
+ Turns sunglighted mud into grass.
*/
bool MapBlock::propagateSunlight(core::map<v3s16, bool> & light_sources)
{
@@ -880,10 +882,6 @@ bool MapBlock::propagateSunlight(core::map<v3s16, bool> & light_sources)
MapNode n = getNodeParent(v3s16(x, MAP_BLOCKSIZE, z));
if(n.getLight(LIGHTBANK_DAY) != LIGHT_SUN)
{
- /*if(is_underground)
- {
- no_sunlight = true;
- }*/
no_sunlight = true;
}
}
@@ -891,15 +889,14 @@ bool MapBlock::propagateSunlight(core::map<v3s16, bool> & light_sources)
{
no_top_block = true;
- // TODO: This makes over-ground roofed places sunlighted
+ // NOTE: This makes over-ground roofed places sunlighted
// Assume sunlight, unless is_underground==true
if(is_underground)
{
no_sunlight = true;
}
- // TODO: There has to be some way to allow this behaviour
- // As of now, it just makes everything dark.
+ // NOTE: As of now, it just would make everything dark.
// No sunlight here
//no_sunlight = true;
}
@@ -928,7 +925,15 @@ bool MapBlock::propagateSunlight(core::map<v3s16, bool> & light_sources)
light_sources.insert(pos_relative + pos, true);
}
- else{
+ else
+ {
+ // Turn mud into grass
+ if(n.d == CONTENT_MUD)
+ {
+ n.d = CONTENT_GRASS;
+ }
+
+ // Sunlight goes no further
break;
}
}