public static TxpTexture ToTxp(this DdsFile dds) { var tex = new TxpTexture { MipMapCount = dds.MipMapCount == 0 ? 1 : dds.MipMapCount }; int mipNum = 1; var mips = new List <TxpMipmap>(tex.MipMapCount) { dds.ToTxpMip() }; if (dds.MipMapCount > 0) { dds.MipMaps.ForEach(mip => mips.Add(mip.ToTxp(dds.PixelFormat, mipNum++))); } mips.ForEach(mip => tex.Mipmaps.Add(mip)); return(tex); }