-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathglwidget.h
66 lines (50 loc) · 1.3 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
#ifndef GLWIDGET_H
#define GLWIDGET_H
#include <QOpenGLWidget>
#include <QOpenGLFunctions>
#include <QKeyEvent>
#include <QMouseEvent>
#include <QWheelEvent>
#include <QGroupBox>
#include <QPushButton>
#include <QVBoxLayout>
#include "mesh.h"
#include "shader.h"
#include "camera.h"
class GLWidget : public QOpenGLWidget, protected QOpenGLFunctions
{
Q_OBJECT
public:
GLWidget(QWidget *parent=0);
void initializeGL();
void resizeGL(int w,int h);
void paintGL();
void keyPressEvent(QKeyEvent *e);
void mouseMoveEvent(QMouseEvent *m);
void wheelEvent(QWheelEvent *w);
void addMesh(QString meshName, Mesh mesh);
void renderScene();
QString activeUniform() {return m_activeUniform;}
QList<QString> uniforms() {return m_uniforms;}
QGroupBox *menu();
Shader shader;
Camera camera;
QMap<QString,Mesh> meshes;
public slots:
void setActiveUniform(QString uniform);
void setUniforms();
void controlLight();
void drawWireframe();
void savePic();
private:
void printContext();
QString m_activeUniform;
QList<QString> m_uniforms;
bool m_drawWireframe = false;
bool m_controlLight = false;
bool m_mouseLook = false;
QPoint m_lastPos = QPoint(0,0);
float m_lastFov = 90;
QVector3D m_light;
};
#endif // GLWIDGET_H