]> git.tdb.fi Git - libs/gl.git/blob - source/light.h
Convert Light to object model
[libs/gl.git] / source / light.h
1 /* $Id$
2
3 This file is part of libmspgl
4 Copyright © 2007  Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
6 */
7
8 #ifndef MSP_GL_LIGHT_H_
9 #define MSP_GL_LIGHT_H_
10
11 #include <vector>
12 #include "color.h"
13
14 namespace Msp {
15 namespace GL {
16
17 class Light
18 {
19 private:
20         Color ambient;
21         Color diffuse;
22         Color specular;
23         float x, y, z, w;
24         float sdx, sdy, sdz;
25         float spot_exp;
26         float spot_cutoff;
27         float attenuation[3];
28
29         static unsigned current_unit;
30         static std::vector<const Light *> current_lights;
31
32 public:
33         Light();
34         void set_ambient(const Color &c);
35         void set_diffuse(const Color &c);
36         void set_specular(const Color &c);
37         void set_position(float, float, float, float);
38         void bind() const;
39         void bind_to(unsigned) const;
40
41         static void activate(unsigned);
42         static void unbind();
43 };
44
45 } // namespace GL
46 } // namespace Msp
47
48 #endif