41 void init(XrInstance instance, XrSession session);
44 bool isValid()
const {
return m_initialized; }
51 void updatePoses(XrTime predictedDisplayTime, XrSpace appSpace);
52 void updateHandtracking(XrTime predictedDisplayTime, XrSpace appSpace,
bool aimExtensionEnabled);
75 XrHandTrackerEXT
handTracker[2] = {XR_NULL_HANDLE, XR_NULL_HANDLE};
83 void setupHandTracking();
84 bool queryHandMesh(
Hand hand);
86 void destroyActions();
87 [[nodiscard]]
bool checkXrResult(
const XrResult &
result);
88 bool resolveXrFunction(
const char *
name, PFN_xrVoidFunction *function);
91 void createAction(XrActionType
type,
93 const char *localizedName,
95 XrPath *subactionPath,
97 void getBoolInputState(XrActionStateGetInfo &getInfo,
const XrAction &action, std::function<
void(
bool)> setter);
98 void getFloatInputState(XrActionStateGetInfo &getInfo,
const XrAction &action, std::function<
void(
float)> setter);
102 XrInstance m_instance{XR_NULL_HANDLE};
103 XrSession m_session{XR_NULL_HANDLE};
105 enum SubPathSelector {NoSubPath = 0, LeftHandSubPath = 1, RightHandSubPath = 2, BothHandsSubPath = 3};
107 struct QXRHandComponentPath
109 XrPath
paths[2] = {{}, {}};
115 struct InputActionInfo {
117 const char *shortName;
118 const char *localizedName;
122 QList<InputActionInfo> m_handInputActionDefs;
125 XrAction gripPoseAction{XR_NULL_HANDLE};
126 XrAction aimPoseAction{XR_NULL_HANDLE};
127 XrAction hapticAction{XR_NULL_HANDLE};
131 XrActionSet m_actionSet{XR_NULL_HANDLE};
132 XrPath m_handSubactionPath[2];
133 XrSpace m_handGripSpace[2];
134 XrSpace m_handAimSpace[2];
137 HandActions m_handActions;
140 uint m_aimStateFlags[2] = {};
141 bool m_initialized =
false;
142 bool m_validAimStateFromUpdatePoses[2] = {
false,
false};
145 struct HandMeshData {
146 QVector<XrVector3f> vertexPositions;
147 QVector<XrVector3f> vertexNormals;
148 QVector<XrVector2f> vertexUVs;
149 QVector<XrVector4sFB> vertexBlendIndices;
150 QVector<XrVector4f> vertexBlendWeights;
152 XrPosef jointBindPoses[XR_HAND_JOINT_COUNT_EXT];
153 XrHandJointEXT jointParents[XR_HAND_JOINT_COUNT_EXT];
154 float jointRadii[XR_HAND_JOINT_COUNT_EXT];
158 struct HandGeometryData {
160 } m_handGeometryData[2];
163 void createHandModelData(
Hand hand);