Gamedev Framework (gf) 1.2.0
A C++17 framework for 2D games
Classes | Functions
Procedural Generation

Procedural generation utilities. More...

Classes

class  gf::Heightmap
 A heightmap. More...
 
class  gf::Noise2D
 2D A noise function More...
 
class  gf::Noise3D
 3D A noise function More...
 
class  gf::ValueNoise2D
 Value 2D noise. More...
 
class  gf::GradientNoise2D
 Gradient 2D noise. More...
 
class  gf::GradientNoise3D
 Gradient 3D noise. More...
 
class  gf::BetterGradientNoise2D
 Better gradient 2D noise. More...
 
class  gf::FractalNoise2D
 Fractal 2D noise. More...
 
class  gf::FractalNoise3D
 Fractal 3D noise. More...
 
class  gf::PerlinNoise2D
 Perlin 2D noise. More...
 
class  gf::PerlinNoise3D
 Perlin 3D noise. More...
 
class  gf::SimplexNoise2D
 Simplex 2D noise. More...
 
class  gf::OpenSimplexNoise2D
 OpenSimplex 2D noise. More...
 
class  gf::OpenSimplexNoise3D
 OpenSimplex3D noise. More...
 
class  gf::WaveletNoise3D
 Wavelet 3D noise. More...
 
class  gf::WorleyNoise2D
 Worley 2D noise. More...
 
class  gf::Multifractal2D
 Multi Fractal 2D noise. More...
 
class  gf::HeteroTerrain2D
 Hetero Terrain 2D noise. More...
 
class  gf::HybridMultifractal2D
 Hybrid Multifractal 2D noise. More...
 
class  gf::RidgedMultifractal2D
 Ridged Multifractal 2D noise. More...
 
class  gf::Noise3DTo2DAdapter
 An adapter that make a 2D noise from a 3D noise. More...
 

Functions

GF_CORE_API std::vector< Vector2fgf::midpointDisplacement1D (Vector2f p0, Vector2f p1, Random &random, unsigned iterations, Vector2f direction, float initialFactor=1.0f, float reductionFactor=0.5f)
 1D midpoint displacement More...
 
GF_CORE_API std::vector< Vector2fgf::midpointDisplacement1D (Vector2f p0, Vector2f p1, Random &random, unsigned iterations, float initialFactor=1.0f, float reductionFactor=0.5f)
 1D midpoint displacement More...
 
GF_CORE_API Heightmap gf::midpointDisplacement2D (Vector2i size, Random &random, Span< const double > initialValues=nullptr)
 2D midpoint displacement More...
 
GF_CORE_API Heightmap gf::diamondSquare2D (Vector2i size, Random &random, Span< const double > initialValues=nullptr)
 2D diamond square More...
 

Detailed Description

Procedural generation utilities.

Function Documentation

◆ diamondSquare2D()

GF_CORE_API Heightmap gf::diamondSquare2D ( Vector2i  size,
Random random,
Span< const double >  initialValues = nullptr 
)

2D diamond square

The size can be anything. If the size is not a power of two plus one, then a greater heightmap is generated and a submap of the right size is returned (in the middle of the generated map).

The function takes initial values. If there are less than three values, only the first one is used to initialize the four corners. If there are more than four, only the first four are used to initialize the four corners in that order: north-west, north-east, south-east, south-west. If no values are given, the four corners are initialized to \( 0.0 \).

Parameters
sizeThe size of the map
randomA random engine
initialValuesThe initial values of the four corners
See also
gf::midpointDisplacement2D()

◆ midpointDisplacement1D() [1/2]

GF_CORE_API std::vector< Vector2f > gf::midpointDisplacement1D ( Vector2f  p0,
Vector2f  p1,
Random random,
unsigned  iterations,
float  initialFactor = 1.0f,
float  reductionFactor = 0.5f 
)

1D midpoint displacement

The direction is perpendicular to the segment \( [P_0 P_1] \)

Parameters
p0The first end point
p1The second end point
randomA random engine
iterationsThe number of iterations
initialFactorThe initial factor to apply to the displacement
reductionFactorThe factor to apply at each iteration

◆ midpointDisplacement1D() [2/2]

GF_CORE_API std::vector< Vector2f > gf::midpointDisplacement1D ( Vector2f  p0,
Vector2f  p1,
Random random,
unsigned  iterations,
Vector2f  direction,
float  initialFactor = 1.0f,
float  reductionFactor = 0.5f 
)

1D midpoint displacement

Parameters
p0The first end point
p1The second end point
randomA random engine
iterationsThe number of iterations
directionThe direction to make a displacement
initialFactorThe initial factor to apply to the displacement
reductionFactorThe factor to apply at each iteration

◆ midpointDisplacement2D()

GF_CORE_API Heightmap gf::midpointDisplacement2D ( Vector2i  size,
Random random,
Span< const double >  initialValues = nullptr 
)

2D midpoint displacement

The size can be anything. If the size is not a power of two plus one, then a greater heightmap is generated and a submap of the right size is returned (in the middle of the generated map).

The function takes initial values. If there are less than three values, only the first one is used to initialize the four corners. If there are more than four, only the first four are used to initialize the four corners in that order: north-west, north-east, south-east, south-west. If no values are given, the four corners are initialized to \( 0.0 \).

Parameters
sizeThe size of the map
randomA random engine
initialValuesThe initial values of the four corners
See also
gf::diamondSquare2D()