mirror of
https://gitea.windcorp.ru/Wind-Corporation/Progressia.git
synced 2025-08-28 10:36:50 +03:00
TMP / Fixed vulkan_adapter.cpp
This commit is contained in:
@@ -62,10 +62,10 @@ void initialize(GraphicsInterface &gintp) {
|
||||
debug("game init begin");
|
||||
gint = &gintp;
|
||||
|
||||
texture1.reset(
|
||||
gint->newTexture(progressia::main::loadImage("assets/texture.png")));
|
||||
texture2.reset(
|
||||
gint->newTexture(progressia::main::loadImage("assets/texture2.png")));
|
||||
texture1 =
|
||||
gint->newTexture(progressia::main::loadImage("assets/texture.png"));
|
||||
texture2 =
|
||||
gint->newTexture(progressia::main::loadImage("assets/texture2.png"));
|
||||
|
||||
// Cube 1
|
||||
{
|
||||
@@ -91,7 +91,7 @@ void initialize(GraphicsInterface &gintp) {
|
||||
c.normal = normal;
|
||||
}
|
||||
|
||||
cube1.reset(gint->newPrimitive(vertices, indices, &*texture1));
|
||||
cube1 = gint->newPrimitive(vertices, indices, &*texture1);
|
||||
}
|
||||
|
||||
// Cube 2
|
||||
@@ -118,11 +118,11 @@ void initialize(GraphicsInterface &gintp) {
|
||||
c.normal = normal;
|
||||
}
|
||||
|
||||
cube2.reset(gint->newPrimitive(vertices, indices, &*texture2));
|
||||
cube2 = gint->newPrimitive(vertices, indices, &*texture2);
|
||||
}
|
||||
|
||||
perspective.reset(gint->newView());
|
||||
light.reset(gint->newLight());
|
||||
perspective = gint->newView();
|
||||
light = gint->newLight();
|
||||
|
||||
debug("game init complete");
|
||||
}
|
||||
|
@@ -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();
|
||||
|
Reference in New Issue
Block a user