refactor(rendering): move directional shadow execution defaults into pipeline

This commit is contained in:
2026-04-15 21:48:41 +08:00
parent 02438762fd
commit e23d9710e7
6 changed files with 162 additions and 14 deletions

View File

@@ -1,7 +1,11 @@
#include <XCEngine/Rendering/RenderPipeline.h>
#include <XCEngine/Rendering/Caches/DirectionalShadowSurfaceCache.h>
#include <XCEngine/Rendering/Execution/DirectionalShadowExecutionState.h>
#include "Components/CameraComponent.h"
#include "Rendering/Execution/CameraFramePlan.h"
#include "Rendering/Shadow/DirectionalShadowData.h"
namespace XCEngine {
namespace Rendering {
@@ -54,5 +58,35 @@ void RenderPipeline::ConfigureRenderSceneData(
BuildDefaultEnvironmentData(plan);
}
void ApplyDefaultRenderPipelineDirectionalShadowExecutionPolicy(
const CameraFramePlan& plan,
const DirectionalShadowSurfaceAllocation& shadowAllocation,
DirectionalShadowExecutionState& shadowState) {
shadowState.shadowCasterRequest.surface = shadowAllocation.surface;
shadowState.shadowCasterRequest.clearFlags = RenderClearFlags::Depth;
if (!shadowState.shadowCasterRequest.hasCameraDataOverride) {
shadowState.shadowCasterRequest.hasCameraDataOverride = true;
shadowState.shadowCasterRequest.cameraDataOverride =
plan.directionalShadow.cameraData;
}
shadowState.shadowData =
BuildRenderDirectionalShadowData(
plan.directionalShadow,
shadowAllocation.depthShaderView);
}
bool RenderPipeline::ConfigureDirectionalShadowExecutionState(
const CameraFramePlan& plan,
const DirectionalShadowSurfaceAllocation& shadowAllocation,
DirectionalShadowExecutionState& shadowState) const {
ApplyDefaultRenderPipelineDirectionalShadowExecutionPolicy(
plan,
shadowAllocation,
shadowState);
return shadowState.shadowCasterRequest.IsValid() &&
shadowState.shadowData.IsValid();
}
} // namespace Rendering
} // namespace XCEngine