From 30893e7ee2f4dbaa3e4348b07cdc77aada168e1f Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sun, 27 Jul 2014 19:57:47 +0200 Subject: RoughRavines: Made floor and ceiling settings-adjustable. The world.ini has settings for the minimum and maximum height for each at the ravines' center and edges. --- src/Noise.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/Noise.h') 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; -- cgit v1.2.3 From 579b80fd3a3b633e59034c0924459a860d611b27 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sun, 27 Jul 2014 20:08:33 +0200 Subject: Added a missing include for abs(float). --- src/Noise.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/Noise.h') diff --git a/src/Noise.h b/src/Noise.h index e69e5cdad..4cf8d4ad8 100644 --- a/src/Noise.h +++ b/src/Noise.h @@ -5,6 +5,12 @@ #pragma once +#include + + + + + // Some settings #define NOISE_DATATYPE float -- cgit v1.2.3