Gazebo Gazebo

API Reference

6.18.0
gz/sim/Light.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2023 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 #ifndef GZ_GAZEBO_LIGHT_HH_
18 #define GZ_GAZEBO_LIGHT_HH_
19 
20 #include <memory>
21 #include <optional>
22 #include <string>
23 #include <vector>
24 
25 #include <gz/utils/ImplPtr.hh>
26 
27 #include <gz/math/Angle.hh>
28 #include <gz/math/Color.hh>
29 #include <gz/math/Pose3.hh>
30 #include <gz/math/Vector3.hh>
31 
32 #include "gz/sim/config.hh"
34 #include "gz/sim/Export.hh"
35 #include "gz/sim/Types.hh"
36 
37 namespace ignition
38 {
39  namespace gazebo
40  {
41  // Inline bracket to help doxygen filtering.
42  inline namespace IGNITION_GAZEBO_VERSION_NAMESPACE {
43  //
63  class IGNITION_GAZEBO_VISIBLE Light
64  {
67  public: explicit Light(gazebo::Entity _entity = kNullEntity);
68 
71  public: gazebo::Entity Entity() const;
72 
75  public: void ResetEntity(gazebo::Entity _newEntity);
76 
81  public: bool Valid(const EntityComponentManager &_ecm) const;
82 
87  public: std::optional<std::string> Name(
88  const EntityComponentManager &_ecm) const;
89 
96  public: std::optional<math::Pose3d> Pose(
97  const EntityComponentManager &_ecm) const;
98 
103  public: std::optional<std::string> Type(
104  const EntityComponentManager &_ecm) const;
105 
110  public: std::optional<math::Color> DiffuseColor(
111  const EntityComponentManager &_ecm) const;
112 
117  public: std::optional<math::Color> SpecularColor(
118  const EntityComponentManager &_ecm) const;
119 
124  public: std::optional<bool> CastShadows(
125  const EntityComponentManager &_ecm) const;
126 
131  public: std::optional<double> Intensity(
132  const EntityComponentManager &_ecm) const;
133 
138  public: std::optional<math::Vector3d> Direction(
139  const EntityComponentManager &_ecm) const;
140 
146  public: std::optional<double> AttenuationRange(
147  const EntityComponentManager &_ecm) const;
148 
154  public: std::optional<double> AttenuationConstant(
155  const EntityComponentManager &_ecm) const;
156 
162  public: std::optional<double> AttenuationLinear(
163  const EntityComponentManager &_ecm) const;
164 
170  public: std::optional<double> AttenuationQuadratic(
171  const EntityComponentManager &_ecm) const;
172 
177  public: std::optional<math::Angle> SpotInnerAngle(
178  const EntityComponentManager &_ecm) const;
179 
184  public: std::optional<math::Angle> SpotOuterAngle(
185  const EntityComponentManager &_ecm) const;
186 
191  public: std::optional<double> SpotFalloff(
192  const EntityComponentManager &_ecm) const;
193 
198  public: void SetPose(EntityComponentManager &_ecm,
199  const math::Pose3d &_pose);
200 
205  const math::Color &_color);
206 
211  const math::Color &_color);
212 
217  bool _castShadows);
218 
223  double _value);
224 
230  const math::Vector3d &_dir);
231 
237  double _range);
238 
244  double _value);
245 
251  double _value);
252 
258  double _value);
259 
264  const math::Angle &_angle);
265 
270  const math::Angle &_angle);
271 
276  double _falloff);
277 
282  public: std::optional<gazebo::Entity> Parent(
283  const EntityComponentManager &_ecm) const;
284 
286  IGN_UTILS_IMPL_PTR(dataPtr)
287  };
288  }
289  }
290 }
291 #endif
The EntityComponentManager constructs, deletes, and returns components and entities....
Definition: gz/sim/EntityComponentManager.hh:67
This class provides wrappers around entities and components which are more convenient and straight-fo...
Definition: gz/sim/Light.hh:64
void SetPose(EntityComponentManager &_ecm, const math::Pose3d &_pose)
Set the pose of this light.
std::optional< double > AttenuationLinear(const EntityComponentManager &_ecm) const
Get the light attenuation linear value. Light attenuation is not applicable to directional lights.
std::optional< double > Intensity(const EntityComponentManager &_ecm) const
Get the light intensity.
std::optional< math::Color > SpecularColor(const EntityComponentManager &_ecm) const
Get the light specular color.
std::optional< math::Pose3d > Pose(const EntityComponentManager &_ecm) const
Get the pose of the light. The pose is given w.r.t the light's parent. which can be a world or a link...
std::optional< double > AttenuationRange(const EntityComponentManager &_ecm) const
Get the light attenuation range. Light attenuation is not applicable to directional lights.
void SetAttenuationRange(EntityComponentManager &_ecm, double _range)
Set attenuation range of this light.
void SetSpotFalloff(EntityComponentManager &_ecm, double _falloff)
Set fall off value for this light. Applies to spot lights only.
Light(gazebo::Entity _entity=kNullEntity)
Constructor.
std::optional< std::string > Type(const EntityComponentManager &_ecm) const
Get the light type.
void SetSpotOuterAngle(EntityComponentManager &_ecm, const math::Angle &_angle)
Set outer angle for this light. Applies to spot lights only.
void SetCastShadows(EntityComponentManager &_ecm, bool _castShadows)
Set whether the light casts shadows.
std::optional< math::Color > DiffuseColor(const EntityComponentManager &_ecm) const
Get the light diffuse color.
std::optional< std::string > Name(const EntityComponentManager &_ecm) const
Get the light's unscoped name.
void SetAttenuationConstant(EntityComponentManager &_ecm, double _value)
Set attenuation constant value of this light.
std::optional< bool > CastShadows(const EntityComponentManager &_ecm) const
Get whether the light casts shadows.
std::optional< double > AttenuationQuadratic(const EntityComponentManager &_ecm) const
Get the light attenuation quadratic value. Light attenuation is not applicable to directional lights.
void SetSpecularColor(EntityComponentManager &_ecm, const math::Color &_color)
Set the specular color of this light.
void SetDirection(EntityComponentManager &_ecm, const math::Vector3d &_dir)
Set light direction. Applies to directional lights.
void ResetEntity(gazebo::Entity _newEntity)
Reset Entity to a new one.
std::optional< math::Angle > SpotInnerAngle(const EntityComponentManager &_ecm) const
Get the inner angle of light. Applies to spot lights only.
std::optional< gazebo::Entity > Parent(const EntityComponentManager &_ecm) const
Get the parent entity. This can be a world or a link.
void SetAttenuationQuadratic(EntityComponentManager &_ecm, double _value)
Set attenuation quadratic value of this light.
bool Valid(const EntityComponentManager &_ecm) const
Check whether this light correctly refers to an entity that has a components::Light.
std::optional< math::Angle > SpotOuterAngle(const EntityComponentManager &_ecm) const
Get the outer angle of light. Applies to spot lights only.
std::optional< math::Vector3d > Direction(const EntityComponentManager &_ecm) const
Get the light direction.
gazebo::Entity Entity() const
Get the entity which this Light is related to.
std::optional< double > SpotFalloff(const EntityComponentManager &_ecm) const
Get the fall off value of light. Applies to spot lights only.
void SetAttenuationLinear(EntityComponentManager &_ecm, double _value)
Set attenuation linear value of this light.
void SetDiffuseColor(EntityComponentManager &_ecm, const math::Color &_color)
Set the diffuse color of this light.
void SetSpotInnerAngle(EntityComponentManager &_ecm, const math::Angle &_angle)
Set inner angle for this light. Applies to spot lights only.
std::optional< double > AttenuationConstant(const EntityComponentManager &_ecm) const
Get the light attenuation constant value. Light attenuation is not applicable to directional lights.
void SetIntensity(EntityComponentManager &_ecm, double _value)
Set light intensity.
const Entity kNullEntity
Indicates a non-existant or invalid Entity.
Definition: gz/sim/Entity.hh:61
uint64_t Entity
An Entity identifies a single object in simulation such as a model, link, or light....
Definition: gz/sim/Entity.hh:58
This library is part of the Gazebo project.
Definition: gz/sim/Actor.hh:34