TheAtlasEngine
 
Loading...
Searching...
No Matches
renderer_context.hpp
1#pragma once
2#include <string>
3#include <core/core.hpp>
4#include <drivers/vulkan-cpp/vk_swapchain.hpp>
5#include <core/scene/scene.hpp>
6
7namespace atlas {
19 public:
20 virtual ~render_context() = default;
21
26 void preload(const VkRenderPass& p_renderpass) {
27 return preload_assets(p_renderpass);
28 }
29
46 void begin_frame(const ::vk::command_buffer& p_current,
47 const window_settings& p_settings,
48 const VkRenderPass& p_renderpass,
49 const VkFramebuffer& p_framebuffer,
50 const glm::mat4& p_proj_view) {
51 return start_frame(
52 p_current, p_settings, p_renderpass, p_framebuffer, p_proj_view);
53 }
54
59 void end_frame() { return post_frame(); }
60
65 void set_background_color(const std::array<float, 4>& p_color) {
66 return background_color(p_color);
67 }
68
69 void current_scene_context(ref<scene> p_scene) {
70 return current_scene(std::move(p_scene));
71 }
72
73 private:
74 virtual void preload_assets(const VkRenderPass& p_renderpass) = 0;
75
76 virtual void start_frame(const ::vk::command_buffer& p_current,
77 const window_settings& p_settings,
78 const VkRenderPass& p_renderpass,
79 const VkFramebuffer& p_framebuffer,
80 const glm::mat4& p_proj_view) = 0;
81 virtual void post_frame() = 0;
82
83 virtual void background_color(const std::array<float, 4>& p_color) = 0;
84
85 virtual void current_scene(ref<scene>) = 0;
86 };
87
88 ref<render_context> initialize_renderer(
89 const window_settings& p_window_extent,
90 uint32_t p_image_size,
91 const std::string& p_tag);
92};
is an interface that defines a graphics APi-agnostic renderer
Definition renderer_context.hpp:18
void preload(const VkRenderPass &p_renderpass)
responsibility is to preload any data that is necessary to be loaded before being rendered
Definition renderer_context.hpp:26
void end_frame()
Intended to use to indicate when to end recording to the GPU in the current frame.
Definition renderer_context.hpp:59
void set_background_color(const std::array< float, 4 > &p_color)
sets the background color and request that change to the graphics API
Definition renderer_context.hpp:65
void begin_frame(const ::vk::command_buffer &p_current, const window_settings &p_settings, const VkRenderPass &p_renderpass, const VkFramebuffer &p_framebuffer, const glm::mat4 &p_proj_view)
indicator of when the start of the frame is
Definition renderer_context.hpp:46
settings for specification for atlas::window
Definition types.hpp:9