1 #ifndef PIPELINETEMPLATE_H_
2 #define PIPELINETEMPLATE_H_
6 #include <msp/datafile/loadabletyperegistry.h>
7 #include <msp/datafile/objectloader.h>
9 #include "postprocessor.h"
10 #include "predicate.h"
18 class PipelineTemplate
21 class Loader: public DataFile::CollectionObjectLoader<PipelineTemplate>
27 static void add(Loader &ldr, const std::string &kw) { ldr.add(kw, &Loader::postprocessor<T>); }
31 Loader(PipelineTemplate &);
32 Loader(PipelineTemplate &, Collection &);
36 void multisample(unsigned);
37 void multisample_range(unsigned, unsigned);
38 void pass(const std::string &, const std::string &);
43 friend class PipelineTemplate;
48 class Loader: public DataFile::CollectionObjectLoader<Pass>
52 Loader(Pass &, Collection &);
56 void blend(BlendFactor, BlendFactor);
57 void blend_predefined(const std::string &);
58 void depth_test(Predicate);
59 void depth_test_predefined(const std::string &);
60 void lighting(const std::string &);
61 void lighting_inline();
62 // TODO requires support for scenes in Resources
63 //void scene(const std::string &);
67 RefPtr<Lighting> lighting;
68 RefPtr<const DepthTest> depth_test;
69 RefPtr<const Blend> blend;
70 std::string renderable_name;
71 //Renderable *default_renderable;
76 typedef std::vector<Pass> PassArray;
77 typedef std::vector<PostProcessor::Template *> PostProcessorArray;
80 typedef DataFile::LoadableTypeRegistry<Loader, Loader::AddPostProc> PostProcessorRegistry;
83 unsigned required_multisample;
84 unsigned max_multisample;
86 PostProcessorArray postprocessors;
92 bool get_hdr() const { return hdr; }
93 unsigned get_required_multisample() const { return required_multisample; }
94 unsigned get_maximum_multisample() const { return max_multisample; }
95 const PassArray &get_passes() const { return passes; }
96 const PostProcessorArray &get_postprocessors() const { return postprocessors; }
99 static void register_postprocessor(const std::string &);
101 static PostProcessorRegistry &get_postprocessor_registry();
105 void PipelineTemplate::register_postprocessor(const std::string &kw)
107 get_postprocessor_registry().register_type<T>(kw);
111 void PipelineTemplate::Loader::postprocessor()
113 RefPtr<typename T::Template> postproc = new typename T::Template;
115 obj.postprocessors.push_back(postproc.release());