From Rommano Silva, admendments to Texture::computeRequiredTextureDimensions

so that it takes into account the current mip map settings.
This commit is contained in:
Robert Osfield
2003-12-27 11:30:41 +00:00
parent 177eb76244
commit 2cb360dd38

View File

@@ -516,20 +516,31 @@ void Texture::computeRequiredTextureDimensions(State& state, const osg::Image& i
inwidth = width;
inheight = height;
numMipmapLevels = 0;
for( ; (width || height) ;++numMipmapLevels)
bool useHardwareMipMapGeneration = !image.isMipmap() && _useHardwareMipMapGeneration && extensions->isGenerateMipMapSupported();
if( _min_filter == LINEAR || _min_filter == NEAREST || useHardwareMipMapGeneration )
{
numMipmapLevels = 1;
}
else if( image.isMipmap() )
{
numMipmapLevels = image.getNumMipmapLevels();
}
else
{
numMipmapLevels = 0;
for( ; (width || height) ;++numMipmapLevels)
{
if (width == 0)
width = 1;
if (height == 0)
height = 1;
if (width == 0)
width = 1;
if (height == 0)
height = 1;
width >>= 1;
height >>= 1;
}
width >>= 1;
height >>= 1;
}
}
}
bool Texture::areAllTextureObjectsLoaded() const