refactor(rendering): remove unused object id outline pass

This commit is contained in:
2026-04-15 22:36:38 +08:00
parent e9da6b290d
commit a458f2838c
3 changed files with 0 additions and 561 deletions

View File

@@ -1,92 +0,0 @@
#pragma once
#include <XCEngine/Core/Containers/String.h>
#include <XCEngine/Core/Math/Color.h>
#include <XCEngine/Core/Math/Vector3.h>
#include <XCEngine/Core/Math/Vector4.h>
#include <XCEngine/Core/Asset/ResourceHandle.h>
#include <XCEngine/Rendering/RenderContext.h>
#include <XCEngine/Rendering/RenderSurface.h>
#include <XCEngine/RHI/RHIDescriptorPool.h>
#include <XCEngine/RHI/RHIDescriptorSet.h>
#include <XCEngine/RHI/RHIEnums.h>
#include <XCEngine/RHI/RHIPipelineLayout.h>
#include <XCEngine/RHI/RHIPipelineState.h>
#include <XCEngine/RHI/RHIResourceView.h>
#include <XCEngine/Resources/Shader/Shader.h>
#include <array>
#include <cstdint>
#include <optional>
#include <vector>
namespace XCEngine {
namespace Rendering {
namespace Passes {
struct ObjectIdOutlineStyle {
Math::Color outlineColor = Math::Color(1.0f, 0.4f, 0.0f, 1.0f);
float outlineWidthPixels = 2.0f;
bool debugSelectionMask = false;
};
struct ObjectIdOutlinePassInputs {
RHI::RHIResourceView* objectIdTextureView = nullptr;
RHI::ResourceStates objectIdTextureState = RHI::ResourceStates::PixelShaderResource;
};
class BuiltinObjectIdOutlinePass {
public:
explicit BuiltinObjectIdOutlinePass(Containers::String shaderPath = Containers::String());
~BuiltinObjectIdOutlinePass() = default;
BuiltinObjectIdOutlinePass(const BuiltinObjectIdOutlinePass&) = delete;
BuiltinObjectIdOutlinePass& operator=(const BuiltinObjectIdOutlinePass&) = delete;
BuiltinObjectIdOutlinePass(BuiltinObjectIdOutlinePass&&) = delete;
BuiltinObjectIdOutlinePass& operator=(BuiltinObjectIdOutlinePass&&) = delete;
static constexpr uint32_t kMaxSelectedObjectCount = 256u;
void SetShaderPath(const Containers::String& shaderPath);
const Containers::String& GetShaderPath() const;
void Shutdown();
bool Render(
const RenderContext& renderContext,
const RenderSurface& surface,
const ObjectIdOutlinePassInputs& inputs,
const std::vector<uint64_t>& selectedObjectIds,
const ObjectIdOutlineStyle& style = {});
private:
struct OutlineConstants {
Math::Vector4 viewportSizeAndTexelSize = Math::Vector4::Zero();
Math::Vector4 outlineColor = Math::Vector4::Zero();
Math::Vector4 selectedInfo = Math::Vector4::Zero();
std::array<Math::Vector4, kMaxSelectedObjectCount> selectedObjectColors = {};
};
bool EnsureInitialized(const RenderContext& renderContext, const RenderSurface& surface);
bool CreateResources(const RenderContext& renderContext, const RenderSurface& surface);
void DestroyResources();
bool HasCreatedResources() const;
void ResetState();
RHI::RHIDevice* m_device = nullptr;
RHI::RHIType m_backendType = RHI::RHIType::D3D12;
RHI::RHIPipelineLayout* m_pipelineLayout = nullptr;
RHI::RHIPipelineState* m_pipelineState = nullptr;
RHI::RHIDescriptorPool* m_constantPool = nullptr;
RHI::RHIDescriptorSet* m_constantSet = nullptr;
RHI::RHIDescriptorPool* m_texturePool = nullptr;
RHI::RHIDescriptorSet* m_textureSet = nullptr;
Containers::String m_shaderPath;
std::optional<Resources::ResourceHandle<Resources::Shader>> m_builtinObjectIdOutlineShader;
RHI::Format m_renderTargetFormat = RHI::Format::Unknown;
uint32_t m_renderTargetSampleCount = 1u;
};
} // namespace Passes
} // namespace Rendering
} // namespace XCEngine