Add target decoder compression option.

pull/216/head
castano 13 years ago
parent cd6f798b85
commit b74cd8ec97

@ -69,6 +69,8 @@ void CompressionOptions::reset()
m.enableAlphaDithering = false; m.enableAlphaDithering = false;
m.binaryAlpha = false; m.binaryAlpha = false;
m.alphaThreshold = 127; m.alphaThreshold = 127;
m.decoder = Decoder_D3D10;
} }
@ -185,6 +187,13 @@ void CompressionOptions::setQuantization(bool colorDithering, bool alphaDitherin
m.alphaThreshold = alphaThreshold; m.alphaThreshold = alphaThreshold;
} }
/// Set target decoder to optimize for.
void CompressionOptions::setTargetDecoder(Decoder decoder)
{
m.decoder = decoder;
}
// Translate to and from D3D formats. // Translate to and from D3D formats.
unsigned int CompressionOptions::d3d9Format() const unsigned int CompressionOptions::d3d9Format() const

@ -32,45 +32,47 @@
namespace nvtt namespace nvtt
{ {
struct CompressionOptions::Private struct CompressionOptions::Private
{ {
Format format; Format format;
Quality quality; Quality quality;
nv::Vector4 colorWeight; nv::Vector4 colorWeight;
// Pixel format description. // Pixel format description.
uint bitcount; uint bitcount;
uint rmask; uint rmask;
uint gmask; uint gmask;
uint bmask; uint bmask;
uint amask; uint amask;
uint8 rsize; uint8 rsize;
uint8 gsize; uint8 gsize;
uint8 bsize; uint8 bsize;
uint8 asize; uint8 asize;
PixelType pixelType; PixelType pixelType;
uint pitchAlignment; uint pitchAlignment;
nv::String externalCompressor; nv::String externalCompressor;
// Quantization.
bool enableColorDithering;
bool enableAlphaDithering;
bool binaryAlpha;
int alphaThreshold; // reference value used for binary alpha quantization.
// Quantization. Decoder decoder;
bool enableColorDithering;
bool enableAlphaDithering;
bool binaryAlpha;
int alphaThreshold; // reference value used for binary alpha quantization.
uint getBitCount() const uint getBitCount() const
{ {
if (format == Format_RGBA) { if (format == Format_RGBA) {
if (bitcount != 0) return bitcount; if (bitcount != 0) return bitcount;
else return rsize + gsize + bsize + asize; else return rsize + gsize + bsize + asize;
} }
return 0; return 0;
} }
}; };
} // nvtt namespace } // nvtt namespace

@ -121,6 +121,15 @@ namespace nvtt
Quality_Highest, Quality_Highest,
}; };
/// DXT decoder.
enum Decoder
{
Decoder_D3D10,
Decoder_D3D9,
Decoder_NV5x,
};
/// Compression options. This class describes the desired compression format and other compression settings. /// Compression options. This class describes the desired compression format and other compression settings.
struct CompressionOptions struct CompressionOptions
{ {
@ -148,6 +157,8 @@ namespace nvtt
NVTT_API void setQuantization(bool colorDithering, bool alphaDithering, bool binaryAlpha, int alphaThreshold = 127); NVTT_API void setQuantization(bool colorDithering, bool alphaDithering, bool binaryAlpha, int alphaThreshold = 127);
NVTT_API void setTargetDecoder(Decoder decoder);
// Translate to and from D3D formats. // Translate to and from D3D formats.
NVTT_API unsigned int d3d9Format() const; NVTT_API unsigned int d3d9Format() const;
//NVTT_API bool setD3D9Format(unsigned int format); //NVTT_API bool setD3D9Format(unsigned int format);
@ -377,14 +388,6 @@ namespace nvtt
typedef Compressor Context; typedef Compressor Context;
/// DXT decoder.
enum Decoder
{
Decoder_D3D10,
Decoder_D3D9,
Decoder_NV5x,
};
/// A texture mipmap. /// A texture mipmap.
struct TexImage struct TexImage
{ {

Loading…
Cancel
Save