float perlinNoise::perlinNoise2D(float x, float y){ float freq = frequency; float amp = amplitude; float total = 0.0f; int n = numberOfOctaves; for(int i=0;i<n;i++){ if (freqOctDep) freq *=2; if(ampOctDep) amp*=persistence; total = total + interpolatedNoise2D(x * freq, y * freq) * amp; } return total; }
T perlinNoise2D(const int x, const int y) { T value = 0.0; T p = persistance; int n = octaveAmount; T freq = frequency; T ampl = amplitude; T z = zoom; for(int i = 0; i < n; ++i) { value += interpolatedNoise2D(x * freq/z, y * freq/z) * ampl; ampl *= p; freq *= 2.0; } return value; }