Sequence::~Sequence()
{
+ for(vector<PostProcStep>::iterator i=postproc.begin(); i!=postproc.end(); ++i)
+ if(i->owned)
+ delete i->postproc;
delete target[0];
delete target[1];
delete target_ms;
void Sequence::add_postprocessor(PostProcessor &pp)
{
- add_postprocessor(&pp, true);
+ add_postprocessor(&pp, false);
}
void Sequence::add_postprocessor_owned(PostProcessor *pp)
{
- add_postprocessor(pp, false);
+ add_postprocessor(pp, true);
}
-void Sequence::add_postprocessor(PostProcessor *pp, bool keep)
+void Sequence::add_postprocessor(PostProcessor *pp, bool owned)
{
- postproc.push_back(pp);
- if(keep)
- postproc.back().keep();
+ postproc.push_back(PostProcStep(pp, owned));
try
{
create_targets(0);
}
catch(...)
{
+ if(!owned)
+ delete pp;
postproc.pop_back();
throw;
}
out_fbo->bind();
const Texture2D &color = target[j]->get_target_texture(RENDER_COLOR);
const Texture2D &depth = target[j]->get_target_texture(RENDER_DEPTH);
- postproc[i]->render(renderer, color, depth);
+ postproc[i].postproc->render(renderer, color, depth);
}
}
}