rendering/Light.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2016 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 _GAZEBO_RENDERING_LIGHT_HH_
18 #define _GAZEBO_RENDERING_LIGHT_HH_
19 
20 #include <string>
21 #include <iostream>
22 #include <sdf/sdf.hh>
23 
24 #include "gazebo/msgs/msgs.hh"
26 #include "gazebo/common/Color.hh"
27 #include "gazebo/util/system.hh"
28 
29 namespace Ogre
30 {
31  class Light;
32 }
33 
34 namespace gazebo
35 {
36  namespace rendering
37  {
38  // Forward declare private data.
39  class LightPrivate;
40 
43 
51  class GZ_RENDERING_VISIBLE Light :
52  public boost::enable_shared_from_this<Light>
53  {
56  public: Light(ScenePtr _scene);
57 
59  public: virtual ~Light();
60 
64  public: void Load(sdf::ElementPtr _sdf);
65 
67  public: void Load();
68 
71  public: void LoadFromMsg(ConstLightPtr &_msg);
72 
75  public: void LoadFromMsg(const msgs::Light &_msg);
76 
79  public: void SetName(const std::string &_name);
80 
84  public: std::string GetName() const GAZEBO_DEPRECATED(7.0);
85 
88  public: std::string Name() const;
89 
93  public: std::string GetType() const GAZEBO_DEPRECATED(7.0);
94 
97  public: std::string Type() const;
98 
103  public: void SetPosition(const math::Vector3 &_p) GAZEBO_DEPRECATED(7.0);
104 
107  public: void SetPosition(const ignition::math::Vector3d &_p);
108 
112  public: math::Vector3 GetPosition() const GAZEBO_DEPRECATED(7.0);
113 
116  public: ignition::math::Vector3d Position() const;
117 
122  public: void SetRotation(const math::Quaternion &_q)
123  GAZEBO_DEPRECATED(7.0);
124 
127  public: void SetRotation(const ignition::math::Quaterniond &_q);
128 
132  public: math::Quaternion GetRotation() const GAZEBO_DEPRECATED(7.0);
133 
136  public: ignition::math::Quaterniond Rotation() const;
137 
141  public: virtual bool SetSelected(const bool _s);
142 
143  // \brief Toggle light visual visibility
144  public: void ToggleShowVisual();
145 
148  public: void ShowVisual(const bool _s);
149 
153  public: bool GetVisible() const GAZEBO_DEPRECATED(7.0);
154 
157  public: bool Visible() const;
158 
161  public: void SetLightType(const std::string &_type);
162 
165  public: void SetDiffuseColor(const common::Color &_color);
166 
170  public: common::Color GetDiffuseColor() const GAZEBO_DEPRECATED(7.0);
171 
174  public: common::Color DiffuseColor() const;
175 
178  public: void SetSpecularColor(const common::Color &_color);
179 
183  public: common::Color GetSpecularColor() const GAZEBO_DEPRECATED(7.0);
184 
187  public: common::Color SpecularColor() const;
188 
194  public: void SetDirection(const math::Vector3 &_dir)
195  GAZEBO_DEPRECATED(7.0);
196 
200  public: void SetDirection(const ignition::math::Vector3d &_dir);
201 
205  public: math::Vector3 GetDirection() const GAZEBO_DEPRECATED(7.0);
206 
209  public: ignition::math::Vector3d Direction() const;
210 
215  public: void SetAttenuation(double _constant, double _linear,
216  double _quadratic);
217 
220  public: void SetSpotInnerAngle(const double _angle);
221 
224  public: void SetSpotOuterAngle(const double _angle);
225 
228  public: void SetSpotFalloff(const double _value);
229 
232  public: void SetRange(const double _range);
233 
236  public: void SetCastShadows(const bool _cast);
237 
240  public: void FillMsg(msgs::Light &_msg) const;
241 
244  public: void UpdateFromMsg(ConstLightPtr &_msg);
245 
250  public: LightPtr Clone(const std::string &_name, ScenePtr _scene);
251 
253  protected: virtual void OnPoseChange() {}
254 
256  private: void CreateVisual();
257 
259  private: void Update();
260 
263  private: void UpdateSDFFromMsg(const msgs::Light &_msg);
264 
267  private: std::unique_ptr<LightPrivate> dataPtr;
268  };
270  }
271 }
272 #endif
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:39
virtual void OnPoseChange()
On pose change callback.
Definition: rendering/Light.hh:253
#define GAZEBO_DEPRECATED(version)
Definition: CommonTypes.hh:48
boost::shared_ptr< Scene > ScenePtr
Definition: RenderTypes.hh:80
A quaternion class.
Definition: Quaternion.hh:42
Defines a color.
Definition: Color.hh:36
A light source.
Definition: rendering/Light.hh:51
boost::shared_ptr< Light > LightPtr
Definition: RenderTypes.hh:84