]> git.tdb.fi Git - libs/gl.git/blobdiff - source/resources/resources.cpp
Remove the deprecated srgb_conversion flag from Resources
[libs/gl.git] / source / resources / resources.cpp
index a0ee5e851e19d62f8e06411478b885f8de84658d..e67405ac705489a56dbc435cd0c1224b1478e667 100644 (file)
@@ -43,7 +43,6 @@ void init_builtin_data(DataFile::BuiltinSource &);
 Resources *Resources::global_resources = 0;
 
 Resources::Resources(bool set_as_global):
-       srgb_conversion(false),
        resource_manager(0)
 {
        add_type<Animation>().suffix(".anim").keyword("animation");
@@ -140,11 +139,6 @@ const DataFile::CollectionSource &Resources::get_builtins()
        return builtins;
 }
 
-void Resources::set_srgb_conversion(bool c)
-{
-       srgb_conversion = c;
-}
-
 void Resources::set_resource_manager(ResourceManager *m)
 {
        resource_manager = m;
@@ -166,7 +160,7 @@ T *Resources::create_generic(const string &name)
 
 Mesh *Resources::create_mesh(const string &name)
 {
-       if(!resource_manager)
+       if(!resource_manager || name[0]=='_')
                return 0;
 
        if(RefPtr<IO::Seekable> io = open_raw(name))
@@ -182,9 +176,16 @@ Mesh *Resources::create_mesh(const string &name)
 
 Texture *Resources::create_texture(const string &name)
 {
+       bool managed = (resource_manager && name[0]!='_');
+
        string ext = FS::extpart(name);
        if(ext==".tex")
-               return create_generic<Texture, GenericResourceLoader<Texture>>(name);
+       {
+               if(managed)
+                       return create_generic<Texture, GenericResourceLoader<Texture>>(name);
+               else
+                       return create_generic<Texture>(name);
+       }
 
        if(RefPtr<IO::Seekable> io = open_raw(name))
        {
@@ -192,14 +193,16 @@ Texture *Resources::create_texture(const string &name)
 
                // Verify that the image is loadable
                Graphics::Image image;
-               if(!resource_manager)
+               if(!managed)
                        image.load_io(*io);
 
                tex = new Texture2D;
-               tex->set_manager(resource_manager);
 
-               if(resource_manager)
+               if(managed)
+               {
+                       tex->set_manager(resource_manager);
                        resource_manager->set_resource_location(*tex, *this, name);
+               }
                else
                        tex->image(image);