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

This class is a sea elevation module that combines several effects:
Waves, defined by direction, amplitude, period and optionally, phase. Perlin noise, used to randomize the sea surface. Pressure points, used to create puntual waves. More...

#include <Noise/Real/Real.h>

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

Public Member Functions

 Real ()
 Default constructor. More...
 
 ~Real ()
 Destructor. More...
 
void create ()
 Create. More...
 
void remove ()
 Remove. More...
 
int addWave (Ogre::Vector2 dir, float A, float T, float p=0.f)
 Adds a wave to the system. More...
 
int addPressurePoint (Ogre::Vector2 Orig, float p, float T, float L)
 Adds a pressure point to the system. More...
 
Wave getWave (int id) const
 Returns a wave to the system. More...
 
bool eraseWave (int id)
 Removes a wave from the system. More...
 
bool modifyWave (int id, Ogre::Vector2 dir, float A, float T, float p=0.f)
 Modify a wave from the system. 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...
 
PerlingetPerlinNoise () const
 Get current Real 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 Attributes

double mTime
 Elapsed time. More...
 
PerlinmPerlinNoise
 Perlin noise. More...
 
GPUNormalMapManagermGPUNormalMapManager
 GPUNormalMapManager pointer. More...
 
std::vector< WavemWaves
 Vector of waves. More...
 
std::vector< PressurePointmPressurePoints
 Vector of pressure points. 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

This class is a sea elevation module that combines several effects:
Waves, defined by direction, amplitude, period and optionally, phase. Perlin noise, used to randomize the sea surface. Pressure points, used to create puntual waves.

Definition at line 68 of file Real.h.

Constructor & Destructor Documentation

◆ Real()

Hydrax::Noise::Real::Real ( )

Default constructor.

Definition at line 38 of file Real.cpp.

◆ ~Real()

Hydrax::Noise::Real::~Real ( )

Destructor.

Definition at line 47 of file Real.cpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ addPressurePoint()

int Hydrax::Noise::Real::addPressurePoint ( Ogre::Vector2  Orig,
float  p,
float  T,
float  L 
)

Adds a pressure point to the system.

Parameters
OrigOrigin of perturbation.
pPressure pulse (N·m).
The maximum half-amplitude of the wave will result from divide this value with g*rho. So, a pressure of 10000 N·m produces 2 m waves.
TMaximum time of perturbation (s).
The effect of the perturbation will decay. When T time will be elapsed, any effects will remain.
Lwave length.
To objects falling, similar values to amplitude can be OK. For ships Kelvin wakes probably length of the ship is a better choice.
Returns
Id of the pressure point.
Warning
Pressure point will be autodestroyed when it have not any effect, so it's not available any modify after the creation.

Definition at line 92 of file Real.cpp.

◆ addWave()

int Hydrax::Noise::Real::addWave ( Ogre::Vector2  dir,
float  A,
float  T,
float  p = 0.f 
)

Adds a wave to the system.

Parameters
dirDirection of the wave.
AAmplitude of the wave (m).
TPeriod of the wave (s).
pPhase of the wave (rad).
Returns
Id of the wave.

Definition at line 86 of file Real.cpp.

◆ create()

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

Create.

Reimplemented from Hydrax::Noise::Noise.

Definition at line 55 of file Real.cpp.

+ Here is the call graph for this function:

◆ createGPUNormalMapResources()

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

◆ eraseWave()

bool Hydrax::Noise::Real::eraseWave ( int  id)

Removes a wave from the system.

Parameters
idIdentifier of the wave.
Returns
true if all gone right, or false if errors happen.

Definition at line 103 of file Real.cpp.

◆ getPerlinNoise()

Perlin* Hydrax::Noise::Real::getPerlinNoise ( ) const
inline

Get current Real noise options.

Returns
Current Real noise options

Definition at line 166 of file Real.h.

◆ getValue()

float Hydrax::Noise::Real::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]

1st.- Perlin height

2nd.- Waves height

3rd.- Pressure points height

Implements Hydrax::Noise::Noise.

Definition at line 178 of file Real.cpp.

+ Here is the call graph for this function:

◆ getWave()

Wave Hydrax::Noise::Real::getWave ( int  id) const

Returns a wave to the system.

Parameters
idIdentifier of the wave.
Returns
Selected wave.

Definition at line 98 of file Real.cpp.

◆ loadCfg()

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

Load config.

Returns
True if is the correct noise config

Reimplemented from Hydrax::Noise::Noise.

Definition at line 142 of file Real.cpp.

+ Here is the call graph for this function:

◆ modifyWave()

bool Hydrax::Noise::Real::modifyWave ( int  id,
Ogre::Vector2  dir,
float  A,
float  T,
float  p = 0.f 
)

Modify a wave from the system.

Parameters
idIdentifier of the wave.
AAmplitude of the wave (m).
TPeriod of the wave (s).
pPhase of the wave (rad).
Returns
true if all gone right, or false if errors happen.

Definition at line 120 of file Real.cpp.

◆ remove()

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

Remove.

Reimplemented from Hydrax::Noise::Noise.

Definition at line 66 of file Real.cpp.

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

◆ saveCfg()

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

Save config.

Parameters
DataString reference

Reimplemented from Hydrax::Noise::Noise.

Definition at line 137 of file Real.cpp.

+ Here is the call graph for this function:

◆ update()

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

Call it each frame.

Parameters
timeSinceLastFrameTime since last frame(delta)

Implements Hydrax::Noise::Noise.

Definition at line 163 of file Real.cpp.

+ Here is the call graph for this function:

Field Documentation

◆ mGPUNormalMapManager

GPUNormalMapManager* Hydrax::Noise::Real::mGPUNormalMapManager
private

GPUNormalMapManager pointer.

Definition at line 179 of file Real.h.

◆ mPerlinNoise

Perlin* Hydrax::Noise::Real::mPerlinNoise
private

Perlin noise.

Definition at line 176 of file Real.h.

◆ mPressurePoints

std::vector<PressurePoint> Hydrax::Noise::Real::mPressurePoints
private

Vector of pressure points.

Definition at line 185 of file Real.h.

◆ mTime

double Hydrax::Noise::Real::mTime
private

Elapsed time.

Definition at line 173 of file Real.h.

◆ mWaves

std::vector<Wave> Hydrax::Noise::Real::mWaves
private

Vector of waves.

Definition at line 182 of file Real.h.


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