]> git.tdb.fi Git - libs/gl.git/blobdiff - source/render/renderer.h
Actually update the shdata generation numbers in Renderer
[libs/gl.git] / source / render / renderer.h
index 2854bc8ff181f3ead7f0f19ec9b0ec56d79b0470..1a84d8bf8507c50d596bc3d1490a289f8c2f5855 100644 (file)
@@ -64,13 +64,30 @@ public:
        };
 
 private:
+       struct BoundTexture
+       {
+               Tag tag;
+               mutable int unit;
+               const Texture *texture;
+               const Sampler *sampler;
+               int replaced;
+
+               BoundTexture();
+       };
+
+       struct BoundProgramData
+       {
+               const ProgramData *shdata;
+               mutable unsigned generation;
+
+               BoundProgramData(const ProgramData *);
+       };
+
        struct State
        {
                const Camera *camera;
                Matrix modelview_matrix;
-               const Texture *texture;
-               const Sampler *sampler;
-               const Texturing *texturing;
+               unsigned texture_count;
                unsigned lowest_effect_texunit;
                const Material *material;
                const Lighting *lighting;
@@ -99,8 +116,9 @@ private:
        unsigned char changed;
        std::vector<State> state_stack;
        State *state;
+       std::vector<BoundTexture> texture_stack;
        ProgramData standard_shdata;
-       std::vector<const ProgramData *> shdata_stack;
+       std::vector<BoundProgramData> shdata_stack;
        std::set<const Renderable *> excluded;
 
 public:
@@ -126,9 +144,17 @@ public:
        /** Returns the current modelview matrix. */
        const Matrix &get_matrix() const { return state->modelview_matrix; }
 
-       void set_texture(const Texture *, const Sampler * = 0);
-       void set_texturing(const Texturing *);
-       unsigned allocate_effect_texunit();
+       void set_texture(Tag, const Texture *, const Sampler * = 0);
+private:
+       void set_texture(Tag, int, const Texture *, const Sampler *);
+       void flush_textures();
+public:
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+       DEPRECATED void set_texture(const Texture *, const Sampler * = 0);
+       DEPRECATED void set_texturing(const Texturing *);
+       DEPRECATED unsigned allocate_effect_texunit();
+#pragma GCC diagnostic pop
        void set_material(const Material *);
 
        void set_lighting(const Lighting *);
@@ -167,7 +193,7 @@ public:
        void exclude(const Renderable &);
        void include(const Renderable &);
 
-       void render(const Renderable &, const Tag & = Tag());
+       void render(const Renderable &, Tag = Tag());
        void draw(const Batch &);
        void draw_instanced(const Batch &, unsigned);