Beispiel #1
0
        byte[] ReadDxt5()
        {
            var packed = m_input.ReadBytes((int)m_input.Length);
            var dxt    = new DirectDraw.DxtDecoder(packed, m_info);

            return(dxt.UnpackDXT5());
        }
Beispiel #2
0
        byte[] ReadTex2()
        {
            int tex_width = m_info.AlignedWidth >> 2;
            int total     = tex_width * (m_info.AlignedHeight >> 2);
            var texture   = new byte[m_info.AlignedWidth * m_info.AlignedHeight];
            var packed    = new byte[m_info.AlignedWidth * m_info.AlignedHeight];

            m_input.Read(texture, 0, texture.Length);
            int src = 0;

            for (int i = 0; i < total; ++i)
            {
                int y   = GetY(i, tex_width, 0x10);
                int x   = GetX(i, tex_width, 0x10);
                int dst = (x + y * tex_width) * 16;
                for (int j = 0; j < 8; ++j)
                {
                    packed[dst++] = texture[src + 1];
                    packed[dst++] = texture[src];
                    src          += 2;
                }
            }
            var dxt = new DirectDraw.DxtDecoder(packed, m_info);

            return(dxt.UnpackDXT5());
        }