-
Notifications
You must be signed in to change notification settings - Fork 2
/
renderwidget.h
73 lines (49 loc) · 1.32 KB
/
renderwidget.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
#ifndef RENDERWIDGET_H
#define RENDERWIDGET_H
#include <QOpenGLWidget>
#include <QOpenGLFunctions>
#include <QMatrix4x4>
#include <QQuaternion>
#include <QVector2D>
#include <QBasicTimer>
#include <QTimer>
#include <QOpenGLShaderProgram>
#include <QOpenGLTexture>
#include "System.h"
class RenderWidget : public QOpenGLWidget, protected QOpenGLFunctions
{
Q_OBJECT
public:
explicit RenderWidget(QWidget *parent = 0);
System * getM_system();
~RenderWidget();
void change_wind(QVector3D *);
void setM_windFactor(f32);
void setM_windRotation(u16);
void setM_atmDensityFactor(f32 value);
void setM_gravity(f32);
void startRendering();
protected:
void mousePressEvent(QMouseEvent *e) override;
void mouseReleaseEvent(QMouseEvent *e) override;
void timerEvent(QTimerEvent *e) override;
void initializeGL() override;
void resizeGL(int w, int h) override;
void paintGL() override;
void initShaders();
void initTextures();
private slots:
void animate();
private:
QBasicTimer timer;
QTimer animationTimer;
QOpenGLShaderProgram program;
QMatrix4x4 projection;
QMatrix4x4 view;
QVector2D mousePressPosition;
QVector3D rotationAxis;
qreal angularSpeed;
QQuaternion rotation;
System * m_system;
};
#endif // RENDERWIDGET_H