local Noise = require("tofu.generators.noise")
Constructs a noise generator given a type, a seed, and with a given frequency. type
can be perlin
, simplex
, or cellular
. When called without arguments, seed
and frequency
will assume values 0.0
and 1.0
, respectively.
Gets the current noise generator seed. The default value is 0.0
.
Sets the noise generator seed. Any value is permitted.
Gets the current noise generator frequency. The default value is 1.0
.
Sets the noise generator frequency. When passing normalized coordinates to the Noise:generate()
method, the frequency
parameter assumes it’s proper meaning and can be set to values greater than 1.0
. Otherwise, with not-normalized coordinates, the frequency
parameter should be in the range [0, 1]
.
Evaluates the noise function, called with up to three floating-point arguments, and using the current seed
and frequency
parameters. The returned value is in the range [0, 1]
.
It is advisable (but not required) to pass normalized coordinates in the range [0, 1]
. In that case, the frequency
parameter assumes it’s proper meaning and can be set to values greater than 1.0
. Otherwise, with not-normalized coordinates, the frequency
parameter should be in the range [0, 1]
.
The object’s meta-method
__call()
is mapped to this method and can be used as an alternative.