zenilib  0.5.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Light.h
Go to the documentation of this file.
1 /* This file is part of the Zenipex Library (zenilib).
2  * Copyright (C) 2011 Mitchell Keith Bloch (bazald).
3  *
4  * zenilib is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser 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  * zenilib 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 Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with zenilib. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
34 #ifndef ZENI_LIGHT_H
35 #define ZENI_LIGHT_H
36 
37 #include <Zeni/Color.h>
38 #include <Zeni/Coordinate.h>
39 #include <Zeni/Vector3f.h>
40 
41 #ifndef DISABLE_GL
42 #if defined(REQUIRE_GL_ES)
43 #include <GLES/gl.h>
44 #else
45 #include <GL/glew.h>
46 #endif
47 #endif
48 
49 namespace Zeni {
50 
51  class Video_GL_Fixed;
52  class Video_GL_Shader;
53  class Video_DX9;
54 
56 
57  struct ZENI_GRAPHICS_DLL Light {
59  Light(const Color &ambient = Color(1.0f, 0.0f, 0.0f, 0.0f),
60  const Color &diffuse = Color(1.0f, 1.0f, 1.0f, 1.0f),
61  const Color &specular = Color(1.0f, 1.0f, 1.0f, 1.0f),
62  const Point3f &position = Point3f(0.0f, 0.0f, 0.0f),
63  const Vector3f &spot_direction = Vector3f(0.0f, 0.0f, -1.0f));
64 
65  // Helpers
66  inline void set_light_type(const LIGHT_TYPE &light_type);
67  inline void set_spot_theta(const float &spot_theta);
68  inline void set_spot_phi(const float &spot_phi);
69 
70 #ifndef DISABLE_GL_FIXED
71  void set(const GLenum &number, Video_GL_Fixed &screen) const;
72 #endif
73 
74 #ifndef DISABLE_GL_SHADER
75  void set(const GLenum &number, Video_GL_Shader &screen) const;
76 #endif
77 
78 #ifndef DISABLE_DX9
79  void set(const DWORD &number, Video_DX9 &screen) const;
80 #endif
81 
88  float range;
89  float spot_exponent;
93  float spot_theta;
94  float spot_phi;
95  };
96 
97 }
98 
99 #endif
Point3f position
The position of the Light (irrelevant for directional lights or purely ambient lights) ...
Definition: Light.h:86
An Abstraction of a Light.
Definition: Light.h:57
Color diffuse
The diffuse Color.
Definition: Light.h:83
LIGHT_TYPE
Definition: Light.h:55
The Direct3D9 Rendering System.
Definition: Video_DX9.h:62
float spot_theta
The angle, in radians, describing the size of the inner cone (automatically increases phi if necessar...
Definition: Light.h:93
unsigned int GLenum
Definition: gl2.h:23
GLclampf f
Definition: glew.h:3390
LIGHT_TYPE light_type
The type of the Light.
Definition: Light.h:82
Color specular
The specular Color.
Definition: Light.h:84
float range
The max distance reached by the light; NOT SUPPORTED BY OPENGL.
Definition: Light.h:88
float spot_exponent
Similar to Falloff in OpenGL, describes the intensity of the Light from the inner cone to the outer c...
Definition: Light.h:89
A 3D Point represented with floats.
Definition: Coordinate.h:133
float constant_attenuation
Part of the equation describing the weakening of Light over distance. Read online for more informatio...
Definition: Light.h:90
A Featureful 3-Space Vector Class.
Definition: Vector3f.h:58
The OpenGL Rendering System.
The OpenGL Rendering System.
typedef DWORD(WINAPI *XInputGetState_t)(DWORD dwUserIndex
float linear_attenuation
Part of the equation describing the weakening of Light over distance. Read online for more informatio...
Definition: Light.h:91
float spot_phi
The angle, in radians, describing the size of the outer cone (automatically decreases theta if necess...
Definition: Light.h:94
float quadratic_attenuation
Part of the equation describing the weakening of Light over distance. Read online for more informatio...
Definition: Light.h:92
Point3f spot_direction
The direction of the Light (relevent only to spotlights)
Definition: Light.h:87
Color ambient
The ambient Color.
Definition: Light.h:85
Color.
Definition: Color.h:41