1
0
mirror of synced 2024-11-12 02:00:50 +01:00

Adjust DDS to use older versions if possible

This commit is contained in:
KillzXGaming 2019-11-28 20:11:46 -05:00
parent 45a0ada32e
commit 8d24ab07dc

View File

@ -976,7 +976,23 @@ namespace Toolbox.Library
dds.header.mipmapCount = (uint)MipCount;
dds.header.pitchOrLinearSize = (uint)surfaces[0].mipmaps[0].Length;
if (surfaces.Count > 0) //Use DX10 format for array surfaces as it can do custom amounts
//Check for components to be different. Then set our channel flags
if (RedChannel != STChannelType.Red || GreenChannel != STChannelType.Green ||
BlueChannel != STChannelType.Blue || AlphaChannel != STChannelType.Alpha)
{
//R G B A 1 0
uint[] components = new uint[6] {
0x000000ff, 0x0000ff00,
0x00ff0000, 0xff000000, 0x00008000, 0};
/* dds.header.ddspf.RGBBitCount = 4;
dds.header.ddspf.RBitMask = components[(int)RedChannel];
dds.header.ddspf.GBitMask = components[(int)GreenChannel];
dds.header.ddspf.BBitMask = components[(int)BlueChannel];
dds.header.ddspf.ABitMask = components[(int)AlphaChannel];*/
}
if (surfaces.Count > 1) //Use DX10 format for array surfaces as it can do custom amounts
dds.SetFlags((DDS.DXGI_FORMAT)Format, true);
else
dds.SetFlags((DDS.DXGI_FORMAT)Format);