-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgldisplay.h
More file actions
62 lines (49 loc) · 1.31 KB
/
Copy pathgldisplay.h
File metadata and controls
62 lines (49 loc) · 1.31 KB
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
#ifndef GLDISPLAY_H
#define GLDISPLAY_H
#include <QOpenGLWidget>
#include <QOpenGLFunctions>
#include <QMatrix4x4>
#include <QQuaternion>
#include <QVector2D>
#include <QVector3D>
#include <QBasicTimer>
#include <QOpenGLShaderProgram>
#include <QOpenGLTexture>
#include <QOpenGLBuffer>
#include "triangle.h"
#include "particles.h"
#include "mesh.h"
class GLDisplay : public QOpenGLWidget, protected QOpenGLFunctions
{
Q_OBJECT
public:
explicit GLDisplay(QWidget *parent = 0);
~GLDisplay();
protected:
void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
void mouseMoveEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
void mouseReleaseEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
void timerEvent(QTimerEvent *e) Q_DECL_OVERRIDE;
void initializeGL() Q_DECL_OVERRIDE;
void resizeGL(int w, int h) Q_DECL_OVERRIDE;
void paintGL() Q_DECL_OVERRIDE;
void initShaders();
private:
//simulation loop
QBasicTimer timer;
//geometry
Triangle *m_geometry;
Particles *m_particles;
Mesh *m_mesh;
//lights
int m_lightPosLoc;
//shaders
QOpenGLShaderProgram program;
//matrices
QMatrix4x4 projection; // projection matrix
QMatrix4x4 matrix; //model view matrix
QMatrix3x3 normal; // normal matrix
//mouse
QVector2D mousePressPosition;
};
#endif // GLDISPLAY_H