]> git.tdb.fi Git - libs/gl.git/blob - source/pipelinetemplate.h
Fix a stupid error with PixelStore parameter mask
[libs/gl.git] / source / pipelinetemplate.h
1 #ifndef PIPELINETEMPLATE_H_
2 #define PIPELINETEMPLATE_H_
3
4 #include <string>
5 #include <vector>
6 #include <msp/datafile/objectloader.h>
7 #include "blend.h"
8 #include "postprocessor.h"
9 #include "predicate.h"
10
11 namespace Msp {
12 namespace GL {
13
14 class DepthTest;
15 class Lighting;
16
17 class PipelineTemplate
18 {
19 public:
20         class Loader: public DataFile::CollectionObjectLoader<PipelineTemplate>
21         {
22         public:
23                 Loader(PipelineTemplate &);
24                 Loader(PipelineTemplate &, Collection &);
25         private:
26                 void init();
27
28                 void multisample(unsigned);
29                 void multisample_range(unsigned, unsigned);
30                 void pass(const std::string &, const std::string &);
31
32                 template<typename T>
33                 void postprocessor();
34         };
35
36         struct Pass
37         {
38                 class Loader: public DataFile::CollectionObjectLoader<Pass>
39                 {
40                 public:
41                         Loader(Pass &);
42                         Loader(Pass &, Collection &);
43                 private:
44                         void init();
45
46                         void blend(BlendFactor, BlendFactor);
47                         void blend_predefined(const std::string &);
48                         void depth_test(Predicate);
49                         void depth_test_predefined(const std::string &);
50                         void lighting(const std::string &);
51                         void lighting_inline();
52                         // TODO requires support for scenes in Resources
53                         //void scene(const std::string &);
54                 };
55
56                 std::string tag;
57                 RefPtr<Lighting> lighting;
58                 RefPtr<const DepthTest> depth_test;
59                 RefPtr<const Blend> blend;
60                 std::string renderable_name;
61                 //Renderable *default_renderable;
62
63                 ~Pass();
64         };
65
66         typedef std::vector<Pass> PassArray;
67         typedef std::vector<PostProcessor::Template *> PostProcessorArray;
68
69 private:
70         bool hdr;
71         unsigned required_multisample;
72         unsigned max_multisample;
73         PassArray passes;
74         PostProcessorArray postprocessors;
75
76 public:
77         PipelineTemplate();
78         ~PipelineTemplate();
79
80         bool get_hdr() const { return hdr; }
81         unsigned get_required_multisample() const { return required_multisample; }
82         unsigned get_maximum_multisample() const { return max_multisample; }
83         const PassArray &get_passes() const { return passes; }
84         const PostProcessorArray &get_postprocessors() const { return postprocessors; }
85 };
86
87 } // namespace GL
88 } // namespace Msp
89
90 #endif