![]() |
RigsofRods
2023.09
Soft-body Physics Simulation
|
#include <DataManager.h>
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... | |
| FastFakeRandom * | mFFRandom |
| Fast fake random. More... | |
| int | mMaxNumberOfClouds |
| Max number of clouds(Ellipsoids) More... | |
| std::vector< Ellipsoid * > | mEllipsoids |
| Ellipsoids. More... | |
| VClouds * | mVClouds |
| SkyX parent pointer. More... | |
Definition at line 36 of file DataManager.h.
Volumetric textures enumeration.
| Enumerator | |
|---|---|
| VOL_TEX0 | |
| VOL_TEX1 | |
Definition at line 58 of file DataManager.h.
| SkyX::VClouds::DataManager::DataManager | ( | VClouds * | vc | ) |
| SkyX::VClouds::DataManager::~DataManager | ( | ) |
Destructor.
Definition at line 50 of file DataManager.cpp.
|
private |
Clear probabilities.
| c | Cells data |
| nx | X size |
| ny | Y size |
| nz | Z size |
| clearData | Clear data? |
Definition at line 368 of file DataManager.cpp.
|
private |
Copy 3d cells arrays data.
| src | Source |
| dest | Dest |
| nx | X size |
| ny | Y size |
| nz | Z size |
Definition at line 270 of file DataManager.cpp.
|
private |
Create tridimensional cell array.
| nx | X size |
| ny | Y size |
| nz | Z size |
| init | Initialize values |
Definition at line 209 of file DataManager.cpp.
|
private |
Create volumetric texture.
| TexId | Texture Id |
| nx | X size |
| ny | Y size |
| nz | Z size |
Definition at line 573 of file DataManager.cpp.
|
private |
Delete tridimensional cell array.
| c | Cell pointer to be deleted |
| nx | X size |
| ny | Y size |
Definition at line 253 of file DataManager.cpp.
|
private |
Fact funtion.
| c | Cells data |
| nx | X size |
| ny | Y size |
| nz | Z size |
| x | x Coord |
| y | y Coord |
| z | z Coord |
Definition at line 518 of file DataManager.cpp.
|
private |
Get continous density at a point.
| c | Cells data |
| nx | X size |
| ny | Y size |
| nz | Z size |
| x | x Coord |
| y | y Coord |
| z | z Coord |
| r | Radius |
| sgtrength | Strength |
Definition at line 542 of file DataManager.cpp.
|
private |
Get discrete density at a point.
| c | Cells data |
| x | x Coord |
| y | y Coord |
| z | z Coord |
Definition at line 568 of file DataManager.cpp.
|
inline |
Get current interpolation factor.
Definition at line 117 of file DataManager.h.
|
private |
Get light absorcion factor at a point.
| c | Cells data |
| nx | X size |
| ny | Y size |
| nz | Z size |
| x | x Coord |
| y | y Coord |
| z | z Coord |
| d | Light direction |
| att | Attenuation factor |
Definition at line 408 of file DataManager.cpp.
|
private |
Initialize data.
| nx | X complexity |
| ny | Y complexity |
| nz | Z complexity |
Definition at line 203 of file DataManager.cpp.
|
private |
Perform celullar automata simulation.
| nx | X size |
| ny | Y size |
| nz | Z size |
| step | Calculation step. Valid steps are 0,1,2,3. |
| xStart | x start cell (included) |
| xEnd | x end cell (not included, until xEnd-1) |
Definition at line 439 of file DataManager.cpp.
|
private |
Update probabilities based from the Ellipsoid vector.
| c | Cells data |
| nx | X size |
| ny | Y size |
| nz | Z size |
| delayedResponse | false to change wheather conditions over several updates, true to change it at the moment |
Definition at line 396 of file DataManager.cpp.
|
private |
Update volumetric texture data.
| c | Cells data |
| TexId | Texture Id |
| nx | X size |
| ny | Y size |
| nz | Z size |
Definition at line 595 of file DataManager.cpp.
| 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.
| e | Ellipsoid |
| UpdateProbabilities | Update probabilities? |
Definition at line 358 of file DataManager.cpp.
| void SkyX::VClouds::DataManager::create | ( | const int & | nx, |
| const int & | ny, | ||
| const int & | nz | ||
| ) |
Create.
| nx | X complexity |
| ny | Y complexity |
| nz | Z complexity |
Definition at line 158 of file DataManager.cpp.
| void SkyX::VClouds::DataManager::forceToUpdateData | ( | ) |
Forces the data manager to calculate the next step right now.
Definition at line 179 of file DataManager.cpp.
|
inline |
|
inline |
Has been create(...) already called?
Definition at line 92 of file DataManager.h.
| void SkyX::VClouds::DataManager::remove | ( | ) |
Remove.
Definition at line 55 of file DataManager.cpp.
|
inline |
Set update time.
| UpdateTime | Time 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.
| 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.
| Humidity | Humidity, in other words: the percentage of clouds in [0,1] range. |
| AverageCloudsSize | Average 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 |
| delayedResponse | false to change wheather conditions over several updates, true to change it at the moment |
Definition at line 295 of file DataManager.cpp.
| void SkyX::VClouds::DataManager::update | ( | const Ogre::Real & | timeSinceLastFrame | ) |
Update.
| timeSinceLastFrame | Time elapsed since last frame |
Definition at line 78 of file DataManager.cpp.
|
private |
Simulation data.
Definition at line 268 of file DataManager.h.
|
private |
Definition at line 269 of file DataManager.h.
|
private |
Has been create(...) already called?
Definition at line 287 of file DataManager.h.
|
private |
Current transition.
Definition at line 272 of file DataManager.h.
|
private |
Ellipsoids.
Definition at line 295 of file DataManager.h.
|
private |
Fast fake random.
Definition at line 290 of file DataManager.h.
|
private |
Max number of clouds(Ellipsoids)
Definition at line 293 of file DataManager.h.
|
private |
Complexities.
Definition at line 279 of file DataManager.h.
|
private |
Definition at line 279 of file DataManager.h.
|
private |
Definition at line 279 of file DataManager.h.
|
private |
Current calculation state.
Definition at line 276 of file DataManager.h.
|
private |
Update time.
Definition at line 274 of file DataManager.h.
|
private |
SkyX parent pointer.
Definition at line 298 of file DataManager.h.
|
private |
Current texture.
Definition at line 284 of file DataManager.h.
|
private |
Volumetric textures array.
Definition at line 282 of file DataManager.h.
|
private |
Definition at line 276 of file DataManager.h.
|
private |
Definition at line 276 of file DataManager.h.
1.8.17