]> git.tdb.fi Git - libs/gl.git/blobdiff - source/materials/rendermethod.h
Move blend state from Sequence::Step to RenderMethod
[libs/gl.git] / source / materials / rendermethod.h
index 11c7e8583ecd430f759fe75fb078aac5317700d2..94f716a41c871d4705f76bc585ad493087379fa6 100644 (file)
@@ -3,6 +3,7 @@
 
 #include <msp/core/refptr.h>
 #include <msp/datafile/objectloader.h>
+#include "blend.h"
 #include "cullface.h"
 #include "material.h"
 
@@ -30,7 +31,6 @@ public:
                static ActionMap shared_actions;
 
        public:
-               Loader(RenderMethod &);
                Loader(RenderMethod &, Collection &);
        private:
                virtual void init_actions();
@@ -41,6 +41,8 @@ public:
        private:
                virtual void finish();
 
+               void blend();
+               void blend_factors(BlendFactor, BlendFactor);
                void material_inline();
                void material(const std::string &);
                void shader(const std::string &);
@@ -73,21 +75,18 @@ private:
                TextureSlot(Tag t): tag(t), texture(0), sampler(0) { }
        };
 
-       const Program *shprog;
-       bool shprog_from_material;
+       const Program *shprog = 0;
+       bool shprog_from_material = false;
        RefPtr<ProgramData> shdata;
        std::map<Tag, Tag> uniform_slots;
-       const Material *material;
+       const Material *material = 0;
        std::string material_slot;
        std::vector<TextureSlot> textures;
-       CullMode face_cull;
-       bool receive_shadows;
-       bool image_based_lighting;
+       CullMode face_cull = CULL_BACK;
+       Blend blend;
+       bool receive_shadows = false;
+       bool image_based_lighting = false;
 
-public:
-       RenderMethod();
-
-private:
        void maybe_create_material_shader();
        void set_material_textures();
 
@@ -103,6 +102,8 @@ public:
        Tag get_texture_tag(const std::string &) const;
        void set_face_cull(CullMode);
        CullMode get_face_cull() const { return face_cull; }
+       void set_blend(const Blend &);
+       const Blend &get_blend() const { return blend; }
        void set_receive_shadows(bool);
        bool get_receive_shadows() const { return receive_shadows; }
        void set_image_based_lighting(bool);