Panda3D

Loading...
Searching...
No Matches
Public Member Functions | List of all members
StackedPerlinNoise2 Class Reference

Implements a multi-layer PerlinNoise, with one or more high-frequency noise functions added to a lower-frequency base noise function. More...

`#include "stackedPerlinNoise2.h"`

## Public Member Functions
| StackedPerlinNoise2 ()
| Creates a StackedPerlinNoise2 object with no levels.
| StackedPerlinNoise2 (const StackedPerlinNoise2 &copy)
| Creates an exact duplicate of the existing StackedPerlinNoise2 object, including the random seed.
| StackedPerlinNoise2 (double sx, double sy, int num_levels=2, double scale_factor=4.0f, double amp_scale=0.5f, int table_size=256, unsigned long seed=0)
| Creates num_levels nested PerlinNoise2 objects.
void | add_level (const PerlinNoise2 &level, double amp=1.0)
| Adds an arbitrary PerlinNoise2 object, and an associated amplitude, to the stack.
void | clear ()
| Removes all levels from the stack.
double | noise (const LVecBase2d &value)
| Returns the noise function of the three inputs.
float | noise (const LVecBase2f &value)
| Returns the noise function of the three inputs.
double | noise (double x, double y)
| Returns the noise function of the three inputs.
double | operator() (const LVecBase2d &value)
| Returns the noise function of the three inputs.
float | operator() (const LVecBase2f &value)
| Returns the noise function of the three inputs.
double | operator() (double x, double y)
| Returns the noise function of the three inputs.
void | operator= (const StackedPerlinNoise2 &copy)
| Creates an exact duplicate of the existing StackedPerlinNoise2 object, including the random seed.

## Detailed Description

Implements a multi-layer PerlinNoise, with one or more high-frequency noise functions added to a lower-frequency base noise function.

Definition at line 25 of file stackedPerlinNoise2.h.

## Constructor & Destructor Documentation

## ◆ StackedPerlinNoise2() [1/3]

StackedPerlinNoise2::StackedPerlinNoise2 | ( |  | ) |
| inline

Creates a StackedPerlinNoise2 object with no levels.

You should call add_level() to add each level by hand.

Definition at line 18 of file stackedPerlinNoise2.I.

Referenced by StackedPerlinNoise2(), and operator=().

## ◆ StackedPerlinNoise2() [2/3]

StackedPerlinNoise2::StackedPerlinNoise2 | ( | double | sx,
|  | double | sy,
|  | int | num_levels = 2,
|  | double | scale_factor = 4.0f,
|  | double | amp_scale = 0.5f,
|  | int | table_size = 256,
|  | unsigned long | seed = 0 )
| explicit

Creates num_levels nested PerlinNoise2 objects.

Each stacked Perlin object will have a scale of 1 scale_factor times the previous object (so that it is higher-frequency, if scale_factor > 1), and an amplitude of amp_scale times the previous object (so that it is less important, if amp_scale < 1).

Definition at line 22 of file stackedPerlinNoise2.cxx.

References add_level(), and noise().

## ◆ StackedPerlinNoise2() [3/3]

StackedPerlinNoise2::StackedPerlinNoise2 | ( | const StackedPerlinNoise2 & | copy | ) |

Creates an exact duplicate of the existing StackedPerlinNoise2 object, including the random seed.

Definition at line 43 of file stackedPerlinNoise2.cxx.

References StackedPerlinNoise2().

## Member Function Documentation

## ◆ add_level()

void StackedPerlinNoise2::add_level | ( | const PerlinNoise2 & | level,
|  | double | amp = 1.0 )

Adds an arbitrary PerlinNoise2 object, and an associated amplitude, to the stack.

Definition at line 62 of file stackedPerlinNoise2.cxx.

Referenced by StackedPerlinNoise2().

## ◆ clear()

void StackedPerlinNoise2::clear | ( |  | ) |

Removes all levels from the stack.

You must call add_level() again to restore them.

Definition at line 74 of file stackedPerlinNoise2.cxx.

## ◆ noise() [1/3]

double StackedPerlinNoise2::noise | ( | const LVecBase2d & | value | ) |

Returns the noise function of the three inputs.

Definition at line 82 of file stackedPerlinNoise2.cxx.

## ◆ noise() [2/3]

float StackedPerlinNoise2::noise | ( | const LVecBase2f & | value | ) |
| inline

Returns the noise function of the three inputs.

Definition at line 33 of file stackedPerlinNoise2.I.

References noise().

## ◆ noise() [3/3]

double StackedPerlinNoise2::noise | ( | double | x,
|  | double | y )
| inline

Returns the noise function of the three inputs.

Definition at line 25 of file stackedPerlinNoise2.I.

References noise().

Referenced by StackedPerlinNoise2(), noise(), noise(), operator()(), operator()(), operator()(), and PNMImage::perlin_noise_fill().

## ◆ operator()() [1/3]

double StackedPerlinNoise2::operator() | ( | const LVecBase2d & | value | ) |
| inline

Returns the noise function of the three inputs.

Definition at line 57 of file stackedPerlinNoise2.I.

References noise().

## ◆ operator()() [2/3]

float StackedPerlinNoise2::operator() | ( | const LVecBase2f & | value | ) |
| inline

Returns the noise function of the three inputs.

Definition at line 49 of file stackedPerlinNoise2.I.

References noise().

## ◆ operator()() [3/3]

double StackedPerlinNoise2::operator() | ( | double | x,
|  | double | y )
| inline

Returns the noise function of the three inputs.

Definition at line 41 of file stackedPerlinNoise2.I.

References noise().

## ◆ operator=()

void StackedPerlinNoise2::operator= | ( | const StackedPerlinNoise2 & | copy | ) |

Creates an exact duplicate of the existing StackedPerlinNoise2 object, including the random seed.

Definition at line 53 of file stackedPerlinNoise2.cxx.

References StackedPerlinNoise2().

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

- panda/src/mathutil/stackedPerlinNoise2.h
- panda/src/mathutil/stackedPerlinNoise2.cxx
- panda/src/mathutil/stackedPerlinNoise2.I