Caelum::BaseSkyLight Class Reference

Base class for sky lights (sun and moon). More...

#include <SkyLight.h>

Inheritance diagram for Caelum::BaseSkyLight:

Caelum::CameraBoundElement Caelum::Moon Caelum::SphereSun Caelum::SpriteSun

List of all members.

Public Member Functions

 BaseSkyLight (Ogre::SceneManager *sceneMgr, Ogre::SceneNode *caelumRootNode)
 Constructor.
virtual ~BaseSkyLight ()=0
 Destructor.
virtual void update (const Ogre::Vector3 &direction, const Ogre::ColourValue &lightColour, const Ogre::ColourValue &bodyColour)
 Updates skylight parameters.
const Ogre::Vector3 getLightDirection () const
 Retrieves the latest light direction.
virtual void setLightDirection (const Ogre::Vector3 &dir)
 Set the sun direction.
const Ogre::ColourValue getBodyColour () const
 Get current body colour, as set in setBodyColour.
virtual void setBodyColour (const Ogre::ColourValue &colour)
 Sets the colour to draw the light's body with.
const Ogre::ColourValue getLightColour () const
 Get current light colour, as set in setLightColour.
virtual void setLightColour (const Ogre::ColourValue &colour)
 Sets the skylight colour.
void setDiffuseMultiplier (const Ogre::ColourValue &diffuse)
 Set diffuse multiplier for light colour.
const Ogre::ColourValue getDiffuseMultiplier () const
 Set diffuse multiplier for light colour.
void setSpecularMultiplier (const Ogre::ColourValue &specular)
 Set specular multiplier for light colour.
const Ogre::ColourValue getSpecularMultiplier () const
 Set specular multiplier for light colour.
void setAmbientMultiplier (const Ogre::ColourValue &ambient)
 Set ambient multiplier for light colour This value is only stored here; the SceneManager is not touched However, CaelumSystem does use this value.
const Ogre::ColourValue getAmbientMultiplier () const
 Set ambient multiplier for light colour.
Ogre::Light * getMainLight () const
 Direct access to the Ogre::Light.
bool getAutoDisable () const
 Check if the light is automatically disabled.
void setAutoDisable (bool value)
 Turn on and off auto-disabling of the light when too dim.
Ogre::Real getAutoDisableThreshold () const
 Get the auto-disable threshold.
void setAutoDisableThreshold (Ogre::Real value)
 Set the auto-disable threshold.
void setForceDisable (bool value)
 Disable the light by force; without taking intensity into account.
bool getForceDisable () const
virtual void setQueryFlags (uint flags)=0
virtual uint getQueryFlags () const =0
virtual void setVisibilityFlags (uint flags)=0
virtual uint getVisibilityFlags () const =0

Static Public Attributes

static const Ogre::Real DEFAULT_AUTO_DISABLE_THRESHOLD = 0.1

Protected Member Functions

virtual void setFarRadius (Ogre::Real radius)
 Handle far radius.
void setMainLightColour (const Ogre::ColourValue &colour)
 Temporary change main light color.
bool shouldEnableLight (const Ogre::ColourValue &colour)
 If the light should be enabled for a certain value.

Protected Attributes

Ogre::Light * mMainLight
 The main directional light.
Ogre::SceneNode * mNode
 The sun scene node.
float mRadius
 Base distance of the light.
Ogre::Vector3 mDirection
 The latest normalised sun direction.
Ogre::ColourValue mBodyColour
 Body sphere colour, as set by setBodyColour.
Ogre::ColourValue mLightColour
 Sun light colour, as set by setLightColour.
Ogre::ColourValue mDiffuseMultiplier
 Colour multiplier for light diffuse colour.
Ogre::ColourValue mSpecularMultiplier
 Colour multiplier for light specular colour.
Ogre::ColourValue mAmbientMultiplier
 Colour multiplier for ambient light colour.
bool mAutoDisableLight
 If the light is automatically disabled beneath mAutoDisableThreshold.
Ogre::Real mAutoDisableThreshold
 Threshold beneath which the light is automatically disabled.
bool mForceDisableLight
 If the light is always disabled. Separate from the mAutoDisable mechanism.


Detailed Description

Base class for sky lights (sun and moon).

Contains a directional light which can be automatically disabled when too dim.

Definition at line 31 of file SkyLight.h.


Constructor & Destructor Documentation

Caelum::BaseSkyLight::BaseSkyLight ( Ogre::SceneManager *  sceneMgr,
Ogre::SceneNode *  caelumRootNode 
)

Constructor.

Parameters:
sceneMgr The scene manager where the lights will be created.
caelumRootNode Root node to attach to. Should be bound to the camera.

Definition at line 28 of file SkyLight.cpp.

References mMainLight, and mNode.


Member Function Documentation

void Caelum::BaseSkyLight::update ( const Ogre::Vector3 &  direction,
const Ogre::ColourValue &  lightColour,
const Ogre::ColourValue &  bodyColour 
) [virtual]

Updates skylight parameters.

Parameters:
direction Light direction.
lightColour Color for the light source
bodyColour Color to draw the body of the light (whatever that is).

Definition at line 68 of file SkyLight.cpp.

References setBodyColour(), setLightColour(), and setLightDirection().

void Caelum::BaseSkyLight::setAmbientMultiplier ( const Ogre::ColourValue &  ambient  ) 

Set ambient multiplier for light colour This value is only stored here; the SceneManager is not touched However, CaelumSystem does use this value.

Definition at line 137 of file SkyLight.cpp.

References mAmbientMultiplier.

void Caelum::BaseSkyLight::setAutoDisable ( bool  value  )  [inline]

Turn on and off auto-disabling of the light when too dim.

This is off by default. If you set it to true you probably also want to set the autoDisableThreshold. The "intensity" of the light for the threshold is calculated as the plain sum of r, g and b.

Definition at line 143 of file SkyLight.h.

bool Caelum::BaseSkyLight::shouldEnableLight ( const Ogre::ColourValue &  colour  )  [protected]

If the light should be enabled for a certain value.

This functions takes AutoDisable and such into account.

Definition at line 149 of file SkyLight.cpp.

References mAutoDisableLight, mAutoDisableThreshold, and mForceDisableLight.

Referenced by setMainLightColour().


Member Data Documentation

Ogre::ColourValue Caelum::BaseSkyLight::mAmbientMultiplier [protected]

Colour multiplier for ambient light colour.

No effect, this value is only stored here.

Definition at line 61 of file SkyLight.h.

Referenced by getAmbientMultiplier(), and setAmbientMultiplier().


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

Generated on Sun Aug 9 10:24:22 2009 for Caelum by  doxygen 1.5.9