+#include <msp/datafile/rawdata.h>
#include <msp/io/memory.h>
#include "error.h"
#include "resourcemanager.h"
CollectionObjectLoader<Texture>(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);
add("image_data", &Loader::image_data);
add("mipmap_levels", &Loader::mipmap_levels);
+ add("raw_data", &Loader::raw_data);
}
void Texture::Loader::finish()
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;
levels = l;
}
+void Texture::Loader::raw_data(const string &data)
+{
+ if(obj.manager)
+ obj.set_manager(0);
+
+ obj.image(0, data.data());
+}
+
} // namespace GL
} // namespace Msp