The new mapgen, noise functions, et al.
[oweals/minetest.git] / src / biome.h
1 /*
2 Minetest-c55
3 Copyright (C) 2010-2011 kwolekr, Ryan Kwolek <kwolekr2@cs.scranton.edu>
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 BIOME_HEADER
21 #define BIOME_HEADER
22
23 #include "nodedef.h"
24 #include "gamedef.h"
25 #include "mapnode.h"
26 #include "noise.h"
27 #include "mapgen.h"
28
29 class Biome {
30 public:
31         MapNode n_top;
32         MapNode n_filler;
33         s16 ntopnodes;
34         s16 flags;
35         s16 height_min;
36         s16 height_max;
37         float heat_min;
38         float heat_max;
39         float humidity_min;
40         float humidity_max;
41         const char *name;
42         NoiseParams *np;
43
44         virtual void genColumn(Mapgen *mg, int x, int z, int y1, int y2);
45         virtual int getSurfaceHeight(float noise_terrain);
46 };
47
48 class BiomeOcean : public Biome {
49         virtual void genColumn(Mapgen *mg, int x, int z, int y1, int y2);
50 };
51
52 class BiomeHell : public Biome {
53         virtual void genColumn(Mapgen *mg, int x, int z, int y1, int y2);
54         virtual int getSurfaceHeight(float noise_terrain);
55 };
56
57 class BiomeSuperflat : public Biome {
58         virtual void genColumn(Mapgen *mg, int x, int z, int y1, int y2);
59         virtual int getSurfaceHeight(float noise_terrain);
60 };
61
62 class BiomeDefManager {
63 public:
64         std::vector<float> bgroup_freqs;
65         std::vector<std::vector<Biome *> *> bgroups;
66         Biome *biome_default;
67         IGameDef *m_gamedef;
68         INodeDefManager *ndef;
69
70         BiomeDefManager(IGameDef *gamedef);
71         ~BiomeDefManager();
72
73         Biome *getBiome(float bgfreq, float heat, float humidity);
74
75         void addBiome();
76         void addDefaultBiomes();
77 };
78
79 #endif