]> git.tdb.fi Git - libs/gl.git/blob - source/texunit.h
Make TexUnits aware of their incides
[libs/gl.git] / source / texunit.h
1 #ifndef MSP_GL_TEXUNIT_H_
2 #define MSP_GL_TEXUNIT_H_
3
4 #include <vector>
5
6 namespace Msp {
7 namespace GL {
8
9 class TexEnv;
10 class TexGen;
11 class Texture;
12
13 class TexUnit
14 {
15 private:
16         unsigned index;
17         const Texture *texture;
18         const TexEnv *texenv;
19         const TexGen *texgen[4];
20
21         static std::vector<TexUnit> units;
22         static TexUnit *cur_unit;
23
24 public:
25         TexUnit();
26
27         unsigned get_index() const { return index; }
28         bool set_texture(const Texture *);
29         const Texture *get_texture() const { return texture; }
30         bool set_texenv(const TexEnv *);
31         const TexEnv *get_texenv() const { return texenv; }
32         bool set_texgen(unsigned, const TexGen *);
33         const TexGen *get_texgen(unsigned);
34
35         static unsigned get_n_units();
36         static TexUnit &activate(unsigned);
37         static TexUnit &current();
38 };
39
40 } // namespace GL
41 } // namespace Msp
42
43 #endif