]> git.tdb.fi Git - libs/gl.git/blob - source/lighting.h
Rework Bind and enable it to restore the old binding
[libs/gl.git] / source / lighting.h
1 /* $Id$
2
3 This file is part of libmspgl
4 Copyright © 2008  Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
6 */
7
8 #ifndef MSP_GL_LIGHTING_H_
9 #define MSP_GL_LIGHTING_H_
10
11 #include <vector>
12 #include "bindable.h"
13 #include "color.h"
14 #include "gl.h"
15
16 namespace Msp {
17 namespace GL {
18
19 class Light;
20
21 enum
22 {
23         LIGHTING = GL_LIGHTING
24 };
25
26 /**
27 Encapsulates global lighting parameters and a number of individual lights.
28 */
29 class Lighting: public Bindable<Lighting>
30 {
31 private:
32         Color ambient;
33         std::vector<const Light *> lights;
34
35 public:
36         Lighting();
37
38         void set_ambient(const Color &);
39         const Color &get_ambient() const { return ambient; }
40
41         void attach(unsigned, const Light &);
42         void detach(unsigned);
43         void bind() const;
44
45         static void unbind();
46 };
47
48 } // namespace GL
49 } // namespace Msp
50
51 #endif