Esempio n. 1
0
        protected virtual void OnRenderImage(RenderTexture source, RenderTexture destination)
        {
            if (blurAlgorithm == null || BlurConfig == null)
            {
                goto draw_unmodified;
            }

            if (shouldUpdateBlur())
            {
                //Resize final texture if base downsample changed
                if (Downsample != lastDownsample || !BlurRegion.Approximately(lastBlurRegion))
                {
                    CreateNewBlurredScreen();
                    lastDownsample = Downsample;
                    lastBlurRegion = BlurRegion;
                }

                blurAlgorithm.Blur(source, BlurRegion, ref blurredScreen);
            }

            if (preview)
            {
                previewMaterial.SetVector(ShaderProperties.blurTextureCropRegion, BlurRegion.ToMinMaxVector());
                Graphics.Blit(BlurredScreen, destination, previewMaterial);
                return;
            }

draw_unmodified:
            Graphics.Blit(source, destination);
        }
Esempio n. 2
0
        protected virtual void OnRenderImage(RenderTexture source, RenderTexture destination)
        {
            if (blurAlgorithm == null || BlurConfig == null)
            {
                goto draw_unmodified;
            }

            if (shouldUpdateBlur())
            {
                OnBeforeBlur();
                blurAlgorithm.Blur(source, BlurRegion, ref blurredScreen);
            }

            if (preview)
            {
                previewMaterial.SetVector(ShaderId.CROP_REGION, BlurRegion.ToMinMaxVector());
                Graphics.Blit(BlurredScreen, destination, previewMaterial);
                return;
            }

draw_unmodified:
            Graphics.Blit(source, destination);
        }