]> git.tdb.fi Git - libs/gl.git/blobdiff - source/builders/sequencetemplate.h
Change various generated texture names to use the unified extension
[libs/gl.git] / source / builders / sequencetemplate.h
index 32736d8ee7645e255255d9275abb6156db354b1a..972a6b0b18939e6deda71e243d3dd89a31594eb9 100644 (file)
@@ -6,13 +6,14 @@
 #include <msp/core/typeregistry.h>
 #include <msp/datafile/objectloader.h>
 #include "blend.h"
+#include "depthtest.h"
 #include "postprocessor.h"
-#include "predicate.h"
+#include "resources.h"
+#include "stenciltest.h"
 
 namespace Msp {
 namespace GL {
 
-class DepthTest;
 class Lighting;
 class Renderable;
 
@@ -53,6 +54,7 @@ public:
                Loader(SequenceTemplate &, Collection &);
 
                virtual void postprocessor_loaded();
+               void clear();
                void multisample(unsigned);
                void multisample_range(unsigned, unsigned);
                void postprocessor(const std::string &);
@@ -68,33 +70,29 @@ public:
                        std::string inline_base_name;
 
                public:
-                       Loader(Step &);
                        Loader(Step &, Collection &);
-               private:
-                       void init();
 
-               public:
                        void set_inline_base_name(const std::string &);
 
                private:
-                       void blend(BlendFactor, BlendFactor);
-                       void blend_predefined(const std::string &);
-                       void depth_test(Predicate);
-                       void depth_test_predefined(const std::string &);
+                       void blend();
+                       void blend_factors(BlendFactor, BlendFactor);
+                       void depth_test();
+                       void depth_compare(Predicate);
                        void lighting(const std::string &);
                        void lighting_inline();
                        void object(const std::string &);
                        void scene(const std::string &);
+                       void stencil_test();
                };
 
                std::string tag;
-               const Lighting *lighting;
-               RefPtr<const DepthTest> depth_test;
-               RefPtr<const Blend> blend;
+               const Lighting *lighting = 0;
+               DepthTest depth_test;
+               StencilTest stencil_test;
+               Blend blend;
                std::string slot_name;
-               Renderable *default_renderable;
-
-               ~Step();
+               Renderable *default_renderable = 0;
        };
 
        struct PostProcessor
@@ -105,20 +103,32 @@ public:
                PostProcessor(GL::PostProcessor::Template * = 0);
        };
 
-       typedef std::vector<PostProcessor> PostProcessorArray;
-
 private:
+       class ClearLoader: public DataFile::ObjectLoader<SequenceTemplate>
+       {
+       public:
+               ClearLoader(SequenceTemplate &);
+
+       private:
+               void color(float, float, float, float);
+               void depth(float);
+               void stencil(int);
+       };
+
        typedef TypeRegistry<PostProcLoader::AddPostProc, PostProcLoader &> PostProcessorRegistry;
 
-       bool hdr;
-       bool alpha;
-       unsigned required_multisample;
-       unsigned max_multisample;
+       bool hdr = false;
+       bool alpha = false;
+       unsigned required_multisample = 0;
+       unsigned max_multisample = 0;
        std::vector<Step> steps;
-       PostProcessorArray postprocessors;
+       std::vector<PostProcessor> postprocessors;
+       bool clear_enabled = false;
+       std::vector<Color> clear_colors;
+       float clear_depth = 1.0f;
+       int clear_stencil = 0;
 
 public:
-       SequenceTemplate();
        ~SequenceTemplate();
 
        bool get_hdr() const { return hdr; }
@@ -126,7 +136,11 @@ public:
        unsigned get_required_multisample() const { return required_multisample; }
        unsigned get_maximum_multisample() const { return max_multisample; }
        const std::vector<Step> &get_steps() const { return steps; }
-       const PostProcessorArray &get_postprocessors() const { return postprocessors; }
+       const std::vector<PostProcessor> &get_postprocessors() const { return postprocessors; }
+       bool is_clear_enabled() const { return clear_enabled; }
+       const std::vector<Color> &get_clear_colors() const { return clear_colors; }
+       float get_clear_depth() const { return clear_depth; }
+       int get_clear_stencil() const { return clear_stencil; }
 
        template<typename T>
        static void register_postprocessor(const std::string &);