3 Copyright (C) 2010-2015 kwolekr, Ryan Kwolek <kwolekr@minetest.net>
4 Copyright (C) 2010-2015 paramat, Matt Gregory
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU Lesser General Public License as published by
8 the Free Software Foundation; either version 2.1 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public License along
17 with this program; if not, write to the Free Software Foundation, Inc.,
18 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 #ifndef MAPGEN_FRACTAL_HEADER
22 #define MAPGEN_FRACTAL_HEADER
26 #define MGFRACTAL_LARGE_CAVE_DEPTH -33
30 extern FlagDesc flagdesc_mapgen_fractal[];
33 struct MapgenFractalParams : public MapgenSpecificParams {
47 NoiseParams np_seabed;
48 NoiseParams np_filler_depth;
52 MapgenFractalParams();
53 ~MapgenFractalParams() {}
55 void readParams(const Settings *settings);
56 void writeParams(Settings *settings) const;
59 class MapgenFractal : public Mapgen {
61 EmergeManager *m_emerge;
85 Noise *noise_filler_depth;
90 Noise *noise_humidity;
91 Noise *noise_heat_blend;
92 Noise *noise_humidity_blend;
95 content_t c_water_source;
96 content_t c_lava_source;
97 content_t c_desert_stone;
99 content_t c_sandstone;
102 content_t c_stair_cobble;
103 content_t c_mossycobble;
104 content_t c_sandstonebrick;
105 content_t c_stair_sandstonebrick;
107 MapgenFractal(int mapgenid, MapgenParams *params, EmergeManager *emerge);
110 virtual void makeChunk(BlockMakeData *data);
111 int getGroundLevelAtPoint(v2s16 p);
112 void calculateNoise();
113 bool getFractalAtPoint(s16 x, s16 y, s16 z);
114 s16 generateTerrain();
115 MgStoneType generateBiomes(float *heat_map, float *humidity_map);
117 void generateCaves(s16 max_stone_y);
120 struct MapgenFactoryFractal : public MapgenFactory {
121 Mapgen *createMapgen(int mgid, MapgenParams *params, EmergeManager *emerge)
123 return new MapgenFractal(mgid, params, emerge);
126 MapgenSpecificParams *createMapgenParams()
128 return new MapgenFractalParams();