]> 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 0b3a9751b5f98ebe17f6e55a48fe3d4a998b92c1..cba77e3fb3e49a57e4ca98f7bb698f7ddf7f8489 100644 (file)
@@ -12,11 +12,20 @@ class Texture;
 class Texturing: public Bindable<Texturing>
 {
 private:
-       std::vector<const Texture *> attachments;
+       struct Attachment
+       {
+               unsigned unit;
+               const Texture *texture;
+
+               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:
@@ -24,12 +33,6 @@ private:
 public:
        const Texture *get_attached_texture(unsigned) const;
 
-private:
-       void bind_attachment(unsigned) const;
-
-       static void unbind_attachment(unsigned);
-
-public:
        void bind() const;
 
        static void unbind();