-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathRenderWindow.h
More file actions
executable file
·73 lines (52 loc) · 1.6 KB
/
RenderWindow.h
File metadata and controls
executable file
·73 lines (52 loc) · 1.6 KB
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
#pragma once
#include <functional>
#include <QOpenGLWidget>
#include <QOpenGLFunctions_3_3_Core>
#include <QOpenGLVertexArrayObject>
#include <QOpenGLBuffer>
#include <QMatrix4x4>
#include <QMutex>
#include "OpenGLMouseAdapterWidget.h"
#include "Core/Engine.h"
QT_FORWARD_DECLARE_CLASS(QOpenGLShaderProgram)
using QOpenGLFunctionsBase = QOpenGLFunctions_3_3_Core;
class RenderWindow : public OpenGLMouseAdapterWidget, protected QOpenGLFunctionsBase
{
Q_OBJECT
public:
typedef std::function<void(RenderWindow*)> LifeCycleEventCallback;
RenderWindow(QWidget *parent = 0);
~RenderWindow();
static bool isTransparent() { return m_transparent; }
static void setTransparent(bool t) { m_transparent = t; }
QSize minimumSizeHint() const override;
QSize sizeHint() const override;
Core::WeakPointer<Core::Engine> getEngine();
void onInit(LifeCycleEventCallback func);
QMutex& getUpdateMutex();
void start();
public slots:
void cleanup();
void mainLoop();
signals:
protected:
void initializeGL() override;
void paintGL() override;
void resizeGL(int width, int height) override;
private:
bool m_core;
QOpenGLVertexArrayObject m_vao;
static bool m_transparent;
void init();
void engineUpdate();
void engineRender();
void resolveOnInits();
void resolveOnInit(LifeCycleEventCallback callback);
QMutex onPreRenderMutex;
QMutex onUpdateMutex;
QMutex updateMutex;
bool initialized;
bool engineInitialized;
Core::PersistentWeakPointer<Core::Engine> engine;
std::vector<LifeCycleEventCallback> onInits;
};