21 #ifndef GF_HEIGHTMAP_H 22 #define GF_HEIGHTMAP_H 34 #ifndef DOXYGEN_SHOULD_SKIP_THIS 59 return m_data.getSize();
76 return m_data(position);
85 void setValue(Vector2i position,
double value) {
86 m_data(position) = value;
94 std::tuple<
double,
double>
getMinMax()
const;
107 void normalize(
double min = 0.0,
double max = 1.0);
116 void addHill(Vector2d center,
double radius,
double height);
125 void digHill(Vector2d center,
double radius,
double height);
147 void scale(
double value);
156 void clamp(
double min = 0.0,
double max = 1.0);
177 double getSlope(Vector2i position)
const;
186 void thermalErosion(
unsigned iterations,
double talus,
double fraction);
197 void hydraulicErosion(
unsigned iterations,
double rainAmount,
double solubility,
double evaporation,
double capacity);
206 void fastErosion(
unsigned iterations,
double talus,
double fraction);
278 #ifndef DOXYGEN_SHOULD_SKIP_THIS void setValue(Vector2i position, double value)
Set the value at the specified position.
Definition: Heightmap.h:85
A two-dimensional array.
Definition: Array2D.h:63
void digHill(Vector2d center, double radius, double height)
Dig a hill in the heightmap.
double getErosionScore() const
Compute the erosion score for the heightmap.
void fastErosion(unsigned iterations, double talus, double fraction)
Apply fast erosion to the heightmap.
void addNoise(Noise2D &noise, double scale=1.0)
Add a noise to the heightmap.
A color ramp.
Definition: ColorRamp.h:41
Image copyToColoredImage(const ColorRamp &ramp, double waterLevel=0.5, Render render=Render::Colored) const
Export to a colored image.
void addHill(Vector2d center, double radius, double height)
Add a hill to the heightmap.
Export to a shaded image.
A heightmap.
Definition: Heightmap.h:44
Heightmap(Vector2i size)
Constructor.
2D A noise function
Definition: Noise.h:35
void scale(double value)
Scale the values of the heightmap.
Export to a simply colored image.
Vector2i getSize() const
Get the size of the heightmap.
Definition: Heightmap.h:58
Render
Rendering mode.
Definition: Heightmap.h:224
Class for loading, manipulating and saving images.
Definition: Image.h:92
The namespace for gf classes.
Definition: Action.h:34
void hydraulicErosion(unsigned iterations, double rainAmount, double solubility, double evaporation, double capacity)
Apply hydraulic erosision to the heightmap.
void reset()
Reset the heightmap.
double getSlope(Vector2i position) const
Compute the slope at a position.
void clamp(double min=0.0, double max=1.0)
Clamp the values of the heightmap.
double getValue(Vector2i position) const
Get the value at the specified position.
Definition: Heightmap.h:75
std::tuple< double, double > getMinMax() const
Get the minimum and maximum of the heightmap.
void normalize(double min=0.0, double max=1.0)
Normalize the heightmap.
#define GF_API
Definition: Portability.h:35
void addValue(double value)
Add a constant to the heightmap.
Image copyToGrayscaleImage() const
Export to a grayscale image.
void thermalErosion(unsigned iterations, double talus, double fraction)
Apply thermal erosion to the heightmap.
Heightmap subMap(RectI area) const
Get a sub-map of the heightmap.