From: ThorstenB Date: Sun, 22 May 2011 16:28:42 +0000 (+0200) Subject: Some minor splash screen status improvements. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=dd9d82d94121493b8665e7d5b08fe564f9eb3496;p=flightgear.git Some minor splash screen status improvements. --- diff --git a/src/Main/fg_os_osgviewer.cxx b/src/Main/fg_os_osgviewer.cxx index e2556f5b2..a8b88db43 100644 --- a/src/Main/fg_os_osgviewer.cxx +++ b/src/Main/fg_os_osgviewer.cxx @@ -272,6 +272,7 @@ void fgOSExit(int code) int fgOSMainLoop() { + globals->get_renderer()->init(); ref_ptr manipulator = globals->get_renderer()->getEventHandler(); viewer->setReleaseContextAtEndOfFrameHint(false); diff --git a/src/Main/main.cxx b/src/Main/main.cxx index e66ffe242..59737e5fa 100644 --- a/src/Main/main.cxx +++ b/src/Main/main.cxx @@ -212,6 +212,7 @@ static void fgMainLoop( void ) { } else { + fgSplashProgress("loading scenery"); // be nice to loader threads while waiting for initial scenery, reduce to 2fps simgear::sleepForMSec(500); } @@ -314,7 +315,7 @@ SGPath resolve_path(const std::string& s) } // This is the top level master main function that is registered as -// our idle funciton +// our idle function // The first few passes take care of initialization things (a couple // per pass) and once everything has been initialized fgMainLoop from @@ -348,20 +349,17 @@ static void fgIdleFunction ( void ) { if (!guiFinishInit()) return; idle_state++; - fgSplashProgress("reading aircraft list"); - + fgSplashProgress("loading aircraft list"); } else if ( idle_state == 2 ) { idle_state++; - - fgSplashProgress("reading airport & navigation data"); - + fgSplashProgress("loading navigation data"); } else if ( idle_state == 3 ) { idle_state++; fgInitNav(); - fgSplashProgress("setting up scenery"); + fgSplashProgress("initializing scenery system"); } else if ( idle_state == 4 ) { idle_state++; @@ -386,14 +384,13 @@ static void fgIdleFunction ( void ) { //////////////////////////////////////////////////////////////////// fgInitCommands(); - //////////////////////////////////////////////////////////////////// // Initialize the material manager //////////////////////////////////////////////////////////////////// globals->set_matlib( new SGMaterialLib ); simgear::SGModelLib::init(globals->get_fg_root(), globals->get_props()); simgear::SGModelLib::setPanelFunc(load_panel); - + //////////////////////////////////////////////////////////////////// // Initialize the TG scenery subsystem. //////////////////////////////////////////////////////////////////// @@ -402,15 +399,12 @@ static void fgIdleFunction ( void ) { globals->get_scenery()->bind(); globals->set_tile_mgr( new FGTileMgr ); - fgSplashProgress("loading aircraft"); - } else if ( idle_state == 5 ) { idle_state++; - fgSplashProgress("generating sky elements"); - + fgSplashProgress("initializing sky elements"); } else if ( idle_state == 6 ) { idle_state++; @@ -471,10 +465,8 @@ static void fgIdleFunction ( void ) { // airport->setName( "Airport Lighting" ); // lighting->addKid( airport ); - // build our custom render states fgSplashProgress("initializing subsystems"); - } else if ( idle_state == 7 ) { idle_state++; // Initialize audio support @@ -531,18 +523,18 @@ static void fgIdleFunction ( void ) { fgSetPosFromAirportIDandHdg( apt, hdg ); } } - fgSplashProgress("setting up time & renderer"); + + fgSplashProgress("initializing graphics engine"); } else if ( idle_state == 8 ) { idle_state = 1000; // setup OpenGL view parameters - globals->get_renderer()->init(); + globals->get_renderer()->setupView(); globals->get_renderer()->resize( fgGetInt("/sim/startup/xsize"), fgGetInt("/sim/startup/ysize") ); - fgSplashProgress("loading scenery objects"); int session = fgGetInt("/sim/session",0); session++; fgSetInt("/sim/session",session); @@ -673,5 +665,3 @@ int fgMainInit( int argc, char **argv ) { return result; } - - diff --git a/src/Main/renderer.cxx b/src/Main/renderer.cxx index a6b216ead..7dfe81f3f 100644 --- a/src/Main/renderer.cxx +++ b/src/Main/renderer.cxx @@ -440,7 +440,11 @@ FGRenderer::init( void ) _cloud_status = fgGetNode("/environment/clouds/status", true); _visibility_m = fgGetNode("/environment/visibility-m", true); +} +void +FGRenderer::setupView( void ) +{ osgViewer::Viewer* viewer = globals->get_renderer()->getViewer(); osg::initNotifyLevel(); @@ -593,12 +597,10 @@ FGRenderer::update() // Update all Visuals (redraws anything graphics related) void FGRenderer::update( bool refresh_camera_settings ) { - if ((!_scenery_loaded.get())|| - !(_scenery_loaded->getBoolValue() || + if (!(_scenery_loaded->getBoolValue() || _scenery_override->getBoolValue())) { - // alas, first "update" is being called before "init"... - fgSetDouble("/sim/startup/splash-alpha", 1.0); + _splash_alpha->setDoubleValue(1.0); return; } osgViewer::Viewer* viewer = globals->get_renderer()->getViewer(); @@ -611,10 +613,10 @@ FGRenderer::update( bool refresh_camera_settings ) { double delay_time = SGMiscd::min(fade_time/fade_steps_per_sec, (SGTimeStamp::now() - _splash_time).toSecs()); _splash_time = SGTimeStamp::now(); - double sAlpha = fgGetDouble("/sim/startup/splash-alpha", 1.0); + double sAlpha = _splash_alpha->getDoubleValue(); sAlpha -= SGMiscd::max(0.0,delay_time/fade_time); FGScenerySwitchCallback::scenery_enabled = (sAlpha<1.0); - fgSetDouble("/sim/startup/splash-alpha", sAlpha); + _splash_alpha->setDoubleValue(sAlpha); } bool skyblend = _skyblend->getBoolValue(); diff --git a/src/Main/renderer.hxx b/src/Main/renderer.hxx index 54a69a151..3f045fe0c 100644 --- a/src/Main/renderer.hxx +++ b/src/Main/renderer.hxx @@ -47,6 +47,8 @@ public: void splashinit(); void init(); + void setupView(); + void resize(int width, int height ); // calling update( refresh_camera_settings = false ) will not diff --git a/src/Main/splash.cxx b/src/Main/splash.cxx index 9152fb26d..36cc60326 100644 --- a/src/Main/splash.cxx +++ b/src/Main/splash.cxx @@ -295,6 +295,7 @@ static osg::Node* fgCreateSplashCamera() text->setPosition(osg::Vec3(0, -0.92, 0)); text->setAlignment(osgText::Text::CENTER_CENTER); SGPropertyNode* prop = fgGetNode("/sim/startup/splash-progress-text", true); + prop->setStringValue("initializing"); text->setUpdateCallback(new FGSplashTextUpdateCallback(prop)); geode->addDrawable(text);