MCPcopy Create free account
hub / github.com/OpenFodder/openfodder / fractalXYZ

Method fractalXYZ

Source/Utils/SimplexNoise.cpp:461–476  ·  view source on GitHub ↗

* Fractal/Fractional Brownian Motion (fBm) summation of 3D Perlin Simplex noise * * @param[in] octaves number of fraction of noise to sum * @param[in] x x float coordinate * @param[in] y y float coordinate * @param[in] z z float coordinate * * @return Noise value in the range[-1; 1], value of 0 on all integer coordinates. */

Source from the content-addressed store, hash-verified

459 * @return Noise value in the range[-1; 1], value of 0 on all integer coordinates.
460 */
461float SimplexNoise::fractalXYZ(size_t octaves, float x, float y, float z) {
462 float output = 0.f;
463 float denom = 0.f;
464 float frequency = mFrequency;
465 float amplitude = mAmplitude;
466
467 for (size_t i = 0; i < octaves; i++) {
468 output += (amplitude * noiseXYZ(x * frequency, y * frequency, z * frequency));
469 denom += amplitude;
470
471 frequency *= mLacunarity;
472 amplitude *= mPersistence;
473 }
474
475 return (output / denom);
476}
477
478std::vector<std::vector<float>> SimplexNoise::create(size_t pWidth, size_t pHeight, size_t pOctaves) {
479

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected