summaryrefslogtreecommitdiff
path: root/servers/xr
diff options
context:
space:
mode:
Diffstat (limited to 'servers/xr')
-rw-r--r--servers/xr/xr_interface.h2
-rw-r--r--servers/xr/xr_positional_tracker.cpp34
-rw-r--r--servers/xr/xr_positional_tracker.h13
3 files changed, 22 insertions, 27 deletions
diff --git a/servers/xr/xr_interface.h b/servers/xr/xr_interface.h
index 6e105ffc26..62eba2f00b 100644
--- a/servers/xr/xr_interface.h
+++ b/servers/xr/xr_interface.h
@@ -45,7 +45,7 @@ struct BlitToScreen;
If the user wants to enable AR/VR the choose the interface they want to use and initialize it.
- Note that we may make this into a fully instantiable class for GDNative support.
+ Note that we may make this into a fully instantiable class for GDExtension support.
*/
class XRInterface : public RefCounted {
diff --git a/servers/xr/xr_positional_tracker.cpp b/servers/xr/xr_positional_tracker.cpp
index 7b21eeba04..4857167a8e 100644
--- a/servers/xr/xr_positional_tracker.cpp
+++ b/servers/xr/xr_positional_tracker.cpp
@@ -49,6 +49,10 @@ void XRPositionalTracker::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_tracker_desc", "description"), &XRPositionalTracker::set_tracker_desc);
ADD_PROPERTY(PropertyInfo(Variant::STRING, "description"), "set_tracker_desc", "get_tracker_desc");
+ ClassDB::bind_method(D_METHOD("get_tracker_profile"), &XRPositionalTracker::get_tracker_profile);
+ ClassDB::bind_method(D_METHOD("set_tracker_profile", "profile"), &XRPositionalTracker::set_tracker_profile);
+ ADD_PROPERTY(PropertyInfo(Variant::STRING, "profile"), "set_tracker_profile", "get_tracker_profile");
+
ClassDB::bind_method(D_METHOD("get_tracker_hand"), &XRPositionalTracker::get_tracker_hand);
ClassDB::bind_method(D_METHOD("set_tracker_hand", "hand"), &XRPositionalTracker::set_tracker_hand);
ADD_PROPERTY(PropertyInfo(Variant::INT, "hand", PROPERTY_HINT_ENUM, "Unknown,Left,Right"), "set_tracker_hand", "get_tracker_hand");
@@ -65,10 +69,7 @@ void XRPositionalTracker::_bind_methods() {
ADD_SIGNAL(MethodInfo("button_released", PropertyInfo(Variant::STRING, "name")));
ADD_SIGNAL(MethodInfo("input_value_changed", PropertyInfo(Variant::STRING, "name"), PropertyInfo(Variant::FLOAT, "value")));
ADD_SIGNAL(MethodInfo("input_axis_changed", PropertyInfo(Variant::STRING, "name"), PropertyInfo(Variant::VECTOR2, "vector")));
-
- ClassDB::bind_method(D_METHOD("get_rumble"), &XRPositionalTracker::get_rumble);
- ClassDB::bind_method(D_METHOD("set_rumble", "rumble"), &XRPositionalTracker::set_rumble);
- ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "rumble"), "set_rumble", "get_rumble");
+ ADD_SIGNAL(MethodInfo("profile_changed", PropertyInfo(Variant::STRING, "role")));
};
void XRPositionalTracker::set_tracker_type(XRServer::TrackerType p_type) {
@@ -99,6 +100,18 @@ String XRPositionalTracker::get_tracker_desc() const {
return description;
}
+void XRPositionalTracker::set_tracker_profile(const String &p_profile) {
+ if (profile != p_profile) {
+ profile = p_profile;
+
+ emit_signal("profile_changed", profile);
+ }
+}
+
+String XRPositionalTracker::get_tracker_profile() const {
+ return profile;
+}
+
XRPositionalTracker::TrackerHand XRPositionalTracker::get_tracker_hand() const {
return hand;
};
@@ -206,21 +219,8 @@ void XRPositionalTracker::set_input(const StringName &p_action_name, const Varia
}
}
-real_t XRPositionalTracker::get_rumble() const {
- return rumble;
-};
-
-void XRPositionalTracker::set_rumble(real_t p_rumble) {
- if (p_rumble > 0.0) {
- rumble = p_rumble;
- } else {
- rumble = 0.0;
- };
-};
-
XRPositionalTracker::XRPositionalTracker() {
type = XRServer::TRACKER_UNKNOWN;
name = "Unknown";
hand = TRACKER_HAND_UNKNOWN;
- rumble = 0.0;
};
diff --git a/servers/xr/xr_positional_tracker.h b/servers/xr/xr_positional_tracker.h
index 2f358cbb21..cd06d4a087 100644
--- a/servers/xr/xr_positional_tracker.h
+++ b/servers/xr/xr_positional_tracker.h
@@ -56,16 +56,13 @@ public:
private:
XRServer::TrackerType type; // type of tracker
StringName name; // (unique) name of the tracker
- String description; // description of the tracker, this is interface dependent, for OpenXR this will be the interaction profile bound for to the tracker
+ String description; // description of the tracker
+ String profile; // this is interface dependent, for OpenXR this will be the interaction profile bound for to the tracker
TrackerHand hand; // if known, the hand this tracker is held in
Map<StringName, Ref<XRPose>> poses;
Map<StringName, Variant> inputs;
- int joy_id; // if we also have a related joystick entity, the id of the joystick
- Ref<Mesh> mesh; // when available, a mesh that can be used to render this tracker
- real_t rumble; // rumble strength, 0.0 is off, 1.0 is maximum, note that we only record here, xr_interface is responsible for execution
-
protected:
static void _bind_methods();
@@ -76,6 +73,8 @@ public:
StringName get_tracker_name() const;
void set_tracker_desc(const String &p_desc);
String get_tracker_desc() const;
+ void set_tracker_profile(const String &p_profile);
+ String get_tracker_profile() const;
XRPositionalTracker::TrackerHand get_tracker_hand() const;
void set_tracker_hand(const XRPositionalTracker::TrackerHand p_hand);
@@ -87,10 +86,6 @@ public:
Variant get_input(const StringName &p_action_name) const;
void set_input(const StringName &p_action_name, const Variant &p_value);
- // TODO replace by new implementation
- real_t get_rumble() const;
- void set_rumble(real_t p_rumble);
-
XRPositionalTracker();
~XRPositionalTracker() {}
};