]> git.mxchange.org Git - flightgear.git/blob - src/Main/renderer.hxx
Introduce "PRESERVE" flag to protect properties on sim reset.
[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
11 namespace osg
12 {
13 class Camera;
14 class Group;
15 }
16
17 namespace osgGA
18 {
19 class GUIEventAdapter;
20 }
21
22 namespace osgShadow
23 {
24 class ShadowedScene;
25 }
26
27 namespace osgViewer
28 {
29 class Viewer;
30 }
31
32 namespace flightgear
33 {
34 class FGEventHandler;
35 }
36
37 class SGSky;
38 extern SGSky *thesky;
39
40 class FGRenderer {
41
42 public:
43
44     FGRenderer();
45     ~FGRenderer();
46
47     void splashinit();
48     void init();
49
50     void setupView();
51
52     void resize(int width, int height );
53
54     // calling update( refresh_camera_settings = false ) will not
55     // touch window or camera settings.  This is useful for the tiled
56     // renderer which needs to set the view frustum itself.
57     void update( bool refresh_camera_settings);
58     static void update();
59
60     /** Just pick into the scene and return the pick callbacks on the way ...
61      */
62     bool pick( std::vector<SGSceneryPick>& pickList,
63                const osgGA::GUIEventAdapter* ea );
64
65     /** Get and set the OSG Viewer object, if any.
66      */
67     osgViewer::Viewer* getViewer() { return viewer.get(); }
68     const osgViewer::Viewer* getViewer() const { return viewer.get(); }
69     void setViewer(osgViewer::Viewer* viewer);
70     /** Get and set the manipulator object, if any.
71      */
72     flightgear::FGEventHandler* getEventHandler() { return eventHandler.get(); }
73     const flightgear::FGEventHandler* getEventHandler() const { return eventHandler.get(); }
74     void setEventHandler(flightgear::FGEventHandler* manipulator);
75
76     /** Add a top level camera.
77     */
78     void addCamera(osg::Camera* camera, bool useSceneData);
79
80 protected:
81     osg::ref_ptr<osgViewer::Viewer> viewer;
82     osg::ref_ptr<flightgear::FGEventHandler> eventHandler;
83     SGPropertyNode_ptr _scenery_loaded,_scenery_override;
84     SGPropertyNode_ptr _skyblend, _splash_alpha;
85     SGPropertyNode_ptr _point_sprites, _enhanced_lighting, _distance_attenuation;
86     SGPropertyNode_ptr _textures;
87     SGPropertyNode_ptr _cloud_status, _visibility_m; 
88     SGPropertyNode_ptr _xsize, _ysize;
89     SGPropertyNode_ptr _panel_hotspots, _sim_delta_sec, _horizon_effect, _altitude_ft;
90     SGPropertyNode_ptr _virtual_cockpit;
91     SGTimeStamp _splash_time;
92 };
93
94 bool fgDumpSceneGraphToFile(const char* filename);
95 bool fgDumpTerrainBranchToFile(const char* filename);
96
97 namespace flightgear
98 {
99 bool printVisibleSceneInfo(FGRenderer* renderer);
100 }
101
102 #endif