21 #include "CaelumPrecompiled.h" 26 const Ogre::Real BaseSkyLight::DEFAULT_AUTO_DISABLE_THRESHOLD = 0.1;
29 mDirection(
Ogre::Vector3::ZERO),
30 mBodyColour(
Ogre::ColourValue::White),
31 mLightColour(
Ogre::ColourValue::White),
33 mDiffuseMultiplier(
Ogre::ColourValue(1, 1, 0.9)),
34 mSpecularMultiplier(
Ogre::ColourValue(1, 1, 1)),
35 mAmbientMultiplier(
Ogre::ColourValue(0.2, 0.2, 0.2)),
37 mAutoDisableLight(false),
38 mAutoDisableThreshold(DEFAULT_AUTO_DISABLE_THRESHOLD),
39 mForceDisableLight(false)
41 Ogre::String lightName =
"CaelumSkyLight" + Ogre::StringConverter::toString((
size_t)
this);
43 mMainLight = sceneMgr->createLight (lightName);
44 mMainLight->setType (Ogre::Light::LT_DIRECTIONAL);
46 sceneMgr->getRenderQueue()->getQueueGroup(CAELUM_RENDER_QUEUE_SUN)->setShadowsEnabled(
false);
48 mNode = caelumRootNode->createChildSceneNode ();
53 static_cast<Ogre::SceneNode *
>(
mNode->getParent ())->removeAndDestroyChild (
mNode->getName ());
69 const Ogre::Vector3& direction,
70 const Ogre::ColourValue &lightColour,
71 const Ogre::ColourValue &bodyColour)
154 Ogre::Real sum = colour.r + colour.g + colour.b;
Ogre::Real mAutoDisableThreshold
Threshold beneath which the light is automatically disabled.
virtual void setLightDirection(const Ogre::Vector3 &dir)
Set the sun direction.
virtual void update(const Ogre::Vector3 &direction, const Ogre::ColourValue &lightColour, const Ogre::ColourValue &bodyColour)
Updates skylight parameters.
void setDiffuseMultiplier(const Ogre::ColourValue &diffuse)
Set diffuse multiplier for light colour.
void setMainLightColour(const Ogre::ColourValue &colour)
Temporary change main light color.
const Ogre::ColourValue getDiffuseMultiplier() const
Set diffuse multiplier for light colour.
bool shouldEnableLight(const Ogre::ColourValue &colour)
If the light should be enabled for a certain value.
float mRadius
Base distance of the light.
const Ogre::ColourValue getAmbientMultiplier() const
Set ambient multiplier for light colour.
Ogre::SceneNode * mNode
The sun scene node.
bool mForceDisableLight
If the light is always disabled. Separate from the mAutoDisable mechanism.
bool mAutoDisableLight
If the light is automatically disabled beneath mAutoDisableThreshold.
BaseSkyLight(Ogre::SceneManager *sceneMgr, Ogre::SceneNode *caelumRootNode)
Constructor.
const Ogre::ColourValue getLightColour() const
Get current light colour, as set in setLightColour.
void setSpecularMultiplier(const Ogre::ColourValue &specular)
Set specular multiplier for light colour.
Ogre::ColourValue mLightColour
Sun light colour, as set by setLightColour.
virtual void setBodyColour(const Ogre::ColourValue &colour)
Sets the colour to draw the light's body with.
Ogre::ColourValue mDiffuseMultiplier
Colour multiplier for light diffuse colour.
const Ogre::Vector3 getLightDirection() const
Retrieves the latest light direction.
virtual void setFarRadius(Ogre::Real radius)
Abstract method to set the radius for this elements Derived classes should override this and resize t...
Ogre::ColourValue mBodyColour
Body sphere colour, as set by setBodyColour.
const Ogre::ColourValue getSpecularMultiplier() const
Set specular multiplier for light colour.
Ogre::Light * mMainLight
The main directional light.
Ogre::ColourValue mSpecularMultiplier
Colour multiplier for light specular colour.
Ogre::Vector3 mDirection
The latest normalised sun direction.
Ogre::ColourValue mAmbientMultiplier
Colour multiplier for ambient light colour.
virtual ~BaseSkyLight()=0
Destructor.
virtual void setLightColour(const Ogre::ColourValue &colour)
Sets the skylight colour.
Ogre::Light * getMainLight() const
Direct access to the Ogre::Light.
void setAmbientMultiplier(const Ogre::ColourValue &ambient)
Set ambient multiplier for light colour This value is only stored here; the SceneManager is not touch...
virtual void setFarRadius(Ogre::Real radius)
Handle far radius.
const Ogre::ColourValue getBodyColour() const
Get current body colour, as set in setBodyColour.