-
Notifications
You must be signed in to change notification settings - Fork 0
/
window.h
96 lines (80 loc) · 2.09 KB
/
window.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#ifndef WINDOW_H
#define WINDOW_H
#include <QOpenGLWindow>
#include <QOpenGLBuffer>
#include <QOpenGLVertexArrayObject>
#include <QOpenGLDebugMessage>
#include <QMatrix4x4>
#include <QElapsedTimer>
#include "transform3d.h"
#include "camera3d.h"
// Custom Includes
#include <OpenGLBuffer>
#include <OpenGLFunctions>
#include <OpenGLVertexArrayObject>
class Profiler;
class FrameResult;
class OpenGLError;
//class OpenGLShaderProgram;
class QOpenGLShaderProgram;
class QOpenGLDebugLogger;
class QMoveEvent;
class DataLoader;
class DataAnalyzer;
class Window : public QOpenGLWindow,
protected OpenGLFunctions
{
Q_OBJECT
// OpenGL Events
public:
static const uint64_t FPSFrameDelay = 60;
Window();
~Window();
void initializeGL();
void resizeGL(int width, int height);
void paintGL();
protected slots:
void teardownGL();
void update();
void messageLogged(const QOpenGLDebugMessage &msg);
void onFrameResult(const FrameResult& result);
protected:
bool event(QEvent *event);
void errorEventGL(OpenGLError *event);
void keyPressEvent(QKeyEvent *event);
void keyReleaseEvent(QKeyEvent *event);
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent* event);
void wheelEvent(QWheelEvent* event);
void moveEvent(QMoveEvent *ev);
bool loadData();
void analyzeData();
private:
// OpenGL State Information
OpenGLBuffer m_vertex;
OpenGLBuffer m_vertexAddOn;
OpenGLVertexArrayObject m_object;
OpenGLVertexArrayObject m_objectAddOn;
//OpenGLShaderProgram *m_program;
QOpenGLShaderProgram *m_program;
QOpenGLDebugLogger *m_debugLogger;
Profiler *m_profiler;
uint64_t m_frameCount;
QElapsedTimer m_frameTimer;
// Shader Information
int u_modelToWorld;
int u_worldToCamera;
int u_cameraToView;
QMatrix4x4 m_projection;
Camera3D m_camera;
Transform3D m_transform;
// Data loader
DataLoader* m_dataLoader;
DataAnalyzer* m_dataAnalyzer;
// Private Helpers
void printVersionInformation();
// arcball
QVector3D get_arcball_vector(int x, int y);
};
#endif // WINDOW_H