summaryrefslogtreecommitdiff
path: root/servers/xr/xr_positional_tracker.h
diff options
context:
space:
mode:
Diffstat (limited to 'servers/xr/xr_positional_tracker.h')
-rw-r--r--servers/xr/xr_positional_tracker.h42
1 files changed, 20 insertions, 22 deletions
diff --git a/servers/xr/xr_positional_tracker.h b/servers/xr/xr_positional_tracker.h
index 5577582929..69eb105b5a 100644
--- a/servers/xr/xr_positional_tracker.h
+++ b/servers/xr/xr_positional_tracker.h
@@ -33,6 +33,7 @@
#include "core/os/thread_safe.h"
#include "scene/resources/mesh.h"
+#include "servers/xr/xr_pose.h"
#include "servers/xr_server.h"
/**
@@ -57,14 +58,14 @@ public:
private:
XRServer::TrackerType type; // type of tracker
StringName name; // (unique) name of the tracker
- int tracker_id; // tracker index id that is unique per type
+ String description; // description of the tracker, 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
- bool tracking_orientation; // do we track orientation?
- Basis orientation; // our orientation
- bool tracking_position; // do we track position?
- Vector3 rw_position; // our position "in the real world, so without world_scale applied"
Ref<Mesh> mesh; // when available, a mesh that can be used to render this tracker
- TrackerHand hand; // if known, the hand this tracker is held in
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:
@@ -73,27 +74,24 @@ protected:
public:
void set_tracker_type(XRServer::TrackerType p_type);
XRServer::TrackerType get_tracker_type() const;
- void set_tracker_name(const String &p_name);
+ void set_tracker_name(const StringName &p_name);
StringName get_tracker_name() const;
- int get_tracker_id() const;
- void set_joy_id(int p_joy_id);
- int get_joy_id() const;
- bool is_tracking_orientation() const;
- void set_orientation(const Basis &p_orientation);
- Basis get_orientation() const;
- bool is_tracking_position() const;
- void set_position(const Vector3 &p_position); // set position with world_scale applied
- Vector3 get_position() const; // get position with world_scale applied
- void set_rw_position(const Vector3 &p_rw_position);
- Vector3 get_rw_position() const;
+ void set_tracker_desc(const String &p_desc);
+ String get_tracker_desc() const;
XRPositionalTracker::TrackerHand get_tracker_hand() const;
void set_tracker_hand(const XRPositionalTracker::TrackerHand p_hand);
+
+ bool has_pose(const StringName &p_action_name) const;
+ Ref<XRPose> get_pose(const StringName &p_action_name) const;
+ void invalidate_pose(const StringName &p_action_name);
+ void set_pose(const StringName &p_action_name, const Transform3D &p_transform, const Vector3 &p_linear_velocity, const Vector3 &p_angular_velocity);
+
+ 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);
- void set_mesh(const Ref<Mesh> &p_mesh);
- Ref<Mesh> get_mesh() const;
-
- Transform3D get_transform(bool p_adjust_by_reference_frame) const;
XRPositionalTracker();
~XRPositionalTracker() {}