61 lines
1.9 KiB
C++
61 lines
1.9 KiB
C++
#pragma once
|
|
|
|
#include <XCEngine/Core/Math/Vector3.h>
|
|
#include <XCEngine/Core/Math/Vector4.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 <array>
|
|
#include <cstdint>
|
|
#include <vector>
|
|
|
|
namespace XCEngine {
|
|
namespace Editor {
|
|
|
|
class SceneViewportSelectionOutlinePass {
|
|
public:
|
|
~SceneViewportSelectionOutlinePass() = default;
|
|
|
|
static constexpr uint32_t kMaxSelectedObjectCount = 256u;
|
|
|
|
void Shutdown();
|
|
|
|
bool Render(
|
|
const Rendering::RenderContext& renderContext,
|
|
const Rendering::RenderSurface& surface,
|
|
RHI::RHIResourceView* objectIdTextureView,
|
|
const std::vector<uint64_t>& selectedObjectIds,
|
|
bool debugSelectionMask = false);
|
|
|
|
private:
|
|
struct OutlineConstants {
|
|
Math::Vector4 viewportSizeAndTexelSize = Math::Vector4::Zero();
|
|
Math::Vector4 outlineColorAndWidth = Math::Vector4::Zero();
|
|
Math::Vector4 selectedInfo = Math::Vector4::Zero();
|
|
std::array<Math::Vector4, kMaxSelectedObjectCount> selectedObjectColors = {};
|
|
};
|
|
|
|
bool EnsureInitialized(const Rendering::RenderContext& renderContext);
|
|
bool CreateResources(const Rendering::RenderContext& renderContext);
|
|
void DestroyResources();
|
|
|
|
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;
|
|
};
|
|
|
|
} // namespace Editor
|
|
} // namespace XCEngine
|