diff --git a/src/xrt/drivers/remote/r_hmd.c b/src/xrt/drivers/remote/r_hmd.c index df4a7e1df..7c1db75d5 100644 --- a/src/xrt/drivers/remote/r_hmd.c +++ b/src/xrt/drivers/remote/r_hmd.c @@ -64,12 +64,15 @@ r_hmd_get_tracked_pose(struct xrt_device *xdev, { struct r_hmd *rh = r_hmd(xdev); - if (name != XRT_INPUT_GENERIC_HEAD_POSE) { - U_LOG_E("Unknown input name"); - return; + switch (name) { + case XRT_INPUT_GENERIC_HEAD_POSE: copy_head_center_to_relation(rh, out_relation); break; + case XRT_INPUT_GENERIC_STAGE_SPACE_POSE: + // STAGE is implicitly defined as the space poses are returned in, therefore STAGE origin is (0, 0, 0). + *out_relation = (struct xrt_space_relation)XRT_SPACE_RELATION_ZERO; + out_relation->relation_flags = XRT_SPACE_RELATION_BITMASK_ALL; + break; + default: U_LOG_E("Unknown input name"); break; } - - copy_head_center_to_relation(rh, out_relation); } static void @@ -151,6 +154,7 @@ r_hmd_create(struct r_hub *r) rh->base.orientation_tracking_supported = true; rh->base.position_tracking_supported = true; rh->base.hand_tracking_supported = false; + rh->base.stage_supported = true; rh->base.name = XRT_DEVICE_GENERIC_HMD; rh->base.device_type = XRT_DEVICE_TYPE_HMD; rh->base.inputs[0].name = XRT_INPUT_GENERIC_HEAD_POSE; diff --git a/src/xrt/drivers/steamvr_lh/device.cpp b/src/xrt/drivers/steamvr_lh/device.cpp index 252d572ea..d01edfc69 100644 --- a/src/xrt/drivers/steamvr_lh/device.cpp +++ b/src/xrt/drivers/steamvr_lh/device.cpp @@ -184,6 +184,7 @@ HmdDevice::HmdDevice(const DeviceBuilder &builder) : Device(builder) this->name = XRT_DEVICE_GENERIC_HMD; this->device_type = XRT_DEVICE_TYPE_HMD; this->container_handle = 0; + this->stage_supported = true; #define SETUP_MEMBER_FUNC(name) this->xrt_device::name = &device_bouncer SETUP_MEMBER_FUNC(get_view_poses); @@ -433,7 +434,15 @@ Device::get_pose(uint64_t at_timestamp_ns, xrt_space_relation *out_relation) void HmdDevice::get_tracked_pose(xrt_input_name name, uint64_t at_timestamp_ns, xrt_space_relation *out_relation) { - Device::get_pose(at_timestamp_ns, out_relation); + switch (name) { + case XRT_INPUT_GENERIC_HEAD_POSE: Device::get_pose(at_timestamp_ns, out_relation); break; + case XRT_INPUT_GENERIC_STAGE_SPACE_POSE: + // STAGE is implicitly defined as the space poses are returned in, therefore STAGE origin is (0, 0, 0). + *out_relation = XRT_SPACE_RELATION_ZERO; + out_relation->relation_flags = XRT_SPACE_RELATION_BITMASK_ALL; + break; + default: U_LOG_W("steamvr_lh hmd: Requested pose for unknown name %u", name); break; + } } void diff --git a/src/xrt/drivers/survive/survive_driver.c b/src/xrt/drivers/survive/survive_driver.c index 86e815073..1d51413d4 100644 --- a/src/xrt/drivers/survive/survive_driver.c +++ b/src/xrt/drivers/survive/survive_driver.c @@ -316,7 +316,7 @@ verify_device_name(struct survive_device *survive, enum xrt_input_name name) { switch (survive->device_type) { - case DEVICE_TYPE_HMD: return name == XRT_INPUT_GENERIC_HEAD_POSE; + case DEVICE_TYPE_HMD: return name == XRT_INPUT_GENERIC_HEAD_POSE || name == XRT_INPUT_GENERIC_STAGE_SPACE_POSE; case DEVICE_TYPE_CONTROLLER: return name == XRT_INPUT_INDEX_AIM_POSE || name == XRT_INPUT_INDEX_GRIP_POSE || name == XRT_INPUT_VIVE_AIM_POSE || name == XRT_INPUT_VIVE_GRIP_POSE || @@ -337,6 +337,13 @@ survive_device_get_tracked_pose(struct xrt_device *xdev, return; } + if (name == XRT_INPUT_GENERIC_STAGE_SPACE_POSE) { + // STAGE is implicitly defined as the space poses are returned in, therefore STAGE origin is (0, 0, 0). + *out_relation = (struct xrt_space_relation)XRT_SPACE_RELATION_ZERO; + out_relation->relation_flags = XRT_SPACE_RELATION_BITMASK_ALL; + return; + } + if (!survive->survive_obj) { // U_LOG_D("Obj not set for %p", (void*)survive); return; @@ -970,6 +977,7 @@ _create_hmd_device(struct survive_system *sys, const struct SurviveSimpleObject survive->base.orientation_tracking_supported = true; survive->base.position_tracking_supported = true; survive->base.device_type = XRT_DEVICE_TYPE_HMD; + survive->base.stage_supported = true; survive->base.inputs[0].name = XRT_INPUT_GENERIC_HEAD_POSE;