X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fpipelinebuilder.cpp;h=51e9cc855f8b73d1cb7b4cd49f616a4cc3faea58;hp=286d6cb62f747a4d97abb366389ca01695e60ea1;hb=HEAD;hpb=e85d8669d6c389ded738c7b536f83ea54176662f diff --git a/source/pipelinebuilder.cpp b/source/pipelinebuilder.cpp deleted file mode 100644 index 286d6cb6..00000000 --- a/source/pipelinebuilder.cpp +++ /dev/null @@ -1,93 +0,0 @@ -#include -#include -#include "error.h" -#include "pipeline.h" -#include "pipelinebuilder.h" -#include "pipelinetemplate.h" -#include "renderbuffer.h" - -using namespace std; - -namespace Msp { -namespace GL { - -PipelineBuilder::PipelineBuilder(const PipelineTemplate &t): - tmpl(t) -{ - const vector &passes = tmpl.get_passes(); - for(vector::const_iterator i=passes.begin(); i!=passes.end(); ++i) - renderables[i->renderable_name] = 0; - const vector &postprocs = tmpl.get_postprocessors(); - for(PipelineTemplate::PostProcessorArray::const_iterator i=postprocs.begin(); i!=postprocs.end(); ++i) - if(!i->slot_name.empty()) - postprocessors[i->slot_name] = 0; -} - -void PipelineBuilder::set_renderable(const string &name, Renderable &rend) -{ - get_item(renderables, name) = &rend; -} - -void PipelineBuilder::set_postprocessor(const string &name, PostProcessor &pproc) -{ - get_item(postprocessors, name) = &pproc; -} - -void PipelineBuilder::build(Pipeline &pipeline) const -{ - pipeline.set_hdr(tmpl.get_hdr()); - unsigned samples = min(tmpl.get_maximum_multisample(), Renderbuffer::get_max_samples()); - if(samplesrenderable_name); - if(!renderable) - continue; - - Pipeline::Pass &pass = pipeline.add_pass(i->tag, *renderable); - pass.set_blend(i->blend.get()); - pass.set_depth_test(i->depth_test.get()); - pass.set_lighting(i->lighting.get()); - } - - const PipelineTemplate::PostProcessorArray &postprocs = tmpl.get_postprocessors(); - for(PipelineTemplate::PostProcessorArray::const_iterator i=postprocs.begin(); i!=postprocs.end(); ++i) - { - PostProcessor *proc = 0; - if(!i->slot_name.empty()) - proc = get_item(postprocessors, i->slot_name); - if(!proc && i->postprocessor_template) - proc = i->postprocessor_template->create(pipeline.get_width(), pipeline.get_height()); - if(proc) - pipeline.add_postprocessor_owned(proc); - } -} - -Pipeline *PipelineBuilder::build(unsigned w, unsigned h) const -{ - RefPtr pipeline = new Pipeline(w, h); - build(*pipeline); - return pipeline.release(); -} - -Pipeline *PipelineBuilder::build(const View &view) const -{ - RefPtr pipeline = new Pipeline(view); - build(*pipeline); - return pipeline.release(); -} - -Pipeline *PipelineBuilder::build(const Framebuffer &fbo) const -{ - RefPtr pipeline = new Pipeline(fbo); - build(*pipeline); - return pipeline.release(); -} - -} // namespace GL -} // namespace Msp