X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Ftexture.cpp;h=5f21229fa8abc2d80c3e0029364bb519bd961bee;hb=6cee6c490ded0981c4da3f9f4ec74a41555e1a4e;hp=175e76a2365688c8aef1f30592759d8addbefab1;hpb=260ecf71f02d4b3397e4f6c80d96a7c4ba473185;p=libs%2Fgl.git diff --git a/source/core/texture.cpp b/source/core/texture.cpp index 175e76a2..5f21229f 100644 --- a/source/core/texture.cpp +++ b/source/core/texture.cpp @@ -1,3 +1,4 @@ +#include #include #include "error.h" #include "resourcemanager.h" @@ -87,6 +88,7 @@ Texture::Loader::Loader(Texture &t, Collection *c): CollectionObjectLoader(t, c), levels(0) { + add("external_data", &Loader::external_data); add("external_image", &Loader::external_image, false); add("external_image_srgb", &Loader::external_image, true); add("generate_mipmap", &Loader::generate_mipmap); @@ -109,6 +111,19 @@ void Texture::Loader::load_external_image(Graphics::Image &img, const string &fn img.load_io(*io); } +void Texture::Loader::external_data(const string &fn) +{ + if(obj.manager) + obj.manager->set_resource_location(obj, get_collection(), fn); + else + { + DataFile::RawData rd; + rd.open_file(get_collection(), fn); + rd.load(); + obj.image(0, rd.get_data()); + } +} + void Texture::Loader::external_image(bool srgb, const string &fn) { obj.use_srgb_format = srgb;