From 1cb0bf70c72c33ba4e5112e407589388b3f9755d Mon Sep 17 00:00:00 2001 From: Quentin Bazin Date: Tue, 14 Nov 2023 14:38:40 +0100 Subject: [PATCH] [FastNoiseLite] Updated. --- external/FastNoiseLite/FastNoiseLite.hpp | 110 +++++++++++------------ 1 file changed, 55 insertions(+), 55 deletions(-) diff --git a/external/FastNoiseLite/FastNoiseLite.hpp b/external/FastNoiseLite/FastNoiseLite.hpp index a08bfde0..04fceb66 100644 --- a/external/FastNoiseLite/FastNoiseLite.hpp +++ b/external/FastNoiseLite/FastNoiseLite.hpp @@ -1,7 +1,7 @@ // MIT License // -// Copyright(c) 2020 Jordan Peck (jordan.me2@gmail.com) -// Copyright(c) 2020 Contributors +// Copyright(c) 2023 Jordan Peck (jordan.me2@gmail.com) +// Copyright(c) 2023 Contributors // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files(the "Software"), to deal @@ -44,8 +44,8 @@ // ....',;:codxkO000OOxdoc:;,''',,,;;;;,''.......',,;:clodkO00000Okxolc::;,,''..',;:ldxOKXNWWWNNK0OkkkkkkkkkkkxxddooooodxxkOOOOO000 // ....',;;clodxkkOOOkkdolc:;,,,,,,,,'..........,;:clodxkO0KKXKK0Okxdolcc::;;,,,;;:codkO0XXNNNNXKK0OOOOOkkkkxxdoollloodxkO0KKKXXXXX // -// VERSION: 1.0.1 -// https://github.com/Auburn/FastNoise +// VERSION: 1.1.0 +// https://github.com/Auburn/FastNoiseLite #ifndef FASTNOISELITE_H #define FASTNOISELITE_H @@ -124,7 +124,7 @@ class FastNoiseLite mLacunarity = 2.0f; mGain = 0.5f; mWeightedStrength = 0.0f; - mPingPongStength = 2.0f; + mPingPongStrength = 2.0f; mFractalBounding = 1 / 1.75f; @@ -235,7 +235,7 @@ class FastNoiseLite /// /// Default: 2.0 /// - void SetFractalPingPongStrength(float pingPongStrength) { mPingPongStength = pingPongStrength; } + void SetFractalPingPongStrength(float pingPongStrength) { mPingPongStrength = pingPongStrength; } /// @@ -293,7 +293,7 @@ class FastNoiseLite /// Noise output bounded between -1...1 /// template - float GetNoise(FNfloat x, FNfloat y) + float GetNoise(FNfloat x, FNfloat y) const { Arguments_must_be_floating_point_values(); @@ -319,7 +319,7 @@ class FastNoiseLite /// Noise output bounded between -1...1 /// template - float GetNoise(FNfloat x, FNfloat y, FNfloat z) + float GetNoise(FNfloat x, FNfloat y, FNfloat z) const { Arguments_must_be_floating_point_values(); @@ -348,7 +348,7 @@ class FastNoiseLite /// noise = GetNoise(x, y) /// template - void DomainWarp(FNfloat& x, FNfloat& y) + void DomainWarp(FNfloat& x, FNfloat& y) const { Arguments_must_be_floating_point_values(); @@ -375,7 +375,7 @@ class FastNoiseLite /// noise = GetNoise(x, y, z) /// template - void DomainWarp(FNfloat& x, FNfloat& y, FNfloat& z) + void DomainWarp(FNfloat& x, FNfloat& y, FNfloat& z) const { Arguments_must_be_floating_point_values(); @@ -416,7 +416,7 @@ class FastNoiseLite float mLacunarity; float mGain; float mWeightedStrength; - float mPingPongStength; + float mPingPongStrength; float mFractalBounding; @@ -526,7 +526,7 @@ class FastNoiseLite } - 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; @@ -539,7 +539,7 @@ class FastNoiseLite } - 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; @@ -553,7 +553,7 @@ class FastNoiseLite } - 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); @@ -562,7 +562,7 @@ class FastNoiseLite } - 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); @@ -572,7 +572,7 @@ class FastNoiseLite } - 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); @@ -590,7 +590,7 @@ class FastNoiseLite } - 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); @@ -614,7 +614,7 @@ class FastNoiseLite // Generic noise gen template - float GenNoiseSingle(int seed, FNfloat x, FNfloat y) + float GenNoiseSingle(int seed, FNfloat x, FNfloat y) const { switch (mNoiseType) { @@ -636,7 +636,7 @@ class FastNoiseLite } template - float GenNoiseSingle(int seed, FNfloat x, FNfloat y, FNfloat z) + float GenNoiseSingle(int seed, FNfloat x, FNfloat y, FNfloat z) const { switch (mNoiseType) { @@ -661,7 +661,7 @@ class FastNoiseLite // Noise Coordinate Transforms (frequency, and possible skew or rotation) template - void TransformNoiseCoordinate(FNfloat& x, FNfloat& y) + void TransformNoiseCoordinate(FNfloat& x, FNfloat& y) const { x *= mFrequency; y *= mFrequency; @@ -684,7 +684,7 @@ class FastNoiseLite } template - void TransformNoiseCoordinate(FNfloat& x, FNfloat& y, FNfloat& z) + void TransformNoiseCoordinate(FNfloat& x, FNfloat& y, FNfloat& z) const { x *= mFrequency; y *= mFrequency; @@ -755,7 +755,7 @@ class FastNoiseLite // Domain Warp Coordinate Transforms template - void TransformDomainWarpCoordinate(FNfloat& x, FNfloat& y) + void TransformDomainWarpCoordinate(FNfloat& x, FNfloat& y) const { switch (mDomainWarpType) { @@ -775,7 +775,7 @@ class FastNoiseLite } template - void TransformDomainWarpCoordinate(FNfloat& x, FNfloat& y, FNfloat& z) + void TransformDomainWarpCoordinate(FNfloat& x, FNfloat& y, FNfloat& z) const { switch (mWarpTransformType3D) { @@ -842,7 +842,7 @@ class FastNoiseLite // Fractal FBm template - float GenFractalFBm(FNfloat x, FNfloat y) + float GenFractalFBm(FNfloat x, FNfloat y) const { int seed = mSeed; float sum = 0; @@ -863,7 +863,7 @@ class FastNoiseLite } template - float GenFractalFBm(FNfloat x, FNfloat y, FNfloat z) + float GenFractalFBm(FNfloat x, FNfloat y, FNfloat z) const { int seed = mSeed; float sum = 0; @@ -888,7 +888,7 @@ class FastNoiseLite // Fractal Ridged template - float GenFractalRidged(FNfloat x, FNfloat y) + float GenFractalRidged(FNfloat x, FNfloat y) const { int seed = mSeed; float sum = 0; @@ -909,7 +909,7 @@ class FastNoiseLite } template - float GenFractalRidged(FNfloat x, FNfloat y, FNfloat z) + float GenFractalRidged(FNfloat x, FNfloat y, FNfloat z) const { int seed = mSeed; float sum = 0; @@ -934,7 +934,7 @@ class FastNoiseLite // Fractal PingPong template - float GenFractalPingPong(FNfloat x, FNfloat y) + float GenFractalPingPong(FNfloat x, FNfloat y) const { int seed = mSeed; float sum = 0; @@ -942,7 +942,7 @@ class FastNoiseLite for (int i = 0; i < mOctaves; i++) { - float noise = PingPong((GenNoiseSingle(seed++, x, y) + 1) * mPingPongStength); + float noise = PingPong((GenNoiseSingle(seed++, x, y) + 1) * mPingPongStrength); sum += (noise - 0.5f) * 2 * amp; amp *= Lerp(1.0f, noise, mWeightedStrength); @@ -955,7 +955,7 @@ class FastNoiseLite } template - float GenFractalPingPong(FNfloat x, FNfloat y, FNfloat z) + float GenFractalPingPong(FNfloat x, FNfloat y, FNfloat z) const { int seed = mSeed; float sum = 0; @@ -963,7 +963,7 @@ class FastNoiseLite for (int i = 0; i < mOctaves; i++) { - float noise = PingPong((GenNoiseSingle(seed++, x, y, z) + 1) * mPingPongStength); + float noise = PingPong((GenNoiseSingle(seed++, x, y, z) + 1) * mPingPongStrength); sum += (noise - 0.5f) * 2 * amp; amp *= Lerp(1.0f, noise, mWeightedStrength); @@ -980,7 +980,7 @@ class FastNoiseLite // Simplex/OpenSimplex2 Noise template - 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. @@ -1051,7 +1051,7 @@ class FastNoiseLite } template - 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. @@ -1153,7 +1153,7 @@ class FastNoiseLite // OpenSimplex2S Noise template - 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. @@ -1284,7 +1284,7 @@ class FastNoiseLite } template - 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. @@ -1480,7 +1480,7 @@ class FastNoiseLite // Cellular Noise template - 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); @@ -1610,7 +1610,7 @@ class FastNoiseLite } template - 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); @@ -1767,7 +1767,7 @@ class FastNoiseLite // Perlin Noise template - 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); @@ -1792,7 +1792,7 @@ class FastNoiseLite } template - 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); @@ -1831,7 +1831,7 @@ class FastNoiseLite // Value Cubic Noise template - 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); @@ -1861,7 +1861,7 @@ class FastNoiseLite } template - 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); @@ -1918,7 +1918,7 @@ class FastNoiseLite // Value Noise template - 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); @@ -1938,7 +1938,7 @@ class FastNoiseLite } template - 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); @@ -1970,7 +1970,7 @@ class FastNoiseLite // Domain Warp template - 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) { @@ -1987,7 +1987,7 @@ class FastNoiseLite } template - 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) { @@ -2007,7 +2007,7 @@ class FastNoiseLite // Domain Warp Single Wrapper template - void DomainWarpSingle(FNfloat& x, FNfloat& y) + void DomainWarpSingle(FNfloat& x, FNfloat& y) const { int seed = mSeed; float amp = mDomainWarpAmp * mFractalBounding; @@ -2021,7 +2021,7 @@ class FastNoiseLite } template - void DomainWarpSingle(FNfloat& x, FNfloat& y, FNfloat& z) + void DomainWarpSingle(FNfloat& x, FNfloat& y, FNfloat& z) const { int seed = mSeed; float amp = mDomainWarpAmp * mFractalBounding; @@ -2039,7 +2039,7 @@ class FastNoiseLite // Domain Warp Fractal Progressive template - void DomainWarpFractalProgressive(FNfloat& x, FNfloat& y) + void DomainWarpFractalProgressive(FNfloat& x, FNfloat& y) const { int seed = mSeed; float amp = mDomainWarpAmp * mFractalBounding; @@ -2060,7 +2060,7 @@ class FastNoiseLite } template - void DomainWarpFractalProgressive(FNfloat& x, FNfloat& y, FNfloat& z) + void DomainWarpFractalProgressive(FNfloat& x, FNfloat& y, FNfloat& z) const { int seed = mSeed; float amp = mDomainWarpAmp * mFractalBounding; @@ -2085,7 +2085,7 @@ class FastNoiseLite // Domain Warp Fractal Independant template - void DomainWarpFractalIndependent(FNfloat& x, FNfloat& y) + void DomainWarpFractalIndependent(FNfloat& x, FNfloat& y) const { FNfloat xs = x; FNfloat ys = y; @@ -2106,7 +2106,7 @@ class FastNoiseLite } template - void DomainWarpFractalIndependent(FNfloat& x, FNfloat& y, FNfloat& z) + void DomainWarpFractalIndependent(FNfloat& x, FNfloat& y, FNfloat& z) const { FNfloat xs = x; FNfloat ys = y; @@ -2131,7 +2131,7 @@ class FastNoiseLite // Domain Warp Basic Grid template - 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; @@ -2164,7 +2164,7 @@ class FastNoiseLite } template - 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; @@ -2226,7 +2226,7 @@ class FastNoiseLite // Domain Warp Simplex/OpenSimplex2 template - 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; @@ -2324,7 +2324,7 @@ class FastNoiseLite } template - 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;