]> git.tdb.fi Git - libs/gl.git/blobdiff - source/texturing.h
Remove the deprecated ProgramBuilder class
[libs/gl.git] / source / texturing.h
index c51782bbf237959558af379998d5f4bab504d962..0da3eae41794d167d5ee9421943cdac29c9cc74f 100644 (file)
@@ -1,10 +1,3 @@
-/* $Id$
-
-This file is part of libmspgl
-Copyright © 2010  Mikko Rasa, Mikkosoft Productions
-Distributed under the LGPL
-*/
-
 #ifndef MSP_GL_TEXTURING_H_
 #define MSP_GL_TEXTURING_H_
 
@@ -14,7 +7,6 @@ Distributed under the LGPL
 namespace Msp {
 namespace GL {
 
-class TexEnv;
 class Texture;
 
 class Texturing: public Bindable<Texturing>
@@ -22,10 +14,11 @@ class Texturing: public Bindable<Texturing>
 private:
        struct Attachment
        {
-               const Texture *tex;
-               const TexEnv *env;
+               unsigned unit;
+               const Texture *texture;
+               const Sampler *sampler;
 
-               Attachment();
+               Attachment(unsigned, const Texture *, const Sampler *);
        };
 
        std::vector<Attachment> attachments;
@@ -33,19 +26,23 @@ private:
 public:
        ~Texturing();
 
-       void attach(unsigned, const Texture &);
-       void attach(unsigned, const Texture &, const TexEnv &);
+       int find_free_unit(const std::string & = std::string()) const;
+       void attach(unsigned, const Texture &, const Sampler * = 0);
+       void attach(unsigned, const Sampler &);
        void detach(unsigned);
 private:
-       void set_attachment(unsigned, const Texture *, const TexEnv *);
-       void bind_attachment(unsigned) const;
-
-       static void unbind_attachment(unsigned);
-
+       void set_attachment(unsigned, const Texture *, const Sampler *);
 public:
+       const Texture *get_attached_texture(unsigned) const;
+       const Sampler *get_attached_sampler(unsigned) const;
+
        void bind() const;
 
        static void unbind();
+
+private:
+       void bind_attachment(const Attachment &) const;
+       static void unbind_attachment(unsigned);
 };
 
 } // namespace GL