11#include <vk_mem_alloc.h>
18#include "VLA/Matrix.hpp"
57 m_name(name), m_view_id(0), 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);
66 void on_render(vk::CommandBuffer
cmd);
70 template<
typename T,
typename...
Args>
71 requires std::is_base_of_v<Layer, T>
73 auto&
layer = m_layers.push_layer<T>(std::forward<Args>(
args)...);
74 layer.view_id = m_view_id;
80 template<
typename T,
typename...
Args>
81 requires std::is_base_of_v<Layer, T>
83 auto&
layer = m_layers.push_layer<T>(std::forward<Args>(
args)...);
85 layer.view_id = m_view_id;
92 const std::string&
get_name()
const {
return m_name; }
103 void resize(vk::Extent2D
extent);
107 m_aspect_mode =
mode;
114 const VLA::Matrix4x4f&
get_projection()
const {
return m_camera_view_projection; }
118 bool changed = m_extent_changed;
119 m_extent_changed =
false;
128 vk::Extent2D get_im_gui_extent();
136 void destroy_viewport();
139 vk::Format find_depth_format();
140 void create_vulkan_resources();
165 vk::Format m_color_format = vk::Format::eR8G8B8A8Unorm;
166 vk::Format m_depth_format = vk::Format::eUndefined;
168 vk::Extent2D m_extent = {1280, 720};
169 bool m_extent_changed =
false;
Definition Application.hpp:22
AspectMode
Definition View.hpp:36
RenderMode
Definition View.hpp:43
ViewError
Definition View.hpp:27
@ VIEW_DOES_NOT_EXIST
Definition View.hpp:30
@ SUCCESS
Definition View.hpp:29
@ NAME_ALREADY_EXISTS
Definition View.hpp:28
Definition Application.hpp:42
Definition EngineServices.hpp:10
Definition EventVariant.hpp:19
Definition LayerList.hpp:15
Definition SDImGuiContext.hpp:27
Definition id_types.hpp:7
Definition ViewManager.hpp:21
vk::Extent2D get_extent() const
Definition View.hpp:102
bool is_open() const
Definition View.hpp:94
const LayerList & get_layers() const
Definition View.hpp:99
VkDescriptorSet get_display_texture() const
Definition View.hpp:133
VulkanContext & m_vulkan_ctx
Definition View.hpp:147
RenderMode get_render_mode() const
Definition View.hpp:111
T & push_layer(Args &&... args)
Definition View.hpp:72
void set_aspect_mode(AspectMode mode)
Definition View.hpp:106
std::string m_name
Definition View.hpp:142
const VLA::Matrix4x4f & get_projection() const
Definition View.hpp:114
vk::Format get_depth_format() const
Definition View.hpp:130
VLA::Matrix4x4f m_camera_view_projection
Definition View.hpp:167
ImVec2 get_content_region_extent() const
Definition View.hpp:125
void on_fixed_update(double dt)
Definition View.hpp:67
vk::Format get_color_format() const
Definition View.hpp:129
LayerList m_layers
Definition View.hpp:143
T & push_layer(int stageOrder, Args &&... args)
Definition View.hpp:82
ViewId get_view_id() const
Definition View.hpp:93
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:117
void on_event(EventVariant &e)
Definition View.hpp:65
vk::ImageView get_color_view() const
Definition View.hpp:131
const std::string & get_name() const
Definition View.hpp:92
vk::UniqueImageView m_depth_view
Definition View.hpp:161
AspectMode get_aspect_mode() const
Definition View.hpp:105
void set_render_mode(RenderMode mode)
Definition View.hpp:112
ViewId m_view_id
Definition View.hpp:145
void on_update(float dt)
Definition View.hpp:62
vk::UniqueImageView m_color_view
Definition View.hpp:157
void set_open(bool open)
Definition View.hpp:95
SDImGuiContext & m_imgui_ctx
Definition View.hpp:148
vk::ImageView get_depth_view() const
Definition View.hpp:132
ImVec2 get_content_region_pos() const
Definition View.hpp:124
LayerList & get_layers()
Definition View.hpp:98
Definition VulkanContext.hpp:22
consteval U64 type_id_of()
Definition type_id.hpp:6