|
Vulkan Schnee 0.0.1
High-performance rendering engine
|
This class houses the components needed to display a vr image on the desktop. More...
#include <MirrorView.h>
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 Headset * | headset = nullptr |
| const Renderer * | renderer = nullptr |
| VkExtent2D | swapchainResolution = { 0u, 0u } |
| The swapchain resolution. | |
| ApplicationContext * | context = 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 |
This class houses the components needed to display a vr image on the desktop.
This owns all the data which is needed to display on the
Definition at line 21 of file MirrorView.h.
| 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.
| EngineCore::MirrorView::~MirrorView | ( | ) |
Definition at line 84 of file MirrorView.cpp.
References context, mirrorSurface, and swapchain.
| void EngineCore::MirrorView::cleanup | ( | ) |
Cleanup resources allocated by MirrorView.
Definition at line 559 of file MirrorView.cpp.
References context, mirrorSurface, swapchain, and window.
Connects the mirror view to the headset pointer and the renderer pointer.
| headset | The headset. |
| renderer | The renderer. |
Definition at line 96 of file MirrorView.cpp.
References headset, recreateSwapchain(), and renderer.
|
staticprivate |
Callback, called when the framebuffer gets resized. Aka the window gets resized.
| [in,out] | window | If non-null, the window. |
| width | The width of the new framebuffer. | |
| height | The height of the new framebuffer. |
Definition at line 362 of file MirrorView.cpp.
References hasWindowBeenResized, and window.
Referenced by MirrorView().
| GLFWwindow * EngineCore::MirrorView::getGlfwWindow | ( | ) | const |
Gets glfw window.
Definition at line 390 of file MirrorView.cpp.
References window.
| VkSurfaceKHR EngineCore::MirrorView::getSurface | ( | ) | const |
Gets the surface.
Definition at line 385 of file MirrorView.cpp.
References mirrorSurface.
|
staticprivate |
Callback, called when the window gets minimized or gets unfocused.
| [in,out] | window | If non-null, the window. |
| iconified | In which state the window is. Is effectively a boolean. |
Definition at line 375 of file MirrorView.cpp.
References hasBeenRestored, and window.
Referenced by MirrorView().
|
staticprivate |
Callback, called when glfw detects a key press.
| [in,out] | window | If non-null, the window. |
| key | The key which was pressed. | |
| scancode | The scancode. | |
| action | When to trigger. (on release, on press, etc) | |
| mods | Modifiers like Shift, ctrl, etc. |
Definition at line 367 of file MirrorView.cpp.
References window.
Referenced by MirrorView().
| void EngineCore::MirrorView::present | ( | ) |
Definition at line 332 of file MirrorView.cpp.
References context, mirrorDestinationImageIndex, recreateSwapchain(), renderer, swapchain, and xrSwapchainImageIndex.
|
private |
Recreates the swapchain. Can be called when no swapchain exists yet to create one.
Definition at line 395 of file MirrorView.cpp.
References context, mirrorSurface, mirrorSwapchainImages, swapchain, swapchainResolution, and window.
Referenced by connect(), present(), and render().
| MirrorView::RenderResult EngineCore::MirrorView::render | ( | uint32_t | swapchainImageIndex | ) |
Renders the given swapchainImageIndex.
| swapchainImageIndex | Zero-based index of the swapchain image. |
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.
|
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().
|
staticprivate |
Definition at line 118 of file MirrorView.h.
Referenced by iconifyCallback(), and render().
|
staticprivate |
Definition at line 115 of file MirrorView.h.
Referenced by framebufferResizeCallback(), and render().
|
private |
Definition at line 123 of file MirrorView.h.
|
private |
Definition at line 136 of file MirrorView.h.
|
private |
Definition at line 137 of file MirrorView.h.
|
private |
Definition at line 107 of file MirrorView.h.
Referenced by cleanup(), getSurface(), MirrorView(), recreateSwapchain(), and ~MirrorView().
|
private |
The mirror swapchain images.
Definition at line 166 of file MirrorView.h.
Referenced by recreateSwapchain(), and render().
|
private |
Definition at line 124 of file MirrorView.h.
|
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().
|
private |
The swapchain resolution.
Definition at line 129 of file MirrorView.h.
Referenced by recreateSwapchain(), and render().
|
private |
Definition at line 121 of file MirrorView.h.
Referenced by cleanup(), framebufferResizeCallback(), getGlfwWindow(), iconifyCallback(), keyCallback(), MirrorView(), recreateSwapchain(), and render().
|
private |
Definition at line 138 of file MirrorView.h.