X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fbloom.cpp;h=c7bfd467418b12f58cc3eb9c08afb46878a143c0;hb=47bfbdc8cf844aa079995fca34a3b906b49a4f66;hp=7537b0a6a80711fdcb1ff6cfc9b005b60d27fecc;hpb=a525c632144d3dcefe373916bdde789727d2230d;p=libs%2Fgl.git diff --git a/source/bloom.cpp b/source/bloom.cpp index 7537b0a6..c7bfd467 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); @@ -75,13 +76,35 @@ void Bloom::render(Renderer &renderer, const Texture2D &src, const Texture2D &) Renderer::Push push2(renderer); renderer.set_texture(i ? &target[0]->get_target_texture(RENDER_COLOR) : &src); renderer.add_shader_data(blur_shdata[i]); - quad.draw(renderer); + quad->draw(renderer); } combine_texturing.attach(0, src); renderer.set_texturing(&combine_texturing); renderer.set_shader_program(&combine_shader); - quad.draw(renderer); + 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