mirror of
https://github.com/love2d/love.git
synced 2026-08-21 21:15:09 +02:00
love.math.noise now returns values in the range of [0, 1] instead of [-1, 1]
This commit is contained in:
@@ -139,7 +139,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Calculate Simplex noise for the specified coordinate(s).
|
* 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) const;
|
||||||
float noise(float x, float y) const;
|
float noise(float x, float y) const;
|
||||||
@@ -156,22 +156,22 @@ private:
|
|||||||
|
|
||||||
inline float Math::noise(float x) const
|
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
|
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
|
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
|
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
|
} // math
|
||||||
|
|||||||
Reference in New Issue
Block a user