summaryrefslogtreecommitdiff
path: root/src/noise.h
diff options
context:
space:
mode:
authorkwolekr <kwolekr@minetest.net>2014-11-12 23:49:45 -0500
committerkwolekr <kwolekr@minetest.net>2014-11-12 23:49:45 -0500
commitfc9521874ca3dcbc8dfd7237b9b3f2420250b351 (patch)
tree3d30e87fa7c7d60d7ec94529d128a77052da9fc6 /src/noise.h
parent7616537bc071bc93f8d36c84b94603528be1efb0 (diff)
downloadminetest-fc9521874ca3dcbc8dfd7237b9b3f2420250b351.tar.gz
minetest-fc9521874ca3dcbc8dfd7237b9b3f2420250b351.tar.bz2
minetest-fc9521874ca3dcbc8dfd7237b9b3f2420250b351.zip
Add eased 3d point-value noise functions
Diffstat (limited to 'src/noise.h')
-rw-r--r--src/noise.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/noise.h b/src/noise.h
index aa489b2c0..00d3612af 100644
--- a/src/noise.h
+++ b/src/noise.h
@@ -134,7 +134,7 @@ float noise2d(int x, int y, int seed);
float noise3d(int x, int y, int z, int seed);
float noise2d_gradient(float x, float y, int seed);
-float noise3d_gradient(float x, float y, float z, int seed);
+float noise3d_gradient(float x, float y, float z, int seed, bool eased=false);
float noise2d_perlin(float x, float y, int seed,
int octaves, float persistence);
@@ -143,10 +143,10 @@ float noise2d_perlin_abs(float x, float y, int seed,
int octaves, float persistence);
float noise3d_perlin(float x, float y, float z, int seed,
- int octaves, float persistence);
+ int octaves, float persistence, bool eased=false);
float noise3d_perlin_abs(float x, float y, float z, int seed,
- int octaves, float persistence);
+ int octaves, float persistence, bool eased=false);
inline float easeCurve(float t) {
return t * t * t * (t * (6.f * t - 15.f) + 10.f);
@@ -182,5 +182,10 @@ float contour(float v);
noise3d_perlin((float)(x) / (np)->spread.X, (float)(y) / (np)->spread.Y, \
(float)(z) / (np)->spread.Z, (s) + (np)->seed, (np)->octaves, (np)->persist))
+#define NoisePerlin3DEased(np, x, y, z, s) ((np)->offset + (np)->scale * \
+ noise3d_perlin((float)(x) / (np)->spread.X, (float)(y) / (np)->spread.Y, \
+ (float)(z) / (np)->spread.Z, (s) + (np)->seed, (np)->octaves, \
+ (np)->persist), true)
+
#endif