X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Frender%2Frenderer.h;h=1a84d8bf8507c50d596bc3d1490a289f8c2f5855;hb=acb4aba95c22fa7c72eeef10befd611570d35182;hp=2854bc8ff181f3ead7f0f19ec9b0ec56d79b0470;hpb=7aaec9a70b8d7733429bec043f8e33e02956f266;p=libs%2Fgl.git diff --git a/source/render/renderer.h b/source/render/renderer.h index 2854bc8f..1a84d8bf 100644 --- a/source/render/renderer.h +++ b/source/render/renderer.h @@ -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_stack; State *state; + std::vector texture_stack; ProgramData standard_shdata; - std::vector shdata_stack; + std::vector shdata_stack; std::set 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);