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 635f460dd5
commit 96618a2e26
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,11 +69,11 @@ 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 (_TextureCacheActive && _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);
@ -91,7 +91,7 @@ SGSceneFeatures::applyTextureCompression(osg::Texture* texture) const
texture->setInternalFormatMode(osg::Texture::USE_IMAGE_DATA_FORMAT); texture->setInternalFormatMode(osg::Texture::USE_IMAGE_DATA_FORMAT);
break; break;
} }
#endif }
} }
bool bool