diff options
Diffstat (limited to 'thirdparty')
-rw-r--r-- | thirdparty/noise/FastNoiseLite.h | 101 | ||||
-rw-r--r-- | thirdparty/noise/patches/FastNoiseLite.patch | 437 |
2 files changed, 492 insertions, 46 deletions
diff --git a/thirdparty/noise/FastNoiseLite.h b/thirdparty/noise/FastNoiseLite.h index 3db344c149..a213f0888e 100644 --- a/thirdparty/noise/FastNoiseLite.h +++ b/thirdparty/noise/FastNoiseLite.h @@ -295,7 +295,7 @@ public: /// Noise output bounded between -1...1 /// </returns> template <typename FNfloat> - float GetNoise(FNfloat x, FNfloat y) + float GetNoise(FNfloat x, FNfloat y) const { Arguments_must_be_floating_point_values<FNfloat>(); @@ -321,7 +321,7 @@ public: /// Noise output bounded between -1...1 /// </returns> template <typename FNfloat> - float GetNoise(FNfloat x, FNfloat y, FNfloat z) + float GetNoise(FNfloat x, FNfloat y, FNfloat z) const { Arguments_must_be_floating_point_values<FNfloat>(); @@ -350,7 +350,7 @@ public: /// noise = GetNoise(x, y)</code> /// </example> template <typename FNfloat> - void DomainWarp(FNfloat& x, FNfloat& y) + void DomainWarp(FNfloat& x, FNfloat& y) const { Arguments_must_be_floating_point_values<FNfloat>(); @@ -377,7 +377,7 @@ public: /// noise = GetNoise(x, y, z)</code> /// </example> template <typename FNfloat> - void DomainWarp(FNfloat& x, FNfloat& y, FNfloat& z) + void DomainWarp(FNfloat& x, FNfloat& y, FNfloat& z) const { Arguments_must_be_floating_point_values<FNfloat>(); @@ -528,7 +528,7 @@ private: } - float GradCoord(int seed, int xPrimed, int yPrimed, float xd, float yd) + float GradCoord(int seed, int xPrimed, int yPrimed, float xd, float yd) const { int hash = Hash(seed, xPrimed, yPrimed); hash ^= hash >> 15; @@ -541,7 +541,7 @@ private: } - float GradCoord(int seed, int xPrimed, int yPrimed, int zPrimed, float xd, float yd, float zd) + float GradCoord(int seed, int xPrimed, int yPrimed, int zPrimed, float xd, float yd, float zd) const { int hash = Hash(seed, xPrimed, yPrimed, zPrimed); hash ^= hash >> 15; @@ -555,7 +555,7 @@ private: } - void GradCoordOut(int seed, int xPrimed, int yPrimed, float& xo, float& yo) + void GradCoordOut(int seed, int xPrimed, int yPrimed, float& xo, float& yo) const { int hash = Hash(seed, xPrimed, yPrimed) & (255 << 1); @@ -564,7 +564,7 @@ private: } - void GradCoordOut(int seed, int xPrimed, int yPrimed, int zPrimed, float& xo, float& yo, float& zo) + void GradCoordOut(int seed, int xPrimed, int yPrimed, int zPrimed, float& xo, float& yo, float& zo) const { int hash = Hash(seed, xPrimed, yPrimed, zPrimed) & (255 << 2); @@ -574,7 +574,7 @@ private: } - void GradCoordDual(int seed, int xPrimed, int yPrimed, float xd, float yd, float& xo, float& yo) + void GradCoordDual(int seed, int xPrimed, int yPrimed, float xd, float yd, float& xo, float& yo) const { int hash = Hash(seed, xPrimed, yPrimed); int index1 = hash & (127 << 1); @@ -592,7 +592,7 @@ private: } - void GradCoordDual(int seed, int xPrimed, int yPrimed, int zPrimed, float xd, float yd, float zd, float& xo, float& yo, float& zo) + void GradCoordDual(int seed, int xPrimed, int yPrimed, int zPrimed, float xd, float yd, float zd, float& xo, float& yo, float& zo) const { int hash = Hash(seed, xPrimed, yPrimed, zPrimed); int index1 = hash & (63 << 2); @@ -616,7 +616,7 @@ private: // Generic noise gen template <typename FNfloat> - float GenNoiseSingle(int seed, FNfloat x, FNfloat y) + float GenNoiseSingle(int seed, FNfloat x, FNfloat y) const { switch (mNoiseType) { @@ -638,7 +638,7 @@ private: } template <typename FNfloat> - float GenNoiseSingle(int seed, FNfloat x, FNfloat y, FNfloat z) + float GenNoiseSingle(int seed, FNfloat x, FNfloat y, FNfloat z) const { switch (mNoiseType) { @@ -663,7 +663,7 @@ private: // Noise Coordinate Transforms (frequency, and possible skew or rotation) template <typename FNfloat> - void TransformNoiseCoordinate(FNfloat& x, FNfloat& y) + void TransformNoiseCoordinate(FNfloat& x, FNfloat& y) const { x *= mFrequency; y *= mFrequency; @@ -686,7 +686,7 @@ private: } template <typename FNfloat> - void TransformNoiseCoordinate(FNfloat& x, FNfloat& y, FNfloat& z) + void TransformNoiseCoordinate(FNfloat& x, FNfloat& y, FNfloat& z) const { x *= mFrequency; y *= mFrequency; @@ -757,7 +757,7 @@ private: // Domain Warp Coordinate Transforms template <typename FNfloat> - void TransformDomainWarpCoordinate(FNfloat& x, FNfloat& y) + void TransformDomainWarpCoordinate(FNfloat& x, FNfloat& y) const { switch (mDomainWarpType) { @@ -777,7 +777,7 @@ private: } template <typename FNfloat> - void TransformDomainWarpCoordinate(FNfloat& x, FNfloat& y, FNfloat& z) + void TransformDomainWarpCoordinate(FNfloat& x, FNfloat& y, FNfloat& z) const { switch (mWarpTransformType3D) { @@ -844,7 +844,7 @@ private: // Fractal FBm template <typename FNfloat> - float GenFractalFBm(FNfloat x, FNfloat y) + float GenFractalFBm(FNfloat x, FNfloat y) const { int seed = mSeed; float sum = 0; @@ -865,7 +865,7 @@ private: } template <typename FNfloat> - float GenFractalFBm(FNfloat x, FNfloat y, FNfloat z) + float GenFractalFBm(FNfloat x, FNfloat y, FNfloat z) const { int seed = mSeed; float sum = 0; @@ -890,7 +890,7 @@ private: // Fractal Ridged template <typename FNfloat> - float GenFractalRidged(FNfloat x, FNfloat y) + float GenFractalRidged(FNfloat x, FNfloat y) const { int seed = mSeed; float sum = 0; @@ -911,7 +911,7 @@ private: } template <typename FNfloat> - float GenFractalRidged(FNfloat x, FNfloat y, FNfloat z) + float GenFractalRidged(FNfloat x, FNfloat y, FNfloat z) const { int seed = mSeed; float sum = 0; @@ -936,7 +936,7 @@ private: // Fractal PingPong template <typename FNfloat> - float GenFractalPingPong(FNfloat x, FNfloat y) + float GenFractalPingPong(FNfloat x, FNfloat y) const { int seed = mSeed; float sum = 0; @@ -957,7 +957,7 @@ private: } template <typename FNfloat> - float GenFractalPingPong(FNfloat x, FNfloat y, FNfloat z) + float GenFractalPingPong(FNfloat x, FNfloat y, FNfloat z) const { int seed = mSeed; float sum = 0; @@ -982,7 +982,7 @@ private: // Simplex/OpenSimplex2 Noise template <typename FNfloat> - float SingleSimplex(int seed, FNfloat x, FNfloat y) + float SingleSimplex(int seed, FNfloat x, FNfloat y) const { // 2D OpenSimplex2 case uses the same algorithm as ordinary Simplex. @@ -1053,7 +1053,7 @@ private: } template <typename FNfloat> - float SingleOpenSimplex2(int seed, FNfloat x, FNfloat y, FNfloat z) + float SingleOpenSimplex2(int seed, FNfloat x, FNfloat y, FNfloat z) const { // 3D OpenSimplex2 case uses two offset rotated cube grids. @@ -1155,7 +1155,7 @@ private: // OpenSimplex2S Noise template <typename FNfloat> - float SingleOpenSimplex2S(int seed, FNfloat x, FNfloat y) + float SingleOpenSimplex2S(int seed, FNfloat x, FNfloat y) const { // 2D OpenSimplex2S case is a modified 2D simplex noise. @@ -1286,7 +1286,7 @@ private: } template <typename FNfloat> - float SingleOpenSimplex2S(int seed, FNfloat x, FNfloat y, FNfloat z) + float SingleOpenSimplex2S(int seed, FNfloat x, FNfloat y, FNfloat z) const { // 3D OpenSimplex2S case uses two offset rotated cube grids. @@ -1482,7 +1482,7 @@ private: // Cellular Noise template <typename FNfloat> - float SingleCellular(int seed, FNfloat x, FNfloat y) + float SingleCellular(int seed, FNfloat x, FNfloat y) const { int xr = FastRound(x); int yr = FastRound(y); @@ -1611,8 +1611,14 @@ private: } } +// GCC raises warnings when integer overflows occur, which are needed for hashing here. +#if defined(__GNUC__) && !defined(__clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Waggressive-loop-optimizations" +#endif + template <typename FNfloat> - float SingleCellular(int seed, FNfloat x, FNfloat y, FNfloat z) + float SingleCellular(int seed, FNfloat x, FNfloat y, FNfloat z) const { int xr = FastRound(x); int yr = FastRound(y); @@ -1765,11 +1771,14 @@ private: } } +#if defined(__GNUC__) && !defined(__clang__) +#pragma GCC diagnostic pop +#endif // Perlin Noise template <typename FNfloat> - float SinglePerlin(int seed, FNfloat x, FNfloat y) + float SinglePerlin(int seed, FNfloat x, FNfloat y) const { int x0 = FastFloor(x); int y0 = FastFloor(y); @@ -1794,7 +1803,7 @@ private: } template <typename FNfloat> - float SinglePerlin(int seed, FNfloat x, FNfloat y, FNfloat z) + float SinglePerlin(int seed, FNfloat x, FNfloat y, FNfloat z) const { int x0 = FastFloor(x); int y0 = FastFloor(y); @@ -1833,7 +1842,7 @@ private: // Value Cubic Noise template <typename FNfloat> - float SingleValueCubic(int seed, FNfloat x, FNfloat y) + float SingleValueCubic(int seed, FNfloat x, FNfloat y) const { int x1 = FastFloor(x); int y1 = FastFloor(y); @@ -1863,7 +1872,7 @@ private: } template <typename FNfloat> - float SingleValueCubic(int seed, FNfloat x, FNfloat y, FNfloat z) + float SingleValueCubic(int seed, FNfloat x, FNfloat y, FNfloat z) const { int x1 = FastFloor(x); int y1 = FastFloor(y); @@ -1920,7 +1929,7 @@ private: // Value Noise template <typename FNfloat> - float SingleValue(int seed, FNfloat x, FNfloat y) + float SingleValue(int seed, FNfloat x, FNfloat y) const { int x0 = FastFloor(x); int y0 = FastFloor(y); @@ -1940,7 +1949,7 @@ private: } template <typename FNfloat> - float SingleValue(int seed, FNfloat x, FNfloat y, FNfloat z) + float SingleValue(int seed, FNfloat x, FNfloat y, FNfloat z) const { int x0 = FastFloor(x); int y0 = FastFloor(y); @@ -1972,7 +1981,7 @@ private: // Domain Warp template <typename FNfloat> - void DoSingleDomainWarp(int seed, float amp, float freq, FNfloat x, FNfloat y, FNfloat& xr, FNfloat& yr) + void DoSingleDomainWarp(int seed, float amp, float freq, FNfloat x, FNfloat y, FNfloat& xr, FNfloat& yr) const { switch (mDomainWarpType) { @@ -1989,7 +1998,7 @@ private: } template <typename FNfloat> - void DoSingleDomainWarp(int seed, float amp, float freq, FNfloat x, FNfloat y, FNfloat z, FNfloat& xr, FNfloat& yr, FNfloat& zr) + void DoSingleDomainWarp(int seed, float amp, float freq, FNfloat x, FNfloat y, FNfloat z, FNfloat& xr, FNfloat& yr, FNfloat& zr) const { switch (mDomainWarpType) { @@ -2009,7 +2018,7 @@ private: // Domain Warp Single Wrapper template <typename FNfloat> - void DomainWarpSingle(FNfloat& x, FNfloat& y) + void DomainWarpSingle(FNfloat& x, FNfloat& y) const { int seed = mSeed; float amp = mDomainWarpAmp * mFractalBounding; @@ -2023,7 +2032,7 @@ private: } template <typename FNfloat> - void DomainWarpSingle(FNfloat& x, FNfloat& y, FNfloat& z) + void DomainWarpSingle(FNfloat& x, FNfloat& y, FNfloat& z) const { int seed = mSeed; float amp = mDomainWarpAmp * mFractalBounding; @@ -2041,7 +2050,7 @@ private: // Domain Warp Fractal Progressive template <typename FNfloat> - void DomainWarpFractalProgressive(FNfloat& x, FNfloat& y) + void DomainWarpFractalProgressive(FNfloat& x, FNfloat& y) const { int seed = mSeed; float amp = mDomainWarpAmp * mFractalBounding; @@ -2062,7 +2071,7 @@ private: } template <typename FNfloat> - void DomainWarpFractalProgressive(FNfloat& x, FNfloat& y, FNfloat& z) + void DomainWarpFractalProgressive(FNfloat& x, FNfloat& y, FNfloat& z) const { int seed = mSeed; float amp = mDomainWarpAmp * mFractalBounding; @@ -2087,7 +2096,7 @@ private: // Domain Warp Fractal Independant template <typename FNfloat> - void DomainWarpFractalIndependent(FNfloat& x, FNfloat& y) + void DomainWarpFractalIndependent(FNfloat& x, FNfloat& y) const { FNfloat xs = x; FNfloat ys = y; @@ -2108,7 +2117,7 @@ private: } template <typename FNfloat> - void DomainWarpFractalIndependent(FNfloat& x, FNfloat& y, FNfloat& z) + void DomainWarpFractalIndependent(FNfloat& x, FNfloat& y, FNfloat& z) const { FNfloat xs = x; FNfloat ys = y; @@ -2133,7 +2142,7 @@ private: // Domain Warp Basic Grid template <typename FNfloat> - void SingleDomainWarpBasicGrid(int seed, float warpAmp, float frequency, FNfloat x, FNfloat y, FNfloat& xr, FNfloat& yr) + void SingleDomainWarpBasicGrid(int seed, float warpAmp, float frequency, FNfloat x, FNfloat y, FNfloat& xr, FNfloat& yr) const { FNfloat xf = x * frequency; FNfloat yf = y * frequency; @@ -2166,7 +2175,7 @@ private: } template <typename FNfloat> - void SingleDomainWarpBasicGrid(int seed, float warpAmp, float frequency, FNfloat x, FNfloat y, FNfloat z, FNfloat& xr, FNfloat& yr, FNfloat& zr) + void SingleDomainWarpBasicGrid(int seed, float warpAmp, float frequency, FNfloat x, FNfloat y, FNfloat z, FNfloat& xr, FNfloat& yr, FNfloat& zr) const { FNfloat xf = x * frequency; FNfloat yf = y * frequency; @@ -2228,7 +2237,7 @@ private: // Domain Warp Simplex/OpenSimplex2 template <typename FNfloat> - void SingleDomainWarpSimplexGradient(int seed, float warpAmp, float frequency, FNfloat x, FNfloat y, FNfloat& xr, FNfloat& yr, bool outGradOnly) + void SingleDomainWarpSimplexGradient(int seed, float warpAmp, float frequency, FNfloat x, FNfloat y, FNfloat& xr, FNfloat& yr, bool outGradOnly) const { const float SQRT3 = 1.7320508075688772935274463415059f; const float G2 = (3 - SQRT3) / 6; @@ -2326,7 +2335,7 @@ private: } template <typename FNfloat> - void SingleDomainWarpOpenSimplex2Gradient(int seed, float warpAmp, float frequency, FNfloat x, FNfloat y, FNfloat z, FNfloat& xr, FNfloat& yr, FNfloat& zr, bool outGradOnly) + void SingleDomainWarpOpenSimplex2Gradient(int seed, float warpAmp, float frequency, FNfloat x, FNfloat y, FNfloat z, FNfloat& xr, FNfloat& yr, FNfloat& zr, bool outGradOnly) const { x *= frequency; y *= frequency; diff --git a/thirdparty/noise/patches/FastNoiseLite.patch b/thirdparty/noise/patches/FastNoiseLite.patch index acb1edfd73..3c835c7b06 100644 --- a/thirdparty/noise/patches/FastNoiseLite.patch +++ b/thirdparty/noise/patches/FastNoiseLite.patch @@ -16,3 +16,440 @@ -#endif +} +#endif // namespace fastnoiselite +@@ -295,7 +295,7 @@ public: + /// Noise output bounded between -1...1 + /// </returns> + template <typename FNfloat> +- float GetNoise(FNfloat x, FNfloat y) ++ float GetNoise(FNfloat x, FNfloat y) const + { + Arguments_must_be_floating_point_values<FNfloat>(); + +@@ -321,7 +321,7 @@ public: + /// Noise output bounded between -1...1 + /// </returns> + template <typename FNfloat> +- float GetNoise(FNfloat x, FNfloat y, FNfloat z) ++ float GetNoise(FNfloat x, FNfloat y, FNfloat z) const + { + Arguments_must_be_floating_point_values<FNfloat>(); + +@@ -350,7 +350,7 @@ public: + /// noise = GetNoise(x, y)</code> + /// </example> + template <typename FNfloat> +- void DomainWarp(FNfloat& x, FNfloat& y) ++ void DomainWarp(FNfloat& x, FNfloat& y) const + { + Arguments_must_be_floating_point_values<FNfloat>(); + +@@ -377,7 +377,7 @@ public: + /// noise = GetNoise(x, y, z)</code> + /// </example> + template <typename FNfloat> +- void DomainWarp(FNfloat& x, FNfloat& y, FNfloat& z) ++ void DomainWarp(FNfloat& x, FNfloat& y, FNfloat& z) const + { + Arguments_must_be_floating_point_values<FNfloat>(); + +@@ -528,7 +528,7 @@ private: + } + + +- float GradCoord(int seed, int xPrimed, int yPrimed, float xd, float yd) ++ float GradCoord(int seed, int xPrimed, int yPrimed, float xd, float yd) const + { + int hash = Hash(seed, xPrimed, yPrimed); + hash ^= hash >> 15; +@@ -541,7 +541,7 @@ private: + } + + +- float GradCoord(int seed, int xPrimed, int yPrimed, int zPrimed, float xd, float yd, float zd) ++ float GradCoord(int seed, int xPrimed, int yPrimed, int zPrimed, float xd, float yd, float zd) const + { + int hash = Hash(seed, xPrimed, yPrimed, zPrimed); + hash ^= hash >> 15; +@@ -555,7 +555,7 @@ private: + } + + +- void GradCoordOut(int seed, int xPrimed, int yPrimed, float& xo, float& yo) ++ void GradCoordOut(int seed, int xPrimed, int yPrimed, float& xo, float& yo) const + { + int hash = Hash(seed, xPrimed, yPrimed) & (255 << 1); + +@@ -564,7 +564,7 @@ private: + } + + +- void GradCoordOut(int seed, int xPrimed, int yPrimed, int zPrimed, float& xo, float& yo, float& zo) ++ void GradCoordOut(int seed, int xPrimed, int yPrimed, int zPrimed, float& xo, float& yo, float& zo) const + { + int hash = Hash(seed, xPrimed, yPrimed, zPrimed) & (255 << 2); + +@@ -574,7 +574,7 @@ private: + } + + +- void GradCoordDual(int seed, int xPrimed, int yPrimed, float xd, float yd, float& xo, float& yo) ++ void GradCoordDual(int seed, int xPrimed, int yPrimed, float xd, float yd, float& xo, float& yo) const + { + int hash = Hash(seed, xPrimed, yPrimed); + int index1 = hash & (127 << 1); +@@ -592,7 +592,7 @@ private: + } + + +- void GradCoordDual(int seed, int xPrimed, int yPrimed, int zPrimed, float xd, float yd, float zd, float& xo, float& yo, float& zo) ++ void GradCoordDual(int seed, int xPrimed, int yPrimed, int zPrimed, float xd, float yd, float zd, float& xo, float& yo, float& zo) const + { + int hash = Hash(seed, xPrimed, yPrimed, zPrimed); + int index1 = hash & (63 << 2); +@@ -616,7 +616,7 @@ private: + // Generic noise gen + + template <typename FNfloat> +- float GenNoiseSingle(int seed, FNfloat x, FNfloat y) ++ float GenNoiseSingle(int seed, FNfloat x, FNfloat y) const + { + switch (mNoiseType) + { +@@ -638,7 +638,7 @@ private: + } + + template <typename FNfloat> +- float GenNoiseSingle(int seed, FNfloat x, FNfloat y, FNfloat z) ++ float GenNoiseSingle(int seed, FNfloat x, FNfloat y, FNfloat z) const + { + switch (mNoiseType) + { +@@ -663,7 +663,7 @@ private: + // Noise Coordinate Transforms (frequency, and possible skew or rotation) + + template <typename FNfloat> +- void TransformNoiseCoordinate(FNfloat& x, FNfloat& y) ++ void TransformNoiseCoordinate(FNfloat& x, FNfloat& y) const + { + x *= mFrequency; + y *= mFrequency; +@@ -686,7 +686,7 @@ private: + } + + template <typename FNfloat> +- void TransformNoiseCoordinate(FNfloat& x, FNfloat& y, FNfloat& z) ++ void TransformNoiseCoordinate(FNfloat& x, FNfloat& y, FNfloat& z) const + { + x *= mFrequency; + y *= mFrequency; +@@ -757,7 +757,7 @@ private: + // Domain Warp Coordinate Transforms + + template <typename FNfloat> +- void TransformDomainWarpCoordinate(FNfloat& x, FNfloat& y) ++ void TransformDomainWarpCoordinate(FNfloat& x, FNfloat& y) const + { + switch (mDomainWarpType) + { +@@ -777,7 +777,7 @@ private: + } + + template <typename FNfloat> +- void TransformDomainWarpCoordinate(FNfloat& x, FNfloat& y, FNfloat& z) ++ void TransformDomainWarpCoordinate(FNfloat& x, FNfloat& y, FNfloat& z) const + { + switch (mWarpTransformType3D) + { +@@ -844,7 +844,7 @@ private: + // Fractal FBm + + template <typename FNfloat> +- float GenFractalFBm(FNfloat x, FNfloat y) ++ float GenFractalFBm(FNfloat x, FNfloat y) const + { + int seed = mSeed; + float sum = 0; +@@ -865,7 +865,7 @@ private: + } + + template <typename FNfloat> +- float GenFractalFBm(FNfloat x, FNfloat y, FNfloat z) ++ float GenFractalFBm(FNfloat x, FNfloat y, FNfloat z) const + { + int seed = mSeed; + float sum = 0; +@@ -890,7 +890,7 @@ private: + // Fractal Ridged + + template <typename FNfloat> +- float GenFractalRidged(FNfloat x, FNfloat y) ++ float GenFractalRidged(FNfloat x, FNfloat y) const + { + int seed = mSeed; + float sum = 0; +@@ -911,7 +911,7 @@ private: + } + + template <typename FNfloat> +- float GenFractalRidged(FNfloat x, FNfloat y, FNfloat z) ++ float GenFractalRidged(FNfloat x, FNfloat y, FNfloat z) const + { + int seed = mSeed; + float sum = 0; +@@ -936,7 +936,7 @@ private: + // Fractal PingPong + + template <typename FNfloat> +- float GenFractalPingPong(FNfloat x, FNfloat y) ++ float GenFractalPingPong(FNfloat x, FNfloat y) const + { + int seed = mSeed; + float sum = 0; +@@ -957,7 +957,7 @@ private: + } + + template <typename FNfloat> +- float GenFractalPingPong(FNfloat x, FNfloat y, FNfloat z) ++ float GenFractalPingPong(FNfloat x, FNfloat y, FNfloat z) const + { + int seed = mSeed; + float sum = 0; +@@ -982,7 +982,7 @@ private: + // Simplex/OpenSimplex2 Noise + + template <typename FNfloat> +- float SingleSimplex(int seed, FNfloat x, FNfloat y) ++ float SingleSimplex(int seed, FNfloat x, FNfloat y) const + { + // 2D OpenSimplex2 case uses the same algorithm as ordinary Simplex. + +@@ -1053,7 +1053,7 @@ private: + } + + template <typename FNfloat> +- float SingleOpenSimplex2(int seed, FNfloat x, FNfloat y, FNfloat z) ++ float SingleOpenSimplex2(int seed, FNfloat x, FNfloat y, FNfloat z) const + { + // 3D OpenSimplex2 case uses two offset rotated cube grids. + +@@ -1155,7 +1155,7 @@ private: + // OpenSimplex2S Noise + + template <typename FNfloat> +- float SingleOpenSimplex2S(int seed, FNfloat x, FNfloat y) ++ float SingleOpenSimplex2S(int seed, FNfloat x, FNfloat y) const + { + // 2D OpenSimplex2S case is a modified 2D simplex noise. + +@@ -1286,7 +1286,7 @@ private: + } + + template <typename FNfloat> +- float SingleOpenSimplex2S(int seed, FNfloat x, FNfloat y, FNfloat z) ++ float SingleOpenSimplex2S(int seed, FNfloat x, FNfloat y, FNfloat z) const + { + // 3D OpenSimplex2S case uses two offset rotated cube grids. + +@@ -1482,7 +1482,7 @@ private: + // Cellular Noise + + template <typename FNfloat> +- float SingleCellular(int seed, FNfloat x, FNfloat y) ++ float SingleCellular(int seed, FNfloat x, FNfloat y) const + { + int xr = FastRound(x); + int yr = FastRound(y); +@@ -1612,7 +1612,7 @@ private: + } + + template <typename FNfloat> +- float SingleCellular(int seed, FNfloat x, FNfloat y, FNfloat z) ++ float SingleCellular(int seed, FNfloat x, FNfloat y, FNfloat z) const + { + int xr = FastRound(x); + int yr = FastRound(y); +@@ -1769,7 +1769,7 @@ private: + // Perlin Noise + + template <typename FNfloat> +- float SinglePerlin(int seed, FNfloat x, FNfloat y) ++ float SinglePerlin(int seed, FNfloat x, FNfloat y) const + { + int x0 = FastFloor(x); + int y0 = FastFloor(y); +@@ -1794,7 +1794,7 @@ private: + } + + template <typename FNfloat> +- float SinglePerlin(int seed, FNfloat x, FNfloat y, FNfloat z) ++ float SinglePerlin(int seed, FNfloat x, FNfloat y, FNfloat z) const + { + int x0 = FastFloor(x); + int y0 = FastFloor(y); +@@ -1833,7 +1833,7 @@ private: + // Value Cubic Noise + + template <typename FNfloat> +- float SingleValueCubic(int seed, FNfloat x, FNfloat y) ++ float SingleValueCubic(int seed, FNfloat x, FNfloat y) const + { + int x1 = FastFloor(x); + int y1 = FastFloor(y); +@@ -1863,7 +1863,7 @@ private: + } + + template <typename FNfloat> +- float SingleValueCubic(int seed, FNfloat x, FNfloat y, FNfloat z) ++ float SingleValueCubic(int seed, FNfloat x, FNfloat y, FNfloat z) const + { + int x1 = FastFloor(x); + int y1 = FastFloor(y); +@@ -1920,7 +1920,7 @@ private: + // Value Noise + + template <typename FNfloat> +- float SingleValue(int seed, FNfloat x, FNfloat y) ++ float SingleValue(int seed, FNfloat x, FNfloat y) const + { + int x0 = FastFloor(x); + int y0 = FastFloor(y); +@@ -1940,7 +1940,7 @@ private: + } + + template <typename FNfloat> +- float SingleValue(int seed, FNfloat x, FNfloat y, FNfloat z) ++ float SingleValue(int seed, FNfloat x, FNfloat y, FNfloat z) const + { + int x0 = FastFloor(x); + int y0 = FastFloor(y); +@@ -1972,7 +1972,7 @@ private: + // Domain Warp + + template <typename FNfloat> +- void DoSingleDomainWarp(int seed, float amp, float freq, FNfloat x, FNfloat y, FNfloat& xr, FNfloat& yr) ++ void DoSingleDomainWarp(int seed, float amp, float freq, FNfloat x, FNfloat y, FNfloat& xr, FNfloat& yr) const + { + switch (mDomainWarpType) + { +@@ -1989,7 +1989,7 @@ private: + } + + template <typename FNfloat> +- void DoSingleDomainWarp(int seed, float amp, float freq, FNfloat x, FNfloat y, FNfloat z, FNfloat& xr, FNfloat& yr, FNfloat& zr) ++ void DoSingleDomainWarp(int seed, float amp, float freq, FNfloat x, FNfloat y, FNfloat z, FNfloat& xr, FNfloat& yr, FNfloat& zr) const + { + switch (mDomainWarpType) + { +@@ -2009,7 +2009,7 @@ private: + // Domain Warp Single Wrapper + + template <typename FNfloat> +- void DomainWarpSingle(FNfloat& x, FNfloat& y) ++ void DomainWarpSingle(FNfloat& x, FNfloat& y) const + { + int seed = mSeed; + float amp = mDomainWarpAmp * mFractalBounding; +@@ -2023,7 +2023,7 @@ private: + } + + template <typename FNfloat> +- void DomainWarpSingle(FNfloat& x, FNfloat& y, FNfloat& z) ++ void DomainWarpSingle(FNfloat& x, FNfloat& y, FNfloat& z) const + { + int seed = mSeed; + float amp = mDomainWarpAmp * mFractalBounding; +@@ -2041,7 +2041,7 @@ private: + // Domain Warp Fractal Progressive + + template <typename FNfloat> +- void DomainWarpFractalProgressive(FNfloat& x, FNfloat& y) ++ void DomainWarpFractalProgressive(FNfloat& x, FNfloat& y) const + { + int seed = mSeed; + float amp = mDomainWarpAmp * mFractalBounding; +@@ -2062,7 +2062,7 @@ private: + } + + template <typename FNfloat> +- void DomainWarpFractalProgressive(FNfloat& x, FNfloat& y, FNfloat& z) ++ void DomainWarpFractalProgressive(FNfloat& x, FNfloat& y, FNfloat& z) const + { + int seed = mSeed; + float amp = mDomainWarpAmp * mFractalBounding; +@@ -2087,7 +2087,7 @@ private: + // Domain Warp Fractal Independant + + template <typename FNfloat> +- void DomainWarpFractalIndependent(FNfloat& x, FNfloat& y) ++ void DomainWarpFractalIndependent(FNfloat& x, FNfloat& y) const + { + FNfloat xs = x; + FNfloat ys = y; +@@ -2108,7 +2108,7 @@ private: + } + + template <typename FNfloat> +- void DomainWarpFractalIndependent(FNfloat& x, FNfloat& y, FNfloat& z) ++ void DomainWarpFractalIndependent(FNfloat& x, FNfloat& y, FNfloat& z) const + { + FNfloat xs = x; + FNfloat ys = y; +@@ -2133,7 +2133,7 @@ private: + // Domain Warp Basic Grid + + template <typename FNfloat> +- void SingleDomainWarpBasicGrid(int seed, float warpAmp, float frequency, FNfloat x, FNfloat y, FNfloat& xr, FNfloat& yr) ++ void SingleDomainWarpBasicGrid(int seed, float warpAmp, float frequency, FNfloat x, FNfloat y, FNfloat& xr, FNfloat& yr) const + { + FNfloat xf = x * frequency; + FNfloat yf = y * frequency; +@@ -2166,7 +2166,7 @@ private: + } + + template <typename FNfloat> +- void SingleDomainWarpBasicGrid(int seed, float warpAmp, float frequency, FNfloat x, FNfloat y, FNfloat z, FNfloat& xr, FNfloat& yr, FNfloat& zr) ++ void SingleDomainWarpBasicGrid(int seed, float warpAmp, float frequency, FNfloat x, FNfloat y, FNfloat z, FNfloat& xr, FNfloat& yr, FNfloat& zr) const + { + FNfloat xf = x * frequency; + FNfloat yf = y * frequency; +@@ -2228,7 +2228,7 @@ private: + // Domain Warp Simplex/OpenSimplex2 + + template <typename FNfloat> +- void SingleDomainWarpSimplexGradient(int seed, float warpAmp, float frequency, FNfloat x, FNfloat y, FNfloat& xr, FNfloat& yr, bool outGradOnly) ++ void SingleDomainWarpSimplexGradient(int seed, float warpAmp, float frequency, FNfloat x, FNfloat y, FNfloat& xr, FNfloat& yr, bool outGradOnly) const + { + const float SQRT3 = 1.7320508075688772935274463415059f; + const float G2 = (3 - SQRT3) / 6; +@@ -2326,7 +2326,7 @@ private: + } + + template <typename FNfloat> +- void SingleDomainWarpOpenSimplex2Gradient(int seed, float warpAmp, float frequency, FNfloat x, FNfloat y, FNfloat z, FNfloat& xr, FNfloat& yr, FNfloat& zr, bool outGradOnly) ++ void SingleDomainWarpOpenSimplex2Gradient(int seed, float warpAmp, float frequency, FNfloat x, FNfloat y, FNfloat z, FNfloat& xr, FNfloat& yr, FNfloat& zr, bool outGradOnly) const + { + x *= frequency; + y *= frequency; +@@ -1611,6 +1611,12 @@ private: + } + } + ++// GCC raises warnings when integer overflows occur, which are needed for hashing here. ++#if defined(__GNUC__) && !defined(__clang__) ++#pragma GCC diagnostic push ++#pragma GCC diagnostic ignored "-Waggressive-loop-optimizations" ++#endif ++ + template <typename FNfloat> + float SingleCellular(int seed, FNfloat x, FNfloat y, FNfloat z) const + { +@@ -1765,6 +1771,9 @@ private: + } + } + ++#if defined(__GNUC__) && !defined(__clang__) ++#pragma GCC diagnostic pop ++#endif + + // Perlin Noise +
\ No newline at end of file |