texturec: Added PVR1 RGB/A 4-bpp compression.

This commit is contained in:
Branimir Karadžić 2015-12-22 18:05:06 -08:00
parent c82d3e86d9
commit 69a0f6fa4e
22 changed files with 1615 additions and 0 deletions

View file

@ -14,6 +14,7 @@
#include <libsquish/squish.h>
#include <etc1/etc1.h>
#include <nvtt/nvtt.h>
#include <pvrtc/PvrTcEncoder.h>
#if 0
# define BX_TRACE(_format, ...) fprintf(stderr, "" _format "\n", ##__VA_ARGS__)
@ -76,9 +77,35 @@ namespace bgfx
case TextureFormat::ETC2A:
case TextureFormat::ETC2A1:
case TextureFormat::PTC12:
break;
case TextureFormat::PTC14:
{
using namespace Javelin;
RgbBitmap bmp;
bmp.width = _width;
bmp.height = _height;
bmp.data = const_cast<uint8_t*>(_src);
PvrTcEncoder::EncodeRgb4Bpp(_dst, bmp);
bmp.data = NULL;
}
break;
case TextureFormat::PTC12A:
break;
case TextureFormat::PTC14A:
{
using namespace Javelin;
RgbaBitmap bmp;
bmp.width = _width;
bmp.height = _height;
bmp.data = const_cast<uint8_t*>(_src);
PvrTcEncoder::EncodeRgba4Bpp(_dst, bmp);
bmp.data = NULL;
}
break;
case TextureFormat::PTC22:
case TextureFormat::PTC24:
break;
@ -178,6 +205,14 @@ int main(int _argc, const char* _argv[])
{
format = TextureFormat::BC7;
}
else if (0 == bx::stricmp(type, "ptc14") )
{
format = TextureFormat::PTC14;
}
else if (0 == bx::stricmp(type, "ptc14a") )
{
format = TextureFormat::PTC14A;
}
}
uint32_t size = (uint32_t)bx::getSize(&reader);