1 #ifndef MSP_GL_BLOOM_H_
2 #define MSP_GL_BLOOM_H_
4 #include "postprocessor.h"
5 #include "programdata.h"
6 #include "rendertarget.h"
14 The Bloom post-processing effect causes very bright areas of the image to bleed
15 into surrounding pixels. Commonly used together with HDR rendering.
17 The technique used is to gaussian blur the image and then blend the result with
18 the original image. With suitable parameters, this effect may also be used as
21 class Bloom: public PostProcessor
24 struct Template: public PostProcessor::Template
26 class Loader: public DataFile::DerivedObjectLoader<Template, PostProcessor::Template::Loader>
33 float strength = 0.2f;
35 virtual Bloom *create(unsigned, unsigned) const;
39 RenderTarget *target[2];
40 ProgramData common_shdata;
41 const Program &blur_shader;
42 ProgramData blur_shdata[2];
43 const Program &combine_shader;
45 const Sampler &nearest_sampler;
46 const Sampler &linear_sampler;
49 Bloom(unsigned, unsigned);
52 /** Sets the σ value of the gaussian blur. Values much larger than 4.0 are
53 likely to cause artifacts. */
54 void set_radius(float);
56 /** Sets the blend factor between original and blurred images. Larger
57 values mean more blurriness. */
58 void set_strength(float);
60 virtual void render(Renderer &, const Texture2D &, const Texture2D &);
62 virtual void set_debug_name(const std::string &);