]> git.mxchange.org Git - flightgear.git/blob - src/Main/renderer.hxx
Add a command to dump just the terrain portion of the scene graph to a .osg
[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
44     /** FlightGear code should use this routine to set the FOV rather
45      *  than calling the ssg routine directly
46      */
47     static void setFOV( float w, float h );
48
49
50     /** FlightGear code should use this routine to set the Near/Far
51      *  clip planes rather than calling the ssg routine directly
52      */
53     static void setNearFar( float n, float f );
54
55     /** Just pick into the scene and return the pick callbacks on the way ...
56      */
57     static bool pick( unsigned x, unsigned y,
58                       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) { this->viewer = viewer; }
66     /** Get and set the manipulator object, if any.
67      */
68     FGManipulator* getManipulator() { return manipulator.get(); }
69     const FGManipulator* getManipulator() const { return manipulator.get(); }
70     void setManipulator(FGManipulator* manipulator) {
71         this->manipulator = manipulator;
72     }
73
74     /** Add a top level camera.
75     */
76     void addCamera(osg::Camera* camera, bool useSceneData);
77
78 protected:
79     osg::ref_ptr<osgViewer::Viewer> viewer;
80     osg::ref_ptr<FGManipulator> manipulator;
81 };
82
83 bool fgDumpSceneGraphToFile(const char* filename);
84 bool fgDumpTerrainBranchToFile(const char* filename);
85
86 #endif