forked from terminal29/Simple-OpenVR-Driver-Tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TrackerDevice.hpp
46 lines (33 loc) · 1.47 KB
/
TrackerDevice.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#pragma once
#include <chrono>
#include <cmath>
#include <linalg.h>
#include <Driver/IVRDevice.hpp>
#include <Native/DriverFactory.hpp>
namespace ExampleDriver {
class TrackerDevice : public IVRDevice {
public:
TrackerDevice(std::string serial);
~TrackerDevice() = default;
// Inherited via IVRDevice
virtual std::string GetSerial() override;
virtual void Update() override;
virtual vr::TrackedDeviceIndex_t GetDeviceIndex() override;
virtual DeviceType GetDeviceType() override;
virtual vr::EVRInitError Activate(uint32_t unObjectId) override;
virtual void Deactivate() override;
virtual void EnterStandby() override;
virtual void* GetComponent(const char* pchComponentNameAndVersion) override;
virtual void DebugRequest(const char* pchRequest, char* pchResponseBuffer, uint32_t unResponseBufferSize) override;
virtual vr::DriverPose_t GetPose() override;
private:
vr::TrackedDeviceIndex_t device_index_ = vr::k_unTrackedDeviceIndexInvalid;
std::string serial_;
vr::DriverPose_t last_pose_ = IVRDevice::MakeDefaultPose();
bool did_vibrate_ = false;
float vibrate_anim_state_ = 0.f;
vr::VRInputComponentHandle_t haptic_component_ = 0;
vr::VRInputComponentHandle_t system_click_component_ = 0;
vr::VRInputComponentHandle_t system_touch_component_ = 0;
};
};