Loading...
Searching...
No Matches
Light.hh
Go to the documentation of this file.
1/*
2 * Copyright 2018 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 SDF_LIGHT_HH_
18#define SDF_LIGHT_HH_
19
20#include <memory>
21#include <string>
22#include <ignition/math/Pose3.hh>
23#include <ignition/math/Angle.hh>
24
25#include "sdf/Element.hh"
26#include "sdf/SemanticPose.hh"
27#include "sdf/Types.hh"
28#include "sdf/sdf_config.h"
29#include "sdf/system_util.hh"
30
31namespace sdf
32{
33 // Inline bracket to help doxygen filtering.
34 inline namespace SDF_VERSION_NAMESPACE {
35 //
36
37 // Forward declare private data class.
38 class LightPrivate;
39 struct PoseRelativeToGraph;
40
44 enum class LightType
45 {
48 INVALID = 0,
49
51 POINT = 1,
52
54 SPOT = 2,
55
57 DIRECTIONAL = 3,
58 };
59
63 {
65 public: Light();
66
69 public: Light(const Light &_light);
70
73 public: Light(Light &&_light) noexcept;
74
76 public: ~Light();
77
81 public: Light &operator=(Light &&_light);
82
86 public: Light &operator=(const Light &_light);
87
94 public: Errors Load(ElementPtr _sdf);
95
98 public: LightType Type() const;
99
102 public: void SetType(const LightType _type);
103
106 public: std::string Name() const;
107
110 public: void SetName(const std::string &_name) const;
111
118 public: const ignition::math::Pose3d &Pose() const
119 SDF_DEPRECATED(9.0);
120
125 public: void SetPose(const ignition::math::Pose3d &_pose)
126 SDF_DEPRECATED(9.0);
127
133 public: const ignition::math::Pose3d &RawPose() const;
134
138 public: void SetRawPose(const ignition::math::Pose3d &_pose);
139
144 public: const std::string &PoseRelativeTo() const;
145
150 public: void SetPoseRelativeTo(const std::string &_frame);
151
157 public: const std::string &PoseFrame() const
158 SDF_DEPRECATED(9.0);
159
165 public: void SetPoseFrame(const std::string &_frame)
166 SDF_DEPRECATED(9.0);
167
171 public: sdf::SemanticPose SemanticPose() const;
172
175 public: bool CastShadows() const;
176
179 public: void SetCastShadows(const bool _cast);
180
185 public: ignition::math::Color Diffuse() const;
186
191 public: void SetDiffuse(const ignition::math::Color &_color) const;
192
197 public: ignition::math::Color Specular() const;
198
203 public: void SetSpecular(const ignition::math::Color &_color) const;
204
207 public: double AttenuationRange() const;
208
211 public: void SetAttenuationRange(const double _range);
212
217 public: double LinearAttenuationFactor() const;
218
223 public: void SetLinearAttenuationFactor(const double _factor);
224
229 public: double ConstantAttenuationFactor() const;
230
235 public: void SetConstantAttenuationFactor(const double _factor);
236
240 public: double QuadraticAttenuationFactor() const;
241
245 public: void SetQuadraticAttenuationFactor(const double _factor);
246
251 public: ignition::math::Vector3d Direction() const;
252
256 public: void SetDirection(const ignition::math::Vector3d &_dir);
257
261 public: ignition::math::Angle SpotInnerAngle() const;
262
266 public: void SetSpotInnerAngle(const ignition::math::Angle &_angle);
267
271 public: ignition::math::Angle SpotOuterAngle() const;
272
276 public: void SetSpotOuterAngle(const ignition::math::Angle &_angle);
277
283 public: double SpotFalloff() const;
284
290 public: void SetSpotFalloff(const double _falloff);
291
296 public: sdf::ElementPtr Element() const;
297
300 private: void CopyFrom(const Light &_light);
301
306 private: void SetXmlParentName(const std::string &_xmlParentName);
307
312 private: void SetPoseRelativeToGraph(
313 std::weak_ptr<const PoseRelativeToGraph> _graph);
314
319 friend class Link;
320 friend class World;
321
323 private: LightPrivate *dataPtr = nullptr;
324 };
325 }
326}
327#endif
#define SDF_DEPRECATED(version)
Definition Types.hh:38
Defines a color.
Definition Types.hh:93
SDF Element class.
Definition Element.hh:74
Provides a description of a light source.
Definition Light.hh:63
Light(const Light &_light)
Copy constructor.
Light & operator=(const Light &_light)
Assignment operator.
std::string Name() const
Get the name of the light.
~Light()
Destructor.
Light()
Default constructor.
Errors Load(ElementPtr _sdf)
Load the light based on a element pointer.
void SetType(const LightType _type)
Set the light type.
Light(Light &&_light) noexcept
Move constructor.
const ignition::math::Pose3d & Pose() const SDF_DEPRECATED(9.0)
Get the pose of the light.
LightType Type() const
Get the light type.
Light & operator=(Light &&_light)
Move assignment operator.
void SetName(const std::string &_name) const
Set the name of the light.
SemanticPose is a data structure that can be used by different DOM objects to resolve poses on a Pose...
Definition SemanticPose.hh:54
Definition World.hh:46
std::vector< Error > Errors
A vector of Error.
Definition Types.hh:89
std::shared_ptr< Element > ElementPtr
Definition Element.hh:53
LightType
The set of light types.
Definition Light.hh:45
namespace for Simulation Description Format parser
Definition Actor.hh:33
#define SDFORMAT_VISIBLE
Use to represent "symbol visible" if supported.
Definition system_util.hh:48