-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathglwidget.h
76 lines (52 loc) · 1.24 KB
/
glwidget.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#ifndef GLWIDGET_H
#define GLWIDGET_H
#include <QGLWidget>
#include "timer.h"
#include "vector3d.h"
#define MAX_EMITTERS 16
#define MAX_VERTEXES 20000
class QTimer;
class QGLBuffer;
class QGLShader;
class QGLShader;
class QGLShaderProgram;
class Camera;
class Emitter;
class Rend_VBO;
class GLWidget : public QGLWidget {
Q_OBJECT
public:
explicit GLWidget(QWidget *parent = 0);
virtual ~GLWidget();
QSize minimumSizeHint() const;
QSize sizeHint() const;
float getFPS() { return _timer.fps(); }
int getVertexCount() const;
int addEmitter(Emitter *emitter);
void removeEmitter(int index);
public slots:
virtual void animate();
void setPitch(int val);
void setYaw(int val);
void setRoll(int val);
protected:
Camera *_camera;
Timer _timer;
QTimer *_qtimer;
QGLShader *_vertShader;
QGLShader *_fragShader;
QGLShaderProgram *_shaderProgram;
Rend_VBO *_renderer;
int _emitterCount;
Emitter* _emitters[MAX_EMITTERS];
void initializeGL();
void paintGL();
void resizeGL(int width, int height);
void initShaders();
void createAxis();
void drawAxis(float len = 1.0);
void projection(int width, int height, float size = 1.2);
QGLBuffer *_axisVertexes;
QGLBuffer *_axisColors;
};
#endif // GLWIDGET_H