From fc9521874ca3dcbc8dfd7237b9b3f2420250b351 Mon Sep 17 00:00:00 2001 From: kwolekr Date: Wed, 12 Nov 2014 23:49:45 -0500 Subject: Add eased 3d point-value noise functions --- src/noise.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/noise.h') 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 -- cgit v1.2.3