feat(rendering): add managed SRP renderer runtime

This commit is contained in:
2026-04-19 00:05:29 +08:00
parent a57b322bc7
commit b989edca91
50 changed files with 5732 additions and 171 deletions

View File

@@ -0,0 +1,99 @@
using System;
namespace XCEngine
{
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;
}
}
}