Light Class Reference

A light source. More...

#include <rendering/rendering.hh>

Inherits enable_shared_from_this< Light >.

Public Member Functions

 Light (ScenePtr _scene)
 Constructor. More...
 
virtual ~Light ()
 Destructor. More...
 
LightPtr Clone (const std::string &_name, ScenePtr _scene)
 Clone the light with a new name. More...
 
common::Color DiffuseColor () const
 Get the diffuse color. More...
 
ignition::math::Vector3d Direction () const
 Get the direction. More...
 
void FillMsg (msgs::Light &_msg) const
 Fill the contents of a light message. More...
 
common::Color GetDiffuseColor () const GAZEBO_DEPRECATED(7.0)
 Get the diffuse color. More...
 
math::Vector3 GetDirection () const GAZEBO_DEPRECATED(7.0)
 Get the direction. More...
 
std::string GetName () const GAZEBO_DEPRECATED(7.0)
 Get the name of the visual. More...
 
math::Vector3 GetPosition () const GAZEBO_DEPRECATED(7.0)
 Get the position of the light. More...
 
math::Quaternion GetRotation () const GAZEBO_DEPRECATED(7.0)
 Get the rotation of the light. More...
 
common::Color GetSpecularColor () const GAZEBO_DEPRECATED(7.0)
 Get the specular color. More...
 
std::string GetType () const GAZEBO_DEPRECATED(7.0)
 Get the type of the light. More...
 
bool GetVisible () const GAZEBO_DEPRECATED(7.0)
 Get whether the light is visible. More...
 
void Load (sdf::ElementPtr _sdf)
 Load the light using a set of SDF parameters. More...
 
void Load ()
 Load the light using default parameters. More...
 
void LoadFromMsg (ConstLightPtr &_msg)
 Load from a light message. More...
 
void LoadFromMsg (const msgs::Light &_msg)
 Load from a light message. More...
 
std::string Name () const
 Get the name of the visual. More...
 
ignition::math::Vector3d Position () const
 Get the position of the light. More...
 
ignition::math::Quaterniond Rotation () const
 Get the rotation of the light. More...
 
void SetAttenuation (double _constant, double _linear, double _quadratic)
 Set the attenuation. More...
 
void SetCastShadows (const bool _cast)
 Set cast shadows. More...
 
void SetDiffuseColor (const common::Color &_color)
 Set the diffuse color. More...
 
void SetDirection (const math::Vector3 &_dir) GAZEBO_DEPRECATED(7.0)
 Set the direction. More...
 
void SetDirection (const ignition::math::Vector3d &_dir)
 Set the direction. More...
 
void SetLightType (const std::string &_type)
 Set the light type. More...
 
void SetName (const std::string &_name)
 Set the name of the visual. More...
 
void SetPosition (const math::Vector3 &_p) GAZEBO_DEPRECATED(7.0)
 Set the position of the light. More...
 
void SetPosition (const ignition::math::Vector3d &_p)
 Set the position of the light. More...
 
void SetRange (const double _range)
 Set the range. More...
 
void SetRotation (const math::Quaternion &_q) GAZEBO_DEPRECATED(7.0)
 Set the rotation of the light. More...
 
void SetRotation (const ignition::math::Quaterniond &_q)
 Set the rotation of the light. More...
 
virtual bool SetSelected (const bool _s)
 Set whether this entity has been selected by the user through the gui. More...
 
void SetSpecularColor (const common::Color &_color)
 Set the specular color. More...
 
void SetSpotFalloff (const double _value)
 Set the spot light falloff. More...
 
void SetSpotInnerAngle (const double _angle)
 Set the spot light inner angle. More...
 
void SetSpotOuterAngle (const double _angle)
 Set the spot light outer angle. More...
 
void ShowVisual (const bool _s)
 Set whether to show the visual. More...
 
common::Color SpecularColor () const
 Get the specular color. More...
 
void ToggleShowVisual ()
 
std::string Type () const
 Get the type of the light. More...
 
void UpdateFromMsg (ConstLightPtr &_msg)
 Update a light source from a message. More...
 
bool Visible () const
 Get whether the light is visible. More...
 

Protected Member Functions

virtual void OnPoseChange ()
 On pose change callback. More...
 

Detailed Description

A light source.

There are three types of lights: Point, Spot, and Directional. This class encapsulates all three. Point lights are light light bulbs, spot lights project a cone of light, and directional lights are light sun light.

Constructor & Destructor Documentation

§ Light()

Light ( ScenePtr  _scene)

Constructor.

Parameters
[in]_scenePointer to the scene that contains the Light.

§ ~Light()

virtual ~Light ( )
virtual

Destructor.

Member Function Documentation

§ Clone()

LightPtr Clone ( const std::string &  _name,
ScenePtr  _scene 
)

Clone the light with a new name.

Parameters
[in]_nameName of the cloned light.
[in]_sceneScene to contain the light.
Returns
a clone of the light

§ DiffuseColor()

common::Color DiffuseColor ( ) const

Get the diffuse color.

Returns
The light's diffuse color.

§ Direction()

ignition::math::Vector3d Direction ( ) const

Get the direction.

Returns
The light's direction.

§ FillMsg()

void FillMsg ( msgs::Light &  _msg) const

Fill the contents of a light message.

Parameters
[out]_msgMessage to fill.

§ GetDiffuseColor()

common::Color GetDiffuseColor ( ) const

Get the diffuse color.

Returns
The light's diffuse color.
Deprecated:
See DiffuseColor()

§ GetDirection()

math::Vector3 GetDirection ( ) const

Get the direction.

Returns
The light's direction.
Deprecated:
See Direction()

§ GetName()

std::string GetName ( ) const

Get the name of the visual.

Returns
The light's name.
Deprecated:
See Name()

§ GetPosition()

math::Vector3 GetPosition ( ) const

Get the position of the light.

Returns
The position of the light
Deprecated:
See Position()

§ GetRotation()

math::Quaternion GetRotation ( ) const

Get the rotation of the light.

Returns
The rotation of the light
Deprecated:
See Rotation()

§ GetSpecularColor()

common::Color GetSpecularColor ( ) const

Get the specular color.

Returns
The specular color
Deprecated:
See SpecularColor()

§ GetType()

std::string GetType ( ) const

Get the type of the light.

Returns
The light type: "point", "spot", "directional".
Deprecated:
See Type()

§ GetVisible()

bool GetVisible ( ) const

Get whether the light is visible.

Returns
True if the light is visible.
Deprecated:
See Visible()

§ Load() [1/2]

void Load ( sdf::ElementPtr  _sdf)

Load the light using a set of SDF parameters.

Parameters
[in]_sdfPointer to the SDF containing the Light description.

§ Load() [2/2]

void Load ( )

Load the light using default parameters.

§ LoadFromMsg() [1/2]

void LoadFromMsg ( ConstLightPtr &  _msg)

Load from a light message.

Parameters
[in]_msgContaining the light information.

§ LoadFromMsg() [2/2]

void LoadFromMsg ( const msgs::Light &  _msg)

Load from a light message.

Parameters
[in]_msgMessage containing the light information.

§ Name()

std::string Name ( ) const

Get the name of the visual.

Returns
The light's name.

§ OnPoseChange()

virtual void OnPoseChange ( )
inlineprotectedvirtual

On pose change callback.

§ Position()

ignition::math::Vector3d Position ( ) const

Get the position of the light.

Returns
The position of the light

§ Rotation()

ignition::math::Quaterniond Rotation ( ) const

Get the rotation of the light.

Returns
The rotation of the light

§ SetAttenuation()

void SetAttenuation ( double  _constant,
double  _linear,
double  _quadratic 
)

Set the attenuation.

Parameters
[in]_contantConstant attenuation
[in]_linearLinear attenuation
[in]_quadraticQuadratic attenuation

§ SetCastShadows()

void SetCastShadows ( const bool  _cast)

Set cast shadows.

Parameters
[in]_castSet to true to cast shadows.

§ SetDiffuseColor()

void SetDiffuseColor ( const common::Color _color)

Set the diffuse color.

Parameters
[in]_colorLight diffuse color.

§ SetDirection() [1/2]

void SetDirection ( const math::Vector3 _dir)

Set the direction.

Parameters
[in]_dirSet the light's direction. Only applicable to spot and directional lights.
Deprecated:
See SetDirection() that accepts an ignition::math::Vector3d object.

§ SetDirection() [2/2]

void SetDirection ( const ignition::math::Vector3d &  _dir)

Set the direction.

Parameters
[in]_dirSet the light's direction. Only applicable to spot and directional lights.

§ SetLightType()

void SetLightType ( const std::string &  _type)

Set the light type.

Parameters
[in]_typeThe light type: "point", "spot", "directional"

§ SetName()

void SetName ( const std::string &  _name)

Set the name of the visual.

Parameters
[in]_nameName of the light source.

§ SetPosition() [1/2]

void SetPosition ( const math::Vector3 _p)

Set the position of the light.

Parameters
[in]_pNew position for the light
Deprecated:
See SetPosition() that accepts an ignition::math::Vector3d object.

§ SetPosition() [2/2]

void SetPosition ( const ignition::math::Vector3d &  _p)

Set the position of the light.

Parameters
[in]_pNew position for the light

§ SetRange()

void SetRange ( const double  _range)

Set the range.

Parameters
[in]_rangeRage of the light in meters.

§ SetRotation() [1/2]

void SetRotation ( const math::Quaternion _q)

Set the rotation of the light.

Parameters
[in]_qNew rotation for the light
Deprecated:
See SetRotation() that accepts an ignition::math::Quaterniond object.

§ SetRotation() [2/2]

void SetRotation ( const ignition::math::Quaterniond &  _q)

Set the rotation of the light.

Parameters
[in]_qNew rotation for the light

§ SetSelected()

virtual bool SetSelected ( const bool  _s)
virtual

Set whether this entity has been selected by the user through the gui.

Parameters
[in]_sSet to True when the light is selected by the user.

§ SetSpecularColor()

void SetSpecularColor ( const common::Color _color)

Set the specular color.

Parameters
[in]_colorThe specular color

§ SetSpotFalloff()

void SetSpotFalloff ( const double  _value)

Set the spot light falloff.

Parameters
[in]_valueFalloff value

§ SetSpotInnerAngle()

void SetSpotInnerAngle ( const double  _angle)

Set the spot light inner angle.

Parameters
[in]_angleInner angle in radians

§ SetSpotOuterAngle()

void SetSpotOuterAngle ( const double  _angle)

Set the spot light outer angle.

Parameters
[in]_angleOuter angle in radians

§ ShowVisual()

void ShowVisual ( const bool  _s)

Set whether to show the visual.

Parameters
[in]_sSet to true to draw a representation of the light.

§ SpecularColor()

common::Color SpecularColor ( ) const

Get the specular color.

Returns
The specular color

§ ToggleShowVisual()

void ToggleShowVisual ( )

§ Type()

std::string Type ( ) const

Get the type of the light.

Returns
The light type: "point", "spot", "directional".

§ UpdateFromMsg()

void UpdateFromMsg ( ConstLightPtr &  _msg)

Update a light source from a message.

Parameters
[in]_msgLight message to update from

§ Visible()

bool Visible ( ) const

Get whether the light is visible.

Returns
True if the light is visible.

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