67 inline const size_t pair(
size_t,
size_t)
const;
68 inline const size_t pairstd(
size_t,
size_t)
const;
70 inline const size_t hash(
size_t)
const;
71 inline const size_t hashstd(
size_t)
const;
72 inline const size_t hash2(
size_t,
size_t)
const;
85 inline const float spline(
float)
const;
86 inline const float z(
size_t,
float,
float,
eNoise)
const;
87 const float Lerp(
float,
float,
float,
size_t*,
eNoise)
const;
97 const float generate(
float,
float,
eNoise,
size_t,
float=0.5f,
float=2.0f)
Useful defines, constants, and types.
eDistribution
Distribution.
2D Perlin and Value noise generator.
const size_t GetMinTableSize() const
Get minimum table size.
const size_t m_nDefTableSize
Default table size.
CPerlinNoise2D()
Constructor.
const size_t hashstd(size_t) const
std::hash function.
void RandomizeTableExp()
Randomize table using exponential distribution.
void RandomizeTableMidpoint()
Randomize table using midpoint displacement.
const float z(size_t, float, float, eNoise) const
Apply gradients.
const size_t pair(size_t, size_t) const
Perlin pairing function.
const size_t m_nMinTableSize
Min table size.
eDistribution m_eDistribution
Uniform distribution..
const float noise(float, float, eNoise) const
Perlin noise.
const eSpline GetSpline() const
Get spline function type.
void SetHash(eHash)
Set hash function.
eHash m_eHash
Hash function type.
void RandomizeTableUniform()
Randomize table using uniform distribution.
float * m_fTable
Table of gradients or values.
const size_t GetMaxTableSize() const
Get maximum table size.
const size_t hash2(size_t, size_t) const
Hash function.
const size_t m_nMaxTableSize
Max table size.
size_t m_nSize
Table size, must be a power of 2.
const size_t GetTableSize() const
Get table size.
const size_t pairstd(size_t, size_t) const
Std pairing function.
bool DefaultTableSize()
Set table size to default.
void HashCorners(size_t, size_t, size_t[4]) const
Hash grid corners.
void SetSpline(eSpline)
Set spline function.
size_t * m_nPerm
Random permutation, used for hash function.
size_t m_nMask
Mask for values less than m_nSize.
eSpline m_eSpline
Spline function type.
const float generate(float, float, eNoise, size_t, float=0.5f, float=2.0f) const
Generate noise at a point.
void RandomizeTableMaximal()
Randomize table using large magnitude values.
void RandomizeTableNormal()
Randomize table using normal distribution.
std::default_random_engine m_stdRandom
PRNG.
void RandomizeTable(eDistribution)
Randomize table from distribution.
~CPerlinNoise2D()
Destructor.
const float Lerp(float, float, float, size_t *, eNoise) const
Linear interpolation.
const eHash GetHash() const
Get hash function type.
bool DoubleTableSize()
Double table size.
const eDistribution GetDistribution() const
Get distribution type.
bool HalveTableSize()
Halve table size.
const size_t hash(size_t) const
Perlin hash function.
const size_t GetDefTableSize() const
Get default table size.
void SetSeed()
Set seed for PRNG.
void RandomizePermutation()
Randomize permutation.
const float spline(float) const
Spline curve.
void Initialize()
Initialize.
void RandomizeTableCos()
Randomize table using cosine.