]> git.tdb.fi Git - libs/gl.git/blob - source/light.h
Drop Id tags and copyright notices from files
[libs/gl.git] / source / light.h
1 #ifndef MSP_GL_LIGHT_H_
2 #define MSP_GL_LIGHT_H_
3
4 #include <vector>
5 #include "color.h"
6 #include "vector.h"
7
8 namespace Msp {
9 namespace GL {
10
11 class Light
12 {
13 private:
14         Color ambient;
15         Color diffuse;
16         Color specular;
17         Vector4 position;
18         Vector3 spot_dir;
19         float spot_exp;
20         float spot_cutoff;
21         float attenuation[3];
22
23         static unsigned current_unit;
24         static std::vector<const Light *> current_lights;
25
26 public:
27         Light();
28
29         void set_ambient(const Color &c);
30         void set_diffuse(const Color &c);
31         void set_specular(const Color &c);
32         const Color &get_ambient() const { return ambient; }
33         const Color &get_diffuse() const { return diffuse; }
34         const Color &get_specular() const { return specular; }
35
36         void set_position(const Vector4 &);
37         const Vector4 &get_position() const { return position; }
38         void set_spot_direction(const Vector3 &);
39         void set_spot_exponent(float);
40         void set_spot_cutoff(float);
41         const Vector3 &get_spot_direction() const { return spot_dir; }
42         float get_spot_exponent() const { return spot_exp; }
43         float get_spot_cutoff() const { return spot_cutoff; }
44         void set_attenuation(float, float, float);
45         const float *get_attenuation() const { return attenuation; }
46
47         void bind() const;
48         void bind_to(unsigned) const;
49
50         // Deprecated
51         void set_position(float x, float y, float z, float w) { set_position(Vector4(x, y, z, w)); }
52
53         static void activate(unsigned);
54         static void unbind();
55         static void unbind_from(unsigned);
56 };
57
58 } // namespace GL
59 } // namespace Msp
60
61 #endif