private:
Texture2D &texture;
IO::Seekable &io;
- bool srgb_conversion;
Buffer pixel_buffer;
char *mapped_address;
Graphics::Image image;
public:
AsyncLoader(Texture2D &, IO::Seekable &);
- void set_srgb_conversion(bool);
virtual bool needs_sync() const;
virtual bool process();
};
sub_image(level, x, y, wd, ht, data);
}
-void Texture2D::image(const Graphics::Image &img, unsigned lv, bool srgb)
+void Texture2D::image(const Graphics::Image &img, unsigned lv)
{
- image(img, lv, srgb, false);
+ image(img, lv, false);
}
-void Texture2D::image(const Graphics::Image &img, unsigned lv, bool srgb, bool from_buffer)
+void Texture2D::image(const Graphics::Image &img, unsigned lv, bool from_buffer)
{
unsigned w = img.get_width();
unsigned h = img.get_height();
PixelFormat fmt = pixelformat_from_image(img);
if(width==0)
- storage(make_pixelformat(get_components(fmt), get_component_type(fmt), srgb), w, h, lv);
+ storage(make_pixelformat(get_components(fmt), get_component_type(fmt), use_srgb_format), w, h, lv);
else if(w!=width || h!=height || (lv && lv!=levels))
throw incompatible_data("Texture2D::image");
h = 1;
}
-Resource::AsyncLoader *Texture2D::load(IO::Seekable &io, const Resources *res)
+Resource::AsyncLoader *Texture2D::load(IO::Seekable &io, const Resources *)
{
AsyncLoader *ldr = new AsyncLoader(*this, io);
- if(res)
- ldr->set_srgb_conversion(res->get_srgb_conversion());
return ldr;
}
Texture2D::AsyncLoader::AsyncLoader(Texture2D &t, IO::Seekable &i):
texture(t),
io(i),
- srgb_conversion(false),
pixel_buffer(PIXEL_UNPACK_BUFFER),
mapped_address(0),
phase(0)
{ }
-void Texture2D::AsyncLoader::set_srgb_conversion(bool c)
-{
- srgb_conversion = c;
-}
-
bool Texture2D::AsyncLoader::needs_sync() const
{
return phase%2;
else
glGenTextures(1, &texture.id);
}
- texture.image(image, 0, srgb_conversion, true);
+ texture.image(image, 0, true);
}
++phase;