sinpin-vr/src/controller.h

50 lines
743 B
C
Raw Normal View History

#pragma once
#include "overlay.h"
#include "util.h"
2023-04-16 18:23:00 +02:00
#include <vector>
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();
Ray GetLastRay();
glm::vec3 GetLastPos();
glm::vec3 GetLastRot();
void ReleaseOverlay();
2023-04-16 18:23:00 +02:00
void Update();
private:
void UpdateStatus();
void UpdateLaser();
App *_app;
Overlay _laser;
ControllerSide _side;
TrackerID _device_index;
vr::VRInputValueHandle_t _input_handle;
2023-04-29 16:44:25 +02:00
bool _is_connected;
2023-04-29 16:44:25 +02:00
bool _cursor_active;
Overlay *_grabbed_overlay;
2023-04-29 16:44:25 +02:00
Ray _last_ray;
glm::vec3 _last_rotation;
glm::vec3 _last_pos;
};