Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Vindicus999
2025-07-04 21:59:16 +00:00
34 changed files with 210 additions and 164 deletions
+4 -3
View File
@@ -840,7 +840,7 @@ void wivrn_controller::update_hand_tracking(const from_headset::hand_tracking &
cnx->set_enabled(joints.hand_id == 0 ? to_headset::tracking_control::id::left_hand : to_headset::tracking_control::id::right_hand, false);
}
void wivrn_controller::set_output(xrt_output_name name, const xrt_output_value * value)
xrt_result_t wivrn_controller::set_output(xrt_output_name name, const xrt_output_value * value)
{
device_id id;
const bool left = device_type == XRT_DEVICE_TYPE_LEFT_HAND_CONTROLLER;
@@ -856,7 +856,7 @@ void wivrn_controller::set_output(xrt_output_name name, const xrt_output_value *
id = left ? device_id::LEFT_THUMB_HAPTIC : device_id::RIGHT_THUMB_HAPTIC;
break;
default:
return;
return XRT_ERROR_OUTPUT_UNSUPPORTED;
}
try
@@ -869,7 +869,8 @@ void wivrn_controller::set_output(xrt_output_name name, const xrt_output_value *
}
catch (...)
{
// Ignore errors
return XRT_ERROR_OUTPUT_REQUEST_FAILURE;
}
return XRT_SUCCESS;
}
} // namespace wivrn
+1 -1
View File
@@ -55,7 +55,7 @@ public:
xrt_result_t get_tracked_pose(xrt_input_name name, int64_t at_timestamp_ns, xrt_space_relation * out_relation);
xrt_result_t get_hand_tracking(xrt_input_name name, int64_t desired_timestamp_ns, xrt_hand_joint_set * out_value, int64_t * out_timestamp_ns);
void set_output(xrt_output_name name, const xrt_output_value * value);
xrt_result_t set_output(xrt_output_name name, const xrt_output_value * value);
void set_inputs(const from_headset::inputs &, const clock_offset &);
+15
View File
@@ -76,10 +76,12 @@ wivrn_hmd::wivrn_hmd(wivrn::wivrn_session * cnx,
.supported = {
.orientation_tracking = true,
.position_tracking = true,
.presence = info.presence,
.battery_status = true,
},
.update_inputs = [](xrt_device *) { return XRT_SUCCESS; },
.get_tracked_pose = method_pointer<&wivrn_hmd::get_tracked_pose>,
.get_presence = method_pointer<&wivrn_hmd::get_presence>,
.get_view_poses = method_pointer<&wivrn_hmd::get_view_poses>,
.get_visibility_mask = method_pointer<&wivrn_hmd::get_visibility_mask>,
.get_battery_status = method_pointer<&wivrn_hmd::get_battery_status>,
@@ -147,6 +149,13 @@ void wivrn_hmd::update_battery(const from_headset::battery & new_battery)
battery = new_battery;
}
xrt_result_t wivrn_hmd::get_presence(bool * out_presence)
{
*out_presence = presence;
return XRT_SUCCESS;
}
xrt_result_t wivrn_hmd::get_view_poses(const xrt_vec3 * default_eye_relation,
int64_t at_timestamp_ns,
uint32_t view_count,
@@ -222,4 +231,10 @@ void wivrn_hmd::update_visibility_mask(const from_headset::visibility_mask_chang
auto m = visibility_mask.lock();
m->at(mask.view_index) = mask.data;
}
void wivrn_hmd::update_presence(bool presence)
{
U_LOG_I("Updating user presence to %s", presence ? "true" : "false");
this->presence = presence;
}
} // namespace wivrn
+3
View File
@@ -46,6 +46,7 @@ class wivrn_hmd : public xrt_device
view_list views;
from_headset::battery battery{};
std::atomic<bool> presence{true};
thread_safe<std::array<std::optional<from_headset::visibility_mask_changed::masks>, 2>> visibility_mask;
wivrn::wivrn_session * cnx;
@@ -69,6 +70,7 @@ public:
void set_foveated_size(uint32_t width, uint32_t height);
xrt_result_t get_tracked_pose(xrt_input_name name, int64_t at_timestamp_ns, xrt_space_relation *);
xrt_result_t get_presence(bool * out_presence);
xrt_result_t get_view_poses(const xrt_vec3 * default_eye_relation,
int64_t at_timestamp_ns,
uint32_t view_count,
@@ -82,5 +84,6 @@ public:
void update_battery(const from_headset::battery &);
void update_tracking(const from_headset::tracking &, const clock_offset &);
void update_visibility_mask(const from_headset::visibility_mask_changed &);
void update_presence(bool presence);
};
} // namespace wivrn
+13
View File
@@ -315,6 +315,7 @@ xrt_result_t wivrn::wivrn_session::create_session(std::unique_ptr<wivrn_connecti
&self->hmd,
&self->left_hand,
&self->right_hand,
nullptr,
self->xdevs,
self->xdev_count,
false,
@@ -577,6 +578,18 @@ void wivrn_session::operator()(from_headset::visibility_mask_changed && mask)
auto result = xrt_session_event_sink_push(&xrt_system.broadcast, &event);
}
void wivrn_session::operator()(from_headset::user_presence_changed && event)
{
hmd.update_presence(event.present);
push_event(
{
.presence_change = {
.type = XRT_SESSION_EVENT_USER_PRESENCE_CHANGE,
.is_user_present = event.present,
},
});
}
void wivrn_session::operator()(from_headset::refresh_rate_changed && event)
{
{
+1
View File
@@ -179,6 +179,7 @@ public:
void operator()(from_headset::feedback &&);
void operator()(from_headset::battery &&);
void operator()(from_headset::visibility_mask_changed &&);
void operator()(from_headset::user_presence_changed &&);
void operator()(from_headset::refresh_rate_changed &&);
void operator()(audio_data &&);