OpenPolygon  1.0.0
OpenPolygon is a Rendering Engine
light.h
1 /*
2  Copyright (C) 2014 - 2016 Mutzii
3 
4  This program is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program. If not, see <http://www.gnu.org/licenses/>.
16 
17 */
18 #ifndef LIGHT_H
19 #define LIGHT_H
20 
21 #include "index.h"
22 #include "Interface/IShader.h"
23 #include "camera.h"
24 
25 namespace Engine
26 {
31  class Light : public Camera
32  {
33  public:
34 
39  explicit Light(void);
40 
46  explicit Light( const std::string & light_name );
47  ~Light() = default;
48 
54  void setAmbient ( const Vector3f & ambient );
55 
61  void setDiffuse ( const Vector3f & diffuse );
62 
68  void setSpecular( const Vector3f & specular );
69 
75  void setPrefix( const std::string & prefix );
76 
82  const Vector3f & getAmbient(void);
83 
89  const Vector3f & getDiffuse(void);
90 
96  const Vector3f & getSpecular(void);
97 
103  virtual void ShaderUpdate(int number , IShader *shader );
104 
105 
106  protected:
107 
108  std::string mPrefix;
109 
110  private:
111 
112  Vector3f mAmbient;
113  Vector3f mDiffuse;
114  Vector3f mSpecular;
115  };
116 
120  class SpotLight : public Light
121  {
122  public:
127  explicit SpotLight();
128 
134  explicit SpotLight( const std::string & light_name );
135  ~SpotLight(){}
136 
142  void setSpotDirection( const Vector3f & spotdirection );
143 
149  void setSpotCosCutoff( float angle );
150 
151 
156  const Vector3f & getSpotDirection(void) const;
157 
162  float getSpotCosCutoff(void) const ;
163 
169  void ShaderUpdate(int number, IShader * shader) override;
170 
171  private:
172 
173  Vector3f mSpotDirection;
174 
175  float mSpotCosCutoff;
176 
177  };
178 }
179 
180 #endif // LIGHT_H
void setSpotCosCutoff(float angle)
setSpotCosCutoff
Definition: Light.cpp:110
const Vector3f & getAmbient(void)
getAmbient
Definition: Light.cpp:56
Definition: element.h:23
The IShader - abstract / interface class.
Definition: IShader.h:30
void setSpotDirection(const Vector3f &spotdirection)
setSpotDirection
Definition: Light.cpp:105
void setDiffuse(const Vector3f &diffuse)
setDiffuse
Definition: Light.cpp:41
const Vector3f & getDiffuse(void)
getDiffuse
Definition: Light.cpp:61
void setSpecular(const Vector3f &specular)
setSpecular
Definition: Light.cpp:46
The Camera class.
Definition: camera.h:31
void ShaderUpdate(int number, IShader *shader) override
ShaderUpdate.
Definition: Light.cpp:125
The SpotLight class.
Definition: light.h:120
const Vector3f & getSpecular(void)
getSpecular
Definition: Light.cpp:66
The Light class.
Definition: light.h:31
virtual void ShaderUpdate(int number, IShader *shader)
ShaderUpdate.
Definition: Light.cpp:71
float getSpotCosCutoff(void) const
getSpotCosCutoff
Definition: Light.cpp:120
void setAmbient(const Vector3f &ambient)
setAmbient
Definition: Light.cpp:36
void setPrefix(const std::string &prefix)
setPrefix
Definition: Light.cpp:51
SpotLight()
Light.
Definition: Light.cpp:92
const Vector3f & getSpotDirection(void) const
getSpotDirection
Definition: Light.cpp:115
Light(void)
Light.
Definition: Light.cpp:22