From 34cd266d8c3c71831cfbae6df0c29bcb062c776f Mon Sep 17 00:00:00 2001 From: castano Date: Wed, 21 Oct 2009 19:19:09 +0000 Subject: [PATCH] Add todo item to perform color transforms before compression. --- src/nvtt/Context.cpp | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/src/nvtt/Context.cpp b/src/nvtt/Context.cpp index 9624de9..020c5f8 100644 --- a/src/nvtt/Context.cpp +++ b/src/nvtt/Context.cpp @@ -917,6 +917,8 @@ bool Compressor::Private::compressMipmaps(uint f, const InputOptions::Private & premultiplyAlphaMipmap(mipmap, inputOptions); } +#pragma message(NV_FILE_LINE "TODO: All color transforms should be done here!") + // Apply gamma space color transforms: if (inputOptions.colorTransform == ColorTransform_YCoCg) { @@ -928,6 +930,28 @@ bool Compressor::Private::compressMipmaps(uint f, const InputOptions::Private & //ColorSpace::RGBtoYCoCg_R(mipmap.asMutableFixedImage()); } + /*// Apply linear transforms in linear space. + if (inputOptions.colorTransform == ColorTransform_Linear) + { + FloatImage * image = mipmap.asMutableFloatImage(); + nvDebugCheck(image != NULL); + + Vector4 offset( + inputOptions.colorOffsets[0], + inputOptions.colorOffsets[1], + inputOptions.colorOffsets[2], + inputOptions.colorOffsets[3]); + + image->transform(0, inputOptions.linearTransform, offset); + } + else if (inputOptions.colorTransform == ColorTransform_Swizzle) + { + FloatImage * image = mipmap.asMutableFloatImage(); + nvDebugCheck(image != NULL); + + image->swizzle(0, inputOptions.swizzleTransform[0], inputOptions.swizzleTransform[1], inputOptions.swizzleTransform[2], inputOptions.swizzleTransform[3]); + }*/ + quantizeMipmap(mipmap, compressionOptions); } @@ -1173,7 +1197,9 @@ void Compressor::Private::processInputImage(Mipmap & mipmap, const InputOptions: mipmap.toFloatImage(inputOptions); } - // Apply linear transforms in linear space. +#pragma message(NV_FILE_LINE "FIXME: Do not perform color transforms here!") + + /*// Apply linear transforms in linear space. if (inputOptions.colorTransform == ColorTransform_Linear) { FloatImage * image = mipmap.asMutableFloatImage(); @@ -1193,7 +1219,7 @@ void Compressor::Private::processInputImage(Mipmap & mipmap, const InputOptions: nvDebugCheck(image != NULL); image->swizzle(0, inputOptions.swizzleTransform[0], inputOptions.swizzleTransform[1], inputOptions.swizzleTransform[2], inputOptions.swizzleTransform[3]); - } + }*/ } }