]> git.tdb.fi Git - libs/gl.git/blob - source/materials/technique.h
Add inline data items to the collection
[libs/gl.git] / source / materials / technique.h
1 #ifndef MSP_GL_TECHNIQUE_H_
2 #define MSP_GL_TECHNIQUE_H_
3
4 #include "renderpass.h"
5 #include "tag.h"
6
7 namespace Msp {
8 namespace GL {
9
10 class Material;
11 class Texture;
12
13 /**
14 Ties multiple tagged render passes together.
15 */
16 class Technique
17 {
18 public:
19         class Loader: public Msp::DataFile::CollectionObjectLoader<Technique>
20         {
21         private:
22                 std::string inline_base_name;
23
24                 static ActionMap shared_actions;
25
26         public:
27                 Loader(Technique &);
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 pass(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 public:
53         typedef std::map<Tag, RenderPass> PassMap;
54
55 private:
56         PassMap passes;
57
58 public:
59         RenderPass &add_pass(Tag);
60         bool has_pass(Tag) const;
61         const RenderPass &get_pass(Tag) const;
62         const RenderPass *find_pass(Tag) const;
63         const PassMap &get_passes() const { return passes; }
64         bool replace_texture(const std::string &, const Texture &);
65         bool replace_material(const std::string &, const Material &);
66         bool replace_uniforms(const ProgramData &);
67         bool has_shaders() const;
68
69         void set_debug_name(const std::string &);
70 };
71
72 } // namespace GL
73 } // namespace Msp
74
75 #endif