Ignore errors when enumerating action sources, fixed input paths for HTC Vive Focus 3

This commit is contained in:
Guillaume Meunier
2024-01-30 20:26:07 +01:00
parent a2126f3e28
commit 33fea3f6b6
4 changed files with 51 additions and 20 deletions
+36 -18
View File
@@ -226,11 +226,12 @@ static std::vector<interaction_profile> interaction_profiles{
"/user/hand/right/input/aim/pose", "/user/hand/right/input/aim/pose",
"/user/hand/left/input/x/click", "/user/hand/left/input/x/click",
"/user/hand/left/input/x/touch",
"/user/hand/left/input/y/click", "/user/hand/left/input/y/click",
"/user/hand/left/input/y/touch",
"/user/hand/left/input/menu/click", "/user/hand/left/input/menu/click",
"/user/hand/left/input/squeeze/click",
"/user/hand/left/input/squeeze/touch",
"/user/hand/left/input/squeeze/value", "/user/hand/left/input/squeeze/value",
"/user/hand/left/input/trigger/click",
"/user/hand/left/input/trigger/value", "/user/hand/left/input/trigger/value",
"/user/hand/left/input/trigger/touch", "/user/hand/left/input/trigger/touch",
"/user/hand/left/input/thumbrest/touch", "/user/hand/left/input/thumbrest/touch",
@@ -239,11 +240,12 @@ static std::vector<interaction_profile> interaction_profiles{
"/user/hand/left/input/thumbstick/touch", "/user/hand/left/input/thumbstick/touch",
"/user/hand/right/input/a/click", "/user/hand/right/input/a/click",
"/user/hand/right/input/a/touch",
"/user/hand/right/input/b/click", "/user/hand/right/input/b/click",
"/user/hand/right/input/b/touch",
"/user/hand/right/input/system/click", "/user/hand/right/input/system/click",
"/user/hand/right/input/squeeze/click",
"/user/hand/right/input/squeeze/touch",
"/user/hand/right/input/squeeze/value", "/user/hand/right/input/squeeze/value",
"/user/hand/right/input/trigger/click",
"/user/hand/right/input/trigger/value", "/user/hand/right/input/trigger/value",
"/user/hand/right/input/trigger/touch", "/user/hand/right/input/trigger/touch",
"/user/hand/right/input/thumbstick", "/user/hand/right/input/thumbstick",
@@ -1313,15 +1315,23 @@ void application::interaction_profile_changed()
spdlog::info("Global actions:"); spdlog::info("Global actions:");
for(auto& [action, type, name]: actions) for(auto& [action, type, name]: actions)
{ {
auto sources = xr_session.localized_sources_for_action(action); try
if (!sources.empty())
{ {
spdlog::info(" Sources for {}", name); auto sources = xr_session.localized_sources_for_action(action);
for (auto & k: sources) if (!sources.empty())
spdlog::info(" {}", k); {
spdlog::info(" Sources for {}", name);
for (auto & k: sources)
spdlog::info(" {}", k);
}
else
spdlog::info(" No source for {}", name);
}
catch(std::exception& e)
{
spdlog::warn("Error enumerating sources for {}: {}", name, e.what());
continue;
} }
else
spdlog::warn(" No source for {}", name);
} }
if (current_scene()) if (current_scene())
@@ -1332,15 +1342,23 @@ void application::interaction_profile_changed()
{ {
auto [action, type] = action_and_type; auto [action, type] = action_and_type;
auto sources = xr_session.localized_sources_for_action(action); try
if (!sources.empty())
{ {
spdlog::info(" Sources for {}", name); auto sources = xr_session.localized_sources_for_action(action);
for (auto & k: sources) if (!sources.empty())
spdlog::info(" {}", k); {
spdlog::info(" Sources for {}", name);
for (auto & k: sources)
spdlog::info(" {}", k);
}
else
spdlog::info(" No source for {}", name);
}
catch(std::exception& e)
{
spdlog::warn("Error enumerating sources for {}: {}", name, e.what());
continue;
} }
else
spdlog::warn(" No source for {}", name);
} }
} }
} }
+13 -2
View File
@@ -63,8 +63,6 @@ model guess_model()
return model::meta_quest_pro; return model::meta_quest_pro;
if (device == "eureka") if (device == "eureka")
return model::meta_quest_3; return model::meta_quest_3;
if (device == "TBD")
return model::htc_vive_focus_3;
if (manufacturer == "Pico") if (manufacturer == "Pico")
{ {
@@ -74,6 +72,14 @@ model guess_model()
spdlog::info("manufacturer={}, model={}, device={} assuming Pico 4", manufacturer, model, device); spdlog::info("manufacturer={}, model={}, device={} assuming Pico 4", manufacturer, model, device);
return model::pico_4; return model::pico_4;
} }
if (manufacturer == "HTC")
{
if (model == "VIVE Focus 3")
return model::htc_vive_focus_3;
if (model == "VIVE XR Series")
return model::htc_vive_xr_elite;
}
spdlog::info("Unknown model, manufacturer={}, model={}, device={}", manufacturer, model, device); spdlog::info("Unknown model, manufacturer={}, model={}, device={}", manufacturer, model, device);
#endif #endif
@@ -122,6 +128,11 @@ XrViewConfigurationView override_view(XrViewConfigurationView view, model m)
view.recommendedImageRectWidth = 2448; view.recommendedImageRectWidth = 2448;
view.recommendedImageRectHeight = 2448; view.recommendedImageRectHeight = 2448;
return view; return view;
case model::htc_vive_xr_elite:
spdlog::info("Using panel resolution 1920x1920 for HTC Vive XR Elite");
view.recommendedImageRectWidth = 1920;
view.recommendedImageRectHeight = 1920;
return view;
case model::unknown: case model::unknown:
return view; return view;
} }
+1
View File
@@ -29,6 +29,7 @@ enum class model
pico_neo_3, pico_neo_3,
pico_4, pico_4,
htc_vive_focus_3, htc_vive_focus_3,
htc_vive_xr_elite,
unknown unknown
}; };
+1
View File
@@ -82,6 +82,7 @@ static std::string choose_webxr_profile()
case model::pico_4: case model::pico_4:
return "pico-4"; return "pico-4";
case model::htc_vive_focus_3: case model::htc_vive_focus_3:
case model::htc_vive_xr_elite:
return "htc-vive-focus-3"; return "htc-vive-focus-3";
case model::unknown: case model::unknown:
return "generic-trigger-squeeze"; return "generic-trigger-squeeze";