Add interaction profile and glTF models for HTC Vive Focus 3

This commit is contained in:
Guillaume Meunier
2024-01-30 20:26:07 +01:00
parent a6578451d5
commit a2126f3e28
13 changed files with 398 additions and 9 deletions
+64 -5
View File
@@ -73,7 +73,7 @@ struct interaction_profile
static std::vector<interaction_profile> interaction_profiles{
interaction_profile{
"/interaction_profiles/khr/simple_controller",
{},
{},
{
"/user/hand/left/output/haptic",
"/user/hand/right/output/haptic",
@@ -93,7 +93,7 @@ static std::vector<interaction_profile> interaction_profiles{
}},
interaction_profile{
"/interaction_profiles/oculus/touch_controller",
{},
{},
{
"/user/hand/left/output/haptic",
"/user/hand/right/output/haptic",
@@ -132,7 +132,7 @@ static std::vector<interaction_profile> interaction_profiles{
}},
interaction_profile{
"/interaction_profiles/bytedance/pico_neo3_controller",
{ "XR_BD_controller_interaction" },
{ "XR_BD_controller_interaction" },
{
"/user/hand/left/output/haptic",
"/user/hand/right/output/haptic",
@@ -174,7 +174,7 @@ static std::vector<interaction_profile> interaction_profiles{
}},
interaction_profile{
"/interaction_profiles/bytedance/pico4_controller",
{ "XR_BD_controller_interaction" },
{ "XR_BD_controller_interaction" },
{
"/user/hand/left/output/haptic",
"/user/hand/right/output/haptic",
@@ -212,6 +212,45 @@ static std::vector<interaction_profile> interaction_profiles{
"/user/hand/right/input/thumbstick/touch",
"/user/hand/right/input/thumbrest/touch",
}},
interaction_profile{
"/interaction_profiles/htc/vive_focus3_controller",
{ "XR_HTC_vive_focus3_controller_interaction" },
{
"/user/hand/left/output/haptic",
"/user/hand/right/output/haptic",
"/user/hand/left/input/grip/pose",
"/user/hand/left/input/aim/pose",
"/user/hand/right/input/grip/pose",
"/user/hand/right/input/aim/pose",
"/user/hand/left/input/x/click",
"/user/hand/left/input/x/touch",
"/user/hand/left/input/y/click",
"/user/hand/left/input/y/touch",
"/user/hand/left/input/menu/click",
"/user/hand/left/input/squeeze/value",
"/user/hand/left/input/trigger/value",
"/user/hand/left/input/trigger/touch",
"/user/hand/left/input/thumbrest/touch",
"/user/hand/left/input/thumbstick",
"/user/hand/left/input/thumbstick/click",
"/user/hand/left/input/thumbstick/touch",
"/user/hand/right/input/a/click",
"/user/hand/right/input/a/touch",
"/user/hand/right/input/b/click",
"/user/hand/right/input/b/touch",
"/user/hand/right/input/system/click",
"/user/hand/right/input/squeeze/value",
"/user/hand/right/input/trigger/value",
"/user/hand/right/input/trigger/touch",
"/user/hand/right/input/thumbstick",
"/user/hand/right/input/thumbstick/click",
"/user/hand/right/input/thumbstick/touch",
"/user/hand/right/input/thumbrest/touch",
}},
};
static const std::pair<std::string_view, XrActionType> action_suffixes[] =
@@ -689,7 +728,14 @@ void application::initialize_actions()
}
spdlog::info("Suggesting bindings for interaction profile {}", profile.profile_name);
xr_instance.suggest_bindings(profile.profile_name, xr_bindings);
try
{
xr_instance.suggest_bindings(profile.profile_name, xr_bindings);
}
catch(std::exception& e)
{
spdlog::warn("Caught {} while suggesting interaction profile", e.what());
}
}
xr_session.attach_actionsets(action_sets);
@@ -741,6 +787,19 @@ void application::initialize()
xr_system_id = xr::system(xr_instance, app_info.formfactor);
spdlog::info("Created OpenXR system for form factor {}", xr::to_string(app_info.formfactor));
// Log system properties
XrSystemProperties properties = xr_system_id.properties();
spdlog::info("OpenXR sytem properties:");
spdlog::info(" Vendor ID: {:#x}", properties.vendorId);
spdlog::info(" System name: {}", properties.systemName);
spdlog::info(" Graphics properties:");
spdlog::info(" Maximum swapchain image size: {}x{}", properties.graphicsProperties.maxSwapchainImageWidth, properties.graphicsProperties.maxSwapchainImageWidth);
spdlog::info(" Maximum layer count: {}", properties.graphicsProperties.maxLayerCount);
spdlog::info(" Tracking properties:");
spdlog::info(" Orientation tracking: {}", (bool)properties.trackingProperties.orientationTracking);
spdlog::info(" Position tracking: {}", (bool)properties.trackingProperties.positionTracking);
// Log view configurations and blend modes
log_views();
+16 -2
View File
@@ -46,6 +46,15 @@ model guess_model()
{
#ifdef __ANDROID__
const auto device = get_property("ro.product.device");
const auto manufacturer = get_property("ro.product.manufacturer");
const auto model = get_property("ro.product.model");
spdlog::info("Guessing HMD model from:");
spdlog::info(" ro.product.device = \"{}\":", device);
spdlog::info(" ro.product.manufacturer = \"{}\":", manufacturer);
spdlog::info(" ro.product.model = \"{}\":", model);
if (device == "monterey")
return model::oculus_quest;
if (device == "hollywood")
@@ -54,9 +63,9 @@ model guess_model()
return model::meta_quest_pro;
if (device == "eureka")
return model::meta_quest_3;
if (device == "TBD")
return model::htc_vive_focus_3;
const auto manufacturer = get_property("ro.product.manufacturer");
const auto model = get_property("ro.product.model");
if (manufacturer == "Pico")
{
if (model == "Pico Neo 3")
@@ -108,6 +117,11 @@ XrViewConfigurationView override_view(XrViewConfigurationView view, model m)
view.recommendedImageRectWidth = 2160;
view.recommendedImageRectHeight = 2160;
return view;
case model::htc_vive_focus_3:
spdlog::info("Using panel resolution 2448x2448 for HTC Vive Focus 3");
view.recommendedImageRectWidth = 2448;
view.recommendedImageRectHeight = 2448;
return view;
case model::unknown:
return view;
}
+1
View File
@@ -28,6 +28,7 @@ enum class model
meta_quest_3,
pico_neo_3,
pico_4,
htc_vive_focus_3,
unknown
};
+17
View File
@@ -81,6 +81,8 @@ static std::string choose_webxr_profile()
return "pico-neo3";
case model::pico_4:
return "pico-4";
case model::htc_vive_focus_3:
return "htc-vive-focus-3";
case model::unknown:
return "generic-trigger-squeeze";
}
@@ -955,6 +957,21 @@ scene::meta& scenes::lobby::get_meta_scene()
{"right_haptic", "/user/hand/right/output/haptic"},
}
},
suggested_binding{
"/interaction_profiles/htc/vive_focus3_controller",
{
{"left_aim", "/user/hand/left/input/aim/pose"},
{"left_trigger", "/user/hand/left/input/trigger/value"},
{"left_squeeze", "/user/hand/left/input/squeeze/value"},
{"left_scroll", "/user/hand/left/input/thumbstick"},
{"left_haptic", "/user/hand/left/output/haptic"},
{"right_aim", "/user/hand/right/input/aim/pose"},
{"right_trigger", "/user/hand/right/input/trigger/value"},
{"right_squeeze", "/user/hand/right/input/squeeze/value"},
{"right_scroll", "/user/hand/right/input/thumbstick"},
{"right_haptic", "/user/hand/right/output/haptic"},
}
},
suggested_binding{
"/interaction_profiles/khr/simple_controller",
{
+1 -1
View File
@@ -56,7 +56,7 @@ XrSystemProperties xr::system::properties() const
if (!id)
throw std::invalid_argument("this");
XrSystemProperties prop;
XrSystemProperties prop{.type = XR_TYPE_SYSTEM_PROPERTIES};
CHECK_XR(xrGetSystemProperties(*inst, id, &prop));
return prop;