zenilib: zenilib/jni/external/zenilib/zeni_graphics/Zeni/Light.h Source File

zenilib 0.5.3.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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
55 enum LIGHT_TYPE {LIGHT_POINT = 1, LIGHT_SPOT = 2, LIGHT_DIRECTIONAL = 3};
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
82 LIGHT_TYPE light_type;
83 Color diffuse;
84 Color specular;
85 Color ambient;
86 Point3f position;
87 Point3f spot_direction;
88 float range;
89 float spot_exponent;
90 float constant_attenuation;
91 float linear_attenuation;
92 float quadratic_attenuation;
93 float spot_theta;
94 float spot_phi;
95 };
96
97 }
98
99 #endif
Zeni::Light::position
Point3f position
The position of the Light (irrelevant for directional lights or purely ambient lights) ...
Definition: Light.h:86
Zeni::Light
An Abstraction of a Light.
Definition: Light.h:57
Zeni::Light::diffuse
Color diffuse
The diffuse Color.
Definition: Light.h:83
Zeni::LIGHT_TYPE
LIGHT_TYPE
Definition: Light.h:55
Zeni::Video_DX9
The Direct3D9 Rendering System.
Definition: Video_DX9.h:62
Zeni::Light::spot_theta
float spot_theta
The angle, in radians, describing the size of the inner cone (automatically increases phi if necessar...
Definition: Light.h:93
GLenum
unsigned int GLenum
Definition: gl2.h:23
f
GLclampf f
Definition: glew.h:3390
Zeni::Light::light_type
LIGHT_TYPE light_type
The type of the Light.
Definition: Light.h:82
Zeni::LIGHT_SPOT
Definition: Light.h:55
Zeni::Light::specular
Color specular
The specular Color.
Definition: Light.h:84
Zeni::Light::range
float range
The max distance reached by the light; NOT SUPPORTED BY OPENGL.
Definition: Light.h:88
Zeni::Light::spot_exponent
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
Zeni::Point3f
A 3D Point represented with floats.
Definition: Coordinate.h:133
Zeni::Light::constant_attenuation
float constant_attenuation
Part of the equation describing the weakening of Light over distance. Read online for more informatio...
Definition: Light.h:90
Coordinate.h
Vector3f.h
Zeni::Vector3f
A Featureful 3-Space Vector Class.
Definition: Vector3f.h:58
Zeni::LIGHT_DIRECTIONAL
Definition: Light.h:55
Zeni::Video_GL_Fixed
The OpenGL Rendering System.
Definition: Video_GL_Fixed.h:70
Zeni::LIGHT_POINT
Definition: Light.h:55
Zeni::Video_GL_Shader
The OpenGL Rendering System.
Definition: Video_GL_Shader.h:70
DWORD
typedef DWORD(WINAPI *XInputGetState_t)(DWORD dwUserIndex
Zeni::Light::linear_attenuation
float linear_attenuation
Part of the equation describing the weakening of Light over distance. Read online for more informatio...
Definition: Light.h:91
Color.h
Zeni::Light::spot_phi
float spot_phi
The angle, in radians, describing the size of the outer cone (automatically decreases theta if necess...
Definition: Light.h:94
Zeni::Light::quadratic_attenuation
float quadratic_attenuation
Part of the equation describing the weakening of Light over distance. Read online for more informatio...
Definition: Light.h:92
Zeni::Light::spot_direction
Point3f spot_direction
The direction of the Light (relevent only to spotlights)
Definition: Light.h:87
Zeni::Light::ambient
Color ambient
The ambient Color.
Definition: Light.h:85
Zeni::Color
Color.
Definition: Color.h:41