|
procedurals
Procedural generation building blocks
|
Procedural generation building blocks. More...
Classes | |
| class | PoissonDisk |
| class | TinyKeepDev |
| class | WaveFunctionCollapse |
Functions | |
| uint64_t | mix64 (uint64_t x) noexcept |
| float | normaliseHash (uint64_t x) noexcept |
| float | random0D (uint64_t seed=0) noexcept |
| float | random1D (int x, uint64_t seed=0) noexcept |
| float | random2D (int x, int y, uint64_t seed=0) noexcept |
| float | random3D (int x, int y, int z, uint64_t seed=0) noexcept |
| float | random4D (int x, int y, int z, int w, uint64_t seed=0) noexcept |
| uint64_t | SplitSeed (uint64_t seed, uint64_t channel) noexcept |
| float | noise2D (float x, float y, uint64_t seed=0) noexcept |
| 2D deterministic value noise in [-1, 1]. | |
| float | fbm2D (float x, float y, int octaves=5, uint64_t seed=0, float gain=0.5f, float lacunarity=2.0f) noexcept |
| Fractal Brownian Motion (fBm) | |
| float | warp2D (float x, float y, uint64_t seed=0, float strength=2.0f) noexcept |
| float | ridge2D (float x, float y, int octaves=5, float gain=0.5f, float lacunarity=2.0f, uint64_t seed=0) noexcept |
| Ridged Fractal Noise (inverted fBm) | |
| float | rarity2D (float x, float y, float rarity=0.01f, uint64_t seed=0) |
| float | worley2D (float x, float y, uint64_t seed=0) noexcept |
| void | initPerm (uint8_t *perm, uint64_t seed) |
| float | grad (int hash, float x, float y) |
| float | simplex2D (float xin, float yin, uint64_t seed=0) |
| float | Lerp (float a, float b, float t) noexcept |
| float | Clamp (float x, float minVal, float maxVal) noexcept |
| float | EaseIn (float t) noexcept |
| float | EaseOut (float t) noexcept |
| float | EaseInOut (float t) noexcept |
| float | InterpolateEaseInOut (float a, float b, float t) noexcept |
| template<int Levels = 10> | |
| float | Quantize (float v) |
| Quantize a float value into discrete levels, useful for stylized effects. | |
| void | visualizer2D (const std::string &filename, int width, int height, float scale, const std::function< float(float, float)> &noiseFunc) |
| void | visualizer2D (const std::string &filename, const std::vector< std::vector< float > > &map) |
Variables | |
| constexpr double | PHI = 1.6180339887498949 |
| phi, inv_phi, golden_ratio | |
| constexpr double | INV_PHI = 1.0 / PHI |
| constexpr uint64_t | UINT64_MAX_CONST = ~0ULL |
| constexpr double | DOUBLE_MAX = static_cast<double>(UINT64_MAX_CONST) |
| constexpr uint64_t | GOLDEN_64 = static_cast<uint64_t>(INV_PHI * DOUBLE_MAX) |
| constexpr uint64_t | MAGIC1 = GOLDEN_64 ^ 0xAAAAAAAAAAAAAAAAULL |
| Magic Multipliers. | |
| constexpr uint64_t | MAGIC2 = GOLDEN_64 ^ 0x5555555555555555ULL |
| constexpr uint64_t | MAGIC3 = GOLDEN_64 ^ 0x3333333333333333ULL |
| constexpr uint64_t | MAGIC4 = GOLDEN_64 ^ 0xCCCCCCCCCCCCCCCCULL |
Procedural generation building blocks.
Noise, Poisson disk sampling, smoothing, and a TinyKeep-style dungeon generator. Deterministic : same seed, same output.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Fractal Brownian Motion (fBm)
Adds multiple octaves of noise to create fractal-like complexity. Each octave increases frequency and decreases amplitude.
|
inline |
|
inline |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
noexcept |
2D deterministic value noise in [-1, 1].
Computes smooth pseudo-random noise from (x, y) and an optional seed. Values at the four surrounding grid points are hashed and smoothly interpolated using an ease-in-out curve.
| x | X coordinate (can be fractional) |
| y | Y coordinate (can be fractional) |
| seed | Optional seed for reproducibility |
|
inlinenoexcept |
|
inline |
Quantize a float value into discrete levels, useful for stylized effects.
| Levels |
| v |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
|
inlinenoexcept |
Ridged Fractal Noise (inverted fBm)
Turns smooth valleys into sharp ridges and peaks. Useful for mountain heightmaps or cracked stone surfaces.
|
inline |
|
inlinenoexcept |
|
inline |
|
inline |
|
inlinenoexcept |
|
inlinenoexcept |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
Magic Multipliers.
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
phi, inv_phi, golden_ratio
|
constexpr |