RigsofRods
Soft-body Physics Simulation
Data Structures | Public Types | Public Member Functions | Private Member Functions | Private Attributes
SkyX::VClouds::DataManager Class Reference

#include <DataManager.h>

+ Collaboration diagram for SkyX::VClouds::DataManager:

Data Structures

struct  Cell
 Cell struct. More...
 

Public Types

enum  VolTextureId { VOL_TEX0 = 0, VOL_TEX1 = 1 }
 Volumetric textures enumeration. More...
 

Public Member Functions

 DataManager (VClouds *vc)
 Constructor. More...
 
 ~DataManager ()
 Destructor. More...
 
void create (const int &nx, const int &ny, const int &nz)
 Create. More...
 
void update (const Ogre::Real &timeSinceLastFrame)
 Update. More...
 
void remove ()
 Remove. More...
 
const bool & isCreated () const
 Has been create(...) already called? More...
 
void setUpdateTime (const float &UpdateTime)
 Set update time. More...
 
const Ogre::Real & getUpdateTime () const
 Get update time. More...
 
const Ogre::Real _getInterpolation () const
 Get current interpolation factor. More...
 
void setWheater (const float &Humidity, const float &AverageCloudsSize, const bool &delayedResponse=true)
 Set wheater parameters Use this funtion to update the cloud field parameters, you'll get a smart and smooth transition from your old setting to your new ones. More...
 
void addEllipsoid (Ellipsoid *e, const bool &UpdateProbabilities=true)
 Add ellipsoid: clouds are modelled as ellipsoids in our simulation approach, so. More...
 
void forceToUpdateData ()
 Forces the data manager to calculate the next step right now. More...
 

Private Member Functions

void _initData (const int &nx, const int &ny, const int &nz)
 Initialize data. More...
 
Cell *** _create3DCellArray (const int &nx, const int &ny, const int &nz, const bool &init=true)
 Create tridimensional cell array. More...
 
void _delete3DCellArray (Cell ***c, const int &nx, const int &ny)
 Delete tridimensional cell array. More...
 
void _copy3DCellArraysData (Cell ***src, Cell ***dest, const int &nx, const int &ny, const int &nz)
 Copy 3d cells arrays data. More...
 
void _performCalculations (const int &nx, const int &ny, const int &nz, const int &step, const int &xStart, const int &xEnd)
 Perform celullar automata simulation. More...
 
void _updateVolTextureData (Cell ***c, const VolTextureId &TexId, const int &nx, const int &ny, const int &nz)
 Update volumetric texture data. More...
 
const float _getDensityAt (Cell ***c, const int &nx, const int &ny, const int &nz, const int &x, const int &y, const int &z, const int &r, const float &strength) const
 Get continous density at a point. More...
 
const float _getDensityAt (Cell ***c, const int &x, const int &y, const int &z) const
 Get discrete density at a point. More...
 
const bool _fact (Cell ***c, const int &nx, const int &ny, const int &nz, const int &x, const int &y, const int &z) const
 Fact funtion. More...
 
void _clearProbabilities (Cell ***c, const int &nx, const int &ny, const int &nz, const bool &clearData)
 Clear probabilities. More...
 
void _updateProbabilities (Cell ***c, const int &nx, const int &ny, const int &nz, const bool &delayedResponse)
 Update probabilities based from the Ellipsoid vector. More...
 
const Ogre::Real _getLightAbsorcionAt (Cell ***c, const int &nx, const int &ny, const int &nz, const int &x, const int &y, const int &z, const Ogre::Vector3 &d, const float &att) const
 Get light absorcion factor at a point. More...
 
void _createVolTexture (const VolTextureId &TexId, const int &nx, const int &ny, const int &nz)
 Create volumetric texture. More...
 

Private Attributes

Cell *** mCellsCurrent
 Simulation data. More...
 
Cell *** mCellsTmp
 
float mCurrentTransition
 Current transition. More...
 
float mUpdateTime
 Update time. More...
 
int mStep
 Current calculation state. More...
 
int mXStart
 
int mXEnd
 
int mNx
 Complexities. More...
 
int mNy
 
int mNz
 
Ogre::TexturePtr mVolTextures [2]
 Volumetric textures array. More...
 
bool mVolTexToUpdate
 Current texture. More...
 
bool mCreated
 Has been create(...) already called? More...
 
FastFakeRandommFFRandom
 Fast fake random. More...
 
int mMaxNumberOfClouds
 Max number of clouds(Ellipsoids) More...
 
std::vector< Ellipsoid * > mEllipsoids
 Ellipsoids. More...
 
VCloudsmVClouds
 SkyX parent pointer. More...
 

Detailed Description

Definition at line 36 of file DataManager.h.

Member Enumeration Documentation

◆ VolTextureId

Volumetric textures enumeration.

Enumerator
VOL_TEX0 
VOL_TEX1 

Definition at line 58 of file DataManager.h.

Constructor & Destructor Documentation

◆ DataManager()

SkyX::VClouds::DataManager::DataManager ( VClouds vc)

Constructor.

Parameters
vcVClouds parent pointer

Definition at line 31 of file DataManager.cpp.

◆ ~DataManager()

SkyX::VClouds::DataManager::~DataManager ( )

Destructor.

Definition at line 50 of file DataManager.cpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ _clearProbabilities()

void SkyX::VClouds::DataManager::_clearProbabilities ( Cell ***  c,
const int &  nx,
const int &  ny,
const int &  nz,
const bool &  clearData 
)
private

Clear probabilities.

Parameters
cCells data
nxX size
nyY size
nzZ size
clearDataClear data?

Definition at line 368 of file DataManager.cpp.

+ Here is the caller graph for this function:

◆ _copy3DCellArraysData()

void SkyX::VClouds::DataManager::_copy3DCellArraysData ( Cell ***  src,
Cell ***  dest,
const int &  nx,
const int &  ny,
const int &  nz 
)
private

Copy 3d cells arrays data.

Parameters
srcSource
destDest
nxX size
nyY size
nzZ size

Definition at line 270 of file DataManager.cpp.

◆ _create3DCellArray()

DataManager::Cell *** SkyX::VClouds::DataManager::_create3DCellArray ( const int &  nx,
const int &  ny,
const int &  nz,
const bool &  init = true 
)
private

Create tridimensional cell array.

Parameters
nxX size
nyY size
nzZ size
initInitialize values
Returns
Cell 3d pointer

Definition at line 209 of file DataManager.cpp.

+ Here is the caller graph for this function:

◆ _createVolTexture()

void SkyX::VClouds::DataManager::_createVolTexture ( const VolTextureId TexId,
const int &  nx,
const int &  ny,
const int &  nz 
)
private

Create volumetric texture.

Parameters
TexIdTexture Id
nxX size
nyY size
nzZ size

Definition at line 573 of file DataManager.cpp.

+ Here is the caller graph for this function:

◆ _delete3DCellArray()

void SkyX::VClouds::DataManager::_delete3DCellArray ( Cell ***  c,
const int &  nx,
const int &  ny 
)
private

Delete tridimensional cell array.

Parameters
cCell pointer to be deleted
nxX size
nyY size

Definition at line 253 of file DataManager.cpp.

+ Here is the caller graph for this function:

◆ _fact()

const bool SkyX::VClouds::DataManager::_fact ( Cell ***  c,
const int &  nx,
const int &  ny,
const int &  nz,
const int &  x,
const int &  y,
const int &  z 
) const
private

Fact funtion.

Parameters
cCells data
nxX size
nyY size
nzZ size
xx Coord
yy Coord
zz Coord

Definition at line 518 of file DataManager.cpp.

+ Here is the caller graph for this function:

◆ _getDensityAt() [1/2]

const float SkyX::VClouds::DataManager::_getDensityAt ( Cell ***  c,
const int &  nx,
const int &  ny,
const int &  nz,
const int &  x,
const int &  y,
const int &  z,
const int &  r,
const float &  strength 
) const
private

Get continous density at a point.

Parameters
cCells data
nxX size
nyY size
nzZ size
xx Coord
yy Coord
zz Coord
rRadius
sgtrengthStrength

Definition at line 542 of file DataManager.cpp.

+ Here is the caller graph for this function:

◆ _getDensityAt() [2/2]

const float SkyX::VClouds::DataManager::_getDensityAt ( Cell ***  c,
const int &  x,
const int &  y,
const int &  z 
) const
private

Get discrete density at a point.

Parameters
cCells data
xx Coord
yy Coord
zz Coord

Definition at line 568 of file DataManager.cpp.

◆ _getInterpolation()

const Ogre::Real SkyX::VClouds::DataManager::_getInterpolation ( ) const
inline

Get current interpolation factor.

Returns
Interpolation factor
Remarks
Only for internal use

Definition at line 117 of file DataManager.h.

+ Here is the caller graph for this function:

◆ _getLightAbsorcionAt()

const Ogre::Real SkyX::VClouds::DataManager::_getLightAbsorcionAt ( Cell ***  c,
const int &  nx,
const int &  ny,
const int &  nz,
const int &  x,
const int &  y,
const int &  z,
const Ogre::Vector3 &  d,
const float &  att 
) const
private

Get light absorcion factor at a point.

Parameters
cCells data
nxX size
nyY size
nzZ size
xx Coord
yy Coord
zz Coord
dLight direction
attAttenuation factor

Definition at line 408 of file DataManager.cpp.

+ Here is the caller graph for this function:

◆ _initData()

void SkyX::VClouds::DataManager::_initData ( const int &  nx,
const int &  ny,
const int &  nz 
)
private

Initialize data.

Parameters
nxX complexity
nyY complexity
nzZ complexity

Definition at line 203 of file DataManager.cpp.

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

◆ _performCalculations()

void SkyX::VClouds::DataManager::_performCalculations ( const int &  nx,
const int &  ny,
const int &  nz,
const int &  step,
const int &  xStart,
const int &  xEnd 
)
private

Perform celullar automata simulation.

Parameters
nxX size
nyY size
nzZ size
stepCalculation step. Valid steps are 0,1,2,3.
xStartx start cell (included)
xEndx end cell (not included, until xEnd-1)

Definition at line 439 of file DataManager.cpp.

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

◆ _updateProbabilities()

void SkyX::VClouds::DataManager::_updateProbabilities ( Cell ***  c,
const int &  nx,
const int &  ny,
const int &  nz,
const bool &  delayedResponse 
)
private

Update probabilities based from the Ellipsoid vector.

Parameters
cCells data
nxX size
nyY size
nzZ size
delayedResponsefalse to change wheather conditions over several updates, true to change it at the moment

Definition at line 396 of file DataManager.cpp.

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

◆ _updateVolTextureData()

void SkyX::VClouds::DataManager::_updateVolTextureData ( Cell ***  c,
const VolTextureId TexId,
const int &  nx,
const int &  ny,
const int &  nz 
)
private

Update volumetric texture data.

Parameters
cCells data
TexIdTexture Id
nxX size
nyY size
nzZ size

Definition at line 595 of file DataManager.cpp.

+ Here is the caller graph for this function:

◆ addEllipsoid()

void SkyX::VClouds::DataManager::addEllipsoid ( Ellipsoid e,
const bool &  UpdateProbabilities = true 
)

Add ellipsoid: clouds are modelled as ellipsoids in our simulation approach, so.

. different kind of clouds can be modelled with ellipsoids compositions.

Parameters
eEllipsoid
UpdateProbabilitiesUpdate probabilities?

Definition at line 358 of file DataManager.cpp.

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

◆ create()

void SkyX::VClouds::DataManager::create ( const int &  nx,
const int &  ny,
const int &  nz 
)

Create.

Parameters
nxX complexity
nyY complexity
nzZ complexity

Definition at line 158 of file DataManager.cpp.

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

◆ forceToUpdateData()

void SkyX::VClouds::DataManager::forceToUpdateData ( )

Forces the data manager to calculate the next step right now.

Definition at line 179 of file DataManager.cpp.

+ Here is the call graph for this function:

◆ getUpdateTime()

const Ogre::Real& SkyX::VClouds::DataManager::getUpdateTime ( ) const
inline

Get update time.

Returns
Update time

Definition at line 108 of file DataManager.h.

◆ isCreated()

const bool& SkyX::VClouds::DataManager::isCreated ( ) const
inline

Has been create(...) already called?

Returns
true if created() have been already called

Definition at line 92 of file DataManager.h.

◆ remove()

void SkyX::VClouds::DataManager::remove ( )

Remove.

Definition at line 55 of file DataManager.cpp.

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

◆ setUpdateTime()

void SkyX::VClouds::DataManager::setUpdateTime ( const float &  UpdateTime)
inline

Set update time.

Parameters
UpdateTimeTime elapsed between data calculations, a little freeze could be experimented during these calculations on old CPU's

Definition at line 100 of file DataManager.h.

◆ setWheater()

void SkyX::VClouds::DataManager::setWheater ( const float &  Humidity,
const float &  AverageCloudsSize,
const bool &  delayedResponse = true 
)

Set wheater parameters Use this funtion to update the cloud field parameters, you'll get a smart and smooth transition from your old setting to your new ones.

Parameters
HumidityHumidity, in other words: the percentage of clouds in [0,1] range.
AverageCloudsSizeAverage clouds size, for example: if previous wheater clouds size parameter was very different from new one(i.e: more little) only the old biggest clouds are going to be keept and the little ones are going to be replaced
delayedResponsefalse to change wheather conditions over several updates, true to change it at the moment

Definition at line 295 of file DataManager.cpp.

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

◆ update()

void SkyX::VClouds::DataManager::update ( const Ogre::Real &  timeSinceLastFrame)

Update.

Parameters
timeSinceLastFrameTime elapsed since last frame

Definition at line 78 of file DataManager.cpp.

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

Field Documentation

◆ mCellsCurrent

Cell*** SkyX::VClouds::DataManager::mCellsCurrent
private

Simulation data.

Definition at line 268 of file DataManager.h.

◆ mCellsTmp

Cell *** SkyX::VClouds::DataManager::mCellsTmp
private

Definition at line 269 of file DataManager.h.

◆ mCreated

bool SkyX::VClouds::DataManager::mCreated
private

Has been create(...) already called?

Definition at line 287 of file DataManager.h.

◆ mCurrentTransition

float SkyX::VClouds::DataManager::mCurrentTransition
private

Current transition.

Definition at line 272 of file DataManager.h.

◆ mEllipsoids

std::vector<Ellipsoid*> SkyX::VClouds::DataManager::mEllipsoids
private

Ellipsoids.

Definition at line 295 of file DataManager.h.

◆ mFFRandom

FastFakeRandom* SkyX::VClouds::DataManager::mFFRandom
private

Fast fake random.

Definition at line 290 of file DataManager.h.

◆ mMaxNumberOfClouds

int SkyX::VClouds::DataManager::mMaxNumberOfClouds
private

Max number of clouds(Ellipsoids)

Definition at line 293 of file DataManager.h.

◆ mNx

int SkyX::VClouds::DataManager::mNx
private

Complexities.

Definition at line 279 of file DataManager.h.

◆ mNy

int SkyX::VClouds::DataManager::mNy
private

Definition at line 279 of file DataManager.h.

◆ mNz

int SkyX::VClouds::DataManager::mNz
private

Definition at line 279 of file DataManager.h.

◆ mStep

int SkyX::VClouds::DataManager::mStep
private

Current calculation state.

Definition at line 276 of file DataManager.h.

◆ mUpdateTime

float SkyX::VClouds::DataManager::mUpdateTime
private

Update time.

Definition at line 274 of file DataManager.h.

◆ mVClouds

VClouds* SkyX::VClouds::DataManager::mVClouds
private

SkyX parent pointer.

Definition at line 298 of file DataManager.h.

◆ mVolTexToUpdate

bool SkyX::VClouds::DataManager::mVolTexToUpdate
private

Current texture.

Definition at line 284 of file DataManager.h.

◆ mVolTextures

Ogre::TexturePtr SkyX::VClouds::DataManager::mVolTextures[2]
private

Volumetric textures array.

Definition at line 282 of file DataManager.h.

◆ mXEnd

int SkyX::VClouds::DataManager::mXEnd
private

Definition at line 276 of file DataManager.h.

◆ mXStart

int SkyX::VClouds::DataManager::mXStart
private

Definition at line 276 of file DataManager.h.


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