xrt: Add function to request recentering of local spaces

This commit is contained in:
Jakob Bornecrantz 2023-11-23 18:41:17 +00:00
parent 65f1078950
commit 9b5cfadc64
2 changed files with 29 additions and 1 deletions
src/xrt/include/xrt

View file

@ -1,4 +1,4 @@
// Copyright 2020-2022, Collabora, Ltd.
// Copyright 2020-2023, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
/*!
* @file
@ -158,4 +158,9 @@ typedef enum xrt_result
* Some D3D12 error
*/
XRT_ERROR_D3D12 = -25,
/*!
* The @ref xrt_space_overseer doesn't support recentering driven from
* the application side of things.
*/
XRT_ERROR_RECENTERING_NOT_SUPPORTED = -26,
} xrt_result_t;

View file

@ -235,6 +235,16 @@ struct xrt_space_overseer
*/
xrt_result_t (*ref_space_dec)(struct xrt_space_overseer *xso, enum xrt_reference_space_type type);
/*!
* Trigger a re-center of the local and local_floor spaces, not all
* implementations of @ref xrt_space_overseer may support recenter. The
* recenter operation will normally mean that the local and local_floor
* will move to the where the view space currently is.
*
* @param[in] xso The space overseer.
*/
xrt_result_t (*recenter_local_spaces)(struct xrt_space_overseer *xso);
/*!
* Destroy function.
*
@ -338,6 +348,19 @@ xrt_space_overseer_ref_space_dec(struct xrt_space_overseer *xso, enum xrt_refere
return xso->ref_space_dec(xso, type);
}
/*!
* @copydoc xrt_space_overseer::recenter_local_spaces
*
* Helper for calling through the function pointer.
*
* @public @memberof xrt_space_overseer
*/
static inline xrt_result_t
xrt_space_overseer_recenter_local_spaces(struct xrt_space_overseer *xso)
{
return xso->recenter_local_spaces(xso);
}
/*!
* Helper for calling through the function pointer: does a null check and sets
* xc_ptr to null if freed.