Caelum  0.6.4
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Friends | List of all members
Caelum::PrecipitationController Class Reference

Compositor-based precipitation controller. More...

#include <PrecipitationController.h>

Public Types

typedef std::map< Ogre::Viewport *, PrecipitationInstance * > ViewportInstanceMap
 

Public Member Functions

void setParams (const PrecipitationPresetParams &params)
 Set all parameters at once.
 
void setPresetType (PrecipitationType value)
 Quickly set a certain preset type of precipitation.
 
PrecipitationType getPresetType () const
 Get the preset type. More...
 
void setTextureName (const Ogre::String &textureName)
 
const Ogre::String getTextureName () const
 
void setColour (const Ogre::ColourValue &color)
 Precipitation color. Part of a preset.
 
const Ogre::ColourValue getColour () const
 
void setSpeed (Real value)
 Precipitation speed (affects direction). Part of a preset.
 
Real getSpeed () const
 
void setIntensity (Real value)
 Precipitation intensity.
 
Real getIntensity () const
 
void setWindSpeed (const Ogre::Vector3 &value)
 Wind speed and direction.
 
const Ogre::Vector3 getWindSpeed () const
 
void setFallingDirection (const Ogre::Vector3 &value)
 The basic direction for falling precipitation. More...
 
const Ogre::Vector3 getFallingDirection () const
 
void setManualCameraSpeed (const Ogre::Vector3 &value)
 Set manual camera speed for all viewports.
 
void setAutoCameraSpeed ()
 Set auto camera speed everywhere.o.
 
void setAutoDisableThreshold (Real value)
 Automatically disable compositors when intensity is low. More...
 
Real getAutoDisableThreshold () const
 
void setCameraSpeedScale (const Ogre::Vector3 &value)
 Automatically scale camera speed. More...
 
const Ogre::Vector3 getCameraSpeedScale () const
 
void setCameraSpeedScale (Ogre::Real value)
 Set an equal camera speed scale in all dimensions.
 
void update (Real secondsSinceLastFrame, Ogre::ColourValue colour)
 Update the the precipitation controller. More...
 
 PrecipitationController (Ogre::SceneManager *sceneMgr)
 
PrecipitationInstancecreateViewportInstance (Ogre::Viewport *viewport)
 Add precipitation to a certain viewport.
 
void destroyViewportInstance (Ogre::Viewport *viewport)
 Remove precipitation from a certain viewport.
 
PrecipitationInstancegetViewportInstance (Ogre::Viewport *viewport)
 Get per-viewport instance, or null if not created yet.
 
void destroyAllViewportInstances ()
 Remove from all attached viewports; clean up.
 

Static Public Member Functions

static bool isPresetType (PrecipitationType value)
 Check if a preset type is valid.
 
static const PrecipitationPresetParamsgetPresetParams (PrecipitationType value)
 Get preset parameters for a certain type of precipitation.
 

Public Attributes

ViewportInstanceMap mViewportInstanceMap
 

Static Public Attributes

static const String COMPOSITOR_NAME
 Name of the compositor resource.
 
static const String MATERIAL_NAME
 Name of the compositor material.
 

Friends

class PrecipitationInstance
 

Detailed Description

Compositor-based precipitation controller.

This class will add and control precipitation controllers to viewports.

Compositors clone the composing materials. This controller will register itself as a compositor listener and change the material in notifyMaterialSetup.

Member Function Documentation

◆ getPresetType()

PrecipitationType Caelum::PrecipitationController::getPresetType ( ) const

Get the preset type.

Will return PRECIPITATION_CUSTOM if you modify parameters manually after setPresetType.

◆ setFallingDirection()

void Caelum::PrecipitationController::setFallingDirection ( const Ogre::Vector3 value)
inline

The basic direction for falling precipitation.

This property define the notion of a "falling down" direction. By default this is Vector3::NEGATIVE_UNIT_Y. You need to change this for a Z-up system.

◆ setAutoDisableThreshold()

void Caelum::PrecipitationController::setAutoDisableThreshold ( Real  value)
inline

Automatically disable compositors when intensity is low.

A negative value always enable the compositor.

Note
: Ogre::CompositorInstance allocates/frees resources when enabling or disabling. That is expensive.

◆ setCameraSpeedScale()

void Caelum::PrecipitationController::setCameraSpeedScale ( const Ogre::Vector3 value)
inline

Automatically scale camera speed.

This is multiplied per-component with camera speed; manual or automatic. It's most useful for automatic camera speed to control how much of an effect moving the camera has on rain drop directions.

The components should probably be equal.

Default in Ogre::Vector3::UNIT_SCALE

◆ update()

void Caelum::PrecipitationController::update ( Real  secondsSinceLastFrame,
Ogre::ColourValue  colour 
)

Update the the precipitation controller.

Parameters
secondsSinceLastFrameNumber of secods since the last frame.