From bd6ad544cc7d81c65f47416a4205bb7c1975b846 Mon Sep 17 00:00:00 2001 From: Deve Date: Mon, 15 Aug 2016 08:46:02 +0200 Subject: [PATCH] Fixed bloom with scale_rtts_factor parameter. --- data/shaders/bloom.frag | 3 ++- src/graphics/post_processing.cpp | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/data/shaders/bloom.frag b/data/shaders/bloom.frag index 78bfbf965..a94402950 100644 --- a/data/shaders/bloom.frag +++ b/data/shaders/bloom.frag @@ -1,4 +1,5 @@ uniform sampler2D tex; +uniform float scale; out vec4 FragColor; @@ -7,7 +8,7 @@ out vec4 FragColor; void main() { - vec2 uv = gl_FragCoord.xy / 512.; + vec2 uv = gl_FragCoord.xy / (512. * scale); vec3 col = texture(tex, uv).xyz; vec3 Yxy = getCIEYxy(col); vec3 WhiteYxy = getCIEYxy(vec3(1.)); diff --git a/src/graphics/post_processing.cpp b/src/graphics/post_processing.cpp index 593565767..d68fc4a21 100644 --- a/src/graphics/post_processing.cpp +++ b/src/graphics/post_processing.cpp @@ -327,21 +327,21 @@ public: }; // ComputeGaussian17TapVShader // ============================================================================ -class BloomShader : public TextureShader +class BloomShader : public TextureShader { public: BloomShader() { loadProgram(OBJECT, GL_VERTEX_SHADER, "screenquad.vert", GL_FRAGMENT_SHADER, "bloom.frag"); - assignUniforms(); + assignUniforms("scale"); assignSamplerNames(0, "tex", ST_NEAREST_FILTERED); } // BloomShader // ------------------------------------------------------------------------ void render(GLuint in) { BloomShader::getInstance()->setTextureUnits(in); - drawFullScreenEffect(); + drawFullScreenEffect(UserConfigParams::m_scale_rtts_factor); } // render }; // BloomShader