Noise2D

Engine/source/util/noise2d.h

More...

Noise

These functions actually generate noise values into the passed in destination array.

Note that the output values of these functions are from -1.0 to 1.0.

fBm - Fractal Brownian Motion - A simple noise generation algorithm, it tends to generate either flowing rounded hills or rounded mountainous shapes.

fBm(Vector< F32 > * dst, U32 size, U32 interval, F32 h, F32 octave)
rigidMultiFractal(Vector< F32 > * dst, Vector< F32 > * signal, U32 size, U32 interval, F32 h, F32 octave)

rigidMultiFractal Creates ridged mountains with a high frequency detail.

Private Types

enum
Constants {
  SIZE = 0x100
  SIZE_MASK = 0x0ff
}

Private Attributes

mGradient [SIZE+SIZE+2][2]
mPermutation [SIZE+SIZE+2]

Private Functions

dot(const F32 * q, F32 rx, F32 ry)
lerp(F32 t, F32 a, F32 b)
setup(F32 t, S32 & b0, S32 & b1, F32 & r0, F32 & r1)

Public Functions

bool
erodeHydraulic(Vector< F32 > * src, Vector< F32 > * dst, U32 iterations, U32 size)
bool
erodeThermal(Vector< F32 > * src, Vector< F32 > * dst, F32 slope, F32 materialLoss, U32 iterations, U32 size, U32 squareSize, F32 maxHeight)
getMinMax(Vector< F32 > * src, F32 * maxNoise, F32 * minNoise, U32 size)
getValue(F32 u, F32 v, S32 interval)
turbulence(F32 x, F32 y, F32 freq)

Detailed Description

Noise

These functions actually generate noise values into the passed in destination array.

Note that the output values of these functions are from -1.0 to 1.0.

fBm - Fractal Brownian Motion - A simple noise generation algorithm, it tends to generate either flowing rounded hills or rounded mountainous shapes.

fBm(Vector< F32 > * dst, U32 size, U32 interval, F32 h, F32 octave)

rigidMultiFractal(Vector< F32 > * dst, Vector< F32 > * signal, U32 size, U32 interval, F32 h, F32 octave)

rigidMultiFractal Creates ridged mountains with a high frequency detail.

Private Types

Constants

Enumerator

SIZE = 0x100
SIZE_MASK = 0x0ff

Private Attributes

F32 mGradient [SIZE+SIZE+2][2]
S32 mPermutation [SIZE+SIZE+2]
MRandom mRandom 
U32 mSeed 

Private Functions

curve(F32 t)

dot(const F32 * q, F32 rx, F32 ry)

lerp(F32 t, F32 a, F32 b)

normalize(F32 v)

setup(F32 t, S32 & b0, S32 & b1, F32 & r0, F32 & r1)

Public Functions

Noise2D()

~Noise2D()

erodeHydraulic(Vector< F32 > * src, Vector< F32 > * dst, U32 iterations, U32 size)

erodeThermal(Vector< F32 > * src, Vector< F32 > * dst, F32 slope, F32 materialLoss, U32 iterations, U32 size, U32 squareSize, F32 maxHeight)

getMinMax(Vector< F32 > * src, F32 * maxNoise, F32 * minNoise, U32 size)

getSeed()

getValue(F32 u, F32 v, S32 interval)

setSeed(U32 seed)

turbulence(F32 x, F32 y, F32 freq)