refactor: move scene view post-pass planning into renderer
This commit is contained in:
@@ -346,6 +346,7 @@ add_library(XCEngine STATIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/XCEngine/Rendering/SceneRenderer.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/XCEngine/Rendering/Passes/BuiltinObjectIdPass.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/XCEngine/Rendering/Passes/BuiltinInfiniteGridPass.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/XCEngine/Rendering/Passes/BuiltinSceneViewPostPassPlan.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/XCEngine/Rendering/Passes/BuiltinObjectIdOutlinePass.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/XCEngine/Rendering/Pipelines/BuiltinForwardPipeline.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/Rendering/CameraRenderer.cpp
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
namespace XCEngine {
|
||||
namespace Rendering {
|
||||
namespace Passes {
|
||||
|
||||
enum class BuiltinSceneViewPostPassStep : uint8_t {
|
||||
ColorToRenderTarget,
|
||||
InfiniteGrid,
|
||||
SelectionOutline,
|
||||
ColorToShaderResource,
|
||||
SelectionMaskDebug
|
||||
};
|
||||
|
||||
struct BuiltinSceneViewPostPassPlanInput {
|
||||
bool overlayValid = false;
|
||||
bool hasSelection = false;
|
||||
bool debugSelectionMask = false;
|
||||
bool hasObjectIdShaderView = false;
|
||||
};
|
||||
|
||||
struct BuiltinSceneViewPostPassPlan {
|
||||
bool valid = false;
|
||||
std::vector<BuiltinSceneViewPostPassStep> steps;
|
||||
};
|
||||
|
||||
inline BuiltinSceneViewPostPassPlan BuildBuiltinSceneViewPostPassPlan(
|
||||
const BuiltinSceneViewPostPassPlanInput& input) {
|
||||
BuiltinSceneViewPostPassPlan plan = {};
|
||||
if (!input.overlayValid) {
|
||||
return plan;
|
||||
}
|
||||
|
||||
plan.valid = true;
|
||||
|
||||
if (input.debugSelectionMask) {
|
||||
plan.steps.push_back(BuiltinSceneViewPostPassStep::ColorToRenderTarget);
|
||||
if (input.hasSelection && input.hasObjectIdShaderView) {
|
||||
plan.steps.push_back(BuiltinSceneViewPostPassStep::SelectionMaskDebug);
|
||||
}
|
||||
plan.steps.push_back(BuiltinSceneViewPostPassStep::ColorToShaderResource);
|
||||
return plan;
|
||||
}
|
||||
|
||||
plan.steps.push_back(BuiltinSceneViewPostPassStep::ColorToRenderTarget);
|
||||
plan.steps.push_back(BuiltinSceneViewPostPassStep::InfiniteGrid);
|
||||
|
||||
if (input.hasSelection && input.hasObjectIdShaderView) {
|
||||
plan.steps = {
|
||||
BuiltinSceneViewPostPassStep::ColorToRenderTarget,
|
||||
BuiltinSceneViewPostPassStep::InfiniteGrid,
|
||||
BuiltinSceneViewPostPassStep::SelectionOutline,
|
||||
BuiltinSceneViewPostPassStep::ColorToShaderResource
|
||||
};
|
||||
return plan;
|
||||
}
|
||||
|
||||
plan.steps.push_back(BuiltinSceneViewPostPassStep::ColorToShaderResource);
|
||||
return plan;
|
||||
}
|
||||
|
||||
} // namespace Passes
|
||||
} // namespace Rendering
|
||||
} // namespace XCEngine
|
||||
Reference in New Issue
Block a user