if(RefPtr<IO::Seekable> io = open_raw(name))
{
- Graphics::Image image;
- if(!resource_manager)
- image.load_io(*io);
-
- RefPtr<Texture2D> tex = new Texture2D(resource_manager);
+ RefPtr<Texture2D> tex;
if(ext==".tex2d")
{
+ tex = new Texture2D(resource_manager);
DataFile::Parser parser(*io, name);
Texture2D::Loader ldr(*tex, *this);
ldr.load(parser);
}
else
{
+ // Verify that the image is loadable
+ Graphics::Image image;
+ if(!resource_manager)
+ image.load_io(*io);
+
+ tex = new Texture2D(resource_manager);
Sampler &samp = tex->get_default_sampler();
if(is_mipmapped(default_tex_filter))
{
samp.set_mag_filter(default_tex_filter);
samp.set_min_filter(default_tex_filter);
samp.set_max_anisotropy(default_tex_anisotropy);
+
+ if(resource_manager)
+ resource_manager->set_resource_location(*tex, *this, name);
+ else
+ tex->image(image);
}
- if(resource_manager)
- resource_manager->set_resource_location(*tex, *this, name);
- else
- tex->image(image);
return tex.release();
}