Ignition Rendering

API Reference

4.1.0
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 IGNITION_RENDERING_OGRE2_OGRE2LIGHT_HH_
18 #define IGNITION_RENDERING_OGRE2_OGRE2LIGHT_HH_
19 
20 #include <memory>
21 
25 
26 namespace Ogre
27 {
28  class Light;
29 }
30 
31 namespace ignition
32 {
33  namespace rendering
34  {
35  inline namespace IGNITION_RENDERING_VERSION_NAMESPACE {
36  //
37  // forward declaration
38  class Ogre2LightPrivate;
39 
41  class IGNITION_RENDERING_OGRE2_VISIBLE Ogre2Light :
42  public BaseLight<Ogre2Node>
43  {
45  protected: Ogre2Light();
46 
48  public: virtual ~Ogre2Light();
49 
50  // Documentation Inherited
51  public: virtual math::Color DiffuseColor() const override;
52 
53  // Documentation Inherited
54  public: virtual void SetDiffuseColor(const math::Color &_color) override;
55 
56  // Documentation Inherited
57  public: virtual math::Color SpecularColor() const override;
58 
59  // Documentation Inherited
60  public: virtual void SetSpecularColor(const math::Color &_color) override;
61 
62  // Documentation Inherited
63  public: virtual double AttenuationConstant() const override;
64 
65  // Documentation Inherited
66  public: virtual void SetAttenuationConstant(double _value) override;
67 
68  // Documentation Inherited
69  public: virtual double AttenuationLinear() const override;
70 
71  // Documentation Inherited
72  public: virtual void SetAttenuationLinear(double _value) override;
73 
74  // Documentation Inherited
75  public: virtual double AttenuationQuadratic() const override;
76 
77  // Documentation Inherited
78  public: virtual void SetAttenuationQuadratic(double _value) override;
79 
80  // Documentation Inherited
81  public: virtual double AttenuationRange() const override;
82 
83  // Documentation Inherited
84  public: virtual void SetAttenuationRange(double _range) override;
85 
86  // Documentation Inherited
87  public: virtual bool CastShadows() const override;
88 
89  // Documentation Inherited
90  public: virtual void SetCastShadows(bool _castShadows) override;
91 
93  public: virtual Ogre::Light *Light() const;
94 
96  public: virtual void Destroy() override;
97 
99  protected: virtual void Init() override;
100 
102  private: void CreateLight();
103 
105  private: void UpdateAttenuation();
106 
108  protected: double attenConstant = 1.0;
109 
111  protected: double attenLinear = 0.0;
112 
114  protected: double attenQuadratic = 0.0;
115 
117  protected: double attenRange = 100.0;
118 
120  protected: Ogre::Light *ogreLight = nullptr;
121 
123  protected: Ogre::Light::LightTypes ogreLightType;
124 
126  private: std::unique_ptr<Ogre2LightPrivate> dataPtr;
127  };
128 
130  class IGNITION_RENDERING_OGRE2_VISIBLE Ogre2DirectionalLight :
131  public BaseDirectionalLight<Ogre2Light>
132  {
134  protected: Ogre2DirectionalLight();
135 
137  public: virtual ~Ogre2DirectionalLight();
138 
139  // Documentation Inherited
140  public: virtual math::Vector3d Direction() const override;
141 
142  // Documentation Inherited
143  public: virtual void SetDirection(const math::Vector3d &_dir) override;
144 
146  private: friend class Ogre2Scene;
147  };
148 
150  class IGNITION_RENDERING_OGRE2_VISIBLE Ogre2PointLight :
151  public BasePointLight<Ogre2Light>
152  {
154  protected: Ogre2PointLight();
155 
157  public: virtual ~Ogre2PointLight();
158 
160  private: friend class Ogre2Scene;
161  };
162 
164  class IGNITION_RENDERING_OGRE2_VISIBLE Ogre2SpotLight :
165  public BaseSpotLight<Ogre2Light>
166  {
168  protected: Ogre2SpotLight();
169 
171  public: virtual ~Ogre2SpotLight();
172 
173  // Documentation inherited.
174  public: virtual math::Vector3d Direction() const override;
175 
176  // Documentation Inherited
177  public: virtual void SetDirection(const math::Vector3d &_dir) override;
178 
179  // Documentation Inherited
180  public: virtual math::Angle InnerAngle() const override;
181 
182  // Documentation Inherited
183  public: virtual void SetInnerAngle(const math::Angle &_angle) override;
184 
185  // Documentation Inherited
186  public: virtual math::Angle OuterAngle() const override;
187 
188  // Documentation Inherited
189  public: virtual void SetOuterAngle(const math::Angle &_angle) override;
190 
191  // Documentation Inherited
192  public: virtual double Falloff() const override;
193 
194  // Documentation Inherited
195  public: virtual void SetFalloff(double _falloff) override;
196 
198  private: friend class Ogre2Scene;
199  };
200  }
201  }
202 }
203 #endif
Definition: BaseLight.hh:29
Ogre 2.x implementation of the point light class.
Definition: Ogre2Light.hh:150
Definition: BaseLight.hh:77
Ogre2.x implementation of the scene class.
Definition: Ogre2Scene.hh:45
Ogre 2.x implementation of the spot light class.
Definition: Ogre2Light.hh:164
Definition: BaseLight.hh:87
Ogre 2.x implementation of the directional light class.
Definition: Ogre2Light.hh:130
Represents a light source in the scene graph.
Definition: Light.hh:32
Definition: OgreCamera.hh:27
Ogre 2.x implementation of the light class.
Definition: Ogre2Light.hh:41
Ogre::Light::LightTypes ogreLightType
Light type.
Definition: Ogre2Light.hh:123