summaryrefslogtreecommitdiff
path: root/src/treegen.cpp
diff options
context:
space:
mode:
authorDániel Juhász <juhdanad@gmail.com>2016-12-10 19:02:44 +0100
committerparamat <mat.gregory@virginmedia.com>2017-03-11 02:06:18 +0000
commitab371cc93491baf0973ecc94b96c3a1fdb4abfd5 (patch)
treeea9eedcef115258714163ef3927a095847c35d7b /src/treegen.cpp
parentd785456b3fa35faf47cb972fde9e8668382c5e22 (diff)
downloadminetest-ab371cc93491baf0973ecc94b96c3a1fdb4abfd5.tar.gz
minetest-ab371cc93491baf0973ecc94b96c3a1fdb4abfd5.tar.bz2
minetest-ab371cc93491baf0973ecc94b96c3a1fdb4abfd5.zip
Light calculation: New bulk node lighting code
This commit introduces a new bulk node lighting algorithm to minimize lighting bugs during l-system tree generation, schematic placement and non-mapgen-object lua voxelmanip light calculation. If the block above the changed area is not loaded, it gets loaded to avoid lighting bugs. Light is updated as soon as write_to_map is called on a voxel manipulator, therefore update_map does nothing.
Diffstat (limited to 'src/treegen.cpp')
-rw-r--r--src/treegen.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/treegen.cpp b/src/treegen.cpp
index 4df574f34..505954e8e 100644
--- a/src/treegen.cpp
+++ b/src/treegen.cpp
@@ -25,6 +25,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "serverenvironment.h"
#include "nodedef.h"
#include "treegen.h"
+#include "voxelalgorithms.h"
namespace treegen
{
@@ -125,12 +126,8 @@ treegen::error spawn_ltree(ServerEnvironment *env, v3s16 p0,
if (e != SUCCESS)
return e;
- vmanip.blitBackAll(&modified_blocks);
+ voxalgo::blit_back_with_light(map, &vmanip, &modified_blocks);
- // update lighting
- std::map<v3s16, MapBlock*> lighting_modified_blocks;
- lighting_modified_blocks.insert(modified_blocks.begin(), modified_blocks.end());
- map->updateLighting(lighting_modified_blocks, modified_blocks);
// Send a MEET_OTHER event
MapEditEvent event;
event.type = MEET_OTHER;