-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainwidget.h
57 lines (48 loc) · 1.25 KB
/
mainwidget.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
#ifndef MAINWIDGET_H
#define MAINWIDGET_H
#include "vertexdata.h"
#include "geometryengine.h"
#include "hexaedr.h"
#include "tetraedr.h"
#include "octaedr.h"
#include <QOpenGLWidget>
#include <QMatrix4x4>
#include <QQuaternion>
#include <QBasicTimer>
#include <QOpenGLTexture>
#include <QMouseEvent>
#include <math.h>
class GeometryEngine;
class MainWidget : public QOpenGLWidget, protected QOpenGLFunctions
{
Q_OBJECT
public:
explicit MainWidget(QWidget *parent = 0);
~MainWidget();
QOpenGLShaderProgram program;
GeometryEngine *geometries;
void pickedHexaedr();
void pickedTetraedr();
void pickedOctaedr();
void wheelEvent(QWheelEvent* event);
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:
int m_colorAttr;
QBasicTimer timer;
QOpenGLTexture *texture;
QMatrix4x4 projection;
QVector2D mousePressPosition;
QVector3D rotationAxis;
float angularSpeed;
QQuaternion rotation;
float scaling = 1.0f;
};
#endif // MAINWIDGET_H