clan::PerlinNoise Class Reference - ClanLib SDK
Description: clan::PerlinNoise Class Reference

Public Member Functions | List of all members
clan::PerlinNoise Class Reference
clanDisplay Display

Perlin Noise Generator class. More...

`#include <perlin_noise.h>`

## Public Member Functions
| PerlinNoise ()
| Constructor.
virtual | ~PerlinNoise ()
| Destructor.
PixelBuffer | create_noise1d (float start_x, float end_x)
| Create the perlin noise.
PixelBuffer | create_noise2d (float start_x, float end_x, float start_y, float end_y)
| Create the perlin noise.
PixelBuffer | create_noise3d (float start_x, float end_x, float start_y, float end_y, float z_position)
| Create the perlin noise.
PixelBuffer | create_noise4d (float start_x, float end_x, float start_y, float end_y, float z_position, float w_position)
| Create the perlin noise.
float | get_amplitude () const
| Get the amplitude of the perlin noise.
TextureFormat | get_format () const
| Get the format of the output pixelbuffer.
int | get_octaves () const
| Get the number of octaves of the perlin noise.
Size | get_size () const
| Get the size of the output pixelbuffer.
void | set_amplitude (float amplitude=1.0f)
| Set the amplitude of the perlin noise.
void | set_format (TextureFormat texture_format=TextureFormat::rgb8)
| Set the format of the output pixelbuffer.
void | set_octaves (int octaves=1)
| Set the number of octaves of the perlin noise.
void | set_permutations (const unsigned char *table, unsigned int size=256)
| Set the permutation table.
void | set_size (const Size &size)
| Set the size of the output pixelbuffer.
void | set_size (int width=256, int height=256)
| Set the size of the output pixelbuffer.

## Detailed Description

Perlin Noise Generator class.

## Constructor & Destructor Documentation

## ◆ PerlinNoise()

clan::PerlinNoise::PerlinNoise | ( |  | ) |

Constructor.

## ◆ ~PerlinNoise()

virtual clan::PerlinNoise::~PerlinNoise | ( |  | ) |
| virtual

Destructor.

## Member Function Documentation

## ◆ create_noise1d()

PixelBuffer clan::PerlinNoise::create_noise1d | ( | float | start_x,
|  | float | end_x )

Create the perlin noise.

Remember to call set_size() with the height set to 1.
The period of these parameters are from 0 to 255

Parameters

  start_x | = Start x position of the noise
  end_x | = End x position of the noise
  start_y | = Start y position of the noise
  end_y | = End y position of the noise

## ◆ create_noise2d()

PixelBuffer clan::PerlinNoise::create_noise2d | ( | float | start_x,
|  | float | end_x,
|  | float | start_y,
|  | float | end_y )

Create the perlin noise.

The period of these parameters are from 0 to 255

Parameters

  start_x | = Start x position of the noise
  end_x | = End x position of the noise
  start_y | = Start y position of the noise
  end_y | = End y position of the noise

## ◆ create_noise3d()

PixelBuffer clan::PerlinNoise::create_noise3d | ( | float | start_x,
|  | float | end_x,
|  | float | start_y,
|  | float | end_y,
|  | float | z_position )

Create the perlin noise.

The period of these parameters are from 0 to 255

Parameters

  start_x | = Start x position of the noise
  end_x | = End x position of the noise
  start_y | = Start y position of the noise
  end_y | = End y position of the noise
  z_position | = The z position of the noise

## ◆ create_noise4d()

PixelBuffer clan::PerlinNoise::create_noise4d | ( | float | start_x,
|  | float | end_x,
|  | float | start_y,
|  | float | end_y,
|  | float | z_position,
|  | float | w_position )

Create the perlin noise.

The period of these parameters are from 0 to 255

Parameters

  start_x | = Start x position of the noise
  end_x | = End x position of the noise
  start_y | = Start y position of the noise
  end_y | = End y position of the noise
  z_position | = The z position of the noise
  w_position | = The w position of the noise

## ◆ get_amplitude()

float clan::PerlinNoise::get_amplitude | ( |  | ) | const

Get the amplitude of the perlin noise.

## ◆ get_format()

TextureFormat clan::PerlinNoise::get_format | ( |  | ) | const

Get the format of the output pixelbuffer.

## ◆ get_octaves()

int clan::PerlinNoise::get_octaves | ( |  | ) | const

Get the number of octaves of the perlin noise.

## ◆ get_size()

Size clan::PerlinNoise::get_size | ( |  | ) | const

Get the size of the output pixelbuffer.

## ◆ set_amplitude()

void clan::PerlinNoise::set_amplitude | ( | float | amplitude = 1.0f | ) |

Set the amplitude of the perlin noise.

If this function is not used, the amplitude defaults to 1.0f

Parameters

  amplitude | = The amplitude to set

## ◆ set_format()

void clan::PerlinNoise::set_format | ( | TextureFormat | texture_format = TextureFormat::rgb8 | ) |

Set the format of the output pixelbuffer.

If this function is not used, the format defaults to TextureFormat::rgb8
These following formats are supported:
TextureFormat::rgba8, TextureFormat::rgb8, TextureFormat::r8, tf_r32f

Parameters

  format | = The specified format

References clan::rgb8.

## ◆ set_octaves()

void clan::PerlinNoise::set_octaves | ( | int | octaves = 1 | ) |

Set the number of octaves of the perlin noise.

If this function is not used, the octaves count defaults to 1

Parameters

  octaves | = The number of octaves to set

## ◆ set_permutations()

void clan::PerlinNoise::set_permutations | ( | const unsigned char * | table,
|  | unsigned int | size = 256 )

Set the permutation table.

If this function is not used, this class uses rand() to create a permutation table instead

Parameters

  table | = The permutation table
  size | = The permutation table size (2,4,8,16,32,64,128,256). Usually 256 (the maximum) unless a lower periodic table is required

## ◆ set_size() [1/2]

void clan::PerlinNoise::set_size | ( | const Size & | size | ) |

Set the size of the output pixelbuffer.

If this function is not used, the size defaults to 256x256

Parameters

  width | = Output pixelbuffer width
  height | = Output pixelbuffer height

## ◆ set_size() [2/2]

void clan::PerlinNoise::set_size | ( | int | width = 256,
|  | int | height = 256 )

Set the size of the output pixelbuffer.

If this function is not used, the size defaults to 256x256

Parameters

  width | = Output pixelbuffer width
  height | = Output pixelbuffer height

The documentation for this class was generated from the following file:

- perlin_noise.h