]> git.tdb.fi Git - libs/gl.git/blob - source/lighting.h
Convert Light to object model
[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 "color.h"
13 #include "gl.h"
14
15 namespace Msp {
16 namespace GL {
17
18 class Light;
19
20 enum
21 {
22         LIGHTING = GL_LIGHTING
23 };
24
25 /**
26 Encapsulates global lighting parameters and a number of individual lights.
27 */
28 class Lighting
29 {
30 private:
31         Color ambient;
32         std::vector<const Light *> lights;
33
34         static const Lighting *current;
35
36 public:
37         Lighting();
38
39         void set_ambient(const Color &);
40         const Color &get_ambient() const { return ambient; }
41
42         void attach(unsigned, const Light &);
43         void detach(unsigned);
44         void bind() const;
45
46         static void unbind();
47 };
48
49 } // namespace GL
50 } // namespace Msp
51
52 #endif