Add support for linear and swizzle transforms. Fixes issue 4.
This commit is contained in:
@ -651,9 +651,20 @@ void Compressor::Private::processInputImage(Mipmap & mipmap, const InputOptions:
|
||||
{
|
||||
mipmap.toFloatImage(inputOptions);
|
||||
}
|
||||
}
|
||||
|
||||
// @@ Linear and swizzle color transforms should be done here.
|
||||
// Apply linear transforms in linear space.
|
||||
FloatImage * image = mipmap.asFloatImage();
|
||||
nvDebugCheck(image != NULL);
|
||||
|
||||
if (inputOptions.colorTransform == ColorTransform_Linear)
|
||||
{
|
||||
image->transform(0, inputOptions.linearTransform);
|
||||
}
|
||||
else if (inputOptions.colorTransform == ColorTransform_Swizzle)
|
||||
{
|
||||
image->swizzle(0, input.swizzleTransform[0], input.swizzleTransform[1], input.swizzleTransform[2], input.swizzleTransform[3]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -316,10 +316,10 @@ void InputOptions::setSwizzleTransform(int x, int y, int z, int w)
|
||||
nvCheck(z >= 0 && z < 3);
|
||||
nvCheck(w >= 0 && w < 3);
|
||||
|
||||
// m.xswizzle = x;
|
||||
// m.yswizzle = y;
|
||||
// m.zswizzle = z;
|
||||
// m.wswizzle = w;
|
||||
m.swizzleTransform[0] = x;
|
||||
m.swizzleTransform[1] = y;
|
||||
m.swizzleTransform[2] = z;
|
||||
m.swizzleTransform[3] = w;
|
||||
}
|
||||
|
||||
void InputOptions::setMaxExtents(int e)
|
||||
|
@ -56,6 +56,7 @@ namespace nvtt
|
||||
// Color transform.
|
||||
ColorTransform colorTransform;
|
||||
nv::Matrix linearTransform;
|
||||
uint swizzleTransform[4];
|
||||
|
||||
// Mipmap generation options.
|
||||
bool generateMipmaps;
|
||||
|
Reference in New Issue
Block a user