Merge pull request #7332 from aws-lumberyard-dev/cgalvan/AddedPresetForConvertingGSIImages
Added preset for converting gsi images
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
{
|
||||
"Type": "JsonSerialization",
|
||||
"Version": 1,
|
||||
"ClassName": "MultiplatformPresetSettings",
|
||||
"ClassData": {
|
||||
"DefaultPreset": {
|
||||
"UUID": "{C5E76E09-39FA-411F-B2E2-15B47BB6AB5F}",
|
||||
"Name": "GSI",
|
||||
"OutputTypeHandling": "UseInputFormat",
|
||||
"IsPowerOf2": true,
|
||||
"MipMapSetting": {
|
||||
"MipGenType": "Box"
|
||||
}
|
||||
},
|
||||
"PlatformsPresets": {
|
||||
"android": {
|
||||
"UUID": "{C5E76E09-39FA-411F-B2E2-15B47BB6AB5F}",
|
||||
"Name": "GSI",
|
||||
"OutputTypeHandling": "UseInputFormat",
|
||||
"MaxTextureSize": 2048,
|
||||
"IsPowerOf2": true,
|
||||
"MipMapSetting": {
|
||||
"MipGenType": "Box"
|
||||
}
|
||||
},
|
||||
"ios": {
|
||||
"UUID": "{C5E76E09-39FA-411F-B2E2-15B47BB6AB5F}",
|
||||
"Name": "GSI",
|
||||
"OutputTypeHandling": "UseInputFormat",
|
||||
"MaxTextureSize": 2048,
|
||||
"IsPowerOf2": true,
|
||||
"MipMapSetting": {
|
||||
"MipGenType": "Box"
|
||||
}
|
||||
},
|
||||
"mac": {
|
||||
"UUID": "{C5E76E09-39FA-411F-B2E2-15B47BB6AB5F}",
|
||||
"Name": "GSI",
|
||||
"OutputTypeHandling": "UseInputFormat",
|
||||
"IsPowerOf2": true,
|
||||
"MipMapSetting": {
|
||||
"MipGenType": "Box"
|
||||
}
|
||||
},
|
||||
"provo": {
|
||||
"UUID": "{C5E76E09-39FA-411F-B2E2-15B47BB6AB5F}",
|
||||
"Name": "GSI",
|
||||
"OutputTypeHandling": "UseInputFormat",
|
||||
"IsPowerOf2": true,
|
||||
"MipMapSetting": {
|
||||
"MipGenType": "Box"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
{
|
||||
"Type": "JsonSerialization",
|
||||
"Version": 1,
|
||||
"ClassName": "MultiplatformPresetSettings",
|
||||
"ClassData": {
|
||||
"DefaultPreset": {
|
||||
"UUID": "{181FE328-5408-4722-895F-1BB61803997B}",
|
||||
"Name": "GSI16",
|
||||
"PixelFormat": "R16",
|
||||
"DiscardAlpha": true,
|
||||
"IsPowerOf2": true,
|
||||
"MipMapSetting": {
|
||||
"MipGenType": "Box"
|
||||
}
|
||||
},
|
||||
"PlatformsPresets": {
|
||||
"android": {
|
||||
"UUID": "{181FE328-5408-4722-895F-1BB61803997B}",
|
||||
"Name": "GSI16",
|
||||
"PixelFormat": "R16",
|
||||
"MaxTextureSize": 2048,
|
||||
"DiscardAlpha": true,
|
||||
"IsPowerOf2": true,
|
||||
"MipMapSetting": {
|
||||
"MipGenType": "Box"
|
||||
}
|
||||
},
|
||||
"ios": {
|
||||
"UUID": "{181FE328-5408-4722-895F-1BB61803997B}",
|
||||
"Name": "GSI16",
|
||||
"PixelFormat": "R16",
|
||||
"MaxTextureSize": 2048,
|
||||
"DiscardAlpha": true,
|
||||
"IsPowerOf2": true,
|
||||
"MipMapSetting": {
|
||||
"MipGenType": "Box"
|
||||
}
|
||||
},
|
||||
"mac": {
|
||||
"UUID": "{181FE328-5408-4722-895F-1BB61803997B}",
|
||||
"Name": "GSI16",
|
||||
"PixelFormat": "R16",
|
||||
"DiscardAlpha": true,
|
||||
"IsPowerOf2": true,
|
||||
"MipMapSetting": {
|
||||
"MipGenType": "Box"
|
||||
}
|
||||
},
|
||||
"provo": {
|
||||
"UUID": "{181FE328-5408-4722-895F-1BB61803997B}",
|
||||
"Name": "GSI16",
|
||||
"PixelFormat": "R16",
|
||||
"DiscardAlpha": true,
|
||||
"IsPowerOf2": true,
|
||||
"MipMapSetting": {
|
||||
"MipGenType": "Box"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
{
|
||||
"Type": "JsonSerialization",
|
||||
"Version": 1,
|
||||
"ClassName": "MultiplatformPresetSettings",
|
||||
"ClassData": {
|
||||
"DefaultPreset": {
|
||||
"UUID": "{604FB174-7165-4F6E-889A-3B91DEC9311C}",
|
||||
"Name": "GSI32",
|
||||
"PixelFormat": "R32",
|
||||
"DiscardAlpha": true,
|
||||
"IsPowerOf2": true,
|
||||
"MipMapSetting": {
|
||||
"MipGenType": "Box"
|
||||
}
|
||||
},
|
||||
"PlatformsPresets": {
|
||||
"android": {
|
||||
"UUID": "{604FB174-7165-4F6E-889A-3B91DEC9311C}",
|
||||
"Name": "GSI32",
|
||||
"PixelFormat": "R32",
|
||||
"MaxTextureSize": 2048,
|
||||
"DiscardAlpha": true,
|
||||
"IsPowerOf2": true,
|
||||
"MipMapSetting": {
|
||||
"MipGenType": "Box"
|
||||
}
|
||||
},
|
||||
"ios": {
|
||||
"UUID": "{604FB174-7165-4F6E-889A-3B91DEC9311C}",
|
||||
"Name": "GSI32",
|
||||
"PixelFormat": "R32",
|
||||
"MaxTextureSize": 2048,
|
||||
"DiscardAlpha": true,
|
||||
"IsPowerOf2": true,
|
||||
"MipMapSetting": {
|
||||
"MipGenType": "Box"
|
||||
}
|
||||
},
|
||||
"mac": {
|
||||
"UUID": "{604FB174-7165-4F6E-889A-3B91DEC9311C}",
|
||||
"Name": "GSI32",
|
||||
"PixelFormat": "R32",
|
||||
"DiscardAlpha": true,
|
||||
"IsPowerOf2": true,
|
||||
"MipMapSetting": {
|
||||
"MipGenType": "Box"
|
||||
}
|
||||
},
|
||||
"provo": {
|
||||
"UUID": "{604FB174-7165-4F6E-889A-3B91DEC9311C}",
|
||||
"Name": "GSI32",
|
||||
"PixelFormat": "R32",
|
||||
"DiscardAlpha": true,
|
||||
"IsPowerOf2": true,
|
||||
"MipMapSetting": {
|
||||
"MipGenType": "Box"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
{
|
||||
"Type": "JsonSerialization",
|
||||
"Version": 1,
|
||||
"ClassName": "MultiplatformPresetSettings",
|
||||
"ClassData": {
|
||||
"DefaultPreset": {
|
||||
"UUID": "{84B1FE72-AD1A-4E50-83CC-4253ABA59733}",
|
||||
"Name": "GSI8",
|
||||
"PixelFormat": "R8",
|
||||
"DiscardAlpha": true,
|
||||
"IsPowerOf2": true,
|
||||
"MipMapSetting": {
|
||||
"MipGenType": "Box"
|
||||
}
|
||||
},
|
||||
"PlatformsPresets": {
|
||||
"android": {
|
||||
"UUID": "{84B1FE72-AD1A-4E50-83CC-4253ABA59733}",
|
||||
"Name": "GSI8",
|
||||
"PixelFormat": "R8",
|
||||
"MaxTextureSize": 2048,
|
||||
"DiscardAlpha": true,
|
||||
"IsPowerOf2": true,
|
||||
"MipMapSetting": {
|
||||
"MipGenType": "Box"
|
||||
}
|
||||
},
|
||||
"ios": {
|
||||
"UUID": "{84B1FE72-AD1A-4E50-83CC-4253ABA59733}",
|
||||
"Name": "GSI8",
|
||||
"PixelFormat": "R8",
|
||||
"MaxTextureSize": 2048,
|
||||
"DiscardAlpha": true,
|
||||
"IsPowerOf2": true,
|
||||
"MipMapSetting": {
|
||||
"MipGenType": "Box"
|
||||
}
|
||||
},
|
||||
"mac": {
|
||||
"UUID": "{84B1FE72-AD1A-4E50-83CC-4253ABA59733}",
|
||||
"Name": "GSI8",
|
||||
"PixelFormat": "R8",
|
||||
"DiscardAlpha": true,
|
||||
"IsPowerOf2": true,
|
||||
"MipMapSetting": {
|
||||
"MipGenType": "Box"
|
||||
}
|
||||
},
|
||||
"provo": {
|
||||
"UUID": "{84B1FE72-AD1A-4E50-83CC-4253ABA59733}",
|
||||
"Name": "GSI8",
|
||||
"PixelFormat": "R8",
|
||||
"DiscardAlpha": true,
|
||||
"IsPowerOf2": true,
|
||||
"MipMapSetting": {
|
||||
"MipGenType": "Box"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -146,7 +146,11 @@
|
||||
// decal
|
||||
"_decal": [ "Decal_AlbedoWithOpacity" ],
|
||||
// ui
|
||||
"_ui": [ "UserInterface_Compressed","UserInterface_Lossless" ]
|
||||
"_ui": [ "UserInterface_Compressed","UserInterface_Lossless" ],
|
||||
"_gsi": [ "GSI" ],
|
||||
"_gsi8": [ "GSI8" ],
|
||||
"_gsi16": [ "GSI16" ],
|
||||
"_gsi32": [ "GSI32" ]
|
||||
},
|
||||
"DefaultPreset": "Albedo",
|
||||
"DefaultPresetAlpha": "AlbedoWithGenericAlpha"
|
||||
|
||||
@@ -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("OutputTypeHandling", &PresetSettings::m_outputTypeHandling)
|
||||
;
|
||||
|
||||
serialize->Enum<RGBWeight>()
|
||||
->Value("Uniform", RGBWeight::uniform)
|
||||
@@ -130,6 +132,11 @@ namespace ImageProcessingAtom
|
||||
->Value("R32", EPixelFormat::ePixelFormat_R32)
|
||||
->Value("Unknown", EPixelFormat::ePixelFormat_Unknown)
|
||||
;
|
||||
|
||||
serialize->Enum<OutputTypeHandling>()
|
||||
->Value("Default", OutputTypeHandling::UseSpecifiedOutputType)
|
||||
->Value("UseInputFormat", OutputTypeHandling::UseInputFormat)
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -200,7 +207,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_outputTypeHandling == other.m_outputTypeHandling
|
||||
;
|
||||
}
|
||||
|
||||
void PresetSettings::DeepCopyMembers(const PresetSettings& other)
|
||||
@@ -237,6 +246,7 @@ namespace ImageProcessingAtom
|
||||
m_swizzle = other.m_swizzle;
|
||||
m_isMipRenormalize = other.m_isMipRenormalize;
|
||||
m_numResidentMips = other.m_numResidentMips;
|
||||
m_outputTypeHandling = other.m_outputTypeHandling;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,13 @@ namespace ImageProcessingAtom
|
||||
AZ_TYPE_INFO(PresetSettings, "{4F4DEC5C-48DD-40FD-97B4-5FB6FC7242E9}");
|
||||
AZ_CLASS_ALLOCATOR(PresetSettings, AZ::SystemAllocator, 0);
|
||||
|
||||
//! Custom overrides for how to handle the output format
|
||||
enum OutputTypeHandling
|
||||
{
|
||||
UseSpecifiedOutputType = 0,
|
||||
UseInputFormat
|
||||
};
|
||||
|
||||
PresetSettings();
|
||||
PresetSettings(const PresetSettings& other);
|
||||
PresetSettings& operator= (const PresetSettings& other);
|
||||
@@ -103,6 +110,9 @@ namespace ImageProcessingAtom
|
||||
//"swizzle". need to be 4 character and each character need to be one of "rgba01"
|
||||
AZStd::string m_swizzle;
|
||||
|
||||
//! Controls how the output type format is derived
|
||||
OutputTypeHandling m_outputTypeHandling = UseSpecifiedOutputType;
|
||||
|
||||
protected:
|
||||
void DeepCopyMembers(const PresetSettings& other);
|
||||
};
|
||||
@@ -136,3 +146,10 @@ namespace ImageProcessingAtom
|
||||
};
|
||||
|
||||
} // namespace ImageProcessingAtom
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
// Bind enums with uuids. Required for named enum support.
|
||||
// Note: AZ_TYPE_INFO_SPECIALIZE has to be declared in AZ namespace
|
||||
AZ_TYPE_INFO_SPECIALIZE(ImageProcessingAtom::PresetSettings::OutputTypeHandling, "{F919ECB6-BF80-4BEF-9E72-EA76504EBE9D}");
|
||||
}
|
||||
|
||||
@@ -535,7 +535,21 @@ 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);
|
||||
// Convert to a pixel format based on the desired handling
|
||||
// The default behavior will choose the output format specified by the preset
|
||||
EPixelFormat outputFormat;
|
||||
switch (m_input->m_presetSetting.m_outputTypeHandling)
|
||||
{
|
||||
case PresetSettings::OutputTypeHandling::UseInputFormat:
|
||||
outputFormat = m_input->m_inputImage->GetPixelFormat();
|
||||
break;
|
||||
case PresetSettings::OutputTypeHandling::UseSpecifiedOutputType:
|
||||
default:
|
||||
outputFormat = m_input->m_presetSetting.m_pixelFormat;
|
||||
break;
|
||||
}
|
||||
|
||||
m_image->ConvertFormat(outputFormat);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user