+++ /dev/null
-#ifndef PIPELINETEMPLATE_H_
-#define PIPELINETEMPLATE_H_
-
-#include <string>
-#include <vector>
-#include <msp/datafile/loadabletyperegistry.h>
-#include <msp/datafile/objectloader.h>
-#include "blend.h"
-#include "postprocessor.h"
-#include "predicate.h"
-
-namespace Msp {
-namespace GL {
-
-class DepthTest;
-class Lighting;
-
-class PipelineTemplate
-{
-public:
- class Loader: public DataFile::CollectionObjectLoader<PipelineTemplate>
- {
- private:
- template<typename T>
- struct AddPostProc
- {
- static void add(Loader &ldr, const std::string &kw) { ldr.add(kw, &Loader::postprocessor<T>); }
- };
-
- public:
- Loader(PipelineTemplate &);
- Loader(PipelineTemplate &, Collection &);
- private:
- void init();
-
- void multisample(unsigned);
- void multisample_range(unsigned, unsigned);
- void pass(const std::string &, const std::string &);
-
- template<typename T>
- void postprocessor();
-
- friend class PipelineTemplate;
- };
-
- struct Pass
- {
- class Loader: public DataFile::CollectionObjectLoader<Pass>
- {
- public:
- Loader(Pass &);
- Loader(Pass &, Collection &);
- private:
- void init();
-
- void blend(BlendFactor, BlendFactor);
- void blend_predefined(const std::string &);
- void depth_test(Predicate);
- void depth_test_predefined(const std::string &);
- void lighting(const std::string &);
- void lighting_inline();
- // TODO requires support for scenes in Resources
- //void scene(const std::string &);
- };
-
- std::string tag;
- RefPtr<Lighting> lighting;
- RefPtr<const DepthTest> depth_test;
- RefPtr<const Blend> blend;
- std::string renderable_name;
- //Renderable *default_renderable;
-
- ~Pass();
- };
-
- typedef std::vector<Pass> PassArray;
- typedef std::vector<PostProcessor::Template *> PostProcessorArray;
-
-private:
- typedef DataFile::LoadableTypeRegistry<Loader, Loader::AddPostProc> PostProcessorRegistry;
-
- bool hdr;
- unsigned required_multisample;
- unsigned max_multisample;
- PassArray passes;
- PostProcessorArray postprocessors;
-
-public:
- PipelineTemplate();
- ~PipelineTemplate();
-
- bool get_hdr() const { return hdr; }
- unsigned get_required_multisample() const { return required_multisample; }
- unsigned get_maximum_multisample() const { return max_multisample; }
- const PassArray &get_passes() const { return passes; }
- const PostProcessorArray &get_postprocessors() const { return postprocessors; }
-
- template<typename T>
- static void register_postprocessor(const std::string &);
-private:
- static PostProcessorRegistry &get_postprocessor_registry();
-};
-
-template<typename T>
-void PipelineTemplate::register_postprocessor(const std::string &kw)
-{
- get_postprocessor_registry().register_type<T>(kw);
-}
-
-template<typename T>
-void PipelineTemplate::Loader::postprocessor()
-{
- RefPtr<typename T::Template> postproc = new typename T::Template;
- load_sub(*postproc);
- obj.postprocessors.push_back(postproc.release());
-}
-
-} // namespace GL
-} // namespace Msp
-
-#endif