Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qopenxrhelpers_p.h
Go to the documentation of this file.
1// Copyright (C) 2024 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5
6#ifndef QOPENXRHELPERS_H
7#define QOPENXRHELPERS_H
8
9//
10// W A R N I N G
11// -------------
12//
13// This file is not part of the Qt API. It exists purely as an
14// implementation detail. This header file may change from version to
15// version without notice, or even be removed.
16//
17// We mean it.
18//
19
20
21#include <openxr/openxr.h>
22#include <QtQuick3DXr/qtquick3dxrglobal.h>
23#include <QQuaternion>
24#include <QString>
25#include <QVector3D>
26
27QT_BEGIN_NAMESPACE
28
30{
31QString getXrResultAsString(XrResult result, XrInstance instance);
32bool checkXrResult(XrResult result, XrInstance instance);
33bool resolveXrFunction(XrInstance instance, const char *name, PFN_xrVoidFunction *function);
34
35inline QQuaternion toQQuaternion(const XrQuaternionf &q)
36{
37 return { q.w, q.x, q.y, q.z };
38}
39
40inline QVector3D toQVector(const XrVector3f &v)
41{
42 return { v.x * 100, v.y * 100, v.z * 100 };
43}
44
45/*!
46 * \brief Safe call to OpenXR function
47 * \param f - OpenXR function pointer that returns a XrResult
48 * \param args - arguments for the function pointed to by f
49 * \return a XrResult indicating the result of the function call.
50 *
51 * \note This function is used to "safely" call OpenXR functions without having to check if the function pointer is nullptr.
52 * If the function pointer is nullptr XR_ERROR_FUNCTION_UNSUPPORTED is returned.
53 *
54 * \note If the function returns XR_ERROR_FUNCTION_UNSUPPORTED the caller should avoid calling the function again.
55 */
56
57template <typename T>
58[[nodiscard]] XrResult safeCall();
59template <typename... A>
60[[nodiscard]] XrResult safeCall(XrResult (XRAPI_PTR *f)(A...), A... args)
61{
63}
64
65}
66
67QT_END_NAMESPACE
68
69#endif // QOPENXRHELPERS_H
Combined button and popup list for selecting options.