Rigs of Rods 2026.01
Soft-body Physics Simulation
Loading...
Searching...
No Matches
Data Structures | Public Types | Public Member Functions | Private Member Functions | Private Attributes
SkyX::VClouds::DataManager Class Reference

Description

Definition at line 36 of file DataManager.h.

Data Structures

struct  Cell
 

Public Types

enum  VolTextureId
 

Public Member Functions

 DataManager (VClouds *vc)
 
 ~DataManager ()
 
void create (const int &nx, const int &ny, const int &nz)
 
void update (const Ogre::Real &timeSinceLastFrame)
 
void remove ()
 
const bool & isCreated () const
 
void setUpdateTime (const float &UpdateTime)
 
const Ogre::Real & getUpdateTime () const
 
const Ogre::Real _getInterpolation () const
 
void setWheater (const float &Humidity, const float &AverageCloudsSize, const bool &delayedResponse=true)
 
void addEllipsoid (Ellipsoid *e, const bool &UpdateProbabilities=true)
 
void forceToUpdateData ()
 

Private Member Functions

void _initData (const int &nx, const int &ny, const int &nz)
 
Cell *** _create3DCellArray (const int &nx, const int &ny, const int &nz, const bool &init=true)
 
void _delete3DCellArray (Cell ***c, const int &nx, const int &ny)
 
void _copy3DCellArraysData (Cell ***src, Cell ***dest, const int &nx, const int &ny, const int &nz)
 
void _performCalculations (const int &nx, const int &ny, const int &nz, const int &step, const int &xStart, const int &xEnd)
 
void _updateVolTextureData (Cell ***c, const VolTextureId &TexId, const int &nx, const int &ny, const int &nz)
 
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
 
const float _getDensityAt (Cell ***c, const int &x, const int &y, const int &z) const
 
const bool _fact (Cell ***c, const int &nx, const int &ny, const int &nz, const int &x, const int &y, const int &z) const
 
void _clearProbabilities (Cell ***c, const int &nx, const int &ny, const int &nz, const bool &clearData)
 
void _updateProbabilities (Cell ***c, const int &nx, const int &ny, const int &nz, const bool &delayedResponse)
 
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
 
void _createVolTexture (const VolTextureId &TexId, const int &nx, const int &ny, const int &nz)
 

Private Attributes

Cell *** mCellsCurrent
 
Cell *** mCellsTmp
 
float mCurrentTransition
 
float mUpdateTime
 
int mStep
 
int mXStart
 
int mXEnd
 
int mNx
 
int mNy
 
int mNz
 
Ogre::TexturePtr mVolTextures [2]
 
bool mVolTexToUpdate
 
bool mCreated
 
FastFakeRandom * mFFRandom
 
int mMaxNumberOfClouds
 
std::vector< Ellipsoid * > mEllipsoids
 
VClouds * mVClouds
 

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.

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.

◆ _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.

◆ _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.

◆ _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.

◆ _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.

◆ _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.

◆ _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.

◆ _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.

◆ _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.

◆ _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.

◆ _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.

◆ _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.

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ 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.

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: