示例#1
0
        public static byte[] Decompress(
            EndianBinaryReader r,
            int width,
            int height,
            GlTextureFormat inputFormat,
            long readLength)
        {
            bool hasAlpha = (inputFormat == GlTextureFormat.ETC1a4);

            byte[] pixelData = new byte[readLength * (hasAlpha ? 4 : 8)];

            for (int y = 0; y < height; y += 8)
            {
                for (int x = 0; x < width; x += 8)
                {
                    Etc1.DecodeETC1Tile_(r,
                                         pixelData,
                                         x,
                                         y,
                                         width,
                                         height,
                                         (hasAlpha ? true : false));
                }
            }

            return(pixelData);
        }
示例#2
0
        private GlTextureFormat CollapseFormat_(GlTextureFormat format)
        {
            var lowerFormat = (GlTextureFormat)((int)format & 0xFFFF);

            if (lowerFormat == GlTextureFormat.ETC1)
            {
                format = GlTextureFormat.ETC1;
            }
            else if (lowerFormat == GlTextureFormat.ETC1a4)
            {
                format = GlTextureFormat.ETC1a4;
            }

            return(format);
        }
示例#3
0
 private int GetFmtBpp_(GlTextureFormat format)
 => this.CollapseFormat_(format) switch
 {