2021-05-06 17:02:10 +02:00
|
|
|
#pragma once
|
|
|
|
|
#include "MinimalEngine.h"
|
|
|
|
|
#include "Math/Math.h"
|
2022-11-17 16:47:42 +01:00
|
|
|
#include "RenderGraphResources.h"
|
|
|
|
|
#include "Component/Camera.h"
|
2021-05-06 17:02:10 +02:00
|
|
|
|
|
|
|
|
namespace Seele
|
|
|
|
|
{
|
2021-09-23 10:10:39 +02:00
|
|
|
DECLARE_NAME_REF(Gfx, Viewport)
|
|
|
|
|
DECLARE_NAME_REF(Gfx, Graphics)
|
2021-05-06 17:02:10 +02:00
|
|
|
DECLARE_NAME_REF(Gfx, RenderPass)
|
2021-10-01 19:55:04 +02:00
|
|
|
template<typename RenderPassDataType>
|
2021-05-06 17:02:10 +02:00
|
|
|
class RenderPass
|
|
|
|
|
{
|
|
|
|
|
public:
|
2022-11-17 16:47:42 +01:00
|
|
|
RenderPass(Gfx::PGraphics graphics)
|
2021-10-01 19:55:04 +02:00
|
|
|
: graphics(graphics)
|
|
|
|
|
{}
|
|
|
|
|
virtual ~RenderPass()
|
|
|
|
|
{}
|
|
|
|
|
void updateViewFrame(RenderPassDataType viewFrame) {
|
|
|
|
|
passData = std::move(viewFrame);
|
|
|
|
|
}
|
2022-11-17 16:47:42 +01:00
|
|
|
virtual void beginFrame(const Component::Camera& cam) = 0;
|
2022-04-15 23:45:44 +02:00
|
|
|
virtual void render() = 0;
|
|
|
|
|
virtual void endFrame() = 0;
|
2021-05-06 17:02:10 +02:00
|
|
|
virtual void publishOutputs() = 0;
|
|
|
|
|
virtual void createRenderPass() = 0;
|
2022-11-15 12:19:11 +01:00
|
|
|
void setResources(PRenderGraphResources _resources) { resources = _resources; }
|
2022-11-17 16:47:42 +01:00
|
|
|
void setViewport(Gfx::PViewport _viewport)
|
|
|
|
|
{
|
|
|
|
|
viewport = _viewport;
|
|
|
|
|
publishOutputs();
|
|
|
|
|
}
|
2021-05-06 17:02:10 +02:00
|
|
|
protected:
|
2021-10-13 15:20:30 +02:00
|
|
|
struct ViewParameter
|
2021-05-06 17:02:10 +02:00
|
|
|
{
|
2022-11-15 12:19:11 +01:00
|
|
|
Math::Matrix4 viewMatrix;
|
|
|
|
|
Math::Matrix4 projectionMatrix;
|
|
|
|
|
Math::Vector4 cameraPosition;
|
|
|
|
|
Math::Vector2 screenDimensions;
|
|
|
|
|
Math::Vector2 pad0;
|
2021-05-10 23:57:55 +02:00
|
|
|
} viewParams;
|
2021-10-01 19:55:04 +02:00
|
|
|
PRenderGraphResources resources;
|
|
|
|
|
RenderPassDataType passData;
|
2021-05-06 17:02:10 +02:00
|
|
|
Gfx::PRenderPass renderPass;
|
2021-09-23 10:10:39 +02:00
|
|
|
Gfx::PGraphics graphics;
|
|
|
|
|
Gfx::PViewport viewport;
|
2021-05-06 17:02:10 +02:00
|
|
|
};
|
2022-11-17 16:47:42 +01:00
|
|
|
template<typename RP, typename T>
|
|
|
|
|
concept RenderPassType = std::derived_from<RP, RenderPass<T>>;
|
2021-10-01 19:55:04 +02:00
|
|
|
|
2021-05-06 17:02:10 +02:00
|
|
|
} // namespace Seele
|