]> git.tdb.fi Git - libs/gl.git/blobdiff - source/builders/pipelinetemplate.cpp
Rename Pipeline to Sequence
[libs/gl.git] / source / builders / pipelinetemplate.cpp
diff --git a/source/builders/pipelinetemplate.cpp b/source/builders/pipelinetemplate.cpp
deleted file mode 100644 (file)
index de91450..0000000
+++ /dev/null
@@ -1,202 +0,0 @@
-#include <msp/core/maputils.h>
-#include <msp/datafile/collection.h>
-#include "ambientocclusion.h"
-#include "blend.h"
-#include "bloom.h"
-#include "colorcurve.h"
-#include "lighting.h"
-#include "pipelinetemplate.h"
-#include "resources.h"
-#include "tests.h"
-
-using namespace std;
-
-namespace Msp {
-namespace GL {
-
-PipelineTemplate::PipelineTemplate():
-       resources(0),
-       hdr(false),
-       alpha(false),
-       required_multisample(0),
-       max_multisample(0)
-{ }
-
-PipelineTemplate::~PipelineTemplate()
-{
-       for(PostProcessorArray::iterator i=postprocessors.begin(); i!=postprocessors.end(); ++i)
-               delete i->postprocessor_template;
-}
-
-Resources &PipelineTemplate::get_resources() const
-{
-       if(!resources)  
-               throw logic_error("no resources");
-       return *resources;
-}
-
-
-PipelineTemplate::PostProcessorRegistry &PipelineTemplate::get_postprocessor_registry()
-{
-       static PostProcessorRegistry registry;
-       static bool initialized = false;
-       if(!initialized)
-       {
-               registry.register_type<AmbientOcclusion>("ambient_occlusion");
-               registry.register_type<Bloom>("bloom");
-               registry.register_type<ColorCurve>("colorcurve");
-               initialized = true;
-       }
-       return registry;
-}
-
-
-PipelineTemplate::Pass::~Pass()
-{ }
-
-
-PipelineTemplate::PostProcessor::PostProcessor(GL::PostProcessor::Template *ppt):
-       postprocessor_template(ppt)
-{ }
-
-
-PipelineTemplate::PostProcLoader::PostProcLoader()
-{
-       get_postprocessor_registry().invoke_all(*this);
-}
-
-
-PipelineTemplate::Loader::Loader(PipelineTemplate &t, Collection &c):
-       DataFile::CollectionObjectLoader<PipelineTemplate, Resources>(t, &c)
-{
-       add("hdr", &PipelineTemplate::hdr);
-       add("alpha", &PipelineTemplate::alpha);
-       add("multisample", &Loader::multisample);
-       add("multisample", &Loader::multisample_range);
-       add("pass", &Loader::pass);
-       add("postprocessor", &Loader::postprocessor);
-
-       obj.resources = &c;
-}
-
-void PipelineTemplate::Loader::postprocessor_loaded()
-{
-       obj.postprocessors.push_back(get_postprocessor_template());
-}
-
-void PipelineTemplate::Loader::multisample(unsigned samples)
-{
-       obj.required_multisample = samples;
-       obj.max_multisample = samples;
-}
-
-void PipelineTemplate::Loader::multisample_range(unsigned req, unsigned max)
-{
-       obj.required_multisample = req;
-       obj.max_multisample = max;
-}
-
-void PipelineTemplate::Loader::pass(const string &tag, const string &rend)
-{
-       Pass pss;;
-       pss.tag = tag;
-       pss.renderable_name = rend;
-       if(coll)
-               load_sub(pss, *coll);
-       else
-               load_sub(pss);
-
-       obj.passes.push_back(pss);
-}
-
-void PipelineTemplate::Loader::postprocessor(const string &slot)
-{
-       PostProcLoader ldr;
-       load_sub_with(ldr);
-       PostProcessor pp;
-       pp.postprocessor_template = ldr.get_postprocessor_template();
-       pp.slot_name = slot;
-       obj.postprocessors.push_back(pp);
-}
-
-
-PipelineTemplate::Pass::Loader::Loader(Pass &p):
-       DataFile::CollectionObjectLoader<Pass>(p, 0)
-{
-       init();
-}
-
-PipelineTemplate::Pass::Loader::Loader(Pass &p, Collection &c):
-       DataFile::CollectionObjectLoader<Pass>(p, &c)
-{
-       init();
-}
-
-void PipelineTemplate::Pass::Loader::init()
-{
-       add("blend", &Loader::blend);
-       add("blend", &Loader::blend_predefined);
-       add("depth_test", &Loader::depth_test);
-       add("depth_test", &Loader::depth_test_predefined);
-       add("lighting", &Loader::lighting);
-       add("lighting", &Loader::lighting_inline);
-}
-
-void PipelineTemplate::Pass::Loader::blend_predefined(const string &name)
-{
-       const Blend *bln = 0;
-       if(name=="alpha")
-               bln = &Blend::alpha();
-       else if(name=="additive")
-               bln = &Blend::additive();
-       else if(name=="additive_alpha")
-               bln = &Blend::additive_alpha();
-       else
-               throw key_error(name);
-
-       obj.blend = bln;
-       obj.blend.keep();
-}
-
-void PipelineTemplate::Pass::Loader::blend(BlendFactor src, BlendFactor dest)
-{
-       obj.blend = new Blend(src, dest);
-}
-
-void PipelineTemplate::Pass::Loader::depth_test_predefined(const string &name)
-{
-       const DepthTest *dtest = 0;
-       if(name=="lequal")
-               dtest = &DepthTest::lequal();
-       else
-               throw key_error(name);
-
-       obj.depth_test = dtest;
-       obj.depth_test.keep();
-}
-
-void PipelineTemplate::Pass::Loader::depth_test(Predicate pred)
-{
-       obj.depth_test = new DepthTest(pred);
-}
-
-void PipelineTemplate::Pass::Loader::lighting_inline()
-{
-       RefPtr<Lighting> lightn = new Lighting;
-       load_sub(*lightn);
-       obj.lighting = lightn;
-}
-
-void PipelineTemplate::Pass::Loader::lighting(const string &name)
-{
-       obj.lighting = &get_collection().get<Lighting>(name);
-       obj.lighting.keep();
-}
-
-/*void PipelineTemplate::Pass::Loader::scene(const string &name)
-{
-       obj.default_renderable = get_collection().get<Scene>(name);
-}*/
-
-} // namespace GL
-} // namespace Msp