UnityGame/Library/PackageCache/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/RendererFeatures/BlitToRTHandle/BlitToRTHandleRendererFeature.cs

29 lines
894 B
C#
Raw Normal View History

2024-10-27 10:53:47 +03:00
using UnityEngine;
using UnityEngine.Rendering.Universal;
// This Renderer Feature sets up the BlitToRTHandlePass pass.
public class BlitToRTHandleRendererFeature : ScriptableRendererFeature
{
private BlitToRTHandlePass m_CopyColorPass;
private RenderPassEvent m_CopyColorEvent = RenderPassEvent.AfterRenderingTransparents;
public Material blitMaterial;
public override void Create()
{
m_CopyColorPass = new BlitToRTHandlePass(m_CopyColorEvent, blitMaterial);
}
public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData)
{
if (renderingData.cameraData.cameraType != CameraType.Game)
return;
renderer.EnqueuePass(m_CopyColorPass);
}
protected override void Dispose(bool disposing)
{
m_CopyColorPass?.Dispose();
m_CopyColorPass = null;
}
}