]> git.tdb.fi Git - libs/gl.git/blobdiff - source/texture.h
Add a geometry flag to ProgramBuilder
[libs/gl.git] / source / texture.h
index c091c884cacfd592833120b785c7f83ff2fe303e..4cd5481e2e18f570377c3f13d86b8b4dbf984cb8 100644 (file)
@@ -2,8 +2,11 @@
 #define MSP_GL_TEXTURE_H_
 
 #include <msp/datafile/objectloader.h>
+#include "datatype.h"
 #include "gl.h"
+#include "pixelformat.h"
 #include "predicate.h"
+#include "resource.h"
 
 namespace Msp {
 namespace GL {
@@ -63,14 +66,20 @@ texture to be usable.
 If texture coordinates fall outside of the principal range of the texture,
 wrapping is applied.  The default for all directions is REPEAT.
 */
-class Texture
+class Texture: public Resource
 {
 protected:
-       class Loader: public DataFile::ObjectLoader<Texture>
+       class Loader: public DataFile::CollectionObjectLoader<Texture>
        {
+       protected:
+               bool srgb;
+
        public:
                Loader(Texture &);
+               Loader(Texture &, Collection &);
        private:
+               void init();
+
                void filter(TextureFilter);
                void generate_mipmap(bool);
                void mag_filter(TextureFilter);
@@ -108,13 +117,15 @@ protected:
        Predicate cmp_func;
        mutable int dirty_params;
 
-       Texture(GLenum);
+       Texture(GLenum, ResourceManager * = 0);
        Texture(const Texture &);
        Texture &operator=(const Texture &);
 public:
        ~Texture();
 
 protected:
+       static DataType get_alloc_type(PixelFormat);
+
        void update_parameter(int) const;
 public:
        void set_min_filter(TextureFilter);
@@ -137,6 +148,10 @@ public:
        when a texture image is uploaded. */
        void set_generate_mipmap(bool);
 
+protected:
+       void auto_generate_mipmap();
+
+public:
        /** Sets depth texture comparison.  Has no effect on other formats.  When
        comparison is enabled, the third component of the texture coordinate is
        compared against the texel value, and the result is returned as the texture
@@ -155,6 +170,8 @@ public:
        static const Texture *current(unsigned = 0);
        static void unbind() { unbind_from(0); }
        static void unbind_from(unsigned);
+
+       virtual UInt64 get_data_size() const { return 0; }
 };
 
 } // namespace GL