X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Ftexturecube.cpp;h=0e0a1fc9178dca4ebd8b4cfc55bd52185b5e5b51;hb=6cee6c490ded0981c4da3f9f4ec74a41555e1a4e;hp=ff2b28755bb3e8e37c3dbadf57f6695b24e13d83;hpb=4365124bd39bd6edbda6eaef64ec72a1a10565f8;p=libs%2Fgl.git diff --git a/source/core/texturecube.cpp b/source/core/texturecube.cpp index ff2b2875..0e0a1fc9 100644 --- a/source/core/texturecube.cpp +++ b/source/core/texturecube.cpp @@ -49,6 +49,14 @@ void TextureCube::storage(PixelFormat fmt, unsigned sz, unsigned lv) allocate(); } +void TextureCube::image(unsigned level, const void *data) +{ + const char *pixels = static_cast(data); + unsigned face_size = size*size*get_pixel_size(storage_fmt); + for(unsigned i=0; i<6; ++i) + image(static_cast(i), level, pixels+i*face_size); +} + void TextureCube::image(TextureCubeFace face, unsigned level, const void *data) { unsigned lsz = get_level_size(level); @@ -90,10 +98,7 @@ void TextureCube::image(const Graphics::Image &img, unsigned lv) else if(w!=size || h!=size) throw incompatible_data("TextureCube::image"); - const char *pixels = reinterpret_cast(img.get_pixels()); - unsigned face_size = img.get_stride()*size; - for(unsigned i=0; i<6; ++i) - image(static_cast(i), 0, pixels+i*face_size); + image(0, img.get_pixels()); } unsigned TextureCube::get_n_levels() const