#include <FlatCloudLayer.h>
Public Member Functions | |
FlatCloudLayer (Ogre::SceneManager *sceneMgr, Ogre::SceneNode *cloudRoot) | |
void | update (Ogre::Real timePassed, const Ogre::Vector3 &sunDirection, const Ogre::ColourValue &sunLightColour, const Ogre::ColourValue &fogColour, const Ogre::ColourValue &sunSphereColour) |
Update function called each frame from above. | |
void | reset () |
Reset most tweak settings to their default values. | |
void | _ensureGeometry () |
Regenerate the plane mesh and recreate entity. | |
void | _invalidateGeometry () |
Regenerate the plane mesh and recreate entity. | |
void | setMeshParameters (Real meshWidth, Real meshHeight, int meshWidthSegments, int meshHeightSegments) |
Reset all mesh parameters. | |
void | setMeshWidth (Real value) |
void | setMeshHeight (Real value) |
void | setMeshWidthSegments (int value) |
void | setMeshHeightSegments (int value) |
Real | getMeshWidth () const |
Real | getMeshHeight () const |
int | getMeshWidthSegments () const |
int | getMeshHeightSegments () const |
void | setHeight (Ogre::Real height) |
Set the height of the cloud layer. | |
Ogre::Real | getHeight () const |
Get the height of the cloud layer. | |
void | setCloudSpeed (const Ogre::Vector2 &cloudSpeed) |
Sets cloud movement speed. | |
const Ogre::Vector2 | getCloudSpeed () const |
Gets cloud movement speed. | |
void | setCloudCover (const Ogre::Real cloudCover) |
Sets cloud cover, between 0 (completely clear) and 1 (completely covered). | |
Ogre::Real | getCloudCover () const |
Gets the current cloud cover. | |
void | setCloudCoverLookup (const Ogre::String &fileName) |
Set the image used to lookup the cloud coverage threshold. | |
void | disableCloudCoverLookup () |
Disable any cloud cover lookup. | |
void | setCloudBlendTime (const Ogre::Real value) |
Sets the time it takes to blend two cloud shaped together, in seconds. | |
Ogre::Real | getCloudBlendTime () const |
Gets the time it takes to blend two cloud shaped together, in seconds. | |
void | setCloudBlendPos (const Ogre::Real value) |
Set the current blending position; between noise textures. | |
Ogre::Real | getCloudBlendPos () const |
void | setCloudUVFactor (const Ogre::Real value) |
Cloud texture coordinates are multiplied with this. | |
Ogre::Real | getCloudUVFactor () const |
void | setHeightRedFactor (const Ogre::Real value) |
High-altitude clouds are tinted red in the evening. | |
Ogre::Real | getHeightRedFactor () const |
void | setFadeDistances (Ogre::Real nearValue, Ogre::Real farValue) |
Cloud fade distances. | |
void | setNearFadeDist (const Ogre::Real value) |
Ogre::Real | getNearFadeDist () const |
void | setFarFadeDist (const Ogre::Real value) |
Ogre::Real | getFarFadeDist () const |
void | setQueryFlags (uint flags) |
uint | getQueryFlags () const |
void | setVisibilityFlags (uint flags) |
uint | getVisibilityFlags () const |
Supports movement and variable cloud cover.
Definition at line 34 of file FlatCloudLayer.h.
void Caelum::FlatCloudLayer::_ensureGeometry | ( | ) |
Regenerate the plane mesh and recreate entity.
This automatically happens in update.
Definition at line 89 of file FlatCloudLayer.cpp.
References Ogre::SceneManager::createEntity(), Caelum::OwnedPtr< PointedT, TraitsT >::get(), Ogre::MeshManager::getSingleton(), Caelum::OwnedPtr< PointedT, TraitsT >::reset(), Ogre::StringConverter::toString(), and Ogre::Vector3::UNIT_X.
Referenced by update().
void Caelum::FlatCloudLayer::_invalidateGeometry | ( | ) |
Regenerate the plane mesh and recreate entity.
This automatically happens when mesh parameters are changed.
Definition at line 85 of file FlatCloudLayer.cpp.
Referenced by reset(), and setMeshParameters().
void Caelum::FlatCloudLayer::setMeshWidth | ( | Real | value | ) | [inline] |
void Caelum::FlatCloudLayer::setHeight | ( | Ogre::Real | height | ) |
Set the height of the cloud layer.
height | In world units above the cloud root node. |
Definition at line 293 of file FlatCloudLayer.cpp.
Referenced by Caelum::CloudSystem::createLayerAtHeight().
Ogre::Real Caelum::FlatCloudLayer::getHeight | ( | void | ) | const |
Get the height of the cloud layer.
Definition at line 299 of file FlatCloudLayer.cpp.
void Caelum::FlatCloudLayer::setCloudSpeed | ( | const Ogre::Vector2 & | cloudSpeed | ) |
Sets cloud movement speed.
cloudSpeed | Cloud movement speed. |
Definition at line 272 of file FlatCloudLayer.cpp.
Referenced by reset().
const Ogre::Vector2 Caelum::FlatCloudLayer::getCloudSpeed | ( | ) | const [inline] |
Gets cloud movement speed.
cloudSpeed | Cloud movement speed. |
Definition at line 150 of file FlatCloudLayer.h.
void Caelum::FlatCloudLayer::setCloudCover | ( | const Ogre::Real | cloudCover | ) |
Sets cloud cover, between 0 (completely clear) and 1 (completely covered).
cloudCover | Cloud cover between 0 and 1 |
Definition at line 212 of file FlatCloudLayer.cpp.
Referenced by Caelum::CaelumSystem::autoConfigure(), and reset().
Ogre::Real Caelum::FlatCloudLayer::getCloudCover | ( | ) | const [inline] |
Gets the current cloud cover.
Definition at line 160 of file FlatCloudLayer.h.
void Caelum::FlatCloudLayer::setCloudCoverLookup | ( | const Ogre::String & | fileName | ) |
Set the image used to lookup the cloud coverage threshold.
This image is used to calculate the cloud coverage threshold based on the desired cloud cover.
The cloud coverage threshold is substracted from cloud intensity at any point; to generate fewer or more clouds. That threshold is not linear, a lookup is required to ensure that setCloudCover(0.1) will actually have 10% the clouds at setCloudCover(1).
The lookup is the inverse of the sum on the histogram, and was calculated with a small hacky tool.
Definition at line 206 of file FlatCloudLayer.cpp.
Referenced by reset().
void Caelum::FlatCloudLayer::disableCloudCoverLookup | ( | ) |
void Caelum::FlatCloudLayer::setCloudBlendTime | ( | const Ogre::Real | value | ) |
Sets the time it takes to blend two cloud shaped together, in seconds.
This will also reset the animation at the current time.
value | Cloud shape blend time in seconds |
Definition at line 233 of file FlatCloudLayer.cpp.
Referenced by reset().
Ogre::Real Caelum::FlatCloudLayer::getCloudBlendTime | ( | ) | const |
Gets the time it takes to blend two cloud shaped together, in seconds.
Definition at line 237 of file FlatCloudLayer.cpp.
void Caelum::FlatCloudLayer::setCloudBlendPos | ( | const Ogre::Real | value | ) |
Set the current blending position; between noise textures.
Integer values are used for single textures. Float values blend between two textures. Values outside [0, textureCount) are wrapped around.
value | New cloud blending position |
Definition at line 241 of file FlatCloudLayer.cpp.
Ogre::Real Caelum::FlatCloudLayer::getCloudBlendPos | ( | ) | const |
Definition at line 268 of file FlatCloudLayer.cpp.
Referenced by update().
void Caelum::FlatCloudLayer::setCloudUVFactor | ( | const Ogre::Real | value | ) |
Cloud texture coordinates are multiplied with this.
Higher values result in more spread-out clouds. Very low value result in ugly texture repeats.
Definition at line 303 of file FlatCloudLayer.cpp.
Referenced by reset().
Ogre::Real Caelum::FlatCloudLayer::getCloudUVFactor | ( | ) | const [inline] |
void Caelum::FlatCloudLayer::setHeightRedFactor | ( | const Ogre::Real | value | ) |
High-altitude clouds are tinted red in the evening.
Higher values attenuate the effect.
Definition at line 307 of file FlatCloudLayer.cpp.
Referenced by reset().
Ogre::Real Caelum::FlatCloudLayer::getHeightRedFactor | ( | ) | const [inline] |
void Caelum::FlatCloudLayer::setFadeDistances | ( | Ogre::Real | nearValue, | |
Ogre::Real | farValue | |||
) |
Cloud fade distances.
These are measured horizontally in meters (height is not used).
The effect is a fade based on alpha blending which occurs between nearValue and farValue. After farValue nothing is visibile from this layer.
Default values are 10000 and 140000
Definition at line 311 of file FlatCloudLayer.cpp.
Referenced by reset().