refactor(rendering): split managed SRP layers and namespaces
This commit is contained in:
@@ -0,0 +1,102 @@
|
||||
using System;
|
||||
using XCEngine;
|
||||
using XCEngine.Rendering;
|
||||
|
||||
namespace XCEngine.Rendering.Renderer
|
||||
{
|
||||
public abstract class ScriptableRendererData : Object
|
||||
{
|
||||
private ScriptableRendererFeature[] m_rendererFeatures;
|
||||
|
||||
protected ScriptableRendererData()
|
||||
{
|
||||
}
|
||||
|
||||
internal ScriptableRenderer CreateRendererInstance()
|
||||
{
|
||||
return CreateRenderer();
|
||||
}
|
||||
|
||||
internal ScriptableRendererFeature[] CreateRendererFeaturesInstance()
|
||||
{
|
||||
return GetRendererFeatures();
|
||||
}
|
||||
|
||||
internal void ConfigureCameraRenderRequestInstance(
|
||||
ScriptableRenderPipelineCameraRequestContext context)
|
||||
{
|
||||
ConfigureCameraRenderRequest(context);
|
||||
|
||||
ScriptableRendererFeature[] rendererFeatures =
|
||||
GetRendererFeatures();
|
||||
for (int i = 0; i < rendererFeatures.Length; ++i)
|
||||
{
|
||||
ScriptableRendererFeature rendererFeature =
|
||||
rendererFeatures[i];
|
||||
if (rendererFeature == null ||
|
||||
!rendererFeature.isActive)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
rendererFeature.ConfigureCameraRenderRequest(
|
||||
context);
|
||||
}
|
||||
}
|
||||
|
||||
internal void ConfigureCameraFramePlanInstance(
|
||||
ScriptableRenderPipelinePlanningContext context)
|
||||
{
|
||||
ConfigureCameraFramePlan(context);
|
||||
|
||||
ScriptableRendererFeature[] rendererFeatures =
|
||||
GetRendererFeatures();
|
||||
for (int i = 0; i < rendererFeatures.Length; ++i)
|
||||
{
|
||||
ScriptableRendererFeature rendererFeature =
|
||||
rendererFeatures[i];
|
||||
if (rendererFeature == null ||
|
||||
!rendererFeature.isActive)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
rendererFeature.ConfigureCameraFramePlan(
|
||||
context);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual ScriptableRenderer CreateRenderer()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
protected virtual void ConfigureCameraRenderRequest(
|
||||
ScriptableRenderPipelineCameraRequestContext context)
|
||||
{
|
||||
}
|
||||
|
||||
protected virtual void ConfigureCameraFramePlan(
|
||||
ScriptableRenderPipelinePlanningContext context)
|
||||
{
|
||||
}
|
||||
|
||||
protected virtual ScriptableRendererFeature[] CreateRendererFeatures()
|
||||
{
|
||||
return Array.Empty<ScriptableRendererFeature>();
|
||||
}
|
||||
|
||||
private ScriptableRendererFeature[] GetRendererFeatures()
|
||||
{
|
||||
if (m_rendererFeatures == null)
|
||||
{
|
||||
m_rendererFeatures =
|
||||
CreateRendererFeatures() ??
|
||||
Array.Empty<ScriptableRendererFeature>();
|
||||
}
|
||||
|
||||
return m_rendererFeatures;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user