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

View File

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