X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Ftexture.cpp;h=0d7a81512e7f73f5c0a49659b4feddc16739c582;hb=be962824e72a7d5e2946ad4c0e69e01c60da30e8;hp=73dd39b6c5cf79a5662a31ff3846b8981fc677b6;hpb=d0df3ba82b187705331e2cc55d515c2d44e7f466;p=libs%2Fgl.git diff --git a/source/core/texture.cpp b/source/core/texture.cpp index 73dd39b6..0d7a8151 100644 --- a/source/core/texture.cpp +++ b/source/core/texture.cpp @@ -34,6 +34,13 @@ void Texture::set_format(PixelFormat fmt) swizzle = swiz; } +unsigned Texture::count_levels(unsigned size) +{ + unsigned n = 0; + for(; size; size>>=1, ++n) ; + return n; +} + void Texture::load_image(const string &fn, unsigned lv) { Graphics::Image img;