Added support for explitly requesting DXT1a and DXT1c compression
This commit is contained in:
parent
f0f31e4a8c
commit
e7e860b742
@ -447,7 +447,9 @@ class OSG_EXPORT Texture : public osg::StateAttribute
|
|||||||
USE_S3TC_DXT3_COMPRESSION,
|
USE_S3TC_DXT3_COMPRESSION,
|
||||||
USE_S3TC_DXT5_COMPRESSION,
|
USE_S3TC_DXT5_COMPRESSION,
|
||||||
USE_RGTC1_COMPRESSION,
|
USE_RGTC1_COMPRESSION,
|
||||||
USE_RGTC2_COMPRESSION
|
USE_RGTC2_COMPRESSION,
|
||||||
|
USE_S3TC_DXT1c_COMPRESSION,
|
||||||
|
USE_S3TC_DXT1a_COMPRESSION
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Sets the internal texture format mode. Note: If the texture format is
|
/** Sets the internal texture format mode. Note: If the texture format is
|
||||||
|
@ -1299,6 +1299,36 @@ void Texture::computeInternalFormatWithImage(const osg::Image& image) const
|
|||||||
else internalFormat = image.getInternalTextureFormat();
|
else internalFormat = image.getInternalTextureFormat();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case(USE_S3TC_DXT1c_COMPRESSION):
|
||||||
|
if (extensions->isTextureCompressionS3TCSupported())
|
||||||
|
{
|
||||||
|
switch(image.getPixelFormat())
|
||||||
|
{
|
||||||
|
case(3):
|
||||||
|
case(4):
|
||||||
|
case(GL_RGB):
|
||||||
|
case(GL_RGBA): internalFormat = GL_COMPRESSED_RGB_S3TC_DXT1_EXT; break;
|
||||||
|
default: internalFormat = image.getInternalTextureFormat(); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else internalFormat = image.getInternalTextureFormat();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case(USE_S3TC_DXT1a_COMPRESSION):
|
||||||
|
if (extensions->isTextureCompressionS3TCSupported())
|
||||||
|
{
|
||||||
|
switch(image.getPixelFormat())
|
||||||
|
{
|
||||||
|
case(3):
|
||||||
|
case(4):
|
||||||
|
case(GL_RGB):
|
||||||
|
case(GL_RGBA): internalFormat = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT; break;
|
||||||
|
default: internalFormat = image.getInternalTextureFormat(); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else internalFormat = image.getInternalTextureFormat();
|
||||||
|
break;
|
||||||
|
|
||||||
case(USE_S3TC_DXT3_COMPRESSION):
|
case(USE_S3TC_DXT3_COMPRESSION):
|
||||||
if (extensions->isTextureCompressionS3TCSupported())
|
if (extensions->isTextureCompressionS3TCSupported())
|
||||||
{
|
{
|
||||||
|
@ -177,7 +177,8 @@ struct DDSURFACEDESC2
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Structure of a DXT-1 compressed texture block
|
// Structure of a DXT-1 compressed texture block
|
||||||
// see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/Opaque_and_1_Bit_Alpha_Textures.asp
|
// see page "Opaque and 1-Bit Alpha Textures (Direct3D 9)" on http://msdn.microsoft.com
|
||||||
|
// url at time of writing http://msdn.microsoft.com/en-us/library/bb147243(v=VS.85).aspx
|
||||||
//
|
//
|
||||||
struct DXT1TexelsBlock
|
struct DXT1TexelsBlock
|
||||||
{
|
{
|
||||||
|
@ -307,6 +307,12 @@ void NVTTProcessor::compress(osg::Image& image, osg::Texture::InternalFormatMode
|
|||||||
else
|
else
|
||||||
format = nvtt::Format_DXT1;
|
format = nvtt::Format_DXT1;
|
||||||
break;
|
break;
|
||||||
|
case osg::Texture::USE_S3TC_DXT1c_COMPRESSION:
|
||||||
|
format = nvtt::Format_DXT1;
|
||||||
|
break;
|
||||||
|
case osg::Texture::USE_S3TC_DXT1a_COMPRESSION:
|
||||||
|
format = nvtt::Format_DXT1a;
|
||||||
|
break;
|
||||||
case osg::Texture::USE_S3TC_DXT3_COMPRESSION:
|
case osg::Texture::USE_S3TC_DXT3_COMPRESSION:
|
||||||
format = nvtt::Format_DXT3;
|
format = nvtt::Format_DXT3;
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user