2021-04-24 03:06:03 +02:00
|
|
|
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)
|
|
|
|
{
|
2021-04-26 00:44:43 +02:00
|
|
|
RenderTextureDescriptor blitTargetDescriptor = renderingData.cameraData.cameraTargetDescriptor;
|
|
|
|
blitTargetDescriptor.depthBufferBits = 0;
|
|
|
|
var renderer = renderingData.cameraData.renderer;
|
2021-04-24 03:06:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|