74 lines
2.1 KiB
C#
74 lines
2.1 KiB
C#
using XCEngine;
|
|
using XCEngine.Rendering;
|
|
|
|
namespace XCEngine.Rendering.Universal
|
|
{
|
|
internal sealed class UniversalShadowCasterBlock
|
|
{
|
|
private readonly DrawObjectsPass m_drawShadowCasterPass =
|
|
new DrawObjectsPass(
|
|
RenderPassEvent.BeforeRenderingShadows,
|
|
SceneRenderPhase.Opaque,
|
|
RendererListDesc.CreateDefault(
|
|
RendererListType.ShadowCaster));
|
|
|
|
public void ConfigureCameraFramePlan(
|
|
ScriptableRenderPipelinePlanningContext context,
|
|
ShadowCasterBlockData shadowCaster)
|
|
{
|
|
if (context == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (shadowCaster != null &&
|
|
shadowCaster.enabled)
|
|
{
|
|
context.RequestShadowCasterStage();
|
|
return;
|
|
}
|
|
|
|
context.ClearShadowCasterStage();
|
|
}
|
|
|
|
public void ConfigureDirectionalShadowExecutionState(
|
|
DirectionalShadowExecutionContext context,
|
|
ShadowCasterBlockData shadowCaster)
|
|
{
|
|
if (context == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (!context.hasPlannedMainDirectionalShadow ||
|
|
shadowCaster == null ||
|
|
!shadowCaster.enabled)
|
|
{
|
|
context.ClearDirectionalShadowExecution();
|
|
return;
|
|
}
|
|
|
|
context.UseDefaultMainDirectionalShadowExecution();
|
|
}
|
|
|
|
public void EnqueueRenderPasses(
|
|
ScriptableRenderer renderer,
|
|
ShadowCasterBlockData shadowCaster)
|
|
{
|
|
if (renderer == null ||
|
|
shadowCaster == null ||
|
|
!shadowCaster.enabled)
|
|
{
|
|
return;
|
|
}
|
|
|
|
m_drawShadowCasterPass.Configure(
|
|
shadowCaster.passEvent,
|
|
SceneRenderPhase.Opaque,
|
|
shadowCaster.rendererListDesc,
|
|
shadowCaster.drawingSettings);
|
|
renderer.EnqueuePass(m_drawShadowCasterPass);
|
|
}
|
|
}
|
|
}
|