Fix DXT1a single color compressor. Compare alpha against 0 instead of 128. Fixes issue 134.

2.0
castano 14 years ago
parent 2996120fe2
commit dcdeead859

@ -4,6 +4,7 @@ NVIDIA Texture Tools version 2.0.9
* Fix the C wrapper and provide methods involving callbacks. * Fix the C wrapper and provide methods involving callbacks.
* Improve C# / .NET Wrapper * Improve C# / .NET Wrapper
* Add an XNA Game Studio 3.1 Content Processor to make it easy to utilize NVIDIA Texture Tools in XNA applications. * Add an XNA Game Studio 3.1 Content Processor to make it easy to utilize NVIDIA Texture Tools in XNA applications.
* Fix single color DXT1a compressor. Fixes issue 134.
NVIDIA Texture Tools version 2.0.8 NVIDIA Texture Tools version 2.0.8
* Fix float to fixed image conversion. Patch provided by Alex Pfaffe. Fixes issue 121. * Fix float to fixed image conversion. Patch provided by Alex Pfaffe. Fixes issue 121.

@ -255,7 +255,7 @@ void nv::SlowCompressor::compressDXT1a(const CompressionOptions::Private & compr
for (uint i = 0; i < 16; i++) for (uint i = 0; i < 16; i++)
{ {
if (rgba.color(i).a < 128) anyAlpha = true; if (rgba.color(i).a == 0) anyAlpha = true;
else allAlpha = false; else allAlpha = false;
} }

@ -205,7 +205,7 @@ void OptimalCompress::compressDXT1(Color32 c, BlockDXT1 * dxtBlock)
void OptimalCompress::compressDXT1a(Color32 rgba, BlockDXT1 * dxtBlock) void OptimalCompress::compressDXT1a(Color32 rgba, BlockDXT1 * dxtBlock)
{ {
if (rgba.a < 128) if (rgba.a == 0)
{ {
dxtBlock->col0.u = 0; dxtBlock->col0.u = 0;
dxtBlock->col1.u = 0; dxtBlock->col1.u = 0;

@ -483,7 +483,7 @@ void QuickCompress::compressDXT1a(const ColorBlock & rgba, BlockDXT1 * dxtBlock)
for (uint i = 0; i < 16; i++) for (uint i = 0; i < 16; i++)
{ {
if (rgba.color(i).a < 128) { if (rgba.color(i).a == 0) {
hasAlpha = true; hasAlpha = true;
break; break;
} }

@ -419,6 +419,11 @@ int main(int argc, char *argv[])
// compressionOptions.setPixelFormat(16, 0, 0, 0); // compressionOptions.setPixelFormat(16, 0, 0, 0);
} }
} }
if (format == nvtt::Format_BC1a) {
compressionOptions.setQuantization(false, true, true, 127);
}
if (fast) if (fast)
{ {
compressionOptions.setQuality(nvtt::Quality_Fastest); compressionOptions.setQuality(nvtt::Quality_Fastest);

Loading…
Cancel
Save