]> git.mxchange.org Git - flightgear.git/blob - src/Main/renderer.hxx
Fix main window aspect ratios other than 4/3
[flightgear.git] / src / Main / renderer.hxx
1
2 #ifndef __FG_RENDERER_HXX
3 #define __FG_RENDERER_HXX 1
4
5 #include <simgear/screen/extensions.hxx>
6 #include <simgear/scene/sky/sky.hxx>
7 #include <simgear/scene/util/SGPickCallback.hxx>
8
9 #include <osg/Camera>
10 #include <osgViewer/Viewer>
11
12 #include "FGManipulator.hxx"
13
14 #define FG_ENABLE_MULTIPASS_CLOUDS 1
15
16 class SGSky;
17 extern SGSky *thesky;
18
19 extern glPointParameterfProc glPointParameterfPtr;
20 extern glPointParameterfvProc glPointParameterfvPtr;
21 extern bool glPointParameterIsSupported;
22 extern bool glPointSpriteIsSupported;
23
24
25 class FGRenderer {
26
27 public:
28
29     FGRenderer();
30     ~FGRenderer();
31
32     void splashinit();
33     void init();
34
35     static void resize(int width, int height );
36
37     // calling update( refresh_camera_settings = false ) will not
38     // touch window or camera settings.  This is useful for the tiled
39     // renderer which needs to set the view frustum itself.
40     static void update( bool refresh_camera_settings );
41     inline static void update() { update( true ); }
42
43     /** Set all the camera parameters at once. aspectRatio is height / width.
44      */
45     static void setCameraParameters(float vfov, float aspectRatio,
46                                     float near, float far);
47     /** Just pick into the scene and return the pick callbacks on the way ...
48      */
49     static bool pick( unsigned x, unsigned y,
50                       std::vector<SGSceneryPick>& pickList,
51                       const osgGA::GUIEventAdapter* ea );
52
53     /** Get and set the OSG Viewer object, if any.
54      */
55     osgViewer::Viewer* getViewer() { return viewer.get(); }
56     const osgViewer::Viewer* getViewer() const { return viewer.get(); }
57     void setViewer(osgViewer::Viewer* viewer) { this->viewer = viewer; }
58     /** Get and set the manipulator object, if any.
59      */
60     FGManipulator* getManipulator() { return manipulator.get(); }
61     const FGManipulator* getManipulator() const { return manipulator.get(); }
62     void setManipulator(FGManipulator* manipulator) {
63         this->manipulator = manipulator;
64     }
65
66     /** Add a top level camera.
67     */
68     void addCamera(osg::Camera* camera, bool useSceneData);
69
70 protected:
71     osg::ref_ptr<osgViewer::Viewer> viewer;
72     osg::ref_ptr<FGManipulator> manipulator;
73 };
74
75 bool fgDumpSceneGraphToFile(const char* filename);
76 bool fgDumpTerrainBranchToFile(const char* filename);
77
78 #endif