]> git.tdb.fi Git - libs/gl.git/blobdiff - source/texture2d.h
Enable resource management on Texture2D
[libs/gl.git] / source / texture2d.h
index 639d47a6cee591d3a39ad6cbeced110c75550a0a..a37e2a4d7fd746eeb732d23483d8896115377338 100644 (file)
@@ -5,6 +5,7 @@
 #include <msp/graphics/image.h>
 #include "datatype.h"
 #include "pixelformat.h"
+#include "resource.h"
 #include "texture.h"
 
 namespace Msp {
@@ -33,13 +34,15 @@ public:
        };
 
 private:
+       class AsyncLoader;
+
        PixelFormat ifmt;
        unsigned width;
        unsigned height;
        unsigned allocated;
 
 public:
-       Texture2D();
+       Texture2D(ResourceManager * = 0);
 
        /** Defines storage structure for the texture.  Must be called before an
        image can be uploaded.  Once storage is defined, it can't be changed. */
@@ -71,11 +74,19 @@ public:
        format will be used. */
        void image(const Graphics::Image &, bool srgb = false);
 
+private:
+       void image(const Graphics::Image &, bool, bool);
+
+public:
        unsigned get_width() const { return width; }
        unsigned get_height() const { return height; }
 
 private:
        void get_level_size(unsigned, unsigned &, unsigned &);
+
+public:
+       virtual Resource::AsyncLoader *load(IO::Seekable &);
+       virtual void unload();
 };
 
 } // namespace GL