ABI/API: Restore InputOptions::setColorTransform(ColorTransform)
The only colortransform actually implemented was the transform from RGB to YCoCG (ColorTransform_YCoCg). Restore the full enum for API compatibility, and allow the transform to be specified using InputOptions::setColortransform. Fixes part of https://github.com/castano/nvidia-texture-tools/issues/259 Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
This commit is contained in:
parent
80ca02930a
commit
a52f9cee06
@ -277,6 +277,11 @@ bool Compressor::Private::compress(const InputOptions::Private & inputOptions, c
|
||||
// Resize input.
|
||||
img.resize(w, h, d, ResizeFilter_Box);
|
||||
|
||||
// Apply color transform.
|
||||
if (inputOptions.colorTransform == ColorTransform_YCoCg) {
|
||||
img.toYCoCg();
|
||||
}
|
||||
|
||||
nvtt::Surface tmp = img;
|
||||
if (!img.isNormalMap()) {
|
||||
tmp.toGamma(inputOptions.outputGamma);
|
||||
|
@ -104,6 +104,8 @@ void InputOptions::reset()
|
||||
m.inputGamma = 2.2f;
|
||||
m.outputGamma = 2.2f;
|
||||
|
||||
m.colorTransform = ColorTransform_None;
|
||||
|
||||
m.generateMipmaps = true;
|
||||
m.maxLevel = -1;
|
||||
m.mipmapFilter = MipmapFilter_Box;
|
||||
@ -337,6 +339,12 @@ void InputOptions::setNormalizeMipmaps(bool normalize)
|
||||
m.normalizeMipmaps = normalize;
|
||||
}
|
||||
|
||||
// Set color transform.
|
||||
void InputOptions::setColorTransform(ColorTransform t)
|
||||
{
|
||||
m.colorTransform = t;
|
||||
}
|
||||
|
||||
// Set linear transform for the given channel.
|
||||
// Stub for ABI compatibily, never implemented
|
||||
void InputOptions::setLinearTransform(int, float, float, float, float)
|
||||
|
@ -55,6 +55,9 @@ namespace nvtt
|
||||
float inputGamma;
|
||||
float outputGamma;
|
||||
|
||||
// Color transform.
|
||||
ColorTransform colorTransform;
|
||||
|
||||
// Mipmap generation options.
|
||||
bool generateMipmaps;
|
||||
int maxLevel;
|
||||
|
@ -249,6 +249,17 @@ namespace nvtt
|
||||
ResizeFilter_Mitchell,
|
||||
};
|
||||
|
||||
// Color transformation.
|
||||
// deprecated since 2.1.0
|
||||
enum ColorTransform
|
||||
{
|
||||
ColorTransform_None,
|
||||
ColorTransform_Linear,
|
||||
ColorTransform_Swizzle,
|
||||
ColorTransform_YCoCg,
|
||||
ColorTransform_ScaledYCoCg,
|
||||
};
|
||||
|
||||
// Extents rounding mode.
|
||||
enum RoundMode
|
||||
{
|
||||
@ -323,6 +334,7 @@ namespace nvtt
|
||||
NVTT_API void setNormalizeMipmaps(bool b);
|
||||
|
||||
// Set color transforms.
|
||||
NVTT_API void setColorTransform(ColorTransform t);
|
||||
NVTT_API void setLinearTransform(int channel, float w0, float w1, float w2, float w3);
|
||||
|
||||
// Set resizing options.
|
||||
|
Loading…
Reference in New Issue
Block a user