65 lines
1.8 KiB
C++
65 lines
1.8 KiB
C++
#pragma once
|
|
|
|
#include <XCEngine/Core/Math/Vector3.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>
|
|
|
|
namespace XCEngine {
|
|
namespace Rendering {
|
|
namespace Passes {
|
|
|
|
struct InfiniteGridPassData {
|
|
bool valid = false;
|
|
Math::Vector3 cameraPosition = Math::Vector3::Zero();
|
|
Math::Vector3 cameraForward = Math::Vector3::Forward();
|
|
Math::Vector3 cameraRight = Math::Vector3::Right();
|
|
Math::Vector3 cameraUp = Math::Vector3::Up();
|
|
float verticalFovDegrees = 60.0f;
|
|
float nearClipPlane = 0.03f;
|
|
float farClipPlane = 2000.0f;
|
|
float orbitDistance = 6.0f;
|
|
};
|
|
|
|
struct InfiniteGridParameters {
|
|
bool valid = false;
|
|
float baseScale = 1.0f;
|
|
float transitionBlend = 0.0f;
|
|
float fadeDistance = 500.0f;
|
|
};
|
|
|
|
InfiniteGridParameters BuildInfiniteGridParameters(const InfiniteGridPassData& data);
|
|
|
|
class BuiltinInfiniteGridPass {
|
|
public:
|
|
~BuiltinInfiniteGridPass() = default;
|
|
|
|
void Shutdown();
|
|
|
|
bool Render(
|
|
const RenderContext& renderContext,
|
|
const RenderSurface& surface,
|
|
const InfiniteGridPassData& data);
|
|
|
|
private:
|
|
bool EnsureInitialized(const RenderContext& renderContext);
|
|
bool CreateResources(const 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;
|
|
};
|
|
|
|
} // namespace Passes
|
|
} // namespace Rendering
|
|
} // namespace XCEngine
|