]> git.mxchange.org Git - flightgear.git/blob - src/Main/renderer.hxx
Push aspect-ratio handling into CameraGroup, so renderer doesn't need to resize viewp...
[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     void update();
55   
56     /** Just pick into the scene and return the pick callbacks on the way ...
57      */
58     bool pick( std::vector<SGSceneryPick>& pickList,
59                const osgGA::GUIEventAdapter* ea );
60
61     /** Get and set the OSG Viewer object, if any.
62      */
63     osgViewer::Viewer* getViewer() { return viewer.get(); }
64     const osgViewer::Viewer* getViewer() const { return viewer.get(); }
65     void setViewer(osgViewer::Viewer* viewer);
66     /** Get and set the manipulator object, if any.
67      */
68     flightgear::FGEventHandler* getEventHandler() { return eventHandler.get(); }
69     const flightgear::FGEventHandler* getEventHandler() const { return eventHandler.get(); }
70     void setEventHandler(flightgear::FGEventHandler* manipulator);
71
72     /** Add a top level camera.
73     */
74     void addCamera(osg::Camera* camera, bool useSceneData);
75
76 protected:
77     osg::ref_ptr<osgViewer::Viewer> viewer;
78     osg::ref_ptr<flightgear::FGEventHandler> eventHandler;
79     SGPropertyNode_ptr _scenery_loaded,_scenery_override;
80     SGPropertyNode_ptr _skyblend, _splash_alpha;
81     SGPropertyNode_ptr _point_sprites, _enhanced_lighting, _distance_attenuation;
82     SGPropertyNode_ptr _textures;
83     SGPropertyNode_ptr _cloud_status, _visibility_m; 
84     SGPropertyNode_ptr _xsize, _ysize;
85     SGPropertyNode_ptr _panel_hotspots, _sim_delta_sec, _horizon_effect, _altitude_ft;
86     SGPropertyNode_ptr _virtual_cockpit;
87     SGTimeStamp _splash_time;
88 };
89
90 bool fgDumpSceneGraphToFile(const char* filename);
91 bool fgDumpTerrainBranchToFile(const char* filename);
92
93 namespace flightgear
94 {
95 bool printVisibleSceneInfo(FGRenderer* renderer);
96 }
97
98 #endif