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

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

@ -121,6 +121,15 @@ namespace nvtt
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.
struct CompressionOptions
{
@ -148,6 +157,8 @@ namespace nvtt
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.
NVTT_API unsigned int d3d9Format() const;
//NVTT_API bool setD3D9Format(unsigned int format);
@ -377,14 +388,6 @@ namespace nvtt
typedef Compressor Context;
/// DXT decoder.
enum Decoder
{
Decoder_D3D10,
Decoder_D3D9,
Decoder_NV5x,
};
/// A texture mipmap.
struct TexImage
{

Loading…
Cancel
Save