]> git.tdb.fi Git - libs/gl.git/blob - source/technique.h
Remember the camera given to Renderer constructor
[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                 void uniforms();
41         };
42
43 public:
44         typedef std::map<Tag, RenderPass> PassMap;
45
46 private:
47         PassMap passes;
48
49 public:
50         RenderPass &add_pass(const Tag &);
51         bool has_pass(const Tag &) const;
52         const RenderPass &get_pass(const Tag &) const;
53         const PassMap &get_passes() const { return passes; }
54         bool replace_texture(const std::string &, const Texture &);
55         bool replace_material(const std::string &, const Material &);
56         bool replace_uniforms(const ProgramData &);
57         bool has_shaders() const;
58 };
59
60 } // namespace GL
61 } // namespace Msp
62
63 #endif