summaryrefslogtreecommitdiff
path: root/src/mapgen.cpp
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2012-01-27 14:10:10 +0200
committerPerttu Ahola <celeron55@gmail.com>2012-03-27 19:01:51 +0300
commit8cb7badd632200e06004577f351b9c845c174e29 (patch)
treee1bcb0aa60d385cbacdecef392bbcea4fb9516a9 /src/mapgen.cpp
parent0f3c2f65414f332fad510fb8651dd59d506aad2e (diff)
downloadminetest-8cb7badd632200e06004577f351b9c845c174e29.tar.gz
minetest-8cb7badd632200e06004577f351b9c845c174e29.tar.bz2
minetest-8cb7badd632200e06004577f351b9c845c174e29.zip
Do post-mapgen lighting using the VoxelManipulator-based functions (causes glitches currently)
Diffstat (limited to 'src/mapgen.cpp')
-rw-r--r--src/mapgen.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/mapgen.cpp b/src/mapgen.cpp
index 25fa427aa..0ce211f30 100644
--- a/src/mapgen.cpp
+++ b/src/mapgen.cpp
@@ -27,6 +27,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "nodedef.h"
#include "content_mapnode.h" // For content_mapnode_get_new_name
#include "voxelalgorithms.h"
+#include "profiler.h"
+#include "main.h" // For g_profiler
namespace mapgen
{
@@ -2339,7 +2341,33 @@ void make_block(BlockMakeData *data)
/*
Calculate lighting
*/
+ {
+ ScopeProfiler sp(g_profiler, "EmergeThread: mapgen lighting update",
+ SPT_AVG);
+ VoxelArea a(node_min, node_max);
+ enum LightBank banks[2] = {LIGHTBANK_DAY, LIGHTBANK_NIGHT};
+ for(int i=0; i<2; i++)
+ {
+ enum LightBank bank = banks[i];
+
+ core::map<v3s16, bool> light_sources;
+ core::map<v3s16, u8> unlight_from;
+
+ voxalgo::clearLightAndCollectSources(vmanip, a, bank, ndef,
+ light_sources, unlight_from);
+
+ // TODO: Get this from elsewhere
+ bool inexistent_top_provides_sunlight = true;
+ voxalgo::SunlightPropagateResult res = voxalgo::propagateSunlight(
+ vmanip, a, inexistent_top_provides_sunlight,
+ light_sources, ndef);
+ // TODO: Do stuff according to bottom_sunlight_valid
+
+ vmanip.unspreadLight(bank, unlight_from, light_sources, ndef);
+ vmanip.spreadLight(bank, light_sources, ndef);
+ }
+ }
}
BlockMakeData::BlockMakeData():