]> git.tdb.fi Git - libs/gl.git/blob - source/lighting.h
Create ProgramData for materials and lights
[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         ProgramData shdata;
24
25 public:
26         Lighting();
27
28         void set_ambient(const Color &);
29         const Color &get_ambient() const { return ambient; }
30
31         void attach(unsigned, const Light &);
32         void detach(unsigned);
33
34         void update_shader_data(const Matrix &);
35         const ProgramData &get_shader_data() const { return shdata; }
36         void bind() const;
37
38         static void unbind();
39 };
40
41 } // namespace GL
42 } // namespace Msp
43
44 #endif