2023-04-15 20:56:40 +02:00
|
|
|
#pragma once
|
|
|
|
#include "overlay.h"
|
|
|
|
#include "util.h"
|
2023-04-16 18:23:00 +02:00
|
|
|
#include <vector>
|
2023-04-15 20:56:40 +02:00
|
|
|
|
|
|
|
class App;
|
|
|
|
|
|
|
|
enum class ControllerSide
|
|
|
|
{
|
|
|
|
Left,
|
|
|
|
Right
|
|
|
|
};
|
|
|
|
|
|
|
|
class Controller
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Controller(App *app, ControllerSide hand);
|
|
|
|
TrackerID DeviceIndex();
|
|
|
|
vr::VRInputValueHandle_t InputHandle();
|
|
|
|
ControllerSide Side();
|
|
|
|
|
|
|
|
bool IsConnected();
|
2023-04-22 17:49:07 +02:00
|
|
|
Ray GetLastRay();
|
|
|
|
glm::vec3 GetLastPos();
|
|
|
|
glm::vec3 GetLastRot();
|
2023-04-15 20:56:40 +02:00
|
|
|
|
2023-04-17 21:23:19 +02:00
|
|
|
void ReleaseOverlay();
|
2023-04-16 18:23:00 +02:00
|
|
|
|
2023-04-15 20:56:40 +02:00
|
|
|
void Update();
|
|
|
|
|
|
|
|
private:
|
2023-04-17 21:23:19 +02:00
|
|
|
void UpdateStatus();
|
|
|
|
void UpdateLaser();
|
|
|
|
|
2023-04-15 20:56:40 +02:00
|
|
|
App *_app;
|
|
|
|
Overlay _laser;
|
|
|
|
ControllerSide _side;
|
|
|
|
TrackerID _device_index;
|
|
|
|
vr::VRInputValueHandle_t _input_handle;
|
2023-04-29 16:44:25 +02:00
|
|
|
|
2023-04-15 20:56:40 +02:00
|
|
|
bool _is_connected;
|
2023-04-29 16:44:25 +02:00
|
|
|
|
|
|
|
bool _cursor_active;
|
2023-04-17 21:23:19 +02:00
|
|
|
Overlay *_grabbed_overlay;
|
2023-04-29 16:44:25 +02:00
|
|
|
|
2023-04-22 17:49:07 +02:00
|
|
|
Ray _last_ray;
|
|
|
|
glm::vec3 _last_rotation;
|
|
|
|
glm::vec3 _last_pos;
|
2023-04-15 20:56:40 +02:00
|
|
|
};
|