2022-08-19 02:40:34 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "shader.h"
|
2022-09-23 04:44:07 +00:00
|
|
|
#include "simpleengine/gfx/mesh.h"
|
2022-08-19 02:40:34 +00:00
|
|
|
|
2022-08-30 23:39:24 +00:00
|
|
|
#include <unordered_map>
|
2022-08-19 02:40:34 +00:00
|
|
|
#include <vector>
|
2022-09-23 04:44:07 +00:00
|
|
|
#include <queue>
|
2022-08-19 02:40:34 +00:00
|
|
|
|
|
|
|
namespace simpleengine::gfx {
|
2022-09-23 04:44:07 +00:00
|
|
|
class RenderingJob {
|
2022-08-19 02:40:34 +00:00
|
|
|
public:
|
2022-09-23 04:44:07 +00:00
|
|
|
gfx::Mesh& rendering_mesh;
|
|
|
|
glm::mat4 transform_mat;
|
2022-08-30 23:39:24 +00:00
|
|
|
|
2022-09-23 04:44:07 +00:00
|
|
|
RenderingJob(gfx::Mesh& mesh, glm::mat4 position) : rendering_mesh(mesh), transform_mat(position) {
|
2022-08-19 02:40:34 +00:00
|
|
|
|
2022-09-23 04:44:07 +00:00
|
|
|
}
|
|
|
|
};
|
2022-08-19 02:40:34 +00:00
|
|
|
|
2022-09-23 04:44:07 +00:00
|
|
|
class Renderer : public simpleengine::Renderable {
|
|
|
|
private:
|
|
|
|
GLFWwindow* window;
|
|
|
|
public:
|
2022-08-19 02:40:34 +00:00
|
|
|
|
2022-09-23 04:44:07 +00:00
|
|
|
std::queue<RenderingJob> rendering_queue;
|
2022-09-10 22:39:39 +00:00
|
|
|
gfx::Shader shader;
|
2022-08-19 02:40:34 +00:00
|
|
|
|
|
|
|
Renderer(GLFWwindow* window, gfx::Shader shader);
|
|
|
|
Renderer(GLFWwindow* window, GLuint shader_program);
|
2022-09-10 22:39:39 +00:00
|
|
|
|
|
|
|
void enable_debug();
|
|
|
|
|
2022-09-23 04:44:07 +00:00
|
|
|
virtual void queue_job(RenderingJob job);
|
|
|
|
virtual void create_job_buffers(RenderingJob& job);
|
2022-08-19 02:40:34 +00:00
|
|
|
|
|
|
|
virtual void initialize();
|
2022-09-10 22:39:39 +00:00
|
|
|
virtual void destroy() override;
|
2022-08-19 02:40:34 +00:00
|
|
|
|
2022-08-30 23:39:24 +00:00
|
|
|
virtual void update(const float& delta_time) override;
|
2022-08-19 02:40:34 +00:00
|
|
|
|
2022-09-16 15:14:38 +00:00
|
|
|
virtual void render() override;
|
2022-08-19 02:40:34 +00:00
|
|
|
};
|
|
|
|
}
|