]> git.mxchange.org Git - flightgear.git/blob - src/Viewer/renderingpipeline.hxx
Add simple conditions (no opengl related tests) to buffers, stages and attachments
[flightgear.git] / src / Viewer / renderingpipeline.hxx
1
2 #ifndef __FG_RENDERINGPIPELINE_HXX
3 #define __FG_RENDERINGPIPELINE_HXX 1
4
5 #include <osg/ref_ptr>
6 #include <osg/Camera>
7 #include <string>
8
9 #include <simgear/structure/SGExpression.hxx>
10
11 namespace simgear
12 {
13 class SGReaderWriterOptions;
14 }
15 namespace flightgear
16 {
17 struct CameraInfo;
18 class CameraGroup;
19 }
20
21 class FGRenderingPipeline;
22 namespace flightgear {
23     FGRenderingPipeline* makeRenderingPipeline(const std::string& name,
24                    const simgear::SGReaderWriterOptions* options);
25 }
26
27 class FGRenderingPipeline : public osg::Referenced {
28 public:
29     class Conditionable : public osg::Referenced {
30     public:
31         Conditionable() : _alwaysValid(false) {}
32         void parseCondition(SGPropertyNode* prop);
33         bool getAlwaysValid() const { return _alwaysValid; }
34         void setAlwaysValid(bool val) { _alwaysValid = val; }
35         void setValidExpression(SGExpressionb* exp);
36         bool valid();
37     protected:
38         bool _alwaysValid;
39         SGSharedPtr<SGExpressionb> _validExpression;
40     };
41     struct Buffer : public Conditionable {
42         Buffer(SGPropertyNode* prop);
43
44         std::string name;
45         GLint internalFormat;
46         GLenum sourceFormat;
47         GLenum sourceType;
48         int width;
49         int height;
50         float scaleFactor;
51         GLenum wrapMode;
52                 bool shadowComparison;
53                 //GLenum shadowTextureMode;
54                 //osg::Vec4 borderColor;
55     };
56
57     struct Pass : public Conditionable {
58         Pass(SGPropertyNode* prop);
59
60         std::string name;
61         std::string type;
62     };
63
64     struct Attachment : public Conditionable {
65         Attachment(SGPropertyNode* prop);
66         Attachment(osg::Camera::BufferComponent c, const std::string& b ) : component(c), buffer(b) {}
67
68         osg::Camera::BufferComponent component;
69         std::string buffer;
70     };
71     typedef std::vector<osg::ref_ptr<Attachment> > AttachmentList;
72
73     struct Stage : public Conditionable {
74         Stage(SGPropertyNode* prop);
75
76         std::string name;
77         std::string type;
78         int orderNum;
79         std::string effect;
80         bool needsDuDv;
81         float scaleFactor;
82
83         std::vector<osg::ref_ptr<Pass> > passes;
84         AttachmentList attachments;
85     };
86     FGRenderingPipeline();
87
88     std::vector<osg::ref_ptr<Buffer> > buffers;
89     std::vector<osg::ref_ptr<Stage> > stages;
90
91     friend FGRenderingPipeline* flightgear::makeRenderingPipeline(const std::string& name,
92                    const simgear::SGReaderWriterOptions* options);
93 };
94
95 namespace flightgear {
96
97 class PipelinePredParser : public simgear::expression::ExpressionParser
98 {
99 public:
100 protected:
101 };
102 }
103
104 #endif