1 #ifndef SEQUENCETEMPLATE_H_
2 #define SEQUENCETEMPLATE_H_
6 #include <msp/core/typeregistry.h>
7 #include <msp/datafile/dynamicobjectloader.h>
8 #include <msp/datafile/objectloader.h>
10 #include "postprocessor.h"
11 #include "resources.h"
12 #include "stenciltest.h"
20 class SequenceTemplate
24 class TemplateLoader: public DataFile::DynamicObjectLoader<typename T::Template>
26 friend class SequenceTemplate;
29 TemplateLoader(typename DataFile::DynamicObjectLoader<typename T::Template>::Collection &c): DataFile::DynamicObjectLoader<typename T::Template>(&c) { }
32 virtual typename DataFile::DynamicObjectLoader<typename T::Template>::TypeRegistry &get_type_registry() const { return get_registry<T>(); }
36 using TemplateRegistry = typename TemplateLoader<T>::TypeRegistry;
39 class Loader: public DataFile::CollectionObjectLoader<SequenceTemplate>
42 static ActionMap shared_actions;
45 Loader(SequenceTemplate &, Collection &);
47 virtual void init_actions();
50 void multisample(unsigned);
51 void multisample_range(unsigned, unsigned);
53 void postprocessor_with_slot(const std::string &);
54 void renderable(const std::string &);
55 void renderable_with_default(const std::string &, const std::string &);
56 void step(const std::string &, const std::string &);
61 GL::Renderable *renderable = 0;
62 std::string slot_name;
67 class Loader: public DataFile::CollectionObjectLoader<Step>
70 std::string inline_base_name;
72 static ActionMap shared_actions;
75 Loader(Step &, Collection &);
77 virtual void init_actions();
80 void set_inline_base_name(const std::string &);
84 void depth_compare(Predicate);
85 void lighting(const std::string &);
86 void lighting_inline();
91 const Lighting *lighting = 0;
93 StencilTest stencil_test;
94 std::string renderable_name;
99 GL::PostProcessor::Template *postprocessor_template;
100 std::string slot_name;
102 PostProcessor(GL::PostProcessor::Template * = 0);
106 class ClearLoader: public DataFile::ObjectLoader<SequenceTemplate>
109 static ActionMap shared_actions;
112 ClearLoader(SequenceTemplate &);
114 virtual void init_actions();
116 void color(float, float, float, float);
123 unsigned required_multisample = 0;
124 unsigned max_multisample = 0;
125 std::vector<Renderable> renderables;
126 std::vector<Step> steps;
127 std::vector<PostProcessor> postprocessors;
128 bool clear_enabled = false;
129 std::vector<Color> clear_colors;
130 float clear_depth = 1.0f;
131 int clear_stencil = 0;
136 bool get_hdr() const { return hdr; }
137 bool get_alpha() const { return alpha; }
138 unsigned get_required_multisample() const { return required_multisample; }
139 unsigned get_maximum_multisample() const { return max_multisample; }
140 const std::vector<Renderable> &get_renderables() const { return renderables; }
141 const std::vector<Step> &get_steps() const { return steps; }
142 const std::vector<PostProcessor> &get_postprocessors() const { return postprocessors; }
143 bool is_clear_enabled() const { return clear_enabled; }
144 const std::vector<Color> &get_clear_colors() const { return clear_colors; }
145 float get_clear_depth() const { return clear_depth; }
146 int get_clear_stencil() const { return clear_stencil; }
149 static void register_postprocessor(const std::string &);
153 static TemplateRegistry<T> &get_registry();
157 void SequenceTemplate::register_postprocessor(const std::string &kw)
159 get_registry<GL::PostProcessor>().register_type<typename T::Template>(kw);