From f533d737b959b0589b250be04cda8224aca47708 Mon Sep 17 00:00:00 2001 From: Ryan Pavlik Date: Fri, 5 Apr 2019 17:28:36 -0500 Subject: [PATCH] st/oxr: Improve action space stubs. --- src/xrt/state_trackers/oxr/oxr_api_space.c | 12 ++++++++++-- src/xrt/state_trackers/oxr/oxr_space.c | 21 +++++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/src/xrt/state_trackers/oxr/oxr_api_space.c b/src/xrt/state_trackers/oxr/oxr_api_space.c index 3ad9fbd21..66b8fb293 100644 --- a/src/xrt/state_trackers/oxr/oxr_api_space.c +++ b/src/xrt/state_trackers/oxr/oxr_api_space.c @@ -35,8 +35,16 @@ oxr_xrCreateActionSpace(XrAction action, OXR_VERIFY_ARG_TYPE_AND_NULL(&log, createInfo, XR_TYPE_ACTION_SPACE_CREATE_INFO); - //! @todo Implement - return oxr_error(&log, XR_ERROR_HANDLE_INVALID, " not implemented"); + + struct oxr_space* spc; + XrResult ret = oxr_space_action_create(&log, act, createInfo, &spc); + if (ret != XR_SUCCESS) { + return ret; + } + + *space = oxr_space_to_openxr(spc); + + return XR_SUCCESS; } static const XrReferenceSpaceType session_spaces[] = { diff --git a/src/xrt/state_trackers/oxr/oxr_space.c b/src/xrt/state_trackers/oxr/oxr_space.c index ca40a4bb1..c4ff51065 100644 --- a/src/xrt/state_trackers/oxr/oxr_space.c +++ b/src/xrt/state_trackers/oxr/oxr_space.c @@ -52,6 +52,27 @@ oxr_space_destroy(struct oxr_logger *log, struct oxr_handle_base *hb) return XR_SUCCESS; } +XrResult +oxr_space_action_create(struct oxr_logger *log, + struct oxr_action *act, + const XrActionSpaceCreateInfo *createInfo, + struct oxr_space **out_space) +{ + struct oxr_space *spc = NULL; + OXR_ALLOCATE_HANDLE_OR_RETURN(log, spc, OXR_XR_DEBUG_SPACE, + oxr_space_destroy, &act->handle); + + //! @todo implement more fully + oxr_warn(log, " not fully implemented"); + + spc->is_reference = false; + memcpy(&spc->pose, &createInfo->poseInActionSpace, sizeof(spc->pose)); + + *out_space = spc; + + return XR_SUCCESS; +} + XrResult oxr_space_reference_create(struct oxr_logger *log, struct oxr_session *sess,