Replaced Simplex noise with Perlin noise for the 3D and 4D variants of love.math.noise, to avoid patent-infringement issues (resolves issue #997.)

This commit is contained in:
Alex Szpakowski
2015-04-17 17:01:41 -03:00
parent c62b005ff3
commit 97806f87c0
7 changed files with 611 additions and 279 deletions
+7 -3
View File
@@ -32,6 +32,7 @@
#include "common/int.h"
// Noise
#include "libraries/noise1234/noise1234.h"
#include "libraries/noise1234/simplexnoise1234.h"
// STL
@@ -154,7 +155,7 @@ public:
float linearToGamma(float c) const;
/**
* Calculate Simplex noise for the specified coordinate(s).
* Calculate noise for the specified coordinate(s).
*
* @return Noise value in the range of [0, 1].
**/
@@ -218,14 +219,17 @@ inline float Math::noise(float x, float y) const
return SimplexNoise1234::noise(x, y) * 0.5f + 0.5f;
}
// Perlin noise is used instead of Simplex noise in the 3D and 4D cases to avoid
// patent issues.
inline float Math::noise(float x, float y, float z) const
{
return SimplexNoise1234::noise(x, y, z) * 0.5f + 0.5f;
return Noise1234::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) * 0.5f + 0.5f;
return Noise1234::noise(x, y, z, w) * 0.5f + 0.5f;
}
} // math