From 5c0066332f892380870587a6da696d4415349a6b Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Mon, 19 Aug 2013 19:57:55 -0300 Subject: [PATCH] love.math.noise now returns values in the range of [0, 1] instead of [-1, 1] --- src/modules/math/MathModule.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/modules/math/MathModule.h b/src/modules/math/MathModule.h index 01af49fdc..2c8435000 100644 --- a/src/modules/math/MathModule.h +++ b/src/modules/math/MathModule.h @@ -139,7 +139,7 @@ public: /** * Calculate Simplex noise for the specified coordinate(s). * - * @return Noise value in the range of [-1,1]. + * @return Noise value in the range of [0, 1]. **/ float noise(float x) const; float noise(float x, float y) const; @@ -156,22 +156,22 @@ private: inline float Math::noise(float x) const { - return SimplexNoise1234::noise(x); + return SimplexNoise1234::noise(x) * 0.5f + 0.5f; } inline float Math::noise(float x, float y) const { - return SimplexNoise1234::noise(x, y); + return SimplexNoise1234::noise(x, y) * 0.5f + 0.5f; } inline float Math::noise(float x, float y, float z) const { - return SimplexNoise1234::noise(x, y, z); + return SimplexNoise1234::noise(x, y, z) * 0.5f + 0.5f; } inline float Math::noise(float x, float y, float z, float w) const { - return SimplexNoise1234::noise(x, y, z, w); + return SimplexNoise1234::noise(x, y, z, w) * 0.5f + 0.5f; } } // math