#include <noise.h>
Static Public Member Functions | |
static MAXON_METHOD NoiseInterface * | Alloc (MAXON_SOURCE_LOCATION_DECLARATION) |
Private Member Functions | |
MAXON_INTERFACE_NONVIRTUAL (NoiseInterface, MAXON_REFERENCE_NORMAL, "net.maxon.render.interface.noise") | |
|
private |
|
static |
allocator for common use.
MAXON_METHOD Result<void> Init | ( | UInt32 | seed, |
Int | permutationTablePower | ||
) |
Initializes the noise. A permutationTablePower of 10 results in 1024 elements, which is a good compromise between too frequent repetition and memory consumption.
[in] | seed | Start value for the random table generation. |
[in] | permutationTablePower | This specifies the size of the permutation table, which will have (2 ^ permutationTablePower) entries. permutationTablePower must be [5..16], otherwise initialization fails. |
MAXON_METHOD UInt32 GetSeed | ( | ) | const |
Returns the seed value the noise was initialized with.
MAXON_METHOD Int GetPermutationTablePower | ( | ) | const |
Returns the power of the permutation table the noise was initialized with.
MAXON_METHOD const BaseArray<UInt16>* GetPermutationTable | ( | ) | const |
Returns a pointer to the permutation table. The table is only valid as long as the class exists and no further Init() is called. All values are read-only. The permutation table has at least (1 << permutationTablePower) entries. Any additional entries are repetitions of the original elements.
MAXON_METHOD Result<void> GetGradientTable | ( | Bool | gradient3D, |
BaseArray< Vector4d32 > & | gradient | ||
) | const |
Fills an array with the gradient data.
[in] | gradient3D | If this parameter is true, the table for the 3D gradient is returned, otherwise a 4D gradient is returned. |
[in] | gradient | The gradient array to fill. |
MAXON_METHOD Result<void> GetFbmTable | ( | FbmTableRef | table, |
BaseArray< Float32 > & | fbm | ||
) | const |
Fills an array with the FBM data. The table must have been initialized with InitFbm, otherwise the function will fail.
[in] | table | Table that was initialized with InitFbm. |
[in] | fbm | The table array to fill. |
MAXON_METHOD const BaseArray<Vector4d32>* GetRandomTable | ( | ) | const |
Returns a pointer to the random point table. Each component of each point is in the range of [0..1]. The table is only valid as long as the class exists and no further Init() is called. All values are read-only. The random table has at least (1 << permutationTablePower) entries. Any additional entries are repetitions of the original elements.
MAXON_METHOD Float32 SNoise | ( | const Vector32 & | p | ) | const |
Calculates an 'Improved Perlin Noise' value for three dimensions. The noise will repeat itself after a distance of (1 << permutationTablePower). Note that calling with Vector4d32 and the fourth (w) component set to zero delivers different results as the 4-dimensional tables are different.
[in] | p | Point for noise calculation. |
MAXON_METHOD Float32 SNoise | ( | const Vector4d32 & | p | ) | const |
Calculates an 'Improved Perlin Noise' value for four dimensions. The noise will repeat itself after a distance of (1 << permutationTablePower).
[in] | p | Point for noise calculation. |
MAXON_FUNCTION Float32 SNoise | ( | const Vector32 & | p, |
Float32 | time | ||
) | const |
Calculates an 'Improved Perlin Noise' value for four dimensions. The noise will repeat itself after a distance of (1 << permutationTablePower). This is a convenience function that assigns the time to the fourth (w) component.
[in] | p | Point for noise calculation. |
[in] | time | Time (fourth dimension) for noise calculation. |
MAXON_METHOD Float32 PeriodicSNoise | ( | const Vector32 & | p, |
Int | repeatX, | ||
Int | repeatY, | ||
Int | repeatZ | ||
) | const |
Calculates a periodic 'Improved Perlin Noise' value for three dimensions. The noise will repeat itself after a distance of repeatX/repeatY/repeatZ. Note that calling with Vector4d32 and the fourth (w) component set to zero delivers different results as the 4-dimensional tables are different. Periodic noise is more than 2x slower than regular noise. If you have repetitions that are a power of 2 use a noise with fitting permutationTable instead.
[in] | p | Point for noise calculation. |
[in] | repeatX | X repetition. Needs to be in the range of [2..(1 << permutationTablePower)]. |
[in] | repeatY | Y repetition. Needs to be in the range of [2..(1 << permutationTablePower)]. |
[in] | repeatZ | Z repetition. Needs to be in the range of [2..(1 << permutationTablePower)]. |
MAXON_METHOD Float32 PeriodicSNoise | ( | const Vector4d32 & | p, |
Int | repeatX, | ||
Int | repeatY, | ||
Int | repeatZ, | ||
Int | repeatT | ||
) | const |
Calculates a periodic 'Improved Perlin Noise' value for four dimensions. The noise will repeat itself after a distance of repeatX/repeatY/repeatZ/repeatT. Periodic noise is more than 2x slower than regular noise. If you have repetitions that are a power of 2 use a noise with fitting permutationTable instead.
[in] | p | Point for noise calculation. |
[in] | repeatX | X repetition. Needs to be in the range of [2..(1 << permutationTablePower)]. |
[in] | repeatY | Y repetition. Needs to be in the range of [2..(1 << permutationTablePower)]. |
[in] | repeatZ | Z repetition. Needs to be in the range of [2..(1 << permutationTablePower)]. |
[in] | repeatT | T repetition. Needs to be in the range of [2..(1 << permutationTablePower)]. |
MAXON_METHOD void Voronoi | ( | const Vector32 & | p, |
Int | maximumOrder, | ||
Float32 * | distance, | ||
Int32 * | index | ||
) | const |
Calculates voronoi noise for three dimensions. The noise will repeat itself after a distance of (1 << permutationTablePower). Make sure to choose maximumOrder as small as possible to optimize speed. Also passing nullptr for index will increase calculation speed. Note that calling with Vector4d32 and the fourth (w) component set to zero delivers different results as the 4-dimensional tables are different.
[in] | p | Point for noise calculation. |
[in] | maximumOrder | Maximum order that will be calculated. This value must be in the range [1..3], otherwise undefined behaviour will happen. |
[out] | distance | Pointer to an array that will be filled with distance values. It is guaranteed that distance[i] <= distance[i + 1]. The array must at least have maximumOrder elements, otherwise the routine will crash. |
[out] | index | Nullptr or pointer to an array that will be filled with indices to the noise permutation table that correspond to the distance values. The array must at least have maximumOrder elements, otherwise the routine will crash. |
MAXON_METHOD void Voronoi | ( | const Vector4d32 & | p, |
Int | maximumOrder, | ||
Float32 * | distance, | ||
Int32 * | index | ||
) | const |
Calculates voronoi noise for four dimensions. The noise will repeat itself after a distance of (1 << permutationTablePower). Make sure to choose maximumOrder as small as possible to optimize speed. Also passing nullptr for index will increase calculation speed.
[in] | p | Point for noise calculation. |
[in] | maximumOrder | Maximum order that will be calculated. This value must be in the range [1..3], otherwise undefined behaviour will happen. |
[out] | distance | Pointer to an array that will be filled with distance values. It is guaranteed that distance[i] <= distance[i + 1]. The array must at least have maximumOrder elements, otherwise the routine will crash. |
[out] | index | Nullptr or pointer to an array that will be filled with indices to the noise permutation table that correspond to the distance values. The array must at least have maximumOrder elements, otherwise the routine will crash. |
MAXON_METHOD ResultMemT<FbmTableRef> InitFbm | ( | Float32 | lacunarity, |
Float32 | gain | ||
) | const |
Initializes the Fractal Brownian Motion coefficients. The standard is lacunarity 2.0 and gain 0.5. http://code.google.com/p/fractalterraingeneration/wiki/Fractional_Brownian_Motion.
[in] | lacunarity | Frequency multiplier between successive octaves, must be >0.0. A lacunarity of 2.0 means that the frequency doubles each octave. |
[in] | gain | Value that shrinks the amplitude. Each octave the amplitude is multiplied by the gain. Values need to be >0.0. |
MAXON_METHOD Float32 Fbm | ( | FbmTableRef | table, |
Vector32 | p, | ||
Float32 | octaves | ||
) | const |
Calculates Fractal Brownian Motion noise.
[in] | table | Table that was initialized with InitFbm. |
[in] | p | Point for noise calculation. |
[in] | octaves | Number of octaves to be calculated in the range of [0..15]. The higher the number, the more computationally expensive the function. |
MAXON_METHOD Float32 Fbm | ( | FbmTableRef | table, |
Vector4d32 | p, | ||
Float32 | octaves | ||
) | const |
Calculates Fractal Brownian Motion noise. Note that calling with Vector4d32 and the fourth (w) component set to zero delivers different results as the 4-dimensional tables are different.
[in] | table | Table that was initialized with InitFbm. |
[in] | p | Point for noise calculation. |
[in] | octaves | Number of octaves to be calculated in the range of [0..15]. The higher the number, the more computationally expensive the function. |
MAXON_METHOD Float32 Turbulence | ( | Vector32 | p, |
Float32 | octaves, | ||
Bool | absolute | ||
) | const |
Calculates Perlin's Turbulence function. Note that calling with Vector4d32 and the fourth (w) component set to zero delivers different results as the 4-dimensional tables are different.
[in] | p | Point for noise calculation. |
[in] | octaves | Number of octaves to be calculated. The higher the number, the more computationally expensive the function. |
[in] | absolute | If true the absolute values of each octave are summed. |
MAXON_METHOD Float32 Turbulence | ( | Vector4d32 | p, |
Float32 | octaves, | ||
Bool | absolute | ||
) | const |
Calculates Perlin's Turbulence function.
[in] | p | Point for noise calculation. |
[in] | octaves | Number of octaves to be calculated. The higher the number, the more computationally expensive the function. |
[in] | absolute | If true the absolute values of each octave are summed. |
MAXON_METHOD Float32 RidgedMultifractal | ( | FbmTableRef | table, |
Vector32 | p, | ||
Float32 | octaves, | ||
Float32 | offset, | ||
Float32 | threshold | ||
) | const |
Calculates Musgraves Ridged Multifractal function. Note that calling with Vector4d32 and the fourth (w) component set to zero delivers different results as the 4-dimensional tables are different.
[in] | table | Table that was initialized with InitFbm. |
[in] | p | Point for noise calculation. |
[in] | octaves | Number of octaves to be calculated. The higher the number, the more computationally expensive the function. |
[in] | offset | Must be >0.0. Offset where the details begin to ramp sharply. A good start value is 1.0. |
[in] | threshold | Must be >0.0. The higher the value, the more sharp details / peaks. A good start value is 2.0. |
MAXON_METHOD Float32 RidgedMultifractal | ( | FbmTableRef | table, |
Vector4d32 | p, | ||
Float32 | octaves, | ||
Float32 | offset, | ||
Float32 | threshold | ||
) | const |
Calculates Musgraves Ridged Multifractal function.
[in] | table | Table that was initialized with InitFbm. |
[in] | p | Point for noise calculation. |
[in] | octaves | Number of octaves to be calculated. The higher the number, the more computationally expensive the function. |
[in] | offset | Must be >0.0. Offset where the details begin to ramp sharply. A good start value is 1.0. |
[in] | threshold | Must be >0.0. The higher the value, the more sharp details / peaks. A good start value is 2.0. |