Forward XR_EXT_user_presence

Closes #258
This commit is contained in:
Sapphire
2025-07-04 23:43:06 +02:00
committed by xytovl
parent f43ee229f1
commit 3ac31fe5cc
10 changed files with 67 additions and 1 deletions
+1
View File
@@ -1113,6 +1113,7 @@ void application::initialize()
opt_extensions.push_back(XR_KHR_COMPOSITION_LAYER_DEPTH_EXTENSION_NAME);
opt_extensions.push_back(XR_FB_COMPOSITION_LAYER_DEPTH_TEST_EXTENSION_NAME);
opt_extensions.push_back(XR_KHR_COMPOSITION_LAYER_COLOR_SCALE_BIAS_EXTENSION_NAME);
opt_extensions.push_back(XR_EXT_USER_PRESENCE_EXTENSION_NAME);
opt_extensions.push_back(XR_KHR_VISIBILITY_MASK_EXTENSION_NAME);
opt_extensions.push_back(XR_FB_COMPOSITION_LAYER_SETTINGS_EXTENSION_NAME);
+7
View File
@@ -21,6 +21,7 @@
#include "xr/fb_face_tracker2.h"
#include "xr/htc_body_tracker.h"
#include "xr/pico_body_tracker.h"
#include <openxr/openxr.h>
#define GLM_FORCE_RADIANS
#include "stream.h"
@@ -217,6 +218,7 @@ std::shared_ptr<scenes::stream> scenes::stream::create(std::unique_ptr<wivrn_ses
info.hand_tracking = config.check_feature(feature::hand_tracking);
info.eye_gaze = config.check_feature(feature::eye_gaze);
info.presence = self->instance.has_extension(XR_EXT_USER_PRESENCE_EXTENSION_NAME) && self->system.user_presence_properties().supportsUserPresence;
if (config.check_feature(feature::face_tracking))
{
@@ -1287,6 +1289,11 @@ void scenes::stream::on_xr_event(const xr::event & event)
.view_index = uint8_t(event.visibility_mask_changed.viewIndex),
});
break;
case XR_TYPE_EVENT_DATA_USER_PRESENCE_CHANGED_EXT:
network_session->send_control(from_headset::user_presence_changed{
.present = (bool)event.user_presence_changed.isUserPresent,
});
break;
case XR_TYPE_EVENT_DATA_INTERACTION_PROFILE_CHANGED:
on_interaction_profile_changed(event.interaction_profile_changed);
break;
+1
View File
@@ -43,6 +43,7 @@ union event
XrEventDataDisplayRefreshRateChangedFB refresh_rate_changed;
XrEventDataPassthroughStateChangedFB passthrough_state_changed;
XrEventDataVisibilityMaskChangedKHR visibility_mask_changed;
XrEventDataUserPresenceChangedEXT user_presence_changed;
};
class instance : public utils::handle<XrInstance, xrDestroyInstance>
{
+18
View File
@@ -105,6 +105,24 @@ XrSystemEyeGazeInteractionPropertiesEXT xr::system::eye_gaze_interaction_propert
return eye_gaze_prop;
}
XrSystemUserPresencePropertiesEXT xr::system::user_presence_properties() const
{
if (!id)
throw std::invalid_argument("this");
XrSystemUserPresencePropertiesEXT presence_prop{
.type = XR_TYPE_SYSTEM_USER_PRESENCE_PROPERTIES_EXT,
};
XrSystemProperties prop{
.type = XR_TYPE_SYSTEM_PROPERTIES,
.next = &presence_prop,
};
CHECK_XR(xrGetSystemProperties(*inst, id, &prop));
return presence_prop;
}
XrSystemFaceTrackingProperties2FB xr::system::fb_face_tracking2_properties() const
{
if (!id)
+1
View File
@@ -62,6 +62,7 @@ public:
XrSystemProperties properties() const;
XrSystemHandTrackingPropertiesEXT hand_tracking_properties() const;
XrSystemEyeGazeInteractionPropertiesEXT eye_gaze_interaction_properties() const;
XrSystemUserPresencePropertiesEXT user_presence_properties() const;
XrSystemFaceTrackingProperties2FB fb_face_tracking2_properties() const;
XrSystemFacialTrackingPropertiesHTC htc_face_tracking_properties() const;
XrSystemBodyTrackingPropertiesFB fb_body_tracking_properties() const;