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 #include <ignition/utils/ImplPtr.hh>
25 
26 #include "sdf/Element.hh"
27 #include "sdf/SemanticPose.hh"
28 #include "sdf/Types.hh"
29 #include "sdf/sdf_config.h"
30 #include "sdf/system_util.hh"
31 
32 namespace sdf
33 {
34  // Inline bracket to help doxygen filtering.
35  inline namespace SDF_VERSION_NAMESPACE {
36  //
37 
38  // Forward declare private data class.
39  struct PoseRelativeToGraph;
40  template <typename T> class ScopedGraph;
41 
45  enum class LightType
46  {
49  INVALID = 0,
50 
52  POINT = 1,
53 
55  SPOT = 2,
56 
58  DIRECTIONAL = 3,
59  };
60 
64  {
66  public: Light();
67 
74  public: Errors Load(ElementPtr _sdf);
75 
78  public: LightType Type() const;
79 
82  public: void SetType(const LightType _type);
83 
86  public: std::string Name() const;
87 
90  public: void SetName(const std::string &_name);
91 
97  public: const ignition::math::Pose3d &RawPose() const;
98 
102  public: void SetRawPose(const ignition::math::Pose3d &_pose);
103 
108  public: const std::string &PoseRelativeTo() const;
109 
114  public: void SetPoseRelativeTo(const std::string &_frame);
115 
119  public: sdf::SemanticPose SemanticPose() const;
120 
123  public: bool CastShadows() const;
124 
127  public: void SetCastShadows(const bool _cast);
128 
131  public: double Intensity() const;
132 
135  public: void SetIntensity(const double _intensity);
136 
141  public: ignition::math::Color Diffuse() const;
142 
147  public: void SetDiffuse(const ignition::math::Color &_color);
148 
153  public: ignition::math::Color Specular() const;
154 
159  public: void SetSpecular(const ignition::math::Color &_color);
160 
163  public: double AttenuationRange() const;
164 
167  public: void SetAttenuationRange(const double _range);
168 
173  public: double LinearAttenuationFactor() const;
174 
179  public: void SetLinearAttenuationFactor(const double _factor);
180 
185  public: double ConstantAttenuationFactor() const;
186 
191  public: void SetConstantAttenuationFactor(const double _factor);
192 
196  public: double QuadraticAttenuationFactor() const;
197 
201  public: void SetQuadraticAttenuationFactor(const double _factor);
202 
207  public: ignition::math::Vector3d Direction() const;
208 
212  public: void SetDirection(const ignition::math::Vector3d &_dir);
213 
217  public: ignition::math::Angle SpotInnerAngle() const;
218 
222  public: void SetSpotInnerAngle(const ignition::math::Angle &_angle);
223 
227  public: ignition::math::Angle SpotOuterAngle() const;
228 
232  public: void SetSpotOuterAngle(const ignition::math::Angle &_angle);
233 
239  public: double SpotFalloff() const;
240 
246  public: void SetSpotFalloff(const double _falloff);
247 
252  public: sdf::ElementPtr Element() const;
253 
256  private: void CopyFrom(const Light &_light);
257 
262  private: void SetXmlParentName(const std::string &_xmlParentName);
263 
268  private: void SetPoseRelativeToGraph(
270 
274  public: sdf::ElementPtr ToElement() const;
275 
280  friend class Link;
281  friend class World;
282 
284  IGN_UTILS_IMPL_PTR(dataPtr)
285  };
286  }
287 }
288 #endif
sdf::v12::World
Definition: World.hh:54
sdf::v12::LightType::SPOT
@ SPOT
A spot light source.
sdf::v12::ScopedGraph
Definition: Collision.hh:39
sdf::v12::LightType::POINT
@ POINT
A point light source.
sdf
namespace for Simulation Description Format parser
Definition: Actor.hh:33
sdf::v12::Light
Provides a description of a light source.
Definition: Light.hh:63
sdf::v12::LightType::DIRECTIONAL
@ DIRECTIONAL
A directional light source.
sdf::v12::Errors
std::vector< Error > Errors
A vector of Error.
Definition: Types.hh:106
sdf::v12::LightType
LightType
Definition: Light.hh:45
Types.hh
SemanticPose.hh
SDFORMAT_VISIBLE
#define SDFORMAT_VISIBLE
Definition: system_util.hh:41
sdf::v12::ForceTorqueFrame::INVALID
@ INVALID
Invalid frame.
sdf::v12::SemanticPose
SemanticPose is a data structure that can be used by different DOM objects to resolve poses on a Pose...
Definition: SemanticPose.hh:54
sdf::v12::Element
SDF Element class.
Definition: Element.hh:73
system_util.hh
sdf::v12::ElementPtr
std::shared_ptr< Element > ElementPtr
Definition: Element.hh:54
Element.hh