#include <src/orxonox/objects/worldentities/Light.h>
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_ |
orxonox::Light::Light | ( | BaseObject * | creator | ) |
References orxonox::WorldEntity::attachOgreObject(), attenuation_, diffuse_, orxonox::WorldEntity::FRONT, orxonox::BaseObject::getScene(), orxonox::Scene::getSceneManager(), orxonox::getUniqueNumberString(), light_, Point, RegisterObject, registerVariables(), orxonox::GameMode::showsGraphics(), specular_, spotlightRange_, ThrowException, type_, updateAttenuation(), updateDiffuseColour(), updateSpecularColour(), updateSpotlightRange(), updateType(), orxonox::MT_Type::Vector3, and orxonox::MT_Type::Vector4.
orxonox::Light::~Light | ( | ) | [virtual] |
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] |
void orxonox::Light::registerVariables | ( | ) |
Reimplemented from orxonox::StaticEntity.
References attenuation_, diffuse_, orxonox::Synchronisable::registerVariable(), specular_, spotlightRange_, orxonox::VariableDirection::ToClient, type_, updateAttenuation(), updateDiffuseColour(), updateSpecularColour(), updateSpotlightRange(), and updateType().
Referenced by Light().
void orxonox::Light::setAttenuation | ( | const Vector4 & | attenuation | ) | [inline] |
Sets the attenuation parameters of the light source i.e. how it diminishes with distance.
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 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.
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] |
Implements orxonox::TeamColourable.
void orxonox::Light::setType | ( | Light::LightTypes | type | ) | [inline] |
Referenced by setTypeString().
void orxonox::Light::setTypeString | ( | const std::string & | type | ) | [private] |
void orxonox::Light::updateAttenuation | ( | ) | [private] |
References attenuation_, Directional, light_, and type_.
Referenced by Light(), registerVariables(), and updateType().
void orxonox::Light::updateDiffuseColour | ( | ) | [private] |
void orxonox::Light::updateSpecularColour | ( | ) | [private] |
void orxonox::Light::updateSpotlightRange | ( | ) | [private] |
References orxonox::MT_Type::Degree, light_, Spotlight, spotlightRange_, and type_.
Referenced by Light(), registerVariables(), and updateType().
void orxonox::Light::updateType | ( | ) | [private] |
References Directional, light_, Spotlight, type_, updateAttenuation(), and updateSpotlightRange().
Referenced by Light(), and registerVariables().
void orxonox::Light::XMLPort | ( | Element & | xmlelement, | |
XMLPort::Mode | mode | |||
) | [virtual] |
XML loading and saving.
xmlelement | The XML-element | |
loading | Loading (true) or saving (false) |
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.
Vector4 orxonox::Light::attenuation_ [private] |
Referenced by Light(), registerVariables(), and updateAttenuation().
ColourValue orxonox::Light::diffuse_ [private] |
Referenced by Light(), registerVariables(), and updateDiffuseColour().
Ogre::Light* orxonox::Light::light_ [private] |
Referenced by changedVisibility(), Light(), updateAttenuation(), updateDiffuseColour(), updateSpecularColour(), updateSpotlightRange(), updateType(), and ~Light().
ColourValue orxonox::Light::specular_ [private] |
Referenced by Light(), registerVariables(), and updateSpecularColour().
Vector3 orxonox::Light::spotlightRange_ [private] |
Referenced by Light(), registerVariables(), and updateSpotlightRange().
LightTypes orxonox::Light::type_ [private] |
Referenced by getTypeString(), Light(), registerVariables(), updateAttenuation(), updateSpotlightRange(), and updateType().