Support Forum       Library Source       SourceForge Page       G3D Web Page     
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | List of all members
G3D::Noise Class Reference

3D fixed point Perlin noise generator. More...

Public Member Functions

 Noise ()
 Not threadsafe.
 
int sample (int x, int y, int z)
 Returns numbers between -2^16 and 2^16.
 
float sampleFloat (int x, int y, int z)
 Returns numbers on the range [-1, 1].
 
uint8 sampleUint8 (int x, int y, int z)
 Returns numbers on the range [0, 255].
 

Static Public Member Functions

static Noisecommon ()
 

Detailed Description

3D fixed point Perlin noise generator.

Ported from Ken Perlin's Java INoise implementation.

Referenced Code:
Copyright 2002 Ken Perlin
Referenced Code:
http://mrl.nyu.edu/~perlin/noise/ FIXED POINT VERSION OF IMPROVED NOISE: 1.0 IS REPRESENTED BY 2^16

Example:

GImage im(256, 256, 1);
for (int y = 0; y < im.height(); ++y) {
for (int x = 0; x < im.width(); ++x) {
im.pixel1(x, y) = Color1unorm8(n.sampleUint8(x << 12, y << 12, 0));
}
}
im.save("noise.png");
See Also
G3D::Random

Constructor & Destructor Documentation

G3D::Noise::Noise ( )
inline

Not threadsafe.

Member Function Documentation

static Noise& G3D::Noise::common ( )
static
int G3D::Noise::sample ( int  x,
int  y,
int  z 
)
inline

Returns numbers between -2^16 and 2^16.

Arguments should be on the order of 2^16

Threadsafe.

Referenced by sampleFloat(), and sampleUint8().

float G3D::Noise::sampleFloat ( int  x,
int  y,
int  z 
)
inline

Returns numbers on the range [-1, 1].

Arguments should be on the order of 2^16

Threadsafe.

uint8 G3D::Noise::sampleUint8 ( int  x,
int  y,
int  z 
)
inline

Returns numbers on the range [0, 255].

Arguments should be on the order of 2^16

Threadsafe.


documentation generated on Sat Jan 12 2013 22:49:56 using doxygen 1.8.2