vrecko
virtual reality framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
MouseHand.h
Go to the documentation of this file.
1 #ifndef MOUSEHAND_H
2 #define MOUSEHAND_H
3 
4 #include <string>
5 
6 #include <vrecko/Ability.h>
7 
9 
10 using namespace vrecko;
11 
12 namespace base {
13 
14 class MouseHand: public Ability {
15  public:
16  static const std::string GRAB_EVENT;
17  static const std::string GRAB_RELEASE_EVENT;
18  static const std::string BRICK_MOVE_EVENT;
19 
20  MouseHand();
21  ~MouseHand() {};
22 
23  // ------ BaseClass functions ------------------------
25  void processEvent(const std::string &input_name, void *value);
26  // ---------------------------------------------------
27 
28  void update(void);
29 
30  void preInitialize() {owner = (EnvironmentObject*)pOwner;}
31 
32  protected:
33  osg::Vec3 _grab_position, _actual_position, _last_position;
34  osg::Matrix _grab_rotation, _actual_rotation, _last_rotation;
35  osg::Matrix _parent_rotation, _parent_inverse_rotation;
36  bool _first;
38 
41  bool manipulate;
42 
43  osg::Vec3 _last_positions[200];
45  osg::Matrix _grab_rotation2;
46  osg::Vec3 _grab_position2;
47  osg::Vec3 force;
48  bool first;
49 
50  osg::Vec2 mouse_position;
52  float z_position, z_step;
53 
54  // new
55  osg::Matrix grab_transform, current_transform, last_transform;
56  osg::Matrix grab_transform_SO, SOparent_mat;
57 
59 
60 
61  DECLARE_INPUT(Grab, MessageBool);
62  DECLARE_INPUT(Position, MessageVec2);
63  DECLARE_INPUT(ZChange, MessageFloat);
64 
65  DECLARE_OUTPUT(Grab, MessageObjectID);
66  DECLARE_OUTPUT(GrabRelease, MessageObjectID);
67  DECLARE_OUTPUT(BrickMove, MessageObjectID);
68 };
69 
70 }
71 
72 #endif