1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-05 12:10:55 +00:00

Added missing interaction profiles and making sure related extensions are enabled if available

This commit is contained in:
Bastiaan Olij
2022-04-06 23:00:26 +10:00
parent 338b23d572
commit f8dab282cb
6 changed files with 305 additions and 22 deletions

View File

@@ -172,11 +172,18 @@ bool OpenXRAPI::load_supported_extensions() {
bool OpenXRAPI::is_extension_supported(const char *p_extension) const {
for (uint32_t i = 0; i < num_supported_extensions; i++) {
if (strcmp(supported_extensions[i].extensionName, p_extension)) {
if (strcmp(supported_extensions[i].extensionName, p_extension) == 0) {
#ifdef DEBUG
print_line("OpenXR: requested extension", p_extension, "is supported");
#endif
return true;
}
}
#ifdef DEBUG
print_line("OpenXR: requested extension", p_extension, "is not supported");
#endif
return false;
}
@@ -207,6 +214,14 @@ bool OpenXRAPI::create_instance() {
}
}
// Add optional extensions for controllers that may be supported.
// Overkill to create extension classes for this.
requested_extensions[XR_EXT_HP_MIXED_REALITY_CONTROLLER_EXTENSION_NAME] = &ext_hp_mixed_reality_available;
requested_extensions[XR_EXT_SAMSUNG_ODYSSEY_CONTROLLER_EXTENSION_NAME] = &ext_samsung_odyssey_available;
requested_extensions[XR_HTC_VIVE_COSMOS_CONTROLLER_INTERACTION_EXTENSION_NAME] = &ext_vive_cosmos_available;
requested_extensions[XR_HTC_VIVE_FOCUS3_CONTROLLER_INTERACTION_EXTENSION_NAME] = &ext_vive_focus3_available;
requested_extensions[XR_HUAWEI_CONTROLLER_INTERACTION_EXTENSION_NAME] = &ext_huawei_controller_available;
// Check which extensions are supported
enabled_extensions.clear();
for (auto &requested_extension : requested_extensions) {