您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
40 行
1.4 KiB
40 行
1.4 KiB
namespace UnityEngine.Rendering.Universal
|
|
{
|
|
/// <summary>
|
|
/// Let customizable actions inject commands to capture the camera output.
|
|
///
|
|
/// You can use this pass to inject capture commands into a command buffer
|
|
/// with the goal of having camera capture happening in external code.
|
|
/// </summary>
|
|
internal class CapturePass : ScriptableRenderPass
|
|
{
|
|
RenderTargetHandle m_CameraColorHandle;
|
|
const string m_ProfilerTag = "Capture Pass";
|
|
public CapturePass(RenderPassEvent evt)
|
|
{
|
|
renderPassEvent = evt;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Configure the pass
|
|
/// </summary>
|
|
/// <param name="actions"></param>
|
|
public void Setup(RenderTargetHandle colorHandle)
|
|
{
|
|
m_CameraColorHandle = colorHandle;
|
|
}
|
|
|
|
/// <inheritdoc/>
|
|
public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData)
|
|
{
|
|
CommandBuffer cmdBuf = CommandBufferPool.Get(m_ProfilerTag);
|
|
var colorAttachmentIdentifier = m_CameraColorHandle.Identifier();
|
|
var captureActions = renderingData.cameraData.captureActions;
|
|
for (captureActions.Reset(); captureActions.MoveNext();)
|
|
captureActions.Current(colorAttachmentIdentifier, cmdBuf);
|
|
|
|
context.ExecuteCommandBuffer(cmdBuf);
|
|
CommandBufferPool.Release(cmdBuf);
|
|
}
|
|
}
|
|
}
|