]> git.mxchange.org Git - flightgear.git/blob - src/Main/renderer.hxx
Choose renderer from /sim/rendering/rembrandt property
[flightgear.git] / src / Main / renderer.hxx
1
2 #ifndef __FG_RENDERER_HXX
3 #define __FG_RENDERER_HXX 1
4
5 #include <simgear/scene/util/SGPickCallback.hxx>
6 #include <simgear/props/props.hxx>
7 #include <simgear/timing/timestamp.hxx>
8
9 #include <osg/ref_ptr>
10 #include <osg/Matrix>
11
12 namespace osg
13 {
14 class Camera;
15 class Group;
16 }
17
18 namespace osgGA
19 {
20 class GUIEventAdapter;
21 }
22
23 namespace osgShadow
24 {
25 class ShadowedScene;
26 }
27
28 namespace osgViewer
29 {
30 class Viewer;
31 }
32
33 namespace flightgear
34 {
35 class FGEventHandler;
36 struct CameraInfo;
37 class CameraGroup;
38 }
39
40 class SGSky;
41
42 class FGRenderer {
43
44 public:
45
46     FGRenderer();
47     ~FGRenderer();
48
49     void splashinit();
50     void init();
51
52     void setupView();
53
54     void resize(int width, int height );
55
56     void update();
57   
58     /** Just pick into the scene and return the pick callbacks on the way ...
59      */
60     bool pick( std::vector<SGSceneryPick>& pickList,
61                const osgGA::GUIEventAdapter* ea );
62
63     /** Get and set the OSG Viewer object, if any.
64      */
65     osgViewer::Viewer* getViewer() { return viewer.get(); }
66     const osgViewer::Viewer* getViewer() const { return viewer.get(); }
67     void setViewer(osgViewer::Viewer* viewer);
68     /** Get and set the manipulator object, if any.
69      */
70     flightgear::FGEventHandler* getEventHandler() { return eventHandler.get(); }
71     const flightgear::FGEventHandler* getEventHandler() const { return eventHandler.get(); }
72     void setEventHandler(flightgear::FGEventHandler* manipulator);
73
74     /** Add a top level camera.
75      */
76     void addCamera(osg::Camera* camera, bool useSceneData);
77
78     /** Add a camera to the group. The camera is added to the viewer
79      * as a slave. See osgViewer::Viewer::addSlave.
80      * @param flags properties of the camera; see CameraGroup::Flags
81      * @param projection slave projection matrix
82      * @param view slave view matrix
83      * @param useMasterSceneData whether the camera displays the
84      * viewer's scene data.
85      * @return a CameraInfo object for the camera.
86      */
87         flightgear::CameraInfo* buildRenderingPipeline(flightgear::CameraGroup* cgroup, unsigned flags, osg::Camera* camera,
88                                    const osg::Matrix& view,
89                                    const osg::Matrix& projection,
90                                    bool useMasterSceneData);
91
92         /**
93          */
94         flightgear::CameraInfo* buildClassicalPipeline(flightgear::CameraGroup* cgroup, unsigned flags, osg::Camera* camera,
95                                    const osg::Matrix& view,
96                                    const osg::Matrix& projection,
97                                    bool useMasterSceneData);
98
99         /**
100          */
101         flightgear::CameraInfo* buildDeferredPipeline(flightgear::CameraGroup* cgroup, unsigned flags, osg::Camera* camera,
102                                    const osg::Matrix& view,
103                                    const osg::Matrix& projection);
104
105     SGSky* getSky() const { return _sky; }
106     
107     /**
108      * inform the renderer when the global (2D) panel is changed
109      */
110     void panelChanged();
111 protected:
112     osg::ref_ptr<osgViewer::Viewer> viewer;
113     osg::ref_ptr<flightgear::FGEventHandler> eventHandler;
114     SGPropertyNode_ptr _scenery_loaded,_scenery_override;
115     SGPropertyNode_ptr _skyblend, _splash_alpha;
116     SGPropertyNode_ptr _point_sprites, _enhanced_lighting, _distance_attenuation;
117     SGPropertyNode_ptr _textures;
118     SGPropertyNode_ptr _cloud_status, _visibility_m; 
119     SGPropertyNode_ptr _xsize, _ysize;
120     SGPropertyNode_ptr _panel_hotspots, _sim_delta_sec, _horizon_effect, _altitude_ft;
121     SGPropertyNode_ptr _virtual_cockpit;
122     SGTimeStamp _splash_time;
123     SGSky* _sky;
124         bool _classicalRenderer;
125 };
126
127 bool fgDumpSceneGraphToFile(const char* filename);
128 bool fgDumpTerrainBranchToFile(const char* filename);
129
130 namespace flightgear
131 {
132 bool printVisibleSceneInfo(FGRenderer* renderer);
133 }
134
135 #endif