SDEngine
Game Engine
Loading...
Searching...
No Matches
sd::View Class Reference

#include <View.hpp>

+ Inheritance diagram for sd::View:
+ Collaboration diagram for sd::View:

Public Member Functions

 View (const std::string &name, const EngineServices &services)
 
virtual ~View ()
 
void on_update (float dt)
 
virtual void on_gui_render ()
 
virtual void on_event (Event &e)
 
virtual void on_render (vk::CommandBuffer cmd)
 
virtual void on_fixed_update (double dt)
 
template<typename T , typename... Args>
requires std::is_base_of_v<Layer, T>
T & push_layer (Args &&... args)
 
template<typename T , typename... Args>
requires std::is_base_of_v<Layer, T>
T & push_layer (int stageOrder, Args &&... args)
 
const std::string & get_name () const
 
ViewId get_view_id () const
 
bool is_open () const
 
void set_open (bool open)
 
LayerListget_layers ()
 
const LayerListget_layers () const
 
VkExtent2D get_extent () const
 
void resize (VkExtent2D extent)
 
AspectMode get_aspect_mode () const
 
void set_aspect_mode (AspectMode mode)
 
RenderMode get_render_mode () const
 
void set_render_mode (RenderMode mode)
 
const VLA::Matrix4x4f & get_projection () const
 
bool consume_extent_changed ()
 Returns true (once) if the extent changed since the last call.
 
ImVec2 get_content_region_pos () const
 
ImVec2 get_content_region_extent () const
 
VkExtent2D get_im_gui_extent ()
 
VkFormat find_depth_format ()
 
vk::RenderPass get_layered_render_pass () const
 
Layerget_layer_by_stage (u32 stage)
 
void setup_layered_render (u32 maxStages, VkExtent2D initialExtent={1280, 720})
 
void cleanup_layered_render ()
 

Private Member Functions

void create_vulkan_resources ()
 

Private Attributes

std::string m_name
 
LayerList m_layers
 
bool m_open = true
 
ViewId m_view_id
 
VulkanContextm_vulkan_ctx
 
SDImGuiContextm_imgui_ctx
 
ImVec2 m_content_region_pos {0, 0}
 
ImVec2 m_content_region_extent {0, 0}
 
vk::UniqueRenderPass m_layered_rp
 
VkImage m_color_image = VK_NULL_HANDLE
 
VmaAllocation m_color_allocation = VK_NULL_HANDLE
 
vk::UniqueImageView m_color_view
 
VkImage m_depth_image = VK_NULL_HANDLE
 
VmaAllocation m_depth_allocation = VK_NULL_HANDLE
 
vk::UniqueImageView m_depth_view
 
VkDescriptorSet m_display_tex_ds = VK_NULL_HANDLE
 
vk::UniqueFramebuffer m_layered_framebuffer
 
std::vector< std::unique_ptr< Layer > > m_layers_by_stage
 
VLA::Matrix4x4f m_camera_view_projection
 
VkExtent2D m_extent = {1280, 720}
 
bool m_extent_changed = false
 
AspectMode m_aspect_mode = AspectMode::BEST_FIT
 
RenderMode m_render_mode = RenderMode::SHADED
 

Friends

class Application
 
class ViewManager
 

Constructor & Destructor Documentation

◆ View()

sd::View::View ( const std::string &  name,
const EngineServices services 
)
inline

◆ ~View()

sd::View::~View ( )
virtual

Member Function Documentation

◆ cleanup_layered_render()

void sd::View::cleanup_layered_render ( )

◆ consume_extent_changed()

bool sd::View::consume_extent_changed ( )
inline

Returns true (once) if the extent changed since the last call.

◆ create_vulkan_resources()

void sd::View::create_vulkan_resources ( )
private

◆ find_depth_format()

VkFormat sd::View::find_depth_format ( )

◆ get_aspect_mode()

AspectMode sd::View::get_aspect_mode ( ) const
inline

◆ get_content_region_extent()

ImVec2 sd::View::get_content_region_extent ( ) const
inline

◆ get_content_region_pos()

ImVec2 sd::View::get_content_region_pos ( ) const
inline

◆ get_extent()

VkExtent2D sd::View::get_extent ( ) const
inline

◆ get_im_gui_extent()

VkExtent2D sd::View::get_im_gui_extent ( )

◆ get_layer_by_stage()

sd::Layer * sd::View::get_layer_by_stage ( u32  stage)

◆ get_layered_render_pass()

vk::RenderPass sd::View::get_layered_render_pass ( ) const
inline

◆ get_layers() [1/2]

LayerList & sd::View::get_layers ( )
inline

◆ get_layers() [2/2]

const LayerList & sd::View::get_layers ( ) const
inline

◆ get_name()

const std::string & sd::View::get_name ( ) const
inline

◆ get_projection()

const VLA::Matrix4x4f & sd::View::get_projection ( ) const
inline

◆ get_render_mode()

RenderMode sd::View::get_render_mode ( ) const
inline

◆ get_view_id()

ViewId sd::View::get_view_id ( ) const
inline

◆ is_open()

bool sd::View::is_open ( ) const
inline

◆ on_event()

virtual void sd::View::on_event ( Event e)
inlinevirtual

◆ on_fixed_update()

virtual void sd::View::on_fixed_update ( double  dt)
inlinevirtual

◆ on_gui_render()

void sd::View::on_gui_render ( )
virtual

Reimplemented in sd::SceneView.

◆ on_render()

void sd::View::on_render ( vk::CommandBuffer  cmd)
virtual

Reimplemented in sd::SceneView.

◆ on_update()

void sd::View::on_update ( float  dt)
inline

◆ push_layer() [1/2]

template<typename T , typename... Args>
requires std::is_base_of_v<Layer, T>
T & sd::View::push_layer ( Args &&...  args)
inline

◆ push_layer() [2/2]

template<typename T , typename... Args>
requires std::is_base_of_v<Layer, T>
T & sd::View::push_layer ( int  stageOrder,
Args &&...  args 
)
inline

◆ resize()

void sd::View::resize ( VkExtent2D  extent)

◆ set_aspect_mode()

void sd::View::set_aspect_mode ( AspectMode  mode)
inline

◆ set_open()

void sd::View::set_open ( bool  open)
inline

◆ set_render_mode()

void sd::View::set_render_mode ( RenderMode  mode)
inline

◆ setup_layered_render()

void sd::View::setup_layered_render ( u32  maxStages,
VkExtent2D  initialExtent = {1280, 720} 
)

Friends And Related Symbol Documentation

◆ Application

◆ ViewManager

Member Data Documentation

◆ m_aspect_mode

AspectMode sd::View::m_aspect_mode = AspectMode::BEST_FIT
private

◆ m_camera_view_projection

VLA::Matrix4x4f sd::View::m_camera_view_projection
private

◆ m_color_allocation

VmaAllocation sd::View::m_color_allocation = VK_NULL_HANDLE
private

◆ m_color_image

VkImage sd::View::m_color_image = VK_NULL_HANDLE
private

◆ m_color_view

vk::UniqueImageView sd::View::m_color_view
private

◆ m_content_region_extent

ImVec2 sd::View::m_content_region_extent {0, 0}
private

◆ m_content_region_pos

ImVec2 sd::View::m_content_region_pos {0, 0}
private

◆ m_depth_allocation

VmaAllocation sd::View::m_depth_allocation = VK_NULL_HANDLE
private

◆ m_depth_image

VkImage sd::View::m_depth_image = VK_NULL_HANDLE
private

◆ m_depth_view

vk::UniqueImageView sd::View::m_depth_view
private

◆ m_display_tex_ds

VkDescriptorSet sd::View::m_display_tex_ds = VK_NULL_HANDLE
private

◆ m_extent

VkExtent2D sd::View::m_extent = {1280, 720}
private

◆ m_extent_changed

bool sd::View::m_extent_changed = false
private

◆ m_imgui_ctx

SDImGuiContext& sd::View::m_imgui_ctx
private

◆ m_layered_framebuffer

vk::UniqueFramebuffer sd::View::m_layered_framebuffer
private

◆ m_layered_rp

vk::UniqueRenderPass sd::View::m_layered_rp
private

◆ m_layers

LayerList sd::View::m_layers
private

◆ m_layers_by_stage

std::vector<std::unique_ptr<Layer> > sd::View::m_layers_by_stage
private

◆ m_name

std::string sd::View::m_name
private

◆ m_open

bool sd::View::m_open = true
private

◆ m_render_mode

RenderMode sd::View::m_render_mode = RenderMode::SHADED
private

◆ m_view_id

ViewId sd::View::m_view_id
private

◆ m_vulkan_ctx

VulkanContext& sd::View::m_vulkan_ctx
private

The documentation for this class was generated from the following files: