Forward body skeletons from headset

This commit is contained in:
Sapphire
2026-07-10 13:22:05 -05:00
parent 41c2c0b727
commit 2e28b0a4ad
28 changed files with 858 additions and 236 deletions
+97 -4
View File
@@ -253,7 +253,7 @@ struct visibility_mask_changed
uint8_t view_index;
};
enum face_type : uint8_t
enum class face_type : uint8_t
{
none,
android,
@@ -261,6 +261,15 @@ enum face_type : uint8_t
htc,
};
enum class body_type : uint8_t
{
none,
fb,
meta,
bd,
htc,
};
struct settings_changed
{
float preferred_refresh_rate;
@@ -300,6 +309,8 @@ struct headset_info_packet
bool user_presence;
bool passthrough;
face_type face_tracking;
body_type body_tracking;
// htc body only
uint32_t num_generic_trackers;
std::vector<video_codec> supported_codecs; // from preferred to least preferred
std::optional<uint8_t> bit_depth;
@@ -434,7 +445,86 @@ struct hand_tracking
std::optional<std::array<pose, XR_HAND_JOINT_COUNT_EXT>> joints;
};
struct body_tracking
struct meta_body
{
enum flags : uint8_t
{
orientation_valid = 1 << 0,
position_valid = 1 << 1,
orientation_tracked = 1 << 2,
position_tracked = 1 << 3,
};
struct pose
{
XrVector3f position;
packed_quaternion orientation;
uint8_t flags;
};
struct packed_pose
{
struct
{
int16_t x, y, z; // 10th of mm relative to root
} position;
packed_quaternion orientation;
uint8_t flags;
};
XrTime production_timestamp;
XrTime timestamp;
float confidence;
struct fb_joints
{
pose root;
// excluding root
std::array<packed_pose, XR_BODY_JOINT_COUNT_FB - 1> joints;
};
struct meta_joints
{
pose root;
// excluding root
std::array<packed_pose, XR_FULL_BODY_JOINT_COUNT_META - 1> joints;
};
std::variant<std::monostate, fb_joints, meta_joints> joints;
};
struct meta_body_skeleton
{
struct fb_skeleton
{
std::array<XrBodySkeletonJointFB, XR_BODY_JOINT_COUNT_FB> joints;
};
struct meta_skeleton
{
std::array<XrBodySkeletonJointFB, XR_FULL_BODY_JOINT_COUNT_META> joints;
};
std::variant<fb_skeleton, meta_skeleton> skeleton;
};
struct bd_body
{
enum flags : uint8_t
{
orientation_valid = 1 << 0,
position_valid = 1 << 1,
orientation_tracked = 1 << 2,
position_tracked = 1 << 3,
};
struct pose
{
XrVector3f position;
packed_quaternion orientation;
uint8_t flags;
};
bool all_tracked;
XrTime production_timestamp;
XrTime timestamp;
std::array<pose, XR_BODY_JOINT_COUNT_BD> joints;
};
struct htc_body
{
inline static const size_t max_tracked_poses = 16;
enum flags : uint8_t
@@ -453,7 +543,7 @@ struct body_tracking
XrTime production_timestamp;
XrTime timestamp;
std::optional<std::array<pose, max_tracked_poses>> poses;
std::array<pose, max_tracked_poses> poses;
};
struct inputs
@@ -607,7 +697,10 @@ using packets = std::variant<
tracking,
derived_pose,
hand_tracking,
body_tracking,
meta_body,
meta_body_skeleton,
bd_body,
htc_body,
inputs,
timesync_response,
battery,