X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Ftexture3d.cpp;h=70dcf7725568bef6637f18cf95fe1d89e5c61493;hb=656b4577fccfb02bea747871e5ab10148f002443;hp=7edc908098c73ed0866ff6d9733874f4efa7993d;hpb=7e9e15a12fb398798f2719545cc8553354c1e389;p=libs%2Fgl.git diff --git a/source/texture3d.cpp b/source/texture3d.cpp index 7edc9080..70dcf772 100644 --- a/source/texture3d.cpp +++ b/source/texture3d.cpp @@ -22,12 +22,13 @@ Texture3D::Texture3D(): Texture(GL_TEXTURE_3D), width(0), height(0), - depth(0) + depth(0), + allocated(0) { static RequireVersion _ver(1, 2); } -void Texture3D::storage(PixelFormat f, unsigned w, unsigned h, unsigned d, int b) +void Texture3D::storage(PixelFormat f, unsigned w, unsigned h, unsigned d) { if(width>0) throw InvalidState("Textures storage may only be specified once"); @@ -38,18 +39,43 @@ void Texture3D::storage(PixelFormat f, unsigned w, unsigned h, unsigned d, int b height = h; depth = d; ifmt = f; - border = b; +} + +void Texture3D::allocate(unsigned level) +{ + if(allocated&(1<>=1, h>>=1, d>>=1, ++level) ; + allocated |= (1<>= level; + h >>= level; + d >>= level; + + if(!w && (h || d)) + w = 1; + if(!h && (w || d)) + h = 1; + if(!d && (w || h)) + d = 1; +} + } // namespace GL } // namespace Msp