The texture's loader already informs the resource manager of the location
of the image, so it shouldn't be done here. There's also no need to load
the image first anymore.
if(RefPtr<IO::Seekable> io = open_raw(name))
{
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);
+ tex = new Texture2D(resource_manager);
DataFile::Parser parser(*io, name);
Texture2D::Loader ldr(*tex, *this);
ldr.load(parser);
}
else
{
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))
{
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);
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);