summaryrefslogtreecommitdiffstats
path: root/modules/openxr/openxr_util.h
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-02-16 14:47:31 +0100
committerRémi Verschelde <rverschelde@gmail.com>2023-06-16 16:25:04 +0200
commit34a07b81ae640dc877a47091ca9a63d1a2cba07b (patch)
tree5ce7452cdaaecda25de4e002258ee95d3c54200b /modules/openxr/openxr_util.h
parent598378513b256e69e9b824c36136774c41cc763c (diff)
downloadredot-engine-34a07b81ae640dc877a47091ca9a63d1a2cba07b.tar.gz
Allow unbundling OpenXR (for Linux distros)
Copy XrMatrix4x4f_CreateProjectionFov to our OpenXRUtil, instead of relying on a private header.
Diffstat (limited to 'modules/openxr/openxr_util.h')
-rw-r--r--modules/openxr/openxr_util.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/modules/openxr/openxr_util.h b/modules/openxr/openxr_util.h
index 8ad68c0b02..3f36ab9fca 100644
--- a/modules/openxr/openxr_util.h
+++ b/modules/openxr/openxr_util.h
@@ -44,6 +44,27 @@ public:
static String get_action_type_name(XrActionType p_action_type);
static String get_environment_blend_mode_name(XrEnvironmentBlendMode p_blend_mode);
static String make_xr_version_string(XrVersion p_version);
+
+ // Copied from OpenXR xr_linear.h private header, so we can still link against
+ // system-provided packages without relying on our `thirdparty` code.
+
+ // Column-major, pre-multiplied. This type does not exist in the OpenXR API and is provided for convenience.
+ typedef struct XrMatrix4x4f {
+ float m[16];
+ } XrMatrix4x4f;
+
+ typedef enum GraphicsAPI {
+ GRAPHICS_VULKAN,
+ GRAPHICS_OPENGL,
+ GRAPHICS_OPENGL_ES,
+ GRAPHICS_D3D
+ } GraphicsAPI;
+
+ static void XrMatrix4x4f_CreateProjection(XrMatrix4x4f *result, GraphicsAPI graphicsApi, const float tanAngleLeft,
+ const float tanAngleRight, const float tanAngleUp, float const tanAngleDown,
+ const float nearZ, const float farZ);
+ static void XrMatrix4x4f_CreateProjectionFov(XrMatrix4x4f *result, GraphicsAPI graphicsApi, const XrFovf fov,
+ const float nearZ, const float farZ);
};
#endif // OPENXR_UTIL_H