API Quick Reference
This page is a compact signature index for fast lookup.
Signatures are aligned with include/grimoire-pcg/*.h and current DLL exports.
Random
GRIMOIRE_API GrimoireRandom GrimoireRandom_CreateNew();
GRIMOIRE_API GrimoireRandom GrimoireRandom_CreateSeed(hash_t seed);
GRIMOIRE_API void GrimoireRandom_Destroy(GrimoireRandom random);
GRIMOIRE_API int32_t GrimoireRandom_Next(GrimoireRandom random);
GRIMOIRE_API int32_t GrimoireRandom_NextRange(GrimoireRandom random, int32_t min, int32_t max);
GRIMOIRE_API int32_t GrimoireRandom_NextMax(GrimoireRandom random, int32_t max);
GRIMOIRE_API double GrimoireRandom_NextDouble(GrimoireRandom random);
GRIMOIRE_API void GrimoireRandom_NextBytes(GrimoireRandom random, void* buffer, size_t length);
GRIMOIRE_API void GrimoireRandom_Serialize(GrimoireRandom random, uint8_t* buffer);
GRIMOIRE_API GrimoireRandom GrimoireRandom_Deserialize(const uint8_t* buffer);
GRIMOIRE_API void GrimoireRandom_CloneInto(const GrimoireRandom source, GrimoireRandom destination);
GRIMOIRE_API GrimoireRandom GrimoireRandom_Clone(const GrimoireRandom source);
Random Notes
- Serialized state buffer size (current release): 228 bytes.
NextRangeuses[min, max).NextMaxuses[0, max).- Destroy every successful created/cloned/deserialized handle.
Noise
GRIMOIRE_API float Grimoire_ValueSharp1D(float x, float y, float z, hash_t seed);
GRIMOIRE_API float Grimoire_ValueSharp2D(float x, float y, float z, hash_t seed);
GRIMOIRE_API float Grimoire_ValueSharp3D(float x, float y, float z, hash_t seed);
GRIMOIRE_API float Grimoire_ValueSmooth1D(float x, float y, float z, hash_t seed);
GRIMOIRE_API float Grimoire_ValueSmooth2D(float x, float y, float z, hash_t seed);
GRIMOIRE_API float Grimoire_ValueSmooth3D(float x, float y, float z, hash_t seed);
GRIMOIRE_API float Grimoire_Perlin1D(float x, float y, float z, hash_t seed);
GRIMOIRE_API float Grimoire_Perlin2D(float x, float y, float z, hash_t seed);
GRIMOIRE_API float Grimoire_Perlin3D(float x, float y, float z, hash_t seed);
GRIMOIRE_API float Grimoire_Fbm(GrimoireNoiseFunction noiseFunc, float x, float y, float z, hash_t seed,
const GrimoireFractalSettings* settings);
GRIMOIRE_API float Grimoire_Billow(GrimoireNoiseFunction noiseFunc, float x, float y, float z, hash_t seed,
const GrimoireFractalSettings* settings);
Noise Notes
- 1D functions ignore
yandz. - 2D functions ignore
z. - Fractal functions require a valid
GrimoireFractalSettings*.
Fractal Settings
typedef struct GrimoireFractalSettings
{
float frequency;
uint32_t octaves;
float lacunarity;
float persistence;
bool staticSeed;
} GrimoireFractalSettings;
Noise Function Pointer Type
typedef float (*GrimoireNoiseFunction)(float x, float y, float z, hash_t seed);