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.h51
1 files changed, 21 insertions, 30 deletions
diff --git a/servers/xr/xr_positional_tracker.h b/servers/xr/xr_positional_tracker.h
index 5577582929..8371dfcbb5 100644
--- a/servers/xr/xr_positional_tracker.h
+++ b/servers/xr/xr_positional_tracker.h
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -33,11 +33,10 @@
#include "core/os/thread_safe.h"
#include "scene/resources/mesh.h"
+#include "servers/xr/xr_pose.h"
#include "servers/xr_server.h"
/**
- @author Bastiaan Olij <mux213@gmail.com>
-
The positional tracker object as an object that represents the position and orientation of a tracked object like a controller or headset.
An AR/VR Interface will registered the trackers it manages with our AR/VR server and update its position and orientation.
This is where potentially additional AR/VR interfaces may be active as there are AR/VR SDKs that solely deal with positional tracking.
@@ -57,15 +56,12 @@ 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
- 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
+ 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
- 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
+
+ HashMap<StringName, Ref<XRPose>> poses;
+ HashMap<StringName, Variant> inputs;
protected:
static void _bind_methods();
@@ -73,27 +69,22 @@ 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;
+ 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);
- 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;
+ 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, const XRPose::TrackingConfidence p_tracking_confidence = XRPose::XR_TRACKING_CONFIDENCE_HIGH);
+
+ Variant get_input(const StringName &p_action_name) const;
+ void set_input(const StringName &p_action_name, const Variant &p_value);
XRPositionalTracker();
~XRPositionalTracker() {}
@@ -101,4 +92,4 @@ public:
VARIANT_ENUM_CAST(XRPositionalTracker::TrackerHand);
-#endif
+#endif // XR_POSITIONAL_TRACKER_H