]> git.tdb.fi Git - libs/gl.git/blob - source/technique.h
Refresh lighting and culling uniforms if the camera changes in pop_state
[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 GL::Tag &);
50         bool has_pass(const GL::Tag &) const;
51         const RenderPass &get_pass(const GL::Tag &) const;
52         const PassMap &get_passes() const { return passes; }
53         void replace_texture(const std::string &, const Texture &);
54         bool has_shaders() const;
55 };
56
57 } // namespace GL
58 } // namespace Msp
59
60 #endif