+void Texture::unbind()
+{
+ const Texture *cur = TexUnit::current().get_texture();
+ if(!cur)
+ return;
+
+ glBindTexture(cur->target, 0);
+ glDisable(cur->target);
+ TexUnit::current().set_texture(0);
+}
+
+void Texture::unbind_from(unsigned i)
+{
+ TexUnit::activate(i);
+ unbind();
+}
+
+
+Texture::Loader::Loader(Texture &t):
+ DataFile::ObjectLoader<Texture>(t)
+{
+ add("generate_mipmap", &Loader::generate_mipmap);
+ add("mag_filter", &Loader::mag_filter);
+ add("min_filter", &Loader::min_filter);
+ add("wrap", &Loader::wrap);
+ add("wrap_r", &Loader::wrap_r);
+ add("wrap_s", &Loader::wrap_s);
+ add("wrap_t", &Loader::wrap_t);
+}
+
+void Texture::Loader::generate_mipmap(bool gm)
+{
+ obj.set_generate_mipmap(gm);
+}
+
+void Texture::Loader::mag_filter(TextureFilter f)
+{
+ obj.set_mag_filter(f);
+}
+
+void Texture::Loader::min_filter(TextureFilter f)
+{
+ obj.set_min_filter(f);
+}
+
+void Texture::Loader::wrap(TextureWrap w)
+{
+ obj.set_wrap(w);
+}
+
+void Texture::Loader::wrap_r(TextureWrap w)
+{
+ obj.set_wrap_r(w);
+}
+
+void Texture::Loader::wrap_s(TextureWrap w)
+{
+ obj.set_wrap_s(w);
+}
+
+void Texture::Loader::wrap_t(TextureWrap w)
+{
+ obj.set_wrap_t(w);
+}