client: support XR_META_foveation_eye_tracked (#1123)
This commit is contained in:
+81
-60
@@ -40,6 +40,7 @@
|
||||
#include "utils/ranges.h"
|
||||
#include "wivrn_packets.h"
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <mutex>
|
||||
#include <ranges>
|
||||
#include <thread>
|
||||
@@ -200,7 +201,8 @@ static const std::array supported_depth_formats{
|
||||
|
||||
scenes::stream::stream(std::string server_name, scene & parent_scene) :
|
||||
scene_impl<stream>(supported_color_formats, supported_depth_formats, parent_scene),
|
||||
apps{*this, std::move(server_name)}
|
||||
apps{*this, std::move(server_name)},
|
||||
foveation_center{instance, system, session, device, commandpool, queue, swapchain_format}
|
||||
{
|
||||
auto views = system.view_configuration_views(viewconfig);
|
||||
width = views[0].recommendedImageRectWidth;
|
||||
@@ -387,20 +389,6 @@ std::shared_ptr<scenes::stream> scenes::stream::create(std::unique_ptr<wivrn_ses
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
const auto & config = application::get_config();
|
||||
self->override_foveation_enable = config.override_foveation_enable;
|
||||
self->override_foveation_pitch = config.override_foveation_pitch;
|
||||
self->override_foveation_distance = config.override_foveation_distance;
|
||||
|
||||
if (self->override_foveation_enable)
|
||||
self->network_session->send_control(from_headset::override_foveation_center{
|
||||
.enabled = self->override_foveation_enable,
|
||||
.pitch = self->override_foveation_pitch,
|
||||
.distance = self->override_foveation_distance,
|
||||
});
|
||||
}
|
||||
|
||||
self->network_thread = utils::named_thread("network_thread", &stream::process_packets, self.get());
|
||||
|
||||
self->command_buffer = std::move(self->device.allocateCommandBuffers({
|
||||
@@ -892,6 +880,33 @@ void scenes::stream::render(const XrFrameState & frame_state)
|
||||
}
|
||||
}
|
||||
|
||||
// Search for frame with desired display time on all decoders
|
||||
// If no such frame exists, use the latest frame for each decoder
|
||||
current_blit_handles = common_frame(frame_state.predictedDisplayTime);
|
||||
std::array<XrPosef, view_count> pose;
|
||||
std::array<XrFovf, view_count> fov{};
|
||||
std::array<bool, view_count> valid_fov{};
|
||||
std::array<wivrn::to_headset::foveation_parameter, view_count> foveation;
|
||||
std::array<XrExtent2Di, view_count> extents;
|
||||
int32_t max_width = 0;
|
||||
int32_t max_height = 0;
|
||||
for (size_t i = 0; i < view_count; ++i)
|
||||
{
|
||||
auto & blit_handle = current_blit_handles[i];
|
||||
if (!blit_handle)
|
||||
continue;
|
||||
|
||||
fov[i] = blit_handle->view_info.fov[i];
|
||||
valid_fov[i] = true;
|
||||
foveation[i] = blit_handle->view_info.foveation[i];
|
||||
extents[i] = stream_defoveator::defoveated_size(foveation[i]);
|
||||
max_width = std::max(max_width, extents[i].width);
|
||||
max_height = std::max(max_height, extents[i].height);
|
||||
}
|
||||
|
||||
if (max_width > 0 and max_height > 0)
|
||||
ensure_foveation_mode(foveation_center.is_cropped(fov, valid_fov), max_width, max_height);
|
||||
|
||||
session.begin_frame();
|
||||
|
||||
#if WIVRN_FEATURE_RENDERDOC
|
||||
@@ -907,12 +922,6 @@ void scenes::stream::render(const XrFrameState & frame_state)
|
||||
command_buffer.resetQueryPool(*query_pool, 0, size_gpu_timestamps);
|
||||
command_buffer.writeTimestamp(vk::PipelineStageFlagBits::eTopOfPipe, *query_pool, 0);
|
||||
|
||||
// Search for frame with desired display time on all decoders
|
||||
// If no such frame exists, use the latest frame for each decoder
|
||||
current_blit_handles = common_frame(frame_state.predictedDisplayTime);
|
||||
std::array<XrPosef, view_count> pose;
|
||||
std::array<XrFovf, view_count> fov;
|
||||
std::array<wivrn::to_headset::foveation_parameter, view_count> foveation;
|
||||
bool use_alpha = false;
|
||||
|
||||
std::array<stream_defoveator::input, view_count> images;
|
||||
@@ -1025,42 +1034,18 @@ void scenes::stream::render(const XrFrameState & frame_state)
|
||||
std::ranges::any_of(current_blit_handles, [](const auto & h) { return h and h->feedback.times_displayed < 2; }) or
|
||||
is_gui_interactable())
|
||||
{
|
||||
XrExtent2Di extents[view_count];
|
||||
{
|
||||
int32_t max_width = 0;
|
||||
int32_t max_height = 0;
|
||||
for (size_t i = 0; i < view_count; ++i)
|
||||
{
|
||||
extents[i] = stream_defoveator::defoveated_size(foveation[i]);
|
||||
max_width = std::max(max_width, extents[i].width);
|
||||
max_height = std::max(max_height, extents[i].height);
|
||||
}
|
||||
if (not swapchain)
|
||||
setup_reprojection_swapchain(max_width, max_height);
|
||||
else if (swapchain.width() < max_width or swapchain.height() < max_height)
|
||||
{
|
||||
// If the defoveated image is larger than the swapchain, try to reallocate one
|
||||
try
|
||||
{
|
||||
spdlog::info("Recreating swapchain, from {}x{} to {}x{}",
|
||||
swapchain.width(),
|
||||
swapchain.height(),
|
||||
max_width,
|
||||
max_height);
|
||||
setup_reprojection_swapchain(max_width, max_height);
|
||||
}
|
||||
catch (std::exception & e)
|
||||
{
|
||||
spdlog::warn("failed to increase swapchain size");
|
||||
for (size_t i = 0; i < view_count; ++i)
|
||||
{
|
||||
extents[i].width = std::min(extents[i].width, swapchain.width());
|
||||
extents[i].height = std::min(extents[i].height, swapchain.height());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
assert(swapchain);
|
||||
|
||||
// Swapchains only recreated when switching between cropped/full
|
||||
// Otherwise we clamp and resize the existing one
|
||||
for (size_t i = 0; i < view_count; ++i)
|
||||
{
|
||||
extents[i].width = std::min(extents[i].width, swapchain.width());
|
||||
extents[i].height = std::min(extents[i].height, swapchain.height());
|
||||
}
|
||||
|
||||
foveation_center.update(fov, valid_fov, swapchain, frame_state.predictedDisplayTime);
|
||||
|
||||
// defoveate the image, apply scale/bias
|
||||
int image_index = swapchain.acquire();
|
||||
swapchain.wait();
|
||||
@@ -1170,6 +1155,10 @@ void scenes::stream::render(const XrFrameState & frame_state)
|
||||
|
||||
render_start(use_alpha, frame_state.predictedDisplayTime);
|
||||
|
||||
// full-FOV dummy layer for Meta foveation, used when cropping FOV
|
||||
if (auto layer = foveation_center.get_layer())
|
||||
add_projection_layer(layer->flags, layer->space, layer->views);
|
||||
|
||||
// Add the layer with the streamed content
|
||||
std::array<XrCompositionLayerProjectionView, view_count> layer_view;
|
||||
for (uint32_t view = 0; view < view_count; view++)
|
||||
@@ -1220,7 +1209,8 @@ void scenes::stream::render(const XrFrameState & frame_state)
|
||||
{
|
||||
// Keep a copy of the feedback packets as they can be modified if they're encrypted
|
||||
inplace_vector<from_headset::feedback, decoder_count> feedbacks;
|
||||
inplace_vector<serialization_packet, decoder_count> packets;
|
||||
// +1 for optional foveation packet
|
||||
inplace_vector<serialization_packet, decoder_count + 1> packets;
|
||||
|
||||
feedbacks.reserve(current_blit_handles.size());
|
||||
packets.reserve(current_blit_handles.size());
|
||||
@@ -1233,6 +1223,11 @@ void scenes::stream::render(const XrFrameState & frame_state)
|
||||
wivrn_session::control_socket_t::serialize(packet, feedbacks.emplace_back(handle->feedback));
|
||||
}
|
||||
}
|
||||
if (auto foveation_packet = foveation_center.take_packet())
|
||||
{
|
||||
auto & packet = packets.emplace_back();
|
||||
wivrn_session::control_socket_t::serialize(packet, *foveation_packet);
|
||||
}
|
||||
if (not packets.empty())
|
||||
{
|
||||
try
|
||||
@@ -1304,7 +1299,7 @@ void scenes::stream::setup(const to_headset::video_stream_description & descript
|
||||
defoveator->reset_pipelines();
|
||||
}
|
||||
|
||||
void scenes::stream::setup_reprojection_swapchain(uint32_t swapchain_width, uint32_t swapchain_height)
|
||||
void scenes::stream::setup_reprojection_swapchain(uint32_t swapchain_width, uint32_t swapchain_height, bool foveation)
|
||||
{
|
||||
assert(swapchain_width);
|
||||
assert(swapchain_height);
|
||||
@@ -1314,8 +1309,21 @@ void scenes::stream::setup_reprojection_swapchain(uint32_t swapchain_width, uint
|
||||
|
||||
auto views = system.view_configuration_views(viewconfig);
|
||||
|
||||
swapchain = xr::swapchain(instance, session, device, swapchain_format, swapchain_width, swapchain_height, 1, views.size());
|
||||
spdlog::info("Created stream swapchain: {}x{}", swapchain.width(), swapchain.height());
|
||||
swapchain = xr::swapchain(
|
||||
instance,
|
||||
session,
|
||||
device,
|
||||
swapchain_format,
|
||||
swapchain_width,
|
||||
swapchain_height,
|
||||
1,
|
||||
views.size(),
|
||||
foveation);
|
||||
spdlog::info(
|
||||
"Created stream swapchain: {}x{}{}",
|
||||
swapchain.width(),
|
||||
swapchain.height(),
|
||||
foveation ? " with eye-tracked foveation" : "");
|
||||
for (auto view: views)
|
||||
{
|
||||
if (swapchain.width() > view.maxImageRectWidth or swapchain.height() > view.maxImageRectHeight)
|
||||
@@ -1333,6 +1341,19 @@ void scenes::stream::setup_reprojection_swapchain(uint32_t swapchain_width, uint
|
||||
swapchain.format());
|
||||
}
|
||||
|
||||
void scenes::stream::ensure_foveation_mode(bool cropped, uint32_t width, uint32_t height)
|
||||
{
|
||||
if (!swapchain or foveation_center.needs_swapchain_recreation(cropped))
|
||||
{
|
||||
setup_reprojection_swapchain(width, height, foveation_center.use_meta_swapchain(cropped));
|
||||
foveation_center.on_swapchain_recreated(cropped);
|
||||
}
|
||||
else
|
||||
{
|
||||
foveation_center.set_cropped(cropped);
|
||||
}
|
||||
}
|
||||
|
||||
scene::meta & scenes::stream::get_meta_scene()
|
||||
{
|
||||
static meta m{
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "audio/audio.h"
|
||||
#include "configuration.h"
|
||||
#include "decoder/shard_accumulator.h"
|
||||
#include "foveation.h"
|
||||
#include "render/imgui_impl.h"
|
||||
#include "scene.h"
|
||||
#include "scenes/input_profile.h"
|
||||
@@ -119,6 +120,7 @@ private:
|
||||
state_.compare_exchange_strong(prev, new_state);
|
||||
}
|
||||
|
||||
client_foveation::center foveation_center;
|
||||
xr::swapchain swapchain;
|
||||
|
||||
std::optional<audio> audio_handle;
|
||||
@@ -190,10 +192,6 @@ private:
|
||||
glm::vec3 world_gui_position;
|
||||
glm::quat world_gui_orientation;
|
||||
|
||||
bool override_foveation_enable;
|
||||
float override_foveation_pitch; // The pitch is the opposite as the height displayed in the GUI
|
||||
float override_foveation_distance;
|
||||
|
||||
// Which controller is used for recentering and position of the GUI relative to the controller, in controller axes, during recentering
|
||||
std::optional<std::tuple<xr::spaces, glm::vec3, glm::quat>> recentering_context;
|
||||
void update_gui_position(xr::spaces controller, float predicted_display_period);
|
||||
@@ -279,7 +277,8 @@ private:
|
||||
void send_derived_pose();
|
||||
|
||||
void setup(const to_headset::video_stream_description &);
|
||||
void setup_reprojection_swapchain(uint32_t width, uint32_t height);
|
||||
void setup_reprojection_swapchain(uint32_t width, uint32_t height, bool foveation);
|
||||
void ensure_foveation_mode(bool cropped, uint32_t width, uint32_t height);
|
||||
|
||||
vk::raii::QueryPool query_pool = nullptr;
|
||||
bool query_pool_filled = false;
|
||||
|
||||
@@ -415,13 +415,10 @@ void scenes::stream::gui_settings(float)
|
||||
.enter_foveation_adjust = [this] { next_gui_status = stream_tab::foveation_settings; },
|
||||
.on_foveation_override_changed = [this] {
|
||||
const auto & config = application::get_config();
|
||||
override_foveation_enable = config.override_foveation_enable;
|
||||
override_foveation_pitch = config.override_foveation_pitch;
|
||||
override_foveation_distance = config.override_foveation_distance;
|
||||
network_session->send_control(from_headset::override_foveation_center{
|
||||
.enabled = override_foveation_enable,
|
||||
.pitch = override_foveation_pitch,
|
||||
.distance = override_foveation_distance,
|
||||
foveation_center.set_manual_mode({
|
||||
.enabled = config.override_foveation_enable,
|
||||
.pitch = config.override_foveation_pitch,
|
||||
.distance = config.override_foveation_distance,
|
||||
}); },
|
||||
};
|
||||
|
||||
@@ -482,11 +479,13 @@ void scenes::stream::gui_bitrate_settings(float predicted_display_period)
|
||||
|
||||
void scenes::stream::gui_foveation_settings(float predicted_display_period)
|
||||
{
|
||||
auto override = foveation_center.get_manual_mode();
|
||||
|
||||
ImGui::PushFont(nullptr, constants::gui::font_size_large);
|
||||
ImGui::Text("%s", _S("Use the thumbsticks to move the foveation center"));
|
||||
ImGui::Text("%s", _S("Press A to save or B to cancel"));
|
||||
ImGui::Text("%s", fmt::format(_F("Height {:.1f} °"), -override_foveation_pitch * 180 / M_PI).c_str());
|
||||
ImGui::Text("%s", fmt::format(_F("Distance {:.2f} m"), override_foveation_distance).c_str());
|
||||
ImGui::Text("%s", fmt::format(_F("Height {:.1f} °"), -override.pitch * 180 / M_PI).c_str());
|
||||
ImGui::Text("%s", fmt::format(_F("Distance {:.2f} m"), override.distance).c_str());
|
||||
ImGui::PopFont();
|
||||
|
||||
// Maximum speed 1 rad/s
|
||||
@@ -495,8 +494,8 @@ void scenes::stream::gui_foveation_settings(float predicted_display_period)
|
||||
// Maximum speed 2m/s @ 1m
|
||||
float delta_distance = std::pow(constants::stream::gui_max_foveation_speed, application::read_action_float(foveation_distance).value_or(std::pair{0, 0}).second * predicted_display_period);
|
||||
|
||||
override_foveation_pitch = std::clamp<float>(override_foveation_pitch + delta_pitch, constants::stream::gui_min_foveation_pitch, constants::stream::gui_max_foveation_pitch);
|
||||
override_foveation_distance = std::clamp<float>(override_foveation_distance * delta_distance, constants::stream::gui_min_foveation_distance, constants::stream::gui_max_foveation_distance);
|
||||
override.pitch = std::clamp<float>(override.pitch + delta_pitch, constants::stream::gui_min_foveation_pitch, constants::stream::gui_max_foveation_pitch);
|
||||
override.distance = std::clamp<float>(override.distance * delta_distance, constants::stream::gui_min_foveation_distance, constants::stream::gui_max_foveation_distance);
|
||||
|
||||
bool ok = application::read_action_bool(foveation_ok).value_or(std::pair{0, false}).second;
|
||||
bool cancel = application::read_action_bool(foveation_cancel).value_or(std::pair{0, false}).second;
|
||||
@@ -504,12 +503,13 @@ void scenes::stream::gui_foveation_settings(float predicted_display_period)
|
||||
if (ok)
|
||||
{
|
||||
next_gui_status = stream_tab::settings;
|
||||
override.enabled = true;
|
||||
|
||||
// Save settings
|
||||
auto & config = application::get_config();
|
||||
config.override_foveation_enable = true;
|
||||
config.override_foveation_pitch = override_foveation_pitch;
|
||||
config.override_foveation_distance = override_foveation_distance;
|
||||
config.override_foveation_enable = override.enabled;
|
||||
config.override_foveation_pitch = override.pitch;
|
||||
config.override_foveation_distance = override.distance;
|
||||
config.save();
|
||||
}
|
||||
else if (cancel)
|
||||
@@ -518,16 +518,14 @@ void scenes::stream::gui_foveation_settings(float predicted_display_period)
|
||||
|
||||
// Restore settings
|
||||
const auto & config = application::get_config();
|
||||
override_foveation_enable = config.override_foveation_enable;
|
||||
override_foveation_pitch = config.override_foveation_pitch;
|
||||
override_foveation_distance = config.override_foveation_distance;
|
||||
override = {
|
||||
.enabled = config.override_foveation_enable,
|
||||
.pitch = config.override_foveation_pitch,
|
||||
.distance = config.override_foveation_distance,
|
||||
};
|
||||
}
|
||||
|
||||
network_session->send_control(from_headset::override_foveation_center{
|
||||
.enabled = override_foveation_enable,
|
||||
.pitch = override_foveation_pitch,
|
||||
.distance = override_foveation_distance,
|
||||
});
|
||||
foveation_center.set_manual_mode(override);
|
||||
}
|
||||
|
||||
void scenes::stream::gui_applications()
|
||||
@@ -727,10 +725,13 @@ void scenes::stream::draw_gui(XrTime predicted_display_time, XrDuration predicte
|
||||
glm::mat3 M = glm::mat3_cast(head_position->second);
|
||||
switch (gui_status)
|
||||
{
|
||||
case stream_tab::foveation_settings:
|
||||
case stream_tab::foveation_settings: {
|
||||
auto override = foveation_center.get_manual_mode();
|
||||
|
||||
imgui_ctx->layers()[0].orientation = head_position->second;
|
||||
imgui_ctx->layers()[0].position = head_position->first + M * glm::vec3{0, override_foveation_distance * sin(override_foveation_pitch), -override_foveation_distance};
|
||||
imgui_ctx->layers()[0].position = head_position->first + M * glm::vec3{0, override.distance * sin(override.pitch), -override.distance};
|
||||
break;
|
||||
}
|
||||
|
||||
case stream_tab::hidden:
|
||||
// Always use the same position for the GUI shortcut tip
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "xr/face_tracker.h"
|
||||
#include "xr/fb_body_tracker.h"
|
||||
#include "xr/to_string.h"
|
||||
#include <glm/gtc/quaternion.hpp>
|
||||
#include <magic_enum.hpp>
|
||||
#include <magic_enum_containers.hpp>
|
||||
#include <ranges>
|
||||
@@ -60,6 +61,37 @@ from_headset::tracking::pose locate_space(device_id device, XrSpace space, XrSpa
|
||||
return {.device = device};
|
||||
}
|
||||
|
||||
from_headset::tracking::pose make_eye_gaze_view_relative(
|
||||
const from_headset::tracking::pose & gaze_pose,
|
||||
const from_headset::tracking::pose & view_pose)
|
||||
{
|
||||
glm::quat gaze_quat(
|
||||
gaze_pose.pose.orientation.w,
|
||||
gaze_pose.pose.orientation.x,
|
||||
gaze_pose.pose.orientation.y,
|
||||
gaze_pose.pose.orientation.z);
|
||||
const glm::quat view_quat(
|
||||
view_pose.pose.orientation.w,
|
||||
view_pose.pose.orientation.x,
|
||||
view_pose.pose.orientation.y,
|
||||
view_pose.pose.orientation.z);
|
||||
gaze_quat = glm::conjugate(view_quat) * gaze_quat;
|
||||
|
||||
using flags = from_headset::pose_flags;
|
||||
return {
|
||||
.pose = {
|
||||
.orientation = {
|
||||
.x = gaze_quat.x,
|
||||
.y = gaze_quat.y,
|
||||
.z = gaze_quat.z,
|
||||
.w = gaze_quat.w,
|
||||
},
|
||||
},
|
||||
.device = gaze_pose.device,
|
||||
.flags = uint8_t(gaze_pose.flags & view_pose.flags & ~(flags::linear_velocity_valid | flags::angular_velocity_valid)),
|
||||
};
|
||||
}
|
||||
|
||||
class locate_spaces_functor
|
||||
{
|
||||
std::vector<XrSpaceLocationData> locations;
|
||||
@@ -253,6 +285,7 @@ void scenes::stream::tracking()
|
||||
magic_enum::containers::array<device_id, XrSpace> spaces{};
|
||||
|
||||
const auto & config = application::get_config();
|
||||
const bool eye_gaze_enabled = config.check_feature(feature::eye_gaze);
|
||||
|
||||
{
|
||||
std::vector ids{
|
||||
@@ -270,7 +303,7 @@ void scenes::stream::tracking()
|
||||
ids.insert(ids.end(), {device_id::LEFT_PINCH_POSE, device_id::LEFT_POKE, device_id::RIGHT_PINCH_POSE, device_id::RIGHT_POKE});
|
||||
}
|
||||
|
||||
if (config.check_feature(feature::eye_gaze))
|
||||
if (eye_gaze_enabled)
|
||||
ids.emplace_back(device_id::EYE_GAZE);
|
||||
|
||||
for (auto id: ids)
|
||||
@@ -294,6 +327,17 @@ void scenes::stream::tracking()
|
||||
};
|
||||
float applied_height_offset = config.get_height_offset();
|
||||
xr::space height_offset_space = make_height_offset_space(applied_height_offset);
|
||||
XrSpace world_space = application::space(xr::spaces::world);
|
||||
auto locate_eye_gaze = [&](XrTime time) {
|
||||
// Eye gaze uses view pose as the origin.
|
||||
if (application::get_hmd_traits().view_locate)
|
||||
return locate_space(device_id::EYE_GAZE, spaces[device_id::EYE_GAZE], view_space, time);
|
||||
|
||||
// Pico headsets fail to locate gaze relative to view.
|
||||
return make_eye_gaze_view_relative(
|
||||
locate_space(device_id::EYE_GAZE, spaces[device_id::EYE_GAZE], world_space, time),
|
||||
locate_space(device_id::EYE_GAZE, view_space, world_space, time));
|
||||
};
|
||||
|
||||
from_headset::tracking tracking;
|
||||
std::vector<from_headset::hand_tracking> hands;
|
||||
@@ -464,6 +508,7 @@ void scenes::stream::tracking()
|
||||
j.pose = i.pose;
|
||||
j.fov = i.fov;
|
||||
}
|
||||
|
||||
locate_spaces.add_space(item.device, view_space, tracking.timestamp, tracking.device_poses);
|
||||
break;
|
||||
case wivrn::device_id::LEFT_GRIP:
|
||||
@@ -479,33 +524,8 @@ void scenes::stream::tracking()
|
||||
locate_spaces.add_space(item.device, spaces[item.device], tracking.timestamp, tracking.device_poses);
|
||||
break;
|
||||
case wivrn::device_id::EYE_GAZE:
|
||||
// Eye gaze uses view pose as the origin
|
||||
if (application::get_hmd_traits().view_locate)
|
||||
tracking.device_poses.push_back(locate_space(item.device, spaces[item.device], spaces[wivrn::device_id::HEAD], tracking.timestamp));
|
||||
else
|
||||
{
|
||||
// Pico headsets fail to locate gaze relative to view
|
||||
auto gaze = locate_space(item.device, spaces[item.device], height_offset_space, tracking.timestamp);
|
||||
auto view_pose = locate_space(item.device, view_space, height_offset_space, tracking.timestamp);
|
||||
glm::quat gaze_quat(gaze.pose.orientation.w, gaze.pose.orientation.x, gaze.pose.orientation.y, gaze.pose.orientation.z);
|
||||
glm::quat view_quat(view_pose.pose.orientation.w, view_pose.pose.orientation.x, view_pose.pose.orientation.y, view_pose.pose.orientation.z);
|
||||
gaze_quat = glm::conjugate(view_quat) * gaze_quat;
|
||||
using flags = from_headset::pose_flags;
|
||||
tracking.device_poses.push_back(
|
||||
from_headset::tracking::pose{
|
||||
// Zero position and velocities
|
||||
.pose = {
|
||||
.orientation = {
|
||||
.x = gaze_quat.x,
|
||||
.y = gaze_quat.y,
|
||||
.z = gaze_quat.z,
|
||||
.w = gaze_quat.w,
|
||||
},
|
||||
},
|
||||
.device = item.device,
|
||||
.flags = uint8_t(gaze.flags & view_pose.flags & ~(flags::linear_velocity_valid | flags::angular_velocity_valid)),
|
||||
});
|
||||
}
|
||||
if (eye_gaze_enabled)
|
||||
tracking.device_poses.push_back(locate_eye_gaze(tracking.timestamp));
|
||||
break;
|
||||
case wivrn::device_id::FACE:
|
||||
std::visit(utils::overloaded{
|
||||
|
||||
Reference in New Issue
Block a user