]> git.tdb.fi Git - libs/gl.git/blobdiff - source/core/texture.cpp
Use set_manager instead of passing the manager to the constructor
[libs/gl.git] / source / core / texture.cpp
index 4968e2e678bd6103c239103828cc1c78b0ff4b2b..568479a6d7fd9d187b3a9805af63591283bc9239 100644 (file)
@@ -8,17 +8,14 @@ using namespace std;
 namespace Msp {
 namespace GL {
 
-Texture::Texture(unsigned t, ResourceManager *m):
-       TextureBackend(t, !m),
+Texture::Texture(unsigned t):
+       TextureBackend(t),
        format(NO_PIXELFORMAT),
        storage_fmt(format),
        swizzle(NO_SWIZZLE),
        use_srgb_format(false),
        auto_gen_mipmap(false)
-{
-       if(m)
-               set_manager(m);
-}
+{ }
 
 void Texture::set_format(PixelFormat fmt)
 {
@@ -65,22 +62,10 @@ void Texture::load_image(const string &fn, unsigned lv)
 }
 
 
-Texture::Loader::Loader(Texture &t):
-       DataFile::CollectionObjectLoader<Texture>(t, 0)
-{
-       init();
-}
-
-Texture::Loader::Loader(Texture &t, Collection &c):
-       DataFile::CollectionObjectLoader<Texture>(t, &c)
+Texture::Loader::Loader(Texture &t, Collection *c):
+       CollectionObjectLoader<Texture>(t, c),
+       levels(0)
 {
-       init();
-}
-
-void Texture::Loader::init()
-{
-       levels = 0;
-
        add("external_image", &Loader::external_image);
        add("external_image_srgb", &Loader::external_image_srgb);
        add("generate_mipmap", &Loader::generate_mipmap);
@@ -134,11 +119,7 @@ void Texture::Loader::generate_mipmap(bool gm)
 void Texture::Loader::image_data(const string &data)
 {
        if(obj.manager)
-       {
                obj.set_manager(0);
-               if(!obj.id)
-                       obj.generate_id();
-       }
 
        Graphics::Image img;
        IO::Memory mem(data.data(), data.size());