2016-03-07 19:37:33 +01:00

31 lines
855 B
C++

#ifndef NOISE_H
#define NOISE_H
#include <glm/vec2.hpp>
#include <glm/vec3.hpp>
#define ARBITRARY_VALUE 12 // TODO : find an appropriate name
class Noise
{
private:
static glm::vec2 gradient2[ARBITRARY_VALUE];
static glm::vec3 gradient3[ARBITRARY_VALUE];
static int permut[ARBITRARY_VALUE];
//private function
static int calculIdx2D(int x, int z); // TODO : remove french namings
static int fastfloor(float v);
static float lerp(float a, float b, float w);
public:
Noise();
~Noise();
static void initPerlinNoise(int seed);
static float PerlinNoise2D(float x, float z);
static float PerlinNoise3D(float x, float y, float z);
static float OctavePerlinNoise(float nb_octave, float persistence, float x, float y, float z);
static float SimplexNoise(float x, float y, float z);
};
#endif // NOISE_H