]> git.tdb.fi Git - libs/gl.git/commitdiff
Convert Technique and RenderPass loaders to use shared actions
authorMikko Rasa <tdb@tdb.fi>
Sun, 18 Apr 2021 22:43:58 +0000 (01:43 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sun, 18 Apr 2021 22:43:58 +0000 (01:43 +0300)
source/materials/renderpass.cpp
source/materials/renderpass.h
source/materials/technique.cpp
source/materials/technique.h

index 702bddeaab393034521ccfb93a78f1152218b697..033c43b1955ae56b08ed4dddfc17d6fdef9789f2 100644 (file)
@@ -150,19 +150,21 @@ void RenderPass::apply(Renderer &renderer) const
 }
 
 
+DataFile::Loader::ActionMap RenderPass::Loader::shared_actions;
+
 RenderPass::Loader::Loader(RenderPass &p):
        DataFile::CollectionObjectLoader<RenderPass>(p, 0)
 {
-       init();
+       set_actions(shared_actions);
 }
 
 RenderPass::Loader::Loader(RenderPass &p, Collection &c):
        DataFile::CollectionObjectLoader<RenderPass>(p, &c)
 {
-       init();
+       set_actions(shared_actions);
 }
 
-void RenderPass::Loader::init()
+void RenderPass::Loader::init_actions()
 {
        add("shader",   &Loader::shader);
        add("material", &Loader::material_inline);
index 8a69ad12afcc5397739781e91242a8f79cfecc59..cb378556f27df66f35f0d448bb67ba3de9133c5e 100644 (file)
@@ -24,12 +24,15 @@ class RenderPass
 public:
        class Loader: public DataFile::CollectionObjectLoader<RenderPass>
        {
+       private:
+               static ActionMap shared_actions;
+
        public:
                Loader(RenderPass &);
                Loader(RenderPass &, Collection &);
 
        private:
-               void init();
+               virtual void init_actions();
 
                static std::string get_shader_name(const std::string &);
 
index 12111e5e675305aa98859bf1ba58f2c332bb544e..a4d181629a122a802d8bd66509f3f01617784a88 100644 (file)
@@ -102,19 +102,21 @@ bool Technique::has_shaders() const
 }
 
 
+DataFile::Loader::ActionMap Technique::Loader::shared_actions;
+
 Technique::Loader::Loader(Technique &t):
        DataFile::CollectionObjectLoader<Technique>(t, 0)
 {
-       init();
+       set_actions(shared_actions);
 }
 
 Technique::Loader::Loader(Technique &t, Collection &c):
        DataFile::CollectionObjectLoader<Technique>(t, &c)
 {
-       init();
+       set_actions(shared_actions);
 }
 
-void Technique::Loader::init()
+void Technique::Loader::init_actions()
 {
        add("inherit", &Loader::inherit);
        add("pass", &Loader::pass);
index c3b5245357180a8e1993fb63a831efbc60db72c0..8e4adf4f1ebaad993e2fd0efbd1d6806b38599e3 100644 (file)
@@ -18,12 +18,16 @@ class Technique
 public:
        class Loader: public Msp::DataFile::CollectionObjectLoader<Technique>
        {
+       private:
+               static ActionMap shared_actions;
+
        public:
                Loader(Technique &);
                Loader(Technique &, Collection &);
 
        private:
-               void init();
+               virtual void init_actions();
+
                void inherit(const std::string &);
                void pass(const std::string &);
        };