]> git.lizzy.rs Git - minetest.git/blob - src/voxelalgorithms.h
2a5fc394e239a41cdc8e9f715be983c0a232a646
[minetest.git] / src / voxelalgorithms.h
1 /*
2 Minetest
3 Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20 #ifndef VOXELALGORITHMS_HEADER
21 #define VOXELALGORITHMS_HEADER
22
23 #include "voxel.h"
24 #include "mapnode.h"
25
26 namespace voxalgo
27 {
28
29 // TODO: Move unspreadLight and spreadLight from VoxelManipulator to here
30
31 void setLight(VoxelManipulator &v, VoxelArea a, u8 light,
32                 INodeDefManager *ndef);
33
34 void clearLightAndCollectSources(VoxelManipulator &v, VoxelArea a,
35                 enum LightBank bank, INodeDefManager *ndef,
36                 core::map<v3s16, bool> & light_sources,
37                 core::map<v3s16, u8> & unlight_from);
38
39 struct SunlightPropagateResult
40 {
41         bool bottom_sunlight_valid;
42
43         SunlightPropagateResult(bool bottom_sunlight_valid_):
44                 bottom_sunlight_valid(bottom_sunlight_valid_)
45         {}
46 };
47
48 SunlightPropagateResult propagateSunlight(VoxelManipulator &v, VoxelArea a,
49                 bool inexistent_top_provides_sunlight,
50                 core::map<v3s16, bool> & light_sources,
51                 INodeDefManager *ndef);
52
53 } // namespace voxalgo
54
55 #endif
56