From c071efaa43ad3dcba7d60a7a67e942aae2a7dc83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1niel=20Juh=C3=A1sz?= Date: Thu, 20 Oct 2016 21:41:38 +0200 Subject: Improved lighting This commit rewrites the procedure that is responsible for light updating. this commit -provides iterative solutions for unlighting and light spreading -introduces a new priority queue-like container for the iteration -creates per-node MapBlock caching to reduce retrieving MapBlocks from the map -calculates with map block positions and in-block relative node coordinates -skips light updating if it is not necessary since the node's new light will be the same as its old light was --- src/voxelalgorithms.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/voxelalgorithms.h') diff --git a/src/voxelalgorithms.h b/src/voxelalgorithms.h index 2eba6a176..f2b2fde32 100644 --- a/src/voxelalgorithms.h +++ b/src/voxelalgorithms.h @@ -25,6 +25,9 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include +class Map; +class MapBlock; + namespace voxalgo { @@ -52,6 +55,23 @@ SunlightPropagateResult propagateSunlight(VoxelManipulator &v, VoxelArea a, std::set & light_sources, INodeDefManager *ndef); +/*! + * Updates the lighting on the map. + * The result will be correct only if + * no nodes were changed except the given one. + * + * \param p position of the changed node + * \param oldnode this node was overwritten on the map + * \param modified_blocks output, contains all map blocks that + * the function modified + */ +void update_lighting_node( + Map *map, + INodeDefManager *ndef, + v3s16 p, + MapNode oldnode, + std::map &modified_blocks); + } // namespace voxalgo #endif -- cgit v1.2.3