Monado OpenXR Runtime
|
A single HMD or input device. More...
#include <xrt/xrt_device.h>
Data Fields | |
enum xrt_device_name | name |
Enum identifier of the device. More... | |
enum xrt_device_type | device_type |
char | str [256] |
A string describing the device. More... | |
char | serial [256] |
A unique identifier. Persistent across configurations, if possible. More... | |
struct xrt_hmd_parts * | hmd |
Null if this device does not interface with the users head. More... | |
struct xrt_tracking_origin * | tracking_origin |
Always set, pointing to the tracking system for this device. More... | |
size_t | binding_profile_count |
Number of bindings in xrt_device::binding_profiles. More... | |
struct xrt_binding_profile * | binding_profiles |
size_t | input_count |
Number of inputs. More... | |
struct xrt_input * | inputs |
Array of input structs. More... | |
size_t | output_count |
Number of outputs. More... | |
struct xrt_output * | outputs |
Array of output structs. More... | |
bool | orientation_tracking_supported |
bool | position_tracking_supported |
bool | hand_tracking_supported |
bool | eye_gaze_supported |
bool | force_feedback_supported |
bool | ref_space_usage_supported |
bool | form_factor_check_supported |
bool | stage_supported |
bool | face_tracking_supported |
bool | body_tracking_supported |
bool | battery_status_supported |
xrt_result_t(* | update_inputs )(struct xrt_device *xdev) |
Update any attached inputs. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
void(* | set_output )(struct xrt_device *xdev, enum xrt_output_name name, const union xrt_output_value *value) |
Set a output value. More... | |
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. More... | |
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. More... | |
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. More... | |
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 used, or when the last usage of the reference space stops. More... | |
bool(* | is_form_factor_available )(struct xrt_device *xdev, enum xrt_form_factor form_factor) |
Check if given form factor is available or not. More... | |
xrt_result_t(* | get_battery_status )(struct xrt_device *xdev, bool *out_present, bool *out_charging, float *out_charge) |
Get battery status information. More... | |
xrt_result_t(* | begin_feature )(struct xrt_device *xdev, enum xrt_device_feature_type type) |
Enable the feature for this device. More... | |
xrt_result_t(* | end_feature )(struct xrt_device *xdev, enum xrt_device_feature_type type) |
Disable the feature for this device. More... | |
void(* | destroy )(struct xrt_device *xdev) |
Destroy device. More... | |
Related Functions | |
(Note that these are not member functions.) | |
void | u_distortion_mesh_fill_in_compute (struct xrt_device *xdev) |
Given a xrt_device generates meshes by calling xdev->compute_distortion(), populates xdev->hmd_parts.distortion.mesh & xdev->hmd_parts.distortion.models . More... | |
void | u_distortion_mesh_fill_in_none (struct xrt_device *xdev) |
Given a xrt_device generates a no distortion mesh, populates xdev->hmd_parts.distortion.mesh & xdev->hmd_parts.distortion.models . More... | |
void | u_distortion_mesh_set_none (struct xrt_device *xdev) |
Given a xrt_device generates a no distortion mesh, also sets xdev->compute_distortion() and populates xdev->hmd_parts.distortion.mesh & xdev->hmd_parts.distortion.models . More... | |
A single HMD or input device.
|
inlinestatic |
Helper function for xrt_device::begin_feature.
Enable the feature for this device.
[in] | xdev | The device. |
[in] | type | The type of device feature. |
|
inlinestatic |
Helper function for xrt_device::compute_distortion.
Compute the distortion at a single point.
The input is u
v
in screen/output space (that is, predistorted), you are to compute and return the u,v coordinates to sample the render texture. The compositor will step through a range of u,v parameters to build the lookup (vertex attribute or distortion texture) used to pre-distort the image as required by the device's optics.
xdev | the device | |
view | the view index | |
u | horizontal texture coordinate | |
v | vertical texture coordinate | |
[out] | out_result | corresponding u,v pairs for all three color channels. |
References compute_distortion.
|
inlinestatic |
Helper function for xrt_device::destroy.
Handles nulls, sets your pointer to null.
References destroy.
Referenced by u_system_devices_close().
|
inlinestatic |
Helper function for xrt_device::end_feature.
Disable the feature for this device.
[in] | xdev | The device. |
[in] | type | The type of device feature. |
|
inlinestatic |
Helper function for xrt_device::get_battery_status.
Get battery status information.
[in] | xdev | The device. |
[out] | out_present | Whether battery status information exist for this device. |
[out] | out_charging | Whether the device's battery is being charged. |
[out] | out_charge | Battery charge as a value between 0 and 1. |
References get_battery_status.
|
inlinestatic |
Helper function for xrt_device::get_body_joints.
Get the joint locations for a body tracker.
[in] | xdev | The device. |
[in] | body_tracking_type | The body joint set type (XR_FB_body_tracking, XR_META_body_tracking_full_body, etc). |
[in] | desired_timestamp_ns | If the device can predict or has a history of locations, this is when the caller |
[in] | out_value | Set of body joint locations & properties. |
References get_body_joints.
|
inlinestatic |
Helper function for xrt_device::get_body_skeleton.
Get the body skeleton in T-pose, used to query the skeleton hierarchy, scale, proportions etc.
[in] | xdev | The device. |
[in] | body_tracking_type | The body joint set type (XR_FB_body_tracking, XR_META_body_tracking_full_body, etc). |
[in] | out_value | The body skeleton hierarchy/properties. |
References get_body_skeleton.
|
inlinestatic |
Helper function for xrt_device::get_face_tracking.
Get the requested blend shape properties & weights for a face tracker.
[in] | xdev | The device. |
[in] | facial_expression_type | The facial expression data type (XR_FB_face_tracking, XR_HTC_facial_tracking, etc). |
[in] | at_timestamp_ns | Timestamp to be optionally used for prediction/history. For OXR extensions that do not pass a timestamp, the current timestamp is used. |
[in] | out_value | Set of requested expression weights & blend shape properties. |
References get_face_tracking.
|
inlinestatic |
Helper function for xrt_device::get_hand_tracking.
Get relationship of hand joints to the tracking origin space as the base space.
It is the responsibility of the device driver to either do prediction or return joints from a previous time and write that time out to out_timestamp_ns
.
The timestamps are system monotonic timestamps, such as returned by os_monotonic_get_ns().
[in] | xdev | The device. |
[in] | name | Some devices may have multiple poses on them, select the one using this field. For hand tracking use XRT_INPUT_GENERIC_HAND_TRACKING_DEFAULT_SET . |
[in] | desired_timestamp_ns | If the device can predict or has a history of positions, this is when the caller wants the pose to be from. |
[out] | out_value | The hand joint data read from the device. |
[out] | out_timestamp_ns | The timestamp of the data being returned. |
References get_hand_tracking, and name.
Referenced by oxr_xdev_get_hand_tracking_at().
|
inlinestatic |
Helper function for xrt_device::get_tracked_pose.
Get relationship of a tracked device to the tracking origin space as the base space.
It is the responsibility of the device driver to do any prediction, there are helper functions available for this.
The timestamps are system monotonic timestamps, such as returned by os_monotonic_get_ns().
[in] | xdev | The device. |
[in] | name | Some devices may have multiple poses on them, select the one using this field. For HMDs use XRT_INPUT_GENERIC_HEAD_POSE . For Unbounded Reference Space you can use XRT_INPUT_GENERIC_UNBOUNDED_SPACE_POSE to get the origin of that space. |
[in] | at_timestamp_ns | If the device can predict or has a history of positions, this is when the caller wants the pose to be from. |
[out] | out_relation | The relation read from the device. |
References get_tracked_pose, and name.
Referenced by u_device_get_view_poses().
|
inlinestatic |
Helper function for xrt_device::get_view_poses.
Get the per-view pose in relation to the view space.
On most devices with coplanar displays and no built-in eye tracking or IPD sensing, this just calls a helper to process the provided eye relation, but this may also handle canted displays as well as eye tracking.
Incorporates a call to xrt_device::get_tracked_pose or a wrapper for it
[in] | xdev | The device. |
[in] | default_eye_relation | The interpupillary relation as a 3D position. Most simple stereo devices would just want to set out_pose->position.[x|y|z] = ipd.[x|y|z] / 2.0f and adjust for left vs right view. Not to be confused with IPD that is absolute distance, this is a full 3D translation If a device has a more accurate/dynamic way of knowing the eye relation, it may ignore this input. |
[in] | at_timestamp_ns | This is when the caller wants the poses and FOVs to be from. |
[in] | view_count | Number of views. |
[out] | out_head_relation | The head pose in the device tracking space. Combine with out_poses to get the views in device tracking space. |
[out] | out_fovs | An array (of size view_count ) to populate with the device-suggested fields of view. |
[out] | out_poses | An array (of size view_count ) to populate with view output poses in head space. When implementing, be sure to also set orientation: most likely identity orientation unless you have canted screens. (Caution: Even if you have eye tracking, you won't use eye orientation here!) |
References get_view_poses.
|
inlinestatic |
Helper function for xrt_device::get_visibility_mask.
Get the visibility mask for this device.
[in] | xdev | The device. |
[in] | type | The type of visibility mask. |
[in] | view_index | The index of the view to get the mask for. |
[out] | out_mask | Output mask, caller must free. |
|
inlinestatic |
Helper function for xrt_device::is_form_factor_available.
Check if given form factor is available or not.
This should only be used in HMD device, if the device driver supports form factor check.
[in] | xdev | The device. |
[in] | form_factor | Form factor to check. |
References is_form_factor_available.
|
inlinestatic |
Helper function for xrt_device::ref_space_usage.
Called by the xrt_space_overseer when a reference space that is implemented by this device is first used, or when the last usage of the reference space stops.
What is provided is both the xrt_reference_space_type that triggered the usage change and the xrt_input_name (if any) that is used to drive the space.
|
inlinestatic |
Helper function for xrt_device::set_output.
Set a output value.
[in] | xdev | The device. |
[in] | name | The output component name to set. |
[in] | value | The value to set the output to. |
References name, and set_output.
|
inlinestatic |
Helper function for xrt_device::update_inputs.
Update any attached inputs.
[in] | xdev | The device. |
References update_inputs.
xrt_result_t(* xrt_device::begin_feature) (struct xrt_device *xdev, enum xrt_device_feature_type type) |
Enable the feature for this device.
[in] | xdev | The device. |
[in] | type | The type of device feature. |
size_t xrt_device::binding_profile_count |
Number of bindings in xrt_device::binding_profiles.
bool(* xrt_device::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.
The input is u
v
in screen/output space (that is, predistorted), you are to compute and return the u,v coordinates to sample the render texture. The compositor will step through a range of u,v parameters to build the lookup (vertex attribute or distortion texture) used to pre-distort the image as required by the device's optics.
xdev | the device | |
view | the view index | |
u | horizontal texture coordinate | |
v | vertical texture coordinate | |
[out] | out_result | corresponding u,v pairs for all three color channels. |
Referenced by CDeviceDriver_Monado::ComputeDistortion(), and xrt_device_compute_distortion().
void(* xrt_device::destroy) (struct xrt_device *xdev) |
Destroy device.
Referenced by xrt_device_destroy().
xrt_result_t(* xrt_device::end_feature) (struct xrt_device *xdev, enum xrt_device_feature_type type) |
Disable the feature for this device.
[in] | xdev | The device. |
[in] | type | The type of device feature. |
xrt_result_t(* xrt_device::get_battery_status) (struct xrt_device *xdev, bool *out_present, bool *out_charging, float *out_charge) |
Get battery status information.
[in] | xdev | The device. |
[out] | out_present | Whether battery status information exist for this device. |
[out] | out_charging | Whether the device's battery is being charged. |
[out] | out_charge | Battery charge as a value between 0 and 1. |
Referenced by xrt_device_get_battery_status().
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) |
Get the joint locations for a body tracker.
[in] | xdev | The device. |
[in] | body_tracking_type | The body joint set type (XR_FB_body_tracking, XR_META_body_tracking_full_body, etc). |
[in] | desired_timestamp_ns | If the device can predict or has a history of locations, this is when the caller |
[in] | out_value | Set of body joint locations & properties. |
Referenced by xrt_device_get_body_joints().
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) |
Get the body skeleton in T-pose, used to query the skeleton hierarchy, scale, proportions etc.
[in] | xdev | The device. |
[in] | body_tracking_type | The body joint set type (XR_FB_body_tracking, XR_META_body_tracking_full_body, etc). |
[in] | out_value | The body skeleton hierarchy/properties. |
Referenced by xrt_device_get_body_skeleton().
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) |
Get the requested blend shape properties & weights for a face tracker.
[in] | xdev | The device. |
[in] | facial_expression_type | The facial expression data type (XR_FB_face_tracking, XR_HTC_facial_tracking, etc). |
[in] | at_timestamp_ns | Timestamp to be optionally used for prediction/history. For OXR extensions that do not pass a timestamp, the current timestamp is used. |
[in] | out_value | Set of requested expression weights & blend shape properties. |
Referenced by xrt_device_get_face_tracking().
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) |
Get relationship of hand joints to the tracking origin space as the base space.
It is the responsibility of the device driver to either do prediction or return joints from a previous time and write that time out to out_timestamp_ns
.
The timestamps are system monotonic timestamps, such as returned by os_monotonic_get_ns().
[in] | xdev | The device. |
[in] | name | Some devices may have multiple poses on them, select the one using this field. For hand tracking use XRT_INPUT_GENERIC_HAND_TRACKING_DEFAULT_SET . |
[in] | desired_timestamp_ns | If the device can predict or has a history of positions, this is when the caller wants the pose to be from. |
[out] | out_value | The hand joint data read from the device. |
[out] | out_timestamp_ns | The timestamp of the data being returned. |
Referenced by xrt_device_get_hand_tracking().
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) |
Get relationship of a tracked device to the tracking origin space as the base space.
It is the responsibility of the device driver to do any prediction, there are helper functions available for this.
The timestamps are system monotonic timestamps, such as returned by os_monotonic_get_ns().
[in] | xdev | The device. |
[in] | name | Some devices may have multiple poses on them, select the one using this field. For HMDs use XRT_INPUT_GENERIC_HEAD_POSE . For Unbounded Reference Space you can use XRT_INPUT_GENERIC_UNBOUNDED_SPACE_POSE to get the origin of that space. |
[in] | at_timestamp_ns | If the device can predict or has a history of positions, this is when the caller wants the pose to be from. |
[out] | out_relation | The relation read from the device. |
Referenced by multi_create_tracking_override(), and xrt_device_get_tracked_pose().
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) |
Get the per-view pose in relation to the view space.
On most devices with coplanar displays and no built-in eye tracking or IPD sensing, this just calls a helper to process the provided eye relation, but this may also handle canted displays as well as eye tracking.
Incorporates a call to xrt_device::get_tracked_pose or a wrapper for it
[in] | xdev | The device. |
[in] | default_eye_relation | The interpupillary relation as a 3D position. Most simple stereo devices would just want to set out_pose->position.[x|y|z] = ipd.[x|y|z] / 2.0f and adjust for left vs right view. Not to be confused with IPD that is absolute distance, this is a full 3D translation If a device has a more accurate/dynamic way of knowing the eye relation, it may ignore this input. |
[in] | at_timestamp_ns | This is when the caller wants the poses and FOVs to be from. |
[in] | view_count | Number of views. |
[out] | out_head_relation | The head pose in the device tracking space. Combine with out_poses to get the views in device tracking space. |
[out] | out_fovs | An array (of size view_count ) to populate with the device-suggested fields of view. |
[out] | out_poses | An array (of size view_count ) to populate with view output poses in head space. When implementing, be sure to also set orientation: most likely identity orientation unless you have canted screens. (Caution: Even if you have eye tracking, you won't use eye orientation here!) |
Referenced by xrt_device_get_view_poses().
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) |
Get the visibility mask for this device.
[in] | xdev | The device. |
[in] | type | The type of visibility mask. |
[in] | view_index | The index of the view to get the mask for. |
[out] | out_mask | Output mask, caller must free. |
struct xrt_hmd_parts* xrt_device::hmd |
Null if this device does not interface with the users head.
Referenced by CDeviceDriver_Monado::CDeviceDriver_Monado(), comp_settings_init(), CDeviceDriver_Monado::ComputeDistortion(), render_resources::render_resources_init(), sdl_device_init(), u_device_free(), u_device_get_view_poses(), u_device_setup_one_eye(), u_device_setup_split_side_by_side(), u_distortion_mesh_fill_in_none(), u_distortion_mesh_set_none(), and u_extents_2d_split_side_by_side().
size_t xrt_device::input_count |
Number of inputs.
Referenced by create_controller(), oxr_xdev_find_input(), sdl_device_init(), and u_system_devices_get_ht_device().
struct xrt_input* xrt_device::inputs |
Array of input structs.
Referenced by oxr_xdev_find_input(), sdl_device_init(), and u_system_devices_get_ht_device().
bool(* xrt_device::is_form_factor_available) (struct xrt_device *xdev, enum xrt_form_factor form_factor) |
Check if given form factor is available or not.
This should only be used in HMD device, if the device driver supports form factor check.
[in] | xdev | The device. |
[in] | form_factor | Form factor to check. |
Referenced by xrt_device_is_form_factor_available().
enum xrt_device_name xrt_device::name |
Enum identifier of the device.
Referenced by ipcproto.common.Arg::__init__(), ipcproto.common.Call::__init__(), bindings.Profile::__init__(), ipcproto.common.Arg::dump(), ipcproto.common.Call::dump(), ipcproto.common.Arg::get_func_argument_in(), ipcproto.common.Arg::get_func_argument_out(), ipcproto.common.Arg::get_struct_field(), HmdDevice::get_tracked_pose(), CDeviceDriver_Monado_Controller::GetPose(), oxr_xdev_find_input(), oxr_xdev_find_output(), sdl_device_init(), survive_controller_get_hand_tracking(), ipcproto.common.Call::write_call_decl(), ipcproto.common.Call::write_handler_decl(), ipcproto.common.Call::write_receive_decl(), ipcproto.common.Call::write_send_decl(), xrt_device_get_hand_tracking(), xrt_device_get_tracked_pose(), and xrt_device_set_output().
size_t xrt_device::output_count |
Number of outputs.
Referenced by create_controller(), and oxr_xdev_find_output().
struct xrt_output* xrt_device::outputs |
Array of output structs.
Referenced by oxr_xdev_find_output().
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) |
Called by the xrt_space_overseer when a reference space that is implemented by this device is first used, or when the last usage of the reference space stops.
What is provided is both the xrt_reference_space_type that triggered the usage change and the xrt_input_name (if any) that is used to drive the space.
char xrt_device::serial[256] |
A unique identifier. Persistent across configurations, if possible.
void(* xrt_device::set_output) (struct xrt_device *xdev, enum xrt_output_name name, const union xrt_output_value *value) |
Set a output value.
[in] | xdev | The device. |
[in] | name | The output component name to set. |
[in] | value | The value to set the output to. |
Referenced by xrt_device_set_output().
char xrt_device::str[256] |
A string describing the device.
struct xrt_tracking_origin* xrt_device::tracking_origin |
Always set, pointing to the tracking system for this device.
Referenced by CDeviceDriver_Monado::GetPose(), multi_create_tracking_override(), sdl_device_init(), u_builder_setup_tracking_origins(), and u_space_overseer_legacy_setup().
xrt_result_t(* xrt_device::update_inputs) (struct xrt_device *xdev) |
Update any attached inputs.
[in] | xdev | The device. |
Implemented in Device.
Referenced by xrt_device_update_inputs().