11 #ifndef hifi_controllers_Input_h
12 #define hifi_controllers_Input_h
14 #include <GLMHelpers.h>
16 namespace controller {
18 enum class HmdAvatarAlignmentType {
23 struct InputCalibrationData {
24 glm::mat4 sensorToWorldMat;
26 glm::mat4 hmdSensorMat;
27 glm::mat4 defaultCenterEyeMat;
28 glm::mat4 defaultHeadMat;
29 glm::mat4 defaultSpine2;
30 glm::mat4 defaultHips;
31 glm::mat4 defaultLeftFoot;
32 glm::mat4 defaultRightFoot;
33 glm::mat4 defaultRightArm;
34 glm::mat4 defaultLeftArm;
35 glm::mat4 defaultRightHand;
36 glm::mat4 defaultLeftHand;
37 HmdAvatarAlignmentType hmdAvatarAlignmentType;
40 enum class ChannelType {
57 uint16_t channel : 12 ;
63 bool isValid()
const {
return (
id != INVALID_INPUT.id); }
65 uint16_t getDevice()
const {
return device; }
66 uint16_t getChannel()
const {
return channel; }
67 uint32_t getID()
const {
return id; }
68 ChannelType getType()
const {
return (ChannelType) type; }
70 bool isButton()
const {
return getType() == ChannelType::BUTTON; }
71 bool isAxis()
const {
return getType() == ChannelType::AXIS; }
72 bool isPose()
const {
return getType() == ChannelType::POSE; }
77 explicit Input(uint32_t
id) : id(id) {}
78 explicit Input(uint16_t device, uint16_t channel, ChannelType type) : device(device), channel(channel), type(uint16_t(type)), padding(0) {}
79 Input(
const Input& src) : id(src.id) {}
80 Input& operator = (
const Input& src) {
id = src.id;
return (*
this); }
81 bool operator ==(
const Input& right)
const {
return INVALID_INPUT.id !=
id && INVALID_INPUT.id != right.id &&
id == right.id; }
82 bool operator !=(
const Input& right)
const {
return !(*
this == right); }
83 bool operator < (
const Input& src)
const {
return id < src.id; }
85 static const Input INVALID_INPUT;
86 static const uint16_t INVALID_DEVICE;
87 static const uint16_t INVALID_CHANNEL;
88 static const uint16_t INVALID_TYPE;
90 using NamedPair = QPair<Input, QString>;
91 using NamedVector = QVector<NamedPair>;
93 static const Input& invalidInput();