]> git.tdb.fi Git - libs/gl.git/blobdiff - source/builders/sequencetemplate.h
Support effects and subordinate sequences inside sequence templates
[libs/gl.git] / source / builders / sequencetemplate.h
index 3f4b86b956d3499ee1020a96595cbf78818db106..5c13aebebc2263677447e93e33ab96de25883cf0 100644 (file)
@@ -7,6 +7,7 @@
 #include <msp/datafile/dynamicobjectloader.h>
 #include <msp/datafile/objectloader.h>
 #include "depthtest.h"
+#include "effect.h"
 #include "postprocessor.h"
 #include "resources.h"
 #include "stenciltest.h"
@@ -47,18 +48,23 @@ public:
                virtual void init_actions();
 
                void clear();
+               void effect(const std::string &);
                void multisample(unsigned);
                void multisample_range(unsigned, unsigned);
                void postprocessor();
                void postprocessor_with_slot(const std::string &);
                void renderable(const std::string &);
                void renderable_with_default(const std::string &, const std::string &);
+               void sequence(const std::string &, const std::string &);
                void step(const std::string &, const std::string &);
        };
 
        struct Renderable
        {
+               Effect::Template *effect_template = 0;
                GL::Renderable *renderable = 0;
+               SequenceTemplate *sequence_template = 0;
+               std::map<std::string, std::string> sequence_renderables;
                std::string slot_name;
        };
 
@@ -118,6 +124,19 @@ private:
                void stencil(int);
        };
 
+       class SequenceLoader: public DataFile::ObjectLoader<Renderable>
+       {
+       private:
+               static ActionMap shared_actions;
+
+       public:
+               SequenceLoader(Renderable &);
+       private:
+               virtual void init_actions();
+
+               void renderable(const std::string &, const std::string &);
+       };
+
        bool hdr = false;
        bool alpha = false;
        unsigned required_multisample = 0;
@@ -145,6 +164,9 @@ public:
        float get_clear_depth() const { return clear_depth; }
        int get_clear_stencil() const { return clear_stencil; }
 
+       template<typename T>
+       static void register_effect(const std::string &);
+
        template<typename T>
        static void register_postprocessor(const std::string &);
 
@@ -153,6 +175,12 @@ private:
        static TemplateRegistry<T> &get_registry();
 };
 
+template<typename T>
+void SequenceTemplate::register_effect(const std::string &kw)
+{
+       get_registry<Effect>().register_type<typename T::Template>(kw);
+}
+
 template<typename T>
 void SequenceTemplate::register_postprocessor(const std::string &kw)
 {