]> git.lizzy.rs Git - dragonfireclient.git/blob - src/mg_biome.h
Biome API: Add shore top and shore filler nodes, underwater node, water top node...
[dragonfireclient.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_shore_top;
43         content_t c_shore_filler;
44         content_t c_underwater;
45         content_t c_stone;
46         content_t c_water_top;
47         content_t c_water;
48         content_t c_dust;
49
50         s16 depth_top;
51         s16 depth_filler;
52         s16 height_shore;
53         s16 depth_water_top;
54
55         s16 height_min;
56         s16 height_max;
57         float heat_point;
58         float humidity_point;
59
60         virtual void resolveNodeNames(NodeResolveInfo *nri);
61 };
62
63 class BiomeManager : public GenElementManager {
64 public:
65         static const char *ELEMENT_TITLE;
66         static const size_t ELEMENT_LIMIT = 0x100;
67
68         BiomeManager(IGameDef *gamedef);
69         ~BiomeManager();
70
71         Biome *create(int btt)
72         {
73                 return new Biome;
74         }
75
76         void clear();
77
78         void calcBiomes(s16 sx, s16 sy, float *heat_map, float *humidity_map,
79                 s16 *height_map, u8 *biomeid_map);
80         Biome *getBiome(float heat, float humidity, s16 y);
81 };
82
83 #endif
84