From 6a4043fd3803cbff91f3cf4b2d08c518fd0a2317 Mon Sep 17 00:00:00 2001 From: galister <22305755+galister@users.noreply.github.com> Date: Tue, 4 Jun 2024 22:50:42 +0900 Subject: [PATCH] feat: stage_supported --- server/driver/wivrn_controller.cpp | 6 ++++++ server/driver/wivrn_hmd.cpp | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/server/driver/wivrn_controller.cpp b/server/driver/wivrn_controller.cpp index ad5f0091..858b0501 100644 --- a/server/driver/wivrn_controller.cpp +++ b/server/driver/wivrn_controller.cpp @@ -169,6 +169,7 @@ wivrn_controller::wivrn_controller(int hand_id, base->orientation_tracking_supported = true; base->hand_tracking_supported = true; base->position_tracking_supported = true; + base->stage_supported = true; base->tracking_origin = hmd->tracking_origin; @@ -313,6 +314,11 @@ xrt_space_relation wivrn_controller::get_tracked_pose(xrt_input_name name, uint6 xrt_space_relation res; switch (name) { + 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). + res = (struct xrt_space_relation)XRT_SPACE_RELATION_ZERO; + res.relation_flags = XRT_SPACE_RELATION_BITMASK_ALL; + return res; case XRT_INPUT_TOUCH_AIM_POSE: std::tie(extrapolation_time, res) = aim.get_at(at_timestamp_ns); break; diff --git a/server/driver/wivrn_hmd.cpp b/server/driver/wivrn_hmd.cpp index 853594d1..da0a5244 100644 --- a/server/driver/wivrn_hmd.cpp +++ b/server/driver/wivrn_hmd.cpp @@ -186,6 +186,7 @@ wivrn_hmd::wivrn_hmd(std::shared_ptr cnx, base->hmd = &hmd_parts; base->tracking_origin = &tracking_origin; + base->stage_supported = true; tracking_origin.type = XRT_TRACKING_TYPE_OTHER; tracking_origin.offset.orientation = xrt_quat{0, 0, 0, 1}; strcpy(tracking_origin.name, "No tracking"); @@ -247,6 +248,13 @@ void wivrn_hmd::update_inputs() xrt_space_relation wivrn_hmd::get_tracked_pose(xrt_input_name name, uint64_t at_timestamp_ns) { + 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). + xrt_space_relation relation = (struct xrt_space_relation)XRT_SPACE_RELATION_ZERO; + relation.relation_flags = XRT_SPACE_RELATION_BITMASK_ALL; + return relation; + } if (name != XRT_INPUT_GENERIC_HEAD_POSE) { U_LOG_E("Unknown input name");