Allow opt out of hand tracking

This commit is contained in:
Patrick Nicolas
2024-10-22 10:36:27 +02:00
parent 08d19bd94d
commit 281b04cbc2
9 changed files with 95 additions and 47 deletions
+5
View File
@@ -95,6 +95,10 @@ bool configuration::check_feature(feature f) const
{
case feature::microphone:
break;
case feature::hand_tracking:
if (not application::get_hand_tracking_supported())
return false;
break;
case feature::eye_gaze:
if (not application::get_eye_gaze_supported())
return false;
@@ -138,6 +142,7 @@ void configuration::set_feature(feature f, bool state)
configuration::configuration(xr::system & system)
{
passthrough_enabled = system.passthrough_supported() == xr::system::passthrough_type::color;
features[feature::hand_tracking] = application::get_hand_tracking_supported();
try
{
simdjson::dom::parser parser;
+2
View File
@@ -159,6 +159,8 @@ const char * permission_name(feature f)
{
case feature::microphone:
return "android.permission.RECORD_AUDIO";
case feature::hand_tracking:
return nullptr;
case feature::eye_gaze:
switch (guess_model())
{
+1
View File
@@ -37,6 +37,7 @@ enum class model
enum class feature
{
microphone,
hand_tracking,
eye_gaze,
face_tracking,
};
+24 -20
View File
@@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WiVRn 0.15\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-09-21 16:13+0200\n"
"POT-Creation-Date: 2024-10-21 22:59+0200\n"
"PO-Revision-Date: 2024-05-20 13:00+0200\n"
"Last-Translator: Guillaume Meunier <guillaume.meunier@centraliens.net>\n"
"Language: French\n"
@@ -10,31 +10,31 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: client/scenes/lobby.cpp:143
#: client/scenes/lobby.cpp:142
msgid "No supported swapchain format"
msgstr "Aucun format de swapchain supporté"
#: client/scenes/lobby.cpp:178
#: client/scenes/lobby.cpp:177
msgid "Incompatible WiVRn server: no protocol field in TXT"
msgstr "Serveur WiVRn incompatible : pas de champ protocol dans le TXT"
#: client/scenes/lobby.cpp:181
#: client/scenes/lobby.cpp:180
#, c++-format
msgid "Incompatible WiVRn server protocol (client: {}, server: {})"
msgstr ""
"Version du protocole WiVRn du serveur incompatible (client: {}, serveur: {})"
#: client/scenes/lobby.cpp:196
#: client/scenes/lobby.cpp:195
#, c++-format
msgid "Cannot resolve hostname: {}"
msgstr "Impossible de résoudre le nom: {}"
#: client/scenes/lobby.cpp:235
#: client/scenes/lobby.cpp:234
#, c++-format
msgid "Cannot connect to {} ({}): {}"
msgstr "Impossible de se connecter à {} ({}): {}"
#: client/scenes/lobby.cpp:347
#: client/scenes/lobby.cpp:346
msgid "Waiting for connection"
msgstr "Attente de connexion"
@@ -122,60 +122,64 @@ msgid "Enable microphone"
msgstr "Activer le micro"
#: client/scenes/lobby_gui.cpp:395
msgid "Enable hand tracking"
msgstr "Activer le suivi des mains"
#: client/scenes/lobby_gui.cpp:406
msgid "Enable eye tracking"
msgstr "Activer le suivi des yeux"
#: client/scenes/lobby_gui.cpp:406
#: client/scenes/lobby_gui.cpp:417
msgid "Enable face tracking"
msgstr "Activer le suivi du visage"
#: client/scenes/lobby_gui.cpp:416
#: client/scenes/lobby_gui.cpp:427
msgid "Enable video passthrough in lobby"
msgstr "Activer la vue réelle dans l'accueil"
#: client/scenes/lobby_gui.cpp:424
#: client/scenes/lobby_gui.cpp:435
msgid "Show performance metrics"
msgstr "Afficher les métriques de performances"
#: client/scenes/lobby_gui.cpp:428
#: client/scenes/lobby_gui.cpp:439
msgid "Overlay can be toggled by pressing both thumbsticks"
msgstr "L'affichage peut être basculé en appuyant sur les deux joysticks"
#: client/scenes/lobby_gui.cpp:458 client/scenes/lobby_gui.cpp:466
#: client/scenes/lobby_gui.cpp:469 client/scenes/lobby_gui.cpp:477
#: client/scenes/stream_stats.cpp:147
msgid "CPU time"
msgstr "Temps CPU"
#: client/scenes/lobby_gui.cpp:462
#: client/scenes/lobby_gui.cpp:473
msgid "CPU time [ms]"
msgstr "Temps CPU [ms]"
#: client/scenes/lobby_gui.cpp:472 client/scenes/lobby_gui.cpp:480
#: client/scenes/lobby_gui.cpp:483 client/scenes/lobby_gui.cpp:491
#: client/scenes/stream_stats.cpp:149
msgid "GPU time"
msgstr "Temps GPU"
#: client/scenes/lobby_gui.cpp:476
#: client/scenes/lobby_gui.cpp:487
msgid "GPU time [ms]"
msgstr "Temps GPU [ms]"
#: client/scenes/lobby_gui.cpp:504 client/scenes/lobby_gui.cpp:773
#: client/scenes/lobby_gui.cpp:515 client/scenes/lobby_gui.cpp:1004
msgid "Licenses"
msgstr "Licences"
#: client/scenes/lobby_gui.cpp:763
#: client/scenes/lobby_gui.cpp:994
msgid "Server list"
msgstr "Serveurs"
#: client/scenes/lobby_gui.cpp:766
#: client/scenes/lobby_gui.cpp:997
msgid "Settings"
msgstr "Paramètres"
#: client/scenes/lobby_gui.cpp:770
#: client/scenes/lobby_gui.cpp:1001
msgid "About"
msgstr "À propos"
#: client/scenes/lobby_gui.cpp:776
#: client/scenes/lobby_gui.cpp:1007
msgid "Exit"
msgstr "Quitter"
+24 -20
View File
@@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WiVRn 0.15\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-09-21 16:13+0200\n"
"POT-Creation-Date: 2024-10-21 22:59+0200\n"
"PO-Revision-Date: 2024-10-15 20:16+0100\n"
"Last-Translator: Albano Battistella <albanobattistella@gmail.com>\n"
"Language: Italian\n"
@@ -10,30 +10,30 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: client/scenes/lobby.cpp:143
#: client/scenes/lobby.cpp:142
msgid "No supported swapchain format"
msgstr "Nessun formato swapchain supportato"
#: client/scenes/lobby.cpp:178
#: client/scenes/lobby.cpp:177
msgid "Incompatible WiVRn server: no protocol field in TXT"
msgstr "Server WiVRn incompatibile: nessun campo protocollo in TXT"
#: client/scenes/lobby.cpp:181
#: client/scenes/lobby.cpp:180
#, c++-format
msgid "Incompatible WiVRn server protocol (client: {}, server: {})"
msgstr "Protocollo server WiVRn incompatibile (client: {}, server: {})"
#: client/scenes/lobby.cpp:196
#: client/scenes/lobby.cpp:195
#, c++-format
msgid "Cannot resolve hostname: {}"
msgstr "Impossibile risolvere il nome host: {}"
#: client/scenes/lobby.cpp:235
#: client/scenes/lobby.cpp:234
#, c++-format
msgid "Cannot connect to {} ({}): {}"
msgstr "Impossibile connettersi a {} ({}): {}"
#: client/scenes/lobby.cpp:347
#: client/scenes/lobby.cpp:346
msgid "Waiting for connection"
msgstr "In attesa di connessione"
@@ -121,60 +121,64 @@ msgid "Enable microphone"
msgstr "Attiva il microfono"
#: client/scenes/lobby_gui.cpp:395
msgid "Enable hand tracking"
msgstr "Abilita il tracciamento delle mani"
#: client/scenes/lobby_gui.cpp:406
msgid "Enable eye tracking"
msgstr "Abilita il tracciamento oculare"
#: client/scenes/lobby_gui.cpp:406
#: client/scenes/lobby_gui.cpp:417
msgid "Enable face tracking"
msgstr "Abilita il tracciamento facciale"
#: client/scenes/lobby_gui.cpp:416
#: client/scenes/lobby_gui.cpp:427
msgid "Enable video passthrough in lobby"
msgstr "Abilita la visualizzazione reale in ingresso"
#: client/scenes/lobby_gui.cpp:424
#: client/scenes/lobby_gui.cpp:435
msgid "Show performance metrics"
msgstr "Mostra metriche delle prestazioni"
#: client/scenes/lobby_gui.cpp:428
#: client/scenes/lobby_gui.cpp:439
msgid "Overlay can be toggled by pressing both thumbsticks"
msgstr "È possibile alternare la visualizzazione premendo entrambi i joystick"
#: client/scenes/lobby_gui.cpp:458 client/scenes/lobby_gui.cpp:466
#: client/scenes/lobby_gui.cpp:469 client/scenes/lobby_gui.cpp:477
#: client/scenes/stream_stats.cpp:147
msgid "CPU time"
msgstr "Tempo CPU"
#: client/scenes/lobby_gui.cpp:462
#: client/scenes/lobby_gui.cpp:473
msgid "CPU time [ms]"
msgstr "Tempo CPU [ms]"
#: client/scenes/lobby_gui.cpp:472 client/scenes/lobby_gui.cpp:480
#: client/scenes/lobby_gui.cpp:483 client/scenes/lobby_gui.cpp:491
#: client/scenes/stream_stats.cpp:149
msgid "GPU time"
msgstr "Tempo GPU"
#: client/scenes/lobby_gui.cpp:476
#: client/scenes/lobby_gui.cpp:487
msgid "GPU time [ms]"
msgstr "Tempo GPU [ms]"
#: client/scenes/lobby_gui.cpp:504 client/scenes/lobby_gui.cpp:773
#: client/scenes/lobby_gui.cpp:515 client/scenes/lobby_gui.cpp:1004
msgid "Licenses"
msgstr "Licenze"
#: client/scenes/lobby_gui.cpp:763
#: client/scenes/lobby_gui.cpp:994
msgid "Server list"
msgstr "Elenco dei server"
#: client/scenes/lobby_gui.cpp:766
#: client/scenes/lobby_gui.cpp:997
msgid "Settings"
msgstr "Impostazioni"
#: client/scenes/lobby_gui.cpp:770
#: client/scenes/lobby_gui.cpp:1001
msgid "About"
msgstr "Informazioni"
#: client/scenes/lobby_gui.cpp:776
#: client/scenes/lobby_gui.cpp:1007
msgid "Exit"
msgstr "Esci"
+28 -1
View File
@@ -389,6 +389,17 @@ void scenes::lobby::gui_settings()
}
vibrate_on_hover();
}
{
ImGui::BeginDisabled(not application::get_hand_tracking_supported());
bool enabled = config.check_feature(feature::hand_tracking);
if (ImGui::Checkbox(_S("Enable hand tracking"), &enabled))
{
config.set_feature(feature::hand_tracking, enabled);
config.save();
}
vibrate_on_hover();
ImGui::EndDisabled();
}
{
ImGui::BeginDisabled(not application::get_eye_gaze_supported());
bool enabled = config.check_feature(feature::eye_gaze);
@@ -822,7 +833,7 @@ void scenes::lobby::draw_features_status(XrTime predicted_display_time)
{
feature f;
const char * icon_enabled;
const char * icon_disabled;
const char * icon_disabled = ICON_FA_SLASH;
bool enabled;
float w;
};
@@ -834,6 +845,14 @@ void scenes::lobby::draw_features_status(XrTime predicted_display_time)
.icon_disabled = ICON_FA_MICROPHONE_SLASH,
});
if (application::get_hand_tracking_supported())
{
items.push_back({
.f = feature::hand_tracking,
.icon_enabled = ICON_FA_HAND,
});
}
if (application::get_eye_gaze_supported())
{
items.push_back({
@@ -870,12 +889,20 @@ void scenes::lobby::draw_features_status(XrTime predicted_display_time)
ImGui::PushStyleColor(ImGuiCol_Text, i.enabled ? ImGui::GetColorU32(ImGuiCol_Text) : IM_COL32(255, 0, 0, 255));
if (&i != &items.front())
ImGui::SameLine();
auto pos = ImGui::GetCursorPos();
if (ImGui::Button(i.enabled ? i.icon_enabled : i.icon_disabled))
{
// button doesn't alter the bool
config.set_feature(i.f, not i.enabled);
config.save();
}
if (i.icon_disabled == std::string_view(ICON_FA_SLASH) and not i.enabled)
{
auto save = ImGui::GetCursorPos();
ImGui::SetCursorPos(pos + ImGui::GetStyle().FramePadding);
ImGui::Text("%s", i.icon_enabled);
ImGui::SetCursorPos(save);
}
vibrate_on_hover();
ImGui::PopStyleColor(2);
ImGui::PopStyleVar();
+1 -1
View File
@@ -123,7 +123,7 @@ std::shared_ptr<scenes::stream> scenes::stream::create(std::unique_ptr<wivrn_ses
if (info.available_refresh_rates.empty())
spdlog::warn("Unable to detect refresh rates");
info.hand_tracking = application::get_hand_tracking_supported();
info.hand_tracking = config.check_feature(feature::hand_tracking);
info.eye_gaze = config.check_feature(feature::eye_gaze);
info.face_tracking2_fb = config.check_feature(feature::face_tracking);
info.palm_pose = application::space(xr::spaces::palm_left) or application::space(xr::spaces::palm_right);
+8 -3
View File
@@ -191,7 +191,9 @@ void scenes::stream::tracking()
if (XrSpace palm = application::space(xr::spaces::palm_right))
spaces.emplace_back(device_id::RIGHT_PALM, palm);
if (application::get_eye_gaze_supported())
const auto & config = application::get_config();
if (config.check_feature(feature::eye_gaze))
spaces.push_back({device_id::EYE_GAZE, application::space(xr::spaces::eye_gaze)});
XrSpace view_space = application::space(xr::spaces::view);
@@ -204,6 +206,9 @@ void scenes::stream::tracking()
std::vector<from_headset::hand_tracking> hands;
int skip_samples = 0;
const bool hand_tracking = config.check_feature(feature::hand_tracking);
const bool face_tracking = config.check_feature(feature::face_tracking);
while (not exiting)
{
try
@@ -259,7 +264,7 @@ void scenes::stream::tracking()
packet.device_poses.push_back(locate_space(device, space, world_space, t0 + Δt));
}
if (application::get_hand_tracking_supported())
if (hand_tracking)
{
if (control.enabled[size_t(tid::left_hand)])
hands.emplace_back(
@@ -276,7 +281,7 @@ void scenes::stream::tracking()
locate_hands(application::get_right_hand(), world_space, t0 + Δt));
}
if (application::get_fb_face_tracking2_supported() and control.enabled[size_t(tid::face)])
if (face_tracking and control.enabled[size_t(tid::face)])
{
application::get_fb_face_tracker2().get_weights(t0 + Δt, packet.face.emplace());
}
+2 -2
View File
@@ -171,7 +171,7 @@ wivrn_controller::wivrn_controller(int hand_id,
base->name = XRT_DEVICE_TOUCH_CONTROLLER;
base->orientation_tracking_supported = true;
base->hand_tracking_supported = true;
base->hand_tracking_supported = cnx->get_info().hand_tracking;
base->position_tracking_supported = true;
base->tracking_origin = hmd->tracking_origin;
@@ -214,7 +214,7 @@ wivrn_controller::wivrn_controller(int hand_id,
SET_INPUT(THUMBREST_TOUCH);
inputs[WIVRN_CONTROLLER_HAND_TRACKER].name = hand_id == 0 ? XRT_INPUT_GENERIC_HAND_TRACKING_LEFT : XRT_INPUT_GENERIC_HAND_TRACKING_RIGHT;
inputs[WIVRN_CONTROLLER_HAND_TRACKER].active = true;
inputs[WIVRN_CONTROLLER_HAND_TRACKER].active = hand_tracking_supported;
inputs[WIVRN_CONTROLLER_PALM_POSE].name = XRT_INPUT_GENERIC_PALM_POSE;
inputs[WIVRN_CONTROLLER_PALM_POSE].active = cnx->get_info().palm_pose;