-
Notifications
You must be signed in to change notification settings - Fork 0
/
vritemrenderer.h
74 lines (69 loc) · 1.8 KB
/
vritemrenderer.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
#ifndef GOGGLESITEMRENDERER_H
#define GOGGLESITEMRENDERER_H
#include <QObject>
#include <QTimer>
#include <QMutex>
#define QT_OPENGL_ES_3
#include <QQuickWindow>
#include <QOpenGLFramebufferObject>
#include "./vrprojection.h"
#include "./vrrendergoggles.h"
#include "./vrrenderfullscreen.h"
class VrItem;
/**
* @brief The VrItemRenderer class id pure virtual class which you have to override in otder to render 3d
*/
class VrItemRenderer: public QObject
{
Q_OBJECT
public:
VrItemRenderer(const VrItem * item);
virtual ~VrItemRenderer();
/**
* @brief renderScene In this method
* @param width
* @param height
*/
virtual void renderScene(int width, int height)=0;
/**
* @brief update Force update of the graphics
*/
void update();
/**
* @brief projection
* @return Parameterd of the rendering system.
*/
const VrProjection *projection() const;
/**
* @brief setDistortion
* @param enable Trun off/on rendering with distortion
*/
void setDistortion(bool enable);
/**
* @brief distortion
* @return Is distortion enabled.
*/
bool distortion();
protected:
virtual void updateProjection(const VrProjection *projection);
virtual void synchronize();
private slots:
void windowChanged(QQuickWindow * window);
void afterRendering();
void beforeSynchronizing();
void visibleChanged();
void selfDestruct();
private:
friend class VrItem;
void createFramebuffer(int width, int height);
void deleteFramebuffer();
VrRenderGoggles goggles_render;
VrRenderFullscreen fullscreen_render;
VrProjection config_copy;
QMutex mutex;
const VrItem * item;
GLuint texture, framebuffer, depth_buffer;
bool m_distortion;
bool visible;
};
#endif // GOGGLESITEMRENDERER_H