You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-08 12:40:44 +00:00
Add support for OpenXR hand interaction extension
This commit is contained in:
@@ -35,6 +35,7 @@
|
||||
#include "servers/rendering/rendering_server_globals.h"
|
||||
|
||||
#include "extensions/openxr_eye_gaze_interaction.h"
|
||||
#include "extensions/openxr_hand_interaction_extension.h"
|
||||
#include "thirdparty/openxr/include/openxr/openxr.h"
|
||||
|
||||
void OpenXRInterface::_bind_methods() {
|
||||
@@ -93,6 +94,7 @@ void OpenXRInterface::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_hand_joint_angular_velocity", "hand", "joint"), &OpenXRInterface::get_hand_joint_angular_velocity);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("is_hand_tracking_supported"), &OpenXRInterface::is_hand_tracking_supported);
|
||||
ClassDB::bind_method(D_METHOD("is_hand_interaction_supported"), &OpenXRInterface::is_hand_interaction_supported);
|
||||
ClassDB::bind_method(D_METHOD("is_eye_gaze_interaction_supported"), &OpenXRInterface::is_eye_gaze_interaction_supported);
|
||||
|
||||
BIND_ENUM_CONSTANT(HAND_LEFT);
|
||||
@@ -808,6 +810,21 @@ bool OpenXRInterface::is_hand_tracking_supported() {
|
||||
}
|
||||
}
|
||||
|
||||
bool OpenXRInterface::is_hand_interaction_supported() const {
|
||||
if (openxr_api == nullptr) {
|
||||
return false;
|
||||
} else if (!openxr_api->is_initialized()) {
|
||||
return false;
|
||||
} else {
|
||||
OpenXRHandInteractionExtension *hand_interaction_ext = OpenXRHandInteractionExtension::get_singleton();
|
||||
if (hand_interaction_ext == nullptr) {
|
||||
return false;
|
||||
} else {
|
||||
return hand_interaction_ext->is_available();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool OpenXRInterface::is_eye_gaze_interaction_supported() {
|
||||
if (openxr_api == nullptr) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user