-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathControllerManager.h
More file actions
71 lines (59 loc) · 2.1 KB
/
ControllerManager.h
File metadata and controls
71 lines (59 loc) · 2.1 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#pragma once
#include <openvr.h>
#include <map>
#include <string>
#include <vector>
#include "Matrices.h"
#include "CGLRenderModel.h"
#define VR_INK_COLOR Vector3(0.7294f, 0.8274f, 1.0f)
enum EControllerRole
{
kStylus = 0,
kNonDominent = 1
};
typedef struct _DeviceHandlesInfo {
vr::VRInputValueHandle_t sourceHandle;
vr::VRActionHandle_t actionPose;
vr::VRActionHandle_t actionTrackpadAnalogValue;
vr::VRActionHandle_t actionTrackpadDigitalTouch;
vr::VRActionHandle_t actionTrackpadDigitalClick;
vr::VRActionHandle_t actionPrimaryAnalogValue;
vr::VRActionHandle_t actionPrimaryDigitalTouch;
vr::VRActionHandle_t actionPrimaryDigitalClick;
vr::VRActionHandle_t actionTipAnalogValue;
vr::VRActionHandle_t actionTipDigitalTouch;
vr::VRActionHandle_t actionTipDigitalClick;
vr::VRActionHandle_t actionGripDigitalTouch;
vr::VRActionHandle_t actionGripDigitalClick;
vr::VRActionHandle_t actionGripAnalogValue;
vr::VRActionHandle_t actionApplicationMenuDigitalClick;
vr::VRActionHandle_t actionSystemDigitalClick;
vr::VRActionHandle_t actionHaptics;
} DeviceHandlesInfo;
class ControllerManager
{
public:
ControllerManager(std::string renderModelName);
ControllerManager();
~ControllerManager();
void Render(Matrix4 matMVP);
void SetShaderParameters(GLuint shaderId, GLint mvpMatrixLocation, GLint tintColorLocation, GLint intensityColorLocation);
virtual void UpdateControllerStatus();
virtual void UpdateButtonHighlights();
Matrix4 GetPoseMatrix();
std::vector<std::string>GetRenderModelComponentNames();
vr::VRActionSetHandle_t actionSetDriver = vr::k_ulInvalidActionSetHandle;
vr::EVRInputError vrInputError = vr::EVRInputError::VRInputError_NoSteam;
DeviceHandlesInfo deviceHandles;
protected:
std::string m_RenderModelName;
std::vector<std::string> m_vRenderModelComponentNames;
Matrix4 m_PoseMatrix;
std::map<std::string, CGLRenderModel *>m_ModelComponents;
GLuint m_shaderId;
GLint m_mvpMatrixLocation;
GLint m_tintColorLocation;
GLint m_nColorIntensityLocation;
void LoadRenderModel(std::string renderModelName);
void UpdateButton(std::vector<std::string> alternativeNames, float value);
};