X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fbuilders%2Fpipelinetemplate.h;h=607bb6b6185e805e201f7bff6f3961fe6e8f0793;hp=177c0b145356f05e613d4f256efcb5e62ff2c47f;hb=HEAD;hpb=9a63244c1342337915c4610401a24c09fa72cc3d diff --git a/source/builders/pipelinetemplate.h b/source/builders/pipelinetemplate.h index 177c0b14..607bb6b6 100644 --- a/source/builders/pipelinetemplate.h +++ b/source/builders/pipelinetemplate.h @@ -1,150 +1,12 @@ -#ifndef PIPELINETEMPLATE_H_ -#define PIPELINETEMPLATE_H_ +#ifndef MSP_GL_PIPELINETEMPLATE_H_ +#define MSP_GL_PIPELINETEMPLATE_H_ -#include -#include -#include -#include -#include "blend.h" -#include "postprocessor.h" -#include "predicate.h" +#include "sequencetemplate.h" namespace Msp { namespace GL { -class DepthTest; -class Lighting; - -class PipelineTemplate -{ -private: - class PostProcLoader: virtual public DataFile::Loader - { - private: - template - struct AddPostProc - { - static void add(PostProcLoader &ldr, const std::string &kw) { ldr.add(kw, &PostProcLoader::postprocessor); } - }; - - protected: - RefPtr postproc; - - public: - PostProcLoader(); - - PostProcessor::Template *get_postprocessor_template() { return postproc.release(); } - - protected: - virtual void postprocessor_loaded() { } - - private: - template - void postprocessor(); - - friend class PipelineTemplate; - }; - -public: - class Loader: public DataFile::CollectionObjectLoader, public PostProcLoader - { - public: - Loader(PipelineTemplate &, Collection &); - - virtual void postprocessor_loaded(); - void multisample(unsigned); - void multisample_range(unsigned, unsigned); - void pass(const std::string &, const std::string &); - void postprocessor(const std::string &); - }; - - struct Pass - { - class Loader: public DataFile::CollectionObjectLoader - { - 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; - RefPtr depth_test; - RefPtr blend; - std::string renderable_name; - //Renderable *default_renderable; - - ~Pass(); - }; - - struct PostProcessor - { - GL::PostProcessor::Template *postprocessor_template; - std::string slot_name; - - PostProcessor(GL::PostProcessor::Template * = 0); - }; - - typedef std::vector PassArray; - typedef std::vector PostProcessorArray; - -private: - typedef DataFile::LoadableTypeRegistry PostProcessorRegistry; - - Resources *resources; - bool hdr; - bool alpha; - unsigned required_multisample; - unsigned max_multisample; - PassArray passes; - PostProcessorArray postprocessors; - -public: - PipelineTemplate(); - ~PipelineTemplate(); - - Resources &get_resources() const; - bool get_hdr() const { return hdr; } - bool get_alpha() const { return alpha; } - 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 - static void register_postprocessor(const std::string &); -private: - static PostProcessorRegistry &get_postprocessor_registry(); -}; - -template -void PipelineTemplate::register_postprocessor(const std::string &kw) -{ - get_postprocessor_registry().register_type(kw); -} - -template -void PipelineTemplate::PostProcLoader::postprocessor() -{ - if(postproc) - throw std::logic_error("Only one postprocessor allowed per slot"); - RefPtr pp = new typename T::Template; - load_sub(*pp); - postproc = pp; - pp = 0; - postprocessor_loaded(); -} +DEPRECATED typedef SequenceTemplate PipelineTemplate; } // namespace GL } // namespace Msp