Improvements to handling smoothing

This commit is contained in:
Robert Osfield 2005-03-11 09:53:13 +00:00
parent fd84431d36
commit cc439f11c7

View File

@ -476,7 +476,9 @@ void DataSet::SourceData::readImage(DestinationData& destination)
const float resizeTolerance = 1.1; const float resizeTolerance = 1.1;
bool interpolateSourceImagery = true; bool interpolateSourceImagery = true;
if (interpolateSourceImagery && (destWindowWidthRatio>resizeTolerance || destWindowHeightRatio>resizeTolerance)) if (interpolateSourceImagery &&
(destWindowWidthRatio>resizeTolerance || destWindowHeightRatio>resizeTolerance) &&
windowWidth>=2 && windowHeight>=2)
{ {
readWidth = windowWidth; readWidth = windowWidth;
readHeight = windowHeight; readHeight = windowHeight;
@ -712,9 +714,6 @@ void DataSet::SourceData::readImage(DestinationData& destination)
tempImage = destImage; tempImage = destImage;
} }
// now copy into destination image // now copy into destination image
unsigned char* sourceRowPtr = tempImage; unsigned char* sourceRowPtr = tempImage;
unsigned int sourceRowDelta = pixelSpace*destWidth; unsigned int sourceRowDelta = pixelSpace*destWidth;
@ -2198,11 +2197,19 @@ osg::StateSet* DataSet::DestinationTile::createStateSet()
bool compressedImageSupported = inlineImageFile || imageExension==".dds"; bool compressedImageSupported = inlineImageFile || imageExension==".dds";
bool mipmapImageSupported = inlineImageFile; bool mipmapImageSupported = inlineImageFile;
int minumCompressedTextureSize = 64;
int minumDXT3CompressedTextureSize = 256;
if (compressedImageSupported && if (compressedImageSupported &&
image->s()>=minumCompressedTextureSize && image->t()>=minumCompressedTextureSize &&
_dataSet->getTextureType()==COMPRESSED_TEXTURE && _dataSet->getTextureType()==COMPRESSED_TEXTURE &&
(image->getPixelFormat()==GL_RGB || image->getPixelFormat()==GL_RGBA)) (image->getPixelFormat()==GL_RGB || image->getPixelFormat()==GL_RGBA))
{ {
if (image->s()>=minumDXT3CompressedTextureSize && image->t()>=minumDXT3CompressedTextureSize)
texture->setInternalFormatMode(osg::Texture::USE_S3TC_DXT3_COMPRESSION); texture->setInternalFormatMode(osg::Texture::USE_S3TC_DXT3_COMPRESSION);
else
texture->setInternalFormatMode(osg::Texture::USE_S3TC_DXT5_COMPRESSION);
osg::ref_ptr<osg::State> state = new osg::State; osg::ref_ptr<osg::State> state = new osg::State;
@ -2236,7 +2243,20 @@ osg::StateSet* DataSet::DestinationTile::createStateSet()
if (mipmapImageSupported && _dataSet->getMipMappingMode()==DataSet::MIP_MAPPING_IMAGERY) if (mipmapImageSupported && _dataSet->getMipMappingMode()==DataSet::MIP_MAPPING_IMAGERY)
{ {
my_notify(osg::NOTICE)<<"Non compressed mipmapped not yet supported yet"<<std::endl;
osg::ref_ptr<osg::State> state = new osg::State;
// get OpenGL driver to create texture from image.
texture->apply(*state);
image->readImageFromCurrentTexture(0,true);
texture->setInternalFormatMode(osg::Texture::USE_IMAGE_DATA_FORMAT);
texture->dirtyTextureObject();
my_notify(osg::INFO)<<">>>>>>>>>>>>>>>mip mapped image.<<<<<<<<<<<<<<"<<std::endl;
} }
} }
} }