]> git.tdb.fi Git - libs/gl.git/blob - source/materials/technique.h
Remove deprecated interfaces from material and lighting code
[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 "renderpass.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 passes 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 &);
29                 Loader(Technique &, Collection &);
30         private:
31                 virtual void init_actions();
32
33         public:
34                 void set_inline_base_name(const std::string &);
35
36         private:
37                 void inherit(const std::string &);
38                 void pass(const std::string &);
39         };
40
41 private:
42         class InheritLoader: public Msp::DataFile::CollectionObjectLoader<Technique>
43         {
44         public:
45                 InheritLoader(Technique &, Collection &);
46
47         private:
48                 void material(const std::string &, const std::string &);
49                 void texture(const std::string &, const std::string &);
50                 void uniforms();
51         };
52
53         std::map<Tag, RenderPass> passes;
54
55 public:
56         RenderPass &add_pass(Tag);
57         bool has_pass(Tag) const;
58         const RenderPass &get_pass(Tag) const;
59         const RenderPass *find_pass(Tag) const;
60         const std::map<Tag, RenderPass> &get_passes() const { return passes; }
61         bool replace_texture(const std::string &, const Texture &);
62         bool replace_material(const std::string &, const Material &);
63         bool replace_uniforms(const ProgramData &);
64
65         void set_debug_name(const std::string &);
66 };
67
68 } // namespace GL
69 } // namespace Msp
70
71 #endif