Monado OpenXR Runtime
oxr_hand_tracking.h
Go to the documentation of this file.
1// Copyright 2018-2024, Collabora, Ltd.
2// Copyright 2025, NVIDIA CORPORATION.
3// SPDX-License-Identifier: BSL-1.0
4/*!
5 * @file
6 * @brief Hand tracking objects and functions.
7 * @author Christoph Haag <christoph.haag@collabora.com>
8 * @author Korcan Hussein <korcan.hussein@collabora.com>
9 * @ingroup oxr_main
10 */
11
12#pragma once
13
15#include "oxr_handle.h"
16
17
18/*
19 *
20 * Structs and defines.
21 *
22 */
23
24struct oxr_session;
25
27{
28 //! xrt_device backing this hand tracker
30
31 //! the input name associated with this hand tracker
33};
34
35static inline int
36oxr_hand_tracking_data_source_cmp(const void *p1, const void *p2)
37{
38 const struct oxr_hand_tracking_data_source *lhs = (const struct oxr_hand_tracking_data_source *)p1;
39 const struct oxr_hand_tracking_data_source *rhs = (const struct oxr_hand_tracking_data_source *)p2;
40 assert(lhs && rhs);
41 if (rhs->input_name < lhs->input_name)
42 return -1;
43 if (rhs->input_name > lhs->input_name)
44 return 1;
45 return 0;
46}
47
48/*!
49 * A hand tracker.
50 *
51 * Parent type/handle is @ref oxr_instance
52 *
53 *
54 * @obj{XrHandTrackerEXT}
55 * @extends oxr_handle_base
56 */
58{
59 //! Common structure for things referred to by OpenXR handles.
61
62 //! Owner of this hand tracker.
64
65 struct oxr_hand_tracking_data_source unobstructed;
66 struct oxr_hand_tracking_data_source conforming;
67
68 /*!
69 * An ordered list of requested data-source from above options (@ref
70 * oxr_hand_tracker::[unobstructed|conforming]), ordered by
71 * @ref oxr_hand_tracker::input_name (see @ref oxr_hand_tracking_data_source_cmp)
72 *
73 * if OXR_HAVE_EXT_hand_tracking_data_source is not defined the list
74 * will contain refs to all the above options.
75 */
77 uint32_t requested_sources_count;
78
79 XrHandEXT hand;
80 XrHandJointSetEXT hand_joint_set;
81};
82
83
84/*
85 *
86 * Functions.
87 *
88 */
89
90XrResult
91oxr_hand_tracker_create(struct oxr_logger *log,
92 struct oxr_session *sess,
93 const XrHandTrackerCreateInfoEXT *createInfo,
94 struct oxr_hand_tracker **out_hand_tracker);
95
96XrResult
97oxr_hand_tracker_joints(struct oxr_logger *log,
98 struct oxr_hand_tracker *hand_tracker,
99 const XrHandJointsLocateInfoEXT *locateInfo,
100 XrHandJointLocationsEXT *locations);
101
102XrResult
103oxr_hand_tracker_apply_force_feedback(struct oxr_logger *log,
104 struct oxr_hand_tracker *hand_tracker,
105 const XrForceFeedbackCurlApplyLocationsMNDX *locations);
xrt_input_name
Every internal input source known to monado with a baked in type.
Definition: xrt_defines.h:1359
Contains handle-related functions and defines only required in a few locations.
A hand tracker.
Definition: oxr_hand_tracking.h:58
struct oxr_session * sess
Owner of this hand tracker.
Definition: oxr_hand_tracking.h:63
struct oxr_hand_tracking_data_source * requested_sources[2]
An ordered list of requested data-source from above options (oxr_hand_tracker::[unobstructed|conformi...
Definition: oxr_hand_tracking.h:76
struct oxr_handle_base handle
Common structure for things referred to by OpenXR handles.
Definition: oxr_hand_tracking.h:60
Definition: oxr_hand_tracking.h:27
enum xrt_input_name input_name
the input name associated with this hand tracker
Definition: oxr_hand_tracking.h:32
struct xrt_device * xdev
xrt_device backing this hand tracker
Definition: oxr_hand_tracking.h:29
Used to hold diverse child handles and ensure orderly destruction.
Definition: oxr_objects.h:1470
Logger struct that lives on the stack, one for each call client call.
Definition: oxr_logger.h:40
Object that client program interact with.
Definition: oxr_objects.h:1853
A single HMD or input device.
Definition: xrt_device.h:309
Include all of the openxr headers in one place.