From 52f2f5ff782e6f5fbc5b890e259595ff76947287 Mon Sep 17 00:00:00 2001 From: James Turner Date: Thu, 19 Dec 2013 13:33:18 +0000 Subject: [PATCH] Bugfix: remove the (totally broken) skyblend option --- docs-mini/FlightGear-FAQ.html | 44 ---------- man/fgfs.1.in | 6 -- src/Main/options.cxx | 3 - src/Viewer/renderer.cxx | 152 +++++++++++++--------------------- src/Viewer/renderer.hxx | 4 +- 5 files changed, 62 insertions(+), 147 deletions(-) diff --git a/docs-mini/FlightGear-FAQ.html b/docs-mini/FlightGear-FAQ.html index 6ec3c5588..b6053487c 100644 --- a/docs-mini/FlightGear-FAQ.html +++ b/docs-mini/FlightGear-FAQ.html @@ -114,9 +114,6 @@
5.5 - Why is FlightGear so slow?
-
5.6 - - Why is my SGI machine so slow? -
5.7 - How do I see the frame rate?
@@ -573,47 +570,6 @@ like Quake3.

- - 5.6 - - Why is my SGI machine so slow? - - -
-

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).

-

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):

- -

This means that running FlightGear with the following options may not - even get the desired result:

-

- ./runfgfs --fog-disable --shading-flat --disable-skyblend \ -
- --disable-textures --disable-clouds --disable-sound \ -
- --disable-panel --enable-hud --disable-anti-alias-hud -

-

I could even imagine that adding --enable-wireframe doesn't work on - these machines (I would be happy to be proven wrong though).

-

On a machine like O2 the following options give an acceptable - result:

- ./runfgfs --fog-fastest --disable-sound -

Since I don't have access to other SGI hardware I can't tell which - options would be appropriate for your situation.

-
- 5.7 - How do I see the frame rate? diff --git a/man/fgfs.1.in b/man/fgfs.1.in index ba8a60e71..6e1c166d8 100644 --- a/man/fgfs.1.in +++ b/man/fgfs.1.in @@ -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 diff --git a/src/Main/options.cxx b/src/Main/options.cxx index 44d5d7c5f..c7d13a7f3 100644 --- a/src/Main/options.cxx +++ b/src/Main/options.cxx @@ -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 }, diff --git a/src/Viewer/renderer.cxx b/src/Viewer/renderer.cxx index 7a5489240..8eaabc00a 100644 --- a/src/Viewer/renderer.cxx +++ b/src/Viewer/renderer.cxx @@ -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(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 ) { diff --git a/src/Viewer/renderer.hxx b/src/Viewer/renderer.hxx index e46f2ca17..0e9152067 100644 --- a/src/Viewer/renderer.hxx +++ b/src/Viewer/renderer.hxx @@ -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 _pipeline; void addChangeListener(SGPropertyChangeListener* l, const char* path); + + void updateSky(); }; bool fgDumpSceneGraphToFile(const char* filename);