aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorparamat <mat.gregory@virginmedia.com>2015-10-28 22:58:39 +0000
committerparamat <mat.gregory@virginmedia.com>2015-10-29 20:02:57 +0000
commit182b3fd2831a7deb22d709e7c285eca3a57a5678 (patch)
treea741d5ef74a26265a58f7e8b657dfb51b90f5ec5 /src
parent688556a5d1910ead2cf06a87af6908110fa9d035 (diff)
downloadminetest-182b3fd2831a7deb22d709e7c285eca3a57a5678.tar.gz
minetest-182b3fd2831a7deb22d709e7c285eca3a57a5678.tar.bz2
minetest-182b3fd2831a7deb22d709e7c285eca3a57a5678.zip
Mgfractal: Add filler depth noise
Diffstat (limited to 'src')
-rw-r--r--src/mapgen_fractal.cpp18
-rw-r--r--src/mapgen_fractal.h3
2 files changed, 14 insertions, 7 deletions
diff --git a/src/mapgen_fractal.cpp b/src/mapgen_fractal.cpp
index c359dc4c6..a33e19840 100644
--- a/src/mapgen_fractal.cpp
+++ b/src/mapgen_fractal.cpp
@@ -82,7 +82,8 @@ MapgenFractal::MapgenFractal(int mapgenid, MapgenParams *params, EmergeManager *
this->julia_w = sp->julia_w;
//// 2D terrain noise
- noise_seabed = new Noise(&sp->np_seabed, seed, csize.X, csize.Z);
+ noise_seabed = new Noise(&sp->np_seabed, seed, csize.X, csize.Z);
+ noise_filler_depth = new Noise(&sp->np_filler_depth, seed, csize.X, csize.Z);
//// 3D terrain noise
noise_cave1 = new Noise(&sp->np_cave1, seed, csize.X, csize.Y + 2, csize.Z);
@@ -126,7 +127,7 @@ MapgenFractal::MapgenFractal(int mapgenid, MapgenParams *params, EmergeManager *
MapgenFractal::~MapgenFractal()
{
delete noise_seabed;
-
+ delete noise_filler_depth;
delete noise_cave1;
delete noise_cave2;
@@ -158,9 +159,10 @@ MapgenFractalParams::MapgenFractalParams()
julia_z = 0.33;
julia_w = 0.33;
- np_seabed = NoiseParams(-14, 9, v3f(600, 600, 600), 41900, 5, 0.6, 2.0);
- np_cave1 = NoiseParams(0, 12, v3f(128, 128, 128), 52534, 4, 0.5, 2.0);
- np_cave2 = NoiseParams(0, 12, v3f(128, 128, 128), 10325, 4, 0.5, 2.0);
+ np_seabed = NoiseParams(-14, 9, v3f(600, 600, 600), 41900, 5, 0.6, 2.0);
+ np_filler_depth = NoiseParams(0, 1.2, v3f(150, 150, 150), 261, 3, 0.7, 2.0);
+ np_cave1 = NoiseParams(0, 12, v3f(128, 128, 128), 52534, 4, 0.5, 2.0);
+ np_cave2 = NoiseParams(0, 12, v3f(128, 128, 128), 10325, 4, 0.5, 2.0);
}
@@ -183,6 +185,7 @@ void MapgenFractalParams::readParams(const Settings *settings)
settings->getFloatNoEx("mgfractal_julia_w", julia_w);
settings->getNoiseParams("mgfractal_np_seabed", np_seabed);
+ settings->getNoiseParams("mgfractal_np_filler_depth", np_filler_depth);
settings->getNoiseParams("mgfractal_np_cave1", np_cave1);
settings->getNoiseParams("mgfractal_np_cave2", np_cave2);
}
@@ -207,6 +210,7 @@ void MapgenFractalParams::writeParams(Settings *settings) const
settings->setFloat("mgfractal_julia_w", julia_w);
settings->setNoiseParams("mgfractal_np_seabed", np_seabed);
+ settings->setNoiseParams("mgfractal_np_filler_depth", np_filler_depth);
settings->setNoiseParams("mgfractal_np_cave1", np_cave1);
settings->setNoiseParams("mgfractal_np_cave2", np_cave2);
}
@@ -349,6 +353,7 @@ void MapgenFractal::calculateNoise()
int z = node_min.Z;
noise_seabed->perlinMap2D(x, z);
+ noise_filler_depth->perlinMap2D(x, z);
if (flags & MG_CAVES) {
noise_cave1->perlinMap3D(x, y, z);
@@ -492,7 +497,8 @@ MgStoneType MapgenFractal::generateBiomes(float *heat_map, float *humidity_map)
(c == c_water_source && (air_above || !biome))) {
biome = bmgr->getBiome(heat_map[index], humidity_map[index], y);
depth_top = biome->depth_top;
- base_filler = depth_top + biome->depth_filler;
+ base_filler = MYMAX(depth_top + biome->depth_filler
+ + noise_filler_depth->result[index], 0);
depth_water_top = biome->depth_water_top;
// Detect stone type for dungeons during every biome calculation.
diff --git a/src/mapgen_fractal.h b/src/mapgen_fractal.h
index 8e52dafec..ee947dba2 100644
--- a/src/mapgen_fractal.h
+++ b/src/mapgen_fractal.h
@@ -51,6 +51,7 @@ struct MapgenFractalParams : public MapgenSpecificParams {
float julia_w;
NoiseParams np_seabed;
+ NoiseParams np_filler_depth;
NoiseParams np_cave1;
NoiseParams np_cave2;
@@ -90,7 +91,7 @@ public:
float julia_w;
Noise *noise_seabed;
-
+ Noise *noise_filler_depth;
Noise *noise_cave1;
Noise *noise_cave2;