2 #ifndef __FG_RENDERER_HXX
3 #define __FG_RENDERER_HXX 1
5 #include <simgear/scene/util/SGPickCallback.hxx>
6 #include <simgear/props/props.hxx>
7 #include <simgear/timing/timestamp.hxx>
16 class GraphicsContext;
21 class GUIEventAdapter;
55 void resize(int width, int height );
59 /** Just pick into the scene and return the pick callbacks on the way ...
61 bool pick( std::vector<SGSceneryPick>& pickList,
62 const osgGA::GUIEventAdapter* ea );
64 /** Get and set the OSG Viewer object, if any.
66 osgViewer::Viewer* getViewer() { return viewer.get(); }
67 const osgViewer::Viewer* getViewer() const { return viewer.get(); }
68 void setViewer(osgViewer::Viewer* viewer);
69 /** Get and set the manipulator object, if any.
71 flightgear::FGEventHandler* getEventHandler() { return eventHandler.get(); }
72 const flightgear::FGEventHandler* getEventHandler() const { return eventHandler.get(); }
73 void setEventHandler(flightgear::FGEventHandler* manipulator);
75 /** Add a top level camera.
77 void addCamera(osg::Camera* camera, bool useSceneData);
79 /** Add a camera to the group. The camera is added to the viewer
80 * as a slave. See osgViewer::Viewer::addSlave.
81 * @param flags properties of the camera; see CameraGroup::Flags
82 * @param projection slave projection matrix
83 * @param view slave view matrix
84 * @param useMasterSceneData whether the camera displays the
85 * viewer's scene data.
86 * @return a CameraInfo object for the camera.
88 flightgear::CameraInfo* buildRenderingPipeline(flightgear::CameraGroup* cgroup, unsigned flags, osg::Camera* camera,
89 const osg::Matrix& view,
90 const osg::Matrix& projection,
91 osg::GraphicsContext* gc,
92 bool useMasterSceneData);
96 flightgear::CameraInfo* buildClassicalPipeline(flightgear::CameraGroup* cgroup, unsigned flags, osg::Camera* camera,
97 const osg::Matrix& view,
98 const osg::Matrix& projection,
99 bool useMasterSceneData);
103 flightgear::CameraInfo* buildDeferredPipeline(flightgear::CameraGroup* cgroup, unsigned flags, osg::Camera* camera,
104 const osg::Matrix& view, const osg::Matrix& projection, osg::GraphicsContext* gc);
106 SGSky* getSky() const { return _sky; }
108 void setPlanes( double zNear, double zFar );
111 * inform the renderer when the global (2D) panel is changed
115 osg::ref_ptr<osgViewer::Viewer> viewer;
116 osg::ref_ptr<flightgear::FGEventHandler> eventHandler;
117 SGPropertyNode_ptr _scenery_loaded,_scenery_override;
118 SGPropertyNode_ptr _skyblend, _splash_alpha;
119 SGPropertyNode_ptr _point_sprites, _enhanced_lighting, _distance_attenuation;
120 SGPropertyNode_ptr _textures;
121 SGPropertyNode_ptr _cloud_status, _visibility_m;
122 SGPropertyNode_ptr _xsize, _ysize;
123 SGPropertyNode_ptr _panel_hotspots, _sim_delta_sec, _horizon_effect, _altitude_ft;
124 SGPropertyNode_ptr _virtual_cockpit;
125 SGTimeStamp _splash_time;
127 bool _classicalRenderer;
129 osg::Camera* buildDeferredGeometryCamera( flightgear::CameraInfo* info, osg::GraphicsContext* gc );
130 osg::Camera* buildDeferredLightingCamera( flightgear::CameraInfo* info, osg::GraphicsContext* gc );
131 osg::ref_ptr<osg::Uniform> _ambientFactor;
132 osg::ref_ptr<osg::Uniform> _sunDiffuse;
133 osg::ref_ptr<osg::Uniform> _sunSpecular;
134 osg::ref_ptr<osg::Uniform> _sunDirection;
135 osg::ref_ptr<osg::Uniform> _planes;
136 osg::ref_ptr<osg::Uniform> _fogColor;
137 osg::ref_ptr<osg::Uniform> _fogDensity;
141 bool fgDumpSceneGraphToFile(const char* filename);
142 bool fgDumpTerrainBranchToFile(const char* filename);
146 bool printVisibleSceneInfo(FGRenderer* renderer);