]> git.tdb.fi Git - libs/gl.git/blobdiff - source/texture.h
Implement automatic unloading when a total size limit is exceeded
[libs/gl.git] / source / texture.h
index c091c884cacfd592833120b785c7f83ff2fe303e..79d79dbd68fbc8c8908b04f180501c6335b783ab 100644 (file)
@@ -4,6 +4,7 @@
 #include <msp/datafile/objectloader.h>
 #include "gl.h"
 #include "predicate.h"
+#include "resource.h"
 
 namespace Msp {
 namespace GL {
@@ -63,14 +64,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,7 +115,7 @@ protected:
        Predicate cmp_func;
        mutable int dirty_params;
 
-       Texture(GLenum);
+       Texture(GLenum, ResourceManager * = 0);
        Texture(const Texture &);
        Texture &operator=(const Texture &);
 public:
@@ -155,6 +162,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