]> git.tdb.fi Git - libs/vr.git/blob - source/motioncontroller.h
Provide objects for visualizing controllers
[libs/vr.git] / source / motioncontroller.h
1 #ifndef MSP_VR_MOTIONCONTROLLER_H_
2 #define MSP_VR_MOTIONCONTROLLER_H_
3
4 #include <msp/gl/matrix.h>
5 #include <msp/gl/object.h>
6 #include <msp/input/device.h>
7
8 namespace Msp {
9 namespace VR {
10
11 class StereoView;
12
13 class MotionController: public Input::Device
14 {
15 public:
16         sigc::signal<void, bool> signal_tracking_state_changed;
17
18 protected:
19         StereoView *view;
20         Msp::GL::Matrix matrix;
21
22         MotionController();
23 public:
24         virtual ~MotionController();
25
26         void attach_to_view(StereoView &);
27         void detach_from_view();
28         virtual bool is_tracked() const = 0;
29         const GL::Matrix &get_matrix() const { return matrix; }
30         virtual void update() = 0;
31 protected:
32         void update_from_matrix(const Msp::GL::Matrix &);
33
34 public:
35         virtual const GL::Object *get_object() const { return 0; }
36 };
37
38 } // namespace VR
39 } // namespace Msp
40
41 #endif