Basic graphics structure
This commit is contained in:
@@ -2,7 +2,10 @@ target_sources(SeeleEngine
|
||||
PRIVATE
|
||||
Graphics.h
|
||||
Graphics.cpp
|
||||
RenderPath.h
|
||||
RenderPath.cpp
|
||||
View.h
|
||||
View.cpp
|
||||
WindowManager.h
|
||||
WindowManager.cpp
|
||||
Window.h
|
||||
|
||||
@@ -1,28 +1,22 @@
|
||||
#pragma once
|
||||
#include "MinimalEngine.h"
|
||||
#include "GraphicsResources.h"
|
||||
#include "Containers/Array.h"
|
||||
|
||||
namespace Seele {
|
||||
class Window;
|
||||
class Graphics
|
||||
{
|
||||
public:
|
||||
static Graphics& getInstance()
|
||||
{
|
||||
static Graphics instance;
|
||||
|
||||
return instance;
|
||||
}
|
||||
void init(GraphicsInitializer initializer);
|
||||
void beginFrame();
|
||||
void endFrame();
|
||||
virtual void init(GraphicsInitializer initializer) = 0;
|
||||
virtual void beginFrame() = 0;
|
||||
virtual void endFrame() = 0;
|
||||
virtual void* createWindow(const WindowCreateInfo& createInfo) = 0;
|
||||
|
||||
//Singleton
|
||||
private:
|
||||
Graphics();
|
||||
Graphics(Graphics const&) = delete;
|
||||
void operator=(Graphics const&) = delete;
|
||||
~Graphics();
|
||||
|
||||
friend class Window;
|
||||
};
|
||||
}
|
||||
@@ -6,4 +6,12 @@ namespace Seele
|
||||
{
|
||||
const char* windowLayoutFile;
|
||||
};
|
||||
struct WindowCreateInfo
|
||||
{
|
||||
int32 width;
|
||||
int32 height;
|
||||
const char* title;
|
||||
bool bFullscreen;
|
||||
};
|
||||
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
#include "RenderPath.h"
|
||||
|
||||
Seele::RenderPath::RenderPath(Graphics* graphics)
|
||||
: graphics(graphics)
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
#include "Graphics.h"
|
||||
namespace Seele
|
||||
{
|
||||
//A renderpath is a general Renderer for a view.
|
||||
class RenderPath
|
||||
{
|
||||
public:
|
||||
RenderPath(Graphics* graphics);
|
||||
virtual ~RenderPath();
|
||||
virtual void init() = 0;
|
||||
virtual void beginFrame() = 0;
|
||||
virtual void render() = 0;
|
||||
virtual void endFrame() = 0;
|
||||
protected:
|
||||
Graphics* graphics;
|
||||
};
|
||||
DECLARE_REF(RenderPath);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
#include "View.h"
|
||||
|
||||
Seele::View::View(PSection owner)
|
||||
: owner(owner)
|
||||
{
|
||||
}
|
||||
|
||||
Seele::View::~View()
|
||||
{
|
||||
}
|
||||
@@ -1,10 +1,18 @@
|
||||
#pragma once
|
||||
#include "Window.h"
|
||||
|
||||
// A view is a part of the window, which can be anything from a viewport to an editor
|
||||
class View
|
||||
#include "RenderPath.h"
|
||||
namespace Seele
|
||||
{
|
||||
public:
|
||||
private:
|
||||
Window::Section* owner;
|
||||
};
|
||||
// A view is a part of the window, which can be anything from a viewport to an editor
|
||||
class View
|
||||
{
|
||||
public:
|
||||
View(PSection owner);
|
||||
~View();
|
||||
private:
|
||||
PRenderPath renderer;
|
||||
PSection owner;
|
||||
};
|
||||
|
||||
DECLARE_REF(View)
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
target_sources(SeeleEngine
|
||||
PRIVATE
|
||||
VulkanGraphics.h
|
||||
VulkanGraphics.cpp)
|
||||
@@ -0,0 +1,18 @@
|
||||
#include "VulkanGraphics.h"
|
||||
|
||||
void Seele::VulkanGraphics::init(GraphicsInitializer initializer)
|
||||
{
|
||||
}
|
||||
|
||||
void Seele::VulkanGraphics::beginFrame()
|
||||
{
|
||||
}
|
||||
|
||||
void Seele::VulkanGraphics::endFrame()
|
||||
{
|
||||
}
|
||||
|
||||
void* Seele::VulkanGraphics::createWindow(const WindowCreateInfo& createInfo)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
#include "Graphics/Graphics.h"
|
||||
|
||||
namespace Seele
|
||||
{
|
||||
class VulkanGraphics : public Graphics
|
||||
{
|
||||
public:
|
||||
// Inherited via Graphics
|
||||
virtual void init(GraphicsInitializer initializer) override;
|
||||
virtual void beginFrame() override;
|
||||
virtual void endFrame() override;
|
||||
virtual void* createWindow(const WindowCreateInfo& createInfo) override;
|
||||
};
|
||||
}
|
||||
@@ -1,12 +1,14 @@
|
||||
#include "Window.h"
|
||||
#include "Graphics.h"
|
||||
#include <iostream>
|
||||
#include "Vulkan/VulkanGraphics.h"
|
||||
|
||||
Seele::Window::Window(const WindowCreateInfo& createInfo)
|
||||
: width(createInfo.width)
|
||||
, height(createInfo.height)
|
||||
, windowHandle(nullptr)
|
||||
{
|
||||
graphics = new VulkanGraphics();
|
||||
}
|
||||
|
||||
Seele::Window::~Window()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,33 +1,30 @@
|
||||
#pragma once
|
||||
#include "MinimalEngine.h"
|
||||
namespace Seele {
|
||||
struct WindowCreateInfo
|
||||
|
||||
// A window is divided into 5 sections, using a border layout
|
||||
// +--------------TOP------------------+
|
||||
// | |
|
||||
// L R
|
||||
// E I
|
||||
// F CENTER G
|
||||
// T H
|
||||
// | T
|
||||
// +-------------BOTTOM----------------+
|
||||
// In every section, there can be any number
|
||||
// of views, when there are multiple, they stack to tabs
|
||||
struct Section
|
||||
{
|
||||
int32 width;
|
||||
int32 height;
|
||||
const char* title;
|
||||
};
|
||||
DECLARE_REF(Section)
|
||||
|
||||
class Window
|
||||
{
|
||||
public:
|
||||
Window(const WindowCreateInfo& createInfo);
|
||||
~Window();
|
||||
private:
|
||||
// A window is divided into 5 sections, using a border layout
|
||||
// +--------------TOP------------------+
|
||||
// | |
|
||||
// L R
|
||||
// E I
|
||||
// F CENTER G
|
||||
// T H
|
||||
// | T
|
||||
// +-------------BOTTOM----------------+
|
||||
// In every section, there can be any number
|
||||
// of views, when there are multiple, they stack to tabs
|
||||
struct Section
|
||||
{
|
||||
|
||||
};
|
||||
void* windowHandle;
|
||||
Section top;
|
||||
Section bot;
|
||||
Section left;
|
||||
@@ -35,5 +32,7 @@ namespace Seele {
|
||||
Section center;
|
||||
uint32 width;
|
||||
uint32 height;
|
||||
Graphics* graphics;
|
||||
};
|
||||
DECLARE_REF(Window)
|
||||
}
|
||||
@@ -11,6 +11,6 @@ namespace Seele
|
||||
WindowManager(GraphicsInitializer initializer);
|
||||
~WindowManager();
|
||||
private:
|
||||
Array<RefPtr<Window>> windows;
|
||||
Array<PWindow> windows;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user