1
0
mirror of synced 2024-11-29 01:34:42 +01:00

Set the default format setting only for non dds types to prevent errors with dds

This commit is contained in:
KillzXGaming 2019-05-09 14:25:52 -04:00
parent 84dae95c3e
commit 781bd585b3

View File

@ -109,7 +109,7 @@ namespace Bfres.Structs
return importer;
}
public static GTXImporterSettings SetImporterSettings(string name)
public static GTXImporterSettings SetImporterSettings(string name, TEX_FORMAT DefaultFormat = TEX_FORMAT.UNKNOWN)
{
var importer = new GTXImporterSettings();
string ext = System.IO.Path.GetExtension(name);
@ -123,6 +123,10 @@ namespace Bfres.Structs
break;
default:
importer.LoadBitMap(name);
//Override the format setting. This only will do this for images not as dds or astc
if (DefaultFormat != TEX_FORMAT.UNKNOWN)
importer.Format = (GX2.GX2SurfaceFormat)ConvertToGx2Format(DefaultFormat);
break;
}
@ -199,7 +203,7 @@ namespace Bfres.Structs
return;
}
GTXImporterSettings setting = SetImporterSettings(FileName);
GTXImporterSettings setting = SetImporterSettings(FileName, DefaultFormat);
setting.MipSwizzle = Tex2Swizzle;
GTXTextureImporter importer = new GTXTextureImporter();
@ -221,9 +225,6 @@ namespace Bfres.Structs
importer.LoadSetting(setting);
if (DefaultFormat != TEX_FORMAT.UNKNOWN)
setting.Format = (GX2.GX2SurfaceFormat)ConvertToGx2Format(DefaultFormat);
if (ext == ".dds")
{
if (setting.DataBlockOutput != null)
@ -581,7 +582,7 @@ namespace Bfres.Structs
case GX2SurfaceFormat.T_BC2_UNorm: return TEX_FORMAT.BC2_UNORM;
case GX2SurfaceFormat.T_BC2_SRGB: return TEX_FORMAT.BC2_UNORM_SRGB;
case GX2SurfaceFormat.T_BC3_UNorm: return TEX_FORMAT.BC3_UNORM;
case GX2SurfaceFormat.T_BC3_SRGB: return TEX_FORMAT.BC3_UNORM;
case GX2SurfaceFormat.T_BC3_SRGB: return TEX_FORMAT.BC3_UNORM_SRGB;
case GX2SurfaceFormat.T_BC4_UNorm: return TEX_FORMAT.BC4_UNORM;
case GX2SurfaceFormat.T_BC4_SNorm: return TEX_FORMAT.BC4_SNORM;
case GX2SurfaceFormat.T_BC5_UNorm: return TEX_FORMAT.BC5_UNORM;