summaryrefslogtreecommitdiff
path: root/src/mapgen_v7.cpp
diff options
context:
space:
mode:
authorparamat <mat.gregory@virginmedia.com>2015-07-15 02:31:14 +0100
committerparamat <mat.gregory@virginmedia.com>2015-07-21 23:16:14 +0100
commitd569c91f489d16decf270847688c4e42c1014679 (patch)
tree606ecfca2fc6904faa23bff6b9079084b0d43d89 /src/mapgen_v7.cpp
parent60350699c792b816b20704d59cfbda0894cdba39 (diff)
downloadminetest-d569c91f489d16decf270847688c4e42c1014679.tar.gz
minetest-d569c91f489d16decf270847688c4e42c1014679.tar.bz2
minetest-d569c91f489d16decf270847688c4e42c1014679.zip
Mgv7: Use density noise + density gradient for mountain terrain
Tune and optimise noise parameters
Diffstat (limited to 'src/mapgen_v7.cpp')
-rw-r--r--src/mapgen_v7.cpp30
1 files changed, 17 insertions, 13 deletions
diff --git a/src/mapgen_v7.cpp b/src/mapgen_v7.cpp
index a46bf8f17..e499ebb81 100644
--- a/src/mapgen_v7.cpp
+++ b/src/mapgen_v7.cpp
@@ -146,17 +146,17 @@ MapgenV7Params::MapgenV7Params()
{
spflags = MGV7_MOUNTAINS | MGV7_RIDGES;
- np_terrain_base = NoiseParams(4, 70, v3f(600, 600, 600), 82341, 5, 0.6, 2.0);
- np_terrain_alt = NoiseParams(4, 25, v3f(600, 600, 600), 5934, 5, 0.6, 2.0);
- np_terrain_persist = NoiseParams(0.6, 0.12, v3f(2000, 2000, 2000), 539, 3, 0.5, 2.0);
- np_height_select = NoiseParams(-12, 24, v3f(500, 500, 500), 4213, 6, 0.69, 2.0);
- np_filler_depth = NoiseParams(0, 1.2, v3f(150, 150, 150), 261, 4, 0.7, 2.0);
- np_mount_height = NoiseParams(184, 72, v3f(1000, 1000, 1000), 72449, 3, 0.5, 2.0);
- np_ridge_uwater = NoiseParams(0, 1, v3f(1000, 1000, 1000), 85039, 5, 0.6, 2.0);
- np_mountain = NoiseParams(-0.6, 1, v3f(250, 350, 250), 5333, 5, 0.68, 2.0);
- np_ridge = NoiseParams(0, 1, v3f(100, 100, 100), 6467, 4, 0.75, 2.0);
- np_cave1 = NoiseParams(0, 12, v3f(100, 100, 100), 52534, 4, 0.5, 2.0);
- np_cave2 = NoiseParams(0, 12, v3f(100, 100, 100), 10325, 4, 0.5, 2.0);
+ np_terrain_base = NoiseParams(4, 70, v3f(600, 600, 600), 82341, 5, 0.6, 2.0);
+ np_terrain_alt = NoiseParams(4, 25, v3f(600, 600, 600), 5934, 5, 0.6, 2.0);
+ np_terrain_persist = NoiseParams(0.6, 0.1, v3f(2000, 2000, 2000), 539, 3, 0.6, 2.0);
+ np_height_select = NoiseParams(-12, 24, v3f(500, 500, 500), 4213, 6, 0.7, 2.0);
+ np_filler_depth = NoiseParams(0, 1.2, v3f(150, 150, 150), 261, 3, 0.7, 2.0);
+ np_mount_height = NoiseParams(256, 112, v3f(1000, 1000, 1000), 72449, 3, 0.6, 2.0);
+ np_ridge_uwater = NoiseParams(0, 1, v3f(1000, 1000, 1000), 85039, 5, 0.6, 2.0);
+ np_mountain = NoiseParams(-0.6, 1, v3f(250, 350, 250), 5333, 5, 0.63, 2.0);
+ np_ridge = NoiseParams(0, 1, v3f(100, 100, 100), 6467, 4, 0.75, 2.0);
+ np_cave1 = NoiseParams(0, 12, v3f(100, 100, 100), 52534, 4, 0.5, 2.0);
+ np_cave2 = NoiseParams(0, 12, v3f(100, 100, 100), 10325, 4, 0.5, 2.0);
}
@@ -429,16 +429,20 @@ float MapgenV7::baseTerrainLevelFromMap(int index)
bool MapgenV7::getMountainTerrainAtPoint(s16 x, s16 y, s16 z)
{
float mnt_h_n = NoisePerlin2D(&noise_mount_height->np, x, z, seed);
+ float density_gradient = -((float)y / mnt_h_n);
float mnt_n = NoisePerlin3D(&noise_mountain->np, x, y, z, seed);
- return mnt_n * mnt_h_n >= (float)y;
+
+ return mnt_n + density_gradient >= 0.0;
}
bool MapgenV7::getMountainTerrainFromMap(int idx_xyz, int idx_xz, s16 y)
{
float mounthn = noise_mount_height->result[idx_xz];
+ float density_gradient = -((float)y / mounthn);
float mountn = noise_mountain->result[idx_xyz];
- return mountn * mounthn >= (float)y;
+
+ return mountn + density_gradient >= 0.0;
}