- switch(ctype)
- {
- case PNG_COLOR_TYPE_GRAY: fmt=LUMINANCE8; planes=1; break;
- case PNG_COLOR_TYPE_GRAY_ALPHA: fmt=LUMINANCE8_ALPHA8; planes=2; break;
- case PNG_COLOR_TYPE_RGB: fmt=RGB8; planes=3; break;
- case PNG_COLOR_TYPE_RGB_ALPHA: fmt=RGBA8; planes=4; break;
- default: throw Exception("Invalid color type");
- }
+Texture2D::Loader::Loader(Texture2D &t):
+ DataFile::DerivedObjectLoader<Texture2D, Texture::Loader>(t)
+{
+ add("image_data", &Loader::image_data);
+ add("raw_data", &Loader::raw_data);
+ add("storage", &Loader::storage);
+ add("storage", &Loader::storage_b);
+}
+
+void Texture2D::Loader::image_data(const string &data)
+{
+ Graphics::Image img;
+ IO::Memory mem(data.data(), data.size());
+ img.load_io(mem);