diff options
author | Cara Salter <cara@devcara.com> | 2023-01-07 23:24:04 -0500 |
---|---|---|
committer | Cara Salter <cara@devcara.com> | 2023-01-07 23:24:04 -0500 |
commit | 36d4f4741cd2559362de7e64820ca4b29b022121 (patch) | |
tree | 172537aa08f946e2a6dc65bc4bec40985f6e1f95 /src/noise.hpp | |
download | cpp-rl-36d4f4741cd2559362de7e64820ca4b29b022121.tar.gz cpp-rl-36d4f4741cd2559362de7e64820ca4b29b022121.zip |
Diffstat (limited to 'src/noise.hpp')
-rw-r--r-- | src/noise.hpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/noise.hpp b/src/noise.hpp new file mode 100644 index 0000000..c127e7f --- /dev/null +++ b/src/noise.hpp @@ -0,0 +1,32 @@ +/* + * ===================================================================================== + * + * Filename: noise.hpp + * + * Description: Defining Perlin Noise + * + * Version: 1.0 + * Created: 01/07/2023 10:52:51 PM + * Revision: none + * Compiler: gcc + * + * Author: Cara Salter (muirrum), cara@devcara.com + * Organization: + * + * ===================================================================================== + */ +#include <vector> +#include <stdlib.h> + +class PerlinNoise { + // permutation vector + std::vector<int> p; + public: + PerlinNoise(); + PerlinNoise(unsigned int seed); + double noise(double x, double y, double z); + private: + double fade(double t); + double lerp(double t, double a, double b); + double grad(int hash, double x, double y, double z); +}; |