]> git.tdb.fi Git - libs/gl.git/blob - source/texunit.h
Update deprecated things
[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 /**
14 Keeps track of texture unit related state.  Mostly for internal use.
15 */
16 class TexUnit
17 {
18 private:
19         unsigned index;
20         bool legacy;
21         const Texture *texture;
22         bool tex_legacy;
23
24         static std::vector<TexUnit> units;
25         static TexUnit *cur_unit;
26
27         TexUnit();
28
29 public:
30         unsigned get_index() const { return index; }
31         bool supports_legacy() const { return legacy; }
32         bool set_texture(const Texture *, bool = true);
33         const Texture *get_texture() const { return texture; }
34         bool get_texture_legacy() const { return tex_legacy; }
35         void bind();
36
37         static unsigned get_n_units();
38         static unsigned get_n_legacy_units();
39         static TexUnit &get_unit(unsigned);
40         static TexUnit &current();
41         static TexUnit *find_unit(const Texture *);
42 };
43
44 } // namespace GL
45 } // namespace Msp
46
47 #endif