Added support for ETC2/EAC compressed textures. Changed the CompressedFormat enum names to capitalize the format names (e.g. "PVR1rgba4" instead of "pvr1rgba4".) Improved sRGB support for compressed textures.

--HG--
branch : minor
This commit is contained in:
Alex Szpakowski
2015-01-20 07:53:44 -04:00
parent c1d4613ff7
commit 18ab3973e8
15 changed files with 170 additions and 52 deletions
+17 -1
View File
@@ -74,6 +74,21 @@ CompressedData::Format convertFormat(uint16 texformat)
{
case ETC1_RGB_NO_MIPMAPS:
return CompressedData::FORMAT_ETC1;
case ETC2PACKAGE_RGB_NO_MIPMAPS:
return CompressedData::FORMAT_ETC2_RGB;
case ETC2PACKAGE_RGBA_NO_MIPMAPS_OLD:
case ETC2PACKAGE_RGBA_NO_MIPMAPS:
return CompressedData::FORMAT_ETC2_RGBA;
case ETC2PACKAGE_RGBA1_NO_MIPMAPS:
return CompressedData::FORMAT_ETC2_RGBA1;
case ETC2PACKAGE_R_NO_MIPMAPS:
return CompressedData::FORMAT_EAC_R;
case ETC2PACKAGE_RG_NO_MIPMAPS:
return CompressedData::FORMAT_EAC_RG;
case ETC2PACKAGE_R_SIGNED_NO_MIPMAPS:
return CompressedData::FORMAT_EAC_Rs;
case ETC2PACKAGE_RG_SIGNED_NO_MIPMAPS:
return CompressedData::FORMAT_EAC_RGs;
default:
return CompressedData::FORMAT_UNKNOWN;
}
@@ -98,7 +113,7 @@ bool PKMHandler::canParse(const filesystem::FileData *data)
return true;
}
uint8 *PKMHandler::parse(filesystem::FileData *filedata, std::vector<CompressedData::SubImage> &images, size_t &dataSize, CompressedData::Format &format)
uint8 *PKMHandler::parse(filesystem::FileData *filedata, std::vector<CompressedData::SubImage> &images, size_t &dataSize, CompressedData::Format &format, bool &sRGB)
{
if (!canParse(filedata))
throw love::Exception("Could not decode compressed data (not a PKM file?)");
@@ -146,6 +161,7 @@ uint8 *PKMHandler::parse(filesystem::FileData *filedata, std::vector<CompressedD
dataSize = totalsize;
format = cformat;
sRGB = false;
return data;
}