]> git.tdb.fi Git - libs/gl.git/blob - source/materials/technique.h
Check the flat qualifier from the correct member
[libs/gl.git] / source / materials / technique.h
1 #ifndef MSP_GL_TECHNIQUE_H_
2 #define MSP_GL_TECHNIQUE_H_
3
4 #include <map>
5 #include "rendermethod.h"
6 #include "tag.h"
7
8 namespace Msp {
9 namespace GL {
10
11 class Material;
12 class Texture;
13
14 /**
15 Ties multiple tagged render methods together.
16 */
17 class Technique
18 {
19 public:
20         class Loader: public Msp::DataFile::CollectionObjectLoader<Technique>
21         {
22         private:
23                 std::string inline_base_name;
24
25                 static ActionMap shared_actions;
26
27         public:
28                 Loader(Technique &, Collection &);
29         private:
30                 virtual void init_actions();
31
32         public:
33                 void set_inline_base_name(const std::string &);
34
35         private:
36                 void inherit(const std::string &);
37                 void method(const std::string &);
38         };
39
40 private:
41         class InheritLoader: public Msp::DataFile::CollectionObjectLoader<Technique>
42         {
43         public:
44                 InheritLoader(Technique &, Collection &);
45
46         private:
47                 void material(const std::string &, const std::string &);
48                 void texture(const std::string &, const std::string &);
49                 void uniforms();
50         };
51
52         std::map<Tag, RenderMethod> methods;
53
54 public:
55         RenderMethod &add_method(Tag);
56         bool has_method(Tag) const;
57         const RenderMethod &get_method(Tag) const;
58         const RenderMethod *find_method(Tag) const;
59         const std::map<Tag, RenderMethod> &get_methods() const { return methods; }
60         bool replace_texture(const std::string &, const Texture &);
61         bool replace_material(const std::string &, const Material &);
62         bool replace_uniforms(const ProgramData &);
63
64         void set_debug_name(const std::string &);
65 };
66
67 } // namespace GL
68 } // namespace Msp
69
70 #endif