-
-
Notifications
You must be signed in to change notification settings - Fork 88
/
Copy pathpbrshaderprogram.h
117 lines (113 loc) · 4.68 KB
/
pbrshaderprogram.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
/*
* Copyright (c) 2020 Jeremy HU <jeremy-at-dust3d dot org>. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef AUTO_REMESHER_PBR_SHADER_PROGRAM_H
#define AUTO_REMESHER_PBR_SHADER_PROGRAM_H
#include <QOpenGLShaderProgram>
#include <QString>
class PbrShaderProgram : public QOpenGLShaderProgram
{
public:
PbrShaderProgram(bool isCoreProfile);
int projectionMatrixLoc();
int modelMatrixLoc();
int normalMatrixLoc();
int viewMatrixLoc();
int eyePosLoc();
int textureIdLoc();
int textureEnabledLoc();
int normalMapEnabledLoc();
int normalMapIdLoc();
int metalnessMapEnabledLoc();
int roughnessMapEnabledLoc();
int ambientOcclusionMapEnabledLoc();
int metalnessRoughnessAmbientOcclusionMapIdLoc();
int mousePickEnabledLoc();
int mousePickTargetPositionLoc();
int mousePickRadiusLoc();
int environmentIrradianceMapIdLoc();
int environmentIrradianceMapEnabledLoc();
int environmentSpecularMapIdLoc();
int environmentSpecularMapEnabledLoc();
bool isCoreProfile();
static const QString &loadShaderSource(const QString &name);
void setProjectionMatrixValue(const QMatrix4x4 &value);
void setModelMatrixValue(const QMatrix4x4 &value);
void setNormalMatrixValue(const QMatrix3x3 &value);
void setViewMatrixValue(const QMatrix4x4 &value);
void setEyePosValue(const QVector3D &value);
void setTextureIdValue(int value);
void setTextureEnabledValue(int value);
void setNormalMapEnabledValue(int value);
void setNormalMapIdValue(int value);
void setMetalnessMapEnabledValue(int value);
void setRoughnessMapEnabledValue(int value);
void setAmbientOcclusionMapEnabledValue(int value);
void setMetalnessRoughnessAmbientOcclusionMapIdValue(int value);
void setMousePickEnabledValue(int value);
void setMousePickTargetPositionValue(const QVector3D &value);
void setMousePickRadiusValue(float value);
void setEnvironmentIrradianceMapIdValue(int value);
void setEnvironmentIrradianceMapEnabledValue(int value);
void setEnvironmentSpecularMapIdValue(int value);
void setEnvironmentSpecularMapEnabledValue(int value);
private:
bool m_isCoreProfile = false;
int m_projectionMatrixLoc = 0;
int m_modelMatrixLoc = 0;
int m_normalMatrixLoc = 0;
int m_viewMatrixLoc = 0;
int m_eyePosLoc = 0;
int m_textureIdLoc = 0;
int m_textureEnabledLoc = 0;
int m_normalMapEnabledLoc = 0;
int m_normalMapIdLoc = 0;
int m_metalnessMapEnabledLoc = 0;
int m_roughnessMapEnabledLoc = 0;
int m_ambientOcclusionMapEnabledLoc = 0;
int m_metalnessRoughnessAmbientOcclusionMapIdLoc = 0;
int m_mousePickEnabledLoc = 0;
int m_mousePickTargetPositionLoc = 0;
int m_mousePickRadiusLoc = 0;
int m_environmentIrradianceMapIdLoc = 0;
int m_environmentIrradianceMapEnabledLoc = 0;
int m_environmentSpecularMapIdLoc = 0;
int m_environmentSpecularMapEnabledLoc = 0;
QMatrix4x4 m_projectionMatrixValue;
QMatrix4x4 m_modelMatrixValue;
QMatrix3x3 m_normalMatrixValue;
QMatrix4x4 m_viewMatrixValue;
QVector3D m_eyePosValue;
int m_textureIdValue = -1;
int m_textureEnabledValue = -1;
int m_normalMapEnabledValue = -1;
int m_normalMapIdValue = -1;
int m_metalnessMapEnabledValue = -1;
int m_roughnessMapEnabledValue = -1;
int m_ambientOcclusionMapEnabledValue = -1;
int m_metalnessRoughnessAmbientOcclusionMapIdValue = -1;
int m_mousePickEnabledValue = -1;
QVector3D m_mousePickTargetPositionValue;
float m_mousePickRadiusValue = 0.0;
int m_environmentIrradianceMapIdValue = -1;
int m_environmentIrradianceMapEnabledValue = -1;
int m_environmentSpecularMapIdValue = -1;
int m_environmentSpecularMapEnabledValue = -1;
};
#endif