Gazebo Rendering

API Reference

6.6.3
gz/rendering/ogre2/Ogre2Light.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 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 GZ_RENDERING_OGRE2_OGRE2LIGHT_HH_
18 #define GZ_RENDERING_OGRE2_OGRE2LIGHT_HH_
19 
20 #include <memory>
21 
24 
25 #ifdef _MSC_VER
26  #pragma warning(push, 0)
27 #endif
28 #include <OgreLight.h>
29 #ifdef _MSC_VER
30  #pragma warning(pop)
31 #endif
32 
33 namespace Ogre
34 {
35  class Light;
36 }
37 
38 namespace ignition
39 {
40  namespace rendering
41  {
42  inline namespace IGNITION_RENDERING_VERSION_NAMESPACE {
43  //
44  // forward declaration
45  class Ogre2LightPrivate;
46 
48  class IGNITION_RENDERING_OGRE2_VISIBLE Ogre2Light :
49  public BaseLight<Ogre2Node>
50  {
52  protected: Ogre2Light();
53 
55  public: virtual ~Ogre2Light();
56 
57  // Documentation Inherited
58  public: virtual math::Color DiffuseColor() const override;
59 
60  // Documentation Inherited
61  public: virtual void SetDiffuseColor(const math::Color &_color) override;
62 
63  // Documentation Inherited
64  public: virtual math::Color SpecularColor() const override;
65 
66  // Documentation Inherited
67  public: virtual void SetSpecularColor(const math::Color &_color) override;
68 
69  // Documentation Inherited
70  public: virtual double AttenuationConstant() const override;
71 
72  // Documentation Inherited
73  public: virtual void SetAttenuationConstant(double _value) override;
74 
75  // Documentation Inherited
76  public: virtual double AttenuationLinear() const override;
77 
78  // Documentation Inherited
79  public: virtual void SetAttenuationLinear(double _value) override;
80 
81  // Documentation Inherited
82  public: virtual double AttenuationQuadratic() const override;
83 
84  // Documentation Inherited
85  public: virtual void SetAttenuationQuadratic(double _value) override;
86 
87  // Documentation Inherited
88  public: virtual double AttenuationRange() const override;
89 
90  // Documentation Inherited
91  public: virtual void SetAttenuationRange(double _range) override;
92 
93  // Documentation Inherited
94  public: virtual bool CastShadows() const override;
95 
96  // Documentation Inherited
97  public: virtual void SetCastShadows(bool _castShadows) override;
98 
99  // Documentation Inherited
100  public: virtual double Intensity() const override;
101 
102  // Documentation Inherited
103  public: virtual void SetIntensity(double _intensity) override;
104 
106  public: virtual Ogre::Light *Light() const;
107 
109  public: virtual void Destroy() override;
110 
112  protected: virtual void Init() override;
113 
115  private: void CreateLight();
116 
118  private: void UpdateAttenuation();
119 
121  protected: double attenConstant = 1.0;
122 
124  protected: double attenLinear = 0.0;
125 
127  protected: double attenQuadratic = 0.0;
128 
130  protected: double attenRange = 100.0;
131 
133  protected: Ogre::Light *ogreLight = nullptr;
134 
136  protected: Ogre::Light::LightTypes ogreLightType;
137 
139  private: std::unique_ptr<Ogre2LightPrivate> dataPtr;
140  };
141 
143  class IGNITION_RENDERING_OGRE2_VISIBLE Ogre2DirectionalLight :
144  public BaseDirectionalLight<Ogre2Light>
145  {
147  protected: Ogre2DirectionalLight();
148 
150  public: virtual ~Ogre2DirectionalLight();
151 
152  // Documentation Inherited
153  public: virtual math::Vector3d Direction() const override;
154 
155  // Documentation Inherited
156  public: virtual void SetDirection(const math::Vector3d &_dir) override;
157 
159  private: friend class Ogre2Scene;
160  };
161 
163  class IGNITION_RENDERING_OGRE2_VISIBLE Ogre2PointLight :
164  public BasePointLight<Ogre2Light>
165  {
167  protected: Ogre2PointLight();
168 
170  public: virtual ~Ogre2PointLight();
171 
173  private: friend class Ogre2Scene;
174  };
175 
177  class IGNITION_RENDERING_OGRE2_VISIBLE Ogre2SpotLight :
178  public BaseSpotLight<Ogre2Light>
179  {
181  protected: Ogre2SpotLight();
182 
184  public: virtual ~Ogre2SpotLight();
185 
186  // Documentation inherited.
187  public: virtual math::Vector3d Direction() const override;
188 
189  // Documentation Inherited
190  public: virtual void SetDirection(const math::Vector3d &_dir) override;
191 
192  // Documentation Inherited
193  public: virtual math::Angle InnerAngle() const override;
194 
195  // Documentation Inherited
196  public: virtual void SetInnerAngle(const math::Angle &_angle) override;
197 
198  // Documentation Inherited
199  public: virtual math::Angle OuterAngle() const override;
200 
201  // Documentation Inherited
202  public: virtual void SetOuterAngle(const math::Angle &_angle) override;
203 
204  // Documentation Inherited
205  public: virtual double Falloff() const override;
206 
207  // Documentation Inherited
208  public: virtual void SetFalloff(double _falloff) override;
209 
211  private: friend class Ogre2Scene;
212  };
213  }
214  }
215 }
216 #endif
Ogre 2.x implementation of the light class.
Definition: gz/rendering/ogre2/Ogre2Light.hh:48
Definition: gz/rendering/base/BaseLight.hh:97
Definition: gz/rendering/ogre/OgreCamera.hh:27
Definition: gz/rendering/base/BaseLight.hh:71
Definition: gz/rendering/base/BaseLight.hh:87
Ogre 2.x implementation of the spot light class.
Definition: gz/rendering/ogre2/Ogre2Light.hh:177
Ogre 2.x implementation of the point light class.
Definition: gz/rendering/ogre2/Ogre2Light.hh:163
Definition: gz/rendering/base/BaseLight.hh:29
Ogre2.x implementation of the scene class.
Definition: gz/rendering/ogre2/Ogre2Scene.hh:57
Ogre 2.x implementation of the directional light class.
Definition: gz/rendering/ogre2/Ogre2Light.hh:143
Represents a light source in the scene graph.
Definition: gz/rendering/Light.hh:32
Ogre::Light::LightTypes ogreLightType
Light type.
Definition: gz/rendering/ogre2/Ogre2Light.hh:136