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
19 extern "C" {
20 #endif
21 
22 struct 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  */
32 struct xrt_view
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  */
79  struct xrt_matrix_2x2 rot;
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
103  } screens[1];
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.
141  int *indices;
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  */
160 struct xrt_input
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.
214  enum xrt_device_name name;
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  * @interface xrt_device
224  *
225  * A single HMD or input device.
226  *
227  * @ingroup xrt_iface
228  */
230 {
231  //! Enum identifier of the device.
232  enum xrt_device_name name;
233  enum xrt_device_type device_type;
234 
235  //! A string describing the device.
236  char str[XRT_DEVICE_NAME_LEN];
237 
238  //! A unique identifier. Persistent across configurations, if possible.
239  char serial[XRT_DEVICE_NAME_LEN];
240 
241  //! Null if this device does not interface with the users head.
243 
244  //! Always set, pointing to the tracking system for this device.
246 
247  //! Number of bindings in xrt_device::binding_profiles
249  // Array of alternative binding profiles.
250  struct xrt_binding_profile *binding_profiles;
251 
252  //! Number of inputs.
253  size_t input_count;
254  //! Array of input structs.
255  struct xrt_input *inputs;
256 
257  //! Number of outputs.
258  size_t output_count;
259  //! Array of output structs.
261 
262  bool orientation_tracking_supported;
263  bool position_tracking_supported;
264  bool hand_tracking_supported;
265  bool eye_gaze_supported;
266  bool force_feedback_supported;
267  bool ref_space_usage_supported;
268  bool form_factor_check_supported;
269  bool stage_supported;
270  bool face_tracking_supported;
271 
272  /*
273  *
274  * Functions.
275  *
276  */
277 
278  /*!
279  * Update any attached inputs.
280  *
281  * @param[in] xdev The device.
282  */
283  void (*update_inputs)(struct xrt_device *xdev);
284 
285  /*!
286  * @brief Get relationship of a tracked device to the tracking origin
287  * space as the base space.
288  *
289  * It is the responsibility of the device driver to do any prediction,
290  * there are helper functions available for this.
291  *
292  * The timestamps are system monotonic timestamps, such as returned by
293  * os_monotonic_get_ns().
294  *
295  * @param[in] xdev The device.
296  * @param[in] name Some devices may have multiple poses on
297  * them, select the one using this field. For
298  * HMDs use @p XRT_INPUT_GENERIC_HEAD_POSE.
299  * For Unbounded Reference Space you can use
300  * @p XRT_INPUT_GENERIC_UNBOUNDED_SPACE_POSE
301  * to get the origin of that space.
302  * @param[in] at_timestamp_ns If the device can predict or has a history
303  * of positions, this is when the caller
304  * wants the pose to be from.
305  * @param[out] out_relation The relation read from the device.
306  *
307  * @see xrt_input_name
308  */
309  void (*get_tracked_pose)(struct xrt_device *xdev,
310  enum xrt_input_name name,
311  uint64_t at_timestamp_ns,
312  struct xrt_space_relation *out_relation);
313 
314  /*!
315  * @brief Get relationship of hand joints to the tracking origin space as
316  * the base space.
317  *
318  * It is the responsibility of the device driver to either do prediction
319  * or return joints from a previous time and write that time out to
320  * @p out_timestamp_ns.
321  *
322  * The timestamps are system monotonic timestamps, such as returned by
323  * os_monotonic_get_ns().
324  *
325  * @param[in] xdev The device.
326  * @param[in] name Some devices may have multiple poses on
327  * them, select the one using this field. For
328  * hand tracking use @p XRT_INPUT_GENERIC_HAND_TRACKING_DEFAULT_SET.
329  * @param[in] desired_timestamp_ns If the device can predict or has a history
330  * of positions, this is when the caller
331  * wants the pose to be from.
332  * @param[out] out_value The hand joint data read from the device.
333  * @param[out] out_timestamp_ns The timestamp of the data being returned.
334  *
335  * @see xrt_input_name
336  */
337  void (*get_hand_tracking)(struct xrt_device *xdev,
338  enum xrt_input_name name,
339  uint64_t desired_timestamp_ns,
340  struct xrt_hand_joint_set *out_value,
341  uint64_t *out_timestamp_ns);
342 
343  /*!
344  * @brief Get the requested blend shape properties & weights for a face tracker
345  *
346  * @param[in] xdev The device.
347  * @param[in] facial_expression_type The facial expression data type (XR_FB_face_tracking,
348  * XR_HTC_facial_tracking, etc).
349  * @param[in] out_value Set of requested expression weights & blend shape properties.
350  *
351  * @see xrt_input_name
352  */
354  enum xrt_input_name facial_expression_type,
355  struct xrt_facial_expression_set *out_value);
356 
357  /*!
358  * Set a output value.
359  *
360  * @param[in] xdev The device.
361  * @param[in] name The output component name to set.
362  * @param[in] value The value to set the output to.
363  * @see xrt_output_name
364  */
365  void (*set_output)(struct xrt_device *xdev, enum xrt_output_name name, const union xrt_output_value *value);
366 
367  /*!
368  * @brief Get the per-view pose in relation to the view space.
369  *
370  * On most devices with coplanar displays and no built-in eye tracking
371  * or IPD sensing, this just calls a helper to process the provided
372  * eye relation, but this may also handle canted displays as well as
373  * eye tracking.
374  *
375  * Incorporates a call to xrt_device::get_tracked_pose or a wrapper for it
376  *
377  * @param[in] xdev The device.
378  * @param[in] default_eye_relation
379  * The interpupillary relation as a 3D position.
380  * Most simple stereo devices would just want to
381  * set `out_pose->position.[x|y|z] = ipd.[x|y|z]
382  * / 2.0f` and adjust for left vs right view.
383  * Not to be confused with IPD that is absolute
384  * distance, this is a full 3D translation
385  * If a device has a more accurate/dynamic way of
386  * knowing the eye relation, it may ignore this
387  * input.
388  * @param[in] at_timestamp_ns This is when the caller wants the poses and FOVs to be from.
389  * @param[in] view_count Number of views.
390  * @param[out] out_head_relation
391  * The head pose in the device tracking space.
392  * Combine with @p out_poses to get the views in
393  * device tracking space.
394  * @param[out] out_fovs An array (of size @p view_count ) to populate
395  * with the device-suggested fields of view.
396  * @param[out] out_poses An array (of size @p view_count ) to populate
397  * with view output poses in head space. When
398  * implementing, be sure to also set orientation:
399  * most likely identity orientation unless you
400  * have canted screens.
401  * (Caution: Even if you have eye tracking, you
402  * won't use eye orientation here!)
403  */
404  void (*get_view_poses)(struct xrt_device *xdev,
405  const struct xrt_vec3 *default_eye_relation,
406  uint64_t at_timestamp_ns,
407  uint32_t view_count,
408  struct xrt_space_relation *out_head_relation,
409  struct xrt_fov *out_fovs,
410  struct xrt_pose *out_poses);
411 
412  /**
413  * Compute the distortion at a single point.
414  *
415  * The input is @p u @p v in screen/output space (that is, predistorted), you are to compute and return the u,v
416  * coordinates to sample the render texture. The compositor will step through a range of u,v parameters to build
417  * the lookup (vertex attribute or distortion texture) used to pre-distort the image as required by the device's
418  * optics.
419  *
420  * @param xdev the device
421  * @param view the view index
422  * @param u horizontal texture coordinate
423  * @param v vertical texture coordinate
424  * @param[out] out_result corresponding u,v pairs for all three color channels.
425  */
427  struct xrt_device *xdev, uint32_t view, float u, float v, struct xrt_uv_triplet *out_result);
428 
429  /*!
430  * Get the visibility mask for this device.
431  *
432  * @param[in] xdev The device.
433  * @param[in] type The type of visibility mask.
434  * @param[in] view_index The index of the view to get the mask for.
435  * @param[out] out_mask Output mask, caller must free.
436  */
438  enum xrt_visibility_mask_type type,
439  uint32_t view_index,
440  struct xrt_visibility_mask **out_mask);
441 
442  /*!
443  * Called by the @ref xrt_space_overseer when a reference space that is
444  * implemented by this device is first used, or when the last usage of
445  * the reference space stops.
446  *
447  * What is provided is both the @ref xrt_reference_space_type that
448  * triggered the usage change and the @ref xrt_input_name (if any) that
449  * is used to drive the space.
450  *
451  * @see xrt_space_overseer_ref_space_inc
452  * @see xrt_space_overseer_ref_space_dec
453  * @see xrt_input_name
454  * @see xrt_reference_space_type
455  */
457  enum xrt_reference_space_type type,
458  enum xrt_input_name name,
459  bool used);
460 
461  /*!
462  * @brief Check if given form factor is available or not.
463  *
464  * This should only be used in HMD device, if the device driver supports form factor check.
465  *
466  * @param[in] xdev The device.
467  * @param[in] form_factor Form factor to check.
468  *
469  * @return true if given form factor is available; otherwise false.
470  */
471  bool (*is_form_factor_available)(struct xrt_device *xdev, enum xrt_form_factor form_factor);
472 
473  /*!
474  * Destroy device.
475  */
476  void (*destroy)(struct xrt_device *xdev);
477 
478  // Add new functions above destroy.
479 };
480 
481 /*!
482  * Helper function for @ref xrt_device::update_inputs.
483  *
484  * @copydoc xrt_device::update_inputs
485  *
486  * @public @memberof xrt_device
487  */
488 static inline void
490 {
491  xdev->update_inputs(xdev);
492 }
493 
494 /*!
495  * Helper function for @ref xrt_device::get_tracked_pose.
496  *
497  * @copydoc xrt_device::get_tracked_pose
498  *
499  * @public @memberof xrt_device
500  */
501 static inline void
503  enum xrt_input_name name,
504  uint64_t at_timestamp_ns,
505  struct xrt_space_relation *out_relation)
506 {
507  xdev->get_tracked_pose(xdev, name, at_timestamp_ns, out_relation);
508 }
509 
510 /*!
511  * Helper function for @ref xrt_device::get_hand_tracking.
512  *
513  * @copydoc xrt_device::get_hand_tracking
514  *
515  * @public @memberof xrt_device
516  */
517 static inline void
519  enum xrt_input_name name,
520  uint64_t desired_timestamp_ns,
521  struct xrt_hand_joint_set *out_value,
522  uint64_t *out_timestamp_ns)
523 {
524  xdev->get_hand_tracking(xdev, name, desired_timestamp_ns, out_value, out_timestamp_ns);
525 }
526 
527 /*!
528  * Helper function for @ref xrt_device::get_face_tracking.
529  *
530  * @copydoc xrt_device::get_face_tracking
531  *
532  * @public @memberof xrt_device
533  */
534 static inline xrt_result_t
536  enum xrt_input_name facial_expression_type,
537  struct xrt_facial_expression_set *out_value)
538 {
539  return xdev->get_face_tracking(xdev, facial_expression_type, out_value);
540 }
541 
542 /*!
543  * Helper function for @ref xrt_device::set_output.
544  *
545  * @copydoc xrt_device::set_output
546  *
547  * @public @memberof xrt_device
548  */
549 static inline void
551 {
552  xdev->set_output(xdev, name, value);
553 }
554 
555 /*!
556  * Helper function for @ref xrt_device::get_view_poses.
557  *
558  * @copydoc xrt_device::get_view_poses
559  * @public @memberof xrt_device
560  */
561 static inline void
563  const struct xrt_vec3 *default_eye_relation,
564  uint64_t at_timestamp_ns,
565  uint32_t view_count,
566  struct xrt_space_relation *out_head_relation,
567  struct xrt_fov *out_fovs,
568  struct xrt_pose *out_poses)
569 {
570  xdev->get_view_poses(xdev, default_eye_relation, at_timestamp_ns, view_count, out_head_relation, out_fovs,
571  out_poses);
572 }
573 
574 /*!
575  * Helper function for @ref xrt_device::compute_distortion.
576  *
577  * @copydoc xrt_device::compute_distortion
578  *
579  * @public @memberof xrt_device
580  */
581 static inline bool
583  struct xrt_device *xdev, uint32_t view, float u, float v, struct xrt_uv_triplet *out_result)
584 {
585  return xdev->compute_distortion(xdev, view, u, v, out_result);
586 }
587 
588 /*!
589  * Helper function for @ref xrt_device::get_visibility_mask.
590  *
591  * @copydoc xrt_device::get_visibility_mask
592  *
593  * @public @memberof xrt_device
594  */
595 static inline xrt_result_t
597  enum xrt_visibility_mask_type type,
598  uint32_t view_index,
599  struct xrt_visibility_mask **out_mask)
600 {
601  return xdev->get_visibility_mask(xdev, type, view_index, out_mask);
602 }
603 
604 /*!
605  * Helper function for @ref xrt_device::ref_space_usage.
606  *
607  * @copydoc xrt_device::ref_space_usage
608  *
609  * @public @memberof xrt_device
610  */
611 static inline xrt_result_t
613  enum xrt_reference_space_type type,
614  enum xrt_input_name name,
615  bool used)
616 {
617  return xdev->ref_space_usage(xdev, type, name, used);
618 }
619 
620 /*!
621  * Helper function for @ref xrt_device::is_form_factor_available.
622  *
623  * @copydoc xrt_device::is_form_factor_available
624  *
625  * @public @memberof xrt_device
626  */
627 static inline bool
629 {
630  return xdev->is_form_factor_available(xdev, form_factor);
631 }
632 
633 /*!
634  * Helper function for @ref xrt_device::destroy.
635  *
636  * Handles nulls, sets your pointer to null.
637  *
638  * @public @memberof xrt_device
639  */
640 static inline void
641 xrt_device_destroy(struct xrt_device **xdev_ptr)
642 {
643  struct xrt_device *xdev = *xdev_ptr;
644  if (xdev == NULL) {
645  return;
646  }
647 
648  xdev->destroy(xdev);
649  *xdev_ptr = NULL;
650 }
651 
652 
653 #ifdef __cplusplus
654 } // extern "C"
655 #endif
xrt_visibility_mask_type
Visibility mask, mirror of XrVisibilityMaskKHR.
Definition: xrt_defines.h:1541
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:1491
xrt_input_name
Every internal input source known to monado with a baked in type.
Definition: xrt_defines.h:1134
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:1388
xrt_device_type
How an xrt_device can be used.
Definition: xrt_defines.h:766
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
A single HMD or input device.
Definition: xrt_device.h:230
static void xrt_device_update_inputs(struct xrt_device *xdev)
Helper function for xrt_device::update_inputs.
Definition: xrt_device.h:489
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:456
xrt_result_t(* get_face_tracking)(struct xrt_device *xdev, enum xrt_input_name facial_expression_type, struct xrt_facial_expression_set *out_value)
Get the requested blend shape properties & weights for a face tracker.
Definition: xrt_device.h:353
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:365
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:612
char str[256]
A string describing the device.
Definition: xrt_device.h:236
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:437
struct xrt_hmd_parts * hmd
Null if this device does not interface with the users head.
Definition: xrt_device.h:242
char serial[256]
A unique identifier. Persistent across configurations, if possible.
Definition: xrt_device.h:239
void(* get_view_poses)(struct xrt_device *xdev, const struct xrt_vec3 *default_eye_relation, uint64_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:404
struct xrt_output * outputs
Array of output structs.
Definition: xrt_device.h:260
static void xrt_device_get_tracked_pose(struct xrt_device *xdev, enum xrt_input_name name, uint64_t at_timestamp_ns, struct xrt_space_relation *out_relation)
Helper function for xrt_device::get_tracked_pose.
Definition: xrt_device.h:502
size_t output_count
Number of outputs.
Definition: xrt_device.h:258
static void xrt_device_get_view_poses(struct xrt_device *xdev, const struct xrt_vec3 *default_eye_relation, uint64_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:562
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:471
struct xrt_input * inputs
Array of input structs.
Definition: xrt_device.h:255
size_t input_count
Number of inputs.
Definition: xrt_device.h:253
void(* destroy)(struct xrt_device *xdev)
Destroy device.
Definition: xrt_device.h:476
void(* get_tracked_pose)(struct xrt_device *xdev, enum xrt_input_name name, uint64_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:309
struct xrt_tracking_origin * tracking_origin
Always set, pointing to the tracking system for this device.
Definition: xrt_device.h:245
size_t binding_profile_count
Number of bindings in xrt_device::binding_profiles.
Definition: xrt_device.h:248
static xrt_result_t xrt_device_get_face_tracking(struct xrt_device *xdev, enum xrt_input_name facial_expression_type, struct xrt_facial_expression_set *out_value)
Helper function for xrt_device::get_face_tracking.
Definition: xrt_device.h:535
enum xrt_device_name name
Enum identifier of the device.
Definition: xrt_device.h:232
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:596
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:628
void(* update_inputs)(struct xrt_device *xdev)
Update any attached inputs.
Definition: xrt_device.h:283
static void xrt_device_destroy(struct xrt_device **xdev_ptr)
Helper function for xrt_device::destroy.
Definition: xrt_device.h:641
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:550
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:426
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:582
static void xrt_device_get_hand_tracking(struct xrt_device *xdev, enum xrt_input_name name, uint64_t desired_timestamp_ns, struct xrt_hand_joint_set *out_value, uint64_t *out_timestamp_ns)
Helper function for xrt_device::get_hand_tracking.
Definition: xrt_device.h:518
void(* get_hand_tracking)(struct xrt_device *xdev, enum xrt_input_name name, uint64_t desired_timestamp_ns, struct xrt_hand_joint_set *out_value, uint64_t *out_timestamp_ns)
Get relationship of hand joints to the tracking origin space as the base space.
Definition: xrt_device.h:337
Definition: xrt_defines.h:1373
Describes a projection matrix fov.
Definition: xrt_defines.h:486
Joint set type used for hand tracking.
Definition: xrt_defines.h:1233
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
struct xrt_hmd_parts::@230 screens[1]
The hmd screen as an unrotated display, like the HMD presents it to the OS.
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
struct xrt_hmd_parts::@231 distortion
Distortion information.
uint32_t index_count_total
Total number of elements in mesh::indices array.
Definition: xrt_device.h:147
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
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::@228 viewport
Viewport position on the screen.
struct xrt_view::@229 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:1249
A union of all output types.
Definition: xrt_defines.h:1463
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
Header for limits of the XRT interfaces.
Header defining visibility mask helper struct.