00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef __GUI_H__
00013 #define __GUI_H__
00014
00015 #ifdef __APPLE__
00016 #include "GLUT/glut.h"
00017 #else
00018 #include "GL/glut.h"
00019 #endif
00020
00021 #include <vector>
00022 #include "Vector3.h"
00023
00024 #include "Geometry.h"
00025 #include "SimpleMesh.h"
00026 #include "HalfEdgeMesh.h"
00027 #include "ObjIO.h"
00028
00029 #include "Stopwatch.h"
00030 #include "Util.h"
00031 #include "Camera.h"
00032
00033 class GUI
00034 {
00035 typedef float Real;
00036 typedef short Index;
00037
00038 public:
00039 GUI();
00040 ~GUI();
00041 void init();
00042 void update();
00043
00044 void displayFunc();
00045 void winReshapeFunc(GLint newWidth, GLint newHeight);
00046 void mouseFunc(GLint button, GLint action, GLint mouseX, GLint mouseY);
00047 void mouseActiveMotionFunc(GLint mouseX, GLint mouseY);
00048 void mousePassiveMotionFunc(GLint mouseX, GLint mouseY);
00049
00050 void keyboardUpFunc(unsigned char keycode, GLint mouseX, GLint mouseY);
00051 void keyboardFunc(unsigned char keycode, GLint mouseX, GLint mouseY);
00052 void specialFunc(GLint keycode, GLint mouseX, GLint mouseY);
00053
00054 void idleFunc();
00055
00056 private:
00057 void getMouseScreenCoordinates(int mouseX, int mouseY, Real &x, Real &y);
00058 void drawXZplane(int nrOfGridCells, Real width, int subGridLines);
00059 void drawCube(Real angle);
00060 void drawFPS(float fps);
00061 bool addObjMesh(const std::string& filename, Mesh* mesh);
00062
00063
00064 unsigned int mWindowHeight;
00065 unsigned int mWindowWidth;
00066 int mMousePos[2];
00067 int mOldMousePos[2];
00068
00069
00070 Camera mCam;
00071
00072
00073 int mOldWindowHeight;
00074 int mOldWindowWidth;
00075
00076
00077 Real mFrameTimestamp;
00078 Stopwatch mClockArray[256];
00079
00080 #define GLOBAL_CLOCK 0 // starts running at startup..
00081 #define ANIMATION_CLOCK 1 // Used for camera movement
00082
00083 #define STOPWATCH 255
00084
00085
00086
00087 bool mDrawXZPlane;
00088 unsigned int mFramecounter;
00089 float mTimeSinceLastFPS;
00090 float mCurrentFPS;
00091
00092
00093
00094 std::vector<Geometry*> mGeometryList;
00095
00096 };
00097
00098
00099 #endif