Files
beyond/Assets/Scripts/PostProcessing/Runtime/RenderPasses/DrawFullscreenFeature.cs
2024-11-20 15:21:28 +01:00

47 lines
1.5 KiB
C#

namespace UnityEngine.Rendering.Universal
{
public enum BufferType
{
CameraColor,
Custom
}
public class DrawFullscreenFeature : ScriptableRendererFeature
{
[System.Serializable]
public class Settings
{
public RenderPassEvent renderPassEvent = RenderPassEvent.AfterRenderingOpaques;
public Material blitMaterial = null;
public int blitMaterialPassIndex = -1;
public BufferType sourceType = BufferType.CameraColor;
public BufferType destinationType = BufferType.CameraColor;
public string sourceTextureId = "_SourceTexture";
public string destinationTextureId = "_DestinationTexture";
}
public Settings settings = new Settings();
DrawFullscreenPass blitPass;
public override void Create()
{
blitPass = new DrawFullscreenPass(name);
}
public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData)
{
if (settings.blitMaterial == null)
{
Debug.LogWarningFormat("Missing Blit Material. {0} blit pass will not execute. Check for missing reference in the assigned renderer.", GetType().Name);
return;
}
blitPass.renderPassEvent = settings.renderPassEvent;
blitPass.settings = settings;
renderer.EnqueuePass(blitPass);
}
}
}