]> git.tdb.fi Git - libs/gl.git/blobdiff - source/texturing.h
Add a texunit statement which automatically determines the unit number
[libs/gl.git] / source / texturing.h
index 2b409d64fb713ee221a4842110832258bd92f711..cba77e3fb3e49a57e4ca98f7bb698f7ddf7f8489 100644 (file)
@@ -12,13 +12,20 @@ class Texture;
 class Texturing: public Bindable<Texturing>
 {
 private:
-       std::vector<const Texture *> attachments;
+       struct Attachment
+       {
+               unsigned unit;
+               const Texture *texture;
 
-       static bool legacy_used;
+               Attachment(unsigned, const Texture *);
+       };
+
+       std::vector<Attachment> attachments;
 
 public:
        ~Texturing();
 
+       int find_free_unit(const std::string & = std::string()) const;
        void attach(unsigned, const Texture &);
        void detach(unsigned);
 private:
@@ -26,13 +33,7 @@ private:
 public:
        const Texture *get_attached_texture(unsigned) const;
 
-private:
-       void bind_attachment(unsigned, bool) const;
-
-       static void unbind_attachment(unsigned);
-
-public:
-       void bind(bool = true) const;
+       void bind() const;
 
        static void unbind();
 };