]> git.mxchange.org Git - flightgear.git/blob - src/Viewer/renderingpipeline.hxx
Begin to implement configurable rendering pipeline
[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 <string>
7
8 namespace simgear
9 {
10 class SGReaderWriterOptions;
11 }
12 namespace flightgear
13 {
14 struct CameraInfo;
15 class CameraGroup;
16 }
17
18 class FGRenderingPipeline;
19 namespace flightgear {
20     FGRenderingPipeline* makeRenderingPipeline(const std::string& name,
21                    const simgear::SGReaderWriterOptions* options);
22 }
23
24 class FGRenderingPipeline : public osg::Referenced {
25 public:
26     struct Buffer : public osg::Referenced {
27         Buffer(SGPropertyNode* prop);
28
29         std::string name;
30         GLint internalFormat;
31         GLenum sourceFormat;
32         GLenum sourceType;
33         int width;
34         int height;
35         float scaleFactor;
36         GLenum wrapMode;
37                 bool shadowComparison;
38                 //GLenum shadowTextureMode;
39                 //osg::Vec4 borderColor;
40     };
41
42     struct Pass : public osg::Referenced {
43         Pass(SGPropertyNode* prop);
44
45         std::string name;
46         std::string type;
47     };
48
49     struct Stage : public osg::Referenced {
50         Stage(SGPropertyNode* prop);
51
52         std::string name;
53         std::string type;
54
55         std::vector<osg::ref_ptr<Pass> > passes;
56     };
57     FGRenderingPipeline();
58
59     flightgear::CameraInfo* buildCamera(flightgear::CameraGroup* cgroup,
60                                         unsigned flags,
61                                         osg::Camera* camera,
62                                         const osg::Matrix& view,
63                                         const osg::Matrix& projection,
64                                         osg::GraphicsContext* gc);
65
66 private:
67     std::vector<osg::ref_ptr<Buffer> > buffers;
68     std::vector<osg::ref_ptr<Stage> > stages;
69
70     void buildBuffers(flightgear::CameraInfo* info);
71     void buildStage(flightgear::CameraInfo* info,
72                     Stage* stage,
73                     flightgear::CameraGroup* cgroup,
74                     osg::Camera* camera,
75                     const osg::Matrix& view,
76                     const osg::Matrix& projection,
77                     osg::GraphicsContext* gc);
78     void buildMainCamera(flightgear::CameraInfo* info,
79                     Stage* stage,
80                     flightgear::CameraGroup* cgroup,
81                     osg::Camera* camera,
82                     const osg::Matrix& view,
83                     const osg::Matrix& projection,
84                     osg::GraphicsContext* gc);
85
86     friend FGRenderingPipeline* flightgear::makeRenderingPipeline(const std::string& name,
87                    const simgear::SGReaderWriterOptions* options);
88 };
89
90 #endif