12#include <vk_mem_alloc.h>
19#include "VLA/Matrix.hpp"
57 m_name(name), m_vulkan_ctx(services.vulkan), m_imgui_ctx(services.imgui) {
58 m_camera_view_projection = VLA::Matrix4x4f::Ortho(-1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f);
63 virtual void on_gui_render();
66 virtual void on_render(vk::CommandBuffer
cmd);
70 template<
typename T,
typename...
Args>
71 requires std::is_base_of_v<Layer, T>
73 return m_layers.push_layer<T>(std::forward<Args>(
args)...);
76 template<
typename T,
typename...
Args>
77 requires std::is_base_of_v<Layer, T>
79 auto layer = std::make_unique<T>(std::forward<Args>(
args)...);
81 layer->m_view_id = m_view_id;
84 if (
static_cast<size_t>(
stageOrder) >= m_layers_by_stage.size()) {
89 return static_cast<T&
>(*m_layers_by_stage[
stageOrder]);
93 const std::string&
get_name()
const {
return m_name; }
108 m_aspect_mode =
mode;
115 const VLA::Matrix4x4f&
get_projection()
const {
return m_camera_view_projection; }
119 bool changed = m_extent_changed;
120 m_extent_changed =
false;
135 void cleanup_layered_render();
138 void create_vulkan_resources();
169 bool m_extent_changed =
false;
Definition Application.hpp:58
Definition LayerList.hpp:21
Base class for all layers. Prefer using System, RenderStage, or Panel instead.
Definition Layer.hpp:28
Definition SDImGuiContext.hpp:27
Definition ViewManager.hpp:26
bool is_open() const
Definition View.hpp:95
const LayerList & get_layers() const
Definition View.hpp:100
VulkanContext & m_vulkan_ctx
Definition View.hpp:145
RenderMode get_render_mode() const
Definition View.hpp:112
VkExtent2D get_extent() const
Definition View.hpp:103
virtual void on_fixed_update(double dt)
Definition View.hpp:67
T & push_layer(Args &&... args)
Definition View.hpp:72
void set_aspect_mode(AspectMode mode)
Definition View.hpp:107
std::string m_name
Definition View.hpp:140
vk::UniqueRenderPass m_layered_rp
Definition View.hpp:152
const VLA::Matrix4x4f & get_projection() const
Definition View.hpp:115
vk::RenderPass get_layered_render_pass() const
Definition View.hpp:131
VLA::Matrix4x4f m_camera_view_projection
Definition View.hpp:167
ImVec2 get_content_region_extent() const
Definition View.hpp:126
std::vector< std::unique_ptr< Layer > > m_layers_by_stage
Definition View.hpp:166
LayerList m_layers
Definition View.hpp:141
vk::UniqueFramebuffer m_layered_framebuffer
Definition View.hpp:164
T & push_layer(int stageOrder, Args &&... args)
Definition View.hpp:78
ViewId get_view_id() const
Definition View.hpp:94
View(const std::string &name, const EngineServices &services)
Definition View.hpp:56
bool consume_extent_changed()
Returns true (once) if the extent changed since the last call.
Definition View.hpp:118
const std::string & get_name() const
Definition View.hpp:93
vk::UniqueImageView m_depth_view
Definition View.hpp:160
AspectMode get_aspect_mode() const
Definition View.hpp:106
void set_render_mode(RenderMode mode)
Definition View.hpp:113
virtual void on_event(Event &e)
Definition View.hpp:65
ViewId m_view_id
Definition View.hpp:143
void on_update(float dt)
Definition View.hpp:62
vk::UniqueImageView m_color_view
Definition View.hpp:156
void set_open(bool open)
Definition View.hpp:96
SDImGuiContext & m_imgui_ctx
Definition View.hpp:146
ImVec2 get_content_region_pos() const
Definition View.hpp:125
LayerList & get_layers()
Definition View.hpp:99
Definition VulkanContext.hpp:22
Definition Application.hpp:28
AspectMode
Definition View.hpp:35
RenderMode
Definition View.hpp:42
ViewError
Definition View.hpp:26
@ VIEW_DOES_NOT_EXIST
Definition View.hpp:29
@ SUCCESS
Definition View.hpp:28
@ NAME_ALREADY_EXISTS
Definition View.hpp:27
Definition EngineServices.hpp:10
Definition id_types.hpp:7
std::uint32_t u32
Definition types.hpp:15
constexpr T g_type_max
Definition types.hpp:21