2 #ifndef GRAMODS_CORE_OPENVR
3 #define GRAMODS_CORE_OPENVR
5 #include <gmCore/config.hh>
7 #ifdef gramods_ENABLE_OpenVR
9 #include <gmCore/Object.hh>
10 #include <gmCore/OFactory.hh>
11 #include <gmCore/Updateable.hh>
15 #include <Eigen/Eigen>
21 BEGIN_NAMESPACE_GMCORE;
51 virtual bool processEvent(
const vr::VREvent_t *event,
bool is_consumed) = 0;
54 typedef std::array<vr::TrackedDevicePose_t, vr::k_unMaxTrackedDeviceCount>
66 void setUseVideo(
bool on);
73 void setManifestPath(std::filesystem::path);
80 void setActionSet(std::string name);
82 void initialize()
override;
95 std::optional<pose_list_t> &getPoseList();
103 void addEventConsumer(std::weak_ptr<EventConsumer> ec);
110 void removeEventConsumer(EventConsumer *ec);
115 Updateable::clock::time_point getLastTime();
120 std::optional<vr::InputAnalogActionData_t>
121 getAnalog(std::string action,
122 vr::VRInputValueHandle_t device = vr::k_ulInvalidInputValueHandle);
127 std::optional<vr::InputDigitalActionData_t>
128 getDigital(std::string action,
129 vr::VRInputValueHandle_t device = vr::k_ulInvalidInputValueHandle);
135 vr::ETrackedDeviceClass getType(
size_t);
141 vr::ETrackedControllerRole getRole(
size_t);
147 std::string getSerial(
size_t);
152 vr::IVRSystem *ptr();
157 static Eigen::Matrix4f convert(
const vr::HmdMatrix34_t &m);
162 static std::string typeToString(vr::ETrackedDeviceClass type);
167 static std::string roleToString(vr::ETrackedControllerRole role);
173 std::unique_ptr<Impl> _impl;
176 END_NAMESPACE_GMCORE;
Base type for objects in the Gramods package for standardized handling of construction,...
Definition: Object.hh:42
Initializer for OpenVR.
Definition: OpenVR.hh:30
std::string getDefaultKey() override
Returns the default key, in Configuration, for the Object.
Definition: OpenVR.hh:88
Interface for event consumers that can be registered with the OpenVR instance.
Definition: OpenVR.hh:38
virtual bool processEvent(const vr::VREvent_t *event, bool is_consumed)=0
Process an incoming OpenVR event and return true if the event was acted upon.