| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
#pragma once |
| 32 |
|
| 33 |
#include "../action_map/openxr_action_set.h" |
| 34 |
#include "../action_map/openxr_binding_modifier.h" |
| 35 |
#include "../action_map/openxr_haptic_feedback.h" |
| 36 |
#include "../util.h" |
| 37 |
#include "openxr_extension_wrapper.h" |
| 38 |
|
| 39 |
class OpenXRDPadBindingExtension : public OpenXRExtensionWrapper { |
| 40 |
GDCLASS(OpenXRDPadBindingExtension, OpenXRExtensionWrapper); |
| 41 |
|
| 42 |
protected: |
| 43 |
static void _bind_methods() {} |
| 44 |
|
| 45 |
public: |
| 46 |
static OpenXRDPadBindingExtension *get_singleton(); |
| 47 |
|
| 48 |
OpenXRDPadBindingExtension(); |
| 49 |
virtual ~OpenXRDPadBindingExtension() override; |
| 50 |
|
| 51 |
virtual HashMap<String, bool *> get_requested_extensions(XrVersion p_version) override; |
| 52 |
|
| 53 |
bool is_available(); |
| 54 |
|
| 55 |
private: |
| 56 |
static OpenXRDPadBindingExtension *singleton; |
| 57 |
|
| 58 |
bool binding_modifier_ext = false; |
| 59 |
bool dpad_binding_ext = false; |
| 60 |
}; |
| 61 |
|
| 62 |
class OpenXRDpadBindingModifier : public OpenXRIPBindingModifier { |
| 63 |
GDCLASS(OpenXRDpadBindingModifier, OpenXRIPBindingModifier); |
| 64 |
|
| 65 |
private: |
| 66 |
PackedByteArray dpad_bindings_data; |
| 67 |
XrInteractionProfileDpadBindingEXT *dpad_bindings = nullptr; |
| 68 |
String input_path; |
| 69 |
Ref<OpenXRActionSet> action_set; |
| 70 |
Ref<OpenXRHapticBase> on_haptic; |
| 71 |
Ref<OpenXRHapticBase> off_haptic; |
| 72 |
|
| 73 |
protected: |
| 74 |
static void _bind_methods(); |
| 75 |
|
| 76 |
public: |
| 77 |
OpenXRDpadBindingModifier(); |
| 78 |
|
| 79 |
void set_action_set(const Ref<OpenXRActionSet> &p_action_set); |
| 80 |
Ref<OpenXRActionSet> get_action_set() const; |
| 81 |
|
| 82 |
void set_input_path(const String &p_input_path); |
| 83 |
String get_input_path() const; |
| 84 |
|
| 85 |
void set_threshold(float p_threshold); |
| 86 |
float get_threshold() const; |
| 87 |
|
| 88 |
void set_threshold_released(float p_threshold); |
| 89 |
float get_threshold_released() const; |
| 90 |
|
| 91 |
void set_center_region(float p_center_region); |
| 92 |
float get_center_region() const; |
| 93 |
|
| 94 |
void set_wedge_angle(float p_wedge_angle); |
| 95 |
float get_wedge_angle() const; |
| 96 |
|
| 97 |
void set_wedge_angle_deg(float p_wedge_angle); |
| 98 |
float get_wedge_angle_deg() const; |
| 99 |
|
| 100 |
void set_is_sticky(bool p_sticky); |
| 101 |
bool get_is_sticky() const; |
| 102 |
|
| 103 |
void set_on_haptic(const Ref<OpenXRHapticBase> &p_haptic); |
| 104 |
Ref<OpenXRHapticBase> get_on_haptic() const; |
| 105 |
|
| 106 |
void set_off_haptic(const Ref<OpenXRHapticBase> &p_haptic); |
| 107 |
Ref<OpenXRHapticBase> get_off_haptic() const; |
| 108 |
|
| 109 |
virtual String get_description() const override { return "DPad modifier"; } |
| 110 |
virtual PackedByteArray get_ip_modification() override; |
| 111 |
}; |