The infinite amortized 3D noise class.
More...
#include <InfiniteAmortizedNoise3D.h>
|
float | getRandomUnitFloat () |
| Random float in range [-1, 1].
|
|
float | h1 (const unsigned int x, const unsigned int y, const unsigned int z) |
| 3D hash function.
|
|
float | h2 (const unsigned int x, const unsigned int y, const unsigned int z) |
| 3D hash function.
|
|
void | FillUp (float *t, float s, int n) |
| Fill amortized noise table bottom up.
|
|
void | FillDn (float *t, float s, int n) |
| Fill amortized noise table top down.
|
|
float | getNoise (const int i, const int j, const int k) |
| Get one point of amortized noise.
|
|
void | getNoise (const int n, const int i0, const int j0, const int k0, float ***cell) |
|
void | addNoise (const int n, const int i0, const int j0, const int k0, float scale, float ***cell) |
| Get 1 octave of amortized noise into cell.
|
|
void | initSplineTable (const int n) |
| Add 1 octave of amortized noise into cell.
|
|
void | initEdgeTables (const int x, const int y, const int z, const int n) |
| Initialize the amortized noise tables.
|
|
|
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 * | ucx |
| X coordinate of u used to compute c.
|
|
float * | vcx |
| X coordinate of v used to compute c.
|
|
float * | udx |
| X coordinate of u used to compute d.
|
|
float * | vdx |
| X coordinate of v used to compute d.
|
|
float * | ucy |
| Y coordinate of u used to compute c.
|
|
float * | vcy |
| Y coordinate of v used to compute c.
|
|
float * | udy |
| Y coordinate of u used to compute d.
|
|
float * | vdy |
| Y coordinate of v used to compute d.
|
|
float * | uaz |
| Z coordinate of u used to compute a.
|
|
float * | vaz |
| Z coordinate of v used to compute a.
|
|
float * | ubz |
| Z coordinate of u used to compute b.
|
|
float * | vbz |
| Z coordinate of v used to compute b.
|
|
float * | ucz |
| Z coordinate of u used to compute c.
|
|
float * | vcz |
| Z coordinate of v used to compute c.
|
|
float * | udz |
| Z coordinate of u used to compute d.
|
|
float * | vdz |
| Z coordinate of v used to compute d.
|
|
float * | spline |
| Spline array.
|
|
unsigned int | seed |
| Hash seed.
|
|
The 3D amortized noise class implements the 3D amortized noise algorithm using Perlin's finite hash table.
void CInfiniteAmortizedNoise3D::addNoise |
( |
const int |
n, |
|
|
const int |
i0, |
|
|
const int |
j0, |
|
|
const int |
k0, |
|
|
float |
scale, |
|
|
float *** |
cell |
|
) |
| |
|
private |
Add a single octave of noise into a subcell.
- Parameters
-
n | Granularity. |
i0 | X offset of this subcell in cell. |
j0 | Y offset of this subcell in cell. |
k0 | Z offset of this subcell in cell. |
scale | Noise is to be rescaled by this factor. |
cell | Noise cell. |
void CInfiniteAmortizedNoise3D::FillDn |
( |
float * |
t, |
|
|
float |
s, |
|
|
int |
n |
|
) |
| |
|
private |
Fill amortized noise table top down.
- Parameters
-
t | Amortized noise table. |
s | Initial value. |
n | Granularity. |
void CInfiniteAmortizedNoise3D::FillUp |
( |
float * |
t, |
|
|
float |
s, |
|
|
int |
n |
|
) |
| |
|
private |
< Fill amortized noise table bottom up.
- Parameters
-
t | Amortized noise table. |
s | Initial value. |
n | Granularity. |
float CInfiniteAmortizedNoise3D::generate |
( |
int |
x, |
|
|
int |
y, |
|
|
int |
z, |
|
|
const int |
m0, |
|
|
const int |
m1, |
|
|
int |
n, |
|
|
float *** |
cell |
|
) |
| |
< Get a cell of 1/f amortized noise. Assumes step 0.5 and lacunarity 2.0.
- Parameters
-
x | x coordinate of top left corner of cell. |
y | y coordinate of top left corner of cell. |
z | z coordinate of top left corner of cell. |
m0 | First octave. |
m1 | Last octave. |
n | Granularity. |
cell | Generated noise. |
float CInfiniteAmortizedNoise3D::getNoise |
( |
const int |
i, |
|
|
const int |
j, |
|
|
const int |
k |
|
) |
| |
|
private |
Compute a single point of a single octave of Perlin noise. This is similar to Perlin's noise3 function except that it substitutes table lookups for floating point multiplication.
- Parameters
-
i | x coordinate of point. |
j | y coordinate of point. |
k | z coordinate of point. |
- Returns
- Noise value at (i, j, k).
void CInfiniteAmortizedNoise3D::getNoise |
( |
const int |
n, |
|
|
const int |
i0, |
|
|
const int |
j0, |
|
|
const int |
k0, |
|
|
float *** |
cell |
|
) |
| |
|
private |
Get a single octave of noise into a subcell.
- Parameters
-
n | Granularity. |
i0 | X offset of this subcell in cell. |
j0 | Y offset of this subcell in cell. |
k0 | Z offset of this subcell in cell. |
cell | Noise cell. |
float CInfiniteAmortizedNoise3D::getRandomUnitFloat |
( |
| ) |
|
|
private |
Get a random unit floating point number.
- Returns
- Random floating point number >=-1 and <=1.
float CInfiniteAmortizedNoise3D::h1 |
( |
const unsigned int |
x, |
|
|
const unsigned int |
y, |
|
|
const unsigned int |
z |
|
) |
| |
|
private |
A 3D hash function. Hash three dimensions into a single unsigned int.
- Parameters
-
x | X coordinate of value to be hashed. |
y | Y coordinate of value to be hashed. |
z | Z coordinate of value to be hashed. |
- Returns
- Hash of (x, y, z).
void CInfiniteAmortizedNoise3D::initEdgeTables |
( |
const int |
x0, |
|
|
const int |
y0, |
|
|
const int |
z0, |
|
|
const int |
n |
|
) |
| |
|
private |
Initialize amortized noise tables.
- Parameters
-
x0 | x coordinate of top left front corner of cell. |
y0 | y coordinate of top left front corner of cell. |
z0 | z coordinate of top left front corner of cell. |
n | Granularity. |
void CInfiniteAmortizedNoise3D::initSplineTable |
( |
const int |
n | ) |
|
|
private |
Initialize the spline table.
Initialize the spline table.
- Parameters
-
The documentation for this class was generated from the following files: