Adjust friendship
[agianapa.git] / qt / sphere-orbit-camera-gui / myglwidget.h
blobb70da0d1e3e3533ab07f5eda93942c585b5c10ae
1 #ifndef MYGLWIDGET_H
2 #define MYGLWIDGET_H
4 #include <iostream>
5 #include <QGLWidget>
6 #include <QMutex>
7 #include <QTimer>
9 #include "axis.h"
10 #include "camera.h"
11 #include "sphere.h"
12 //#include "workerthread.h"
14 typedef enum axis_t { AXIS_X, AXIS_Y, AXIS_Z };
16 class WorkerThread;
18 class MyGLWidget : public QGLWidget
20 Q_OBJECT
22 public:
23 // Non-default arguments must come first
24 MyGLWidget(Axis *pAxisX = 0, Axis *pAxisY = 0, Axis *pAxisZ = 0,
25 Camera *pCamera = 0, Sphere *pSphere = 0,
26 unsigned int timerInterval = 100, WorkerThread *pthread = 0,
27 QWidget *parent = 0);
28 ~MyGLWidget();
30 // Setters
31 void setAxis(axis_t axis, const Axis *pAxis);
32 void setCamera(const Camera *pCamera);
33 void setSphere(const Sphere *pShere);
34 void setThread(WorkerThread *pthread);
36 void startAnimation(void);
37 void stopAnimation(void);
39 private slots:
40 void pullData(void);
42 protected:
43 void initializeGL();
44 void paintGL();
45 void resizeGL(int width, int height);
47 private:
48 QTimer m_timer;
49 QMutex mutex;
50 WorkerThread *m_pthread;
52 // Functions
53 void drawAxis(void);
54 void drawSphere(void);
56 // Sphere coordinations and orientation
57 GLfloat m_xCoord;
58 GLfloat m_yCoord;
59 GLfloat m_zCoord;
60 GLfloat m_xRot;
61 GLfloat m_yRot;
62 GLfloat m_zRot;
64 // Timer interval;
65 unsigned int m_timerInterval;
67 const Axis *m_pAxisX;
68 const Axis *m_pAxisY;
69 const Axis *m_pAxisZ;
71 const Camera *m_pCamera;
72 const Sphere *m_pSphere;
75 #endif // MYGLWIDGET_H