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

#include <OpenXrHelper.h>

Classes

struct  posef
 A glm based posef struct. More...

Public Types

typedef struct EngineCore::OpenXrHelper::posef posef
 A glm based posef struct.

Static Public Member Functions

template<typename T>
static void LoadXrFunction (XrInstance xrInstance, const std::string &functionName, T &functionPointer)
 Loads a function from openxr which is not loaded at compile time. Retrieves function pointer.
static XrPosef makeIdentityPose ()
 Makes identity pose.
static glm::mat4 poseToMatrix (const XrPosef &pose)
 Converts an XrPosef to a glm::mat4.
static glm::mat4 poseToMatrix (const OpenXrHelper::posef &pose)
 Pose of glm components to glm::mat4.
static glm::quat xrQuaternionfToGlmQuat (const XrQuaternionf &xrQuaternion)
 Turns the OpenXR quaternion into an OpenXR quaternion.
static XrQuaternionf glmQuatToXrQuaternionf (const glm::quat &glmQuaternion)
 Glm quaternion to xr quaternionf.
static glm::vec3 xrVector3fToGlmVec3 (const XrVector3f &xrVector3)
 Converts an OpenXR vector3 to a glm vector3.
static XrVector3f glmVec3ToXrVector3f (const glm::vec3 &glmVector3)
 Converts a glm::vec3 to a XrVector3f.
static float dot (const glm::quat &a, const glm::quat &b)
 Calculates the dot product between two glm quaternions.
static glm::quat lerpMix (const glm::quat &from, const glm::quat &to, float progress)
 Linearly interpolate between two quaternions.
static glm::vec3 lerpMix (const glm::vec3 &from, const glm::vec3 &to, float progress)
 Linearly interpolate between two glm vector3's.
static float lerpMix (float from, float to, float progress)
 Linearly interpolate between two float values.
static float dot (const glm::vec3 &a, const glm::vec3 &b)
 The dot product between two glm vector3's.
static glm::vec3 crossProductVector3 (const glm::vec3 &vector_a, const glm::vec3 &vector_b)
static float clampf (float num, float left, float right)
static float lengthSquared (const glm::vec3 &vec)
static float length (const glm::vec3 &vec)
static glm::vec3 normalize (const glm::vec3 &vec)
static float distanceSquared (const glm::vec3 &vec1, const glm::vec3 &vec2)
static float distance (const glm::vec3 &vec1, const glm::vec3 &vec2)
static glm::quat slerp (const glm::quat &start, const glm::quat &end, float percent)
static glm::vec3 slerp (const glm::vec3 &start, const glm::vec3 &end, float percent)
static float vectorAngleAroundNormal (const glm::vec3 &vec1, const glm::vec3 &vec2, const glm::vec3 &norm)
static glm::mat4 rotationAroundPoint (glm::vec3 point, glm::mat4 rotationMatrix)
static void quaternionToAngleAxis (const glm::quat &quat, float &angle, glm::vec3 &axis)
static glm::quat quaternionFromAngleAxis (const float &angle, const glm::vec3 &axis)
static posef xrPosefToGlmPosef (const XrPosef &xrPosef)
static glm::mat4 createProjectionMatrix (XrFovf fov, float nearClip, float farClip)
static std::string sessionStateToString (XrSessionState state)
static const char * GetXrStructureTypeName (XrStructureType type)

Detailed Description

Definition at line 11 of file OpenXrHelper.h.

Member Typedef Documentation

◆ posef

typedef struct EngineCore::OpenXrHelper::posef EngineCore::OpenXrHelper::posef

A glm based posef struct.

Date
2025-02-01
Author
Konstantin Passig

Member Function Documentation

◆ clampf()

float EngineCore::OpenXrHelper::clampf ( float num,
float left,
float right )
static

Definition at line 95 of file OpenXrHelper.cpp.

Referenced by slerp().

Here is the caller graph for this function:

◆ createProjectionMatrix()

glm::mat4 EngineCore::OpenXrHelper::createProjectionMatrix ( XrFovf fov,
float nearClip,
float farClip )
static

Definition at line 218 of file OpenXrHelper.cpp.

Referenced by EngineCore::Headset::updateViewMatrix().

Here is the caller graph for this function:

◆ crossProductVector3()

glm::vec3 EngineCore::OpenXrHelper::crossProductVector3 ( const glm::vec3 & vector_a,
const glm::vec3 & vector_b )
static

Definition at line 87 of file OpenXrHelper.cpp.

◆ distance()

float EngineCore::OpenXrHelper::distance ( const glm::vec3 & vec1,
const glm::vec3 & vec2 )
static

Definition at line 121 of file OpenXrHelper.cpp.

References distanceSquared().

Here is the call graph for this function:

◆ distanceSquared()

float EngineCore::OpenXrHelper::distanceSquared ( const glm::vec3 & vec1,
const glm::vec3 & vec2 )
static

Definition at line 116 of file OpenXrHelper.cpp.

Referenced by distance().

Here is the caller graph for this function:

◆ dot() [1/2]

float EngineCore::OpenXrHelper::dot ( const glm::quat & a,
const glm::quat & b )
static

Calculates the dot product between two glm quaternions.

Parameters
aA glm::quat to process.
bA glm::quat to process.
Returns
The dot product.
Date
2022-10-22
Author
janhsimon

Definition at line 67 of file OpenXrHelper.cpp.

Referenced by slerp(), slerp(), and vectorAngleAroundNormal().

Here is the caller graph for this function:

◆ dot() [2/2]

float EngineCore::OpenXrHelper::dot ( const glm::vec3 & a,
const glm::vec3 & b )
static

The dot product between two glm vector3's.

Parameters
aA glm::vec3 to process.
bA glm::vec3 to process.
Returns
A float.
Date
2022-10-22
Author
janhsimon

Definition at line 83 of file OpenXrHelper.cpp.

◆ GetXrStructureTypeName()

const char * EngineCore::OpenXrHelper::GetXrStructureTypeName ( XrStructureType type)
static

Definition at line 255 of file OpenXrHelper.cpp.

Referenced by EngineCore::Headset::waitForXrFrame().

Here is the caller graph for this function:

◆ glmQuatToXrQuaternionf()

XrQuaternionf EngineCore::OpenXrHelper::glmQuatToXrQuaternionf ( const glm::quat & glmQuaternion)
static

Glm quaternion to xr quaternionf.

Parameters
glmQuaternionSource for the.
Returns
A XrQuaternionf.
Date
2025-02-08
Author
Konstantin Passig

Definition at line 38 of file OpenXrHelper.cpp.

◆ glmVec3ToXrVector3f()

XrVector3f EngineCore::OpenXrHelper::glmVec3ToXrVector3f ( const glm::vec3 & glmVector3)
static

Converts a glm::vec3 to a XrVector3f.

Parameters
glmVector3the glm vector3 to convert.
Returns
A XrVector3f.
Date
2022-10-22
Author
janhsimon

Definition at line 51 of file OpenXrHelper.cpp.

◆ length()

float EngineCore::OpenXrHelper::length ( const glm::vec3 & vec)
static

Definition at line 107 of file OpenXrHelper.cpp.

References lengthSquared().

Referenced by normalize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lengthSquared()

float EngineCore::OpenXrHelper::lengthSquared ( const glm::vec3 & vec)
static

Definition at line 103 of file OpenXrHelper.cpp.

Referenced by length().

Here is the caller graph for this function:

◆ lerpMix() [1/3]

glm::quat EngineCore::OpenXrHelper::lerpMix ( const glm::quat & from,
const glm::quat & to,
float progress )
static

Linearly interpolate between two quaternions.

Parameters
fromThe start quaternion.
tothe target quaternion.
progressA float to process.
Returns
The interpolated quaternion at progress.
Date
2022-10-22
Author
janhsimon

Definition at line 59 of file OpenXrHelper.cpp.

◆ lerpMix() [2/3]

glm::vec3 EngineCore::OpenXrHelper::lerpMix ( const glm::vec3 & from,
const glm::vec3 & to,
float progress )
static

Linearly interpolate between two glm vector3's.

Parameters
fromThe vector3 to interpolate from.
toThe vector3 to interpolate to.
progressThe factor of how close return is to the target.
Returns
The interpolated vector3 at progress.
Date
2022-10-22
Author
janhsimon

Definition at line 71 of file OpenXrHelper.cpp.

◆ lerpMix() [3/3]

float EngineCore::OpenXrHelper::lerpMix ( float from,
float to,
float progress )
static

Linearly interpolate between two float values.

Parameters
fromThe float to interpolate from.
toThe float to interpolate to.
progressThe factor of how close return is to the target. 0.0f is from 1.0f is target.
Returns
A float.
Date
2022-10-22
Author
janhsimon

Definition at line 79 of file OpenXrHelper.cpp.

◆ LoadXrFunction()

template<typename T>
void EngineCore::OpenXrHelper::LoadXrFunction ( XrInstance xrInstance,
const std::string & functionName,
T & functionPointer )
inlinestatic

Loads a function from openxr which is not loaded at compile time. Retrieves function pointer.

Parameters
xrInstanceThe instance.
functionNameName of the function.
[out]functionPointerThe function pointer.
Exceptions
std::runtime_errorRaised when the requested function was not found.
Template Parameters
TThe class of the function pointer.

Definition at line 37 of file OpenXrHelper.h.

Referenced by EngineCore::ApplicationContext::createDevice(), and EngineCore::ApplicationContext::LoadOpenXrExtensionFunctions().

Here is the caller graph for this function:

◆ makeIdentityPose()

XrPosef EngineCore::OpenXrHelper::makeIdentityPose ( )
static

Makes identity pose.

Returns
An XrPosef.
Date
2022-10-22
Author
janhsimon

Definition at line 8 of file OpenXrHelper.cpp.

Referenced by EngineCore::Headset::Headset().

Here is the caller graph for this function:

◆ normalize()

glm::vec3 EngineCore::OpenXrHelper::normalize ( const glm::vec3 & vec)
static

Definition at line 111 of file OpenXrHelper.cpp.

References length().

Referenced by slerp().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ poseToMatrix() [1/2]

glm::mat4 EngineCore::OpenXrHelper::poseToMatrix ( const OpenXrHelper::posef & pose)
static

Pose of glm components to glm::mat4.

Parameters
poseThe pose.
Returns
A glm::mat4.
Date
2025-02-01
Author
Konstantin Passig

Definition at line 23 of file OpenXrHelper.cpp.

References EngineCore::OpenXrHelper::posef::orientation, and EngineCore::OpenXrHelper::posef::position.

◆ poseToMatrix() [2/2]

glm::mat4 EngineCore::OpenXrHelper::poseToMatrix ( const XrPosef & pose)
static

Converts an XrPosef to a glm::mat4.

Parameters
poseThe pose XrPose.
Returns
A glm::mat4.
Date
2022-10-22
Author
janhsimon

Definition at line 16 of file OpenXrHelper.cpp.

Referenced by Input::XrInputHandler::syncInputs(), and EngineCore::Headset::updateViewMatrix().

Here is the caller graph for this function:

◆ quaternionFromAngleAxis()

glm::quat EngineCore::OpenXrHelper::quaternionFromAngleAxis ( const float & angle,
const glm::vec3 & axis )
static

Definition at line 197 of file OpenXrHelper.cpp.

◆ quaternionToAngleAxis()

void EngineCore::OpenXrHelper::quaternionToAngleAxis ( const glm::quat & quat,
float & angle,
glm::vec3 & axis )
static

Definition at line 188 of file OpenXrHelper.cpp.

◆ rotationAroundPoint()

glm::mat4 EngineCore::OpenXrHelper::rotationAroundPoint ( glm::vec3 point,
glm::mat4 rotationMatrix )
static

Definition at line 179 of file OpenXrHelper.cpp.

◆ sessionStateToString()

std::string EngineCore::OpenXrHelper::sessionStateToString ( XrSessionState state)
static

Definition at line 237 of file OpenXrHelper.cpp.

Referenced by EngineCore::Headset::waitForXrFrame().

Here is the caller graph for this function:

◆ slerp() [1/2]

glm::quat EngineCore::OpenXrHelper::slerp ( const glm::quat & start,
const glm::quat & end,
float percent )
static

Definition at line 126 of file OpenXrHelper.cpp.

References dot().

Here is the call graph for this function:

◆ slerp() [2/2]

glm::vec3 EngineCore::OpenXrHelper::slerp ( const glm::vec3 & start,
const glm::vec3 & end,
float percent )
static

Definition at line 148 of file OpenXrHelper.cpp.

References clampf(), dot(), and normalize().

Here is the call graph for this function:

◆ vectorAngleAroundNormal()

float EngineCore::OpenXrHelper::vectorAngleAroundNormal ( const glm::vec3 & vec1,
const glm::vec3 & vec2,
const glm::vec3 & norm )
static

Definition at line 172 of file OpenXrHelper.cpp.

References dot().

Here is the call graph for this function:

◆ xrPosefToGlmPosef()

OpenXrHelper::posef EngineCore::OpenXrHelper::xrPosefToGlmPosef ( const XrPosef & xrPosef)
static

Definition at line 209 of file OpenXrHelper.cpp.

References xrQuaternionfToGlmQuat(), and xrVector3fToGlmVec3().

Referenced by Input::XrInputHandler::syncInputs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xrQuaternionfToGlmQuat()

glm::quat EngineCore::OpenXrHelper::xrQuaternionfToGlmQuat ( const XrQuaternionf & xrQuaternion)
static

Turns the OpenXR quaternion into an OpenXR quaternion.

Parameters
xrQuaternionSource for the.
Returns
A glm::quat.
Date
2022-10-22
Author
janhsimon

Definition at line 34 of file OpenXrHelper.cpp.

Referenced by xrPosefToGlmPosef().

Here is the caller graph for this function:

◆ xrVector3fToGlmVec3()

glm::vec3 EngineCore::OpenXrHelper::xrVector3fToGlmVec3 ( const XrVector3f & xrVector3)
static

Converts an OpenXR vector3 to a glm vector3.

Parameters
xrVector3OpenXR vector3 to convert.
Returns
A glm::vec3.
Date
2022-10-22
Author
janhsimon

Definition at line 47 of file OpenXrHelper.cpp.

Referenced by xrPosefToGlmPosef().

Here is the caller graph for this function:

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