-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathLesson6Renderer.h
More file actions
99 lines (77 loc) · 3.01 KB
/
Lesson6Renderer.h
File metadata and controls
99 lines (77 loc) · 3.01 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#ifndef LESSON6RENDERER_H
#define LESSON6RENDERER_H
#include "TutorialRenderer.h"
class Lesson6Renderer : public TutorialRenderer
{
Q_OBJECT
Q_PROPERTY(InterpolationType currentInterpolationType READ currentInterpolationType WRITE setCurrentInterpolationType NOTIFY currentInterpolationTypeChanged)
Q_PROPERTY(bool bloomUsed READ bloomUsed WRITE setBloomUsed NOTIFY bloomUsedChanged)
Q_PROPERTY(float blur READ blur WRITE setBlur NOTIFY blurChanged)
Q_PROPERTY(float threshold READ threshold WRITE setThreshold NOTIFY thresholdChanged)
public:
float oldH = 0;
float oldW = 0;
bool checkSizeChange();
void reinitTextures();
bool texturesDone = false;
bool bloomUsed() const;
void setBloomUsed(bool value);
float blur() const;
void setBlur(float blur);
float threshold() const;
void setThreshold(float threshold);
void RenderQuad();
enum InterpolationType
{
Flat,
Smooth,
Gouraud
};
Q_ENUM(InterpolationType)
Q_INVOKABLE Lesson6Renderer();
~Lesson6Renderer() override;
virtual void initialize() override;
virtual void keyReleaseEvent(QKeyEvent* event) override;
virtual QString getOptionsUrl() const override { return "Lesson6Options.qml"; }
virtual QString getDescriptionUrl() const override { return "file:///" + QDir::currentPath() + "/Assets/Lesson 6/Description/description.html"; }
InterpolationType currentInterpolationType() const;
void setCurrentInterpolationType(InterpolationType type);
signals:
void currentInterpolationTypeChanged(InterpolationType type);
void bloomUsedChanged(bool value);
void blurChanged(float blur);
void thresholdChanged(float threshold);
public slots:
virtual void paint() override;
protected:
virtual void update(float deltaTime) override;
float blurValue = 10.0f;
float thresholdValue = 1.0f;
unsigned int renderedTexture;
unsigned int framebuffer;
unsigned int renderbuffer;
unsigned int renderedTexture2;
unsigned int framebuffer2;
unsigned int renderbuffer2;
unsigned int renderedTexture3;
unsigned int framebuffer3;
unsigned int renderbuffer3;
unsigned int renderedTexture33;
unsigned int framebuffer33;
unsigned int renderbuffer33;
int framebufferSize = 2048;
private:
unsigned int planeVAO;
unsigned int planeVBO;
bool bloomAllowed = true;
InterpolationType interpolationType = Flat;
Transform modelTransform;
Model model;
QOpenGLShaderProgram* program = nullptr;
QOpenGLShaderProgram* blurProgram = nullptr;
QOpenGLShaderProgram* blurProgram2 = nullptr;
QOpenGLShaderProgram* brightProgram = nullptr;
QOpenGLShaderProgram* blendProgram = nullptr;
};
Q_DECLARE_METATYPE(Lesson6Renderer*)
#endif // LESSON6RENDERER_H