// This method is called before executing the render pass.
            // It can be used to configure render targets and their clear state. Also to create temporary render target textures.
            // When empty this render pass will render to the active camera render target.
            // You should never call CommandBuffer.SetRenderTarget. Instead call <c>ConfigureTarget</c> and <c>ConfigureClear</c>.
            // The render pipeline will ensure target setup and clearing happens in a performant manner.
            // public override void OnCameraSetup(CommandBuffer cmd, ref RenderingData renderingData)
            // {
            // }

            // Here you can implement the rendering logic.
            // Use <c>ScriptableRenderContext</c> to issue drawing commands or execute command buffers
            // https://docs.unity3d.com/ScriptReference/Rendering.ScriptableRenderContext.html
            // You don't have to call ScriptableRenderContext.submit, the render pipeline will call it at specific points in the pipeline.
            public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData)
            {
                RippleEffect rippleEffect = RippleEffect.instance;

                if (rippleEffect == null || !rippleEffect.HaveEffect)
                {
                    return;
                }

                CommandBuffer cmd = CommandBufferPool.Get(k_tag);

                using (new ProfilingScope(cmd, profilingSampler))
                {
                    //blit
                    cmd.GetTemporaryRT(tempRT_ID, renderingData.cameraData.cameraTargetDescriptor);
                    cmd.SetRenderTarget(tempRT_RTI);
                    cmd.SetGlobalTexture(srcTex_ID, cameraColorTexture_RTI);
                    CoreUtils.DrawFullScreen(cmd, rippleEffect.RippleMat, null, 1);

                    context.ExecuteCommandBuffer(cmd);
                    cmd.Clear();

                    cmd.SetRenderTarget(cameraColorTexture_RTI);
                    cmd.SetGlobalTexture(srcTex_ID, tempRT_RTI);
                    CoreUtils.DrawFullScreen(cmd, rippleEffect.RippleMat, null, 0);
                    cmd.ReleaseTemporaryRT(tempRT_ID);
                }

                context.ExecuteCommandBuffer(cmd);
                CommandBufferPool.Release(cmd);
            }
 private void Start()
 {
     coll         = GetComponent <PlayerCollision>();
     rigi         = GetComponent <Rigidbody2D>();
     anim         = GetComponentInChildren <PlayerAnimation>();
     betJump      = GetComponent <BetterJumping>();
     camTS        = Camera.main.transform;
     rippleEffect = camTS.GetComponent <RippleEffect>();
 }
Esempio n. 3
0
 private void OnDisable()
 {
     instance = null;
 }
Esempio n. 4
0
 private void OnDestroy()
 {
     instance = null;
     Destroy(material);
     Destroy(gradTexture);
 }
Esempio n. 5
0
 private void OnEnable()
 {
     instance = this;
 }