mpri-graphics-project/PerlinGround.cpp

15 lines
404 B
C++

#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);
}
Point PerlinGround::get_normal(double x, double z) const {
const Point pt(x, surface.noise(x, z), z);
return surface.normal_at(pt);
}