X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Ftexturecube.cpp;h=824ff2cc14d29743bf3e8adadd4709936a5f712d;hb=2ba5af95fb7341b0e6b212e28d03208c6747aae5;hp=8306324153747078300a9b593d392d78f91cd5a6;hpb=8ed377139d48a6fc39eeed9f3494bbe41aed4107;p=libs%2Fgl.git diff --git a/source/texturecube.cpp b/source/texturecube.cpp index 83063241..824ff2cc 100644 --- a/source/texturecube.cpp +++ b/source/texturecube.cpp @@ -58,7 +58,7 @@ void TextureCube::storage(PixelFormat fmt, unsigned sz, unsigned lv) if(sz==0) throw invalid_argument("TextureCube::storage"); - set_internal_format(fmt); + set_format(fmt); size = sz; levels = get_n_levels(); if(lv>0) @@ -71,25 +71,24 @@ 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, cdata+i*face_size); } unsigned TextureCube::get_n_levels() const @@ -236,7 +270,7 @@ Vector3 TextureCube::get_texel_direction(TextureCubeFace face, unsigned u, unsig UInt64 TextureCube::get_data_size() const { - return id ? size*size*6*get_pixel_size(ifmt) : 0; + return id ? size*size*6*get_pixel_size(storage_fmt) : 0; } @@ -258,6 +292,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,7 +315,7 @@ 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, data.data()); } void TextureCube::Loader::storage(PixelFormat fmt, unsigned s) @@ -288,6 +323,11 @@ 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) {