Monado OpenXR Runtime
xrt_device.h
Go to the documentation of this file.
1// Copyright 2019-2024, Collabora, Ltd.
2// SPDX-License-Identifier: BSL-1.0
3/*!
4 * @file
5 * @brief Header defining an xrt display or controller device.
6 * @author Jakob Bornecrantz <jakob@collabora.com>
7 * @author Moses Turner <mosesturner@protonmail.com>
8 * @author Korcan Hussein <korcan.hussein@collabora.com>
9 * @ingroup xrt_iface
10 */
11
12#pragma once
13
14#include "xrt/xrt_defines.h"
16#include "xrt/xrt_limits.h"
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
22struct xrt_tracking;
23
24#define XRT_DEVICE_NAME_LEN 256
25
26
27/*!
28 * A per-lens/display view information.
29 *
30 * @ingroup xrt_iface
31 */
33{
34 /*!
35 * @brief Viewport position on the screen.
36 *
37 * In absolute screen coordinates on an unrotated display, like the
38 * HMD presents it to the OS.
39 *
40 * This field is only used by @ref comp to setup the device rendering.
41 *
42 * If the view is being rotated by xrt_view.rot 90° right in the
43 * distortion shader then `display.w_pixels == viewport.h_pixels` and
44 * `display.h_pixels == viewport.w_pixels`.
45 */
46 struct
47 {
48 uint32_t x_pixels;
49 uint32_t y_pixels;
50 uint32_t w_pixels;
51 uint32_t h_pixels;
53
54 /*!
55 * @brief Physical properties of this display (or the part of a display
56 * that covers this view).
57 *
58 * Not in absolute screen coordinates but like the clients see them i.e.
59 * after rotation is applied by xrt_view::rot.
60 * This field is only used for the clients' swapchain setup.
61 *
62 * The xrt_view::display::w_pixels and xrt_view::display::h_pixels
63 * become the recommended image size for this view, after being scaled
64 * by the debug environment variable `XRT_COMPOSITOR_SCALE_PERCENTAGE`.
65 */
66 struct
67 {
68 uint32_t w_pixels;
69 uint32_t h_pixels;
71
72 /*!
73 * @brief Rotation 2d matrix used to rotate the position of the output
74 * of the distortion shaders onto the screen.
75 *
76 * If the distortion shader is based on a mesh, then this matrix rotates
77 * the vertex positions.
78 */
80};
81
82/*!
83 * All of the device components that deals with interfacing to a users head.
84 *
85 * HMD is probably a bad name for the future but for now will have to do.
86 *
87 * @ingroup xrt_iface
88 */
90{
91 /*!
92 * @brief The hmd screen as an unrotated display, like the HMD presents
93 * it to the OS.
94 *
95 * This field is used by @ref comp to setup the extended mode window.
96 */
97 struct
98 {
99 int w_pixels;
100 int h_pixels;
101 //! Nominal frame interval
104
105 /*!
106 * Display information.
107 *
108 * For now hardcoded display to two.
109 */
110 struct xrt_view views[XRT_MAX_VIEWS];
111
112 size_t view_count;
113 /*!
114 * Array of supported blend modes.
115 */
116 enum xrt_blend_mode blend_modes[XRT_MAX_DEVICE_BLEND_MODES];
117 size_t blend_mode_count;
118
119 /*!
120 * Distortion information.
121 */
122 struct
123 {
124 //! Supported distortion models, a bitfield.
126 //! Preferred disortion model, single value.
128
129 struct
130 {
131 //! Data.
132 float *vertices;
133 //! Number of vertices.
134 uint32_t vertex_count;
135 //! Stride of vertices
136 uint32_t stride;
137 //! 1 or 3 for (chromatic aberration).
139
140 //! Indices, for triangle strip.
142 //! Number of indices for the triangle strips (one per view).
143 uint32_t index_counts[XRT_MAX_VIEWS];
144 //! Offsets for the indices (one offset per view).
145 uint32_t index_offsets[XRT_MAX_VIEWS];
146 //! Total number of elements in mesh::indices array.
148 } mesh;
149
150 //! distortion is subject to the field of view
151 struct xrt_fov fov[XRT_MAX_VIEWS];
153};
154
155/*!
156 * A single named input, that sits on a @ref xrt_device.
157 *
158 * @ingroup xrt_iface
159 */
161{
162 //! Is this input active.
163 bool active;
164
165 int64_t timestamp;
166
167 enum xrt_input_name name;
168
169 union xrt_input_value value;
170};
171
172/*!
173 * A single named output, that sits on a @ref xrt_device.
174 *
175 * @ingroup xrt_iface
176 */
178{
179 enum xrt_output_name name;
180};
181
182
183/*!
184 * A binding pair, going @p from a binding point to a @p device input.
185 *
186 * @ingroup xrt_iface
187 */
189{
190 enum xrt_input_name from; //!< From which name.
191 enum xrt_input_name device; //!< To input on the device.
192};
193
194/*!
195 * A binding pair, going @p from a binding point to a @p device output.
196 *
197 * @ingroup xrt_iface
198 */
200{
201 enum xrt_output_name from; //!< From which name.
202 enum xrt_output_name device; //!< To output on the device.
203};
204
205/*!
206 * A binding profile, has lists of binding pairs to goes from device in @p name
207 * to the device it hangs off on.
208 *
209 * @ingroup xrt_iface
210 */
212{
213 //! Device this binding emulates.
215
216 struct xrt_binding_input_pair *inputs;
217 size_t input_count;
218 struct xrt_binding_output_pair *outputs;
219 size_t output_count;
220};
221
222/*!
223 * Higher level features for devices.
224 */
226{
227 XRT_DEVICE_FEATURE_HAND_TRACKING_LEFT = 0,
228 XRT_DEVICE_FEATURE_HAND_TRACKING_RIGHT,
229 XRT_DEVICE_FEATURE_EYE_TRACKING,
230 XRT_DEVICE_FEATURE_MAX_ENUM,
231};
232
233/*!
234 * @interface xrt_device
235 *
236 * A single HMD or input device.
237 *
238 * @ingroup xrt_iface
239 */
241{
242 //! Enum identifier of the device.
244 enum xrt_device_type device_type;
245
246 //! A string describing the device.
247 char str[XRT_DEVICE_NAME_LEN];
248
249 //! A unique identifier. Persistent across configurations, if possible.
250 char serial[XRT_DEVICE_NAME_LEN];
251
252 //! Null if this device does not interface with the users head.
254
255 //! Always set, pointing to the tracking system for this device.
257
258 //! Number of bindings in xrt_device::binding_profiles
260 // Array of alternative binding profiles.
261 struct xrt_binding_profile *binding_profiles;
262
263 //! Number of inputs.
265 //! Array of input structs.
267
268 //! Number of outputs.
270 //! Array of output structs.
272
273 bool orientation_tracking_supported;
274 bool position_tracking_supported;
275 bool hand_tracking_supported;
276 bool eye_gaze_supported;
277 bool force_feedback_supported;
278 bool ref_space_usage_supported;
279 bool form_factor_check_supported;
280 bool stage_supported;
281 bool face_tracking_supported;
282 bool body_tracking_supported;
283 bool battery_status_supported;
284
285 /*
286 *
287 * Functions.
288 *
289 */
290
291 /*!
292 * Update any attached inputs.
293 *
294 * @param[in] xdev The device.
295 */
297
298 /*!
299 * @brief Get relationship of a tracked device to the tracking origin
300 * space as the base space.
301 *
302 * It is the responsibility of the device driver to do any prediction,
303 * there are helper functions available for this.
304 *
305 * The timestamps are system monotonic timestamps, such as returned by
306 * os_monotonic_get_ns().
307 *
308 * @param[in] xdev The device.
309 * @param[in] name Some devices may have multiple poses on
310 * them, select the one using this field. For
311 * HMDs use @p XRT_INPUT_GENERIC_HEAD_POSE.
312 * For Unbounded Reference Space you can use
313 * @p XRT_INPUT_GENERIC_UNBOUNDED_SPACE_POSE
314 * to get the origin of that space.
315 * @param[in] at_timestamp_ns If the device can predict or has a history
316 * of positions, this is when the caller
317 * wants the pose to be from.
318 * @param[out] out_relation The relation read from the device.
319 *
320 * @see xrt_input_name
321 */
323 enum xrt_input_name name,
324 int64_t at_timestamp_ns,
325 struct xrt_space_relation *out_relation);
326
327 /*!
328 * @brief Get relationship of hand joints to the tracking origin space as
329 * the base space.
330 *
331 * It is the responsibility of the device driver to either do prediction
332 * or return joints from a previous time and write that time out to
333 * @p out_timestamp_ns.
334 *
335 * The timestamps are system monotonic timestamps, such as returned by
336 * os_monotonic_get_ns().
337 *
338 * @param[in] xdev The device.
339 * @param[in] name Some devices may have multiple poses on
340 * them, select the one using this field. For
341 * hand tracking use @p XRT_INPUT_GENERIC_HAND_TRACKING_DEFAULT_SET.
342 * @param[in] desired_timestamp_ns If the device can predict or has a history
343 * of positions, this is when the caller
344 * wants the pose to be from.
345 * @param[out] out_value The hand joint data read from the device.
346 * @param[out] out_timestamp_ns The timestamp of the data being returned.
347 *
348 * @see xrt_input_name
349 */
350 void (*get_hand_tracking)(struct xrt_device *xdev,
351 enum xrt_input_name name,
352 int64_t desired_timestamp_ns,
353 struct xrt_hand_joint_set *out_value,
354 int64_t *out_timestamp_ns);
355
356 /*!
357 * @brief Get the requested blend shape properties & weights for a face tracker
358 *
359 * @param[in] xdev The device.
360 * @param[in] facial_expression_type The facial expression data type (XR_FB_face_tracking,
361 * XR_HTC_facial_tracking, etc).
362 * @param[in] at_timestamp_ns Timestamp to be optionally used for prediction/history. For OXR extensions
363 * that do not pass a timestamp, the current timestamp is used.
364 * @param[in] out_value Set of requested expression weights & blend shape properties.
365 *
366 * @see xrt_input_name
367 */
369 enum xrt_input_name facial_expression_type,
370 int64_t at_timestamp_ns,
371 struct xrt_facial_expression_set *out_value);
372
373 /*!
374 * @brief Get the body skeleton in T-pose, used to query the skeleton hierarchy, scale, proportions etc
375 *
376 * @param[in] xdev The device.
377 * @param[in] body_tracking_type The body joint set type (XR_FB_body_tracking,
378 * XR_META_body_tracking_full_body, etc).
379 * @param[in] out_value The body skeleton hierarchy/properties.
380 *
381 * @see xrt_input_name
382 */
384 enum xrt_input_name body_tracking_type,
385 struct xrt_body_skeleton *out_value);
386
387 /*!
388 * @brief Get the joint locations for a body tracker
389 *
390 * @param[in] xdev The device.
391 * @param[in] body_tracking_type The body joint set type (XR_FB_body_tracking,
392 * XR_META_body_tracking_full_body, etc).
393 * @param[in] desired_timestamp_ns If the device can predict or has a history
394 * of locations, this is when the caller
395 * @param[in] out_value Set of body joint locations & properties.
396 *
397 * @see xrt_input_name
398 */
400 enum xrt_input_name body_tracking_type,
401 int64_t desired_timestamp_ns,
402 struct xrt_body_joint_set *out_value);
403
404 /*!
405 * Set a output value.
406 *
407 * @param[in] xdev The device.
408 * @param[in] name The output component name to set.
409 * @param[in] value The value to set the output to.
410 * @see xrt_output_name
411 */
412 void (*set_output)(struct xrt_device *xdev, enum xrt_output_name name, const union xrt_output_value *value);
413
414 /*!
415 * @brief Get the per-view pose in relation to the view space.
416 *
417 * On most devices with coplanar displays and no built-in eye tracking
418 * or IPD sensing, this just calls a helper to process the provided
419 * eye relation, but this may also handle canted displays as well as
420 * eye tracking.
421 *
422 * Incorporates a call to xrt_device::get_tracked_pose or a wrapper for it
423 *
424 * @param[in] xdev The device.
425 * @param[in] default_eye_relation
426 * The interpupillary relation as a 3D position.
427 * Most simple stereo devices would just want to
428 * set `out_pose->position.[x|y|z] = ipd.[x|y|z]
429 * / 2.0f` and adjust for left vs right view.
430 * Not to be confused with IPD that is absolute
431 * distance, this is a full 3D translation
432 * If a device has a more accurate/dynamic way of
433 * knowing the eye relation, it may ignore this
434 * input.
435 * @param[in] at_timestamp_ns This is when the caller wants the poses and FOVs to be from.
436 * @param[in] view_count Number of views.
437 * @param[out] out_head_relation
438 * The head pose in the device tracking space.
439 * Combine with @p out_poses to get the views in
440 * device tracking space.
441 * @param[out] out_fovs An array (of size @p view_count ) to populate
442 * with the device-suggested fields of view.
443 * @param[out] out_poses An array (of size @p view_count ) to populate
444 * with view output poses in head space. When
445 * implementing, be sure to also set orientation:
446 * most likely identity orientation unless you
447 * have canted screens.
448 * (Caution: Even if you have eye tracking, you
449 * won't use eye orientation here!)
450 */
451 void (*get_view_poses)(struct xrt_device *xdev,
452 const struct xrt_vec3 *default_eye_relation,
453 int64_t at_timestamp_ns,
454 uint32_t view_count,
455 struct xrt_space_relation *out_head_relation,
456 struct xrt_fov *out_fovs,
457 struct xrt_pose *out_poses);
458
459 /**
460 * Compute the distortion at a single point.
461 *
462 * The input is @p u @p v in screen/output space (that is, predistorted), you are to compute and return the u,v
463 * coordinates to sample the render texture. The compositor will step through a range of u,v parameters to build
464 * the lookup (vertex attribute or distortion texture) used to pre-distort the image as required by the device's
465 * optics.
466 *
467 * @param xdev the device
468 * @param view the view index
469 * @param u horizontal texture coordinate
470 * @param v vertical texture coordinate
471 * @param[out] out_result corresponding u,v pairs for all three color channels.
472 */
474 struct xrt_device *xdev, uint32_t view, float u, float v, struct xrt_uv_triplet *out_result);
475
476 /*!
477 * Get the visibility mask for this device.
478 *
479 * @param[in] xdev The device.
480 * @param[in] type The type of visibility mask.
481 * @param[in] view_index The index of the view to get the mask for.
482 * @param[out] out_mask Output mask, caller must free.
483 */
485 enum xrt_visibility_mask_type type,
486 uint32_t view_index,
487 struct xrt_visibility_mask **out_mask);
488
489 /*!
490 * Called by the @ref xrt_space_overseer when a reference space that is
491 * implemented by this device is first used, or when the last usage of
492 * the reference space stops.
493 *
494 * What is provided is both the @ref xrt_reference_space_type that
495 * triggered the usage change and the @ref xrt_input_name (if any) that
496 * is used to drive the space.
497 *
498 * @see xrt_space_overseer_ref_space_inc
499 * @see xrt_space_overseer_ref_space_dec
500 * @see xrt_input_name
501 * @see xrt_reference_space_type
502 */
504 enum xrt_reference_space_type type,
505 enum xrt_input_name name,
506 bool used);
507
508 /*!
509 * @brief Check if given form factor is available or not.
510 *
511 * This should only be used in HMD device, if the device driver supports form factor check.
512 *
513 * @param[in] xdev The device.
514 * @param[in] form_factor Form factor to check.
515 *
516 * @return true if given form factor is available; otherwise false.
517 */
518 bool (*is_form_factor_available)(struct xrt_device *xdev, enum xrt_form_factor form_factor);
519
520 /*!
521 * @brief Get battery status information.
522 *
523 * @param[in] xdev The device.
524 * @param[out] out_present Whether battery status information exist for this device.
525 * @param[out] out_charging Whether the device's battery is being charged.
526 * @param[out] out_charge Battery charge as a value between 0 and 1.
527 */
529 bool *out_present,
530 bool *out_charging,
531 float *out_charge);
532
533 /*!
534 * Enable the feature for this device.
535 *
536 * @param[in] xdev The device.
537 * @param[in] type The type of device feature.
538 */
540
541 /*!
542 * Disable the feature for this device.
543 *
544 * @param[in] xdev The device.
545 * @param[in] type The type of device feature.
546 */
548
549 /*!
550 * Destroy device.
551 */
552 void (*destroy)(struct xrt_device *xdev);
553
554 // Add new functions above destroy.
555};
556
557/*!
558 * Helper function for @ref xrt_device::update_inputs.
559 *
560 * @copydoc xrt_device::update_inputs
561 *
562 * @public @memberof xrt_device
563 */
564static inline xrt_result_t
566{
567 return xdev->update_inputs(xdev);
568}
569
570/*!
571 * Helper function for @ref xrt_device::get_tracked_pose.
572 *
573 * @copydoc xrt_device::get_tracked_pose
574 *
575 * @public @memberof xrt_device
576 */
577static inline xrt_result_t
579 enum xrt_input_name name,
580 int64_t at_timestamp_ns,
581 struct xrt_space_relation *out_relation)
582{
583 return xdev->get_tracked_pose(xdev, name, at_timestamp_ns, out_relation);
584}
585
586/*!
587 * Helper function for @ref xrt_device::get_hand_tracking.
588 *
589 * @copydoc xrt_device::get_hand_tracking
590 *
591 * @public @memberof xrt_device
592 */
593static inline void
595 enum xrt_input_name name,
596 int64_t desired_timestamp_ns,
597 struct xrt_hand_joint_set *out_value,
598 int64_t *out_timestamp_ns)
599{
600 xdev->get_hand_tracking(xdev, name, desired_timestamp_ns, out_value, out_timestamp_ns);
601}
602
603/*!
604 * Helper function for @ref xrt_device::get_face_tracking.
605 *
606 * @copydoc xrt_device::get_face_tracking
607 *
608 * @public @memberof xrt_device
609 */
610static inline xrt_result_t
612 enum xrt_input_name facial_expression_type,
613 int64_t at_timestamp_ns,
614 struct xrt_facial_expression_set *out_value)
615{
616 return xdev->get_face_tracking(xdev, facial_expression_type, at_timestamp_ns, out_value);
617}
618
619/*!
620 * Helper function for @ref xrt_device::get_body_skeleton.
621 *
622 * @copydoc xrt_device::get_body_skeleton
623 *
624 * @public @memberof xrt_device
625 */
626static inline xrt_result_t
628 enum xrt_input_name body_tracking_type,
629 struct xrt_body_skeleton *out_value)
630{
631 return xdev->get_body_skeleton(xdev, body_tracking_type, out_value);
632}
633
634/*!
635 * Helper function for @ref xrt_device::get_body_joints.
636 *
637 * @copydoc xrt_device::get_body_joints
638 *
639 * @public @memberof xrt_device
640 */
641static inline xrt_result_t
643 enum xrt_input_name body_tracking_type,
644 int64_t desired_timestamp_ns,
645 struct xrt_body_joint_set *out_value)
646{
647 return xdev->get_body_joints(xdev, body_tracking_type, desired_timestamp_ns, out_value);
648}
649
650/*!
651 * Helper function for @ref xrt_device::set_output.
652 *
653 * @copydoc xrt_device::set_output
654 *
655 * @public @memberof xrt_device
656 */
657static inline void
659{
660 xdev->set_output(xdev, name, value);
661}
662
663/*!
664 * Helper function for @ref xrt_device::get_view_poses.
665 *
666 * @copydoc xrt_device::get_view_poses
667 * @public @memberof xrt_device
668 */
669static inline void
671 const struct xrt_vec3 *default_eye_relation,
672 int64_t at_timestamp_ns,
673 uint32_t view_count,
674 struct xrt_space_relation *out_head_relation,
675 struct xrt_fov *out_fovs,
676 struct xrt_pose *out_poses)
677{
678 xdev->get_view_poses(xdev, default_eye_relation, at_timestamp_ns, view_count, out_head_relation, out_fovs,
679 out_poses);
680}
681
682/*!
683 * Helper function for @ref xrt_device::compute_distortion.
684 *
685 * @copydoc xrt_device::compute_distortion
686 *
687 * @public @memberof xrt_device
688 */
689static inline bool
691 struct xrt_device *xdev, uint32_t view, float u, float v, struct xrt_uv_triplet *out_result)
692{
693 return xdev->compute_distortion(xdev, view, u, v, out_result);
694}
695
696/*!
697 * Helper function for @ref xrt_device::get_visibility_mask.
698 *
699 * @copydoc xrt_device::get_visibility_mask
700 *
701 * @public @memberof xrt_device
702 */
703static inline xrt_result_t
705 enum xrt_visibility_mask_type type,
706 uint32_t view_index,
707 struct xrt_visibility_mask **out_mask)
708{
709 return xdev->get_visibility_mask(xdev, type, view_index, out_mask);
710}
711
712/*!
713 * Helper function for @ref xrt_device::ref_space_usage.
714 *
715 * @copydoc xrt_device::ref_space_usage
716 *
717 * @public @memberof xrt_device
718 */
719static inline xrt_result_t
721 enum xrt_reference_space_type type,
722 enum xrt_input_name name,
723 bool used)
724{
725 return xdev->ref_space_usage(xdev, type, name, used);
726}
727
728/*!
729 * Helper function for @ref xrt_device::is_form_factor_available.
730 *
731 * @copydoc xrt_device::is_form_factor_available
732 *
733 * @public @memberof xrt_device
734 */
735static inline bool
737{
738 return xdev->is_form_factor_available(xdev, form_factor);
739}
740
741/*!
742 * Helper function for @ref xrt_device::get_battery_status.
743 *
744 * @copydoc xrt_device::get_battery_status
745 *
746 * @public @memberof xrt_device
747 */
748static inline xrt_result_t
749xrt_device_get_battery_status(struct xrt_device *xdev, bool *out_present, bool *out_charging, float *out_charge)
750{
751 return xdev->get_battery_status(xdev, out_present, out_charging, out_charge);
752}
753
754/*!
755 * Helper function for @ref xrt_device::begin_feature.
756 *
757 * @copydoc xrt_device::begin_feature
758 *
759 * @public @memberof xrt_device
760 */
761static inline xrt_result_t
763{
764 return xdev->begin_feature(xdev, type);
765}
766
767/*!
768 * Helper function for @ref xrt_device::end_feature.
769 *
770 * @copydoc xrt_device::end_feature
771 *
772 * @public @memberof xrt_device
773 */
774static inline xrt_result_t
776{
777 return xdev->end_feature(xdev, type);
778}
779
780/*!
781 * Helper function for @ref xrt_device::destroy.
782 *
783 * Handles nulls, sets your pointer to null.
784 *
785 * @public @memberof xrt_device
786 */
787static inline void
789{
790 struct xrt_device *xdev = *xdev_ptr;
791 if (xdev == NULL) {
792 return;
793 }
794
795 xdev->destroy(xdev);
796 *xdev_ptr = NULL;
797}
798
799
800#ifdef __cplusplus
801} // extern "C"
802#endif
xrt_visibility_mask_type
Visibility mask, mirror of XrVisibilityMaskKHR.
Definition: xrt_defines.h:1965
xrt_blend_mode
Blend mode that the device supports, exact mirror of XrEnvironmentBlendMode.
Definition: xrt_defines.h:109
xrt_form_factor
What form factor is this device, mostly maps onto OpenXR's XrFormFactor.
Definition: xrt_defines.h:1915
xrt_input_name
Every internal input source known to monado with a baked in type.
Definition: xrt_defines.h:1298
enum xrt_result xrt_result_t
Result type used across Monado.
xrt_reference_space_type
Type of a OpenXR mapped reference space, maps to the semantic spaces on the xrt_space_overseer struct...
Definition: xrt_defines.h:599
xrt_output_name
Name of a output with a baked in type.
Definition: xrt_defines.h:1801
xrt_device_type
How an xrt_device can be used.
Definition: xrt_defines.h:783
A binding pair, going from a binding point to a device input.
Definition: xrt_device.h:189
enum xrt_input_name device
To input on the device.
Definition: xrt_device.h:191
enum xrt_input_name from
From which name.
Definition: xrt_device.h:190
A binding pair, going from a binding point to a device output.
Definition: xrt_device.h:200
enum xrt_output_name device
To output on the device.
Definition: xrt_device.h:202
enum xrt_output_name from
From which name.
Definition: xrt_device.h:201
A binding profile, has lists of binding pairs to goes from device in name to the device it hangs off ...
Definition: xrt_device.h:212
enum xrt_device_name name
Device this binding emulates.
Definition: xrt_device.h:214
Definition: xrt_defines.h:1785
Definition: xrt_defines.h:1757
A single HMD or input device.
Definition: xrt_device.h:241
static xrt_result_t xrt_device_get_tracked_pose(struct xrt_device *xdev, enum xrt_input_name name, int64_t at_timestamp_ns, struct xrt_space_relation *out_relation)
Helper function for xrt_device::get_tracked_pose.
Definition: xrt_device.h:578
xrt_result_t(* get_body_skeleton)(struct xrt_device *xdev, enum xrt_input_name body_tracking_type, struct xrt_body_skeleton *out_value)
Get the body skeleton in T-pose, used to query the skeleton hierarchy, scale, proportions etc.
Definition: xrt_device.h:383
static xrt_result_t xrt_device_begin_feature(struct xrt_device *xdev, enum xrt_device_feature_type type)
Helper function for xrt_device::begin_feature.
Definition: xrt_device.h:762
xrt_result_t(* get_body_joints)(struct xrt_device *xdev, enum xrt_input_name body_tracking_type, int64_t desired_timestamp_ns, struct xrt_body_joint_set *out_value)
Get the joint locations for a body tracker.
Definition: xrt_device.h:399
xrt_result_t(* ref_space_usage)(struct xrt_device *xdev, enum xrt_reference_space_type type, enum xrt_input_name name, bool used)
Called by the xrt_space_overseer when a reference space that is implemented by this device is first u...
Definition: xrt_device.h:503
void(* set_output)(struct xrt_device *xdev, enum xrt_output_name name, const union xrt_output_value *value)
Set a output value.
Definition: xrt_device.h:412
static xrt_result_t xrt_device_update_inputs(struct xrt_device *xdev)
Helper function for xrt_device::update_inputs.
Definition: xrt_device.h:565
void(* get_hand_tracking)(struct xrt_device *xdev, enum xrt_input_name name, int64_t desired_timestamp_ns, struct xrt_hand_joint_set *out_value, int64_t *out_timestamp_ns)
Get relationship of hand joints to the tracking origin space as the base space.
Definition: xrt_device.h:350
static xrt_result_t xrt_device_ref_space_usage(struct xrt_device *xdev, enum xrt_reference_space_type type, enum xrt_input_name name, bool used)
Helper function for xrt_device::ref_space_usage.
Definition: xrt_device.h:720
char str[256]
A string describing the device.
Definition: xrt_device.h:247
static void xrt_device_get_view_poses(struct xrt_device *xdev, const struct xrt_vec3 *default_eye_relation, int64_t at_timestamp_ns, uint32_t view_count, struct xrt_space_relation *out_head_relation, struct xrt_fov *out_fovs, struct xrt_pose *out_poses)
Helper function for xrt_device::get_view_poses.
Definition: xrt_device.h:670
static xrt_result_t xrt_device_get_face_tracking(struct xrt_device *xdev, enum xrt_input_name facial_expression_type, int64_t at_timestamp_ns, struct xrt_facial_expression_set *out_value)
Helper function for xrt_device::get_face_tracking.
Definition: xrt_device.h:611
void(* get_view_poses)(struct xrt_device *xdev, const struct xrt_vec3 *default_eye_relation, int64_t at_timestamp_ns, uint32_t view_count, struct xrt_space_relation *out_head_relation, struct xrt_fov *out_fovs, struct xrt_pose *out_poses)
Get the per-view pose in relation to the view space.
Definition: xrt_device.h:451
xrt_result_t(* get_visibility_mask)(struct xrt_device *xdev, enum xrt_visibility_mask_type type, uint32_t view_index, struct xrt_visibility_mask **out_mask)
Get the visibility mask for this device.
Definition: xrt_device.h:484
struct xrt_hmd_parts * hmd
Null if this device does not interface with the users head.
Definition: xrt_device.h:253
xrt_result_t(* get_face_tracking)(struct xrt_device *xdev, enum xrt_input_name facial_expression_type, int64_t at_timestamp_ns, struct xrt_facial_expression_set *out_value)
Get the requested blend shape properties & weights for a face tracker.
Definition: xrt_device.h:368
char serial[256]
A unique identifier. Persistent across configurations, if possible.
Definition: xrt_device.h:250
struct xrt_output * outputs
Array of output structs.
Definition: xrt_device.h:271
xrt_result_t(* begin_feature)(struct xrt_device *xdev, enum xrt_device_feature_type type)
Enable the feature for this device.
Definition: xrt_device.h:539
size_t output_count
Number of outputs.
Definition: xrt_device.h:269
bool(* is_form_factor_available)(struct xrt_device *xdev, enum xrt_form_factor form_factor)
Check if given form factor is available or not.
Definition: xrt_device.h:518
struct xrt_input * inputs
Array of input structs.
Definition: xrt_device.h:266
static xrt_result_t xrt_device_get_body_skeleton(struct xrt_device *xdev, enum xrt_input_name body_tracking_type, struct xrt_body_skeleton *out_value)
Helper function for xrt_device::get_body_skeleton.
Definition: xrt_device.h:627
size_t input_count
Number of inputs.
Definition: xrt_device.h:264
xrt_result_t(* get_battery_status)(struct xrt_device *xdev, bool *out_present, bool *out_charging, float *out_charge)
Get battery status information.
Definition: xrt_device.h:528
void(* destroy)(struct xrt_device *xdev)
Destroy device.
Definition: xrt_device.h:552
static xrt_result_t xrt_device_end_feature(struct xrt_device *xdev, enum xrt_device_feature_type type)
Helper function for xrt_device::end_feature.
Definition: xrt_device.h:775
xrt_result_t(* update_inputs)(struct xrt_device *xdev)
Update any attached inputs.
Definition: xrt_device.h:296
static xrt_result_t xrt_device_get_body_joints(struct xrt_device *xdev, enum xrt_input_name body_tracking_type, int64_t desired_timestamp_ns, struct xrt_body_joint_set *out_value)
Helper function for xrt_device::get_body_joints.
Definition: xrt_device.h:642
struct xrt_tracking_origin * tracking_origin
Always set, pointing to the tracking system for this device.
Definition: xrt_device.h:256
xrt_result_t(* end_feature)(struct xrt_device *xdev, enum xrt_device_feature_type type)
Disable the feature for this device.
Definition: xrt_device.h:547
size_t binding_profile_count
Number of bindings in xrt_device::binding_profiles.
Definition: xrt_device.h:259
enum xrt_device_name name
Enum identifier of the device.
Definition: xrt_device.h:243
static xrt_result_t xrt_device_get_visibility_mask(struct xrt_device *xdev, enum xrt_visibility_mask_type type, uint32_t view_index, struct xrt_visibility_mask **out_mask)
Helper function for xrt_device::get_visibility_mask.
Definition: xrt_device.h:704
static bool xrt_device_is_form_factor_available(struct xrt_device *xdev, enum xrt_form_factor form_factor)
Helper function for xrt_device::is_form_factor_available.
Definition: xrt_device.h:736
static void xrt_device_destroy(struct xrt_device **xdev_ptr)
Helper function for xrt_device::destroy.
Definition: xrt_device.h:788
static void xrt_device_set_output(struct xrt_device *xdev, enum xrt_output_name name, const union xrt_output_value *value)
Helper function for xrt_device::set_output.
Definition: xrt_device.h:658
xrt_result_t(* get_tracked_pose)(struct xrt_device *xdev, enum xrt_input_name name, int64_t at_timestamp_ns, struct xrt_space_relation *out_relation)
Get relationship of a tracked device to the tracking origin space as the base space.
Definition: xrt_device.h:322
bool(* compute_distortion)(struct xrt_device *xdev, uint32_t view, float u, float v, struct xrt_uv_triplet *out_result)
Compute the distortion at a single point.
Definition: xrt_device.h:473
static bool xrt_device_compute_distortion(struct xrt_device *xdev, uint32_t view, float u, float v, struct xrt_uv_triplet *out_result)
Helper function for xrt_device::compute_distortion.
Definition: xrt_device.h:690
static xrt_result_t xrt_device_get_battery_status(struct xrt_device *xdev, bool *out_present, bool *out_charging, float *out_charge)
Helper function for xrt_device::get_battery_status.
Definition: xrt_device.h:749
static void xrt_device_get_hand_tracking(struct xrt_device *xdev, enum xrt_input_name name, int64_t desired_timestamp_ns, struct xrt_hand_joint_set *out_value, int64_t *out_timestamp_ns)
Helper function for xrt_device::get_hand_tracking.
Definition: xrt_device.h:594
Definition: xrt_defines.h:1646
Describes a projection matrix fov.
Definition: xrt_defines.h:486
Joint set type used for hand tracking.
Definition: xrt_defines.h:1397
All of the device components that deals with interfacing to a users head.
Definition: xrt_device.h:90
float * vertices
Data.
Definition: xrt_device.h:132
struct xrt_fov fov[XRT_MAX_VIEWS]
distortion is subject to the field of view
Definition: xrt_device.h:151
uint32_t vertex_count
Number of vertices.
Definition: xrt_device.h:134
struct xrt_view views[XRT_MAX_VIEWS]
Display information.
Definition: xrt_device.h:110
uint64_t nominal_frame_interval_ns
Nominal frame interval.
Definition: xrt_device.h:102
uint32_t stride
Stride of vertices.
Definition: xrt_device.h:136
enum xrt_blend_mode blend_modes[XRT_MAX_DEVICE_BLEND_MODES]
Array of supported blend modes.
Definition: xrt_device.h:116
int * indices
Indices, for triangle strip.
Definition: xrt_device.h:141
enum xrt_distortion_model models
Supported distortion models, a bitfield.
Definition: xrt_device.h:125
uint32_t index_count_total
Total number of elements in mesh::indices array.
Definition: xrt_device.h:147
struct xrt_hmd_parts::@235 distortion
Distortion information.
uint32_t index_offsets[XRT_MAX_VIEWS]
Offsets for the indices (one offset per view).
Definition: xrt_device.h:145
uint32_t uv_channels_count
1 or 3 for (chromatic aberration).
Definition: xrt_device.h:138
struct xrt_hmd_parts::@234 screens[1]
The hmd screen as an unrotated display, like the HMD presents it to the OS.
enum xrt_distortion_model preferred
Preferred disortion model, single value.
Definition: xrt_device.h:127
uint32_t index_counts[XRT_MAX_VIEWS]
Number of indices for the triangle strips (one per view).
Definition: xrt_device.h:143
A single named input, that sits on a xrt_device.
Definition: xrt_device.h:161
bool active
Is this input active.
Definition: xrt_device.h:163
A tightly packed 2x2 matrix of floats.
Definition: xrt_defines.h:513
A single named output, that sits on a xrt_device.
Definition: xrt_device.h:178
A pose composed of a position and orientation.
Definition: xrt_defines.h:465
A relation with two spaces, includes velocity and acceleration.
Definition: xrt_defines.h:657
A tracking system or device origin.
Definition: xrt_tracking.h:71
Represents a uv triplet for distortion, basically just three xrt_vec2.
Definition: xrt_defines.h:261
A 3 element vector with single floats.
Definition: xrt_defines.h:271
A per-lens/display view information.
Definition: xrt_device.h:33
struct xrt_matrix_2x2 rot
Rotation 2d matrix used to rotate the position of the output of the distortion shaders onto the scree...
Definition: xrt_device.h:79
struct xrt_view::@232 viewport
Viewport position on the screen.
struct xrt_view::@233 display
Physical properties of this display (or the part of a display that covers this view).
Visibility mask helper, the indices and vertices are tightly packed after this struct.
Definition: xrt_visibility_mask.h:25
A union of all input types.
Definition: xrt_defines.h:1413
A union of all output types.
Definition: xrt_defines.h:1887
Common defines and enums for XRT.
xrt_distortion_model
Which distortion model does the device expose, used both as a bitfield and value.
Definition: xrt_defines.h:164
xrt_device_name
A enum that is used to name devices so that the state trackers can reason about the devices easier.
Definition: xrt_defines.h:712
xrt_device_feature_type
Higher level features for devices.
Definition: xrt_device.h:226
Header for limits of the XRT interfaces.
Header defining visibility mask helper struct.