00001 00010 #ifndef MOUSETOTRACKER_H 00011 #define MOUSETOTRACKER_H 00012 00013 #include <G3D/G3DAll.h> 00014 #include "Event.H" 00015 #include "ProjectionVRCamera.H" 00016 00017 namespace VRG3D { 00018 00019 00020 typedef ReferenceCountedPointer<class MouseToTracker> MouseToTrackerRef; 00030 class MouseToTracker : public ReferenceCountedObject 00031 { 00032 public: 00033 00034 MouseToTracker(ProjectionVRCameraRef camera, int numTrackers=1); 00035 00036 virtual ~MouseToTracker(); 00037 00041 void doUserInput(const Array<EventRef> &events, Array<EventRef> &generatedEvents); 00042 00043 protected: 00044 00045 std::string intToString(int i); 00046 void cycleTracker(); 00047 00048 EventRef mouseMoveInPlane(EventRef e); 00049 EventRef mouseMoveInOut(EventRef e); 00050 EventRef mouseMoveRotX(EventRef e); 00051 EventRef mouseMoveRotY(EventRef e); 00052 EventRef mouseMoveRotZ(EventRef e); 00053 00054 00055 enum FsaStates { 00056 START, 00057 XROT, 00058 YROT, 00059 ZROT, 00060 DOLLY 00061 }; 00062 00063 ProjectionVRCameraRef _camera; 00064 FsaStates _fsaState; 00065 Matrix3 _rot; 00066 Vector3 _trans; 00067 Vector2 _lastPos; 00068 int _numTrackers; 00069 int _curTracker; 00070 }; 00071 00072 } // end namespace 00073 00074 #endif