#include <FlatCloudLayer.h>
Classes | |
struct | Params |
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 | advanceAnimation (Ogre::Real timePassed) |
Advance cloud animation (the time part of FlatCloudLayer::update). | |
void | reset () |
Reset most tweak settings to their default values. | |
void | setCloudSpeed (const Ogre::Vector2 &cloudSpeed) |
Sets cloud movement speed. | |
const Ogre::Vector2 | getCloudSpeed () const |
Gets cloud movement speed. | |
void | setSunDirection (const Ogre::Vector3 &sunDirection) |
void | setSunLightColour (const Ogre::ColourValue &sunLightColour) |
void | setSunSphereColour (const Ogre::ColourValue &sunSphereColour) |
void | setFogColour (const Ogre::ColourValue &fogColour) |
const Ogre::Vector3 | getSunDirection () const |
const Ogre::ColourValue | getSunLightColour () const |
const Ogre::ColourValue | getSunSphereColour () const |
const Ogre::ColourValue | getFogColour () const |
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 | 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. | |
const Ogre::String | getCloudCoverLookupFileName () const |
Get the filename of the cloud cover lookup image. | |
void | disableCloudCoverLookup () |
Disable any cloud cover lookup. | |
Ogre::Real | getCloudCoverVisibilityThreshold () const |
Get cloud cover visiblity threshold. | |
void | setCloudCoverVisibilityThreshold (const Ogre::Real value) |
Set cloud cover visiblity threshold. | |
void | setHeight (Ogre::Real height) |
Set the height of the cloud layer. | |
Ogre::Real | getHeight () const |
Get the height of the cloud layer. | |
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) |
Set only near fade distance (see setFadeDistances). | |
Ogre::Real | getNearFadeDist () const |
Get near fade distance (see setFadeDistances). | |
void | setFarFadeDist (const Ogre::Real value) |
Set only far fade distance (see setFadeDistances). | |
Ogre::Real | getFarFadeDist () const |
Get fade distance (see setFadeDistances). | |
void | setFadeDistMeasurementVector (const Ogre::Vector3 &value) |
Set on which components is the fade distance measured. | |
const Ogre::Vector3 | getFadeDistMeasurementVector () const |
Get the value set by setFadeDistMeasurementVector. | |
void | setQueryFlags (uint flags) |
uint | getQueryFlags () const |
void | setVisibilityFlags (uint flags) |
uint | getVisibilityFlags () const |
Protected Member Functions | |
void | _updateVisibilityThreshold () |
Enforce setCloudCoverVisibilityThreshold. |
Supports movement and variable cloud cover.
There are significant incompatible difference between this and the LayeredClouds from version 0.3. This implementation of clouds is positioned in world space while the old implementation was a curved plane moving with the camera. It is not possible to perfectly simulate the older implementation.
Definition at line 42 of file FlatCloudLayer.h.
void Caelum::FlatCloudLayer::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.
This can be reproduced with calls to other public functions.
Definition at line 170 of file FlatCloudLayer.cpp.
References _ensureGeometry(), _updateVisibilityThreshold(), and advanceAnimation().
void Caelum::FlatCloudLayer::setCloudSpeed | ( | const Ogre::Vector2 & | cloudSpeed | ) |
Sets cloud movement speed.
cloudSpeed | Cloud movement speed. |
Definition at line 312 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 87 of file FlatCloudLayer.h.
void Caelum::FlatCloudLayer::_ensureGeometry | ( | ) |
Regenerate the plane mesh and recreate entity.
This automatically happens in update.
Definition at line 77 of file FlatCloudLayer.cpp.
References Caelum::PrivatePtr< PointedT, TraitsT >::reset().
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 73 of file FlatCloudLayer.cpp.
Referenced by reset(), and setMeshParameters().
void Caelum::FlatCloudLayer::setMeshWidth | ( | Real | value | ) | [inline] |
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 251 of file FlatCloudLayer.cpp.
References _updateVisibilityThreshold(), and Caelum::InternalUtilities::getInterpolatedColour().
Referenced by reset().
Ogre::Real Caelum::FlatCloudLayer::getCloudCover | ( | ) | const [inline] |
Gets the current cloud cover.
Definition at line 195 of file FlatCloudLayer.h.
Referenced by _updateVisibilityThreshold().
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 229 of file FlatCloudLayer.cpp.
Referenced by reset().
const Ogre::String Caelum::FlatCloudLayer::getCloudCoverLookupFileName | ( | ) | const |
Get the filename of the cloud cover lookup image.
This returns the value set by setCloudCoverLookup or an empty string if disabled.
Definition at line 242 of file FlatCloudLayer.cpp.
void Caelum::FlatCloudLayer::disableCloudCoverLookup | ( | ) |
Disable any cloud cover lookup.
Definition at line 237 of file FlatCloudLayer.cpp.
Ogre::Real Caelum::FlatCloudLayer::getCloudCoverVisibilityThreshold | ( | ) | const [inline] |
Get cloud cover visiblity threshold.
Beneath this cloud coverage nothing is drawn anymore.
Definition at line 233 of file FlatCloudLayer.h.
Referenced by _updateVisibilityThreshold().
void Caelum::FlatCloudLayer::setCloudCoverVisibilityThreshold | ( | const Ogre::Real | value | ) |
Set cloud cover visiblity threshold.
Beneath this cloud coverage nothing is drawn anymore. Default value is very very low (0.001). All this does is save you from destroying/recreating layers when they're too thin to bother drawing.
Definition at line 246 of file FlatCloudLayer.cpp.
References _updateVisibilityThreshold().
Referenced by reset().
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 350 of file FlatCloudLayer.cpp.
Referenced by Caelum::CloudSystem::createLayerAtHeight().
Ogre::Real Caelum::FlatCloudLayer::getHeight | ( | ) | const |
Get the height of the cloud layer.
Definition at line 356 of file FlatCloudLayer.cpp.
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 273 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 277 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 281 of file FlatCloudLayer.cpp.
Referenced by advanceAnimation(), and reset().
Ogre::Real Caelum::FlatCloudLayer::getCloudBlendPos | ( | ) | const |
Definition at line 308 of file FlatCloudLayer.cpp.
Referenced by advanceAnimation().
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 360 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 364 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 368 of file FlatCloudLayer.cpp.
References setFarFadeDist(), and setNearFadeDist().
Referenced by reset().
void Caelum::FlatCloudLayer::setFadeDistMeasurementVector | ( | const Ogre::Vector3 & | value | ) |
Set on which components is the fade distance measured.
Default is Vector3(0, 1, 1) which measures fade distance horizontally in caelum's default assumed coordinate system.
If you're in a Z-up system you probably want to set this to (1, 1, 0).
Fade distance is always measured relative to the camera.
Definition at line 381 of file FlatCloudLayer.cpp.
Referenced by reset().