Enable old-style texture compression

Thanks to Dany for tracking this down!
This commit is contained in:
James Turner 2020-05-05 20:40:29 +01:00
parent 898559ab31
commit 65925cccdf
2 changed files with 23 additions and 31 deletions

View File

@ -113,9 +113,6 @@ protected:
}
};
// disabling old-syle texture compression in favour of the
// texture-cache
#if 0
class SGTexCompressionVisitor : public SGTextureStateAttributeVisitor {
public:
virtual void apply(int, StateSet::RefAttributePair& refAttr)
@ -146,7 +143,6 @@ public:
}
}
};
#endif
class SGTexDataVarianceVisitor : public SGTextureStateAttributeVisitor {
public:
@ -644,12 +640,8 @@ osg::Node* OptimizeModelPolicy::optimize(osg::Node* node,
SGTexDataVarianceVisitor dataVarianceVisitor;
node->accept(dataVarianceVisitor);
// disabling old-syle texture compression in favour of the
// texture-cache
#if 0
SGTexCompressionVisitor texComp;
node->accept(texComp);
#endif
return node;
}

View File

@ -69,29 +69,29 @@ SGSceneFeatures::instance()
void
SGSceneFeatures::applyTextureCompression(osg::Texture* texture) const
{
// disable older texture-compression, since it interacts confusingly
// with the the runtime texture-cache. We always want to use
// 'USE_IMAGE_DATA_FORMAT' when the texture-cache is active, since we
// decided whether to compress (or not) prior to this point.
#if 0
switch (_textureCompression) {
case UseARBCompression:
texture->setInternalFormatMode(osg::Texture::USE_ARB_COMPRESSION);
break;
case UseDXT1Compression:
texture->setInternalFormatMode(osg::Texture::USE_S3TC_DXT1_COMPRESSION);
break;
case UseDXT3Compression:
texture->setInternalFormatMode(osg::Texture::USE_S3TC_DXT3_COMPRESSION);
break;
case UseDXT5Compression:
texture->setInternalFormatMode(osg::Texture::USE_S3TC_DXT5_COMPRESSION);
break;
default:
texture->setInternalFormatMode(osg::Texture::USE_IMAGE_DATA_FORMAT);
break;
}
#endif
// if the texture cache is active, always use the file data format
if (_TextureCacheCompressionActive) {
texture->setInternalFormatMode(osg::Texture::USE_IMAGE_DATA_FORMAT);
} else {
// keep the older texture compression working, some people need it
switch (_textureCompression) {
case UseARBCompression:
texture->setInternalFormatMode(osg::Texture::USE_ARB_COMPRESSION);
break;
case UseDXT1Compression:
texture->setInternalFormatMode(osg::Texture::USE_S3TC_DXT1_COMPRESSION);
break;
case UseDXT3Compression:
texture->setInternalFormatMode(osg::Texture::USE_S3TC_DXT3_COMPRESSION);
break;
case UseDXT5Compression:
texture->setInternalFormatMode(osg::Texture::USE_S3TC_DXT5_COMPRESSION);
break;
default:
texture->setInternalFormatMode(osg::Texture::USE_IMAGE_DATA_FORMAT);
break;
}
}
}
bool