00001 #ifndef GLUTM_WINEXAM_H
00002 #define GLUTM_WINEXAM_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00033 #include <glutm/window.h>
00034 #include <math/matrix4.h>
00035 #include <glt/project.h>
00036
00042 class GlutWindowExaminer : public GlutWindow
00043 {
00044 public:
00046 GlutWindowExaminer
00047 (
00048 const std::string &title = titleDefault,
00049 int width = widthDefault,
00050 int height = heightDefault,
00051 int x = xDefault,
00052 int y = yDefault,
00053 unsigned int displayMode = displayModeDefault
00054 );
00056 virtual ~GlutWindowExaminer();
00057
00058 void OnOpen();
00059 void OnClose();
00060 void OnReshape(int w, int h);
00061 void OnKeyboard(unsigned char key, int x, int y);
00062 void OnSpecial(int key, int x, int y);
00063 void OnMenu(int value);
00064 void OnMouse(int button, int state, int x, int y);
00065 void OnMotion(int x, int y);
00066 void OnPassiveMotion(int x, int y);
00067
00069 virtual void OnOrient(const Matrix &viewing,const Matrix &inverse);
00070
00072 virtual Vector getReferencePoint(int x,int y,const Vector &pos,const Matrix &modelView,const Matrix &modelViewInverse) const;
00073
00075 Vector &referencePoint();
00076
00077
00078
00079
00080
00082 bool &mouseZoom();
00084 bool &mousePan();
00086 bool &mouseRotate();
00087
00089 typedef enum
00090 {
00091 MODE_MOUSE_ONLY = 0,
00092 MODE_MOUSE_RIGHT,
00093 MODE_MAX
00094 } MouseMode;
00095
00097 MouseMode &mouseMode();
00098
00099 protected:
00100
00102 bool mousePressed() const;
00103
00105 Vector xAxisOfRotation() const;
00107 Vector yAxisOfRotation() const;
00109 Vector axisOfRotation(const Vector &v) const;
00110
00112 void OnPreDisplay();
00113
00115 Vector dragPos(const int x,const int y) const;
00116
00118 Matrix _viewMatrix;
00120 Matrix _viewMatrixInverse;
00121
00122 GltOrtho _ortho;
00123
00124 private:
00125
00126 bool _mouseZoom;
00127 bool _mousePan;
00128 bool _mouseRotate;
00129
00130 MouseMode _mouseMode;
00131
00133 Vector _referencePoint;
00134
00135
00136
00137
00138
00139 bool _mouseLeft;
00140 bool _mouseMiddle;
00141 bool _mouseRight;
00142 int _mouseX;
00143 int _mouseY;
00144 bool _wasIdle;
00145 int _oldCursor;
00146 Vector _dragPosPrev;
00147 };
00148
00149 #endif