04567267f81e3a97aa924d7cf47ab8279b6f4f3e
[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 {
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
56 class BiomeManager : public GenElementManager {
57 public:
58         static const char *ELEMENT_TITLE;
59         static const size_t ELEMENT_LIMIT = 0x100;
60
61         BiomeManager(IGameDef *gamedef);
62         ~BiomeManager();
63
64         Biome *create(int btt)
65         {
66                 return new Biome;
67         }
68
69         void clear();
70
71         void calcBiomes(s16 sx, s16 sy, float *heat_map, float *humidity_map,
72                 s16 *height_map, u8 *biomeid_map);
73         Biome *getBiome(float heat, float humidity, s16 y);
74
75 private:
76         NodeResolver *m_resolver;
77 };
78
79 #endif
80