Loading...
Searching...
No Matches
Public Member Functions | List of all members
sdf::SDF_VERSION_NAMESPACE::Light Class Reference

Provides a description of a light source. More...

#include <Light.hh>

Public Member Functions

 Light ()
 Default constructor.
 
double AttenuationRange () const
 Get the range of the light source in meters.
 
bool CastShadows () const
 Get whether the light casts shadows.
 
double ConstantAttenuationFactor () const
 Get the constant attenuation factor.
 
gz::math::Color Diffuse () const
 Get the diffuse color.
 
gz::math::Vector3d Direction () const
 Get the direction of the light source.
 
sdf::ElementPtr Element () const
 Get a pointer to the SDF element that was used during load.
 
double Intensity () const
 Get the light intensity.
 
bool LightOn () const
 Get if the light is on.
 
double LinearAttenuationFactor () const
 Get the linear attenuation factor.
 
Errors Load (ElementPtr _sdf)
 Load the light based on a element pointer.
 
std::string Name () const
 Get the name of the light.
 
const std::string & PoseRelativeTo () const
 Get the name of the coordinate frame relative to which this object's pose is expressed.
 
double QuadraticAttenuationFactor () const
 Get the quadratic attenuation factor which adds a curvature to the attenuation.
 
const gz::math::Pose3d & RawPose () const
 Get the pose of the light.
 
sdf::SemanticPose SemanticPose () const
 Get SemanticPose object of this object to aid in resolving poses.
 
void SetAttenuationRange (const double _range)
 Set the range of the light source in meters.
 
void SetCastShadows (const bool _cast)
 Set whether the light casts shadows.
 
void SetConstantAttenuationFactor (const double _factor)
 Set the constant attenuation factor.
 
void SetDiffuse (const gz::math::Color &_color)
 Set the diffuse color.
 
void SetDirection (const gz::math::Vector3d &_dir)
 Set the direction of the light source.
 
void SetIntensity (const double _intensity)
 Set the light intensity.
 
void SetLightOn (const bool _isLightOn)
 Set if the light is ON/OFF.
 
void SetLinearAttenuationFactor (const double _factor)
 Set the linear attenuation factor.
 
void SetName (const std::string &_name)
 Set the name of the light.
 
void SetPoseRelativeTo (const std::string &_frame)
 Set the name of the coordinate frame relative to which this object's pose is expressed.
 
void SetQuadraticAttenuationFactor (const double _factor)
 Set the quadratic attenuation factor which adds a curvature to the attenuation.
 
void SetRawPose (const gz::math::Pose3d &_pose)
 Set the pose of the light.
 
void SetSpecular (const gz::math::Color &_color)
 Set the specular color.
 
void SetSpotFalloff (const double _falloff)
 Set the rate of falloff between the inner and outer cones.
 
void SetSpotInnerAngle (const gz::math::Angle &_angle)
 Set the angle covered by the bright inner cone.
 
void SetSpotOuterAngle (const gz::math::Angle &_angle)
 Set the angle covered by the outer cone.
 
void SetType (const LightType _type)
 Set the light type.
 
void SetVisualize (const bool _visualize)
 Set whether light visualization in the GUI is enabled.
 
gz::math::Color Specular () const
 Get the specular color.
 
double SpotFalloff () const
 Get the rate of falloff between the inner and outer cones.
 
gz::math::Angle SpotInnerAngle () const
 Get the angle covered by the bright inner cone.
 
gz::math::Angle SpotOuterAngle () const
 Get the angle covered by the outer cone.
 
sdf::ElementPtr ToElement () const
 Create and return an SDF element filled with data from this light object.
 
sdf::ElementPtr ToElement (sdf::Errors &_errors) const
 Create and return an SDF element filled with data from this light object.
 
LightType Type () const
 Get the light type.
 
bool Visualize () const
 Whether light visualization in the GUI is enabled.
 

Detailed Description

Provides a description of a light source.

A light source can be point, spot, or directional light.

Constructor & Destructor Documentation

◆ Light()

sdf::SDF_VERSION_NAMESPACE::Light::Light ( )

Default constructor.

Member Function Documentation

◆ AttenuationRange()

double sdf::SDF_VERSION_NAMESPACE::Light::AttenuationRange ( ) const

Get the range of the light source in meters.

Returns
Range of the light source in meters.

◆ CastShadows()

bool sdf::SDF_VERSION_NAMESPACE::Light::CastShadows ( ) const

Get whether the light casts shadows.

Returns
True if the light casts shadows.

◆ ConstantAttenuationFactor()

double sdf::SDF_VERSION_NAMESPACE::Light::ConstantAttenuationFactor ( ) const

Get the constant attenuation factor.

This value is clamped to a value between 0 and 1, where 1.0 means never attenuate and 0.0 is complete attenutation.

Returns
Constant attenuation factor.

◆ Diffuse()

gz::math::Color sdf::SDF_VERSION_NAMESPACE::Light::Diffuse ( ) const

Get the diffuse color.

The diffuse color is specified by a set of three numbers representing red/green/blue, each in the range of [0,1].

Returns
Diffuse color.

◆ Direction()

gz::math::Vector3d sdf::SDF_VERSION_NAMESPACE::Light::Direction ( ) const

Get the direction of the light source.

This only has meaning for spot and directional light types. The default value is [0, 0, -1].

Returns
Light source direction.

◆ Element()

sdf::ElementPtr sdf::SDF_VERSION_NAMESPACE::Light::Element ( ) const

Get a pointer to the SDF element that was used during load.

Returns
SDF element pointer. The value will be nullptr if Load has not been called.

◆ Intensity()

double sdf::SDF_VERSION_NAMESPACE::Light::Intensity ( ) const

Get the light intensity.

Returns
The light intensity

◆ LightOn()

bool sdf::SDF_VERSION_NAMESPACE::Light::LightOn ( ) const

Get if the light is on.

Returns
True if the light is on.

◆ LinearAttenuationFactor()

double sdf::SDF_VERSION_NAMESPACE::Light::LinearAttenuationFactor ( ) const

Get the linear attenuation factor.

This value is clamped to a value between 0 and 1, where 1 means attenuate evenly over the distance.

Returns
Linear attentuation factor.

◆ Load()

Errors sdf::SDF_VERSION_NAMESPACE::Light::Load ( ElementPtr  _sdf)

Load the light based on a element pointer.

This is not the usual entry point. Typical usage of the SDF DOM is through the Root object.

Parameters
[in]_sdfThe SDF Element pointer
Returns
Errors, which is a vector of Error objects. Each Error includes an error code and message. An empty vector indicates no error.

◆ Name()

std::string sdf::SDF_VERSION_NAMESPACE::Light::Name ( ) const

Get the name of the light.

Returns
Name of the light.

◆ PoseRelativeTo()

const std::string & sdf::SDF_VERSION_NAMESPACE::Light::PoseRelativeTo ( ) const

Get the name of the coordinate frame relative to which this object's pose is expressed.

An empty value indicates that the frame is relative to the parent link/world coordinate frame.

Returns
The name of the pose relative-to frame.

◆ QuadraticAttenuationFactor()

double sdf::SDF_VERSION_NAMESPACE::Light::QuadraticAttenuationFactor ( ) const

Get the quadratic attenuation factor which adds a curvature to the attenuation.

Returns
The quadratic attenuation factor.

◆ RawPose()

const gz::math::Pose3d & sdf::SDF_VERSION_NAMESPACE::Light::RawPose ( ) const

Get the pose of the light.

This is the pose of the light as specified in SDF (<light> <pose> ... </pose></light>), and is typically used to express the position and rotation of a light in a global coordinate frame.

Returns
The pose of the light.

◆ SemanticPose()

sdf::SemanticPose sdf::SDF_VERSION_NAMESPACE::Light::SemanticPose ( ) const

Get SemanticPose object of this object to aid in resolving poses.

Returns
SemanticPose object for this link.

◆ SetAttenuationRange()

void sdf::SDF_VERSION_NAMESPACE::Light::SetAttenuationRange ( const double  _range)

Set the range of the light source in meters.

Parameters
[in]_factorRange of the light source in meters.

◆ SetCastShadows()

void sdf::SDF_VERSION_NAMESPACE::Light::SetCastShadows ( const bool  _cast)

Set whether the light casts shadows.

Parameters
[in]_castTrue to indicate that the light casts shadows.

◆ SetConstantAttenuationFactor()

void sdf::SDF_VERSION_NAMESPACE::Light::SetConstantAttenuationFactor ( const double  _factor)

Set the constant attenuation factor.

This value is clamped to a value between 0 and 1, where 1.0 means never attenuate and 0.0 is complete attenutation.

Parameters
[in]_factorConstant attenuation factor.

◆ SetDiffuse()

void sdf::SDF_VERSION_NAMESPACE::Light::SetDiffuse ( const gz::math::Color &  _color)

Set the diffuse color.

The diffuse color is specified by a set of three numbers representing red/green/blue, each in the range of [0,1].

Parameters
[in]_colorDiffuse color.

◆ SetDirection()

void sdf::SDF_VERSION_NAMESPACE::Light::SetDirection ( const gz::math::Vector3d &  _dir)

Set the direction of the light source.

This only has meaning for spot and directional light types.

Parameters
[in]_dirLight source direction.

◆ SetIntensity()

void sdf::SDF_VERSION_NAMESPACE::Light::SetIntensity ( const double  _intensity)

Set the light intensity.

Parameters
[in]_intensityNew light intensity

◆ SetLightOn()

void sdf::SDF_VERSION_NAMESPACE::Light::SetLightOn ( const bool  _isLightOn)

Set if the light is ON/OFF.

Parameters
[in]_castTrue to indicate that the light is on, False otherwise.

◆ SetLinearAttenuationFactor()

void sdf::SDF_VERSION_NAMESPACE::Light::SetLinearAttenuationFactor ( const double  _factor)

Set the linear attenuation factor.

This value is clamped to a value between 0 and 1, where 1 means attenuate evenly over the distance.

Parameters
[in]_factorLinear attentuation factor.

◆ SetName()

void sdf::SDF_VERSION_NAMESPACE::Light::SetName ( const std::string &  _name)

Set the name of the light.

Parameters
[in]_nameName of the light.

◆ SetPoseRelativeTo()

void sdf::SDF_VERSION_NAMESPACE::Light::SetPoseRelativeTo ( const std::string &  _frame)

Set the name of the coordinate frame relative to which this object's pose is expressed.

An empty value indicates that the frame is relative to the parent model/world coordinate frame.

Parameters
[in]_frameThe name of the pose relative-to frame.

◆ SetQuadraticAttenuationFactor()

void sdf::SDF_VERSION_NAMESPACE::Light::SetQuadraticAttenuationFactor ( const double  _factor)

Set the quadratic attenuation factor which adds a curvature to the attenuation.

Parameters
[in]_factorThe quadratic attenuation factor.

◆ SetRawPose()

void sdf::SDF_VERSION_NAMESPACE::Light::SetRawPose ( const gz::math::Pose3d &  _pose)

Set the pose of the light.

See also
const gz::math::Pose3d &RawPose() const
Parameters
[in]_poseThe new light pose.

◆ SetSpecular()

void sdf::SDF_VERSION_NAMESPACE::Light::SetSpecular ( const gz::math::Color &  _color)

Set the specular color.

The specular color is specified by a set of three numbers representing red/green/blue, each in the range of [0,1].

Parameters
[in]_colorSpecular color.

◆ SetSpotFalloff()

void sdf::SDF_VERSION_NAMESPACE::Light::SetSpotFalloff ( const double  _falloff)

Set the rate of falloff between the inner and outer cones.

A value of 1.0 is a linear falloff, less than 1.0 is a slower falloff, and a higher value indicates a faster falloff.

Parameters
[in]_falloffThe spot falloff.
Note
This function only has meaning for a spot light.

◆ SetSpotInnerAngle()

void sdf::SDF_VERSION_NAMESPACE::Light::SetSpotInnerAngle ( const gz::math::Angle &  _angle)

Set the angle covered by the bright inner cone.

Parameters
[in]_angleThe angle covered by the bright inner cone.
Note
This function only has meaning for a spot light.

◆ SetSpotOuterAngle()

void sdf::SDF_VERSION_NAMESPACE::Light::SetSpotOuterAngle ( const gz::math::Angle &  _angle)

Set the angle covered by the outer cone.

Parameters
[in]_angleThe angle covered by the outer cone.
Note
This function only has meaning for a spot light.

◆ SetType()

void sdf::SDF_VERSION_NAMESPACE::Light::SetType ( const LightType  _type)

Set the light type.

Parameters
[in]_typeThe light type.

◆ SetVisualize()

void sdf::SDF_VERSION_NAMESPACE::Light::SetVisualize ( const bool  _visualize)

Set whether light visualization in the GUI is enabled.

Parameters
[in]_visualizeTrue to view the light on the GUI.

◆ Specular()

gz::math::Color sdf::SDF_VERSION_NAMESPACE::Light::Specular ( ) const

Get the specular color.

The specular color is specified by a set of three numbers representing red/green/blue, each in the range of [0,1].

Returns
Specular color.

◆ SpotFalloff()

double sdf::SDF_VERSION_NAMESPACE::Light::SpotFalloff ( ) const

Get the rate of falloff between the inner and outer cones.

A value of 1.0 is a linear falloff, less than 1.0 is a slower falloff, and a higher value indicates a faster falloff.

Returns
The spot falloff.
Note
This function only has meaning for a spot light.

◆ SpotInnerAngle()

gz::math::Angle sdf::SDF_VERSION_NAMESPACE::Light::SpotInnerAngle ( ) const

Get the angle covered by the bright inner cone.

Returns
The angle covered by the bright inner cone.
Note
This function only has meaning for a spot light.

◆ SpotOuterAngle()

gz::math::Angle sdf::SDF_VERSION_NAMESPACE::Light::SpotOuterAngle ( ) const

Get the angle covered by the outer cone.

Returns
The angle covered by the outer cone.
Note
This function only has meaning for a spot light.

◆ ToElement() [1/2]

sdf::ElementPtr sdf::SDF_VERSION_NAMESPACE::Light::ToElement ( ) const

Create and return an SDF element filled with data from this light object.

Note that parameter passing functionality is not captured with this function.

Returns
SDF element pointer with updated light values.

◆ ToElement() [2/2]

sdf::ElementPtr sdf::SDF_VERSION_NAMESPACE::Light::ToElement ( sdf::Errors _errors) const

Create and return an SDF element filled with data from this light object.

Note that parameter passing functionality is not captured with this function.

Parameters
[out]_errorsVector of errors.
Returns
SDF element pointer with updated light values.

◆ Type()

LightType sdf::SDF_VERSION_NAMESPACE::Light::Type ( ) const

Get the light type.

Returns
The light type.

◆ Visualize()

bool sdf::SDF_VERSION_NAMESPACE::Light::Visualize ( ) const

Whether light visualization in the GUI is enabled.

Returns
True if visualization is enabled.

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