Add single color compressor for DXT1a.
This commit is contained in:
parent
07df6e7539
commit
3d1b9324e1
|
@ -4,6 +4,7 @@ NVIDIA Texture Tools version 2.0.2
|
||||||
* Fix vc8 post build command, reported by Richard Sim.
|
* Fix vc8 post build command, reported by Richard Sim.
|
||||||
* Fix RGBA modes with less than 32 bpp by Viktor Linder.
|
* Fix RGBA modes with less than 32 bpp by Viktor Linder.
|
||||||
* Fix alpha decompression by amorilia. See issue 40.
|
* Fix alpha decompression by amorilia. See issue 40.
|
||||||
|
* Add single color compresor for DXT1a.
|
||||||
|
|
||||||
NVIDIA Texture Tools version 2.0.1
|
NVIDIA Texture Tools version 2.0.1
|
||||||
* Fix memory leaks.
|
* Fix memory leaks.
|
||||||
|
|
|
@ -97,7 +97,16 @@ void nv::fastCompressDXT1a(const Image * image, const OutputOptions::Private & o
|
||||||
for (uint y = 0; y < h; y += 4) {
|
for (uint y = 0; y < h; y += 4) {
|
||||||
for (uint x = 0; x < w; x += 4) {
|
for (uint x = 0; x < w; x += 4) {
|
||||||
rgba.init(image, x, y);
|
rgba.init(image, x, y);
|
||||||
|
|
||||||
|
// @@ We could do better here: check for single RGB, but varying alpha.
|
||||||
|
if (rgba.isSingleColor())
|
||||||
|
{
|
||||||
|
QuickCompress::compressDXT1a(rgba.color(0), &block);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
QuickCompress::compressDXT1a(rgba, &block);
|
QuickCompress::compressDXT1a(rgba, &block);
|
||||||
|
}
|
||||||
|
|
||||||
if (outputOptions.outputHandler != NULL) {
|
if (outputOptions.outputHandler != NULL) {
|
||||||
outputOptions.outputHandler->writeData(&block, sizeof(block));
|
outputOptions.outputHandler->writeData(&block, sizeof(block));
|
||||||
|
@ -192,7 +201,7 @@ void nv::fastCompressBC5(const Image * image, const nvtt::OutputOptions::Private
|
||||||
|
|
||||||
void nv::doPrecomputation()
|
void nv::doPrecomputation()
|
||||||
{
|
{
|
||||||
static bool done = false; // @@ Stop using statics for reentrancy.
|
static bool done = false; // @@ Stop using statics for reentrancy. Although the worst that could happen is that this stuff is precomputed multiple times.
|
||||||
|
|
||||||
if (!done)
|
if (!done)
|
||||||
{
|
{
|
||||||
|
@ -257,10 +266,16 @@ void nv::compressDXT1a(const Image * image, const OutputOptions::Private & outpu
|
||||||
|
|
||||||
rgba.init(image, x, y);
|
rgba.init(image, x, y);
|
||||||
|
|
||||||
// Compress color.
|
if (rgba.isSingleColor())
|
||||||
|
{
|
||||||
|
QuickCompress::compressDXT1a(rgba.color(0), &block);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
squish::ColourSet colours((uint8 *)rgba.colors(), squish::kDxt1|squish::kWeightColourByAlpha);
|
squish::ColourSet colours((uint8 *)rgba.colors(), squish::kDxt1|squish::kWeightColourByAlpha);
|
||||||
fit.SetColourSet(&colours, squish::kDxt1);
|
fit.SetColourSet(&colours, squish::kDxt1);
|
||||||
fit.Compress(&block);
|
fit.Compress(&block);
|
||||||
|
}
|
||||||
|
|
||||||
if (outputOptions.outputHandler != NULL) {
|
if (outputOptions.outputHandler != NULL) {
|
||||||
outputOptions.outputHandler->writeData(&block, sizeof(block));
|
outputOptions.outputHandler->writeData(&block, sizeof(block));
|
||||||
|
|
|
@ -555,6 +555,20 @@ void QuickCompress::compressDXT1(const ColorBlock & rgba, BlockDXT1 * dxtBlock)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void QuickCompress::compressDXT1a(Color32 rgba, BlockDXT1 * dxtBlock)
|
||||||
|
{
|
||||||
|
if (rgba.a == 0)
|
||||||
|
{
|
||||||
|
dxtBlock->col0.u = 0;
|
||||||
|
dxtBlock->col1.u = 0;
|
||||||
|
dxtBlock->indices = 0xFFFFFFFF;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
compressDXT1(rgba, dxtBlock);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void QuickCompress::compressDXT1a(const ColorBlock & rgba, BlockDXT1 * dxtBlock)
|
void QuickCompress::compressDXT1a(const ColorBlock & rgba, BlockDXT1 * dxtBlock)
|
||||||
{
|
{
|
||||||
if (!rgba.hasAlpha())
|
if (!rgba.hasAlpha())
|
||||||
|
|
|
@ -37,8 +37,9 @@ namespace nv
|
||||||
|
|
||||||
namespace QuickCompress
|
namespace QuickCompress
|
||||||
{
|
{
|
||||||
void compressDXT1(const Color32 rgba, BlockDXT1 * dxtBlock);
|
void compressDXT1(Color32 rgba, BlockDXT1 * dxtBlock);
|
||||||
void compressDXT1(const ColorBlock & rgba, BlockDXT1 * dxtBlock);
|
void compressDXT1(const ColorBlock & rgba, BlockDXT1 * dxtBlock);
|
||||||
|
void compressDXT1a(Color32 rgba, BlockDXT1 * dxtBlock);
|
||||||
void compressDXT1a(const ColorBlock & rgba, BlockDXT1 * dxtBlock);
|
void compressDXT1a(const ColorBlock & rgba, BlockDXT1 * dxtBlock);
|
||||||
void compressDXT1G(const ColorBlock & rgba, BlockDXT1 * block);
|
void compressDXT1G(const ColorBlock & rgba, BlockDXT1 * block);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user