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