static osg::ref_ptr<osg::Group> mRoot = new osg::Group;
+#ifdef FG_JPEG_SERVER
+static void updateRenderer()
+{
+ globals->get_renderer()->update();
+}
+#endif
+
FGRenderer::FGRenderer()
{
#ifdef FG_JPEG_SERVER
- jpgRenderFrame = FGRenderer::update;
+ jpgRenderFrame = updateRenderer;
#endif
eventHandler = new FGEventHandler;
}
// Update all Visuals (redraws anything graphics related)
void
-FGRenderer::update( bool refresh_camera_settings ) {
+FGRenderer::update( ) {
if (!(_scenery_loaded->getBoolValue() ||
_scenery_override->getBoolValue()))
{
FGViewer *current__view = globals->get_current_view();
// Force update of center dependent values ...
current__view->set_dirty();
-
- if ( refresh_camera_settings ) {
- // update view port
- resize( _xsize->getIntValue(),
- _ysize->getIntValue() );
- }
+
osg::Camera *camera = viewer->getCamera();
bool skyblend = _skyblend->getBoolValue();
CameraGroup::getDefault()->setCameraCullMasks(cullMask);
}
-
-
-// options.cxx needs to see this for toggle_panel()
-// Handle new window size or exposure
void
-FGRenderer::resize( int width, int height ) {
-
-// the following breaks aspect-ratio of the main 3D scenery window when 2D panels are moved
-// in y direction - causing issues for aircraft with 2D panels (/sim/virtual_cockpit=false).
-// Disabling for now. Seems this useful for the pre-OSG time only.
-// if ( (!_virtual_cockpit->getBoolValue())
-// && fgPanelVisible() && idle_state == 1000 ) {
-// view_h = (int)(height * (globals->get_current_panel()->getViewHeight() -
-// globals->get_current_panel()->getYOffset()) / 768.0);
-// }
-
+FGRenderer::resize( int width, int height )
+{
int curWidth = _xsize->getIntValue(),
curHeight = _ysize->getIntValue();
if ((curHeight != height) || (curWidth != width)) {
_xsize->setIntValue(width);
_ysize->setIntValue(height);
}
-
- // must set view aspect ratio each frame, or initial values are wrong.
- // should probably be fixed 'smarter' during view setup.
- double aspect = height / (double) width;
-
- // for all views
- FGViewMgr *viewmgr = globals->get_viewmgr();
- if (viewmgr) {
- for ( int i = 0; i < viewmgr->size(); ++i ) {
- viewmgr->get_view(i)->set_aspect_ratio(aspect);
- }
- }
}
bool