Minetest 5.9.0-dev
 
Loading...
Searching...
No Matches
mapgen_fractal.h
Go to the documentation of this file.
1/*
2Minetest
3Copyright (C) 2015-2019 paramat
4Copyright (C) 2015-2016 kwolekr, Ryan Kwolek
5
6Fractal formulas from http://www.bugman123.com/Hypercomplex/index.html
7by Paul Nylander, and from http://www.fractalforums.com, thank you.
8
9This program is free software; you can redistribute it and/or modify
10it under the terms of the GNU Lesser General Public License as published by
11the Free Software Foundation; either version 2.1 of the License, or
12(at your option) any later version.
13
14This program is distributed in the hope that it will be useful,
15but WITHOUT ANY WARRANTY; without even the implied warranty of
16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17GNU Lesser General Public License for more details.
18
19You should have received a copy of the GNU Lesser General Public License along
20with this program; if not, write to the Free Software Foundation, Inc.,
2151 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22*/
23
24#pragma once
25
26#include "mapgen.h"
27
29#define MGFRACTAL_TERRAIN 0x01
30
31class BiomeManager;
32
34
35
37{
38 float cave_width = 0.09f;
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;
56
62
65
66 void readParams(const Settings *settings);
67 void writeParams(Settings *settings) const;
68 void setDefaultSettings(Settings *settings);
69};
70
71
73{
74public:
77
78 virtual MapgenType getType() const { return MAPGEN_FRACTAL; }
79
80 virtual void makeChunk(BlockMakeData *data);
82 bool getFractalAtPoint(s16 x, s16 y, s16 z);
83 s16 generateTerrain();
84
85private:
87 bool julia;
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;
98};
Definition: mg_biome.h:211
Definition: emerge.h:98
Definition: mapgen.h:294
Definition: mapgen_fractal.h:73
float julia_y
Definition: mapgen_fractal.h:94
u16 formula
Definition: mapgen_fractal.h:86
~MapgenFractal()
Definition: mapgen_fractal.cpp:90
float julia_x
Definition: mapgen_fractal.h:93
int getSpawnLevelAtPoint(v2s16 p)
Definition: mapgen_fractal.cpp:178
bool getFractalAtPoint(s16 x, s16 y, s16 z)
Definition: mapgen_fractal.cpp:278
float julia_w
Definition: mapgen_fractal.h:96
virtual MapgenType getType() const
Definition: mapgen_fractal.h:78
u16 fractal
Definition: mapgen_fractal.h:88
virtual void makeChunk(BlockMakeData *data)
Definition: mapgen_fractal.cpp:208
float slice_w
Definition: mapgen_fractal.h:92
v3f offset
Definition: mapgen_fractal.h:91
float julia_z
Definition: mapgen_fractal.h:95
bool julia
Definition: mapgen_fractal.h:87
Noise * noise_seabed
Definition: mapgen_fractal.h:97
s16 generateTerrain()
Definition: mapgen_fractal.cpp:408
u16 iterations
Definition: mapgen_fractal.h:89
v3f scale
Definition: mapgen_fractal.h:90
Definition: noise.h:146
Definition: settings.h:124
core::vector2d< s16 > v2s16
Definition: irr_v2d.h:27
core::vector3df v3f
Definition: irr_v3d.h:26
static LightingParams params
Definition: light.cpp:40
MapgenType
Definition: mapgen.h:117
@ MAPGEN_FRACTAL
Definition: mapgen.h:123
FlagDesc flagdesc_mapgen_fractal[]
Definition: mapgen_fractal.cpp:42
Definition: emerge.h:51
Definition: string.h:80
Definition: mapgen_fractal.h:37
u16 fractal
Definition: mapgen_fractal.h:47
float cave_width
Definition: mapgen_fractal.h:38
NoiseParams np_cave1
Definition: mapgen_fractal.h:59
float slice_w
Definition: mapgen_fractal.h:51
s16 large_cave_depth
Definition: mapgen_fractal.h:39
void setDefaultSettings(Settings *settings)
Definition: mapgen_fractal.cpp:168
float julia_y
Definition: mapgen_fractal.h:53
~MapgenFractalParams()=default
u16 large_cave_num_min
Definition: mapgen_fractal.h:42
NoiseParams np_seabed
Definition: mapgen_fractal.h:57
void readParams(const Settings *settings)
Definition: mapgen_fractal.cpp:107
s16 dungeon_ymin
Definition: mapgen_fractal.h:45
u16 small_cave_num_min
Definition: mapgen_fractal.h:40
u16 iterations
Definition: mapgen_fractal.h:48
u16 large_cave_num_max
Definition: mapgen_fractal.h:43
NoiseParams np_filler_depth
Definition: mapgen_fractal.h:58
float large_cave_flooded
Definition: mapgen_fractal.h:44
float julia_z
Definition: mapgen_fractal.h:54
NoiseParams np_cave2
Definition: mapgen_fractal.h:60
v3f scale
Definition: mapgen_fractal.h:49
v3f offset
Definition: mapgen_fractal.h:50
float julia_w
Definition: mapgen_fractal.h:55
MapgenFractalParams()
Definition: mapgen_fractal.cpp:97
u16 small_cave_num_max
Definition: mapgen_fractal.h:41
NoiseParams np_dungeons
Definition: mapgen_fractal.h:61
void writeParams(Settings *settings) const
Definition: mapgen_fractal.cpp:138
float julia_x
Definition: mapgen_fractal.h:52
s16 dungeon_ymax
Definition: mapgen_fractal.h:46
Definition: mapgen.h:129
Definition: noise.h:119
static std::string p(std::string path)
Definition: test_filesys.cpp:64