summaryrefslogtreecommitdiff
path: root/src/mg_schematic.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/mg_schematic.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/mg_schematic.cpp')
-rw-r--r--src/mg_schematic.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/mg_schematic.cpp b/src/mg_schematic.cpp
index 3d08d86fa..92e138df4 100644
--- a/src/mg_schematic.cpp
+++ b/src/mg_schematic.cpp
@@ -30,6 +30,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "util/serialize.h"
#include "serialization.h"
#include "filesys.h"
+#include "voxelalgorithms.h"
///////////////////////////////////////////////////////////////////////////////
@@ -202,7 +203,7 @@ bool Schematic::placeOnVManip(MMVManip *vm, v3s16 p, u32 flags,
return vm->m_area.contains(VoxelArea(p, p + s - v3s16(1,1,1)));
}
-void Schematic::placeOnMap(Map *map, v3s16 p, u32 flags,
+void Schematic::placeOnMap(ServerMap *map, v3s16 p, u32 flags,
Rotation rot, bool force_place)
{
std::map<v3s16, MapBlock *> lighting_modified_blocks;
@@ -238,15 +239,10 @@ void Schematic::placeOnMap(Map *map, v3s16 p, u32 flags,
blitToVManip(&vm, p, rot, force_place);
- vm.blitBackAll(&modified_blocks);
+ voxalgo::blit_back_with_light(map, &vm, &modified_blocks);
//// Carry out post-map-modification actions
- //// Update lighting
- // TODO: Optimize this by using Mapgen::calcLighting() instead
- lighting_modified_blocks.insert(modified_blocks.begin(), modified_blocks.end());
- map->updateLighting(lighting_modified_blocks, modified_blocks);
-
//// Create & dispatch map modification events to observers
MapEditEvent event;
event.type = MEET_OTHER;