Viewport controls
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
#pragma once
|
||||
#include "MinimalEngine.h"
|
||||
#include "Math/Math.h"
|
||||
#include "RenderGraph.h"
|
||||
#include "RenderGraphResources.h"
|
||||
#include "Component/Camera.h"
|
||||
|
||||
namespace Seele
|
||||
{
|
||||
@@ -12,27 +13,30 @@ template<typename RenderPassDataType>
|
||||
class RenderPass
|
||||
{
|
||||
public:
|
||||
RenderPass(Gfx::PGraphics graphics, Gfx::PViewport viewport)
|
||||
RenderPass(Gfx::PGraphics graphics)
|
||||
: graphics(graphics)
|
||||
, viewport(viewport)
|
||||
{}
|
||||
virtual ~RenderPass()
|
||||
{}
|
||||
void updateViewFrame(RenderPassDataType viewFrame) {
|
||||
passData = std::move(viewFrame);
|
||||
}
|
||||
virtual void beginFrame() = 0;
|
||||
virtual void beginFrame(const Component::Camera& cam) = 0;
|
||||
virtual void render() = 0;
|
||||
virtual void endFrame() = 0;
|
||||
virtual void publishOutputs() = 0;
|
||||
virtual void createRenderPass() = 0;
|
||||
void setResources(PRenderGraphResources _resources) { resources = _resources; }
|
||||
void setViewport(Gfx::PViewport _viewport)
|
||||
{
|
||||
viewport = _viewport;
|
||||
publishOutputs();
|
||||
}
|
||||
protected:
|
||||
struct ViewParameter
|
||||
{
|
||||
Math::Matrix4 viewMatrix;
|
||||
Math::Matrix4 projectionMatrix;
|
||||
Math::Matrix4 inverseProjectionMatrix;
|
||||
Math::Vector4 cameraPosition;
|
||||
Math::Vector2 screenDimensions;
|
||||
Math::Vector2 pad0;
|
||||
@@ -43,7 +47,7 @@ protected:
|
||||
Gfx::PGraphics graphics;
|
||||
Gfx::PViewport viewport;
|
||||
};
|
||||
template<typename T>
|
||||
concept RenderPassType = true;
|
||||
template<typename RP, typename T>
|
||||
concept RenderPassType = std::derived_from<RP, RenderPass<T>>;
|
||||
|
||||
} // namespace Seele
|
||||
|
||||
Reference in New Issue
Block a user