summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVaughan Lapsley <vlapsley@users.noreply.github.com>2017-09-03 02:01:13 +1000
committerLoïc Blot <nerzhul@users.noreply.github.com>2017-09-02 18:01:13 +0200
commit2ac5a45faa26a9192ab3c3940d939b18b0df8b38 (patch)
treee6cbdbab2b7312873543eafe91e9d2290122e8d5
parentc0dac4d9284b61c5ff411cbd45786ed14c200f37 (diff)
downloadminetest-2ac5a45faa26a9192ab3c3940d939b18b0df8b38.tar.gz
minetest-2ac5a45faa26a9192ab3c3940d939b18b0df8b38.tar.bz2
minetest-2ac5a45faa26a9192ab3c3940d939b18b0df8b38.zip
Remove 3D noise from getSteps function (#6360)
-rw-r--r--builtin/settingtypes.txt2
-rw-r--r--minetest.conf.example2
-rw-r--r--src/mapgen_carpathian.cpp14
-rw-r--r--src/mapgen_carpathian.h2
4 files changed, 10 insertions, 10 deletions
diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt
index 9dedd8b8d..c457c5f33 100644
--- a/builtin/settingtypes.txt
+++ b/builtin/settingtypes.txt
@@ -1501,7 +1501,7 @@ mgcarpathian_np_ridge_mnt (Ridged mountain size noise) noise_params 0, 12, (743,
mgcarpathian_np_step_mnt (Step mountain size noise) noise_params 0, 8, (509, 509, 509), 2590, 6, 0.6, 2.0
# 3D noise for mountain overhangs, cliffs, etc. Usually small variations.
-mgcarpathian_np_mnt_var (Mountain variation noise) noise_params 0, 1, (499, 499, 499), 2490, 5, 0.6, 2.0
+mgcarpathian_np_mnt_var (Mountain variation noise) noise_params 0, 1, (499, 499, 499), 2490, 5, 0.55, 2.0
# First of 2 3D noises that together define tunnels.
mgcarpathian_np_cave1 (Cave1 noise) noise_params 0, 12, (61, 61, 61), 52534, 3, 0.5, 2.0
diff --git a/minetest.conf.example b/minetest.conf.example
index 9ce5bbd49..41453e4a9 100644
--- a/minetest.conf.example
+++ b/minetest.conf.example
@@ -1842,7 +1842,7 @@
# 3D noise for mountain overhangs, cliffs, etc. Usually small variations.
# type: noise_params
-# mgcarpathian_np_mnt_var = 0, 1, (499, 499, 499), 2490, 5, 0.6, 2.0
+# mgcarpathian_np_mnt_var = 0, 1, (499, 499, 499), 2490, 5, 0.55, 2.0
# First of 2 3D noises that together define tunnels.
# type: noise_params
diff --git a/src/mapgen_carpathian.cpp b/src/mapgen_carpathian.cpp
index c6ca1de20..c11a97abb 100644
--- a/src/mapgen_carpathian.cpp
+++ b/src/mapgen_carpathian.cpp
@@ -120,7 +120,7 @@ MapgenCarpathianParams::MapgenCarpathianParams()
np_hills = NoiseParams(0, 3, v3f(257, 257, 257), 6604, 6, 0.5, 2.0);
np_ridge_mnt = NoiseParams(0, 12, v3f(743, 743, 743), 5520, 6, 0.7, 2.0);
np_step_mnt = NoiseParams(0, 8, v3f(509, 509, 509), 2590, 6, 0.6, 2.0);
- np_mnt_var = NoiseParams(0, 1, v3f(499, 499, 499), 2490, 5, 0.6, 2.0);
+ np_mnt_var = NoiseParams(0, 1, v3f(499, 499, 499), 2490, 5, 0.55, 2.0);
np_cave1 = NoiseParams(0, 12, v3f(61, 61, 61), 52534, 3, 0.5, 2.0);
np_cave2 = NoiseParams(0, 12, v3f(67, 67, 67), 10325, 3, 0.5, 2.0);
np_cavern = NoiseParams(0, 1, v3f(384, 128, 384), 723, 5, 0.63, 2.0);
@@ -195,11 +195,11 @@ inline float MapgenCarpathian::getLerp(float noise1, float noise2, float mod)
}
// Steps function
-float MapgenCarpathian::getSteps(float noise1, float noise2)
+float MapgenCarpathian::getSteps(float noise)
{
- float w = fabs(noise2);
- float k = floor(noise1 / w);
- float f = (noise1 - k * w) / w;
+ float w = 0.5f;
+ float k = floor(noise / w);
+ float f = (noise - k * w) / w;
float s = std::fmin(2.f * f, 1.f);
return (k + s) * w;
}
@@ -343,7 +343,7 @@ float MapgenCarpathian::terrainLevelAtPoint(s16 x, s16 z)
float ridged_mountains = pow(rter, 3.f) * ridge_mnt;
// Step (terraced) mountains
- float step_mnt = hilliness * getSteps(n_step_mnt, fabs(mnt_var));
+ float step_mnt = hilliness * getSteps(n_step_mnt);
float step_mountains = pow(ster, 3.f) * step_mnt;
// Final terrain level
@@ -430,7 +430,7 @@ int MapgenCarpathian::generateTerrain()
// Step (terraced) mountains
float ster = noise_step_terrain->result[index2d];
float n_step_mnt = noise_step_mnt->result[index2d];
- float step_mnt = hilliness * getSteps(n_step_mnt, fabs(mnt_var));
+ float step_mnt = hilliness * getSteps(n_step_mnt);
float step_mountains = pow(fabs(ster), 3.f) * step_mnt;
// Final terrain level
diff --git a/src/mapgen_carpathian.h b/src/mapgen_carpathian.h
index b7c3935f7..7dbccde2a 100644
--- a/src/mapgen_carpathian.h
+++ b/src/mapgen_carpathian.h
@@ -74,7 +74,7 @@ public:
virtual MapgenType getType() const { return MAPGEN_CARPATHIAN; }
- float getSteps(float noise1, float noise2);
+ float getSteps(float noise);
inline float getLerp(float noise1, float noise2, float mod);
virtual void makeChunk(BlockMakeData *data);