cgv
vr_events.h
1 #pragma once
2 
3 #include <cgv/gui/key_event.h>
4 #include <cgv/gui/throttle_event.h>
5 #include <cgv/gui/stick_event.h>
6 #include <cgv/gui/pose_event.h>
7 #include <vr/vr_state.h>
8 #include <cgv/gui/window.h>
9 #include <cgv/signal/signal.h>
10 #include <cgv/signal/bool_signal.h>
11 
12 #include "lib_begin.h"
13 
16 
18 namespace cgv {
20  namespace gui {
21 
23  class CGV_API vr_key_event : public cgv::gui::key_event
24  {
25  protected:
29  unsigned short controller_index;
31  unsigned short player_index;
34  public:
36  vr_key_event(void* _device_handle, unsigned _player_index, unsigned _controller_index, const vr::vr_kit_state& _state,
37  unsigned short _key = 0, KeyAction _action = KA_PRESS, unsigned char _char = 0,
38  unsigned char _modifiers = 0, double _time = 0);
40  void* get_device_handle() const { return device_handle; }
42  unsigned get_controller_index() const { return controller_index; }
44  unsigned get_player_index() const { return player_index; }
46  const vr::vr_kit_state& get_state() const { return state; }
48  void stream_out(std::ostream& os) const;
50  void stream_in(std::istream& is);
51  };
52 
54  class CGV_API vr_throttle_event : public throttle_event
55  {
56  protected:
61  public:
63  vr_throttle_event(void* _device_handle, unsigned _controller_index, const vr::vr_kit_state& _state,
64  float _x, float _dx, unsigned _player_index = 0, unsigned _throttle_index = 0, double _time = 0);
66  void* get_device_handle() const { return device_handle; }
68  const vr::vr_kit_state& get_state() const { return state; }
70  void stream_out(std::ostream& os) const;
71  };
72 
74  class CGV_API vr_stick_event : public stick_event
75  {
76  protected:
81  public:
83  vr_stick_event(void* _device_handle, unsigned _controller_index, const vr::vr_kit_state& _state,
84  StickAction _action, float _x, float _y, float _dx, float _dy,
85  unsigned _player_index = 0, unsigned _stick_index = 0, double _time = 0);
87  void* get_device_handle() const { return device_handle; }
89  const vr::vr_kit_state& get_state() const { return state; }
91  void stream_out(std::ostream& os) const;
92  };
93 
95  class CGV_API vr_pose_event : public pose_event
96  {
97  protected:
102  public:
104  vr_pose_event(void* _device_handle, short _trackable_index, const vr::vr_kit_state& _state,
105  const float *_pose, const float *_last_pose, unsigned short _player_index, double _time = 0);
107  void* get_device_handle() const { return device_handle; }
109  const vr::vr_kit_state& get_state() const { return state; }
111  void stream_out(std::ostream& os) const;
112  };
113 
114  }
115 }
116 
118 
119 #include <cgv/config/lib_end.h>
cgv::gui::StickAction
StickAction
different actions that a stick can perform
Definition: stick_event.h:15
cgv::gui::vr_throttle_event::state
const vr::vr_kit_state & state
access to current vr state
Definition: vr_events.h:60
cgv::gui::vr_stick_event
vr extension of stick event
Definition: vr_events.h:75
cgv::gui::vr_throttle_event::get_state
const vr::vr_kit_state & get_state() const
return the state
Definition: vr_events.h:68
cgv::gui::vr_throttle_event
vr extension of throttle event
Definition: vr_events.h:55
cgv::gui::key_event
class to represent all possible keyboard events with the EID_KEY
Definition: key_event.h:23
cgv::gui::vr_pose_event::device_handle
void * device_handle
store device handle
Definition: vr_events.h:99
cgv::gui::vr_throttle_event::device_handle
void * device_handle
store device handle
Definition: vr_events.h:58
cgv::gui::vr_key_event::get_device_handle
void * get_device_handle() const
return the device id, by default returns 0
Definition: vr_events.h:40
cgv::gui::vr_stick_event::device_handle
void * device_handle
store device handle
Definition: vr_events.h:78
cgv::gui::throttle_event
class to represent events that inform on a change in a one axis controller with the EID_THROTTLE
Definition: throttle_event.h:15
cgv::gui::vr_key_event::player_index
unsigned short player_index
store player index
Definition: vr_events.h:31
cgv::gui::vr_key_event::controller_index
unsigned short controller_index
store index of controller (0 .. vr::max_nr_controllers-1), controllers with left and right hand role ...
Definition: vr_events.h:29
cgv::gui::KeyAction
KeyAction
different actions that a key can perform
Definition: key_event.h:12
cgv::gui::vr_key_event::state
const vr::vr_kit_state & state
access to current vr state
Definition: vr_events.h:33
cgv::gui::vr_key_event::get_player_index
unsigned get_player_index() const
return player index
Definition: vr_events.h:44
cgv::gui::vr_pose_event::get_device_handle
void * get_device_handle() const
return the device id, by default returns 0
Definition: vr_events.h:107
cgv::gui::vr_key_event::get_state
const vr::vr_kit_state & get_state() const
return the state
Definition: vr_events.h:46
cgv::gui::vr_key_event
vr key events use the key codes defined in vr::VRKeys
Definition: vr_events.h:24
cgv::gui::vr_throttle_event::get_device_handle
void * get_device_handle() const
return the device id, by default returns 0
Definition: vr_events.h:66
cgv::gui::vr_key_event::device_handle
void * device_handle
store device handle
Definition: vr_events.h:27
cgv::gui::vr_key_event::get_controller_index
unsigned get_controller_index() const
return controller index (0 .. vr::max_nr_controllers-1), controllers with left and right hand role ar...
Definition: vr_events.h:42
cgv::gui::vr_pose_event::get_state
const vr::vr_kit_state & get_state() const
return the state
Definition: vr_events.h:109
cgv::gui::KA_PRESS
@ KA_PRESS
key press action
Definition: key_event.h:14
cgv::gui::pose_event
class to represent all pose events from tracking systems with the EID_POSE
Definition: pose_event.h:16
vr::vr_kit_state
structure that stores all information describing the state of a VR kit
Definition: vr_state.h:139
cgv::gui::vr_pose_event::state
const vr::vr_kit_state & state
access to current vr state
Definition: vr_events.h:101
cgv::gui::vr_stick_event::get_device_handle
void * get_device_handle() const
return the device id, by default returns 0
Definition: vr_events.h:87
cgv::gui::stick_event
class to represent stick events with the EID_STICK
Definition: stick_event.h:29
vr_state.h
cgv::gui::vr_stick_event::state
const vr::vr_kit_state & state
access to current vr state
Definition: vr_events.h:80
cgv::gui::vr_pose_event
vr extension of pose events
Definition: vr_events.h:96
cgv
the cgv namespace
Definition: vr_calib.cxx:9
cgv::gui::vr_stick_event::get_state
const vr::vr_kit_state & get_state() const
return the state
Definition: vr_events.h:89