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:
Conditionable()31         Conditionable() : _alwaysValid(true) {}
32         void parseCondition(SGPropertyNode* prop);
getAlwaysValid() const33         bool getAlwaysValid() const { return _alwaysValid; }
setAlwaysValid(bool val)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         int orderNum;
63         std::string effect;
64         std::string debugProperty;
65     };
66 
67     struct Attachment : public Conditionable {
68         Attachment(SGPropertyNode* prop);
AttachmentFGRenderingPipeline::Attachment69         Attachment(osg::Camera::BufferComponent c, const std::string& b ) : component(c), buffer(b) {}
70 
71         osg::Camera::BufferComponent component;
72         std::string buffer;
73     };
74     typedef std::vector<osg::ref_ptr<Attachment> > AttachmentList;
75 
76     struct Stage : public Pass {
77         Stage(SGPropertyNode* prop);
78 
79         bool needsDuDv;
80         float scaleFactor;
81 
82         std::vector<osg::ref_ptr<Pass> > passes;
83         AttachmentList attachments;
84     };
85     FGRenderingPipeline();
86 
87     std::vector<osg::ref_ptr<Buffer> > buffers;
88     std::vector<osg::ref_ptr<Stage> > stages;
89     int MaximumTextureSize;
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
105