git-svn-id: svn://db.shs.com.ru/libs@67 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -31,7 +31,8 @@ fbo_g(5, true, GL_RGBA16F), fbo_out(3, false, GL_RGB16F), fbo_hsmall(1, false, G
|
||||
<< ShaderPair("bloom_pass_1", &shader_bloom_1)
|
||||
<< ShaderPair("fbo_add", &shader_fbo_add)
|
||||
<< ShaderPair("motion_blur", &shader_motion_blur)
|
||||
<< ShaderPair("shadow", &shader_shadow);
|
||||
<< ShaderPair("shadow", &shader_shadow)
|
||||
<< ShaderPair("ssr", &shader_ssr);
|
||||
for (int i = 0; i < shaders.size(); ++i)
|
||||
*(shaders[i].second) = 0;
|
||||
lights_per_pass = 8;
|
||||
@@ -194,6 +195,27 @@ void RendererDeferredShading::renderScene() {
|
||||
glActiveTextureChannel(0);
|
||||
glBindTexture(GL_TEXTURE_2D, fbo_out.colorTexture(ri));
|
||||
|
||||
if (view.isFeatureEnabled(QGLView::qglDynamicReflectionsEnabled)) {
|
||||
fbo_out.setWriteBuffer(wi);
|
||||
glActiveTextureChannel(1);
|
||||
glBindTexture(GL_TEXTURE_2D, fbo_g.colorTexture(0));
|
||||
glActiveTextureChannel(2);
|
||||
glBindTexture(GL_TEXTURE_2D, fbo_g.colorTexture(1));
|
||||
shader_ssr->bind();
|
||||
shader_ssr->setUniformValue("qgl_ModelViewProjectionMatrix", QMatrix4x4());
|
||||
shader_ssr->setUniformValue("dt", QVector2D(1. / fbo_out.width(), 1. / fbo_out.height()));
|
||||
shader_ssr->setUniformValue("t0", 1);
|
||||
shader_ssr->setUniformValue("t1", 2);
|
||||
shader_ssr->setUniformValue("ts", 0);
|
||||
//shader_ssr->setUniformValue("ts", 1);
|
||||
shader_ssr->setUniformValue("factor", GLfloat(view.feature(QGLView::qglMotionBlurFactor).toDouble()));
|
||||
shader_ssr->setUniformValue("steps", view.feature(QGLView::qglMotionBlurSteps).toInt());
|
||||
glDrawQuad(shader_ssr);
|
||||
glActiveTextureChannel(0);
|
||||
glBindTexture(GL_TEXTURE_2D, fbo_out.colorTexture(wi));
|
||||
piSwap<int>(wi, ri);
|
||||
}
|
||||
|
||||
if (view.isFeatureEnabled(QGLView::qglEyeAccomodationEnabled)) {
|
||||
fbo_hsmall.bind();
|
||||
fbo_hsmall.setWriteBuffer(0);
|
||||
@@ -256,7 +278,8 @@ void RendererDeferredShading::renderScene() {
|
||||
fbo_out.setWriteBuffer(2);
|
||||
fbo_out.setReadBuffer(ri);
|
||||
glBlitFramebuffer(0, 0, fbo_out.width(), fbo_out.height(), 0, 0, fbo_out.width(), fbo_out.height(), GL_COLOR_BUFFER_BIT, GL_NEAREST);
|
||||
|
||||
QTime tm;
|
||||
tm.restart();
|
||||
fbo_out.setWriteBuffer(wi);
|
||||
shader_bloom_0->bind();
|
||||
shader_bloom_0->setUniformValue("qgl_ModelViewProjectionMatrix", QMatrix4x4());
|
||||
@@ -284,7 +307,7 @@ void RendererDeferredShading::renderScene() {
|
||||
piSwap<int>(wi, ri);
|
||||
crad *= 2;
|
||||
}
|
||||
|
||||
qDebug() << tm.elapsed();
|
||||
fbo_out.setWriteBuffer(wi);
|
||||
glActiveTextureChannel(0);
|
||||
glBindTexture(GL_TEXTURE_2D, fbo_out.colorTexture(ri));
|
||||
@@ -345,11 +368,6 @@ void RendererDeferredShading::reloadShaders() {
|
||||
|
||||
|
||||
void RendererDeferredShading::setupShadersTextures(GLObjectBase & object, GLRendererBase::RenderingParameters & rp) {
|
||||
shader_ds_0->setUniformValue("has_diffuse", object.material().map_diffuse.bitmap_id != 0);
|
||||
shader_ds_0->setUniformValue("has_bump", object.material().map_normal.bitmap_id != 0);
|
||||
shader_ds_0->setUniformValue("has_height", object.material().map_relief.bitmap_id != 0);
|
||||
shader_ds_0->setUniformValue("bump_scale", object.material().map_normal.color_amount);
|
||||
shader_ds_0->setUniformValue("height_scale", object.material().map_relief.color_amount);
|
||||
glActiveTextureChannel(6);
|
||||
glBindTexture(GL_TEXTURE_2D, white_image_id);
|
||||
glActiveTextureChannel(7);
|
||||
|
||||
Reference in New Issue
Block a user