-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathReprojMT.h
131 lines (106 loc) · 3.93 KB
/
ReprojMT.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
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#ifndef REPROJMT_H
#define REPROJMT_H
#include "GLWindow.h"
#include "Mesh.h"
#include "Camera.h"
#include "StereoCamera.h"
#include "ImageQuality.h"
#define GLM_ENABLE_EXPERIMENTAL
#include <glm/gtx/string_cast.hpp>
#include <FreeImage.h>
#include "Mesh.h"
struct worldViewProj {
glm::mat4 modelWorld;
glm::mat4 worldView;
glm::mat4 Projection;
};
struct TargetFBO {
GLuint gBuffer;
GLuint gColor;
GLuint gDepth;
};
class ReprojMT
{
public:
ReprojMT(int width, int height);
~ReprojMT();
void init(string fMeshPath, string cMeshPath,int numTargets, int numFrames, string directory = "./cached");
void setPath(int cameraOption, int roateOption, int translateOption);
void setPath3(int cameraOption, int roateOption, int translateOption,
int scalePeriod, int rotatePeriod, int translateXPeriod);
vector<float> renderReprojMT(float threshold, bool leftPrimary, bool enableFlip,
bool debug = false);
void updateModels(string fMeshPath, string cMeshPath);
void updateCoarseModel(string cMeshPath);
void updateShaderComplex(int loopVS, int loopFS);
void updateDirectory(string directory);
void updateRenderOption(int renderOption);
void updateNumFrames(int numFrames);
void updateQuality(bool quality);
void updateThetaPhi(float theta, float phi) {
_theta = theta;
_phi = phi;
}
private:
string _directory;
GLWindow* _window;
int windowWidth, windowHeight;
Mesh* _a;
Mesh* _coarseA;
Camera* _camera;
StereoCamera* _stereoCam;
Shader _quadShader;
Shader _phongShader;
Shader _reprojShaderMT;
Shader _noiseShader;
int _renderOption;// use _renderOption num targets
int _numTargets;
vector<worldViewProj> _targetMVPS;
vector<TargetFBO> _targetFBOS;
TargetFBO _renderFBO;
worldViewProj _renderMVP;
TargetFBO _cacheFBO;
worldViewProj _cacheMVP;
GLuint quadVAO, quadVBO;
// path
int _numFrames;
vector<float> _cameraPath;
vector<float> _modelRotateYPath;
vector<float> _modelTranslateXPath;
bool _measureQuality;
ImageQuality _quality;
GLuint _atomicBufferID;// atomic counter buffer
// option
// bool _useMask;
// int _useSpecular;
// rotation
float _theta;
float _phi;
void setupPhongShader();
void updatePhongShader(const worldViewProj& mvp);
void setupNoiseShader();
void updateNoiseShader(const worldViewProj& mvp);
void setupQuadShader();
void updateQuadShader(GLuint gColor);
void renderQuad();
void setupReprojMTShader();
void updateReprojMTShader(int numTarget, const vector<int>& targetIds, worldViewProj& curMVP);
//void updateReprojMTShader(const worldViewProj& curMVP);
// target framebuffer
void setupTargets(int numTargets);
void setupRenderFBO();
void setupCacheFBO();
void setupFBO(GLuint& gBuffer, GLuint& gColor, GLuint& gDepth);
// path
void setMVP(int frameId, bool left, worldViewProj& mvp);
void setCameraPath(float initZ, float stepZ, int option = 1);
void setModelRotateYPath(int periodMotion, int option = 1);
void setModelTranslateXPath(float stepTranslateX, int option = 1);
// Atomic counter buffer
void setAtomicCounterbuffer();
void clearAtomicCounterbuffer();
pair<GLuint, GLuint> readAtomicCounterbuffer();
void saveFigure(bool savePNG, int frameId, const string& thresholdDir, bool renderLeft);
void saveGTFigure(bool savePNG, int frameId, const string& thresholdDir, bool renderLeft);
};
#endif // REPROJMT_H