VOX
A little voxel engine
|
Perlin noise generator. More...
#include <Perlin.hpp>
Public Member Functions | |
Perlin (unsigned int seed) | |
Construct a new Perlin object. More... | |
Perlin (unsigned int seed, int octaves, float frequency, float persistence, float lacunarity) | |
Construct a new Perlin object. More... | |
float | noise (const float &x) const |
generate 1D Perlin noise in the range [-1, 1] More... | |
float | noise (const glm::vec2 &v) const |
generate 2D Perlin noise in the range [-1, 1] More... | |
float | noise (const glm::vec3 &v) const |
generate 3D Perlin noise in the range [-1, 1] More... | |
Perlin noise generator.
This class is a Perlin noise generator. It can generate 1D, 2D and 3D Perlin noise. It will return a value in the range [-1, 1].
Perlin::Perlin | ( | unsigned int | seed | ) |
Construct a new Perlin object.
seed | The seed to use to generate the noise, the same params with the same seed will always return the same value |
Perlin::Perlin | ( | unsigned int | seed, |
int | octaves, | ||
float | frequency, | ||
float | persistence, | ||
float | lacunarity | ||
) |
Construct a new Perlin object.
This constructor allows to tune the noise generation, it is highly recommended to read this, http://campi3d.com/External/MariExtensionPack/userGuide5R8/Understandingsomebasicnoiseterms.html
seed | Same as default constructor |
octaves | Default is 1 |
frequency | Default is 1 |
persistence | Default is 0.5 |
lacunarity | Default is 2.0 |
float Perlin::noise | ( | const float & | x | ) | const |
generate 1D Perlin noise in the range [-1, 1]
x | a point in the 1D space |
float Perlin::noise | ( | const glm::vec2 & | v | ) | const |
generate 2D Perlin noise in the range [-1, 1]
v | a point in the 2D space |
float Perlin::noise | ( | const glm::vec3 & | v | ) | const |
generate 3D Perlin noise in the range [-1, 1]
v | a point in the 3D space |