1
0
Fork 0

Bugfix: remove the (totally broken) skyblend option

This commit is contained in:
James Turner 2013-12-19 13:33:18 +00:00
parent d1cae3ab4d
commit 52f2f5ff78
5 changed files with 62 additions and 147 deletions

View file

@ -114,9 +114,6 @@
<div class="indent">5.5 - <div class="indent">5.5 -
<a href="#5.5">Why is FlightGear so slow?</a> <a href="#5.5">Why is FlightGear so slow?</a>
</div> </div>
<div class="indent">5.6 -
<a href="#5.6">Why is my SGI machine so slow?</a>
</div>
<div class="indent">5.7 - <div class="indent">5.7 -
<a href="#5.7">How do I see the frame rate?</a> <a href="#5.7">How do I see the frame rate?</a>
</div> </div>
@ -573,47 +570,6 @@
like <i>Quake3</i>.</p> like <i>Quake3</i>.</p>
</div> </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> <b>
<a name="5.7">5.7 - <a name="5.7">5.7 -
<u>How do I see the frame rate?</u> <u>How do I see the frame rate?</u>

View file

@ -136,9 +136,6 @@ Disable instrument panel.
.B "--disable-random-objects" .B "--disable-random-objects"
Disable random scenery objects (buildings, trees, etc). Disable random scenery objects (buildings, trees, etc).
.TP .TP
.B "--disable-skyblend"
Disable sky blending.
.TP
.B "--disable-sound" .B "--disable-sound"
Disable sound effects. Disable sound effects.
.TP .TP
@ -206,9 +203,6 @@ Enable instrument panel.
.B "--enable-random-objects" .B "--enable-random-objects"
Enable random scenery objects (buildings, trees, etc). Enable random scenery objects (buildings, trees, etc).
.TP .TP
.B "--enable-skyblend"
Enable sky blending.
.TP
.B "--enable-sound" .B "--enable-sound"
Enable sound effects. Enable sound effects.
.TP .TP

View file

@ -185,7 +185,6 @@ void fgSetDefaults ()
fgSetBool("/environment/clouds/status", true); fgSetBool("/environment/clouds/status", true);
fgSetBool("/sim/startup/fullscreen", false); fgSetBool("/sim/startup/fullscreen", false);
fgSetBool("/sim/rendering/shading", true); fgSetBool("/sim/rendering/shading", true);
fgSetBool("/sim/rendering/skyblend", true);
fgSetBool("/sim/rendering/textures", true); fgSetBool("/sim/rendering/textures", true);
fgTie( "/sim/rendering/filtering", SGGetTextureFilter, SGSetTextureFilter, false); fgTie( "/sim/rendering/filtering", SGGetTextureFilter, SGSetTextureFilter, false);
fgSetInt("/sim/rendering/filtering", 1); fgSetInt("/sim/rendering/filtering", 1);
@ -1533,8 +1532,6 @@ struct OptionDesc {
{"restore-defaults", false, OPTION_BOOL, "/sim/startup/restore-defaults", true, "", 0 }, {"restore-defaults", false, OPTION_BOOL, "/sim/startup/restore-defaults", true, "", 0 },
{"shading-flat", false, OPTION_BOOL, "/sim/rendering/shading", false, "", 0 }, {"shading-flat", false, OPTION_BOOL, "/sim/rendering/shading", false, "", 0 },
{"shading-smooth", false, OPTION_BOOL, "/sim/rendering/shading", true, "", 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 }, {"disable-textures", false, OPTION_BOOL, "/sim/rendering/textures", false, "", 0 },
{"enable-textures", false, OPTION_BOOL, "/sim/rendering/textures", true, "", 0 }, {"enable-textures", false, OPTION_BOOL, "/sim/rendering/textures", true, "", 0 },
{"texture-filtering", false, OPTION_INT, "/sim/rendering/filtering", 1, "", 0 }, {"texture-filtering", false, OPTION_INT, "/sim/rendering/filtering", 1, "", 0 },

View file

@ -558,7 +558,6 @@ FGRenderer::init( void )
_ysize = fgGetNode("/sim/startup/ysize", true); _ysize = fgGetNode("/sim/startup/ysize", true);
_splash_alpha = fgGetNode("/sim/startup/splash-alpha", true); _splash_alpha = fgGetNode("/sim/startup/splash-alpha", true);
_skyblend = fgGetNode("/sim/rendering/skyblend", true);
_point_sprites = fgGetNode("/sim/rendering/point-sprites", true); _point_sprites = fgGetNode("/sim/rendering/point-sprites", true);
_enhanced_lighting = fgGetNode("/sim/rendering/enhanced-lighting", true); _enhanced_lighting = fgGetNode("/sim/rendering/enhanced-lighting", true);
_distance_attenuation = fgGetNode("/sim/rendering/distance-attenuation", true); _distance_attenuation = fgGetNode("/sim/rendering/distance-attenuation", true);
@ -1631,101 +1630,13 @@ FGRenderer::update( ) {
osg::Camera *camera = viewer->getCamera(); osg::Camera *camera = viewer->getCamera();
bool skyblend = _skyblend->getBoolValue(); if ( _textures->getBoolValue() ) {
if ( skyblend ) { SGVec4f clearColor(l->adj_fog_color());
if ( _textures->getBoolValue() ) {
SGVec4f clearColor(l->adj_fog_color());
camera->setClearColor(toOsg(clearColor));
}
} else {
SGVec4f clearColor(l->sky_color());
camera->setClearColor(toOsg(clearColor)); camera->setClearColor(toOsg(clearColor));
} }
// update fog params if visibility has changed updateSky();
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();
// need to call the update visitor once // need to call the update visitor once
_frameStamp->setCalendarTime(*globals->get_time_params()->getGmt()); _frameStamp->setCalendarTime(*globals->get_time_params()->getGmt());
_updateVisitor->setViewData(current__view->getViewPosition(), _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 void
FGRenderer::resize( int width, int height ) FGRenderer::resize( int width, int height )
{ {

View file

@ -131,7 +131,7 @@ protected:
SGPropertyNode_ptr _scenery_loaded, _position_finalized; 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 _point_sprites, _enhanced_lighting, _distance_attenuation;
SGPropertyNode_ptr _textures; SGPropertyNode_ptr _textures;
SGPropertyNode_ptr _cloud_status, _visibility_m; SGPropertyNode_ptr _cloud_status, _visibility_m;
@ -182,6 +182,8 @@ protected:
osg::ref_ptr<FGRenderingPipeline> _pipeline; osg::ref_ptr<FGRenderingPipeline> _pipeline;
void addChangeListener(SGPropertyChangeListener* l, const char* path); void addChangeListener(SGPropertyChangeListener* l, const char* path);
void updateSky();
}; };
bool fgDumpSceneGraphToFile(const char* filename); bool fgDumpSceneGraphToFile(const char* filename);