forked from mamont-92/EqRec2Cubemap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCubemapFBORender.h
58 lines (46 loc) · 1.47 KB
/
CubemapFBORender.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
#ifndef CUBEMAPFBORENDER_H
#define CUBEMAPFBORENDER_H
#include <QObject>
#include <QQuickFramebufferObject>
#include <QOpenGLFunctions>
#include <QOpenGLShaderProgram>
#include <QVector>
#include <QVector3D>
#include <QOpenGLTexture>
#include <QImage>
#include <QHash>
#include "CubemapQuickRender.h"
class CubemapFBORender : public QObject, public QQuickFramebufferObject::Renderer, protected QOpenGLFunctions
{
Q_OBJECT
public:
CubemapFBORender(QObject *parent=Q_NULLPTR);
void render();
QOpenGLFramebufferObject *createFramebufferObject(const QSize &size);
signals:
void imageReady(QImage);
public slots:
void setImage(QImage img);
void setYRotation(float _yRotation);
void setScheme(CubemapQuickRender::Scheme);
protected:
void synchronize(QQuickFramebufferObject *item);
private:
struct SchemeDataElement;
void initDataBuffer();
void drawGeometry();
QOpenGLShaderProgram m_shaderProgram;
int m_vertexAttribId, m_cubemapCoordsAttribId;
int m_matrixUniformId;
int m_textureSamplerId;
int m_yRotationUniformId;
float m_yRotation;
QVector<SchemeDataElement> m_schemeData;
QHash<int, int> m_schemeDataStartInd; //(int)enum -> int
QHash<int, QSize> m_schemeProjectionSize; //(int)enum -> QSize
QOpenGLTexture m_equrectangleMap;
CubemapQuickRender::Scheme m_scheme;
size_t m_faceRealSize;
QSize m_outSize;
};
#endif // CUBEMAPFBORENDER_H