summaryrefslogtreecommitdiffstats
path: root/src/Noise.h
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-07-27 19:57:47 +0200
committermadmaxoft <github@xoft.cz>2014-07-27 19:57:47 +0200
commit30893e7ee2f4dbaa3e4348b07cdc77aada168e1f (patch)
treede895fdc560ca69bf0541a2bb6fae197780f40c0 /src/Noise.h
parentRoughRavines: Added per-height radius modifier. Ledges! (diff)
downloadcuberite-30893e7ee2f4dbaa3e4348b07cdc77aada168e1f.tar
cuberite-30893e7ee2f4dbaa3e4348b07cdc77aada168e1f.tar.gz
cuberite-30893e7ee2f4dbaa3e4348b07cdc77aada168e1f.tar.bz2
cuberite-30893e7ee2f4dbaa3e4348b07cdc77aada168e1f.tar.lz
cuberite-30893e7ee2f4dbaa3e4348b07cdc77aada168e1f.tar.xz
cuberite-30893e7ee2f4dbaa3e4348b07cdc77aada168e1f.tar.zst
cuberite-30893e7ee2f4dbaa3e4348b07cdc77aada168e1f.zip
Diffstat (limited to '')
-rw-r--r--src/Noise.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/Noise.h b/src/Noise.h
index 48a1c73f7..e69e5cdad 100644
--- a/src/Noise.h
+++ b/src/Noise.h
@@ -33,6 +33,12 @@ public:
INLINE NOISE_DATATYPE IntNoise2D(int a_X, int a_Y) const;
INLINE NOISE_DATATYPE IntNoise3D(int a_X, int a_Y, int a_Z) const;
+ // Return a float number in the specified range:
+ INLINE NOISE_DATATYPE IntNoise2DInRange(int a_X, int a_Y, float a_Min, float a_Max) const
+ {
+ return a_Min + std::abs(IntNoise2D(a_X, a_Y)) * (a_Max - a_Min);
+ }
+
// Note: These functions have a mod8-irregular chance - each of the mod8 remainders has different chance of occurrence. Divide by 8 to rectify.
INLINE int IntNoise1DInt(int a_X) const;
INLINE int IntNoise2DInt(int a_X, int a_Y) const;