-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainview.h
59 lines (42 loc) · 1.18 KB
/
mainview.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
#ifndef MAINVIEW_H
#define MAINVIEW_H
#include <QOpenGLWidget>
#include <QOpenGLFunctions_4_1_Core>
#include <QOpenGLDebugLogger>
#include <QOpenGLShaderProgram>
#include <QMouseEvent>
#include "mesh.h"
#include "meshrenderer.h"
class MainView : public QOpenGLWidget, protected QOpenGLFunctions_4_1_Core {
Q_OBJECT
public:
MainView(QWidget *Parent = 0);
~MainView();
void updateMatrices();
void updateUniforms();
void updateBuffers(Mesh& currentMesh);
protected:
void initializeGL();
void resizeGL(int newWidth, int newHeight);
void paintGL();
void mouseMoveEvent(QMouseEvent* event);
void mousePressEvent(QMouseEvent* event);
void wheelEvent(QWheelEvent* event);
void keyPressEvent(QKeyEvent* event);
private:
QOpenGLDebugLogger debugLogger;
QVector2D toNormalizedScreenCoordinates(int x, int y);
//for zoom
float scale;
//for handling rotation
QVector3D oldVec;
QQuaternion rotationQuaternion;
bool dragging;
MeshRenderer mr;
Settings settings;
//we make mainwindow a friend so it can access settings
friend class MainWindow;
private slots:
void onMessageLogged( QOpenGLDebugMessage Message );
};
#endif // MAINVIEW_H