RigsofRods
Soft-body Physics Simulation
Data Structures | Public Member Functions | Private Member Functions | Private Attributes
Hydrax::Noise::Perlin Class Reference

Perlin noise module class. More...

#include <Perlin.h>

+ Inheritance diagram for Hydrax::Noise::Perlin:
+ Collaboration diagram for Hydrax::Noise::Perlin:

Data Structures

struct  Options
 Struct wich contains Perlin noise module options. More...
 

Public Member Functions

 Perlin ()
 Default constructor. More...
 
 Perlin (const Options &Options)
 Constructor. More...
 
 ~Perlin ()
 Destructor. More...
 
void create ()
 Create. More...
 
void remove ()
 Remove. More...
 
bool createGPUNormalMapResources (GPUNormalMapManager *g)
 Create GPUNormalMap resources. More...
 
void update (const Ogre::Real &timeSinceLastFrame)
 Call it each frame. More...
 
void saveCfg (Ogre::String &Data)
 Save config. More...
 
bool loadCfg (Ogre::ConfigFile &CfgFile)
 Load config. More...
 
float getValue (const float &x, const float &y)
 Get the especified x/y noise value. More...
 
void setOptions (const Options &Options)
 Set/Update perlin noise options. More...
 
const OptionsgetOptions () const
 Get current Perlin noise options. More...
 
- Public Member Functions inherited from Hydrax::Noise::Noise
 Noise (const Ogre::String &Name, const bool &GPUNormalMapSupported)
 Constructor. More...
 
virtual ~Noise ()
 Destructor. More...
 
virtual void removeGPUNormalMapResources (GPUNormalMapManager *g)
 Remove GPUNormalMap resources. More...
 
const Ogre::String & getName () const
 Get noise name. More...
 
const bool & isCreated () const
 Is created() called? More...
 
const bool & isGPUNormalMapSupported () const
 Is GPU Normal map generation supported. More...
 
const bool & areGPUNormalMapResourcesCreated () const
 Are GPU normal map resources created? More...
 

Private Member Functions

void _initNoise ()
 Initialize noise. More...
 
void _calculeNoise ()
 Calcule noise. More...
 
void _updateGPUNormalMapResources ()
 Update gpu normal map resources. More...
 
int _readTexelLinearDual (const int &u, const int &v, const int &o)
 Read texel linear dual. More...
 
float _getHeigthDual (float u, float v)
 Read texel linear. More...
 
int _mapSample (const int &u, const int &v, const int &upsamplepower, const int &octave)
 Map sample. More...
 

Private Attributes

int noise [n_size_sq *noise_frames]
 Perlin noise variables. More...
 
int o_noise [n_size_sq *max_octaves]
 
int p_noise [np_size_sq *(max_octaves >>(n_packsize-1))]
 
int * r_noise
 
float magnitude
 
double time
 Elapsed time. More...
 
GPUNormalMapManagermGPUNormalMapManager
 GPUNormalMapManager pointer. More...
 
Options mOptions
 Perlin noise options. More...
 

Additional Inherited Members

- Protected Attributes inherited from Hydrax::Noise::Noise
Ogre::String mName
 Module name. More...
 
bool mCreated
 Has create() been already called? More...
 
bool mGPUNormalMapSupported
 Is GPU normal map generation supported? More...
 
bool mGPUNormalMapResourcesCreated
 Are GPU normal map resources created? More...
 

Detailed Description

Perlin noise module class.

Definition at line 73 of file Perlin.h.

Constructor & Destructor Documentation

◆ Perlin() [1/2]

Hydrax::Noise::Perlin::Perlin ( )

Default constructor.

Definition at line 37 of file Perlin.cpp.

◆ Perlin() [2/2]

Hydrax::Noise::Perlin::Perlin ( const Options Options)

Constructor.

Parameters
OptionsPerlin noise options

Definition at line 46 of file Perlin.cpp.

◆ ~Perlin()

Hydrax::Noise::Perlin::~Perlin ( )

Destructor.

Definition at line 56 of file Perlin.cpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ _calculeNoise()

void Hydrax::Noise::Perlin::_calculeNoise ( )
private

Calcule noise.

Definition at line 447 of file Perlin.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getHeigthDual()

float Hydrax::Noise::Perlin::_getHeigthDual ( float  u,
float  v 
)
private

Read texel linear.

Parameters
uu
vv
Returns
Heigth

Definition at line 547 of file Perlin.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _initNoise()

void Hydrax::Noise::Perlin::_initNoise ( )
private

Initialize noise.

Definition at line 408 of file Perlin.cpp.

+ Here is the caller graph for this function:

◆ _mapSample()

int Hydrax::Noise::Perlin::_mapSample ( const int &  u,
const int &  v,
const int &  upsamplepower,
const int &  octave 
)
private

Map sample.

Parameters
uu
vv
levelLevel
octaveOctave
Returns
Map sample

Definition at line 569 of file Perlin.cpp.

+ Here is the caller graph for this function:

◆ _readTexelLinearDual()

int Hydrax::Noise::Perlin::_readTexelLinearDual ( const int &  u,
const int &  v,
const int &  o 
)
private

Read texel linear dual.

Parameters
uu
vv
oOctave
Returns
int

Definition at line 526 of file Perlin.cpp.

+ Here is the caller graph for this function:

◆ _updateGPUNormalMapResources()

void Hydrax::Noise::Perlin::_updateGPUNormalMapResources ( )
private

Update gpu normal map resources.

Definition at line 378 of file Perlin.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ create()

void Hydrax::Noise::Perlin::create ( )
virtual

Create.

Reimplemented from Hydrax::Noise::Noise.

Definition at line 63 of file Perlin.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createGPUNormalMapResources()

bool Hydrax::Noise::Perlin::createGPUNormalMapResources ( GPUNormalMapManager g)
virtual

Create GPUNormalMap resources.

Parameters
gGPUNormalMapManager pointer
Returns
true if it needs to be created, false if not

Reimplemented from Hydrax::Noise::Noise.

Definition at line 126 of file Perlin.cpp.

+ Here is the call graph for this function:

◆ getOptions()

const Options& Hydrax::Noise::Perlin::getOptions ( ) const
inline

Get current Perlin noise options.

Returns
Current perlin noise options

Definition at line 226 of file Perlin.h.

◆ getValue()

float Hydrax::Noise::Perlin::getValue ( const float &  x,
const float &  y 
)
virtual

Get the especified x/y noise value.

Parameters
xX Coord
yY Coord
Returns
Noise value
Remarks
range [~-0.2, ~0.2]

Implements Hydrax::Noise::Noise.

Definition at line 403 of file Perlin.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadCfg()

bool Hydrax::Noise::Perlin::loadCfg ( Ogre::ConfigFile &  CfgFile)
virtual

Load config.

Returns
True if is the correct noise config

Reimplemented from Hydrax::Noise::Noise.

Definition at line 348 of file Perlin.cpp.

+ Here is the call graph for this function:

◆ remove()

void Hydrax::Noise::Perlin::remove ( )
virtual

Remove.

Reimplemented from Hydrax::Noise::Noise.

Definition at line 74 of file Perlin.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveCfg()

void Hydrax::Noise::Perlin::saveCfg ( Ogre::String &  Data)
virtual

Save config.

Parameters
DataString reference

Reimplemented from Hydrax::Noise::Noise.

Definition at line 335 of file Perlin.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setOptions()

void Hydrax::Noise::Perlin::setOptions ( const Options Options)

Set/Update perlin noise options.

Parameters
OptionsPerlin noise options
Remarks
If create() have been already called, Octaves option doesn't be updated.

Definition at line 91 of file Perlin.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update()

void Hydrax::Noise::Perlin::update ( const Ogre::Real &  timeSinceLastFrame)
virtual

Call it each frame.

Parameters
timeSinceLastFrameTime since last frame(delta)

Implements Hydrax::Noise::Noise.

Definition at line 367 of file Perlin.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ magnitude

float Hydrax::Noise::Perlin::magnitude
private

Definition at line 273 of file Perlin.h.

◆ mGPUNormalMapManager

GPUNormalMapManager* Hydrax::Noise::Perlin::mGPUNormalMapManager
private

GPUNormalMapManager pointer.

Definition at line 279 of file Perlin.h.

◆ mOptions

Options Hydrax::Noise::Perlin::mOptions
private

Perlin noise options.

Definition at line 282 of file Perlin.h.

◆ noise

int Hydrax::Noise::Perlin::noise[n_size_sq *noise_frames]
private

Perlin noise variables.

Definition at line 269 of file Perlin.h.

◆ o_noise

int Hydrax::Noise::Perlin::o_noise[n_size_sq *max_octaves]
private

Definition at line 270 of file Perlin.h.

◆ p_noise

int Hydrax::Noise::Perlin::p_noise[np_size_sq *(max_octaves >>(n_packsize-1))]
private

Definition at line 271 of file Perlin.h.

◆ r_noise

int* Hydrax::Noise::Perlin::r_noise
private

Definition at line 272 of file Perlin.h.

◆ time

double Hydrax::Noise::Perlin::time
private

Elapsed time.

Definition at line 276 of file Perlin.h.


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