Exemplo n.º 1
0
 public UnhandledImageFormatException(TextureNativeSectionData.CompressionMode compression,
                                      TextureNativeSectionData.RasterFormat format)
     : base("Unhandled image format encountered: " +
            (compression != TextureNativeSectionData.CompressionMode.None ?
             compression.ToString() + "-" : "") + format.ToString())
 {
 }
Exemplo n.º 2
0
        private static PixelInternalFormat FindInternalFormat(
            TextureNativeSectionData.CompressionMode compression,
            TextureNativeSectionData.RasterFormat format)
        {
            switch ((TextureNativeSectionData.RasterFormat)((int)format & 0x0fff))
            {
            case TextureNativeSectionData.RasterFormat.R5G6B5:
                if (compression == TextureNativeSectionData.CompressionMode.DXT1)
                {
                    return(PixelInternalFormat.CompressedRgbS3tcDxt1Ext);
                }
                goto default;

            case TextureNativeSectionData.RasterFormat.A1R5G5B5:
                if (compression == TextureNativeSectionData.CompressionMode.DXT1)
                {
                    return(PixelInternalFormat.CompressedRgbaS3tcDxt1Ext);
                }
                goto default;

            case TextureNativeSectionData.RasterFormat.B8G8R8:
                if (compression == TextureNativeSectionData.CompressionMode.None)
                {
                    return(PixelInternalFormat.Rgba);
                }
                goto default;

            case TextureNativeSectionData.RasterFormat.B8G8R8A8:
                if (compression == TextureNativeSectionData.CompressionMode.None)
                {
                    return(PixelInternalFormat.Rgba);
                }
                goto default;

            case TextureNativeSectionData.RasterFormat.R4G4B4A4:
                if (compression == TextureNativeSectionData.CompressionMode.DXT3)
                {
                    return(PixelInternalFormat.CompressedRgbaS3tcDxt3Ext);
                }
                goto default;

            default:
                throw new UnhandledImageFormatException(compression, format);
            }
        }
Exemplo n.º 3
0
        private static int FindImageDataSize(int width, int height,
                                             TextureNativeSectionData.CompressionMode compression,
                                             TextureNativeSectionData.RasterFormat format)
        {
            switch ((TextureNativeSectionData.RasterFormat)((int)format & 0x0fff))
            {
            case TextureNativeSectionData.RasterFormat.R5G6B5:
                if (compression == TextureNativeSectionData.CompressionMode.DXT1)
                {
                    return((width * height) >> 1);
                }
                goto default;

            case TextureNativeSectionData.RasterFormat.A1R5G5B5:
                if (compression == TextureNativeSectionData.CompressionMode.DXT1)
                {
                    return((width * height) >> 1);
                }
                goto default;

            case TextureNativeSectionData.RasterFormat.B8G8R8:
                if (compression == TextureNativeSectionData.CompressionMode.None)
                {
                    return((width * height) << 2);
                }
                goto default;

            case TextureNativeSectionData.RasterFormat.B8G8R8A8:
                if (compression == TextureNativeSectionData.CompressionMode.None)
                {
                    return((width * height) << 2);
                }
                goto default;

            case TextureNativeSectionData.RasterFormat.R4G4B4A4:
                if (compression == TextureNativeSectionData.CompressionMode.DXT3)
                {
                    return(width * height);
                }
                goto default;

            default:
                throw new UnhandledImageFormatException(compression, format);
            }
        }
Exemplo n.º 4
0
        private static PixelFormat FindExternalFormat(
            TextureNativeSectionData.CompressionMode compression,
            TextureNativeSectionData.RasterFormat format)
        {
            if (compression != TextureNativeSectionData.CompressionMode.None)
            {
                return(PixelFormat.Alpha);
            }

            switch ((TextureNativeSectionData.RasterFormat)((int)format & 0x0fff))
            {
            case TextureNativeSectionData.RasterFormat.B8G8R8:
                return(PixelFormat.Bgra);

            case TextureNativeSectionData.RasterFormat.B8G8R8A8:
                return(PixelFormat.Bgra);

            default:
                throw new UnhandledImageFormatException(compression, format);
            }
        }