diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 89edf5ce..dac3ca06 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -38,6 +38,9 @@ + + + - + + + + + + + + + @@ -75,6 +86,7 @@ + diff --git a/assets/controllers/generic-trigger-squeeze/left.glb b/assets/controllers/generic-trigger-squeeze/left.glb old mode 100755 new mode 100644 diff --git a/assets/controllers/generic-trigger-squeeze/none.glb b/assets/controllers/generic-trigger-squeeze/none.glb old mode 100755 new mode 100644 diff --git a/assets/controllers/generic-trigger-squeeze/profile.json b/assets/controllers/generic-trigger-squeeze/profile.json old mode 100755 new mode 100644 diff --git a/assets/controllers/generic-trigger-squeeze/right.glb b/assets/controllers/generic-trigger-squeeze/right.glb old mode 100755 new mode 100644 diff --git a/assets/controllers/htc-vive-focus-3/left.glb b/assets/controllers/htc-vive-focus-3/left.glb new file mode 100644 index 00000000..5b394fbc Binary files /dev/null and b/assets/controllers/htc-vive-focus-3/left.glb differ diff --git a/assets/controllers/htc-vive-focus-3/profile.json b/assets/controllers/htc-vive-focus-3/profile.json new file mode 100644 index 00000000..1fe79b34 --- /dev/null +++ b/assets/controllers/htc-vive-focus-3/profile.json @@ -0,0 +1,286 @@ +{ + "profileId": "htc-vive-focus-3", + "fallbackProfileIds": [ + "generic-trigger-squeeze-thumbstick" + ], + "layouts": { + "left": { + "selectComponentId": "xr-standard-trigger", + "components": { + "xr-standard-trigger": { + "type": "trigger", + "gamepadIndices": { + "button": 0 + }, + "rootNodeName": "xr_standard_trigger", + "visualResponses": { + "xr_standard_trigger_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_trigger_pressed_value", + "minNodeName": "xr_standard_trigger_pressed_min", + "maxNodeName": "xr_standard_trigger_pressed_max" + } + } + }, + "xr-standard-squeeze": { + "type": "squeeze", + "gamepadIndices": { + "button": 1 + }, + "rootNodeName": "xr_standard_squeeze", + "visualResponses": { + "xr_standard_squeeze_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_squeeze_pressed_value", + "minNodeName": "xr_standard_squeeze_pressed_min", + "maxNodeName": "xr_standard_squeeze_pressed_max" + } + } + }, + "xr-standard-thumbstick": { + "type": "thumbstick", + "gamepadIndices": { + "button": 3, + "xAxis": 2, + "yAxis": 3 + }, + "rootNodeName": "xr_standard_thumbstick", + "visualResponses": { + "xr_standard_thumbstick_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_pressed_value", + "minNodeName": "xr_standard_thumbstick_pressed_min", + "maxNodeName": "xr_standard_thumbstick_pressed_max" + }, + "xr_standard_thumbstick_xaxis_pressed": { + "componentProperty": "xAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_xaxis_pressed_value", + "minNodeName": "xr_standard_thumbstick_xaxis_pressed_min", + "maxNodeName": "xr_standard_thumbstick_xaxis_pressed_max" + }, + "xr_standard_thumbstick_yaxis_pressed": { + "componentProperty": "yAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_yaxis_pressed_value", + "minNodeName": "xr_standard_thumbstick_yaxis_pressed_min", + "maxNodeName": "xr_standard_thumbstick_yaxis_pressed_max" + } + } + }, + "x-button": { + "type": "button", + "gamepadIndices": { + "button": 4 + }, + "rootNodeName": "x_button", + "visualResponses": { + "x_button_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "x_button_pressed_value", + "minNodeName": "x_button_pressed_min", + "maxNodeName": "x_button_pressed_max" + } + } + }, + "y-button": { + "type": "button", + "gamepadIndices": { + "button": 5 + }, + "rootNodeName": "y_button", + "visualResponses": { + "y_button_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "y_button_pressed_value", + "minNodeName": "y_button_pressed_min", + "maxNodeName": "y_button_pressed_max" + } + } + } + }, + "gamepadMapping": "xr-standard", + "rootNodeName": "htc-vive-focus-3-left", + "assetPath": "left.glb" + }, + "right": { + "selectComponentId": "xr-standard-trigger", + "components": { + "xr-standard-trigger": { + "type": "trigger", + "gamepadIndices": { + "button": 0 + }, + "rootNodeName": "xr_standard_trigger", + "visualResponses": { + "xr_standard_trigger_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_trigger_pressed_value", + "minNodeName": "xr_standard_trigger_pressed_min", + "maxNodeName": "xr_standard_trigger_pressed_max" + } + } + }, + "xr-standard-squeeze": { + "type": "squeeze", + "gamepadIndices": { + "button": 1 + }, + "rootNodeName": "xr_standard_squeeze", + "visualResponses": { + "xr_standard_squeeze_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_squeeze_pressed_value", + "minNodeName": "xr_standard_squeeze_pressed_min", + "maxNodeName": "xr_standard_squeeze_pressed_max" + } + } + }, + "xr-standard-thumbstick": { + "type": "thumbstick", + "gamepadIndices": { + "button": 3, + "xAxis": 2, + "yAxis": 3 + }, + "rootNodeName": "xr_standard_thumbstick", + "visualResponses": { + "xr_standard_thumbstick_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_pressed_value", + "minNodeName": "xr_standard_thumbstick_pressed_min", + "maxNodeName": "xr_standard_thumbstick_pressed_max" + }, + "xr_standard_thumbstick_xaxis_pressed": { + "componentProperty": "xAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_xaxis_pressed_value", + "minNodeName": "xr_standard_thumbstick_xaxis_pressed_min", + "maxNodeName": "xr_standard_thumbstick_xaxis_pressed_max" + }, + "xr_standard_thumbstick_yaxis_pressed": { + "componentProperty": "yAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_yaxis_pressed_value", + "minNodeName": "xr_standard_thumbstick_yaxis_pressed_min", + "maxNodeName": "xr_standard_thumbstick_yaxis_pressed_max" + } + } + }, + "a-button": { + "type": "button", + "gamepadIndices": { + "button": 4 + }, + "rootNodeName": "a_button", + "visualResponses": { + "a_button_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "a_button_pressed_value", + "minNodeName": "a_button_pressed_min", + "maxNodeName": "a_button_pressed_max" + } + } + }, + "b-button": { + "type": "button", + "gamepadIndices": { + "button": 5 + }, + "rootNodeName": "b_button", + "visualResponses": { + "b_button_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "b_button_pressed_value", + "minNodeName": "b_button_pressed_min", + "maxNodeName": "b_button_pressed_max" + } + } + } + }, + "gamepadMapping": "xr-standard", + "rootNodeName": "htc-vive-focus-3-right", + "assetPath": "right.glb" + } + } +} \ No newline at end of file diff --git a/assets/controllers/htc-vive-focus-3/right.glb b/assets/controllers/htc-vive-focus-3/right.glb new file mode 100644 index 00000000..1efd1d2b Binary files /dev/null and b/assets/controllers/htc-vive-focus-3/right.glb differ diff --git a/client/application.cpp b/client/application.cpp index 89684423..358a171c 100644 --- a/client/application.cpp +++ b/client/application.cpp @@ -73,7 +73,7 @@ struct interaction_profile static std::vector 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_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_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_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_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 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(); diff --git a/client/hardware.cpp b/client/hardware.cpp index 9caf0cab..84f8aea9 100644 --- a/client/hardware.cpp +++ b/client/hardware.cpp @@ -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; } diff --git a/client/hardware.h b/client/hardware.h index e6fb715c..15fc5523 100644 --- a/client/hardware.h +++ b/client/hardware.h @@ -28,6 +28,7 @@ enum class model meta_quest_3, pico_neo_3, pico_4, + htc_vive_focus_3, unknown }; diff --git a/client/scenes/lobby.cpp b/client/scenes/lobby.cpp index 764ce984..dc2ecb19 100644 --- a/client/scenes/lobby.cpp +++ b/client/scenes/lobby.cpp @@ -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", { diff --git a/client/xr/system.cpp b/client/xr/system.cpp index 57add2e8..7ac6ecb2 100644 --- a/client/xr/system.cpp +++ b/client/xr/system.cpp @@ -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;