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 <string>
21 #include <ignition/math/Pose3.hh>
22 #include <ignition/math/Angle.hh>
23 
24 #include "sdf/Element.hh"
25 #include "sdf/Types.hh"
26 #include "sdf/sdf_config.h"
27 #include "sdf/system_util.hh"
28 
29 namespace sdf
30 {
31  // Inline bracke to help doxygen filtering.
32  inline namespace SDF_VERSION_NAMESPACE {
33  //
34 
35  // Forward declare private data class.
36  class LightPrivate;
37 
41  enum class LightType
42  {
45  INVALID = 0,
46 
48  POINT = 1,
49 
51  SPOT = 2,
52 
54  DIRECTIONAL = 3,
55  };
56 
60  {
62  public: Light();
63 
66  public: Light(const Light &_light);
67 
70  public: Light(Light &&_light) noexcept;
71 
73  public: ~Light();
74 
78  public: Light &operator=(Light &&_light);
79 
83  public: Light &operator=(const Light &_light);
84 
91  public: Errors Load(ElementPtr _sdf);
92 
95  public: LightType Type() const;
96 
99  public: void SetType(const LightType _type);
100 
103  public: std::string Name() const;
104 
107  public: void SetName(const std::string &_name) const;
108 
114  public: const ignition::math::Pose3d &Pose() const;
115 
119  public: void SetPose(const ignition::math::Pose3d &_pose);
120 
125  public: const std::string &PoseFrame() const;
126 
131  public: void SetPoseFrame(const std::string &_frame);
132 
135  public: bool CastShadows() const;
136 
139  public: void SetCastShadows(const bool _cast);
140 
145  public: ignition::math::Color Diffuse() const;
146 
151  public: void SetDiffuse(const ignition::math::Color &_color) const;
152 
157  public: ignition::math::Color Specular() const;
158 
163  public: void SetSpecular(const ignition::math::Color &_color) const;
164 
167  public: double AttenuationRange() const;
168 
171  public: void SetAttenuationRange(const double _range);
172 
177  public: double LinearAttenuationFactor() const;
178 
183  public: void SetLinearAttenuationFactor(const double _factor);
184 
189  public: double ConstantAttenuationFactor() const;
190 
195  public: void SetConstantAttenuationFactor(const double _factor);
196 
200  public: double QuadraticAttenuationFactor() const;
201 
205  public: void SetQuadraticAttenuationFactor(const double _factor);
206 
211  public: ignition::math::Vector3d Direction() const;
212 
216  public: void SetDirection(const ignition::math::Vector3d &_dir);
217 
221  public: ignition::math::Angle SpotInnerAngle() const;
222 
226  public: void SetSpotInnerAngle(const ignition::math::Angle &_angle);
227 
231  public: ignition::math::Angle SpotOuterAngle() const;
232 
236  public: void SetSpotOuterAngle(const ignition::math::Angle &_angle);
237 
243  public: double SpotFalloff() const;
244 
250  public: void SetSpotFalloff(const double _falloff);
251 
256  public: sdf::ElementPtr Element() const;
257 
260  private: void CopyFrom(const Light &_light);
261 
263  private: LightPrivate *dataPtr = nullptr;
264  };
265  }
266 }
267 #endif
Provides a description of a light source.
Definition: Light.hh:59
class SDFORMAT_VISIBLE Element
Definition: Element.hh:47
LightType
The set of light types.
Definition: Light.hh:41
A point light source.
An invalid joint.
A directional light source.
std::shared_ptr< Element > ElementPtr
Definition: Element.hh:51
std::vector< Error > Errors
A vector of Error.
Definition: Types.hh:74
A spot light source.
#define SDFORMAT_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system_util.hh:48
namespace for Simulation Description Format parser
Definition: AirPressure.hh:25