1 | // Copyright (C) 2024 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
3 | |
4 | #ifndef QTQUICK3DXRGLOBAL_P_H |
5 | #define QTQUICK3DXRGLOBAL_P_H |
6 | |
7 | // |
8 | // W A R N I N G |
9 | // ------------- |
10 | // |
11 | // This file is not part of the Qt API. It exists purely as an |
12 | // implementation detail. This header file may change from version to |
13 | // version without notice, or even be removed. |
14 | // |
15 | // We mean it. |
16 | // |
17 | |
18 | #include <QtQuick3DXr/qtquick3dxrglobal.h> |
19 | |
20 | #include <type_traits> |
21 | |
22 | QT_BEGIN_NAMESPACE |
23 | |
24 | // See, and match, QQuick3DXrView::FoveationLevel |
25 | namespace QtQuick3DXr |
26 | { |
27 | |
28 | enum FoveationLevel { |
29 | NoFoveation = 0, |
30 | LowFoveation = 1, |
31 | MediumFoveation = 2, |
32 | HighFoveation = 3 |
33 | }; |
34 | |
35 | // See, and match, QQuick3DXrView::ReferenceSpace |
36 | enum class ReferenceSpace { |
37 | ReferenceSpaceUnknown, |
38 | ReferenceSpaceLocal, |
39 | ReferenceSpaceStage, |
40 | ReferenceSpaceLocalFloor |
41 | }; |
42 | |
43 | enum Hand : quint8 { |
44 | LeftHand = 0, |
45 | RightHand = 1, |
46 | Unknown = 2, |
47 | }; |
48 | |
49 | enum class HandPoseSpace { |
50 | GripPose, |
51 | AimPose, |
52 | PinchPose, |
53 | PokePose |
54 | }; |
55 | |
56 | enum class XrSpaceId : quint64 { Invalid = 0 }; |
57 | |
58 | template<typename XrSpaceT> |
59 | XrSpaceT fromXrSpaceId(XrSpaceId space) |
60 | { |
61 | static_assert(sizeof(XrSpaceT) <= sizeof(XrSpaceId), "XrSpaceT's size must equal or smaller than XrSpaceId" ); |
62 | if constexpr (std::is_pointer_v<XrSpaceT>) |
63 | return reinterpret_cast<XrSpaceT>(space); |
64 | else |
65 | return static_cast<XrSpaceT>(space); |
66 | } |
67 | |
68 | template<typename XrSpaceT> |
69 | XrSpaceId toXrSpaceId(XrSpaceT space) |
70 | { |
71 | static_assert(sizeof(XrSpaceT) <= sizeof(XrSpaceId), "XrSpaceT's size must equal or smaller than XrSpaceId" ); |
72 | return static_cast<XrSpaceId>(quint64(space)); |
73 | } |
74 | |
75 | template <size_t N = 16> |
76 | [[nodiscard]] bool isNullUuid(const quint8 (&uuid)[N]) { |
77 | size_t counter = 0; |
78 | for (size_t i = 0; i != N; ++i) |
79 | counter += (uuid[i] == 0); |
80 | |
81 | return (counter == N); |
82 | } |
83 | |
84 | } // namespace QtQuick3DXr |
85 | |
86 | QT_END_NAMESPACE |
87 | |
88 | #endif // QTQUICK3DXRGLOBAL_P_H |
89 | |