+UInt64 TextureCube::get_data_size() const
+{
+ return id ? size*size*6*get_pixel_size(storage_fmt) : 0;
+}
+
+
+TextureCube::Loader::Loader(TextureCube &t):
+ DataFile::DerivedObjectLoader<TextureCube, Texture::Loader>(t)
+{
+ init();
+}
+
+TextureCube::Loader::Loader(TextureCube &t, Collection &c):
+ DataFile::DerivedObjectLoader<TextureCube, Texture::Loader>(t, c)
+{
+ init();
+}
+
+void TextureCube::Loader::init()
+{
+ add("external_image", &Loader::external_image);
+ add("image_data", &Loader::image_data);
+ add("raw_data", &Loader::raw_data);
+ add("storage", &Loader::storage);
+ add("storage", &Loader::storage_levels);
+}
+
+void TextureCube::Loader::external_image(TextureCubeFace face, const string &fn)
+{
+ Graphics::Image img;
+ RefPtr<IO::Seekable> io = get_collection().open_raw(fn);
+ img.load_io(*io);
+
+ obj.image(face, img);
+}
+
+void TextureCube::Loader::image_data(TextureCubeFace face, const string &data)
+{
+ Graphics::Image img;
+ IO::Memory mem(data.data(), data.size());
+ img.load_io(mem);
+
+ obj.image(face, img);
+}
+
+void TextureCube::Loader::raw_data(TextureCubeFace face, const string &data)
+{
+ obj.image(face, 0, data.data());
+}
+
+void TextureCube::Loader::storage(PixelFormat fmt, unsigned s)
+{
+ obj.storage(fmt, s);
+}
+
+void TextureCube::Loader::storage_levels(PixelFormat fmt, unsigned s, unsigned l)
+{
+ obj.storage(fmt, s, l);
+}
+
+
+void operator>>(const LexicalConverter &conv, TextureCubeFace &face)
+{
+ const string &str = conv.get();
+ if(str=="POSITIVE_X")
+ face = POSITIVE_X;
+ else if(str=="NEGATIVE_X")
+ face = NEGATIVE_X;
+ else if(str=="POSITIVE_Y")
+ face = POSITIVE_Y;
+ else if(str=="NEGATIVE_Y")
+ face = NEGATIVE_Y;
+ else if(str=="POSITIVE_Z")
+ face = POSITIVE_Z;
+ else if(str=="NEGATIVE_Z")
+ face = NEGATIVE_Z;
+ else
+ throw lexical_error(format("conversion of '%s' to TextureCubeFace", str));
+}
+