public static byte[] ConvertDDS(GUIDEntry value, DXGI_FORMAT targetFormat, DDSConverter.ImageFormat imageFormat, int frame) { try { if (GetDataType(value) != DataType.Image) { return(null); } teTexture texture = new teTexture(IOHelper.OpenFile(value)); if (texture.PayloadRequired) { ulong payload = texture.GetPayloadGUID(value.GUID, 1); if (IOHelper.HasFile(payload)) { texture.LoadPayload(IOHelper.OpenFile(payload), 1); } else { return(null); } } Stream ms = texture.SaveToDDS(1); return(DDSConverter.ConvertDDS(ms, targetFormat, imageFormat, frame)); } catch { // ignored } return(null); }
public static byte[] ConvertDDS(GUIDEntry value, DXGI_FORMAT targetFormat, DDSConverter.ImageFormat imageFormat, int frame) { try { if (GetDataType(value) != DataType.Image) { return(null); } teTexture texture = LoadTexture(value); Stream ms = texture.SaveToDDS(1); return(DDSConverter.ConvertDDS(ms, targetFormat, imageFormat, frame)); } catch { // ignored } return(null); }