Biome API: Add biome-specific river water
[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_NORMAL,
30         BIOME_LIQUID,
31         BIOME_NETHER,
32         BIOME_AETHER,
33         BIOME_FLAT
34 };
35
36 class Biome : public ObjDef, 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_top;
44         content_t c_water;
45         content_t c_river_water;
46         content_t c_dust;
47
48         s16 depth_top;
49         s16 depth_filler;
50         s16 depth_water_top;
51
52         s16 y_min;
53         s16 y_max;
54         float heat_point;
55         float humidity_point;
56
57         virtual void resolveNodeNames();
58 };
59
60 class BiomeManager : public ObjDefManager {
61 public:
62         static const char *OBJECT_TITLE;
63
64         BiomeManager(IGameDef *gamedef);
65         virtual ~BiomeManager();
66
67         const char *getObjectTitle() const
68         {
69                 return "biome";
70         }
71
72         static Biome *create(BiomeType type)
73         {
74                 return new Biome;
75         }
76
77         virtual void clear();
78
79         void calcBiomes(s16 sx, s16 sy, float *heat_map, float *humidity_map,
80                 s16 *height_map, u8 *biomeid_map);
81         Biome *getBiome(float heat, float humidity, s16 y);
82
83 private:
84         IGameDef *m_gamedef;
85 };
86
87 #endif
88