Public Member Functions | List of all members
sdf::v9::Light Class Reference

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

#include <Light.hh>

Public Member Functions

 Light ()
 Default constructor. More...
 
 Light (const Light &_light)
 Copy constructor. More...
 
 Light (Light &&_light) noexcept
 Move constructor. More...
 
 ~Light ()
 Destructor. More...
 
double AttenuationRange () const
 Get the range of the light source in meters. More...
 
bool CastShadows () const
 Get whether the light casts shadows. More...
 
double ConstantAttenuationFactor () const
 Get the constant attenuation factor. More...
 
gz::math::Color Diffuse () const
 Get the diffuse color. More...
 
gz::math::Vector3d Direction () const
 Get the direction of the light source. More...
 
sdf::ElementPtr Element () const
 Get a pointer to the SDF element that was used during load. More...
 
double LinearAttenuationFactor () const
 Get the linear attenuation factor. More...
 
Errors Load (ElementPtr _sdf)
 Load the light based on a element pointer. More...
 
std::string Name () const
 Get the name of the light. More...
 
Lightoperator= (const Light &_light)
 Assignment operator. More...
 
Lightoperator= (Light &&_light)
 Move assignment operator. More...
 
const gz::math::Pose3d & Pose () const SDF_DEPRECATED(9.0)
 Get the pose of the light. More...
 
const std::string & PoseFrame () const SDF_DEPRECATED(9.0)
 Get the name of the coordinate frame in which this light's pose is expressed. More...
 
const std::string & PoseRelativeTo () const
 Get the name of the coordinate frame relative to which this object's pose is expressed. More...
 
double QuadraticAttenuationFactor () const
 Get the quadratic attenuation factor which adds a curvature to the attenuation. More...
 
const gz::math::Pose3d & RawPose () const
 Get the pose of the light. More...
 
sdf::SemanticPose SemanticPose () const
 Get SemanticPose object of this object to aid in resolving poses. More...
 
void SetAttenuationRange (const double _range)
 Set the range of the light source in meters. More...
 
void SetCastShadows (const bool _cast)
 Set whether the light casts shadows. More...
 
void SetConstantAttenuationFactor (const double _factor)
 Set the constant attenuation factor. More...
 
void SetDiffuse (const gz::math::Color &_color) const
 Set the diffuse color. More...
 
void SetDirection (const gz::math::Vector3d &_dir)
 Set the direction of the light source. More...
 
void SetLinearAttenuationFactor (const double _factor)
 Set the linear attenuation factor. More...
 
void SetName (const std::string &_name) const
 Set the name of the light. More...
 
void SetPose (const gz::math::Pose3d &_pose) SDF_DEPRECATED(9.0)
 Set the pose of the light. More...
 
void SetPoseFrame (const std::string &_frame) SDF_DEPRECATED(9.0)
 Set the name of the coordinate frame in which this light's pose is expressed. More...
 
void SetPoseRelativeTo (const std::string &_frame)
 Set the name of the coordinate frame relative to which this object's pose is expressed. More...
 
void SetQuadraticAttenuationFactor (const double _factor)
 Set the quadratic attenuation factor which adds a curvature to the attenuation. More...
 
void SetRawPose (const gz::math::Pose3d &_pose)
 Set the pose of the light. More...
 
void SetSpecular (const gz::math::Color &_color) const
 Set the specular color. More...
 
void SetSpotFalloff (const double _falloff)
 Set the rate of falloff between the inner and outer cones. More...
 
void SetSpotInnerAngle (const gz::math::Angle &_angle)
 Set the angle covered by the bright inner cone. More...
 
void SetSpotOuterAngle (const gz::math::Angle &_angle)
 Set the angle covered by the outer cone. More...
 
void SetType (const LightType _type)
 Set the light type. More...
 
gz::math::Color Specular () const
 Get the specular color. More...
 
double SpotFalloff () const
 Get the rate of falloff between the inner and outer cones. More...
 
gz::math::Angle SpotInnerAngle () const
 Get the angle covered by the bright inner cone. More...
 
gz::math::Angle SpotOuterAngle () const
 Get the angle covered by the outer cone. More...
 
LightType Type () const
 Get the light type. More...
 

Detailed Description

Provides a description of a light source.

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

Constructor & Destructor Documentation

◆ Light() [1/3]

sdf::v9::Light::Light ( )

Default constructor.

◆ Light() [2/3]

sdf::v9::Light::Light ( const Light _light)

Copy constructor.

Parameters
[in]_lightLight to copy.

◆ Light() [3/3]

sdf::v9::Light::Light ( Light &&  _light)
noexcept

Move constructor.

Parameters
[in]_lightLight to move.

◆ ~Light()

sdf::v9::Light::~Light ( )

Destructor.

Member Function Documentation

◆ AttenuationRange()

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

Get the range of the light source in meters.

Returns
Range of the light source in meters.

◆ CastShadows()

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

Get whether the light casts shadows.

Returns
True if the light casts shadows.

◆ ConstantAttenuationFactor()

double sdf::v9::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::v9::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::v9::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::v9::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.

◆ LinearAttenuationFactor()

double sdf::v9::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::v9::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::v9::Light::Name ( ) const

Get the name of the light.

Returns
Name of the light.

◆ operator=() [1/2]

Light& sdf::v9::Light::operator= ( const Light _light)

Assignment operator.

Parameters
[in]_lightThe light to set values from.
Returns
*this

◆ operator=() [2/2]

Light& sdf::v9::Light::operator= ( Light &&  _light)

Move assignment operator.

Parameters
[in]_lightLight to move.
Returns
Reference to this.

◆ Pose()

const gz::math::Pose3d& sdf::v9::Light::Pose ( ) 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.
Deprecated:
See RawPose.

◆ PoseFrame()

const std::string& sdf::v9::Light::PoseFrame ( ) const

Get the name of the coordinate frame in which this light's pose is expressed.

A empty value indicates that the frame is the global/world coordinate frame.

Returns
The name of the pose frame.
Deprecated:
See PoseRelativeTo.

◆ PoseRelativeTo()

const std::string& sdf::v9::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::v9::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::v9::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::v9::Light::SemanticPose ( ) const

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

Returns
SemanticPose object for this link.

◆ SetAttenuationRange()

void sdf::v9::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::v9::Light::SetCastShadows ( const bool  _cast)

Set whether the light casts shadows.

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

◆ SetConstantAttenuationFactor()

void sdf::v9::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::v9::Light::SetDiffuse ( const gz::math::Color &  _color) const

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::v9::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.

◆ SetLinearAttenuationFactor()

void sdf::v9::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::v9::Light::SetName ( const std::string &  _name) const

Set the name of the light.

Parameters
[in]_nameName of the light.

◆ SetPose()

void sdf::v9::Light::SetPose ( const gz::math::Pose3d &  _pose)

Set the pose of the light.

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

◆ SetPoseFrame()

void sdf::v9::Light::SetPoseFrame ( const std::string &  _frame)

Set the name of the coordinate frame in which this light's pose is expressed.

A empty value indicates that the frame is the global/world coordinate frame.

Parameters
[in]_frameThe name of the pose frame.
Deprecated:
See SetPoseRelativeTo.

◆ SetPoseRelativeTo()

void sdf::v9::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::v9::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::v9::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::v9::Light::SetSpecular ( const gz::math::Color &  _color) const

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::v9::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::v9::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::v9::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::v9::Light::SetType ( const LightType  _type)

Set the light type.

Parameters
[in]_typeThe light type.

◆ Specular()

gz::math::Color sdf::v9::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::v9::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::v9::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::v9::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.

◆ Type()

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

Get the light type.

Returns
The light type.

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