This commit is contained in:
Sapphire
2025-06-08 18:07:23 +02:00
committed by xytovl
parent 7b0cd08060
commit 2fc35832b9
3 changed files with 12 additions and 17 deletions
+5 -7
View File
@@ -67,9 +67,7 @@ void xr::fb_body_tracker::stop()
std::optional<std::array<wivrn::from_headset::body_tracking::pose, wivrn::from_headset::body_tracking::max_tracked_poses>> xr::fb_body_tracker::locate_spaces(XrTime time, XrSpace reference) std::optional<std::array<wivrn::from_headset::body_tracking::pose, wivrn::from_headset::body_tracking::max_tracked_poses>> xr::fb_body_tracker::locate_spaces(XrTime time, XrSpace reference)
{ {
if (!handle) if (!handle)
{
return std::nullopt; return std::nullopt;
}
assert(xrLocateBodyJointsFB); assert(xrLocateBodyJointsFB);
@@ -110,24 +108,24 @@ std::optional<std::array<wivrn::from_headset::body_tracking::pose, wivrn::from_h
if (!hip && joint == XR_FULL_BODY_JOINT_HIPS_META) if (!hip && joint == XR_FULL_BODY_JOINT_HIPS_META)
continue; continue;
auto joint_pose = joints[joint]; const auto & joint_loc = joints[joint];
wivrn::from_headset::body_tracking::pose pose{ wivrn::from_headset::body_tracking::pose pose{
.pose = joint_pose.pose, .pose = joint_loc.pose,
.flags = 0, .flags = 0,
}; };
if (joint_pose.locationFlags & XR_SPACE_LOCATION_ORIENTATION_VALID_BIT) if (joint_loc.locationFlags & XR_SPACE_LOCATION_ORIENTATION_VALID_BIT)
{ {
pose.flags |= wivrn::from_headset::body_tracking::orientation_valid; pose.flags |= wivrn::from_headset::body_tracking::orientation_valid;
pose.flags |= wivrn::from_headset::body_tracking::orientation_tracked; pose.flags |= wivrn::from_headset::body_tracking::orientation_tracked;
} }
if (joint_pose.locationFlags & XR_SPACE_LOCATION_POSITION_VALID_BIT) if (joint_loc.locationFlags & XR_SPACE_LOCATION_POSITION_VALID_BIT)
{ {
pose.flags |= wivrn::from_headset::body_tracking::position_valid; pose.flags |= wivrn::from_headset::body_tracking::position_valid;
pose.flags |= wivrn::from_headset::body_tracking::position_tracked; pose.flags |= wivrn::from_headset::body_tracking::position_tracked;
} }
poses[num_poses++] = std::move(pose); poses[num_poses++] = pose;
} }
return poses; return poses;
} }
+7 -9
View File
@@ -39,9 +39,7 @@ xr::pico_body_tracker::pico_body_tracker(instance & inst, XrBodyTrackerBD h)
std::optional<std::array<wivrn::from_headset::body_tracking::pose, wivrn::from_headset::body_tracking::max_tracked_poses>> xr::pico_body_tracker::locate_spaces(XrTime time, XrSpace reference) std::optional<std::array<wivrn::from_headset::body_tracking::pose, wivrn::from_headset::body_tracking::max_tracked_poses>> xr::pico_body_tracker::locate_spaces(XrTime time, XrSpace reference)
{ {
if (!xrLocateBodyJointsBD) if (!xrLocateBodyJointsBD)
{
return std::nullopt; return std::nullopt;
}
XrBodyJointsLocateInfoBD locate_info{ XrBodyJointsLocateInfoBD locate_info{
.type = XR_TYPE_BODY_JOINTS_LOCATE_INFO_BD, .type = XR_TYPE_BODY_JOINTS_LOCATE_INFO_BD,
@@ -67,22 +65,22 @@ std::optional<std::array<wivrn::from_headset::body_tracking::pose, wivrn::from_h
std::array<wivrn::from_headset::body_tracking::pose, wivrn::from_headset::body_tracking::max_tracked_poses> poses{}; std::array<wivrn::from_headset::body_tracking::pose, wivrn::from_headset::body_tracking::max_tracked_poses> poses{};
for (int i = 0; i < joint_whitelist.size(); i++) for (int i = 0; i < joint_whitelist.size(); i++)
{ {
auto & joint_location = joints[joint_whitelist[i]]; const auto & joint_loc = joints[joint_whitelist[i]];
wivrn::from_headset::body_tracking::pose pose{ wivrn::from_headset::body_tracking::pose pose{
.pose = joint_location.pose, .pose = joint_loc.pose,
.flags = 0, .flags = 0,
}; };
if (joint_location.locationFlags & XR_SPACE_LOCATION_ORIENTATION_VALID_BIT) if (joint_loc.locationFlags & XR_SPACE_LOCATION_ORIENTATION_VALID_BIT)
pose.flags |= wivrn::from_headset::body_tracking::orientation_valid; pose.flags |= wivrn::from_headset::body_tracking::orientation_valid;
if (joint_location.locationFlags & XR_SPACE_LOCATION_POSITION_VALID_BIT) if (joint_loc.locationFlags & XR_SPACE_LOCATION_POSITION_VALID_BIT)
pose.flags |= wivrn::from_headset::body_tracking::position_valid; pose.flags |= wivrn::from_headset::body_tracking::position_valid;
if (joint_location.locationFlags & XR_SPACE_LOCATION_ORIENTATION_TRACKED_BIT) if (joint_loc.locationFlags & XR_SPACE_LOCATION_ORIENTATION_TRACKED_BIT)
pose.flags |= wivrn::from_headset::body_tracking::orientation_tracked; pose.flags |= wivrn::from_headset::body_tracking::orientation_tracked;
if (joint_location.locationFlags & XR_SPACE_LOCATION_POSITION_TRACKED_BIT) if (joint_loc.locationFlags & XR_SPACE_LOCATION_POSITION_TRACKED_BIT)
pose.flags |= wivrn::from_headset::body_tracking::position_tracked; pose.flags |= wivrn::from_headset::body_tracking::position_tracked;
poses[i] = std::move(pose); poses[i] = pose;
} }
return poses; return poses;
} }
-1
View File
@@ -28,7 +28,6 @@
namespace xr namespace xr
{ {
class instance; class instance;
class session;
XrResult destroy_pico_body_tracker(XrBodyTrackerBD); XrResult destroy_pico_body_tracker(XrBodyTrackerBD);