Rigs of Rods 2026.01
Soft-body Physics Simulation
Loading...
Searching...
No Matches
Data Structures | Public Member Functions | Private Member Functions | Private Attributes
Hydrax::Noise::FFT Class Reference

Description

FFT noise module class.

Definition at line 44 of file FFT.h.

+ Inheritance diagram for Hydrax::Noise::FFT:

Data Structures

struct  Options
 

Public Member Functions

 FFT ()
 
 FFT (const Options &Options)
 
 ~FFT ()
 
void create ()
 
bool createGPUNormalMapResources (GPUNormalMapManager *g)
 
void remove ()
 
void update (const Ogre::Real &timeSinceLastFrame)
 
void saveCfg (Ogre::String &Data)
 
bool loadCfg (Ogre::ConfigFile &CfgFile)
 
float getValue (const float &x, const float &y)
 
void setOptions (const Options &Options)
 
const Options & getOptions () const
 
- Public Member Functions inherited from Hydrax::Noise::Noise
 Noise (const Ogre::String &Name, const bool &GPUNormalMapSupported)
 
virtual ~Noise ()
 
virtual void removeGPUNormalMapResources (GPUNormalMapManager *g)
 
const Ogre::String & getName () const
 
const bool & isCreated () const
 
const bool & isGPUNormalMapSupported () const
 
const bool & areGPUNormalMapResourcesCreated () const
 

Private Member Functions

void _initNoise ()
 
void _calculeNoise (const float &delta)
 
void _executeInverseFFT ()
 
void _normalizeFFTData (const float &scale)
 
const float _getPhillipsSpectrum (const Ogre::Vector2 &waveVector, const Ogre::Vector2 &wind, const float &kwPower_=2.0f) const
 
const float _getGaussianRandomFloat () const
 
void _updateGPUNormalMapResources ()
 

Private Attributes

int resolution
 
float * re
 
float * img
 
float maximalValue
 
std::complex< float > * initialWaves
 
std::complex< float > * currentWaves
 
float * angularFrequencies
 
float time
 
GPUNormalMapManager * mGPUNormalMapManager
 
Options mOptions
 

Additional Inherited Members

- Protected Attributes inherited from Hydrax::Noise::Noise
Ogre::String mName
 
bool mCreated
 
bool mGPUNormalMapSupported
 
bool mGPUNormalMapResourcesCreated
 

Constructor & Destructor Documentation

◆ FFT() [1/2]

Hydrax::Noise::FFT::FFT ( )

Default constructor.

Definition at line 37 of file FFT.cpp.

◆ FFT() [2/2]

Hydrax::Noise::FFT::FFT ( const Options &  Options)

Constructor.

Parameters
OptionsFFT noise options

Definition at line 51 of file FFT.cpp.

◆ ~FFT()

Hydrax::Noise::FFT::~FFT ( )

Destructor.

Definition at line 66 of file FFT.cpp.

Member Function Documentation

◆ _calculeNoise()

void Hydrax::Noise::FFT::_calculeNoise ( const float &  delta)
private

Calcule noise.

Parameters
deltaTime elapsed since last frame

Definition at line 469 of file FFT.cpp.

◆ _executeInverseFFT()

void Hydrax::Noise::FFT::_executeInverseFFT ( )
private

Execute inverse fast fourier transform.

Definition at line 547 of file FFT.cpp.

◆ _getGaussianRandomFloat()

const float Hydrax::Noise::FFT::_getGaussianRandomFloat ( ) const
private

Get a Gaussian random number with mean 0 and standard deviation 1, using Box - muller transform.

Returns
Gaussian random number with mean 0 and standard deviation 1, using Box - muller transform

Definition at line 506 of file FFT.cpp.

◆ _getPhillipsSpectrum()

const float Hydrax::Noise::FFT::_getPhillipsSpectrum ( const Ogre::Vector2 &  waveVector,
const Ogre::Vector2 &  wind,
const float &  kwPower_ = 2.0f 
) const
private

Get the Philipps Spectrum, used to create the amplitudes and phases.

Parameters
waveVectorWave vector
windWind direction
kwPower_kwPower
Returns
Philipps Spectrum

Definition at line 525 of file FFT.cpp.

◆ _initNoise()

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

Initialize noise.

Definition at line 433 of file FFT.cpp.

◆ _normalizeFFTData()

void Hydrax::Noise::FFT::_normalizeFFTData ( const float &  scale)
private

Normalize fft data.

Parameters
scaleUser defined scale

Definition at line 714 of file FFT.cpp.

◆ _updateGPUNormalMapResources()

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

Update gpu normal map resources.

Definition at line 371 of file FFT.cpp.

◆ create()

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

Create.

Reimplemented from Hydrax::Noise::Noise.

Definition at line 73 of file FFT.cpp.

◆ createGPUNormalMapResources()

bool Hydrax::Noise::FFT::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 175 of file FFT.cpp.

◆ getOptions()

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

Get current FFT noise options.

Returns
Current fft noise options

Definition at line 213 of file FFT.h.

◆ getValue()

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

Get the especified x/y noise value.

Parameters
xX Coord
yY Coord
Returns
Noise value

Implements Hydrax::Noise::Noise.

Definition at line 757 of file FFT.cpp.

◆ loadCfg()

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

Load config.

Returns
True if is the correct noise config

Reimplemented from Hydrax::Noise::Noise.

Definition at line 404 of file FFT.cpp.

◆ remove()

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

Remove.

Reimplemented from Hydrax::Noise::Noise.

Definition at line 85 of file FFT.cpp.

◆ saveCfg()

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

Save config.

Parameters
DataString reference

Reimplemented from Hydrax::Noise::Noise.

Definition at line 391 of file FFT.cpp.

◆ setOptions()

void Hydrax::Noise::FFT::setOptions ( const Options &  Options)

Set/Update fft noise options.

Parameters
OptionsFFT noise options

Definition at line 125 of file FFT.cpp.

◆ update()

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

Call it each frame.

Parameters
timeSinceLastFrameTime since last frame(delta)

Implements Hydrax::Noise::Noise.

Definition at line 423 of file FFT.cpp.

Field Documentation

◆ angularFrequencies

float* Hydrax::Noise::FFT::angularFrequencies
private

the angular frequencies

Definition at line 266 of file FFT.h.

◆ currentWaves

std::complex<float>* Hydrax::Noise::FFT::currentWaves
private

the data of the simulation at time t, which is formed using the data at time 0 and the angular frequencies at time t

Definition at line 264 of file FFT.h.

◆ img

float * Hydrax::Noise::FFT::img
private

Definition at line 257 of file FFT.h.

◆ initialWaves

std::complex<float>* Hydrax::Noise::FFT::initialWaves
private

the data which is referred as h0{x,t), that is, the data of the simulation at the time 0.

Definition at line 262 of file FFT.h.

◆ maximalValue

float Hydrax::Noise::FFT::maximalValue
private

The minimal value of the result data of the fft transformation.

Definition at line 259 of file FFT.h.

◆ mGPUNormalMapManager

GPUNormalMapManager* Hydrax::Noise::FFT::mGPUNormalMapManager
private

GPUNormalMapManager pointer.

Definition at line 271 of file FFT.h.

◆ mOptions

Options Hydrax::Noise::FFT::mOptions
private

Perlin noise options.

Definition at line 274 of file FFT.h.

◆ re

float* Hydrax::Noise::FFT::re
private

Pointers to resolution*resolution float size arrays.

Definition at line 257 of file FFT.h.

◆ resolution

int Hydrax::Noise::FFT::resolution
private

FFT resolution.

Definition at line 255 of file FFT.h.

◆ time

float Hydrax::Noise::FFT::time
private

Current time.

Definition at line 268 of file FFT.h.


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