Vulkan Schnee 0.0.1
High-performance rendering engine
Loading...
Searching...
No Matches
EngineCore::MirrorView Class Reference

This class houses the components needed to display a vr image on the desktop. More...

#include <MirrorView.h>

Collaboration diagram for EngineCore::MirrorView:

Classes

struct  RenderResult
 Values that represent mirror view render results. More...

Public Member Functions

 MirrorView (ApplicationContext *context=nullptr)
 ~MirrorView ()
void connect (const Headset *headset, const Renderer *renderer)
 Connects the mirror view to the headset pointer and the renderer pointer.
void cleanup ()
 Cleanup resources allocated by MirrorView.
MirrorView::RenderResult render (uint32_t swapchainImageIndex)
 Renders the given swapchainImageIndex.
void present ()
VkSurfaceKHR getSurface () const
 Gets the surface.
GLFWwindow * getGlfwWindow () const
 Gets glfw window.

Private Member Functions

void recreateSwapchain ()
 Recreates the swapchain. Can be called when no swapchain exists yet to create one.

Static Private Member Functions

static void framebufferResizeCallback (GLFWwindow *window, int width, int height)
 Callback, called when the framebuffer gets resized. Aka the window gets resized.
static void keyCallback (GLFWwindow *window, int key, int scancode, int action, int mods)
 Callback, called when glfw detects a key press.
static void iconifyCallback (GLFWwindow *window, int iconified)
 Callback, called when the window gets minimized or gets unfocused.

Private Attributes

VkSurfaceKHR mirrorSurface = nullptr
VkSwapchainKHR swapchain = nullptr
 The swapchain on which the images to display are swapped.
GLFWwindow * window = nullptr
const Headsetheadset = nullptr
const Rendererrenderer = nullptr
VkExtent2D swapchainResolution = { 0u, 0u }
 The swapchain resolution.
ApplicationContextcontext = nullptr
 A pointer to the engines application context.
bool isMirrorResizeDetected = false
uint32_t mirrorDestinationImageIndex = 0u
uint32_t xrSwapchainImageIndex = 0u
std::vector< VkImage > mirrorSwapchainImages
 The mirror swapchain images.

Static Private Attributes

static bool hasWindowBeenResized = false
static bool hasBeenRestored = false

Detailed Description

This class houses the components needed to display a vr image on the desktop.

Date
2025-02-12
Author
Konstantin Passig

This owns all the data which is needed to display on the

Definition at line 21 of file MirrorView.h.

Constructor & Destructor Documentation

◆ MirrorView()

EngineCore::MirrorView::MirrorView ( ApplicationContext * context = nullptr)

Definition at line 30 of file MirrorView.cpp.

References context, framebufferResizeCallback(), iconifyCallback(), keyCallback(), mirrorSurface, TRACY_ZONE_SCOPED_FUNCTION, window, and EngineCore::windowTitle.

Here is the call graph for this function:

◆ ~MirrorView()

EngineCore::MirrorView::~MirrorView ( )

Definition at line 84 of file MirrorView.cpp.

References context, mirrorSurface, and swapchain.

Member Function Documentation

◆ cleanup()

void EngineCore::MirrorView::cleanup ( )

Cleanup resources allocated by MirrorView.

Date
2025-10-19
Author
Konstantin Passig

Definition at line 559 of file MirrorView.cpp.

References context, mirrorSurface, swapchain, and window.

◆ connect()

void EngineCore::MirrorView::connect ( const Headset * headset,
const Renderer * renderer )

Connects the mirror view to the headset pointer and the renderer pointer.

Parameters
headsetThe headset.
rendererThe renderer.
Date
2025-02-15
Author
Konstantin Passig

Definition at line 96 of file MirrorView.cpp.

References headset, recreateSwapchain(), and renderer.

Here is the call graph for this function:

◆ framebufferResizeCallback()

void EngineCore::MirrorView::framebufferResizeCallback ( GLFWwindow * window,
int width,
int height )
staticprivate

Callback, called when the framebuffer gets resized. Aka the window gets resized.

Parameters
[in,out]windowIf non-null, the window.
widthThe width of the new framebuffer.
heightThe height of the new framebuffer.
Date
2025-02-12
Author
Konstantin Passig

Definition at line 362 of file MirrorView.cpp.

References hasWindowBeenResized, and window.

Referenced by MirrorView().

Here is the caller graph for this function:

◆ getGlfwWindow()

GLFWwindow * EngineCore::MirrorView::getGlfwWindow ( ) const

Gets glfw window.

Returns
Null if it fails, else the glfw window.
Date
2025-02-14
Author
Konstantin Passig

Definition at line 390 of file MirrorView.cpp.

References window.

◆ getSurface()

VkSurfaceKHR EngineCore::MirrorView::getSurface ( ) const

Gets the surface.

Returns
The vulkan surface.
Date
2025-02-13
Author
Konstantin Passig

Definition at line 385 of file MirrorView.cpp.

References mirrorSurface.

◆ iconifyCallback()

void EngineCore::MirrorView::iconifyCallback ( GLFWwindow * window,
int iconified )
staticprivate

Callback, called when the window gets minimized or gets unfocused.

Parameters
[in,out]windowIf non-null, the window.
iconifiedIn which state the window is. Is effectively a boolean.
Date
2025-02-12
Author
Konstantin Passig

Definition at line 375 of file MirrorView.cpp.

References hasBeenRestored, and window.

Referenced by MirrorView().

Here is the caller graph for this function:

◆ keyCallback()

void EngineCore::MirrorView::keyCallback ( GLFWwindow * window,
int key,
int scancode,
int action,
int mods )
staticprivate

Callback, called when glfw detects a key press.

Parameters
[in,out]windowIf non-null, the window.
keyThe key which was pressed.
scancodeThe scancode.
actionWhen to trigger. (on release, on press, etc)
modsModifiers like Shift, ctrl, etc.
Date
2025-02-12
Author
Konstantin Passig

Definition at line 367 of file MirrorView.cpp.

References window.

Referenced by MirrorView().

Here is the caller graph for this function:

◆ present()

void EngineCore::MirrorView::present ( )

Definition at line 332 of file MirrorView.cpp.

References context, mirrorDestinationImageIndex, recreateSwapchain(), renderer, swapchain, and xrSwapchainImageIndex.

Here is the call graph for this function:

◆ recreateSwapchain()

void EngineCore::MirrorView::recreateSwapchain ( )
private

Recreates the swapchain. Can be called when no swapchain exists yet to create one.

Date
2025-02-15
Author
Konstantin Passig

Definition at line 395 of file MirrorView.cpp.

References context, mirrorSurface, mirrorSwapchainImages, swapchain, swapchainResolution, and window.

Referenced by connect(), present(), and render().

Here is the caller graph for this function:

◆ render()

MirrorView::RenderResult EngineCore::MirrorView::render ( uint32_t swapchainImageIndex)

Renders the given swapchainImageIndex.

Parameters
swapchainImageIndexZero-based index of the swapchain image.
Returns
A MirrorView::RenderResult.
Date
2025-02-15
Author
Konstantin Passig

Definition at line 104 of file MirrorView.cpp.

References context, hasBeenRestored, hasWindowBeenResized, headset, EngineCore::MirrorView::RenderResult::Invisible, mirrorDestinationImageIndex, mirrorSwapchainImages, recreateSwapchain(), renderer, swapchain, swapchainResolution, EngineCore::MirrorView::RenderResult::Visible, window, and xrSwapchainImageIndex.

Here is the call graph for this function:

Member Data Documentation

◆ context

ApplicationContext* EngineCore::MirrorView::context = nullptr
private

A pointer to the engines application context.

Definition at line 134 of file MirrorView.h.

Referenced by cleanup(), MirrorView(), present(), recreateSwapchain(), render(), and ~MirrorView().

◆ hasBeenRestored

bool EngineCore::MirrorView::hasBeenRestored = false
staticprivate

Definition at line 118 of file MirrorView.h.

Referenced by iconifyCallback(), and render().

◆ hasWindowBeenResized

bool EngineCore::MirrorView::hasWindowBeenResized = false
staticprivate

Definition at line 115 of file MirrorView.h.

Referenced by framebufferResizeCallback(), and render().

◆ headset

const Headset* EngineCore::MirrorView::headset = nullptr
private

Definition at line 123 of file MirrorView.h.

Referenced by connect(), and render().

◆ isMirrorResizeDetected

bool EngineCore::MirrorView::isMirrorResizeDetected = false
private

Definition at line 136 of file MirrorView.h.

◆ mirrorDestinationImageIndex

uint32_t EngineCore::MirrorView::mirrorDestinationImageIndex = 0u
private

Definition at line 137 of file MirrorView.h.

Referenced by present(), and render().

◆ mirrorSurface

VkSurfaceKHR EngineCore::MirrorView::mirrorSurface = nullptr
private

Definition at line 107 of file MirrorView.h.

Referenced by cleanup(), getSurface(), MirrorView(), recreateSwapchain(), and ~MirrorView().

◆ mirrorSwapchainImages

std::vector<VkImage> EngineCore::MirrorView::mirrorSwapchainImages
private

The mirror swapchain images.

Definition at line 166 of file MirrorView.h.

Referenced by recreateSwapchain(), and render().

◆ renderer

const Renderer* EngineCore::MirrorView::renderer = nullptr
private

Definition at line 124 of file MirrorView.h.

Referenced by connect(), present(), and render().

◆ swapchain

VkSwapchainKHR EngineCore::MirrorView::swapchain = nullptr
private

The swapchain on which the images to display are swapped.

Definition at line 112 of file MirrorView.h.

Referenced by cleanup(), present(), recreateSwapchain(), render(), and ~MirrorView().

◆ swapchainResolution

VkExtent2D EngineCore::MirrorView::swapchainResolution = { 0u, 0u }
private

The swapchain resolution.

Definition at line 129 of file MirrorView.h.

Referenced by recreateSwapchain(), and render().

◆ window

GLFWwindow* EngineCore::MirrorView::window = nullptr
private

◆ xrSwapchainImageIndex

uint32_t EngineCore::MirrorView::xrSwapchainImageIndex = 0u
private

Definition at line 138 of file MirrorView.h.

Referenced by present(), and render().


The documentation for this class was generated from the following files:
  • /home/magerbeton/Documents/gl3-vulkan/Engine/include/Engine/Renderer/MirrorView.h
  • /home/magerbeton/Documents/gl3-vulkan/Engine/src/Engine/Renderer/MirrorView.cpp