2#include <glm/ext/matrix_float4x4.hpp>
3#include <glm/gtc/quaternion.hpp>
5#include <openxr/openxr.h>
7#include <vulkan/vulkan_core.h>
The application context is the core class which stores the basic openxr and vulkan objects.
void requestExitSession()
Requests the XR runtime to exit the session gracefully. This should be called when the application wa...
std::vector< RenderTarget > swapchainRenderTargets
The swapchain render targets. The images get rendered onto those render targets.
void endXrFrameNoRender()
void beginXrSession() const
glm::quat transformPlaySpaceOrientation(const glm::quat &orientation) const
Converts an OpenXR play-space orientation into world space.
std::vector< XrViewConfigurationView > eyeImageInfos
XrSpace getReferenceSpace() const
Getter.
std::vector< XrView > eyePoses
std::vector< XrCompositionLayerProjectionView > eyeRenderInfos
VkImage getDepthBufferImage() const
Getter.
glm::quat getHeadsetLocalOrientation() const
Gets the headset's local orientation relative to the play space.
XrFrameState getXrFrameState() const
Getter.
VkImage getColorBufferImage() const
Getter.
VkRenderPass getRenderPass() const
Getter.
VkImage getSwapchainImage(size_t swapchainImageIndex) const
Getter.
VkImageView getDepthBufferView() const
Getter.
void setPlayerRotation(const glm::quat &rotation)
Setter for the player/play-space rotation applied around the world origin.
BeginFrameResult beginXrFrame(uint32_t &swapchainImageIndex, Renderer *renderer)
Combines waitForXrFrame and beginXrFrameAfterWait.
glm::vec3 getPlayerPosition() const
Getter.
XrSpace xrReferenceSpace
The xr reference space.
XrReferenceSpaceType xrReferenceSpaceType
Type of the xr reference space, if it is room scale or just sitting vr.
XrSessionState xrSessionState
VkFormat getColorFormat() const
Getter.
void endXrSession() const
Ends the XR session.
uint32_t getEyeCount() const
Getter.
glm::mat4 getEyeProjectionMatrix(size_t eyeIndex) const
Gets the projection matrix for an eye.
glm::vec3 transformPlaySpacePosition(const glm::vec3 &position) const
Converts an OpenXR play-space position into world space.
VkFormat getSceneColorFormat() const
VkRenderPass vkRenderPass
The vulkan render pass.
VkImage getResolveBufferImage() const
Getter.
ImageBuffer resolveBuffer
glm::mat4 getRawEyeViewMatrix(size_t eyeIndex) const
Gets the raw eye view matrix without player position offset.
Headset(const Core::ApplicationContext *context=nullptr)
const Core::ApplicationContext * context
glm::vec3 playerPosition_
glm::quat playerRotation_
XrFrameState xrFrameState
XrSession getSession() const
Getter.
std::unique_ptr< NamedThreadPool > xrWaitThreadPool_
XrSession xrSession
The xr session.
void setPlayerPosition(const glm::vec3 &position)
Setter.
void updateViewMatrix()
Updates the eye matrix for the headset.
WaitFrameResult waitForXrFrame(Rendering::Renderer *renderer)
First part of frame setup: calls xrWaitFrame. Can be called before previous xrEndFrame completes....
glm::vec3 getHeadsetLocalPosition() const
Gets the headset's local position relative to the play space origin.
BeginFrameResult beginXrFrameAfterWait(uint32_t &swapchainImageIndex)
Second part of frame setup: calls xrBeginFrame, acquires swapchain image. MUST be called after previo...
std::vector< RenderTarget > getSwapchainRenderTargets()
glm::quat getHeadsetWorldOrientation() const
Gets the headset orientation after player rotation is applied.
bool getIsExitRequested() const
Returns true if the headset has requested the application to exit.
VkFormat sceneColorFormat_
glm::mat4 getEyeViewMatrix(size_t eyeIndex) const
Returns the view matrix of the specified eye.
glm::mat4 getViewProjectionMatrix(size_t eyeIndex) const
Gets the multiplied view and projection matrix.
glm::quat getPlayerRotation() const
Getter for the player/play-space rotation.
glm::vec3 getHeadsetWorldPosition() const
Gets the headset position after player position/rotation are applied.
VkExtent2D getEyeResolution(size_t eyeIndex) const
Gets eye resolution in x and y for a specified eye index. 0 is left.
const RenderTarget * getRenderTarget(size_t swapchainImageIndex) const
Getter.
VkImageView getColorBufferView() const
Getter.
VkImageView getResolveBufferView() const
Getter.
The renderer is the main class for rendering. It owns all data which is used any time in any frame....
Tracy-named thread pool using BS_tracy::tracy_thread_pool.
Core audio subsystem owning the miniaudio engine and managing playback.
glm::mat4 eyeProjectionMatrix
void cleanup(const Core::ApplicationContext *context)
VkDeviceMemory deviceMemory
Result from waitForXrFrame indicating what the main loop should do.
bool shouldCallBeginFrame
bool needsGpuSyncForStateTransition
A render target which contains all resources to access the rendered image.
VkImageLayout imageLayout
VkFramebuffer framebuffer
void cleanup(const Core::ApplicationContext *context)