Merge remote-tracking branch 'upstream/master'
This commit is contained in:
@@ -77,6 +77,7 @@ private:
|
||||
thread_safe<to_headset::tracking_control> tracking_control{};
|
||||
std::array<std::atomic<interaction_profile>, 2> interaction_profiles; // left and right hand
|
||||
std::atomic<bool> interaction_profile_changed = false;
|
||||
std::atomic<XrTime> scheduled_derived_pose = 0; // Tracking thread will compute derived pose when time is reached
|
||||
std::atomic<bool> recenter_requested = false;
|
||||
std::atomic<bool> hid_forwarding = false;
|
||||
std::atomic<XrDuration> display_time_phase = 0;
|
||||
@@ -235,6 +236,7 @@ private:
|
||||
void read_actions();
|
||||
|
||||
void on_interaction_profile_changed(const XrEventDataInteractionProfileChanged &);
|
||||
void send_derived_pose();
|
||||
|
||||
void setup(const to_headset::video_stream_description &);
|
||||
void setup_reprojection_swapchain(uint32_t width, uint32_t height);
|
||||
|
||||
@@ -622,6 +622,13 @@ void scenes::stream::tracking()
|
||||
}
|
||||
|
||||
network_session->send_stream(std::span(packets.data(), packet_count));
|
||||
|
||||
XrTime old = scheduled_derived_pose;
|
||||
if (old and now > old)
|
||||
{
|
||||
send_derived_pose();
|
||||
scheduled_derived_pose.compare_exchange_strong(old, 0);
|
||||
}
|
||||
}
|
||||
catch (std::exception & e)
|
||||
{
|
||||
@@ -721,6 +728,12 @@ void scenes::stream::on_interaction_profile_changed(const XrEventDataInteraction
|
||||
interaction_profiles[i] = interaction_profile::none;
|
||||
}
|
||||
|
||||
// Wait for runtime to know about the controllers before sending data
|
||||
scheduled_derived_pose = instance.now() + 1'000'000'000;
|
||||
}
|
||||
|
||||
void scenes::stream::send_derived_pose()
|
||||
{
|
||||
auto now = instance.now();
|
||||
for (device_id target: {
|
||||
device_id::LEFT_AIM,
|
||||
@@ -735,14 +748,8 @@ void scenes::stream::on_interaction_profile_changed(const XrEventDataInteraction
|
||||
{
|
||||
// don't do derived poses for hand interaction
|
||||
const bool right = (target >= device_id::RIGHT_GRIP && target <= device_id::RIGHT_PALM) || target == device_id::RIGHT_PINCH_POSE || target == device_id::RIGHT_POKE;
|
||||
if (interaction_profiles[right].load() == interaction_profile::ext_hand_interaction_ext)
|
||||
{
|
||||
network_session->send_control(from_headset::derived_pose{
|
||||
.source = target,
|
||||
.target = target,
|
||||
});
|
||||
if (interaction_profiles[right] == interaction_profile::ext_hand_interaction_ext)
|
||||
continue;
|
||||
}
|
||||
|
||||
auto source = derived_from(target);
|
||||
auto source_space = application::space(device_to_space(source));
|
||||
|
||||
@@ -107,7 +107,7 @@ std::pair<XrTime, XrTime> pose_list::get_bounds() const
|
||||
|
||||
void pose_list::update_tracking(const from_headset::tracking & tracking, const clock_offset & offset)
|
||||
{
|
||||
if (source)
|
||||
if (source or not offset)
|
||||
return;
|
||||
|
||||
for (const auto & pose: tracking.device_poses)
|
||||
|
||||
@@ -616,10 +616,7 @@ void wivrn_session::operator()(from_headset::override_foveation_center && foveat
|
||||
void wivrn_session::operator()(from_headset::derived_pose && derived)
|
||||
{
|
||||
left_controller.set_derived_pose(derived);
|
||||
left_hand_interaction.set_derived_pose(derived);
|
||||
|
||||
right_controller.set_derived_pose(derived);
|
||||
right_hand_interaction.set_derived_pose(derived);
|
||||
}
|
||||
|
||||
void wivrn_session::operator()(from_headset::hand_tracking && hand_tracking)
|
||||
|
||||
Reference in New Issue
Block a user