Added preset for converting gsi images

Signed-off-by: Chris Galvan <chgalvan@amazon.com>
This commit is contained in:
Chris Galvan
2022-02-01 15:32:53 -06:00
parent ff4529fc60
commit 85b8177efa
8 changed files with 277 additions and 4 deletions
@@ -50,7 +50,9 @@ namespace ImageProcessingAtom
->Field("NumberResidentMips", &PresetSettings::m_numResidentMips)
->Field("Swizzle", &PresetSettings::m_swizzle)
->Field("CubemapSettings", &PresetSettings::m_cubemapSetting)
->Field("MipMapSetting", &PresetSettings::m_mipmapSetting);
->Field("MipMapSetting", &PresetSettings::m_mipmapSetting)
->Field("UncompressedAutoPick", &PresetSettings::m_uncompressedAutoPick)
;
serialize->Enum<RGBWeight>()
->Value("Uniform", RGBWeight::uniform)
@@ -200,7 +202,9 @@ namespace ImageProcessingAtom
m_glossFromNormals == other.m_glossFromNormals &&
m_swizzle == other.m_swizzle &&
m_isMipRenormalize == other.m_isMipRenormalize &&
m_numResidentMips == other.m_numResidentMips;
m_numResidentMips == other.m_numResidentMips &&
m_uncompressedAutoPick == other.m_uncompressedAutoPick
;
}
void PresetSettings::DeepCopyMembers(const PresetSettings& other)
@@ -237,6 +241,7 @@ namespace ImageProcessingAtom
m_swizzle = other.m_swizzle;
m_isMipRenormalize = other.m_isMipRenormalize;
m_numResidentMips = other.m_numResidentMips;
m_uncompressedAutoPick = other.m_uncompressedAutoPick;
}
}
@@ -103,6 +103,10 @@ namespace ImageProcessingAtom
//"swizzle". need to be 4 character and each character need to be one of "rgba01"
AZStd::string m_swizzle;
//! Convert to an uncompressed pixel format that automatically picks a preferred pixel
//! format based on the source input
bool m_uncompressedAutoPick = false;
protected:
void DeepCopyMembers(const PresetSettings& other);
};
@@ -535,7 +535,18 @@ namespace ImageProcessingAtom
m_image->GetCompressOption().rgbWeight = m_input->m_presetSetting.GetColorWeight();
m_image->GetCompressOption().discardAlpha = m_input->m_presetSetting.m_discardAlpha;
m_image->ConvertFormat(m_input->m_presetSetting.m_pixelFormat);
// If the m_uncompressedAutoPick flag is set, then let the converter pick
// a pixel format that best matches the source input format
if (m_input->m_presetSetting.m_uncompressedAutoPick)
{
EPixelFormat sourceInputFormat = m_input->m_inputImage->GetPixelFormat();
m_image->ConvertFormat(sourceInputFormat);
}
// Otherwise, convert to the pixel format specified by the preset that was chosen
else
{
m_image->ConvertFormat(m_input->m_presetSetting.m_pixelFormat);
}
return true;
}