More refactoring

This commit is contained in:
Dynamitos
2023-11-15 00:06:00 +01:00
parent 59d6c9d794
commit f8f48352a3
49 changed files with 930 additions and 1015 deletions
+82 -46
View File
@@ -3,50 +3,6 @@
using namespace Seele;
using namespace Seele::Gfx;
RenderTargetLayout::RenderTargetLayout()
: inputAttachments()
, colorAttachments()
, depthAttachment()
, width(0)
, height(0)
{
}
RenderTargetLayout::RenderTargetLayout(PRenderTargetAttachment depthAttachment)
: inputAttachments()
, colorAttachments()
, depthAttachment(depthAttachment)
, width(depthAttachment->getTexture()->getSizeX())
, height(depthAttachment->getTexture()->getSizeY())
{
}
RenderTargetLayout::RenderTargetLayout(PRenderTargetAttachment colorAttachment, PRenderTargetAttachment depthAttachment)
: inputAttachments()
, depthAttachment(depthAttachment)
, width(depthAttachment->getTexture()->getSizeX())
, height(depthAttachment->getTexture()->getSizeY())
{
colorAttachments.add(colorAttachment);
}
RenderTargetLayout::RenderTargetLayout(Array<PRenderTargetAttachment> colorAttachments, PRenderTargetAttachment depthAttachment)
: inputAttachments()
, colorAttachments(colorAttachments)
, depthAttachment(depthAttachment)
, width(depthAttachment->getTexture()->getSizeX())
, height(depthAttachment->getTexture()->getSizeY())
{
}
RenderTargetLayout::RenderTargetLayout(Array<PRenderTargetAttachment> inputAttachments, Array<PRenderTargetAttachment> colorAttachments, PRenderTargetAttachment depthAttachment)
: inputAttachments(inputAttachments)
, colorAttachments(colorAttachments)
, depthAttachment(depthAttachment)
, width(depthAttachment->getTexture()->getSizeX())
, height(depthAttachment->getTexture()->getSizeY())
{
}
Window::Window(const WindowCreateInfo& createInfo)
: windowState(createInfo)
{
@@ -57,8 +13,8 @@ Window::~Window()
}
Viewport::Viewport(PWindow owner, const ViewportCreateInfo& viewportInfo)
: sizeX(std::min(owner->getSizeX(), viewportInfo.dimensions.size.x))
, sizeY(std::min(owner->getSizeY(), viewportInfo.dimensions.size.y))
: sizeX(std::min(owner->getWidth(), viewportInfo.dimensions.size.x))
, sizeY(std::min(owner->getHeight(), viewportInfo.dimensions.size.y))
, offsetX(viewportInfo.dimensions.offset.x)
, offsetY(viewportInfo.dimensions.offset.y)
, fieldOfView(viewportInfo.fieldOfView)
@@ -81,3 +37,83 @@ Matrix4 Viewport::getProjectionMatrix() const
return glm::ortho(0.0f, (float)sizeX, (float)sizeY, 0.0f);
}
}
RenderTargetAttachment::RenderTargetAttachment(PTexture2D texture,
SeAttachmentLoadOp loadOp = SE_ATTACHMENT_LOAD_OP_LOAD,
SeAttachmentStoreOp storeOp = SE_ATTACHMENT_STORE_OP_STORE,
SeAttachmentLoadOp stencilLoadOp = SE_ATTACHMENT_LOAD_OP_DONT_CARE,
SeAttachmentStoreOp stencilStoreOp = SE_ATTACHMENT_STORE_OP_DONT_CARE)
: clear()
, componentFlags(0)
, loadOp(loadOp)
, storeOp(storeOp)
, stencilLoadOp(stencilLoadOp)
, stencilStoreOp(stencilStoreOp)
, texture(texture)
{
}
RenderTargetAttachment::~RenderTargetAttachment()
{
}
SwapchainAttachment::SwapchainAttachment(PWindow owner,
SeAttachmentLoadOp loadOp = SE_ATTACHMENT_LOAD_OP_LOAD,
SeAttachmentStoreOp storeOp = SE_ATTACHMENT_STORE_OP_STORE,
SeAttachmentLoadOp stencilLoadOp = SE_ATTACHMENT_LOAD_OP_DONT_CARE,
SeAttachmentStoreOp stencilStoreOp = SE_ATTACHMENT_STORE_OP_DONT_CARE)
: RenderTargetAttachment(nullptr, loadOp, storeOp, stencilLoadOp, stencilStoreOp), owner(owner)
{
clear.color.float32[0] = 0.0f;
clear.color.float32[1] = 0.0f;
clear.color.float32[2] = 0.0f;
clear.color.float32[3] = 1.0f;
componentFlags = SE_COLOR_COMPONENT_R_BIT | SE_COLOR_COMPONENT_G_BIT | SE_COLOR_COMPONENT_B_BIT | SE_COLOR_COMPONENT_A_BIT;
}
SwapchainAttachment::~SwapchainAttachment()
{
}
RenderTargetLayout::RenderTargetLayout()
: inputAttachments()
, colorAttachments()
, depthAttachment()
, width(0)
, height(0)
{
}
RenderTargetLayout::RenderTargetLayout(PRenderTargetAttachment depthAttachment)
: inputAttachments()
, colorAttachments()
, depthAttachment(depthAttachment)
, width(depthAttachment->getTexture()->getWidth())
, height(depthAttachment->getTexture()->getHeight())
{
}
RenderTargetLayout::RenderTargetLayout(PRenderTargetAttachment colorAttachment, PRenderTargetAttachment depthAttachment)
: inputAttachments()
, depthAttachment(depthAttachment)
, width(depthAttachment->getTexture()->getWidth())
, height(depthAttachment->getTexture()->getHeight())
{
colorAttachments.add(colorAttachment);
}
RenderTargetLayout::RenderTargetLayout(Array<PRenderTargetAttachment> colorAttachments, PRenderTargetAttachment depthAttachment)
: inputAttachments()
, colorAttachments(colorAttachments)
, depthAttachment(depthAttachment)
, width(depthAttachment->getTexture()->getWidth())
, height(depthAttachment->getTexture()->getHeight())
{
}
RenderTargetLayout::RenderTargetLayout(Array<PRenderTargetAttachment> inputAttachments, Array<PRenderTargetAttachment> colorAttachments, PRenderTargetAttachment depthAttachment)
: inputAttachments(inputAttachments)
, colorAttachments(colorAttachments)
, depthAttachment(depthAttachment)
, width(depthAttachment->getTexture()->getWidth())
, height(depthAttachment->getTexture()->getHeight())
{
}