orxonox::Light Class Reference

#include <src/orxonox/objects/worldentities/Light.h>

Inheritance diagram for orxonox::Light:

orxonox::StaticEntity orxonox::TeamColourable orxonox::WorldEntity orxonox::OrxonoxClass orxonox::BaseObject orxonox::Synchronisable orxonox::OrxonoxClass orxonox::OrxonoxClass

List of all members.

Public Types

enum  LightTypes { Point, Directional, Spotlight }

Public Member Functions

virtual void changedVisibility ()
 This function gets called if the visibility of the object changes.
const Vector4 & getAttenuation () const
const ColourValue & getDiffuseColour () const
Ogre::Light * getLight ()
const ColourValue & getSpecularColour () const
const Vector3 & getSpotlightRange () const
Light::LightTypes getType () const
 Light (BaseObject *creator)
void registerVariables ()
void setAttenuation (const Vector4 &attenuation)
 Sets the attenuation parameters of the light source i.e. how it diminishes with distance.
void setDiffuseColour (const ColourValue &colour)
void setSpecularColour (const ColourValue &colour)
void setSpotlightRange (const Vector3 &spotlightRange)
 Sets the range of a spotlight, i.e. the angle of the inner and outer cones and the rate of falloff between them.
virtual void setTeamColour (const ColourValue &colour)
void setType (Light::LightTypes type)
virtual void XMLPort (Element &xmlelement, XMLPort::Mode mode)
 XML loading and saving.
virtual ~Light ()

Private Member Functions

std::string getTypeString () const
void setTypeString (const std::string &type)
void updateAttenuation ()
void updateDiffuseColour ()
void updateSpecularColour ()
void updateSpotlightRange ()
void updateType ()

Private Attributes

Vector4 attenuation_
ColourValue diffuse_
Ogre::Light * light_
ColourValue specular_
Vector3 spotlightRange_
LightTypes type_


Member Enumeration Documentation

Enumerator:
Point  Point light sources give off light equally in all directions, so require only position not direction.
Directional  Directional lights simulate parallel light beams from a distant source, hence have direction but no position.
Spotlight  Spotlights simulate a cone of light from a source so require position and direction, plus extra values for falloff.


Constructor & Destructor Documentation

orxonox::Light::Light ( BaseObject creator  ) 

orxonox::Light::~Light (  )  [virtual]


Member Function Documentation

void orxonox::Light::changedVisibility (  )  [virtual]

This function gets called if the visibility of the object changes.

Reimplemented from orxonox::BaseObject.

References orxonox::BaseObject::isVisible(), light_, and SUPER.

const Vector4& orxonox::Light::getAttenuation (  )  const [inline]

Referenced by XMLPort().

const ColourValue& orxonox::Light::getDiffuseColour (  )  const [inline]

Referenced by XMLPort().

Ogre::Light* orxonox::Light::getLight (  )  [inline]

const ColourValue& orxonox::Light::getSpecularColour (  )  const [inline]

Referenced by XMLPort().

const Vector3& orxonox::Light::getSpotlightRange (  )  const [inline]

Referenced by XMLPort().

Light::LightTypes orxonox::Light::getType (  )  const [inline]

std::string orxonox::Light::getTypeString (  )  const [private]

References Directional, Point, Spotlight, and type_.

Referenced by XMLPort().

void orxonox::Light::registerVariables (  ) 

void orxonox::Light::setAttenuation ( const Vector4 &  attenuation  )  [inline]

Sets the attenuation parameters of the light source i.e. how it diminishes with distance.

Parameters:
attenuation.x range (The absolute upper range of the light in world units)
attenuation.y constant (The constant factor in the attenuation formula: 1.0 means never attenuate, 0.0 is complete attenuation)
attenuation.z linear (The linear factor in the attenuation formula: 1 means attenuate evenly over the distance)
attenuation.w quadratic (The quadratic factor in the attenuation formula: adds a curvature to the attenuation formula)
Quote from the Ogre API: Lights normally get fainter the further they are away. Also, each light is given a maximum range beyond which it cannot affect any objects. Light attenuation is not applicable to directional lights since they have an infinite range and constant intensity. This follows a standard attenuation approach - see any good 3D text for the details of what they mean since i don't have room here!

Quote from the Ogre wiki: "Using these numbers, the light has 100% intensity at 0 distance, and trails off to near black at a distance equal to the Range. Keep in mind that most of the light falls in the first 20% of the range."

Range Constant Linear Quadratic 3250, 1.0, 0.0014, 0.000007 600, 1.0, 0.007, 0.0002 325, 1.0, 0.014, 0.0007 200, 1.0, 0.022, 0.0019 160, 1.0, 0.027, 0.0028 100, 1.0, 0.045, 0.0075 65, 1.0, 0.07, 0.017 50, 1.0, 0.09, 0.032 32, 1.0, 0.14, 0.07 20, 1.0, 0.22, 0.20 13, 1.0, 0.35, 0.44 7, 1.0, 0.7, 1.8

Referenced by XMLPort().

void orxonox::Light::setDiffuseColour ( const ColourValue &  colour  )  [inline]

Referenced by XMLPort().

void orxonox::Light::setSpecularColour ( const ColourValue &  colour  )  [inline]

Referenced by XMLPort().

void orxonox::Light::setSpotlightRange ( const Vector3 &  spotlightRange  )  [inline]

Sets the range of a spotlight, i.e. the angle of the inner and outer cones and the rate of falloff between them.

Parameters:
spotlightRange.x innerAngle (The angle covered by the bright inner cone)
spotlightRange.x outerAngle (The angle covered by the outer cone)
spotlightRange.x falloff (The rate of falloff between the inner and outer cones. 1.0 means a linear falloff, less means slower falloff, higher means faster falloff.)

Referenced by XMLPort().

virtual void orxonox::Light::setTeamColour ( const ColourValue &  colour  )  [inline, virtual]

void orxonox::Light::setType ( Light::LightTypes  type  )  [inline]

Referenced by setTypeString().

void orxonox::Light::setTypeString ( const std::string type  )  [private]

References Directional, Point, setType(), and Spotlight.

Referenced by XMLPort().

void orxonox::Light::updateAttenuation (  )  [private]

References attenuation_, Directional, light_, and type_.

Referenced by Light(), registerVariables(), and updateType().

void orxonox::Light::updateDiffuseColour (  )  [private]

References diffuse_, and light_.

Referenced by Light(), and registerVariables().

void orxonox::Light::updateSpecularColour (  )  [private]

References light_, and specular_.

Referenced by Light(), and registerVariables().

void orxonox::Light::updateSpotlightRange (  )  [private]

void orxonox::Light::updateType (  )  [private]

void orxonox::Light::XMLPort ( Element &  xmlelement,
XMLPort::Mode  mode 
) [virtual]

XML loading and saving.

Parameters:
xmlelement The XML-element
loading Loading (true) or saving (false)
Returns:
The XML-element

Reimplemented from orxonox::WorldEntity.

References getAttenuation(), getDiffuseColour(), getSpecularColour(), getSpotlightRange(), getTypeString(), setAttenuation(), setDiffuseColour(), setSpecularColour(), setSpotlightRange(), setTypeString(), SUPER, orxonox::MT_Type::Vector3, orxonox::MT_Type::Vector4, and XMLPortParam.


Member Data Documentation

Vector4 orxonox::Light::attenuation_ [private]

ColourValue orxonox::Light::diffuse_ [private]

Ogre::Light* orxonox::Light::light_ [private]

ColourValue orxonox::Light::specular_ [private]


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

Generated on Tue Jul 28 16:22:42 2009 for Orxonox by  doxygen 1.5.6