2#include "resources/Image.hpp"
3#include "resources/Texture.hpp"
4#include "resources/Mesh.hpp"
5#include "processing/GaussianBlur.hpp"
6#include "generation/PerlinNoise.hpp"
7#include "generation/Random.hpp"
27 Cell(uint l, uint x, uint z);
34 Terrain(uint resolution, uint seed);
81 const std::vector<Cell> &
cells()
const {
Applies an approximate gaussian blur using a dual filtering approach.
Definition: GaussianBlur.hpp:17
Represents an image composed of pixels with values in [0,1]. Provide image loading/saving utilities,...
Definition: Image.hpp:8
Represents a geometric mesh composed of vertices, other attributes and triangles.
Definition: Mesh.hpp:15
Generate 3D perlin noise and multi-layered noise.
Definition: PerlinNoise.hpp:10
Generate a terrain with Perlin noise and erosion. Represent the terrain, regrouping elevation and sha...
Definition: Terrain.hpp:14
int _resolution
Height map resolution.
Definition: Terrain.hpp:140
std::vector< Cell > _cells
Grid mesh cells.
Definition: Terrain.hpp:130
MeshSettings _mshOpts
Grid mesh options.
Definition: Terrain.hpp:137
void erode(Image &img)
Definition: Terrain.cpp:207
float _texelSize
Size of a map texel in world space.
Definition: Terrain.hpp:142
void generateMap()
Definition: Terrain.cpp:152
~Terrain()
Definition: Terrain.cpp:482
bool interface()
Definition: Terrain.cpp:434
const std::vector< Cell > & cells() const
Definition: Terrain.hpp:81
PerlinNoise _perlin
Perlin noise generator.
Definition: Terrain.hpp:129
int gridSize() const
Definition: Terrain.hpp:61
Texture _shadowMap
Shadow map generation texture.
Definition: Terrain.hpp:133
GaussianBlur _gaussBlur
Gaussian blur.
Definition: Terrain.hpp:134
Texture _mapLowRes
Low resolution min-height terrain map.
Definition: Terrain.hpp:132
const Texture & shadowMap() const
Definition: Terrain.hpp:76
void generateMesh()
Definition: Terrain.cpp:15
void transferAndUpdateMap(Image &heightMap)
Definition: Terrain.cpp:306
GenerationSettings _genOpts
Terrain generations settings.
Definition: Terrain.hpp:136
ErosionSettings _erOpts
Erosion options.
Definition: Terrain.hpp:138
const Texture & map() const
Definition: Terrain.hpp:71
float meshSize() const
Definition: Terrain.hpp:66
Texture _map
Terrain map, height in R channel, normals in GBA channels.
Definition: Terrain.hpp:131
uint _seed
Current generation seed.
Definition: Terrain.hpp:141
void generateShadowMap(const glm::vec3 &lightDir)
Definition: Terrain.cpp:405
float texelSize() const
Definition: Terrain.hpp:56
float _meshSize
Size of the mesh.
Definition: Terrain.hpp:143
Represents a texture containing one or more images, stored on the CPU and/or GPU.
Definition: Texture.hpp:12
Definition: Terrain.hpp:18
uint level
The density level used to generate the mesh of this cell.
Definition: Terrain.hpp:20
Mesh mesh
The geometry covering this cell.
Definition: Terrain.hpp:19
Definition: Terrain.hpp:115
int stepsMax
Number of steps for each droplet simulation.
Definition: Terrain.hpp:125
float erosion
Erosion strenght.
Definition: Terrain.hpp:120
bool apply
Should erosion be applied.
Definition: Terrain.hpp:126
float inertia
Inertia of water droplet.
Definition: Terrain.hpp:116
float minSlope
Minimal slope, to avoid strong erosion spots.
Definition: Terrain.hpp:118
int dropsCount
Number of droplets to sequentially simulate.
Definition: Terrain.hpp:124
float capacityBase
Base water capacity.
Definition: Terrain.hpp:119
float deposition
Deposition speed.
Definition: Terrain.hpp:122
float gravity
Gravity.
Definition: Terrain.hpp:117
int gatherRadius
Gathering radius for contributions.
Definition: Terrain.hpp:123
float evaporation
Evaporation speed.
Definition: Terrain.hpp:121
Definition: Terrain.hpp:98
float scale
The base frequency, in pixels.
Definition: Terrain.hpp:101
int octaves
Number of noise layers.
Definition: Terrain.hpp:105
float lacunarity
The frequency ratio between successive noise layers.
Definition: Terrain.hpp:99
float rescale
General height rescaling.
Definition: Terrain.hpp:104
float falloff
Strength of the circular falloff.
Definition: Terrain.hpp:103
float maxHeight
Maximum height.
Definition: Terrain.hpp:102
float gain
The amplitude ratio between successive noise layers.
Definition: Terrain.hpp:100
Definition: Terrain.hpp:109
int levels
Number of levels of detail.
Definition: Terrain.hpp:111
int size
Grid dimensions.
Definition: Terrain.hpp:110