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 Bleeds very bright areas of the image into surrounding pixels to simulate
15 optical imperfections in lenses.
17 The input image is blurred with a gaussian kernel to simulate the Airy disc
18 produced by a lens, then the blurred image is blended with the original.
20 class Bloom: public PostProcessor
23 struct Template: public PostProcessor::Template
25 class Loader: public DataFile::DerivedObjectLoader<Template, PostProcessor::Template::Loader>
32 float strength = 0.2f;
34 virtual Bloom *create(unsigned, unsigned) const;
38 RenderTarget *target[2];
39 ProgramData common_shdata;
40 const Program &blur_shader;
41 ProgramData blur_shdata[2];
42 const Program &combine_shader;
44 const Sampler &nearest_sampler;
45 const Sampler &linear_sampler;
48 Bloom(unsigned, unsigned);
51 /** Sets the σ value of the gaussian blur. Values much larger than 4.0 are
52 likely to cause artifacts. */
53 void set_radius(float);
55 /** Sets the blend factor between original and blurred images. Larger
56 values mean more blurriness. */
57 void set_strength(float);
59 virtual void render(Renderer &, const Texture2D &, const Texture2D &);
61 virtual void set_debug_name(const std::string &);