diff options
author | kwolekr <mirrorisim@gmail.com> | 2013-01-06 14:40:24 -0500 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2013-01-21 21:41:37 +0200 |
commit | 631a835e0782a2696762e3d55f75616f5a063394 (patch) | |
tree | 5f344ae788a50eb023e5d9fb92ed9478256c8f46 /src/noise.h | |
parent | 45cf32afc5554d76f7f48268a8cab5a051638761 (diff) | |
download | minetest-631a835e0782a2696762e3d55f75616f5a063394.tar.gz minetest-631a835e0782a2696762e3d55f75616f5a063394.tar.bz2 minetest-631a835e0782a2696762e3d55f75616f5a063394.zip |
Finish and clean up mapgen configuration
Diffstat (limited to 'src/noise.h')
-rw-r--r-- | src/noise.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/noise.h b/src/noise.h index 15df5c25b..9fb6d48a1 100644 --- a/src/noise.h +++ b/src/noise.h @@ -70,6 +70,10 @@ struct NoiseParams { }; +// Convenience macros for getting/setting NoiseParams in Settings +#define getNoiseParams(x) getStruct<NoiseParams>((x), "f,f,v3,s32,s32,f") +#define setNoiseParams(x, y) setStruct((x), "f,f,v3,s32,s32,f", (y)) + class Noise { public: NoiseParams *np; @@ -129,8 +133,12 @@ inline float easeCurve(float t) { } #define NoisePerlin2D(np, x, y, s) ((np)->offset + (np)->scale * \ - noise2d_perlin((float)(x) * (np)->spread.X, (float)(y) * (np)->spread.Y, \ + noise2d_perlin((float)(x) / (np)->spread.X, (float)(y) / (np)->spread.Y, \ (s) + (np)->seed, (np)->octaves, (np)->persist)) +#define NoisePerlin3D(np, x, y, z, s) ((np)->offset + (np)->scale * \ + noise2d_perlin((float)(x) / (np)->spread.X, (float)(y) / (np)->spread.Y, \ + (float)(z) / (np)->spread.Z, (s) + (np)->seed, (np)->octaves, (np)->persist)) + #endif |