]> git.tdb.fi Git - libs/gl.git/blob - source/lighting.h
Don't store ProgramData in Lighting
[libs/gl.git] / source / lighting.h
1 #ifndef MSP_GL_LIGHTING_H_
2 #define MSP_GL_LIGHTING_H_
3
4 #include <vector>
5 #include "bindable.h"
6 #include "color.h"
7 #include "gl.h"
8 #include "programdata.h"
9
10 namespace Msp {
11 namespace GL {
12
13 class Light;
14
15 /**
16 Encapsulates global lighting parameters and a number of individual lights.
17 */
18 class Lighting: public Bindable<Lighting>
19 {
20 private:
21         Color ambient;
22         std::vector<const Light *> lights;
23
24 public:
25         Lighting();
26
27         void set_ambient(const Color &);
28         const Color &get_ambient() const { return ambient; }
29
30         void attach(unsigned, const Light &);
31         void detach(unsigned);
32
33         void update_shader_data(ProgramData &, const Matrix &) const;
34         void bind() const;
35
36         static void unbind();
37 };
38
39 } // namespace GL
40 } // namespace Msp
41
42 #endif