예제 #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;
            }
        }
예제 #2
0
        private void OnEnable()
        {
            if (link.targetCam == null)
            {
                link.targetCam = GetComponent <Camera>();
            }

            manualCam = new ManuallyRenderCamera(link.targetCam);
            commander = new CameraEventRetention(manualCam.Camera);

            cmd      = new CommandBuffer();
            cap      = new DepthCapture();
            depthTex = new ResizableRenderTexture(new FormatRT()
            {
                textureFormat = RenderTextureFormat.Depth,
                depth         = 24
            });
            depthColorTex = new ResizableRenderTexture(new FormatRT()
            {
                textureFormat = RenderTextureFormat.ARGBHalf,
                readWrite     = RenderTextureReadWrite.Linear,
                depth         = 0,
            });

            pip = new PIPTexture();

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

                cmd.Clear();

                var size = link.targetCam.Size();
                depthTex.Size      = size;
                depthColorTex.Size = size;

                cmd.Clear();
                cap.StepThreashold = tuner.stepThreashold;
                cap.Capture(cmd, depthColorTex, tuner.depthOutputMode);
                commander.Set(tuner.captureEvent, cmd);

                pip.CurrTuner = tuner.pip;
                pip.TargetCam = link.targetCam;
            };
            manualCam.AfterCopyFrom += v => {
                manualCam.Camera.depthTextureMode = DepthTextureMode.Depth;
                manualCam.Camera.cullingMask      = tuner.CullingMask();
            };

            validator.Validate();

            depthTex.AfterCreateTexture      += v => validator.Invalidate();
            depthColorTex.AfterCreateTexture += v => {
                using (new RenderTextureActivator(depthColorTex))
                    GL.Clear(true, true, Color.white);
                validator.Invalidate();
            };
        }
예제 #3
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();
        }
예제 #4
0
 private void OnDisable()
 {
     if (commander != null)
     {
         commander.Reset();
         commander = null;
     }
     if (manualCam != null)
     {
         manualCam.Dispose();
         manualCam = null;
     }
     if (cap != null)
     {
         cap.Dispose();
         cap = null;
     }
     if (cmd != null)
     {
         cmd.Dispose();
         cmd = null;
     }
     if (depthTex != null)
     {
         depthTex.Dispose();
         depthTex = null;
     }
     if (depthColorTex != null)
     {
         depthColorTex.Dispose();
         depthColorTex = null;
     }
     if (pip != null)
     {
         pip.Dispose();
         pip = null;
     }
 }