public static TxpMipmap ToTxpMip(this DdsFile dds) { if (dds == null) { throw new NullReferenceException("Tried to create TXP Mipmap from null DDS file"); } var tex = new TxpMipmap { Width = dds.Width, Height = dds.Height, Format = dds.PixelFormat.Format.CastTo <TxpMipmap.TexFormat>(), ByteSize = dds.PitchOrLinearSize, Data = dds.Data }; return(tex); }
public static TxpMipmap ToTxp(this DdsMipMap mip, DdsPixelFormat pf, int id = 0) { if (mip == null) { throw new NullReferenceException("Tried to create TXP Mipmap from null DDS mipmap"); } var tex = new TxpMipmap { Width = mip.Width, Height = mip.Height, Format = pf.Format.CastTo <TxpMipmap.TexFormat>(), ByteSize = mip.ByteSize, Id = id, Data = mip.Data }; return(tex); }