mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-19 13:18:32 +00:00
xrt: Move tracking origin setup code to u_device
This commit is contained in:
parent
c60b7412e5
commit
9d894ab5ff
|
@ -359,3 +359,30 @@ u_device_assign_xdev_roles(struct xrt_device **xdevs,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
u_device_setup_tracking_origins(struct xrt_device *head,
|
||||
struct xrt_device *left,
|
||||
struct xrt_device *right)
|
||||
{
|
||||
if (head->tracking_origin->type == XRT_TRACKING_TYPE_NONE) {
|
||||
// "nominal height" 1.6m
|
||||
head->tracking_origin->offset.position.x = 0.0f;
|
||||
head->tracking_origin->offset.position.y = 1.6f;
|
||||
head->tracking_origin->offset.position.z = 0.0f;
|
||||
}
|
||||
|
||||
if (left != NULL &&
|
||||
left->tracking_origin->type == XRT_TRACKING_TYPE_NONE) {
|
||||
left->tracking_origin->offset.position.x = -0.2f;
|
||||
left->tracking_origin->offset.position.y = 1.3f;
|
||||
left->tracking_origin->offset.position.z = -0.5f;
|
||||
}
|
||||
|
||||
if (right != NULL &&
|
||||
right->tracking_origin->type == XRT_TRACKING_TYPE_NONE) {
|
||||
right->tracking_origin->offset.position.x = 0.2f;
|
||||
right->tracking_origin->offset.position.y = 1.3f;
|
||||
right->tracking_origin->offset.position.z = -0.5f;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -112,6 +112,16 @@ u_device_assign_xdev_roles(struct xrt_device **xdevs,
|
|||
int *left,
|
||||
int *right);
|
||||
|
||||
/*!
|
||||
* Helper function to assign head, left hand and right hand roles.
|
||||
*
|
||||
* @ingroup aux_util
|
||||
*/
|
||||
void
|
||||
u_device_setup_tracking_origins(struct xrt_device *head,
|
||||
struct xrt_device *left,
|
||||
struct xrt_device *right);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -255,6 +255,9 @@ oxr_instance_create(struct oxr_logger *log,
|
|||
return ret;
|
||||
}
|
||||
|
||||
u_device_setup_tracking_origins(dev, GET_XDEV_BY_ROLE(sys, left),
|
||||
GET_XDEV_BY_ROLE(sys, right));
|
||||
|
||||
const float left_override = debug_get_float_option_lfov_left();
|
||||
if (left_override != 0.0f) {
|
||||
printf(
|
||||
|
|
|
@ -102,36 +102,6 @@ oxr_system_fill_in(struct oxr_logger *log,
|
|||
XrSystemId systemId,
|
||||
struct oxr_system *sys)
|
||||
{
|
||||
struct xrt_device *head = GET_XDEV_BY_ROLE(sys, head);
|
||||
struct xrt_device *left = GET_XDEV_BY_ROLE(sys, left);
|
||||
struct xrt_device *right = GET_XDEV_BY_ROLE(sys, right);
|
||||
|
||||
if (head == NULL) {
|
||||
return oxr_error(log, XR_ERROR_INITIALIZATION_FAILED,
|
||||
"Failed to probe device");
|
||||
}
|
||||
|
||||
if (head->tracking_origin->type == XRT_TRACKING_TYPE_NONE) {
|
||||
// "nominal height" 1.6m
|
||||
head->tracking_origin->offset.position.x = 0.0f;
|
||||
head->tracking_origin->offset.position.y = 1.6f;
|
||||
head->tracking_origin->offset.position.z = 0.0f;
|
||||
}
|
||||
|
||||
if (left != NULL &&
|
||||
left->tracking_origin->type == XRT_TRACKING_TYPE_NONE) {
|
||||
left->tracking_origin->offset.position.x = -0.2f;
|
||||
left->tracking_origin->offset.position.y = 1.3f;
|
||||
left->tracking_origin->offset.position.z = -0.5f;
|
||||
}
|
||||
|
||||
if (right != NULL &&
|
||||
right->tracking_origin->type == XRT_TRACKING_TYPE_NONE) {
|
||||
right->tracking_origin->offset.position.x = 0.2f;
|
||||
right->tracking_origin->offset.position.y = 1.3f;
|
||||
right->tracking_origin->offset.position.z = -0.5f;
|
||||
}
|
||||
|
||||
//! @todo handle other subaction paths?
|
||||
|
||||
sys->inst = inst;
|
||||
|
@ -189,6 +159,8 @@ oxr_system_fill_in(struct oxr_logger *log,
|
|||
sys->views[1].maxSwapchainSampleCount = info->views[1].max.sample_count;
|
||||
// clang-format on
|
||||
|
||||
struct xrt_device *head = GET_XDEV_BY_ROLE(sys, head);
|
||||
|
||||
uint32_t i = 0;
|
||||
if (head->hmd->blend_mode & XRT_BLEND_MODE_OPAQUE) {
|
||||
sys->blend_modes[i++] = XR_ENVIRONMENT_BLEND_MODE_OPAQUE;
|
||||
|
|
Loading…
Reference in a new issue