]> git.lizzy.rs Git - dragonfireclient.git/blob - src/mapgen_fractal.h
Put ChatEvent handler into own function
[dragonfireclient.git] / src / mapgen_fractal.h
1 /*
2 Minetest
3 Copyright (C) 2010-2015 kwolekr, Ryan Kwolek <kwolekr@minetest.net>
4 Copyright (C) 2010-2015 paramat, Matt Gregory
5
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.
10
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.
15
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.
19 */
20
21 #ifndef MAPGEN_FRACTAL_HEADER
22 #define MAPGEN_FRACTAL_HEADER
23
24 #include "mapgen.h"
25
26 #define MGFRACTAL_LARGE_CAVE_DEPTH -32
27
28 /////////////////// Mapgen Fractal flags
29 #define MGFRACTAL_JULIA 0x01
30
31 class BiomeManager;
32
33 extern FlagDesc flagdesc_mapgen_fractal[];
34
35
36 struct MapgenFractalParams : public MapgenSpecificParams {
37         u32 spflags;
38
39         u16 m_iterations;
40         v3f m_scale;
41         v3f m_offset;
42         float m_slice_w;
43
44         u16 j_iterations;
45         v3f j_scale;
46         v3f j_offset;
47         float j_slice_w;
48         float julia_x;
49         float julia_y;
50         float julia_z;
51         float julia_w;
52
53         NoiseParams np_seabed;
54         NoiseParams np_filler_depth;
55         NoiseParams np_cave1;
56         NoiseParams np_cave2;
57
58         MapgenFractalParams();
59         ~MapgenFractalParams() {}
60
61         void readParams(const Settings *settings);
62         void writeParams(Settings *settings) const;
63 };
64
65 class MapgenFractal : public Mapgen {
66 public:
67         EmergeManager *m_emerge;
68         BiomeManager *bmgr;
69
70         int ystride;
71         int zstride;
72         u32 spflags;
73
74         v3s16 node_min;
75         v3s16 node_max;
76         v3s16 full_node_min;
77         v3s16 full_node_max;
78
79         u16 m_iterations;
80         v3f m_scale;
81         v3f m_offset;
82         float m_slice_w;
83
84         u16 j_iterations;
85         v3f j_scale;
86         v3f j_offset;
87         float j_slice_w;
88         float julia_x;
89         float julia_y;
90         float julia_z;
91         float julia_w;
92
93         Noise *noise_seabed;
94         Noise *noise_filler_depth;
95         Noise *noise_cave1;
96         Noise *noise_cave2;
97
98         Noise *noise_heat;
99         Noise *noise_humidity;
100         Noise *noise_heat_blend;
101         Noise *noise_humidity_blend;
102
103         content_t c_stone;
104         content_t c_water_source;
105         content_t c_lava_source;
106         content_t c_desert_stone;
107         content_t c_ice;
108         content_t c_sandstone;
109
110         content_t c_cobble;
111         content_t c_stair_cobble;
112         content_t c_mossycobble;
113         content_t c_sandstonebrick;
114         content_t c_stair_sandstonebrick;
115
116         MapgenFractal(int mapgenid, MapgenParams *params, EmergeManager *emerge);
117         ~MapgenFractal();
118
119         virtual void makeChunk(BlockMakeData *data);
120         int getGroundLevelAtPoint(v2s16 p);
121         void calculateNoise();
122         bool getFractalAtPoint(s16 x, s16 y, s16 z);
123         s16 generateTerrain();
124         MgStoneType generateBiomes(float *heat_map, float *humidity_map);
125         void dustTopNodes();
126         void generateCaves(s16 max_stone_y);
127 };
128
129 struct MapgenFactoryFractal : public MapgenFactory {
130         Mapgen *createMapgen(int mgid, MapgenParams *params, EmergeManager *emerge)
131         {
132                 return new MapgenFractal(mgid, params, emerge);
133         };
134
135         MapgenSpecificParams *createMapgenParams()
136         {
137                 return new MapgenFractalParams();
138         };
139 };
140
141 #endif