Firstborn/Library/PackageCache/com.unity.render-pipelines..../Runtime/Decal/DBuffer/DecalForwardEmissivePass.cs

51 lines
2.1 KiB
C#
Raw Normal View History

2023-03-28 13:24:16 -04:00
using System.Collections.Generic;
namespace UnityEngine.Rendering.Universal
{
internal class DecalDrawFowardEmissiveSystem : DecalDrawSystem
{
public DecalDrawFowardEmissiveSystem(DecalEntityManager entityManager) : base("DecalDrawFowardEmissiveSystem.Execute", entityManager) { }
protected override int GetPassIndex(DecalCachedChunk decalCachedChunk) => decalCachedChunk.passIndexEmissive;
}
internal class DecalForwardEmissivePass : ScriptableRenderPass
{
private FilteringSettings m_FilteringSettings;
private ProfilingSampler m_ProfilingSampler;
private List<ShaderTagId> m_ShaderTagIdList;
private DecalDrawFowardEmissiveSystem m_DrawSystem;
public DecalForwardEmissivePass(DecalDrawFowardEmissiveSystem drawSystem)
{
renderPassEvent = RenderPassEvent.AfterRenderingOpaques;
ConfigureInput(ScriptableRenderPassInput.Depth); // Require depth
m_DrawSystem = drawSystem;
m_ProfilingSampler = new ProfilingSampler("Decal Forward Emissive Render");
m_FilteringSettings = new FilteringSettings(RenderQueueRange.opaque, -1);
m_ShaderTagIdList = new List<ShaderTagId>();
m_ShaderTagIdList.Add(new ShaderTagId(DecalShaderPassNames.DecalMeshForwardEmissive));
}
public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData)
{
SortingCriteria sortingCriteria = renderingData.cameraData.defaultOpaqueSortFlags;
DrawingSettings drawingSettings = CreateDrawingSettings(m_ShaderTagIdList, ref renderingData, sortingCriteria);
CommandBuffer cmd = CommandBufferPool.Get();
using (new ProfilingScope(cmd, m_ProfilingSampler))
{
context.ExecuteCommandBuffer(cmd);
cmd.Clear();
m_DrawSystem.Execute(cmd);
context.DrawRenderers(renderingData.cullResults, ref drawingSettings, ref m_FilteringSettings);
}
context.ExecuteCommandBuffer(cmd);
CommandBufferPool.Release(cmd);
}
}
}