X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fpipeline.cpp;h=1833001ff1288fb00257450fe694bd9e44ae62a1;hb=cdfdcecd046c494470bfb4cc1de66f6cfca5efec;hp=0546a4e847829f33844cf6236db2047816ba0b2f;hpb=f33a98b1a044c8ac7b12778cbca6c4a124875e4a;p=libs%2Fgl.git diff --git a/source/pipeline.cpp b/source/pipeline.cpp index 0546a4e8..1833001f 100644 --- a/source/pipeline.cpp +++ b/source/pipeline.cpp @@ -40,8 +40,17 @@ void Pipeline::set_hdr(bool h) if(h==hdr) return; + bool old_hdr= hdr; hdr = h; - create_targets(2); + try + { + create_targets(2); + } + catch(...) + { + hdr = old_hdr; + throw; + } } void Pipeline::set_multisample(unsigned s) @@ -111,7 +120,15 @@ void Pipeline::remove_renderable(const Renderable &r) void Pipeline::add_postprocessor(PostProcessor &pp) { postproc.push_back(&pp); - create_targets(0); + try + { + create_targets(0); + } + catch(...) + { + postproc.pop_back(); + throw; + } } void Pipeline::setup_frame() const @@ -161,13 +178,14 @@ void Pipeline::render(Renderer &renderer, const Tag &tag) const Bind bind_depth_test(i->get_depth_test()); Bind bind_blend(i->get_blend()); renderer.set_lighting(i->get_lighting()); + renderer.set_clipping(i->get_clipping()); for(vector::const_iterator j=renderables.begin(); j!=renderables.end(); ++j) if(j->passes.empty() || j->passes.count(i->get_tag())) renderer.render(*j->renderable, i->get_tag()); } - renderer.escape(); + renderer.end(); if(target[0]) { @@ -224,7 +242,8 @@ Pipeline::Pass::Pass(const Tag &t): tag(t), lighting(0), depth_test(0), - blend(0) + blend(0), + clipping(0) { } void Pipeline::Pass::set_lighting(const Lighting *l) @@ -242,6 +261,11 @@ void Pipeline::Pass::set_blend(const Blend *b) blend = b; } +void Pipeline::Pass::set_clipping(const Clipping *c) +{ + clipping =c; +} + Pipeline::Slot::Slot(const Renderable *r): renderable(r)