67 lines
2.1 KiB
C++
67 lines
2.1 KiB
C++
/*
|
|
QGLView
|
|
Ivan Pelipenko peri4ko@yandex.ru
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU Lesser General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU Lesser General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Lesser General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef RENDERER_DEFERRED_SHADING_H
|
|
#define RENDERER_DEFERRED_SHADING_H
|
|
|
|
#include "qglview.h"
|
|
|
|
#include <QLabel>
|
|
|
|
|
|
class RendererDeferredShading: public GLRendererBase {
|
|
public:
|
|
RendererDeferredShading(QGLView * view);
|
|
virtual ~RendererDeferredShading();
|
|
|
|
virtual void renderScene();
|
|
void init(int width, int height);
|
|
void resize(int width, int height);
|
|
void reloadShaders();
|
|
|
|
protected:
|
|
void setupShadersTextures(GLObjectBase & object, RenderingParameters & rp);
|
|
void setupShadersLights(int lights_count) { cplc = lights_count; }
|
|
void setupDSLights(int pass, const QMatrix4x4 & view_matrix);
|
|
void setupAmbientLight(const QColor & a, bool first_pass);
|
|
|
|
private:
|
|
typedef QPair<QString, QOpenGLShaderProgram **> ShaderPair;
|
|
|
|
int cplc, lights_per_pass;
|
|
float exposure_;
|
|
GLFramebuffer fbo_g, fbo_out, fbo_hsmall;
|
|
QOpenGLShaderProgram *shader_fxaa, *shader_ds_0, *shader_ds_1, *shader_hdr, *shader_small;
|
|
QOpenGLShaderProgram *shader_bloom_0, *shader_bloom_1, *shader_motion_blur, *shader_fbo_add;
|
|
QOpenGLShaderProgram *shader_shadow, *shader_ssr, *shader_ssr_blur, *shader_ssr_merge;
|
|
QOpenGLShaderProgram *shader_ssao_blur, *shader_ssao_merge, *shader_dof;
|
|
GLuint tnoise;
|
|
QVector<ShaderPair> shaders;
|
|
|
|
QMatrix4x4 prev_view, prev_proj;
|
|
QMatrix3x3 nm;
|
|
QVector4D corner_dirs[4];
|
|
QVector<Vector3d> hcontent;
|
|
Light amb_light;
|
|
|
|
QWidget * df;
|
|
QLabel *label_exp, *label_exp_step;
|
|
};
|
|
|
|
#endif // RENDERER_DEFERRED_SHADING_H
|