Gem Illuminator
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros
painter.h
Go to the documentation of this file.
1 #ifndef PAINTER_H
2 #define PAINTER_H
3 
4 #include <QObject>
5 
6 class QOpenGLFunctions;
7 class QOpenGLShaderProgram;
8 class QSize;
9 class QTime;
10 
11 class Camera;
12 class BlurEffect;
13 class CubeMap;
14 class EnvironmentMap;
15 class PainterQML;
16 class ScreenAlignedQuad;
17 class Scene;
18 class SceneRenderer;
19 enum class ShaderPrograms;
20 
26 class Painter : public QObject
27 {
28  Q_OBJECT
29 public:
35  explicit Painter(PainterQML *painter, QObject *parent = 0);
36 
40  virtual ~Painter();
41 
45  void updateEnvMap();
46 
51  bool isActive() const;
56  void setActive(bool active);
57 
61  void clearScene();
62 
67  void synchronizeScene(Scene *scene);
68 
69 public slots:
73  void paint();
74 
75 signals:
80  void initializeDone();
81 
82 protected:
88  void initialize();
89  void initializeFBOs();
91  void renderLightRays(const Camera &camera);
92  void renderScene(const Camera &camera);
93 
94 protected slots:
95  void handleInitializeDone();
96 
97 protected:
98  bool m_active;
100  QOpenGLFunctions *m_gl;
102 
108 
114 
118 
121 
124 
128 
131 
134  QTime *m_time;
135 
139 };
140 
141 #endif // PAINTER_H
The Painter class Includes the rendering process, thus creating the whole picture. The Painter will be used by QML within rendering thread.
Definition: painter.h:26
EnvironmentMap * m_envMap
Definition: painter.h:99
void initializeDone()
This signal is emitted if initialization of all required resources for current scene are initialized...
int m_oldElapsed
Definition: painter.h:133
uint m_sceneFBO
Definition: painter.h:125
void initializeFBOs()
Definition: painter.cpp:314
Camera * m_previewCamera
Definition: painter.h:138
CubeMap * m_rainbowMap
Definition: painter.h:122
void initialize()
Initializes all required resources, that are direct members of painter (scene independent resources)...
Definition: painter.cpp:296
PainterQML * m_painterQML
Definition: painter.h:119
QHash< ShaderPrograms, QOpenGLShaderProgram * > * m_shaderPrograms
Definition: painter.h:129
Painter(PainterQML *painter, QObject *parent=0)
Constructor of Painter.
Definition: painter.cpp:24
int m_blurViewportRatioScene
Definition: painter.h:104
bool m_active
Definition: painter.h:98
void renderScene(const Camera &camera)
Definition: painter.cpp:456
QTime * m_time
Definition: painter.h:134
The EnvironmentMap is a CubeMap based rendering technique for showing some scene enviroment.
Definition: environmentmap.h:16
BlurEffect * m_blurEffectPreviewScene
Definition: painter.h:109
void renderLightRays(const Camera &camera)
Definition: painter.cpp:451
uint m_glowPreviewSceneDepthRB
Definition: painter.h:112
uint m_previewSceneFBO
Definition: painter.h:115
The BlurEffect blurs a given texture.
Definition: blureffect.h:17
The CubeMap class loads cubemap textures and provides them as OpenGL-texture.
Definition: cubemap.h:11
uint m_glowSceneTexture
Definition: painter.h:107
The Camera class provides view and perspective projection matrices. Additional the viewport of camera...
Definition: camera.h:16
void setActive(bool active)
Sets Active state. If active is true the painter renders the picture.
Definition: painter.cpp:90
QSize * m_usedViewport
Definition: painter.h:130
bool isActive() const
Checks if Painter is active. Active means the painter is rendering.
Definition: painter.cpp:85
BlurEffect * m_blurEffectScene
Definition: painter.h:103
void synchronizeScene(Scene *scene)
Painter copies all needed information of scene into own thread.
Definition: painter.cpp:104
uint m_previewSceneDepthRB
Definition: painter.h:116
void updateEnvMap()
Updates environment map using config file.
Definition: painter.cpp:444
int m_blurViewportRatioPreviewScene
Definition: painter.h:110
uint m_glowSceneDepthRB
Definition: painter.h:106
uint m_glowSceneFBO
Definition: painter.h:105
Camera * m_camera
Definition: painter.h:137
The Scene class provides access to geometry and collision detection methods. Furthermore, some game logic is implemented, so the scene holds the player, the gem influenced by player and cameras.
Definition: scene.h:22
CubeMap * m_gemStructureMap
Definition: painter.h:123
ScreenAlignedQuad * m_quad
Definition: painter.h:120
The ScreenAlignedQuad class encapsulates the drawing of a screen aligned quad.
Definition: screenalignedquad.h:10
SceneRenderer * m_sceneRenderer
Definition: painter.h:136
virtual ~Painter()
Destructor. Will delete all rendering related classes and resources.
Definition: painter.cpp:50
uint m_sceneTexture
Definition: painter.h:127
The SceneRenderer class Renders the scene: Packs the scene in the buffer and draws the scene in as f...
Definition: scenerenderer.h:23
void clearScene()
Clears the scene and removes all not anymore required resources.
Definition: painter.cpp:95
void handleInitializeDone()
Definition: painter.cpp:499
int m_counter
Definition: painter.h:132
uint m_glowPreviewSceneFBO
Definition: painter.h:111
The PainterQML class is responsible for making our game visible within QML using Painter. This class is intended to be added and created within QML. As the element showing our game it recognizes resize events and update events needed by our application. Also it keeps our rendering alive. Furthermore, it is the interface between game logic and rendering.
Definition: painterqml.h:18
ShaderPrograms
The ShaderPrograms enum Manage ShaderPrograms with the help of this enum class. If it is neccessary ...
Definition: shaderprograms.h:14
void paint()
Starts rendering and paints the whole picture.
Definition: painter.cpp:124
bool m_initialized
Definition: painter.h:101
uint m_sceneDepthRB
Definition: painter.h:126
QOpenGLFunctions * m_gl
Definition: painter.h:100
uint m_previewSceneTexture
Definition: painter.h:117
uint m_glowPreviewSceneTexture
Definition: painter.h:113
void initializeShaderPrograms()
Definition: painter.cpp:405