mpri-graphics-project/PerlinGround.cpp

15 lines
404 B
C++
Raw Normal View History

2018-02-13 17:03:11 +01:00
#include "PerlinGround.hpp"
PerlinGround::PerlinGround() : surface(PerlinNoise()) {}
PerlinGround::PerlinGround(unsigned int seed) : surface(PerlinNoise(seed)) {}
double PerlinGround::operator() (double x, double z) const {
return surface.noise(x, z);
}
2018-02-13 18:06:01 +01:00
Point PerlinGround::get_normal(double x, double z) const {
const Point pt(x, surface.noise(x, z), z);
return surface.normal_at(pt);
}