mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +00:00
OpenXR: Add support for binding modifiers
This commit is contained in:
parent
c2e4ae782a
commit
0a61ebdcea
56 changed files with 3127 additions and 763 deletions
|
@ -287,6 +287,13 @@ void OpenXRInterface::_load_action_map() {
|
|||
if (ip.is_valid()) {
|
||||
openxr_api->interaction_profile_clear_bindings(ip);
|
||||
|
||||
for (Ref<OpenXRBindingModifier> xr_binding_modifier : xr_interaction_profile->get_binding_modifiers()) {
|
||||
PackedByteArray bm = xr_binding_modifier->get_ip_modification();
|
||||
if (!bm.is_empty()) {
|
||||
openxr_api->interaction_profile_add_modifier(ip, bm);
|
||||
}
|
||||
}
|
||||
|
||||
Array xr_bindings = xr_interaction_profile->get_bindings();
|
||||
for (int j = 0; j < xr_bindings.size(); j++) {
|
||||
Ref<OpenXRIPBinding> xr_binding = xr_bindings[j];
|
||||
|
@ -300,7 +307,18 @@ void OpenXRInterface::_load_action_map() {
|
|||
continue;
|
||||
}
|
||||
|
||||
openxr_api->interaction_profile_add_binding(ip, action->action_rid, xr_binding->get_binding_path());
|
||||
int binding_no = openxr_api->interaction_profile_add_binding(ip, action->action_rid, xr_binding->get_binding_path());
|
||||
if (binding_no >= 0) {
|
||||
for (Ref<OpenXRBindingModifier> xr_binding_modifier : xr_binding->get_binding_modifiers()) {
|
||||
// Binding modifiers on bindings can be added to the interaction profile.
|
||||
PackedByteArray bm = xr_binding_modifier->get_ip_modification();
|
||||
if (!bm.is_empty()) {
|
||||
openxr_api->interaction_profile_add_modifier(ip, bm);
|
||||
}
|
||||
|
||||
// And possibly in the future on the binding itself, we're just preparing for that eventuality.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Now submit our suggestions
|
||||
|
@ -593,8 +611,8 @@ void OpenXRInterface::free_trackers() {
|
|||
void OpenXRInterface::free_interaction_profiles() {
|
||||
ERR_FAIL_NULL(openxr_api);
|
||||
|
||||
for (int i = 0; i < interaction_profiles.size(); i++) {
|
||||
openxr_api->interaction_profile_free(interaction_profiles[i]);
|
||||
for (const RID &interaction_profile : interaction_profiles) {
|
||||
openxr_api->interaction_profile_free(interaction_profile);
|
||||
}
|
||||
interaction_profiles.clear();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue