Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
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
27
QT_BEGIN_NAMESPACE
28
29
namespace
OpenXRHelpers
30
{
31
QString
getXrResultAsString
(XrResult result, XrInstance instance);
32
bool
checkXrResult
(XrResult result, XrInstance instance);
33
bool
resolveXrFunction
(XrInstance instance,
const
char
*name, PFN_xrVoidFunction *function);
34
35
inline
QQuaternion
toQQuaternion
(
const
XrQuaternionf &q)
36
{
37
return
{ q.w, q.x, q.y, q.z };
38
}
39
40
inline
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
57
template
<
typename
T>
58
[[nodiscard]]
XrResult
safeCall
();
59
template
<
typename
...
A
>
60
[[
nodiscard
]]
XrResult
safeCall
(
XrResult
(XRAPI_PTR *
f
)(
A
...),
A
...
args
)
61
{
62
return
f
?
f
(
args
...) :
XR_ERROR_FUNCTION_UNSUPPORTED
;
63
}
64
65
}
66
67
QT_END_NAMESPACE
68
69
#
endif
// QOPENXRHELPERS_H
OpenXRHelpers
Definition
qopenxrhelpers_p.h:30
OpenXRHelpers::toQQuaternion
QQuaternion toQQuaternion(const XrQuaternionf &q)
Definition
qopenxrhelpers_p.h:35
OpenXRHelpers::checkXrResult
bool checkXrResult(XrResult result, XrInstance instance)
Definition
qopenxrhelpers.cpp:19
OpenXRHelpers::resolveXrFunction
bool resolveXrFunction(XrInstance instance, const char *name, PFN_xrVoidFunction *function)
Definition
qopenxrhelpers.cpp:28
OpenXRHelpers::safeCall
XrResult safeCall(XrResult(XRAPI_PTR *f)(A...), A... args)
Definition
qopenxrhelpers_p.h:60
OpenXRHelpers::safeCall
XrResult safeCall()
Safe call to OpenXR function.
OpenXRHelpers::getXrResultAsString
QString getXrResultAsString(XrResult result, XrInstance instance)
Definition
qopenxrhelpers.cpp:11
OpenXRHelpers::toQVector
QVector3D toQVector(const XrVector3f &v)
Definition
qopenxrhelpers_p.h:40
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
qtquick3d
src
xr
quick3dxr
openxr
qopenxrhelpers_p.h
Generated on
for Qt by
1.18.0