]> git.mxchange.org Git - flightgear.git/commitdiff
Bugfix: remove the (totally broken) skyblend option
authorJames Turner <zakalawe@mac.com>
Thu, 19 Dec 2013 13:33:18 +0000 (13:33 +0000)
committerJames Turner <zakalawe@mac.com>
Thu, 19 Dec 2013 14:53:39 +0000 (14:53 +0000)
docs-mini/FlightGear-FAQ.html
man/fgfs.1.in
src/Main/options.cxx
src/Viewer/renderer.cxx
src/Viewer/renderer.hxx

index 6ec3c55885aa57f45cd5dd8457d4c47f630bdc69..b6053487c40449ead6c42bedeb0a7ac599718786 100644 (file)
     <div class="indent">5.5 -
       <a href="#5.5">Why is FlightGear so slow?</a>
     </div>
-    <div class="indent">5.6 -
-      <a href="#5.6">Why is my SGI machine so slow?</a>
-    </div>
     <div class="indent">5.7 -
       <a href="#5.7">How do I see the frame rate?</a>
     </div>
           like <i>Quake3</i>.</p>
         </div>
       
-        <b>
-      <a name="5.6">5.6 -
-    <u>Why is my SGI machine so slow?</u>
-      </a>
-    </b>
-        <div class="indent">
-          <p>First of all, one of the most common mistakes on SGI hardware is to
-          forget to specify --fog-fastest. On most SGI machines the EXP2 shading
-          model isn't hardware supported resulting in frame rates below 1 frame
-          per second (fps).</p>
-          <p>FlightGear makes extensive use of the OpenGL z-buffer feature,which
-          on most older SGI hardware is only supported in software. This means
-          that the CPU has to do all the z-buffer calculations in addition to the
-          other tasks FlightGear involves (flight dynamics, scenery tracking,
-          pushing commands into the graphics queue, etc).  The following features
-          are software rendered on low-end SGI machines (like Indy and
-          Indigo):</p>
-          <ul>
-            <li>stencil and accumulation buffer</li>
-            <li>depth queuing and depth buffering</li>
-            <li>fogging, lighting, clipping and transforms</li>
-            <li>texturing</li>
-          </ul>
-          <p>This means that running FlightGear with the following options may not
-          even get the desired result:</p>
-          <p>
-        <code>./runfgfs --fog-disable --shading-flat --disable-skyblend \</code>
-        <br>
-          <code>--disable-textures --disable-clouds --disable-sound \</code>
-        <br>
-          <code>--disable-panel --enable-hud --disable-anti-alias-hud</code>
-      </p>
-          <p>I could even imagine that adding --enable-wireframe doesn't work on
-          these machines (I would be happy to be proven wrong though).</p>
-          <p>On a machine like O2 the following options give an acceptable
-          result:</p>
-          <code>./runfgfs --fog-fastest --disable-sound</code>
-          <p>Since I don't have access to other SGI hardware I can't tell which
-          options would be appropriate for your situation.</p>
-        </div>
-      
         <b>
       <a name="5.7">5.7 -
     <u>How do I see the frame rate?</u>
index ba8a60e71e8b9aa83947cbf5f8d3340670db03d3..6e1c166d8f07ae2b82a3c10644652e938e4f5f66 100644 (file)
@@ -136,9 +136,6 @@ Disable instrument panel.
 .B "--disable-random-objects"
 Disable random scenery objects (buildings, trees, etc).
 .TP
-.B "--disable-skyblend"
-Disable sky blending.
-.TP
 .B "--disable-sound"
 Disable sound effects.
 .TP
@@ -206,9 +203,6 @@ Enable instrument panel.
 .B "--enable-random-objects"
 Enable random scenery objects (buildings, trees, etc).
 .TP
-.B "--enable-skyblend"
-Enable sky blending.
-.TP
 .B "--enable-sound"
 Enable sound effects.
 .TP
index 44d5d7c5fc10bd1f7d75efbb97e2c952f6ed4e6b..c7d13a7f30c78acc8c821d314da8d68f716b1e24 100644 (file)
@@ -185,7 +185,6 @@ void fgSetDefaults ()
     fgSetBool("/environment/clouds/status", true);
     fgSetBool("/sim/startup/fullscreen", false);
     fgSetBool("/sim/rendering/shading", true);
-    fgSetBool("/sim/rendering/skyblend", true);
     fgSetBool("/sim/rendering/textures", true);
     fgTie( "/sim/rendering/filtering", SGGetTextureFilter, SGSetTextureFilter, false);
     fgSetInt("/sim/rendering/filtering", 1);
@@ -1533,8 +1532,6 @@ struct OptionDesc {
     {"restore-defaults",             false, OPTION_BOOL,   "/sim/startup/restore-defaults", true, "", 0 },
     {"shading-flat",                 false, OPTION_BOOL,   "/sim/rendering/shading", false, "", 0 },
     {"shading-smooth",               false, OPTION_BOOL,   "/sim/rendering/shading", true, "", 0 },
-    {"disable-skyblend",             false, OPTION_BOOL,   "/sim/rendering/skyblend", false, "", 0 },
-    {"enable-skyblend",              false, OPTION_BOOL,   "/sim/rendering/skyblend", true, "", 0 },
     {"disable-textures",             false, OPTION_BOOL,   "/sim/rendering/textures", false, "", 0 },
     {"enable-textures",              false, OPTION_BOOL,   "/sim/rendering/textures", true, "", 0 },
     {"texture-filtering",            false, OPTION_INT,    "/sim/rendering/filtering", 1, "", 0 },
index 7a5489240eed3c740c6946384aa4e977f56e5185..8eaabc00a658942f0ff7515cbb0dc4c55bda499f 100644 (file)
@@ -558,7 +558,6 @@ FGRenderer::init( void )
     _ysize         = fgGetNode("/sim/startup/ysize", true);
     _splash_alpha  = fgGetNode("/sim/startup/splash-alpha", true);
 
-    _skyblend             = fgGetNode("/sim/rendering/skyblend", true);
     _point_sprites        = fgGetNode("/sim/rendering/point-sprites", true);
     _enhanced_lighting    = fgGetNode("/sim/rendering/enhanced-lighting", true);
     _distance_attenuation = fgGetNode("/sim/rendering/distance-attenuation", true);
@@ -1631,101 +1630,13 @@ FGRenderer::update( ) {
   
     osg::Camera *camera = viewer->getCamera();
 
-    bool skyblend = _skyblend->getBoolValue();
-    if ( skyblend ) {
-       
-        if ( _textures->getBoolValue() ) {
-            SGVec4f clearColor(l->adj_fog_color());
-            camera->setClearColor(toOsg(clearColor));
-        }
-    } else {
-        SGVec4f clearColor(l->sky_color());
+    if ( _textures->getBoolValue() ) {
+        SGVec4f clearColor(l->adj_fog_color());
         camera->setClearColor(toOsg(clearColor));
     }
 
-    // update fog params if visibility has changed
-    double visibility_meters = _visibility_m->getDoubleValue();
-    _sky->set_visibility(visibility_meters);
-
-    double altitude_m = _altitude_ft->getDoubleValue() * SG_FEET_TO_METER;
-    _sky->modify_vis( altitude_m, 0.0 /* time factor, now unused */);
-
-    // update the sky dome
-    if ( skyblend ) {
-
-        // The sun and moon distances are scaled down versions
-        // of the actual distance to get both the moon and the sun
-        // within the range of the far clip plane.
-        // Moon distance:    384,467 kilometers
-        // Sun distance: 150,000,000 kilometers
-
-        double sun_horiz_eff, moon_horiz_eff;
-        if (_horizon_effect->getBoolValue()) {
-            sun_horiz_eff
-                = 0.67 + pow(osg::clampAbove(0.5 + cos(l->get_sun_angle()),
-                                             0.0),
-                             0.33) / 3.0;
-            moon_horiz_eff
-                = 0.67 + pow(osg::clampAbove(0.5 + cos(l->get_moon_angle()),
-                                             0.0),
-                             0.33)/3.0;
-        } else {
-           sun_horiz_eff = moon_horiz_eff = 1.0;
-        }
-
-        SGSkyState sstate;
-        sstate.pos       = current__view->getViewPosition();
-        sstate.pos_geod  = current__view->getPosition();
-        sstate.ori       = current__view->getViewOrientation();
-        sstate.spin      = l->get_sun_rotation();
-        sstate.gst       = globals->get_time_params()->getGst();
-        sstate.sun_dist  = 50000.0 * sun_horiz_eff;
-        sstate.moon_dist = 40000.0 * moon_horiz_eff;
-        sstate.sun_angle = l->get_sun_angle();
-
-        SGSkyColor scolor;
-        scolor.sky_color   = SGVec3f(l->sky_color().data());
-        scolor.adj_sky_color = SGVec3f(l->adj_sky_color().data());
-        scolor.fog_color   = SGVec3f(l->adj_fog_color().data());
-        scolor.cloud_color = SGVec3f(l->cloud_color().data());
-        scolor.sun_angle   = l->get_sun_angle();
-        scolor.moon_angle  = l->get_moon_angle();
-  
-        double delta_time_sec = _sim_delta_sec->getDoubleValue();
-        _sky->reposition( sstate, *globals->get_ephem(), delta_time_sec );
-        _sky->repaint( scolor, *globals->get_ephem() );
-
-            //OSGFIXME
-//         shadows->setupShadows(
-//           current__view->getLongitude_deg(),
-//           current__view->getLatitude_deg(),
-//           globals->get_time_params()->getGst(),
-//           globals->get_ephem()->getSunRightAscension(),
-//           globals->get_ephem()->getSunDeclination(),
-//           l->get_sun_angle());
-
-    }
-
-//     sgEnviro.setLight(l->adj_fog_color());
-//     sgEnviro.startOfFrame(current__view->get_view_pos(), 
-//         current__view->get_world_up(),
-//         current__view->getLongitude_deg(),
-//         current__view->getLatitude_deg(),
-//         current__view->getAltitudeASL_ft() * SG_FEET_TO_METER,
-//         delta_time_sec);
-
-    // OSGFIXME
-//     sgEnviro.drawLightning();
-
-//        double current_view_origin_airspeed_horiz_kt =
-//         fgGetDouble("/velocities/airspeed-kt", 0.0)
-//                        * cos( fgGetDouble("/orientation/pitch-deg", 0.0)
-//                                * SGD_DEGREES_TO_RADIANS);
-
-    // OSGFIXME
-//     if( is_internal )
-//         shadows->endOfFrame();
-
+    updateSky();
+    
     // need to call the update visitor once
     _frameStamp->setCalendarTime(*globals->get_time_params()->getGmt());
     _updateVisitor->setViewData(current__view->getViewPosition(),
@@ -1749,6 +1660,61 @@ FGRenderer::update( ) {
        }
 }
 
+void
+FGRenderer::updateSky()
+{
+    // update fog params if visibility has changed
+    double visibility_meters = _visibility_m->getDoubleValue();
+    _sky->set_visibility(visibility_meters);
+    
+    double altitude_m = _altitude_ft->getDoubleValue() * SG_FEET_TO_METER;
+    _sky->modify_vis( altitude_m, 0.0 /* time factor, now unused */);
+
+    FGLight *l = static_cast<FGLight*>(globals->get_subsystem("lighting"));
+    
+    // The sun and moon distances are scaled down versions
+    // of the actual distance to get both the moon and the sun
+    // within the range of the far clip plane.
+    // Moon distance:    384,467 kilometers
+    // Sun distance: 150,000,000 kilometers
+    
+    double sun_horiz_eff, moon_horiz_eff;
+    if (_horizon_effect->getBoolValue()) {
+        sun_horiz_eff
+        = 0.67 + pow(osg::clampAbove(0.5 + cos(l->get_sun_angle()),
+                                     0.0),
+                     0.33) / 3.0;
+        moon_horiz_eff
+        = 0.67 + pow(osg::clampAbove(0.5 + cos(l->get_moon_angle()),
+                                     0.0),
+                     0.33)/3.0;
+    } else {
+        sun_horiz_eff = moon_horiz_eff = 1.0;
+    }
+    
+    SGSkyState sstate;
+    sstate.pos       = globals->get_current_view()->getViewPosition();
+    sstate.pos_geod  = globals->get_current_view()->getPosition();
+    sstate.ori       = globals->get_current_view()->getViewOrientation();
+    sstate.spin      = l->get_sun_rotation();
+    sstate.gst       = globals->get_time_params()->getGst();
+    sstate.sun_dist  = 50000.0 * sun_horiz_eff;
+    sstate.moon_dist = 40000.0 * moon_horiz_eff;
+    sstate.sun_angle = l->get_sun_angle();
+    
+    SGSkyColor scolor;
+    scolor.sky_color   = SGVec3f(l->sky_color().data());
+    scolor.adj_sky_color = SGVec3f(l->adj_sky_color().data());
+    scolor.fog_color   = SGVec3f(l->adj_fog_color().data());
+    scolor.cloud_color = SGVec3f(l->cloud_color().data());
+    scolor.sun_angle   = l->get_sun_angle();
+    scolor.moon_angle  = l->get_moon_angle();
+    
+    double delta_time_sec = _sim_delta_sec->getDoubleValue();
+    _sky->reposition( sstate, *globals->get_ephem(), delta_time_sec );
+    _sky->repaint( scolor, *globals->get_ephem() );
+}
+                                    
 void
 FGRenderer::resize( int width, int height )
 {
index e46f2ca17570ffd0fde05cf3f729c893eff36f13..0e9152067c6c2729046ec922a5011ae8cf19cda1 100644 (file)
@@ -131,7 +131,7 @@ protected:
     SGPropertyNode_ptr _scenery_loaded, _position_finalized;
     
     
-    SGPropertyNode_ptr _skyblend, _splash_alpha;
+    SGPropertyNode_ptr _splash_alpha;
     SGPropertyNode_ptr _point_sprites, _enhanced_lighting, _distance_attenuation;
     SGPropertyNode_ptr _textures;
     SGPropertyNode_ptr _cloud_status, _visibility_m; 
@@ -182,6 +182,8 @@ protected:
     osg::ref_ptr<FGRenderingPipeline> _pipeline;
     
     void addChangeListener(SGPropertyChangeListener* l, const char* path);
+    
+    void updateSky();
 };
 
 bool fgDumpSceneGraphToFile(const char* filename);