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

2.0
castano 14 years ago
parent 68ff9ffd76
commit 20606def7c

@ -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.

@ -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,11 +173,12 @@ 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()

Loading…
Cancel
Save