#ifndef NOISE_H
#define NOISE_H

#include <glm/vec2.hpp>
#include <glm/vec3.hpp>

#define ARBITRARY_VALUE 12 // TODO : find an appropriate name

class Random
{
public:
    static void init();
    static void init(unsigned int seed);

    static int rand(int min, int max);
    static long rand(long min, long max);
    static float rand(float min, float max);
    static double rand(double min, double max);
};

class Noise
{
private:
    static glm::vec2 gradient2[ARBITRARY_VALUE];
    static glm::vec3 gradient3[ARBITRARY_VALUE];
    static int permut[ARBITRARY_VALUE];

    //private function
    static int process2DIndex(int x, int z);
    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
