33 lines
979 B
C#
33 lines
979 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.Rendering;
|
|
using UnityEngine.Rendering.Universal;
|
|
|
|
public class GlitchStencilPass : ScriptableRenderPass
|
|
{
|
|
private readonly GlitchFeature.Settings _settings;
|
|
|
|
private readonly RenderTargetIdentifier _src;
|
|
private readonly RenderTargetIdentifier _dest;
|
|
|
|
public GlitchStencilPass(GlitchFeature.Settings settings)
|
|
{
|
|
_settings = settings;
|
|
_src = new RenderTargetIdentifier(_settings.glitchTex);
|
|
_dest = new RenderTargetIdentifier(_settings.stencilTex);
|
|
}
|
|
|
|
// input is the view of the glitch camera
|
|
public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData)
|
|
{
|
|
var cmd = CommandBufferPool.Get();
|
|
|
|
var stencil = _settings.stencilMat;
|
|
|
|
cmd.Blit(_src,_dest,stencil);
|
|
|
|
context.ExecuteCommandBuffer(cmd);
|
|
}
|
|
}
|