LuaVoxelManip: Add option to allocate blank data
[oweals/minetest.git] / src / mg_biome.h
1 /*
2 Minetest
3 Copyright (C) 2010-2013 kwolekr, Ryan Kwolek <kwolekr@minetest.net>
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 MG_BIOME_HEADER
21 #define MG_BIOME_HEADER
22
23 #include "mapgen.h"
24
25 struct NoiseParams;
26
27 enum BiomeType
28 {
29         BIOME_TYPE_NORMAL,
30         BIOME_TYPE_LIQUID,
31         BIOME_TYPE_NETHER,
32         BIOME_TYPE_AETHER,
33         BIOME_TYPE_FLAT
34 };
35
36 class Biome : public GenElement, public NodeResolver {
37 public:
38         u32 flags;
39
40         content_t c_top;
41         content_t c_filler;
42         content_t c_stone;
43         content_t c_water;
44         content_t c_dust;
45         content_t c_dust_water;
46
47         s16 depth_top;
48         s16 depth_filler;
49
50         s16 height_min;
51         s16 height_max;
52         float heat_point;
53         float humidity_point;
54
55         virtual void resolveNodeNames(NodeResolveInfo *nri);
56 };
57
58 class BiomeManager : public GenElementManager {
59 public:
60         static const char *ELEMENT_TITLE;
61         static const size_t ELEMENT_LIMIT = 0x100;
62
63         BiomeManager(IGameDef *gamedef);
64         ~BiomeManager();
65
66         Biome *create(int btt)
67         {
68                 return new Biome;
69         }
70
71         void clear();
72
73         void calcBiomes(s16 sx, s16 sy, float *heat_map, float *humidity_map,
74                 s16 *height_map, u8 *biomeid_map);
75         Biome *getBiome(float heat, float humidity, s16 y);
76 };
77
78 #endif
79