Forward body skeletons from headset
This commit is contained in:
@@ -859,14 +859,14 @@ void scenes::lobby::gui_settings()
|
||||
}
|
||||
else
|
||||
{
|
||||
if (body_tracker == xr::body_tracker_type::fb)
|
||||
if (body_tracker == xr::body_tracker_type::fb or body_tracker == xr::body_tracker_type::meta)
|
||||
imgui_ctx->tooltip(_("Requires 'Hand and body tracking' to be enabled in the Quest movement tracking settings,\notherwise body data will be guessed from controller and headset positions"));
|
||||
}
|
||||
}
|
||||
|
||||
imgui_ctx->vibrate_on_hover();
|
||||
|
||||
if (body_tracker == xr::body_tracker_type::fb)
|
||||
if (body_tracker == xr::body_tracker_type::meta)
|
||||
{
|
||||
ImGui::BeginDisabled(not config.check_feature(feature::body_tracking));
|
||||
ImGui::Indent();
|
||||
@@ -878,16 +878,6 @@ void scenes::lobby::gui_settings()
|
||||
if (ImGui::IsItemHovered())
|
||||
imgui_ctx->tooltip(_("Estimate lower body joint positions using Generative Legs\nRequires 'Hand and body tracking' to be enabled in the Quest movement tracking settings"));
|
||||
|
||||
ImGui::BeginDisabled(not config.fb_lower_body);
|
||||
if (ImGui::Checkbox(_S("Enable hip tracking"), &config.fb_hip))
|
||||
{
|
||||
config.save();
|
||||
}
|
||||
imgui_ctx->vibrate_on_hover();
|
||||
if (ImGui::IsItemHovered())
|
||||
imgui_ctx->tooltip(_("Only takes affect with lower body tracking enabled\nMay be desired when using another source of hip tracking"));
|
||||
ImGui::EndDisabled();
|
||||
|
||||
ImGui::Unindent();
|
||||
ImGui::EndDisabled();
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "xr/face_tracker.h"
|
||||
#include "xr/fb_face_tracker2.h"
|
||||
#include "xr/space.h"
|
||||
#include "xr/system.h"
|
||||
#include <glm/gtc/matrix_access.hpp>
|
||||
#include <glm/gtc/quaternion.hpp>
|
||||
#include <magic_enum.hpp>
|
||||
@@ -295,21 +296,25 @@ std::shared_ptr<scenes::stream> scenes::stream::create(std::unique_ptr<wivrn_ses
|
||||
}
|
||||
}
|
||||
|
||||
info.num_generic_trackers = 0;
|
||||
if (config.check_feature(feature::body_tracking))
|
||||
{
|
||||
switch (self->system.body_tracker_supported())
|
||||
{
|
||||
case xr::body_tracker_type::none:
|
||||
info.body_tracking = from_headset::body_type::none;
|
||||
break;
|
||||
case xr::body_tracker_type::fb:
|
||||
info.num_generic_trackers = xr::fb_body_tracker::get_whitelisted_joints(config.fb_lower_body, config.fb_hip).size();
|
||||
info.body_tracking = from_headset::body_type::fb;
|
||||
break;
|
||||
case xr::body_tracker_type::htc:
|
||||
info.num_generic_trackers = application::get_generic_trackers().size();
|
||||
case xr::body_tracker_type::meta:
|
||||
info.body_tracking = config.fb_lower_body ? from_headset::body_type::meta : from_headset::body_type::fb;
|
||||
break;
|
||||
case xr::body_tracker_type::pico:
|
||||
info.num_generic_trackers = xr::pico_body_tracker::joint_whitelist.size();
|
||||
info.body_tracking = from_headset::body_type::bd;
|
||||
break;
|
||||
case xr::body_tracker_type::htc:
|
||||
info.body_tracking = from_headset::body_type::htc;
|
||||
info.num_generic_trackers = application::get_generic_trackers().size();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -316,7 +316,7 @@ void scenes::stream::tracking()
|
||||
XrTime t0 = instance.now();
|
||||
from_headset::tracking tracking;
|
||||
std::vector<from_headset::hand_tracking> hands;
|
||||
std::vector<from_headset::body_tracking> body;
|
||||
std::vector<std::variant<from_headset::meta_body, from_headset::bd_body, from_headset::htc_body>> body;
|
||||
std::vector<XrView> views;
|
||||
|
||||
std::vector<serialization_packet> packets;
|
||||
@@ -406,8 +406,7 @@ void scenes::stream::tracking()
|
||||
system,
|
||||
session,
|
||||
application::get_generic_trackers(),
|
||||
config.fb_lower_body,
|
||||
config.fb_hip);
|
||||
config.fb_lower_body);
|
||||
}
|
||||
else
|
||||
body_tracker.emplace<std::monostate>();
|
||||
@@ -554,11 +553,10 @@ void scenes::stream::tracking()
|
||||
std::visit(utils::overloaded{
|
||||
[](std::monostate &) {},
|
||||
[&](auto & b) {
|
||||
body.push_back(from_headset::body_tracking{
|
||||
.production_timestamp = tracking.production_timestamp,
|
||||
.timestamp = at_time,
|
||||
.poses = b.locate_spaces(at_time, world_space),
|
||||
});
|
||||
auto packet = b.locate_spaces(at_time, world_space);
|
||||
packet.timestamp = at_time;
|
||||
packet.production_timestamp = tracking.production_timestamp;
|
||||
body.push_back(packet);
|
||||
},
|
||||
},
|
||||
body_tracker);
|
||||
@@ -591,6 +589,18 @@ void scenes::stream::tracking()
|
||||
}
|
||||
#endif
|
||||
|
||||
if (auto fb = std::get_if<xr::fb_body_tracker>(&body_tracker); fb and fb->should_send_skeleton())
|
||||
{
|
||||
try
|
||||
{
|
||||
network_session->send_control(fb->get_skeleton());
|
||||
}
|
||||
catch (std::exception & e)
|
||||
{
|
||||
spdlog::warn("Failed to send body skeleton: {}", e.what());
|
||||
}
|
||||
}
|
||||
|
||||
packets.resize(std::max(packets.size(), 1 + hands.size() + body.size()));
|
||||
size_t packet_count = 0;
|
||||
|
||||
@@ -609,12 +619,14 @@ void scenes::stream::tracking()
|
||||
}
|
||||
for (const auto & i: body)
|
||||
{
|
||||
if (i.poses)
|
||||
{
|
||||
auto & packet = packets[packet_count++];
|
||||
packet.clear();
|
||||
wivrn_session::stream_socket_t::serialize(packet, i);
|
||||
}
|
||||
auto & packet = packets[packet_count++];
|
||||
packet.clear();
|
||||
std::visit(utils::overloaded{
|
||||
[&](auto & p) {
|
||||
wivrn_session::stream_socket_t::serialize(packet, p);
|
||||
},
|
||||
},
|
||||
i);
|
||||
}
|
||||
|
||||
network_session->send_stream(std::span(packets.data(), packet_count));
|
||||
|
||||
Reference in New Issue
Block a user