Example #1
0
        private void OnDisable()
        {
            NotifyBlurredTexOnUpdate(null);

            if (blur != null)
            {
                blur.Dispose();
                blur = null;
            }
            if (bDepthTex != null)
            {
                bDepthTex.DestroySelf();
                bDepthTex = null;
            }
            if (maskTex0 != null)
            {
                maskTex0.Dispose();
                maskTex0 = null;
            }
            if (maskTex1 != null)
            {
                maskTex1.Dispose();
                maskTex1 = null;
            }
            if (ramm != null)
            {
                ramm.Dispose();
                ramm = null;
            }
            if (pip != null)
            {
                pip.Dispose();
                pip = null;
            }
        }
Example #2
0
        private void OnEnable()
        {
            if (link.targetCam == null)
            {
                link.targetCam = GetComponent <Camera>();
            }

            blur     = new Blur();
            ramm     = new BinaryAccumulator();
            maskTex0 = new ResizableRenderTexture(new FormatRT()
            {
                textureFormat = RenderTextureFormat.ARGBHalf,
                depth         = 0,
            });
            maskTex1 = new ResizableRenderTexture(maskTex0.Format);

            pip = new PIPTexture();

            currCamData = default;
            validator.Reset();
            validator.SetCheckers(() => currCamData.Equals(link.targetCam));
            validator.Validation += () => {
                currCamData = link.targetCam;

                var size = link.targetCam.Size();
                maskTex0.Size = size;
                maskTex1.Size = size;

                pip.CurrTuner = tuner.pip;
                pip.TargetCam = link.targetCam;
            };

            System.Action <RenderTexture> fClear = tex => {
                using (new RenderTextureActivator(tex)) {
                    GL.Clear(true, true, Color.white);
                }
            };

            maskTex0.AfterCreateTexture += fClear;
            maskTex1.AfterCreateTexture += fClear;

            validator.Validate();
        }