]> git.tdb.fi Git - libs/gl.git/blob - source/technique.h
1078433f39f7d5c028b80ca622150882446ac3e4
[libs/gl.git] / source / 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         public:
22                 Loader(Technique &);
23                 Loader(Technique &, Collection &);
24
25         private:
26                 void init();
27                 void inherit(const std::string &);
28                 void pass(const std::string &);
29         };
30
31 private:
32         class InheritLoader: public Msp::DataFile::CollectionObjectLoader<Technique>
33         {
34         public:
35                 InheritLoader(Technique &, Collection &);
36
37         private:
38                 void material(const std::string &, const std::string &);
39                 void texture(const std::string &, const std::string &);
40         };
41
42 public:
43         typedef std::map<Tag, RenderPass> PassMap;
44
45 private:
46         PassMap passes;
47
48 public:
49         RenderPass &add_pass(const Tag &);
50         bool has_pass(const Tag &) const;
51         const RenderPass &get_pass(const Tag &) const;
52         const PassMap &get_passes() const { return passes; }
53         bool replace_texture(const std::string &, const Texture &);
54         bool replace_material(const std::string &, const Material &);
55         bool has_shaders() const;
56 };
57
58 } // namespace GL
59 } // namespace Msp
60
61 #endif