-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRenderer.hpp
More file actions
48 lines (35 loc) · 1.24 KB
/
Renderer.hpp
File metadata and controls
48 lines (35 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#pragma once
#include <etna/GlobalContext.hpp>
#include <etna/PerFrameCmdMgr.hpp>
#include <glm/glm.hpp>
#include <function2/function2.hpp>
#include "wsi/Keyboard.hpp"
#include "FramePacket.hpp"
#include "WorldRenderer.hpp"
class ImGuiRenderer;
using ResolutionProvider = fu2::unique_function<glm::uvec2() const>;
/**
* This class encapsulates things that are very unlikely to change from one sample to another.
* E.g. initialization, frame delivery logic, window resizing, gui setup, etc.
*/
class Renderer
{
public:
explicit Renderer(glm::uvec2 resolution);
~Renderer();
// Initializing all of rendering is a tricky multi-step dance
void initVulkan(std::span<const char*> instance_extensions);
void initFrameDelivery(vk::UniqueSurfaceKHR surface, ResolutionProvider res_provider);
void recreateSwapchain(glm::uvec2 res);
void loadScene(std::filesystem::path path);
void debugInput(const Keyboard& kb);
void update(const FramePacket& packet);
void drawFrame();
private:
ResolutionProvider resolutionProvider;
std::unique_ptr<etna::Window> window;
std::unique_ptr<etna::PerFrameCmdMgr> commandManager;
glm::uvec2 resolution;
std::unique_ptr<ImGuiRenderer> guiRenderer;
std::unique_ptr<WorldRenderer> worldRenderer;
};