X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Ftexturecube.cpp;h=b0887ca85b1e4fca0e88769da87e4621f0d3af54;hb=9087cc0a372b9c739f15398c7a22c0a6eb5041bb;hp=ee8c71c5b0399e88f7c15b375878cf64623a4472;hpb=03d3984ecd2c4e7c38b6a62b4b7a81bab69f8d40;p=libs%2Fgl.git diff --git a/source/texturecube.cpp b/source/texturecube.cpp index ee8c71c5..b0887ca8 100644 --- a/source/texturecube.cpp +++ b/source/texturecube.cpp @@ -71,25 +71,26 @@ void TextureCube::allocate(unsigned level) throw invalid_operation("TextureCube::allocate"); if(level>=levels) throw invalid_argument("TextureCube::allocate"); - if(allocated&(1<(img.get_data()); unsigned face_size = img.get_stride()*size; for(unsigned i=0; i<6; ++i) - image(enumerate_faces(i), 0, fmt, UNSIGNED_BYTE, cdata+i*face_size); + image(enumerate_faces(i), 0, comp, type, cdata+i*face_size); } unsigned TextureCube::get_n_levels() const @@ -258,6 +277,7 @@ void TextureCube::Loader::init() 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) @@ -280,16 +300,19 @@ void TextureCube::Loader::image_data(TextureCubeFace face, const string &data) void TextureCube::Loader::raw_data(TextureCubeFace face, const string &data) { - obj.image(face, 0, get_base_pixelformat(obj.ifmt), UNSIGNED_BYTE, data.data()); + obj.image(face, 0, get_components(obj.ifmt), get_component_type(obj.ifmt), data.data()); } void TextureCube::Loader::storage(PixelFormat fmt, unsigned s) { - if(srgb) - fmt = get_srgb_pixelformat(fmt); 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) {