X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Ftexture3d.cpp;h=36afa9bcdfe9b3fc2dc1e72c5ef8d19bce06f8aa;hb=ac51b8c24d6e9e2c2e1dee7822f3957917722000;hp=8cb26e7f76713bf44932f25744aea5d31be4defd;hpb=55dbeb5e04516699b8415104e346243d5e4c48c9;p=libs%2Fgl.git diff --git a/source/texture3d.cpp b/source/texture3d.cpp index 8cb26e7f..36afa9bc 100644 --- a/source/texture3d.cpp +++ b/source/texture3d.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include "bindable.h" @@ -37,12 +38,15 @@ void Texture3D::storage(PixelFormat fmt, unsigned wd, unsigned ht, unsigned dp) throw invalid_operation("Texture3D::storage"); if(wd==0 || ht==0 || dp==0) throw invalid_argument("Texture3D::storage"); + + if(MSP_sized_internal_formats) + fmt = get_sized_pixelformat(fmt); require_pixelformat(fmt); + ifmt = fmt; width = wd; height = ht; depth = dp; - ifmt = fmt; } void Texture3D::allocate(unsigned level) @@ -50,8 +54,18 @@ void Texture3D::allocate(unsigned level) if(allocated&(1<>=1, h>>=1, d>>=1, ++level) ; - allocated |= (1<>=1, ++n) ; + return n; +} + +void Texture3D::get_level_size(unsigned level, unsigned &w, unsigned &h, unsigned &d) const { w >>= level; h >>= level;