-
首页
-
C4D R23.110 C++ SDK
#include <noise.h>
公共成员函数
|
MAXON_METHOD
Result
< void >
|
Init
(
UInt32
seed,
Int
permutationTablePower)
|
MAXON_METHOD
UInt32
|
GetSeed
() const
|
MAXON_METHOD
Int
|
GetPermutationTablePower
() const
|
const
MAXON_METHOD
BaseArray
<
UInt16
> *
|
GetPermutationTable
() const
|
MAXON_METHOD
Result
< void >
|
GetGradientTable
(
Bool
gradient3D,
BaseArray
<
Vector4d32
> &gradient) const
|
MAXON_METHOD
Result
< void >
|
GetFbmTable
(
FbmTableRef
table,
BaseArray
<
Float32
> &fbm) const
|
const
MAXON_METHOD
BaseArray
<
Vector4d32
> *
|
GetRandomTable
() const
|
MAXON_METHOD
Float32
|
SNoise
(const
Vector32
&p) const
|
MAXON_METHOD
Float32
|
SNoise
(const
Vector4d32
&p) const
|
MAXON_FUNCTION
Float32
|
SNoise
(const
Vector32
&p,
Float32
time) const
|
MAXON_METHOD
Float32
|
PeriodicSNoise
(const
Vector32
&p,
Int
repeatX,
Int
repeatY,
Int
repeatZ) const
|
MAXON_METHOD
Float32
|
PeriodicSNoise
(const
Vector4d32
&p,
Int
repeatX,
Int
repeatY,
Int
repeatZ,
Int
repeatT) const
|
MAXON_METHOD
void
|
Voronoi
(const
Vector32
&p,
Int
maximumOrder,
Float32
*distance,
Int32
*index) const
|
MAXON_METHOD
void
|
Voronoi
(const
Vector4d32
&p,
Int
maximumOrder,
Float32
*distance,
Int32
*index) const
|
MAXON_METHOD
ResultMemT
<
FbmTableRef
>
|
InitFbm
(
Float32
lacunarity,
Float32
gain) const
|
MAXON_METHOD
Float32
|
Fbm
(
FbmTableRef
table,
Vector32
p,
Float32
octaves) const
|
MAXON_METHOD
Float32
|
Fbm
(
FbmTableRef
table,
Vector4d32
p,
Float32
octaves) const
|
MAXON_METHOD
Float32
|
Turbulence
(
Vector32
p,
Float32
octaves,
Bool
absolute) const
|
MAXON_METHOD
Float32
|
Turbulence
(
Vector4d32
p,
Float32
octaves,
Bool
absolute) const
|
MAXON_METHOD
Float32
|
RidgedMultifractal
(
FbmTableRef
table,
Vector32
p,
Float32
octaves,
Float32
offset,
Float32
threshold) const
|
MAXON_METHOD
Float32
|
RidgedMultifractal
(
FbmTableRef
table,
Vector4d32
p,
Float32
octaves,
Float32
offset,
Float32
threshold) const
|
成员函数文档编制
◆
MAXON_INTERFACE_NONVIRTUAL()
◆
Alloc()
allocator for common use.
◆
Init()
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.
|
-
返回
-
OK on success. IllegalArgumentError is returned if the permutationTablePower was out of range.
◆
GetSeed()
Returns the seed value the noise was initialized with.
-
返回
-
Seed value of that was passed to
Init()
or 0 if noise was not initialized.
◆
GetPermutationTablePower()
Returns the power of the permutation table the noise was initialized with.
-
返回
-
Value that was passed to
Init()
or 0 if noise was not initialized.
◆
GetPermutationTable()
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.
-
返回
-
The permutation table or nullptr if noise was not initialized. Ownership doesn't change - the table is still owned by the NoiseRef class.
◆
GetGradientTable()
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.
|
-
返回
-
OK on success.
◆
GetFbmTable()
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.
|
-
返回
-
OK on success.
◆
GetRandomTable()
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.
-
返回
-
The random table or nullptr if noise was not initialized. Ownership doesn't change - the table is still owned by the NoiseRef class.
◆
SNoise()
[1/3]
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.
|
-
返回
-
Noise value in the range of [-1..1]
◆
SNoise()
[2/3]
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.
|
-
返回
-
Noise value in the range of [-1..1]
◆
SNoise()
[3/3]
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.
|
-
返回
-
Noise value in the range of [-1..1]
◆
PeriodicSNoise()
[1/2]
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)].
|
-
返回
-
Noise value in the range of [-1..1]
◆
PeriodicSNoise()
[2/2]
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)].
|
-
返回
-
Noise value in the range of [-1..1]
◆
Voronoi()
[1/2]
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.
|
◆
Voronoi()
[2/2]
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.
|
◆
InitFbm()
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.
|
-
返回
-
Reference to precomputed Fbm coefficients or nullptr if not enough memory.
◆
Fbm()
[1/2]
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.
|
-
返回
-
Noise value. The range dependens on the values passed to InitFbm.
◆
Fbm()
[2/2]
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.
|
-
返回
-
Noise value. The range dependens on the values passed to InitFbm.
◆
Turbulence()
[1/2]
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.
|
-
返回
-
Turbulence value, in the range of [-1.75..1.75]
◆
Turbulence()
[2/2]
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.
|
-
返回
-
Turbulence value, in the range of [-1.75..1.75]
◆
RidgedMultifractal()
[1/2]
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.
|
-
返回
-
Multifractal value. The range depends on the used parameters.
◆
RidgedMultifractal()
[2/2]
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.
|
-
返回
-
Multifractal value. The range depends on the used parameters.