using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;

public class GlitchPass : ScriptableRenderPass
{
    public GlitchFeature.Settings Settings { get; set; }

    private RenderTargetIdentifier _src;
    private RenderTargetIdentifier _dest;

    public override void OnCameraSetup(CommandBuffer cmd, ref RenderingData renderingData)
    {
        RenderTextureDescriptor blitTargetDescriptor = renderingData.cameraData.cameraTargetDescriptor;
        blitTargetDescriptor.depthBufferBits = 0;
        var renderer = renderingData.cameraData.renderer;
    }

    public override void Configure(CommandBuffer cmd, RenderTextureDescriptor cameraTextureDescriptor)
    {
        base.Configure(cmd, cameraTextureDescriptor);

        // _src = new RenderTargetIdentifier(Settings.glitchTex);
        // _dest = new RenderTargetIdentifier(Settings.blendTex);
    }

    public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData)
    {
        var cmd = CommandBufferPool.Get();
        
        // set properties on material
        // var blend = Settings.blendMaterial;
        // blend.SetFloat("_Sample", Settings.sample);
        // blend.SetFloat("_DeltaTime", Time.deltaTime);
        //
        // blend.SetTexture("_GlitchTex", Settings.glitchTex);
        // blend.SetTexture("_BlendTex", Settings.blendTex);
        
        // cmd.Blit(_src,_dest,blend);
        
        context.ExecuteCommandBuffer(cmd);
    }
}
