예제 #1
0
        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);
        }
예제 #2
0
        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);
        }