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