Exemplo n.º 1
0
        private static TexMipmap ReadMipmap(BinaryReader reader)
        {
            var mipmap = new TexMipmap();

            mipmap.Width         = reader.ReadInt32();
            mipmap.Height        = reader.ReadInt32();
            mipmap.LZ4Compressed = reader.ReadInt32();
            mipmap.PixelCount    = reader.ReadInt32();
            mipmap.BytesCount    = reader.ReadInt32();
            mipmap.Bytes         = new byte[mipmap.BytesCount];
            reader.Read(mipmap.Bytes, 0, mipmap.BytesCount);

            return(mipmap);
        }
Exemplo n.º 2
0
        private static TexMipmap ReadMipmap(BinaryReader reader, TexMipmapVersion version)
        {
            var mipmap = new TexMipmap();

            if (version == TexMipmapVersion.Version1)
            {
                mipmap.Width      = reader.ReadInt32();
                mipmap.Height     = reader.ReadInt32();
                mipmap.BytesCount = reader.ReadInt32();
            }
            else
            {
                mipmap.Width         = reader.ReadInt32();
                mipmap.Height        = reader.ReadInt32();
                mipmap.Lz4Compressed = reader.ReadInt32();
                mipmap.PixelCount    = reader.ReadInt32();
                mipmap.BytesCount    = reader.ReadInt32();
            }

            mipmap.Bytes = new byte[mipmap.BytesCount];
            reader.Read(mipmap.Bytes, 0, mipmap.BytesCount);

            return(mipmap);
        }