refactor(srp): unify main-scene feature injection
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
using XCEngine;
|
||||
using XCEngine.Rendering;
|
||||
|
||||
namespace XCEngine.Rendering.Universal
|
||||
{
|
||||
internal static class UniversalMainSceneFeatureUtility
|
||||
{
|
||||
public static bool IsActive(
|
||||
RenderingData renderingData)
|
||||
{
|
||||
return renderingData != null &&
|
||||
renderingData.isMainSceneStage;
|
||||
}
|
||||
|
||||
public static bool SupportsPass(
|
||||
RenderingData renderingData,
|
||||
ScriptableRenderPass renderPass)
|
||||
{
|
||||
return IsActive(renderingData) &&
|
||||
renderPass != null &&
|
||||
renderPass.SupportsStage(
|
||||
renderingData.stage);
|
||||
}
|
||||
|
||||
public static bool EnqueuePass(
|
||||
ScriptableRenderer renderer,
|
||||
RenderingData renderingData,
|
||||
ScriptableRenderPass renderPass)
|
||||
{
|
||||
if (renderer == null ||
|
||||
!SupportsPass(
|
||||
renderingData,
|
||||
renderPass))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
renderer.EnqueuePass(renderPass);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user