]> git.tdb.fi Git - libs/gl.git/blob - source/light.h
Remove ambient color from Light
[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 diffuse;
15         Color specular;
16         Vector4 position;
17         Vector3 spot_dir;
18         float spot_exp;
19         float spot_cutoff;
20         float attenuation[3];
21
22         static unsigned current_unit;
23         static std::vector<const Light *> current_lights;
24
25 public:
26         Light();
27
28         void set_diffuse(const Color &c);
29         void set_specular(const Color &c);
30         const Color &get_diffuse() const { return diffuse; }
31         const Color &get_specular() const { return specular; }
32
33         void set_position(const Vector4 &);
34         const Vector4 &get_position() const { return position; }
35         void set_spot_direction(const Vector3 &);
36         void set_spot_exponent(float);
37         void set_spot_cutoff(float);
38         const Vector3 &get_spot_direction() const { return spot_dir; }
39         float get_spot_exponent() const { return spot_exp; }
40         float get_spot_cutoff() const { return spot_cutoff; }
41         void set_attenuation(float, float, float);
42         const float *get_attenuation() const { return attenuation; }
43
44         void bind() const;
45         void bind_to(unsigned) const;
46
47         static void activate(unsigned);
48         static void unbind();
49         static void unbind_from(unsigned);
50 };
51
52 } // namespace GL
53 } // namespace Msp
54
55 #endif