cleanup
[waspsaliva.git] / src / mapgen / mapgen_fractal.h
blob23af925bccf799a134a4f9eb53dc9ebb7fdc4adb
1 /*
2 Minetest
3 Copyright (C) 2015-2019 paramat
4 Copyright (C) 2015-2016 kwolekr, Ryan Kwolek
6 Fractal formulas from http://www.bugman123.com/Hypercomplex/index.html
7 by Paul Nylander, and from http://www.fractalforums.com, thank you.
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU Lesser General Public License as published by
11 the Free Software Foundation; either version 2.1 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU Lesser General Public License for more details.
19 You should have received a copy of the GNU Lesser General Public License along
20 with this program; if not, write to the Free Software Foundation, Inc.,
21 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 #pragma once
26 #include "mapgen.h"
28 ///////////// Mapgen Fractal flags
29 #define MGFRACTAL_TERRAIN 0x01
31 class BiomeManager;
33 extern FlagDesc flagdesc_mapgen_fractal[];
36 struct MapgenFractalParams : public MapgenParams
38 float cave_width = 0.09f;
39 s16 large_cave_depth = -33;
40 u16 small_cave_num_min = 0;
41 u16 small_cave_num_max = 0;
42 u16 large_cave_num_min = 0;
43 u16 large_cave_num_max = 2;
44 float large_cave_flooded = 0.5f;
45 s16 dungeon_ymin = -31000;
46 s16 dungeon_ymax = 31000;
47 u16 fractal = 1;
48 u16 iterations = 11;
49 v3f scale = v3f(4096.0, 1024.0, 4096.0);
50 v3f offset = v3f(1.52, 0.0, 0.0);
51 float slice_w = 0.0f;
52 float julia_x = 0.267f;
53 float julia_y = 0.2f;
54 float julia_z = 0.133f;
55 float julia_w = 0.067f;
57 NoiseParams np_seabed;
58 NoiseParams np_filler_depth;
59 NoiseParams np_cave1;
60 NoiseParams np_cave2;
61 NoiseParams np_dungeons;
63 MapgenFractalParams();
64 ~MapgenFractalParams() = default;
66 void readParams(const Settings *settings);
67 void writeParams(Settings *settings) const;
68 void setDefaultSettings(Settings *settings);
72 class MapgenFractal : public MapgenBasic
74 public:
75 MapgenFractal(MapgenFractalParams *params, EmergeParams *emerge);
76 ~MapgenFractal();
78 virtual MapgenType getType() const { return MAPGEN_FRACTAL; }
80 virtual void makeChunk(BlockMakeData *data);
81 int getSpawnLevelAtPoint(v2s16 p);
82 bool getFractalAtPoint(s16 x, s16 y, s16 z);
83 s16 generateTerrain();
85 private:
86 u16 formula;
87 bool julia;
88 u16 fractal;
89 u16 iterations;
90 v3f scale;
91 v3f offset;
92 float slice_w;
93 float julia_x;
94 float julia_y;
95 float julia_z;
96 float julia_w;
97 Noise *noise_seabed = nullptr;