Fix fixed to float image conversion. Patch provided by Alex Pfaffe. Fixes issue 121.

This commit is contained in:
castano 2010-05-09 06:58:47 +00:00
parent 68ff9ffd76
commit 20606def7c
2 changed files with 6 additions and 6 deletions

View File

@ -1,4 +1,5 @@
NVIDIA Texture Tools version 2.0.8 NVIDIA Texture Tools version 2.0.8
* Fix float to fixed image conversion. Patch provided by Alex Pfaffe. Fixes issue 121.
* ColorBlock::isSingleColor compares only RGB channels. Fixes issue 115. * ColorBlock::isSingleColor compares only RGB channels. Fixes issue 115.
* Fix cmake build in msvc. Fixes issue 111. * Fix cmake build in msvc. Fixes issue 111.
* Better estimate principal component. Fixes issue 120. * Better estimate principal component. Fixes issue 120.

View File

@ -126,10 +126,8 @@ namespace nvtt
// Convert linear float image to fixed image ready for compression. // Convert linear float image to fixed image ready for compression.
void toFixedImage(const InputOptions::Private & inputOptions) void toFixedImage(const InputOptions::Private & inputOptions)
{ {
if (this->asFixedImage() == NULL) if (m_floatImage != NULL) // apfaffe - We should check that we have a float image, if so convert it!
{ {
nvDebugCheck(m_floatImage != NULL);
if (inputOptions.isNormalMap || inputOptions.outputGamma == 1.0f) if (inputOptions.isNormalMap || inputOptions.outputGamma == 1.0f)
{ {
m_fixedImage = m_floatImage->createImage(); m_fixedImage = m_floatImage->createImage();
@ -175,12 +173,13 @@ namespace nvtt
const Image * asFixedImage() const const Image * asFixedImage() const
{ {
if (m_inputImage != NULL) // - apfaffe - switched logic to return the 'processed image' rather than the input!
if (m_fixedImage != NULL && m_fixedImage.ptr() != NULL)
{ {
return m_inputImage;
}
return m_fixedImage.ptr(); return m_fixedImage.ptr();
} }
return m_inputImage;
}
Image * asMutableFixedImage() Image * asMutableFixedImage()
{ {