]> git.mxchange.org Git - flightgear.git/blobdiff - src/Main/renderer.cxx
Goodbye automake.
[flightgear.git] / src / Main / renderer.cxx
index 7dfe81f3fe377e7956a772a556ca2644784f733b..f4d6e0ad41b2d5fcfe058d33cae403b4384bedb9 100644 (file)
@@ -384,10 +384,17 @@ static osg::ref_ptr<osg::Group> mRealRoot = new osg::Group;
 
 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;
 }
@@ -440,6 +447,13 @@ FGRenderer::init( void )
 
     _cloud_status = fgGetNode("/environment/clouds/status", true);
     _visibility_m = fgGetNode("/environment/visibility-m", true);
+    
+    bool use_point_sprites = _point_sprites->getBoolValue();
+    bool enhanced_lighting = _enhanced_lighting->getBoolValue();
+    bool distance_attenuation = _distance_attenuation->getBoolValue();
+
+    SGConfigureDirectionalLights( use_point_sprites, enhanced_lighting,
+                                  distance_attenuation );
 }
 
 void
@@ -588,15 +602,9 @@ FGRenderer::setupView( void )
     stateSet->setAttributeAndModes(new osg::Program, osg::StateAttribute::ON);
 }
 
-void
-FGRenderer::update()
-{
-    globals->get_renderer()->update(true);
-}
-
 // Update all Visuals (redraws anything graphics related)
 void
-FGRenderer::update( bool refresh_camera_settings ) {
+FGRenderer::update( ) {
     if (!(_scenery_loaded->getBoolValue() || 
            _scenery_override->getBoolValue()))
     {
@@ -619,14 +627,17 @@ FGRenderer::update( bool refresh_camera_settings ) {
         _splash_alpha->setDoubleValue(sAlpha);
     }
 
-    bool skyblend = _skyblend->getBoolValue();
-    bool use_point_sprites = _point_sprites->getBoolValue();
-    bool enhanced_lighting = _enhanced_lighting->getBoolValue();
-    bool distance_attenuation = _distance_attenuation->getBoolValue();
-
-    // OSGFIXME
-    SGConfigureDirectionalLights( use_point_sprites, enhanced_lighting,
-                                  distance_attenuation );
+#if 0 // OSGFIXME
+    // OSGFIXME: features no longer available or no longer run-time configurable
+    {
+        bool use_point_sprites = _point_sprites->getBoolValue();
+        bool enhanced_lighting = _enhanced_lighting->getBoolValue();
+        bool distance_attenuation = _distance_attenuation->getBoolValue();
+    
+        SGConfigureDirectionalLights( use_point_sprites, enhanced_lighting,
+                                      distance_attenuation );
+    }
+#endif
 
     FGLight *l = static_cast<FGLight*>(globals->get_subsystem("lighting"));
 
@@ -645,14 +656,10 @@ FGRenderer::update( bool refresh_camera_settings ) {
     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();
     if ( skyblend ) {
        
         if ( _textures->getBoolValue() ) {
@@ -766,36 +773,15 @@ FGRenderer::update( bool refresh_camera_settings ) {
     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 ) {
-    int view_h = 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);
-//    }
-    static int lastwidth = 0;
-    static int lastheight = 0;
-    if (width != lastwidth)
-        _xsize->setIntValue(lastwidth = width);
-    if (height != lastheight)
-        _ysize->setIntValue(lastheight = height);
-
-    // 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((float)view_h / (float)width);
-      }
+FGRenderer::resize( int width, int height )
+{
+    int curWidth = _xsize->getIntValue(),
+        curHeight = _ysize->getIntValue();
+    if ((curHeight != height) || (curWidth != width)) {
+    // must guard setting these, or PLIB-PUI fails with too many live interfaces
+        _xsize->setIntValue(width);
+        _ysize->setIntValue(height);
     }
 }