caelum::LayeredClouds Class Reference

#include <LayeredClouds.h>

Inheritance diagram for caelum::LayeredClouds:

caelum::CameraBoundElement

List of all members.

Public Member Functions

 LayeredClouds (Ogre::SceneManager *scene, Ogre::SceneNode *caelumRootNode, const Ogre::String &resourceGroupName="Caelum", const Ogre::String &materialName="CaelumLayeredClouds", const Ogre::String &meshName="CaelumLayeredClouds", const Ogre::String &entityName="CaelumLayeredClouds")
void update (Ogre::Real timePassed, const Ogre::Vector3 &sunDirection, const Ogre::ColourValue &sunColour, const Ogre::ColourValue &fogColour)
void setCloudCover (const Ogre::Real cloudCover)
Ogre::Real getCloudCover () const
void setCloudCoverLookup (const Ogre::String &fileName)
void disableCloudCoverLookup ()
void setCloudMassBlend (const Ogre::Real cloudCover)
Ogre::Real getCloudMassBlend () const
void setCloudMassOffset (const Ogre::Vector2 &cloudMassOffset)
Ogre::Vector2 getCloudMassOffset () const
void setCloudDetailOffset (const Ogre::Vector2 &cloudMassOffset)
Ogre::Vector2 getCloudDetailOffset () const
bool isAnimating () const
void setAnimating (bool animating)
void setCloudSpeed (const Ogre::Vector2 &cloudSpeed)
Ogre::Vector2 getCloudSpeed () const
void setCloudBlendTime (const Ogre::Real cloudBlendTime)
Ogre::Real getCloudBlendTime () const
virtual void notifyCameraChanged (Ogre::Camera *cam)
 Handle camera change.

Protected Member Functions

virtual void setFarRadius (Ogre::Real radius)
 Handle far radius.


Detailed Description

Class for layered clouds.
Note:
This is tighly integrated with LayeredCloud.cg and LayeredClouds.material. There are two "cloud mass" layers blended to create animating clouds and an extra detailLayer. Most of the parameters in this class are direct wrappers from GPU shader params.
Cloud offsets and speeds are not in any meaningful world units. Maybe they should be in radians or something?

Definition at line 38 of file LayeredClouds.h.


Constructor & Destructor Documentation

caelum::LayeredClouds::LayeredClouds ( Ogre::SceneManager *  scene,
Ogre::SceneNode *  caelumRootNode,
const Ogre::String &  resourceGroupName = "Caelum",
const Ogre::String &  materialName = "CaelumLayeredClouds",
const Ogre::String &  meshName = "CaelumLayeredClouds",
const Ogre::String &  entityName = "CaelumLayeredClouds" 
)

Standard constructor.

Parameters:
scene,: Scene to add cloud dome to. This class takes control of the scene's skydome.
material,: Name of the material to load. It would be a lot more consistent to generate the material in code.

Definition at line 39 of file LayeredClouds.cpp.


Member Function Documentation

void caelum::LayeredClouds::update ( Ogre::Real  timePassed,
const Ogre::Vector3 &  sunDirection,
const Ogre::ColourValue &  sunColour,
const Ogre::ColourValue &  fogColour 
)

Update cloud material.

Parameters:
timePassed Time passed since last update.
sunDirection Vector towards the sun.
sunColour Colour of the sun.

Definition at line 129 of file LayeredClouds.cpp.

References getCloudBlendTime(), getCloudDetailOffset(), getCloudMassBlend(), getCloudMassOffset(), getCloudSpeed(), isAnimating(), setCloudDetailOffset(), setCloudMassBlend(), and setCloudMassOffset().

void caelum::LayeredClouds::setCloudCover ( const Ogre::Real  cloudCover  ) 

Sets cloud cover, between 0 (completely clear) and 1 (completely covered)

Parameters:
cloudCover Cloud cover between 0 and 1

Definition at line 246 of file LayeredClouds.cpp.

Ogre::Real caelum::LayeredClouds::getCloudCover (  )  const

Gets the current cloud cover.

Returns:
Cloud cover, between 0 and 1

Definition at line 263 of file LayeredClouds.cpp.

void caelum::LayeredClouds::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 267 of file LayeredClouds.cpp.

void caelum::LayeredClouds::disableCloudCoverLookup (  ) 

Disable any cloud cover lookup.

See also:
setCloudCoverLookup.

Definition at line 273 of file LayeredClouds.cpp.

void caelum::LayeredClouds::setCloudMassBlend ( const Ogre::Real  cloudCover  ) 

Sets blending factor between the two cloud mass layers.

Definition at line 222 of file LayeredClouds.cpp.

Referenced by setCloudBlendTime(), and update().

Ogre::Real caelum::LayeredClouds::getCloudMassBlend (  )  const

Gets the current blending factor between the two cloud mass layers

Definition at line 231 of file LayeredClouds.cpp.

Referenced by update().

void caelum::LayeredClouds::setCloudMassOffset ( const Ogre::Vector2 &  cloudMassOffset  ) 

Sets current offset(translation) of the cloud mass on the sky.

Definition at line 208 of file LayeredClouds.cpp.

Referenced by update().

Ogre::Vector2 caelum::LayeredClouds::getCloudMassOffset (  )  const

Gets current offset(translation) of the cloud mass on the sky.

Definition at line 218 of file LayeredClouds.cpp.

Referenced by update().

void caelum::LayeredClouds::setCloudDetailOffset ( const Ogre::Vector2 &  cloudMassOffset  ) 

Sets current offset(translation) of cloud details on the sky.

Definition at line 235 of file LayeredClouds.cpp.

Referenced by update().

Ogre::Vector2 caelum::LayeredClouds::getCloudDetailOffset (  )  const

Gets current offset(translation) of cloud details on the sky.

Definition at line 242 of file LayeredClouds.cpp.

Referenced by update().

bool caelum::LayeredClouds::isAnimating (  )  const

If the cloud layer is animating itself.

Note:
If this is true then parameters like cloudMassBlend and offsets are set every update().

Definition at line 155 of file LayeredClouds.cpp.

Referenced by update().

void caelum::LayeredClouds::setAnimating ( bool  animating  ) 

Switch internal animation on/off

Definition at line 159 of file LayeredClouds.cpp.

void caelum::LayeredClouds::setCloudSpeed ( const Ogre::Vector2 &  cloudSpeed  ) 

Sets cloud movement speed.

Parameters:
cloudSpeed Cloud movement speed.

Definition at line 163 of file LayeredClouds.cpp.

Ogre::Vector2 caelum::LayeredClouds::getCloudSpeed (  )  const

Gets cloud movement speed.

Parameters:
cloudSpeed Cloud movement speed.

Definition at line 167 of file LayeredClouds.cpp.

Referenced by update().

void caelum::LayeredClouds::setCloudBlendTime ( const Ogre::Real  cloudBlendTime  ) 

Sets the time it takes to blend two cloud shaped together, in seconds.

Parameters:
cloudCover Cloud shape blend time in seconds

Definition at line 171 of file LayeredClouds.cpp.

References setCloudMassBlend().

Ogre::Real caelum::LayeredClouds::getCloudBlendTime (  )  const

Gets the time it takes to blend two cloud shaped together, in seconds.

Returns:
Cloud shape blend time in seconds

Definition at line 186 of file LayeredClouds.cpp.

Referenced by update().


The documentation for this class was generated from the following files:

Generated on Fri Jul 11 09:24:53 2008 for Caelum by  doxygen 1.5.6