NGL  6.5
The NCCA Graphics Library
SpotLight.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2009 Jon Macey
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 
19 #ifndef SPOTLIGHT_H__
20 #define SPOTLIGHT_H__
21 // must include types.h first for Real and GLEW if required
22 //----------------------------------------------------------------------------------------------------------------------
25 //----------------------------------------------------------------------------------------------------------------------
26 #include "Light.h"
27 
28 
29 namespace ngl
30 {
31 
32 //----------------------------------------------------------------------------------------------------------------------
55 //----------------------------------------------------------------------------------------------------------------------
56 
57 
59 {
60 public:
61 
62  //----------------------------------------------------------------------------------------------------------------------
64  //----------------------------------------------------------------------------------------------------------------------
65  SpotLight() noexcept{;}
66  //----------------------------------------------------------------------------------------------------------------------
71  //----------------------------------------------------------------------------------------------------------------------
72  SpotLight( const Vec3 &_pos,const Vec3 &_dir,const Colour& _col ) noexcept;
73  //----------------------------------------------------------------------------------------------------------------------
75  //----------------------------------------------------------------------------------------------------------------------
76  SpotLight(const SpotLight &_l) noexcept;
77  //----------------------------------------------------------------------------------------------------------------------
82  //----------------------------------------------------------------------------------------------------------------------
83  void set( const Vec3& _pos, const Vec3& _dir, const Colour& _col ) noexcept;
84  //----------------------------------------------------------------------------------------------------------------------
86  //----------------------------------------------------------------------------------------------------------------------
87  void enable() noexcept;
88  //----------------------------------------------------------------------------------------------------------------------
95  //----------------------------------------------------------------------------------------------------------------------
96  void setParams(const Real _cutoff, const Real _exponent, const Real _constant, const Real _linear, const Real _quadratic ) noexcept;
97  //----------------------------------------------------------------------------------------------------------------------
100  //----------------------------------------------------------------------------------------------------------------------
101  void setCutoff( const Real &_cutoff ) noexcept;
102  //----------------------------------------------------------------------------------------------------------------------
105  //----------------------------------------------------------------------------------------------------------------------
106  void setInnerCutoff( const Real &_cutoff ) noexcept;
107  //----------------------------------------------------------------------------------------------------------------------
110  //----------------------------------------------------------------------------------------------------------------------
111  void setExponent(const Real &_exp ) noexcept{ m_spotExponent=_exp;}
112  //----------------------------------------------------------------------------------------------------------------------
115  //----------------------------------------------------------------------------------------------------------------------
116  void aim( const Vec4& _pos ) noexcept;
117  //----------------------------------------------------------------------------------------------------------------------
130  //----------------------------------------------------------------------------------------------------------------------
131 
132  void loadToShader(std::string _uniformName )const noexcept;
133  //----------------------------------------------------------------------------------------------------------------------
137  //----------------------------------------------------------------------------------------------------------------------
138  void setTransform(Mat4 &_t) noexcept;
139 
140 
141 protected :
142  //----------------------------------------------------------------------------------------------------------------------
144  //----------------------------------------------------------------------------------------------------------------------
146  //----------------------------------------------------------------------------------------------------------------------
148  //----------------------------------------------------------------------------------------------------------------------
150  //----------------------------------------------------------------------------------------------------------------------
152  //----------------------------------------------------------------------------------------------------------------------
154  //----------------------------------------------------------------------------------------------------------------------
156  //----------------------------------------------------------------------------------------------------------------------
158 
159  }; // end of class SpotLight
160 }// end of namespace
161 #endif
162 
163 //----------------------------------------------------------------------------------------------------------------------
164 
GLboolean enable
Definition: glew.h:2748
Real m_spotExponent
the SpotExponent value
Definition: SpotLight.h:149
simple class to hold colour information and set the basic opengl colour state. also has overloaded me...
Definition: Colour.h:40
simple Vector class for OpenGL graphics, contains overloaded operators for most math functions...
Definition: Vec4.h:57
#define NGL_DLLEXPORT
Definition: Types.h:65
Simple class to encapsulate OpenGL Light functions this will fill in the following structure...
Definition: Light.h:68
void setExponent(const Real &_exp) noexcept
sets the exponent
Definition: SpotLight.h:111
simple Vec3 encapsulates a 3 float object like glsl vec3 but not maths use the Vec3 class for maths a...
Definition: Vec3.h:51
implementation files for RibExport class
Definition: AABB.cpp:22
Encapsulation of OpenGL spotlight inherits from the Light class.
Definition: SpotLight.h:58
PRECISION Real
create a variable called Real which is the main data type we use (GLfloat for most cases) ...
Definition: Types.h:127
an encapsulation of an OpenGL Light
Vec4 m_dir
the spot light direction vector
Definition: SpotLight.h:157
SpotLight() noexcept
default ctor
Definition: SpotLight.h:65
Real m_innerCutoffAngle
the spot inner cutoff angle
Definition: SpotLight.h:145
Matrix Class to do simple matrix operations included operator overloaded functions for maths and matr...
Definition: Mat4.h:58
Vec4 m_aim
where the spot is to be aimed
Definition: SpotLight.h:153
GLsizei const GLchar *const * string
Definition: glew.h:1847