The terrain generator class.
More...
#include <TerrainGenerator.h>
|
| CTerrainGenerator (const unsigned int n, const unsigned int s, float tail) |
| Constructor. More...
|
|
| CInfiniteAmortizedNoise2D (const unsigned n, const unsigned int s) |
| Constructor. More...
|
|
| ~CInfiniteAmortizedNoise2D () |
| Destructor.
|
|
float | generate (int x, int y, const int m0, const int m1, const int n, float **cell) |
| Generate a cell of 2D amortized noise. More...
|
|
|
unsigned int | h (const unsigned int x, const unsigned int y, unsigned int seed) |
| 2D hash function. More...
|
|
void | initEdgeTables (const int x, const int y, const int n) |
| Initialize the amortized noise tables. More...
|
|
virtual unsigned int | h (const unsigned int x, const unsigned int y) |
| 2D hash function. More...
|
|
void | FillUp (float *t, const float s, const int n) |
| Fill amortized noise table bottom up. More...
|
|
void | FillDn (float *t, const float s, const int n) |
| Fill amortized noise table top down. More...
|
|
virtual void | initEdgeTables (const int x, const int y, const int n) |
| Initialize the amortized noise tables. More...
|
|
void | initSplineTable (const int n) |
| Initialize the spline table. More...
|
|
float | getNoise (const int i, const int j) |
| Get one point of amortized noise. More...
|
|
void | getNoise (const int n, const int i0, const int j0, float **cell) |
| Get 1 octave of amortized noise into cell. More...
|
|
void | addNoise (const int n, const int i0, const int j0, const float scale, float **cell) |
| Add 1 octave of amortized noise into cell. More...
|
|
|
unsigned int | seed1 |
| Hash seed for gradient magnitude.
|
|
unsigned int | seed2 |
| Hash seed for tail of gradient magnitude distribution.
|
|
float | omega |
| Tail height multiplier.
|
|
float * | uax |
| X coordinate of u used to compute a.
|
|
float * | vax |
| X coordinate of v used to compute a.
|
|
float * | ubx |
| X coordinate of u used to compute b.
|
|
float * | vbx |
| X coordinate of v used to compute b.
|
|
float * | uay |
| Y coordinate of u used to compute a.
|
|
float * | vay |
| Y coordinate of v used to compute a.
|
|
float * | uby |
| Y coordinate of u used to compute b.
|
|
float * | vby |
| Y coordinate of v used to compute b.
|
|
float * | spline |
| Spline table.
|
|
unsigned int | seed |
| Hash seed.
|
|
The terrain class implements the 2D infinite amortized noise algorithm with an exponential gradient magnitude distribution.
◆ CTerrainGenerator()
CTerrainGenerator::CTerrainGenerator |
( |
const unsigned int |
n, |
|
|
const unsigned int |
s, |
|
|
float |
tail |
|
) |
| |
The constructor initializes the new random number seeds and omega, and relies on the CInfiniteAmortizedNoise2D constructor to do the rest.
- Parameters
-
n | Cell size. |
s | Hash function seed. |
tail | Value of omega. |
◆ h()
unsigned int CTerrainGenerator::h |
( |
const unsigned int |
x, |
|
|
const unsigned int |
y, |
|
|
unsigned int |
seed |
|
) |
| |
|
protected |
Hash two unsigned ints into a single unsigned int using MurmurHash.
- Parameters
-
x | X coordinate of value to be hashed. |
y | Y coordinate of value to be hashed. |
seed | Seed for the hash function. |
- Returns
- Hash of (x, y).
◆ initEdgeTables()
void CTerrainGenerator::initEdgeTables |
( |
const int |
x0, |
|
|
const int |
y0, |
|
|
const int |
n |
|
) |
| |
|
protectedvirtual |
Initialize the edge tables with gradients with a uniformly distributed direction and an exponentially distributed magnitude.
- Parameters
-
x0 | x coordinate of top left corner of cell. |
y0 | y coordinate of top left corner of cell. |
n | Granularity. |
Reimplemented from CInfiniteAmortizedNoise2D.
The documentation for this class was generated from the following files: