13#include <unordered_map>
15#include <condition_variable>
21#include "openvr_driver.h"
28 std::shared_ptr<Context> ctx;
29 vr::ITrackedDeviceServerDriver *driver;
31 const std::string &steam_install;
48 get_input_from_name(std::string_view
name);
54 update_pose(
const vr::DriverPose_t &newPose)
const;
61 handle_properties(
const vr::PropertyWrite_t *batch, uint32_t count);
69 std::shared_ptr<Context> ctx;
70 vr::PropertyContainerHandle_t container_handle{0};
71 std::unordered_map<std::string_view, xrt_input *> inputs_map;
72 std::vector<xrt_input> inputs_vec;
73 inline static xrt_pose chaperone = XRT_POSE_IDENTITY;
76 float vsync_to_photon_ns{0.f};
79 handle_property_write(
const vr::PropertyWrite_t &prop) = 0;
82 set_input_class(
const InputClass *input_class);
85 vr::ITrackedDeviceServerDriver *driver;
86 uint64_t current_frame{0};
88 std::mutex frame_mutex;
91 init_chaperone(
const std::string &steam_install);
102 vr::IVRDisplayComponent *display;
111 SetDisplayEyeToHead(uint32_t unWhichDevice,
112 const vr::HmdMatrix34_t &eyeToHeadLeft,
113 const vr::HmdMatrix34_t &eyeToHeadRight);
117 uint64_t at_timestamp_ns,
127 set_hmd_parts(std::unique_ptr<Parts> parts);
136 std::unique_ptr<Parts> hmd_parts{
nullptr};
139 handle_property_write(
const vr::PropertyWrite_t &prop)
override;
142 set_nominal_frame_interval(uint64_t interval_ns);
144 std::condition_variable hmd_parts_cv;
145 std::mutex hmd_parts_mut;
152 set_input_class(
const InputClass *input_class);
161 set_haptic_handle(vr::VRInputComponentHandle_t handle);
167 get_finger_from_name(std::string_view
name);
171 uint64_t desired_timestamp_ns,
173 uint64_t *out_timestamp_ns);
182 vr::VRInputComponentHandle_t haptic_handle{0};
183 std::unique_ptr<xrt_output> output{
nullptr};
184 bool has_index_hand_tracking{
false};
185 std::vector<IndexFingerInput> finger_inputs_vec;
186 std::unordered_map<std::string_view, IndexFingerInput *> finger_inputs_map;
187 uint64_t hand_tracking_timestamp;
193 handle_property_write(
const vr::PropertyWrite_t &prop)
override;
Definition: context.hpp:57
Definition: device.hpp:149
Definition: device.hpp:40
void get_pose(uint64_t at_timestamp_ns, xrt_space_relation *out_relation)
Helper to use the m_relation_history member.
Definition: device.cpp:429
void update_inputs()
Update any attached inputs.
Definition: device.cpp:397
virtual void get_tracked_pose(xrt_input_name name, uint64_t at_timestamp_ns, xrt_space_relation *out_relation)=0
Maps to xrt_device::get_tracked_pose.
Definition: device.hpp:95
SteamVR driver context - implements xrt_tracking_origin and IVRDriverContext.
xrt_hand
Enumeration for left and right hand.
Definition: xrt_defines.h:1190
xrt_input_name
Every internal input source known to monado with a baked in type.
Definition: xrt_defines.h:1134
xrt_output_name
Name of a output with a baked in type.
Definition: xrt_defines.h:1388
Small utility for keeping track of the history of an xrt_space_relation, ie.
Definition: device.hpp:27
Definition: device.hpp:100
Definition: m_relation_history.cpp:46
A single HMD or input device.
Definition: xrt_device.h:230
void(* set_output)(struct xrt_device *xdev, enum xrt_output_name name, const union xrt_output_value *value)
Set a output value.
Definition: xrt_device.h:365
void(* get_view_poses)(struct xrt_device *xdev, const struct xrt_vec3 *default_eye_relation, uint64_t at_timestamp_ns, uint32_t view_count, struct xrt_space_relation *out_head_relation, struct xrt_fov *out_fovs, struct xrt_pose *out_poses)
Get the per-view pose in relation to the view space.
Definition: xrt_device.h:404
void(* get_tracked_pose)(struct xrt_device *xdev, enum xrt_input_name name, uint64_t at_timestamp_ns, struct xrt_space_relation *out_relation)
Get relationship of a tracked device to the tracking origin space as the base space.
Definition: xrt_device.h:309
enum xrt_device_name name
Enum identifier of the device.
Definition: xrt_device.h:232
bool(* compute_distortion)(struct xrt_device *xdev, uint32_t view, float u, float v, struct xrt_uv_triplet *out_result)
Compute the distortion at a single point.
Definition: xrt_device.h:426
void(* get_hand_tracking)(struct xrt_device *xdev, enum xrt_input_name name, uint64_t desired_timestamp_ns, struct xrt_hand_joint_set *out_value, uint64_t *out_timestamp_ns)
Get relationship of hand joints to the tracking origin space as the base space.
Definition: xrt_device.h:337
Describes a projection matrix fov.
Definition: xrt_defines.h:486
Joint set type used for hand tracking.
Definition: xrt_defines.h:1233
All of the device components that deals with interfacing to a users head.
Definition: xrt_device.h:90
A pose composed of a position and orientation.
Definition: xrt_defines.h:465
A relation with two spaces, includes velocity and acceleration.
Definition: xrt_defines.h:657
Represents a uv triplet for distortion, basically just three xrt_vec2.
Definition: xrt_defines.h:261
A 3 element vector with single floats.
Definition: xrt_defines.h:271
A union of all output types.
Definition: xrt_defines.h:1463
Header defining an xrt display or controller device.