From d09f6d3c7ab73abd209bc7a5ae1dddbd1a94fe86 Mon Sep 17 00:00:00 2001 From: hiker Date: Mon, 16 Mar 2015 08:49:36 +1100 Subject: [PATCH] Revert "Clean bloomblending since it's not used anymore" This reverts commit 2206f8ad5c89bae00a54703d91d7e16215b58bb8. Conflicts: src/graphics/post_processing.cpp --- data/shaders/bloomblend.frag | 14 ++++++++++++++ src/graphics/post_processing.cpp | 2 +- src/graphics/shaders.cpp | 10 ++++++++++ src/graphics/shaders.hpp | 6 ++++++ 4 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 data/shaders/bloomblend.frag diff --git a/data/shaders/bloomblend.frag b/data/shaders/bloomblend.frag new file mode 100644 index 000000000..503c9dcb9 --- /dev/null +++ b/data/shaders/bloomblend.frag @@ -0,0 +1,14 @@ +uniform sampler2D tex_128; +uniform sampler2D tex_256; +uniform sampler2D tex_512; + +out vec4 FragColor; + +void main() +{ + vec2 uv = gl_FragCoord.xy / screen; + vec4 col = .125 * texture(tex_128, uv); + col += .25 * texture(tex_256, uv); + col += .5 * texture(tex_512, uv); + FragColor = vec4(col.xyz, 1.); +} diff --git a/src/graphics/post_processing.cpp b/src/graphics/post_processing.cpp index 49f6b4617..11c9ab0f9 100644 --- a/src/graphics/post_processing.cpp +++ b/src/graphics/post_processing.cpp @@ -742,7 +742,7 @@ FrameBuffer *PostProcessing::render(scene::ICameraSceneNode * const camnode, boo renderGaussian6Blur(irr_driver->getFBO(FBO_BLOOM_256), irr_driver->getFBO(FBO_TMP_256), 1., 1.); renderGaussian6Blur(irr_driver->getFBO(FBO_BLOOM_128), irr_driver->getFBO(FBO_TMP_128), 1., 1.); - // Additively blend + // Additively blend on top of tmp1 in_fbo->Bind(); glEnable(GL_BLEND); glBlendFunc(GL_ONE, GL_ONE); diff --git a/src/graphics/shaders.cpp b/src/graphics/shaders.cpp index 532708a67..c3e50ef32 100644 --- a/src/graphics/shaders.cpp +++ b/src/graphics/shaders.cpp @@ -1570,6 +1570,16 @@ namespace FullScreenShader AssignSamplerNames(Program, 0, "tex"); } + + BloomBlendShader::BloomBlendShader() + { + Program = LoadProgram(OBJECT, + GL_VERTEX_SHADER, file_manager->getAsset("shaders/screenquad.vert").c_str(), + GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/bloomblend.frag").c_str()); + AssignUniforms(); + + AssignSamplerNames(Program, 0, "tex_128", 1, "tex_256", 2, "tex_512"); + } LensBlendShader::LensBlendShader() { diff --git a/src/graphics/shaders.hpp b/src/graphics/shaders.hpp index 50a48a759..9661278b1 100644 --- a/src/graphics/shaders.hpp +++ b/src/graphics/shaders.hpp @@ -388,6 +388,12 @@ public: BloomShader(); }; +class BloomBlendShader : public ShaderHelperSingleton, public TextureRead +{ +public: + BloomBlendShader(); +}; + class LensBlendShader : public ShaderHelperSingleton, public TextureRead { public: