]> git.tdb.fi Git - libs/gl.git/blobdiff - source/materials/technique.h
Rearrange soucre files into subdirectories
[libs/gl.git] / source / materials / technique.h
diff --git a/source/materials/technique.h b/source/materials/technique.h
new file mode 100644 (file)
index 0000000..762b98f
--- /dev/null
@@ -0,0 +1,64 @@
+#ifndef MSP_GL_TECHNIQUE_H_
+#define MSP_GL_TECHNIQUE_H_
+
+#include "renderpass.h"
+#include "tag.h"
+
+namespace Msp {
+namespace GL {
+
+class Material;
+class Texture;
+
+/**
+Ties multiple tagged render passes together.
+*/
+class Technique
+{
+public:
+       class Loader: public Msp::DataFile::CollectionObjectLoader<Technique>
+       {
+       public:
+               Loader(Technique &);
+               Loader(Technique &, Collection &);
+
+       private:
+               void init();
+               void inherit(const std::string &);
+               void pass(const std::string &);
+       };
+
+private:
+       class InheritLoader: public Msp::DataFile::CollectionObjectLoader<Technique>
+       {
+       public:
+               InheritLoader(Technique &, Collection &);
+
+       private:
+               void material(const std::string &, const std::string &);
+               void texture(const std::string &, const std::string &);
+               void uniforms();
+       };
+
+public:
+       typedef std::map<Tag, RenderPass> PassMap;
+
+private:
+       PassMap passes;
+
+public:
+       RenderPass &add_pass(const Tag &);
+       bool has_pass(const Tag &) const;
+       const RenderPass &get_pass(const Tag &) const;
+       const RenderPass *find_pass(const Tag &) const;
+       const PassMap &get_passes() const { return passes; }
+       bool replace_texture(const std::string &, const Texture &);
+       bool replace_material(const std::string &, const Material &);
+       bool replace_uniforms(const ProgramData &);
+       bool has_shaders() const;
+};
+
+} // namespace GL
+} // namespace Msp
+
+#endif