expose OpenXR hand tracker handles
This commit is contained in:
parent
fb10e67fef
commit
74413f5609
|
@ -30,6 +30,13 @@
|
|||
Returns an error string for the given [url=https://registry.khronos.org/OpenXR/specs/1.0/man/html/XrResult.html]XrResult[/url].
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_hand_tracker">
|
||||
<return type="int" />
|
||||
<param index="0" name="hand_index" type="int" />
|
||||
<description>
|
||||
Returns the corresponding [code]XRHandTrackerEXT[/code] handle for the given hand index value.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_instance">
|
||||
<return type="int" />
|
||||
<description>
|
||||
|
|
|
@ -57,6 +57,7 @@
|
|||
#include "extensions/openxr_fb_display_refresh_rate_extension.h"
|
||||
#include "extensions/openxr_fb_foveation_extension.h"
|
||||
#include "extensions/openxr_fb_update_swapchain_extension.h"
|
||||
#include "extensions/openxr_hand_tracking_extension.h"
|
||||
|
||||
#ifdef ANDROID_ENABLED
|
||||
#define OPENXR_LOADER_NAME "libopenxr_loader.so"
|
||||
|
@ -1536,6 +1537,12 @@ void OpenXRAPI::cleanup_extension_wrappers() {
|
|||
registered_extension_wrappers.clear();
|
||||
}
|
||||
|
||||
XrHandTrackerEXT OpenXRAPI::get_hand_tracker(int p_hand_index) {
|
||||
ERR_FAIL_INDEX_V(p_hand_index, OpenXRHandTrackingExtension::HandTrackedHands::OPENXR_MAX_TRACKED_HANDS, XR_NULL_HANDLE);
|
||||
OpenXRHandTrackingExtension::HandTrackedHands hand = static_cast<OpenXRHandTrackingExtension::HandTrackedHands>(p_hand_index);
|
||||
return OpenXRHandTrackingExtension::get_singleton()->get_hand_tracker(hand)->hand_tracker;
|
||||
}
|
||||
|
||||
Size2 OpenXRAPI::get_recommended_target_size() {
|
||||
ERR_FAIL_NULL_V(view_configuration_views, Size2());
|
||||
|
||||
|
|
|
@ -359,6 +359,8 @@ public:
|
|||
XrTime get_next_frame_time() { return frame_state.predictedDisplayTime + frame_state.predictedDisplayPeriod; }
|
||||
bool can_render() { return instance != XR_NULL_HANDLE && session != XR_NULL_HANDLE && running && view_pose_valid && frame_state.shouldRender; }
|
||||
|
||||
XrHandTrackerEXT get_hand_tracker(int p_hand_index);
|
||||
|
||||
Size2 get_recommended_target_size();
|
||||
XRPose::TrackingConfidence get_head_center(Transform3D &r_transform, Vector3 &r_linear_velocity, Vector3 &r_angular_velocity);
|
||||
bool get_view_transform(uint32_t p_view, Transform3D &r_transform);
|
||||
|
|
|
@ -51,6 +51,8 @@ void OpenXRAPIExtension::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("get_next_frame_time"), &OpenXRAPIExtension::get_next_frame_time);
|
||||
ClassDB::bind_method(D_METHOD("can_render"), &OpenXRAPIExtension::can_render);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_hand_tracker", "hand_index"), &OpenXRAPIExtension::get_hand_tracker);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("register_composition_layer_provider", "extension"), &OpenXRAPIExtension::register_composition_layer_provider);
|
||||
ClassDB::bind_method(D_METHOD("unregister_composition_layer_provider", "extension"), &OpenXRAPIExtension::unregister_composition_layer_provider);
|
||||
|
||||
|
@ -138,6 +140,11 @@ bool OpenXRAPIExtension::can_render() {
|
|||
return OpenXRAPI::get_singleton()->can_render();
|
||||
}
|
||||
|
||||
uint64_t OpenXRAPIExtension::get_hand_tracker(int p_hand_index) {
|
||||
ERR_FAIL_NULL_V(OpenXRAPI::get_singleton(), 0);
|
||||
return (uint64_t)OpenXRAPI::get_singleton()->get_hand_tracker(p_hand_index);
|
||||
}
|
||||
|
||||
void OpenXRAPIExtension::register_composition_layer_provider(OpenXRExtensionWrapperExtension *p_extension) {
|
||||
ERR_FAIL_NULL(OpenXRAPI::get_singleton());
|
||||
OpenXRAPI::get_singleton()->register_composition_layer_provider(p_extension);
|
||||
|
|
|
@ -72,6 +72,8 @@ public:
|
|||
int64_t get_next_frame_time();
|
||||
bool can_render();
|
||||
|
||||
uint64_t get_hand_tracker(int p_hand_index);
|
||||
|
||||
void register_composition_layer_provider(OpenXRExtensionWrapperExtension *p_extension);
|
||||
void unregister_composition_layer_provider(OpenXRExtensionWrapperExtension *p_extension);
|
||||
|
||||
|
|
Loading…
Reference in New Issue