Caelum
0.6.4
|
A flat cloud layer; drawn as a simple plane. More...
#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. More... | |
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. More... | |
const Ogre::Vector2 | getCloudSpeed () const |
Gets cloud movement speed. More... | |
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. More... | |
void | _invalidateGeometry () |
Regenerate the plane mesh and recreate entity. More... | |
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) More... | |
Ogre::Real | getCloudCover () const |
Gets the current cloud cover. More... | |
void | setCloudCoverLookup (const Ogre::String &fileName) |
Set the image used to lookup the cloud coverage threshold. More... | |
const Ogre::String | getCloudCoverLookupFileName () const |
Get the filename of the cloud cover lookup image. More... | |
void | disableCloudCoverLookup () |
Disable any cloud cover lookup. More... | |
Ogre::Real | getCloudCoverVisibilityThreshold () const |
Get cloud cover visiblity threshold. More... | |
void | setCloudCoverVisibilityThreshold (const Ogre::Real value) |
Set cloud cover visiblity threshold. More... | |
void | setHeight (Ogre::Real height) |
Set the height of the cloud layer. More... | |
Ogre::Real | getHeight () const |
Get the height of the cloud layer. More... | |
void | setCloudBlendTime (const Ogre::Real value) |
Sets the time it takes to blend two cloud shaped together, in seconds. More... | |
Ogre::Real | getCloudBlendTime () const |
Gets the time it takes to blend two cloud shaped together, in seconds. More... | |
void | setCloudBlendPos (const Ogre::Real value) |
Set the current blending position; between noise textures. More... | |
Ogre::Real | getCloudBlendPos () const |
void | setCloudUVFactor (const Ogre::Real value) |
Cloud texture coordinates are multiplied with this. More... | |
Ogre::Real | getCloudUVFactor () const |
void | setHeightRedFactor (const Ogre::Real value) |
High-altitude clouds are tinted red in the evening. More... | |
Ogre::Real | getHeightRedFactor () const |
void | setFadeDistances (Ogre::Real nearValue, Ogre::Real farValue) |
Cloud fade distances. More... | |
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. More... | |
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. | |
A flat cloud layer; drawn as a simple plane.
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.
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.
void Caelum::FlatCloudLayer::setCloudSpeed | ( | const Ogre::Vector2 & | cloudSpeed | ) |
Sets cloud movement speed.
cloudSpeed | Cloud movement speed. |
|
inline |
Gets cloud movement speed.
cloudSpeed | Cloud movement speed. |
void Caelum::FlatCloudLayer::_ensureGeometry | ( | ) |
Regenerate the plane mesh and recreate entity.
This automatically happens in update.
void Caelum::FlatCloudLayer::_invalidateGeometry | ( | ) |
Regenerate the plane mesh and recreate entity.
This automatically happens when mesh parameters are changed.
|
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 |
|
inline |
Gets the current cloud cover.
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.
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.
void Caelum::FlatCloudLayer::disableCloudCoverLookup | ( | ) |
Disable any cloud cover lookup.
|
inline |
Get cloud cover visiblity threshold.
Beneath this cloud coverage nothing is drawn anymore.
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.
void Caelum::FlatCloudLayer::setHeight | ( | Ogre::Real | height | ) |
Set the height of the cloud layer.
height | In world units above the cloud root node. |
Ogre::Real Caelum::FlatCloudLayer::getHeight | ( | ) | const |
Get the height of the cloud layer.
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 |
Ogre::Real Caelum::FlatCloudLayer::getCloudBlendTime | ( | ) | const |
Gets the time it takes to blend two cloud shaped together, in seconds.
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 |
Ogre::Real Caelum::FlatCloudLayer::getCloudBlendPos | ( | ) | const |
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.
|
inline |
void Caelum::FlatCloudLayer::setHeightRedFactor | ( | const Ogre::Real | value | ) |
High-altitude clouds are tinted red in the evening.
Higher values attenuate the effect.
|
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
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.