cgv
Loading...
Searching...
No Matches
vr_state.h
Go to the documentation of this file.
1#pragma once
2
3#include <string>
4#include <vector>
5
6#include "lib_begin.h"
7
10
17namespace vr {
19 const unsigned max_nr_controllers = 8;
21 const unsigned max_nr_controller_inputs = 5;
23 const unsigned max_nr_controller_axes = 8;
24
26 enum KeyAction {
27 KA_RELEASE,
28 KA_PRESS,
29 KA_REPEAT
30 };
62 {
63 VRF_SYSTEM = 0x000001,
64 VRF_MENU = 0x000002,
65 VRF_GRIP = 0x000004,
66 VRF_DPAD_LEFT = 0x000008,
67 VRF_DPAD_RIGHT = 0x000010,
68 VRF_DPAD_DOWN = 0x000020,
69 VRF_DPAD_UP = 0x000040,
70 VRF_A = 0x000080,
71 VRF_INPUT0_TOUCH = 0x000100,
72 VRF_INPUT0 = 0x000200,
73 VRF_INPUT1_TOUCH = 0x000400,
74 VRF_INPUT1 = 0x000800,
75 VRF_INPUT2_TOUCH = 0x001000,
76 VRF_INPUT2 = 0x002000,
77 VRF_INPUT3_TOUCH = 0x004000,
78 VRF_INPUT3 = 0x008000,
79 VRF_INPUT4_TOUCH = 0x010000,
80 VRF_INPUT4 = 0x020000,
81 VRF_PROXIMITY = 0x040000
82 };
91
93 struct CGV_API vr_trackable_state
94 {
98
104 float pose[12];
106 bool operator == (const vr_trackable_state& state) const;
109 };
111
118 {
120 unsigned time_stamp;
122 unsigned button_flags;
126 float vibration[2];
128 bool operator == (const vr_controller_state& state) const;
132 void put_ray(float* ray_origin, float* ray_direction) const;
133 };
135
138 struct CGV_API vr_kit_state
139 {
145 bool operator == (const vr_kit_state& state) const;
147 vr_kit_state();
148 };
150 extern CGV_API std::string get_key_string(unsigned short key);
152 extern CGV_API std::string get_state_flag_string(VRButtonStateFlags flags);
154 extern CGV_API std::string get_status_string(VRStatus status);
155}
157
158#include <cgv/config/lib_end.h>
the vr namespace for virtual reality support
VRButtonStateFlags
one flag for each vr controller button
Definition vr_state.h:62
@ VRF_INPUT0
button of input 0
Definition vr_state.h:72
@ VRF_MENU
application menu button
Definition vr_state.h:64
@ VRF_DPAD_LEFT
direction pad left button
Definition vr_state.h:66
@ VRF_A
A button.
Definition vr_state.h:70
@ VRF_INPUT1_TOUCH
touch sensor for input 1 which often is touchpad or stick
Definition vr_state.h:73
@ VRF_DPAD_RIGHT
direction pad right button
Definition vr_state.h:67
@ VRF_GRIP
grip button
Definition vr_state.h:65
@ VRF_INPUT3_TOUCH
touch sensor for input 3 which often is touchpad or stick
Definition vr_state.h:77
@ VRF_DPAD_UP
direction pad up button
Definition vr_state.h:69
@ VRF_INPUT1
button of input 1
Definition vr_state.h:74
@ VRF_SYSTEM
system button
Definition vr_state.h:63
@ VRF_PROXIMITY
proximity sensor
Definition vr_state.h:81
@ VRF_INPUT4_TOUCH
touch sensor for input 4 which often is touchpad or stick
Definition vr_state.h:79
@ VRF_INPUT0_TOUCH
touch sensor for input 0 which often is touchpad or stick
Definition vr_state.h:71
@ VRF_INPUT2
button of input 2
Definition vr_state.h:76
@ VRF_INPUT2_TOUCH
touch sensor for input 2 which often is touchpad or stick
Definition vr_state.h:75
@ VRF_INPUT4
button of input 4
Definition vr_state.h:80
@ VRF_DPAD_DOWN
direction pad down button
Definition vr_state.h:68
@ VRF_INPUT3
button of input 3
Definition vr_state.h:78
std::string get_key_string(unsigned short key)
convert key to string
Definition vr_state.cxx:78
std::string get_status_string(VRStatus status)
convert flags to string
Definition vr_state.cxx:166
const unsigned max_nr_controller_axes
maximum number of axes per controller
Definition vr_state.h:23
VRStatus
different status values for a trackable
Definition vr_state.h:85
@ VRS_TRACKED
trackable is connected and tracked
Definition vr_state.h:88
@ VRS_ATTACHED
trackable is connected via wireless but not tracked
Definition vr_state.h:87
@ VRS_DETACHED
trackable is not reachable via wireless
Definition vr_state.h:86
const unsigned max_nr_controllers
maximum number of attachable controller and tracker devices
Definition vr_state.h:19
std::string get_state_flag_string(VRButtonStateFlags flags)
convert flags to string
Definition vr_state.cxx:110
KeyAction
repeated definition from cgv/gui/key_event.h
Definition vr_state.h:26
const unsigned max_nr_controller_inputs
maximum number of inputs per controller
Definition vr_state.h:21
VRKeys
enumerate all VR keys starting at 1024
Definition vr_state.h:32
@ VR_INPUT4
input 4
Definition vr_state.h:55
@ VR_DPAD_UP_LEFT
direction pad diagonally up and left
Definition vr_state.h:42
@ VR_DPAD_DOWN_LEFT
direction pad diagonally down and left
Definition vr_state.h:37
@ VR_DPAD_DOWN_RIGHT
direction pad diagonally down and right
Definition vr_state.h:39
@ VR_INPUT3_TOUCH
touched input 3
Definition vr_state.h:52
@ VR_PROXIMITY
proximity sensor
Definition vr_state.h:56
@ VR_DPAD_RIGHT
direction pad right
Definition vr_state.h:41
@ VR_INPUT2_TOUCH
touched input 2
Definition vr_state.h:50
@ VR_INPUT1_TOUCH
touched input 1
Definition vr_state.h:48
@ VR_DPAD_UP_RIGHT
direction pad diagonally up and right
Definition vr_state.h:44
@ VR_BEGIN
begin marker used in for loops over all VR keys
Definition vr_state.h:58
@ VR_DPAD_LEFT
direction pad left
Definition vr_state.h:40
@ VR_MENU
VIVE: menu button; occulus: start button.
Definition vr_state.h:35
@ VR_INPUT2
input 2
Definition vr_state.h:51
@ VR_END
end marker used in for loops over all VR keys
Definition vr_state.h:57
@ VR_A
A button.
Definition vr_state.h:45
@ VR_DPAD_DOWN
direction pad down
Definition vr_state.h:38
@ VR_INPUT1
input 1
Definition vr_state.h:49
@ VR_INPUT0_TOUCH
touched input 0
Definition vr_state.h:46
@ VR_DPAD_UP
direction pad up
Definition vr_state.h:43
@ VR_INPUT0
input 0
Definition vr_state.h:47
@ VR_INPUT4_TOUCH
touched input 4
Definition vr_state.h:54
@ VR_INPUT3
input 3
Definition vr_state.h:53
@ VR_GRIP
grip button
Definition vr_state.h:36
@ VR_SYSTEM
VIVE: system button; occulus: ???
Definition vr_state.h:34
Extends the trackable state by information on the buttons, input axes and vibration strengths.
Definition vr_state.h:118
unsigned time_stamp
a unique time stamp for fast test whether state changed
Definition vr_state.h:120
unsigned button_flags
combination of flags in VRButtonStateFlags combined with the OR operation
Definition vr_state.h:122
structure that stores all information describing the state of a VR kit
Definition vr_state.h:139
vr_trackable_state hmd
status and pose of hmd
Definition vr_state.h:141
a trackable knows whether it is tracked and its 6d pose stored as 3x4 matrix in column major format
Definition vr_state.h:94
VRStatus status
whether trackable is currently tracked, only in case of true, the pose member contains useful informa...
Definition vr_state.h:96