##

Light Class Reference
Rendering

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...
bool | CastShadows () const
| Get cast shadows. More...
LightPtr | Clone (const std::string &_name, ScenePtr _scene)
| Clone the light with a new name. More...
ignition::math::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...
uint32_t | Id () const
| Get the id associated with this light. More...
std::string | LightType () const
| Get the light type. More...
void | Load ()
| Load the light using default parameters. More...
void | Load (sdf::ElementPtr _sdf)
| Load the light using a set of SDF parameters. More...
void | LoadFromMsg (const msgs::Light &_msg)
| Load from a light message. More...
void | LoadFromMsg (ConstLightPtr &_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) GAZEBO_DEPRECATED(9.0)
| Set the diffuse color. More...
void | SetDiffuseColor (const ignition::math::Color &_color)
| Set the diffuse color. 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 ignition::math::Vector3d &_p)
| Set the position of the light. More...
void | SetRange (const double _range)
| Set the range. 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) GAZEBO_DEPRECATED(9.0)
| Set the specular color. More...
void | SetSpecularColor (const ignition::math::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 | SetVisible (const bool _s)
| Set whether the light will be visible. More...
void | ShowVisual (const bool _s)
| Set whether to show the visual. More...
ignition::math::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...
ignition::math::Pose3d | WorldPose () const
| Get the world pose of the light. 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 | ) |

explicit

Constructor.

Parameters

  [in] | _scene | Pointer to the scene that contains the Light.

## ~Light()

virtual ~Light | ( |  | ) |

virtual

Destructor.

## Member Function Documentation

## CastShadows()

bool CastShadows | ( |  | ) | const

Get cast shadows.

Returns
  True if cast shadows.

## Clone()

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

Clone the light with a new name.

Parameters

  [in] | _name | Name of the cloned light.
  [in] | _scene | Scene to contain the light.

Returns
  a clone of the light

## DiffuseColor()

ignition::math::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] | _msg | Message to fill.

## Id()

uint32_t Id | ( |  | ) | const

Get the id associated with this light.

Returns
  Unique Light id

## LightType()

std::string LightType | ( |  | ) | const

Get the light type.

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

## Load() [1/2]

void Load | ( |  | ) |

Load the light using default parameters.

## Load() [2/2]

void Load | ( | sdf::ElementPtr | _sdf | ) |

Load the light using a set of SDF parameters.

Parameters

  [in] | _sdf | Pointer to the SDF containing the Light description.

## LoadFromMsg() [1/2]

void LoadFromMsg | ( | const msgs::Light & | _msg | ) |

Load from a light message.

Parameters

  [in] | _msg | Message containing the light information.

## LoadFromMsg() [2/2]

void LoadFromMsg | ( | ConstLightPtr & | _msg | ) |

Load from a light message.

Parameters

  [in] | _msg | Containing the light information.

## Name()

std::string Name | ( |  | ) | const

Get the name of the visual.

Returns
  The light's name.

## OnPoseChange()

virtual void OnPoseChange | ( |  | ) |

inline protected virtual

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] | _contant | Constant attenuation
  [in] | _linear | Linear attenuation
  [in] | _quadratic | Quadratic attenuation

## SetCastShadows()

void SetCastShadows | ( | const bool | _cast | ) |

Set cast shadows.

Parameters

  [in] | _cast | Set to true to cast shadows.

## SetDiffuseColor() [1/2]

void SetDiffuseColor | ( | const common::Color & | _color | ) |

Set the diffuse color.

Parameters

  [in] | _color | Light diffuse color.

Deprecated:
  See function which accepts ignition::math::Color.

## SetDiffuseColor() [2/2]

void SetDiffuseColor | ( | const ignition::math::Color & | _color | ) |

Set the diffuse color.

Parameters

  [in] | _color | Light diffuse color.

## SetDirection()

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

Set the direction.

Parameters

  [in] | _dir | Set the light's direction. Only applicable to spot and directional lights.

## SetLightType()

void SetLightType | ( | const std::string & | _type | ) |

Set the light type.

Parameters

  [in] | _type | The light type: "point", "spot", "directional"

## SetName()

void SetName | ( | const std::string & | _name | ) |

Set the name of the visual.

Parameters

  [in] | _name | Name of the light source.

## SetPosition()

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

Set the position of the light.

Parameters

  [in] | _p | New position for the light

## SetRange()

void SetRange | ( | const double | _range | ) |

Set the range.

Parameters

  [in] | _range | Rage of the light in meters.

## SetRotation()

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

Set the rotation of the light.

Parameters

  [in] | _q | New 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] | _s | Set to True when the light is selected by the user.

## SetSpecularColor() [1/2]

void SetSpecularColor | ( | const common::Color & | _color | ) |

Set the specular color.

Parameters

  [in] | _color | The specular color

Deprecated:
  See function which accepts ignition::math::Color.

## SetSpecularColor() [2/2]

void SetSpecularColor | ( | const ignition::math::Color & | _color | ) |

Set the specular color.

Parameters

  [in] | _color | The specular color

## SetSpotFalloff()

void SetSpotFalloff | ( | const double | _value | ) |

Set the spot light falloff.

Parameters

  [in] | _value | Falloff value

## SetSpotInnerAngle()

void SetSpotInnerAngle | ( | const double | _angle | ) |

Set the spot light inner angle.

Parameters

  [in] | _angle | Inner angle in radians

## SetSpotOuterAngle()

void SetSpotOuterAngle | ( | const double | _angle | ) |

Set the spot light outer angle.

Parameters

  [in] | _angle | Outer angle in radians

## SetVisible()

void SetVisible | ( | const bool | _s | ) |

Set whether the light will be visible.

Parameters

  [in] | _s | Set to true to make the light visible, false to turn the light off.

## ShowVisual()

void ShowVisual | ( | const bool | _s | ) |

Set whether to show the visual.

Parameters

  [in] | _s | Set to true to draw a representation of the light.

## SpecularColor()

ignition::math::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] | _msg | Light message to update from

## Visible()

bool Visible | ( |  | ) | const

Get whether the light is visible.

Returns
  True if the light is visible.

## WorldPose()

ignition::math::Pose3d WorldPose | ( |  | ) | const

Get the world pose of the light.

Returns
  The world pose of the light

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

- rendering/Light.hh