示例#1
0
 private STChannelType GX2ChanneToGeneric(GX2CompSel comp)
 {
     if (comp == GX2CompSel.ChannelR)
     {
         return(STChannelType.Red);
     }
     else if (comp == GX2CompSel.ChannelG)
     {
         return(STChannelType.Green);
     }
     else if (comp == GX2CompSel.ChannelB)
     {
         return(STChannelType.Blue);
     }
     else if (comp == GX2CompSel.ChannelA)
     {
         return(STChannelType.Alpha);
     }
     else if (comp == GX2CompSel.Always0)
     {
         return(STChannelType.Zero);
     }
     else
     {
         return(STChannelType.One);
     }
 }
 private STChannelType SetChannel(GX2CompSel channelType)
 {
     if (channelType == GX2CompSel.ChannelR)
     {
         return(STChannelType.Red);
     }
     else if (channelType == GX2CompSel.ChannelG)
     {
         return(STChannelType.Green);
     }
     else if (channelType == GX2CompSel.ChannelB)
     {
         return(STChannelType.Blue);
     }
     else if (channelType == GX2CompSel.ChannelA)
     {
         return(STChannelType.Alpha);
     }
     else if (channelType == GX2CompSel.Always0)
     {
         return(STChannelType.Zero);
     }
     else
     {
         return(STChannelType.One);
     }
 }
示例#3
0
        public static GX2CompSel[] SetChannelsByFormat(GX2SurfaceFormat Format)
        {
            GX2CompSel[] channels = new GX2CompSel[4];

            switch (Format)
            {
            case GX2SurfaceFormat.T_BC5_UNorm:
            case GX2SurfaceFormat.T_BC5_SNorm:
                channels[0] = GX2CompSel.ChannelR;
                channels[1] = GX2CompSel.ChannelG;
                channels[2] = GX2CompSel.Always0;
                channels[3] = GX2CompSel.Always1;
                break;

            case GX2SurfaceFormat.T_BC4_SNorm:
            case GX2SurfaceFormat.T_BC4_UNorm:
                channels[0] = GX2CompSel.ChannelR;
                channels[1] = GX2CompSel.ChannelR;
                channels[2] = GX2CompSel.ChannelR;
                channels[3] = GX2CompSel.ChannelR;
                break;

            default:
                channels[0] = GX2CompSel.ChannelR;
                channels[1] = GX2CompSel.ChannelG;
                channels[2] = GX2CompSel.ChannelB;
                channels[3] = GX2CompSel.Always1;
                break;
            }
            return(channels);
        }
示例#4
0
        public void Read(Texture tex)
        {
            ImageKey         = "Texture";
            SelectedImageKey = "Texture";
            Text             = tex.Name;

            ChannelRed   = tex.CompSelR;
            ChannelGreen = tex.CompSelG;
            ChannelBlue  = tex.CompSelB;
            ChannelAlpha = tex.CompSelA;

            renderedTex.width  = (int)tex.Width;
            renderedTex.height = (int)tex.Height;
            format             = (int)tex.Format;
            int  swizzle = (int)tex.Swizzle;
            int  pitch   = (int)tex.Pitch;
            uint bpp     = GTX.surfaceGetBitsPerPixel((uint)format) >> 3;

            GTX.GX2Surface surf = new GTX.GX2Surface();
            surf.bpp = bpp;

            for (int surfaceLevel = 0; surfaceLevel < tex.ArrayLength; surfaceLevel++)
            {
            }
            GTX.Decode(surf, tex.MipData);
        }
示例#5
0
        public void Read(Texture tex)
        {
            ImageKey         = "Texture";
            SelectedImageKey = "Texture";
            Text             = tex.Name;

            ChannelRed   = tex.CompSelR;
            ChannelGreen = tex.CompSelG;
            ChannelBlue  = tex.CompSelB;
            ChannelAlpha = tex.CompSelA;

            renderedTex.width  = (int)tex.Width;
            renderedTex.height = (int)tex.Height;
            format             = (int)tex.Format;
            int swizzle = (int)tex.Swizzle;
            int pitch   = (int)tex.Pitch;

            renderedTex.data = GTX.swizzleBC(tex.Data, renderedTex.width, renderedTex.height, format, (int)tex.TileMode, pitch, swizzle);
        }
示例#6
0
        public static Bitmap ColorComponentSelector(Bitmap image, GX2CompSel R, GX2CompSel G, GX2CompSel B, GX2CompSel A)
        {
            BitmapExtension.ColorSwapFilter color = new BitmapExtension.ColorSwapFilter();
            if (R == GX2CompSel.ChannelR)
            {
                color.CompRed = BitmapExtension.ColorSwapFilter.Red.Red;
            }
            if (R == GX2CompSel.ChannelG)
            {
                color.CompRed = BitmapExtension.ColorSwapFilter.Red.Green;
            }
            if (R == GX2CompSel.ChannelB)
            {
                color.CompRed = BitmapExtension.ColorSwapFilter.Red.Blue;
            }
            if (R == GX2CompSel.ChannelA)
            {
                color.CompRed = BitmapExtension.ColorSwapFilter.Red.Alpha;
            }
            if (R == GX2CompSel.Always0)
            {
                color.CompRed = BitmapExtension.ColorSwapFilter.Red.One;
            }
            if (R == GX2CompSel.Always1)
            {
                color.CompRed = BitmapExtension.ColorSwapFilter.Red.Zero;
            }

            if (G == GX2CompSel.ChannelR)
            {
                color.CompGreen = BitmapExtension.ColorSwapFilter.Green.Red;
            }
            if (G == GX2CompSel.ChannelG)
            {
                color.CompGreen = BitmapExtension.ColorSwapFilter.Green.Green;
            }
            if (G == GX2CompSel.ChannelB)
            {
                color.CompGreen = BitmapExtension.ColorSwapFilter.Green.Blue;
            }
            if (G == GX2CompSel.ChannelA)
            {
                color.CompGreen = BitmapExtension.ColorSwapFilter.Green.Alpha;
            }
            if (G == GX2CompSel.Always0)
            {
                color.CompGreen = BitmapExtension.ColorSwapFilter.Green.One;
            }
            if (G == GX2CompSel.Always1)
            {
                color.CompGreen = BitmapExtension.ColorSwapFilter.Green.Zero;
            }

            if (B == GX2CompSel.ChannelR)
            {
                color.CompBlue = BitmapExtension.ColorSwapFilter.Blue.Red;
            }
            if (B == GX2CompSel.ChannelG)
            {
                color.CompBlue = BitmapExtension.ColorSwapFilter.Blue.Green;
            }
            if (B == GX2CompSel.ChannelB)
            {
                color.CompBlue = BitmapExtension.ColorSwapFilter.Blue.Blue;
            }
            if (B == GX2CompSel.ChannelA)
            {
                color.CompBlue = BitmapExtension.ColorSwapFilter.Blue.Alpha;
            }
            if (B == GX2CompSel.Always0)
            {
                color.CompBlue = BitmapExtension.ColorSwapFilter.Blue.One;
            }
            if (B == GX2CompSel.Always1)
            {
                color.CompBlue = BitmapExtension.ColorSwapFilter.Blue.Zero;
            }

            if (A == GX2CompSel.ChannelR)
            {
                color.CompAlpha = BitmapExtension.ColorSwapFilter.Alpha.Red;
            }
            if (A == GX2CompSel.ChannelG)
            {
                color.CompAlpha = BitmapExtension.ColorSwapFilter.Alpha.Green;
            }
            if (A == GX2CompSel.ChannelB)
            {
                color.CompAlpha = BitmapExtension.ColorSwapFilter.Alpha.Blue;
            }
            if (A == GX2CompSel.ChannelA)
            {
                color.CompAlpha = BitmapExtension.ColorSwapFilter.Alpha.Alpha;
            }
            if (A == GX2CompSel.Always0)
            {
                color.CompAlpha = BitmapExtension.ColorSwapFilter.Alpha.One;
            }
            if (A == GX2CompSel.Always1)
            {
                color.CompAlpha = BitmapExtension.ColorSwapFilter.Alpha.Zero;
            }

            return(BitmapExtension.SwapRGB(image, color));
        }