X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fbloom.cpp;h=6484d052fdb2691b80747cd3965bc2925a799517;hp=7537b0a6a80711fdcb1ff6cfc9b005b60d27fecc;hb=56beca9d8b4f7b4edac81411d31e24df88e84ac3;hpb=a525c632144d3dcefe373916bdde789727d2230d diff --git a/source/bloom.cpp b/source/bloom.cpp index 7537b0a6..6484d052 100644 --- a/source/bloom.cpp +++ b/source/bloom.cpp @@ -23,6 +23,7 @@ Bloom::Bloom(unsigned w, unsigned h): for(unsigned i=0; i<2; ++i) target[i] = new RenderTarget(w, h, (RENDER_COLOR,RGB16F)); + target[1]->set_texture_filter(LINEAR); common_shdata.uniform("source", 0); common_shdata.uniform("blurred", 1); @@ -84,5 +85,27 @@ void Bloom::render(Renderer &renderer, const Texture2D &src, const Texture2D &) quad.draw(renderer); } + +Bloom::Template::Template(): + radius(2.0f), + strength(0.2f) +{ } + +Bloom *Bloom::Template::create(unsigned width, unsigned height) const +{ + RefPtr bloom = new Bloom(width/size_divisor, height/size_divisor); + bloom->set_radius(radius); + bloom->set_strength(strength); + return bloom.release(); +} + + +Bloom::Template::Loader::Loader(Template &t): + DataFile::DerivedObjectLoader(t) +{ + add("strength", &Template::strength); + add("radius", &Template::radius); +} + } // namespace GL } // namespace Msp