Gazebo Rendering

API Reference

9.0.0~pre2
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
33namespace Ogre
34{
35 class Light;
36}
37
38namespace gz
39{
40 namespace rendering
41 {
42 inline namespace GZ_RENDERING_VERSION_NAMESPACE {
43 //
44 // forward declaration
45 class Ogre2LightPrivate;
46
48 class GZ_RENDERING_OGRE2_VISIBLE Ogre2Light :
49 public BaseLight<Ogre2Node>
50 {
52 protected: Ogre2Light();
53
55 public: virtual ~Ogre2Light();
56
57 // Documentation Inherited
58 public: virtual void SetLocalPosition(const math::Vector3d &_position)
59 override;
60
61 // Documentation Inherited
62 public: virtual math::Color DiffuseColor() const override;
63
64 // Documentation Inherited
65 public: virtual void SetDiffuseColor(const math::Color &_color) override;
66
67 // Documentation Inherited
68 public: virtual math::Color SpecularColor() const override;
69
70 // Documentation Inherited
71 public: virtual void SetSpecularColor(const math::Color &_color) override;
72
73 // Documentation Inherited
74 public: virtual double AttenuationConstant() const override;
75
76 // Documentation Inherited
77 public: virtual void SetAttenuationConstant(double _value) override;
78
79 // Documentation Inherited
80 public: virtual double AttenuationLinear() const override;
81
82 // Documentation Inherited
83 public: virtual void SetAttenuationLinear(double _value) override;
84
85 // Documentation Inherited
86 public: virtual double AttenuationQuadratic() const override;
87
88 // Documentation Inherited
89 public: virtual void SetAttenuationQuadratic(double _value) override;
90
91 // Documentation Inherited
92 public: virtual double AttenuationRange() const override;
93
94 // Documentation Inherited
95 public: virtual void SetAttenuationRange(double _range) override;
96
97 // Documentation Inherited
98 public: virtual bool CastShadows() const override;
99
100 // Documentation Inherited
101 public: virtual void SetCastShadows(bool _castShadows) override;
102
103 // Documentation Inherited
104 public: virtual double Intensity() const override;
105
106 // Documentation Inherited
107 public: virtual void SetIntensity(double _intensity) override;
108
110 public: virtual Ogre::Light *Light() const;
111
113 public: virtual void Destroy() override;
114
116 protected: virtual void Init() override;
117
119 private: void CreateLight();
120
122 private: void UpdateAttenuation();
123
125 protected: double attenConstant = 1.0;
126
128 protected: double attenLinear = 0.0;
129
131 protected: double attenQuadratic = 0.0;
132
134 protected: double attenRange = 100.0;
135
137 protected: Ogre::Light *ogreLight = nullptr;
138
140 protected: Ogre::Light::LightTypes ogreLightType;
141
143 private: std::unique_ptr<Ogre2LightPrivate> dataPtr;
144 };
145
147 class GZ_RENDERING_OGRE2_VISIBLE Ogre2DirectionalLight :
148 public BaseDirectionalLight<Ogre2Light>
149 {
152
154 public: virtual ~Ogre2DirectionalLight();
155
156 // Documentation Inherited
157 public: virtual math::Vector3d Direction() const override;
158
159 // Documentation Inherited
160 public: virtual void SetDirection(const math::Vector3d &_dir) override;
161
163 private: friend class Ogre2Scene;
164 };
165
167 class GZ_RENDERING_OGRE2_VISIBLE Ogre2PointLight :
168 public BasePointLight<Ogre2Light>
169 {
171 protected: Ogre2PointLight();
172
174 public: virtual ~Ogre2PointLight();
175
177 private: friend class Ogre2Scene;
178 };
179
181 class GZ_RENDERING_OGRE2_VISIBLE Ogre2SpotLight :
182 public BaseSpotLight<Ogre2Light>
183 {
185 protected: Ogre2SpotLight();
186
188 public: virtual ~Ogre2SpotLight();
189
190 // Documentation inherited.
191 public: virtual math::Vector3d Direction() const override;
192
193 // Documentation Inherited
194 public: virtual void SetDirection(const math::Vector3d &_dir) override;
195
196 // Documentation Inherited
197 public: virtual math::Angle InnerAngle() const override;
198
199 // Documentation Inherited
200 public: virtual void SetInnerAngle(const math::Angle &_angle) override;
201
202 // Documentation Inherited
203 public: virtual math::Angle OuterAngle() const override;
204
205 // Documentation Inherited
206 public: virtual void SetOuterAngle(const math::Angle &_angle) override;
207
208 // Documentation Inherited
209 public: virtual double Falloff() const override;
210
211 // Documentation Inherited
212 public: virtual void SetFalloff(double _falloff) override;
213
215 private: friend class Ogre2Scene;
216 };
217 }
218 }
219}
220#endif