X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Frender%2Fsequence.cpp;h=2c32db86518b14033c9452a64be2ed0fb0106397;hp=05cbafff08d66b406242da77228d83d0252d037b;hb=2b2676392aff2eb6b38c3e463cc67f4d67a4ef8b;hpb=1863f17c5c5563be8492d7f01e5c613a740ea1e9 diff --git a/source/render/sequence.cpp b/source/render/sequence.cpp index 05cbafff..2c32db86 100644 --- a/source/render/sequence.cpp +++ b/source/render/sequence.cpp @@ -163,8 +163,6 @@ void Sequence::render(Renderer &renderer, Tag tag) const const Framebuffer *out_fbo = Framebuffer::current(); // These are no-ops but will ensure the related state gets restored BindRestore restore_fbo(out_fbo); - BindRestore restore_depth_test(DepthTest::current()); - BindRestore restore_blend(Blend::current()); if(target[0]) { @@ -175,17 +173,14 @@ void Sequence::render(Renderer &renderer, Tag tag) const for(vector::const_iterator i=steps.begin(); i!=steps.end(); ++i) { - if(const DepthTest *dt = i->get_depth_test()) - dt->bind(); - else - DepthTest::unbind(); + Renderer::Push push(renderer); - if(const Blend *b = i->get_blend()) - b->bind(); - else - Blend::unbind(); + renderer.set_depth_test(&i->get_depth_test()); + renderer.set_stencil_test(&i->get_stencil_test()); + renderer.set_blend(&i->get_blend()); - renderer.set_lighting(i->get_lighting()); + if (const Lighting *lighting = i->get_lighting()) + renderer.add_shader_data(lighting->get_shader_data()); renderer.set_clipping(i->get_clipping()); if(const Renderable *renderable = i->get_renderable()) @@ -194,8 +189,9 @@ void Sequence::render(Renderer &renderer, Tag tag) const if(target[0]) { - DepthTest::unbind(); - Blend::unbind(); + renderer.set_depth_test(0); + renderer.set_stencil_test(0); + renderer.set_blend(0); if(samples) target[0]->blit_from(*target_ms); @@ -274,8 +270,6 @@ void Sequence::set_target_debug_names() Sequence::Step::Step(Tag t, Renderable *r): tag(t), lighting(0), - depth_test(0), - blend(0), clipping(0), renderable(r) { } @@ -285,12 +279,17 @@ void Sequence::Step::set_lighting(const Lighting *l) lighting = l; } -void Sequence::Step::set_depth_test(const DepthTest *d) +void Sequence::Step::set_depth_test(const DepthTest &dt) { - depth_test = d; + depth_test = dt; } -void Sequence::Step::set_blend(const Blend *b) +void Sequence::Step::set_stencil_test(const StencilTest &st) +{ + stencil_test = st; +} + +void Sequence::Step::set_blend(const Blend &b) { blend = b; }