Started declaring graphics resources

This commit is contained in:
Dynamitos
2020-03-06 11:32:01 +01:00
parent 328edf5196
commit df3ed3c49e
8 changed files with 150 additions and 14 deletions
+108
View File
@@ -13,5 +13,113 @@ namespace Seele
const char* title; const char* title;
bool bFullscreen; bool bFullscreen;
}; };
class RenderCommandBase
{
};
DECLARE_REF(RenderCommandBase);
class DescriptorBinding
{
public:
DescriptorBinding()
: binding(0)
, descriptorType(VK_DESCRIPTOR_TYPE_MAX_ENUM)
, descriptorCount(-1)
, shaderStages(VK_SHADER_STAGE_ALL)
{}
DescriptorBinding(const DescriptorBinding& other)
: binding(other.binding)
, descriptorType(other.descriptorType)
, descriptorCount(other.descriptorCount)
, shaderStages(other.shaderStages)
{}
void operator=(const DescriptorBinding& other)
{
binding = other.binding;
descriptorType = other.descriptorType;
descriptorCount = other.descriptorCount;
shaderStages = other.shaderStages;
}
uint32_t binding;
//TODO make generic enum
VkDescriptorType descriptorType;
uint32_t descriptorCount;
VkShaderStageFlags shaderStages;
};
DECLARE_REF(DescriptorBinding);
class DescriptorAllocator
{
};
DECLARE_REF(DescriptorAllocator);
class DescriptorSet
{
};
DECLARE_REF(DescriptorSet);
class DescriptorLayout
{
};
DECLARE_REF(DescriptorLayout);
class PipelineLayout
{
};
DECLARE_REF(PipelineLayout);
class VertexDeclaration
{
};
DECLARE_REF(VertexDeclaration);
class GraphicsPipeline
{
};
DECLARE_REF(GraphicsPipeline);
class UniformBuffer
{
};
DECLARE_REF(UniformBuffer);
class Viewport
{
};
DECLARE_REF(Viewport);
class VertexBuffer
{
};
DECLARE_REF(VertexBuffer);
class IndexBuffer
{
};
DECLARE_REF(IndexBuffer);
class StructuredBuffer
{
};
DECLARE_REF(StructuredBuffer);
class Texture
{
};
DECLARE_REF(Texture);
class Texture2D : public Texture
{
};
DECLARE_REF(Texture2D);
class RenderPass
{
};
DECLARE_REF(RenderPass);
} }
+30
View File
@@ -0,0 +1,30 @@
#include "SceneRenderPath.h"
Seele::SceneRenderPath::SceneRenderPath(Graphics* graphics)
: RenderPath(graphics)
{
}
Seele::SceneRenderPath::~SceneRenderPath()
{
}
void Seele::SceneRenderPath::applyArea(Rect area)
{
}
void Seele::SceneRenderPath::init()
{
}
void Seele::SceneRenderPath::beginFrame()
{
}
void Seele::SceneRenderPath::render()
{
}
void Seele::SceneRenderPath::endFrame()
{
}
+1 -1
View File
@@ -6,7 +6,7 @@ namespace Seele
class SceneRenderPath : public RenderPath class SceneRenderPath : public RenderPath
{ {
public: public:
SceneRenderPath(); SceneRenderPath(Graphics* graphics);
virtual ~SceneRenderPath(); virtual ~SceneRenderPath();
virtual void applyArea(Rect area) override; virtual void applyArea(Rect area) override;
virtual void init() override; virtual void init() override;
+3 -6
View File
@@ -1,15 +1,12 @@
#include "SceneView.h" #include "SceneView.h"
#include "SceneRenderPath.h" #include "SceneRenderPath.h"
Seele::SceneView::SceneView() Seele::SceneView::SceneView(Graphics* graphics)
: View(graphics)
{ {
renderer = new SceneRenderPath(graphics);
} }
Seele::SceneView::~SceneView() Seele::SceneView::~SceneView()
{ {
} }
void Seele::SceneView::initRenderer()
{
renderer = new SceneRenderPath();
}
+1 -2
View File
@@ -5,8 +5,7 @@ namespace Seele
class SceneView : public View class SceneView : public View
{ {
public: public:
SceneView(); SceneView(Graphics* graphics);
~SceneView(); ~SceneView();
virtual void initRenderer() override;
}; };
} }
+2 -1
View File
@@ -1,6 +1,7 @@
#include "View.h" #include "View.h"
Seele::View::View() Seele::View::View(Graphics* graphics)
: graphics(graphics)
{ {
} }
+3 -2
View File
@@ -2,17 +2,18 @@
#include "RenderPath.h" #include "RenderPath.h"
namespace Seele namespace Seele
{ {
class Graphics;
// A view is a part of the window, which can be anything from a viewport to an editor // A view is a part of the window, which can be anything from a viewport to an editor
class View class View
{ {
public: public:
View(); View(Graphics* graphics);
virtual ~View(); virtual ~View();
virtual void initRenderer() = 0;
void beginFrame(); void beginFrame();
void endFrame(); void endFrame();
void applyArea(Rect area); void applyArea(Rect area);
protected: protected:
Graphics* graphics;
PRenderPath renderer; PRenderPath renderer;
}; };
+2 -2
View File
@@ -6,10 +6,10 @@ Seele::Window::Window(const WindowCreateInfo& createInfo)
: width(createInfo.width) : width(createInfo.width)
, height(createInfo.height) , height(createInfo.height)
{ {
graphics = new VulkanGraphics();
center = new Section(); center = new Section();
center->resizeArea(Rect(1, 1, 0, 0)); center->resizeArea(Rect(1, 1, 0, 0));
center->addView(new SceneView()); center->addView(new SceneView(graphics));
graphics = new VulkanGraphics();
windowHandle = graphics->createWindow(createInfo); windowHandle = graphics->createWindow(createInfo);
} }