Gazebo Sim

API Reference

7.7.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_SIM_LIGHT_HH_
18 #define GZ_SIM_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 gz
38 {
39  namespace sim
40  {
41  // Inline bracket to help doxygen filtering.
42  inline namespace GZ_SIM_VERSION_NAMESPACE {
43  //
63  class GZ_SIM_VISIBLE Light
64  {
67  public: explicit Light(sim::Entity _entity = kNullEntity);
68 
71  public: sim::Entity Entity() const;
72 
75  public: void ResetEntity(sim::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 
204  public: void SetDiffuseColor(EntityComponentManager &_ecm,
205  const math::Color &_color);
206 
210  public: void SetSpecularColor(EntityComponentManager &_ecm,
211  const math::Color &_color);
212 
216  public: void SetCastShadows(EntityComponentManager &_ecm,
217  bool _castShadows);
218 
222  public: void SetIntensity(EntityComponentManager &_ecm,
223  double _value);
224 
229  public: void SetDirection(EntityComponentManager &_ecm,
230  const math::Vector3d &_dir);
231 
236  public: void SetAttenuationRange(EntityComponentManager &_ecm,
237  double _range);
238 
243  public: void SetAttenuationConstant(EntityComponentManager &_ecm,
244  double _value);
245 
250  public: void SetAttenuationLinear(EntityComponentManager &_ecm,
251  double _value);
252 
257  public: void SetAttenuationQuadratic(EntityComponentManager &_ecm,
258  double _value);
259 
263  public: void SetSpotInnerAngle(EntityComponentManager &_ecm,
264  const math::Angle &_angle);
265 
269  public: void SetSpotOuterAngle(EntityComponentManager &_ecm,
270  const math::Angle &_angle);
271 
275  public: void SetSpotFalloff(EntityComponentManager &_ecm,
276  double _falloff);
277 
282  public: std::optional<sim::Entity> Parent(
283  const EntityComponentManager &_ecm) const;
284 
286  GZ_UTILS_IMPL_PTR(dataPtr)
287  };
288  }
289  }
290 }
291 #endif