コード例 #1
0
        static ImageEffectUtil()
        {
            List <ImageEffectPattern> list      = new List <ImageEffectPattern>();
            ImageEffectType           colorFade = ImageEffectType.ColorFade;

            Shader[] shaders = new Shader[] { Shader.Find(ShaderManager.ColorFade) };
            list.Add(new ImageEffectPattern(colorFade.ToString(), typeof(ColorFade), shaders));
            ImageEffectType bloom = ImageEffectType.Bloom;

            Shader[] shaderArray2 = new Shader[] { Shader.Find(ShaderManager.BloomName) };
            list.Add(new ImageEffectPattern(bloom.ToString(), typeof(Bloom), shaderArray2));
            ImageEffectType blur = ImageEffectType.Blur;

            Shader[] shaderArray3 = new Shader[] { Shader.Find(ShaderManager.BlurName) };
            list.Add(new ImageEffectPattern(blur.ToString(), typeof(Blur), shaderArray3));
            ImageEffectType mosaic = ImageEffectType.Mosaic;

            Shader[] shaderArray4 = new Shader[] { Shader.Find(ShaderManager.MosaicName) };
            list.Add(new ImageEffectPattern(mosaic.ToString(), typeof(Mosaic), shaderArray4));
            ImageEffectType grayScale = ImageEffectType.GrayScale;

            Shader[] shaderArray5 = new Shader[] { Shader.Find(ShaderManager.GrayScaleName) };
            list.Add(new ImageEffectPattern(grayScale.ToString(), typeof(Grayscale), shaderArray5));
            ImageEffectType motionBlur = ImageEffectType.MotionBlur;

            Shader[] shaderArray6 = new Shader[] { Shader.Find(ShaderManager.MotionBlurName) };
            list.Add(new ImageEffectPattern(motionBlur.ToString(), typeof(MotionBlur), shaderArray6));
            ImageEffectType screenOverlay = ImageEffectType.ScreenOverlay;

            Shader[] shaderArray7 = new Shader[] { Shader.Find(ShaderManager.BlendModesOverlayName) };
            list.Add(new ImageEffectPattern(screenOverlay.ToString(), typeof(ScreenOverlay), shaderArray7));
            ImageEffectType sepia = ImageEffectType.Sepia;

            Shader[] shaderArray8 = new Shader[] { Shader.Find(ShaderManager.SepiatoneName) };
            list.Add(new ImageEffectPattern(sepia.ToString(), typeof(SepiaTone), shaderArray8));
            ImageEffectType negaPosi = ImageEffectType.NegaPosi;

            Shader[] shaderArray9 = new Shader[] { Shader.Find(ShaderManager.NegaPosiName) };
            list.Add(new ImageEffectPattern(negaPosi.ToString(), typeof(NegaPosi), shaderArray9));
            ImageEffectType fishEye = ImageEffectType.FishEye;

            Shader[] shaderArray10 = new Shader[] { Shader.Find(ShaderManager.FisheyeName) };
            list.Add(new ImageEffectPattern(fishEye.ToString(), typeof(FishEye), shaderArray10));
            ImageEffectType twirl = ImageEffectType.Twirl;

            Shader[] shaderArray11 = new Shader[] { Shader.Find(ShaderManager.TwirlName) };
            list.Add(new ImageEffectPattern(twirl.ToString(), typeof(Twirl), shaderArray11));
            ImageEffectType vortex = ImageEffectType.Vortex;

            Shader[] shaderArray12 = new Shader[] { Shader.Find(ShaderManager.VortexName) };
            list.Add(new ImageEffectPattern(vortex.ToString(), typeof(Vortex), shaderArray12));
            patterns = list;
        }
コード例 #2
0
        public void SetEffectShader(ImageEffectType type)
        {
            if (!effectMat)
            {
                effectMat = new Material(_shaderEffects[type]);
            }
            else
            {
                effectMat.shader = _shaderEffects[type];
                effectMat.name   = _shaderEffects[type].name;
            }

            UpdateMaterialProperties();
        }