Add some structure for the ground.
This commit is contained in:
parent
0db091f76e
commit
d484a18da5
7 changed files with 44 additions and 0 deletions
6
FlatGround.cpp
Normal file
6
FlatGround.cpp
Normal file
|
@ -0,0 +1,6 @@
|
|||
#include "FlatGround.hpp"
|
||||
|
||||
|
||||
double FlatGround::operator() (double, double) const {
|
||||
return 0. ;
|
||||
}
|
6
FlatGround.hpp
Normal file
6
FlatGround.hpp
Normal file
|
@ -0,0 +1,6 @@
|
|||
#pragma once
|
||||
#include "Ground.hpp"
|
||||
|
||||
class FlatGround : public Ground {
|
||||
double operator() (double, double) const;
|
||||
};
|
0
Ground.cpp
Normal file
0
Ground.cpp
Normal file
8
Ground.hpp
Normal file
8
Ground.hpp
Normal file
|
@ -0,0 +1,8 @@
|
|||
#pragma once
|
||||
|
||||
#include "common_structures.hpp"
|
||||
|
||||
class Ground {
|
||||
public:
|
||||
virtual double operator() (double, double) const = 0;
|
||||
};
|
3
Makefile
3
Makefile
|
@ -11,6 +11,9 @@ OBJS=Implicit.o \
|
|||
Mesh.o \
|
||||
spheroid.o \
|
||||
Ball.o \
|
||||
Ground.o \
|
||||
FlatGround.o \
|
||||
PerlinGround.o \
|
||||
PerlinNoise.o \
|
||||
util/ObjParser.o \
|
||||
MarchingCubes.o \
|
||||
|
|
9
PerlinGround.cpp
Normal file
9
PerlinGround.cpp
Normal file
|
@ -0,0 +1,9 @@
|
|||
#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);
|
||||
}
|
||||
|
12
PerlinGround.hpp
Normal file
12
PerlinGround.hpp
Normal file
|
@ -0,0 +1,12 @@
|
|||
#pragma once
|
||||
#include "Ground.hpp"
|
||||
#include "PerlinNoise.hpp"
|
||||
|
||||
class PerlinGround : public Ground {
|
||||
public:
|
||||
PerlinGround();
|
||||
PerlinGround(unsigned int seed);
|
||||
double operator() (double, double) const;
|
||||
private:
|
||||
PerlinNoise surface;
|
||||
};
|
Loading…
Reference in a new issue