TMP / Fixed vulkan_adapter.cpp

This commit is contained in:
2023-03-28 15:12:34 +02:00
parent 2c45f519fb
commit 2dc60d589c
4 changed files with 118 additions and 105 deletions

View File

@ -25,30 +25,26 @@ struct Vertex {
};
class Texture : private progressia::main::NonCopyable {
public:
using Backend = void *;
private:
Backend backend;
struct Backend;
std::unique_ptr<Backend> backend;
friend class GraphicsInterface;
friend class Primitive;
public:
Texture(Backend);
Texture(std::unique_ptr<Backend>);
~Texture();
};
class Primitive : private progressia::main::NonCopyable {
public:
using Backend = void *;
private:
Backend backend;
struct Backend;
std::unique_ptr<Backend> backend;
friend class GraphicsInterface;
public:
Primitive(Backend);
Primitive(std::unique_ptr<Backend>);
~Primitive();
void draw();
@ -57,14 +53,13 @@ class Primitive : private progressia::main::NonCopyable {
};
class View : private progressia::main::NonCopyable {
public:
using Backend = void *;
private:
Backend backend;
struct Backend;
std::unique_ptr<Backend> backend;
friend class GraphicsInterface;
public:
View(Backend);
View(std::unique_ptr<Backend>);
~View();
void configure(const glm::mat4 &proj, const glm::mat4 &view);
@ -72,14 +67,13 @@ class View : private progressia::main::NonCopyable {
};
class Light : private progressia::main::NonCopyable {
public:
using Backend = void *;
private:
Backend backend;
struct Backend;
std::unique_ptr<Backend> backend;
friend class GraphicsInterface;
public:
Light(Backend);
Light(std::unique_ptr<Backend>);
~Light();
void configure(const glm::vec3 &color, const glm::vec3 &from,
@ -98,18 +92,18 @@ class GraphicsInterface : private progressia::main::NonCopyable {
GraphicsInterface(Backend);
~GraphicsInterface();
Texture *newTexture(const Image &);
std::unique_ptr<Texture> newTexture(const Image &);
Primitive *newPrimitive(const std::vector<Vertex> &,
const std::vector<Vertex::Index> &,
Texture *texture);
std::unique_ptr<Primitive> newPrimitive(const std::vector<Vertex> &,
const std::vector<Vertex::Index> &,
Texture *texture);
glm::vec2 getViewport() const;
void setModelTransform(const glm::mat4 &);
View *newView();
Light *newLight();
std::unique_ptr<View> newView();
std::unique_ptr<Light> newLight();
void flush();
void startNextLayer();