]> git.mxchange.org Git - flightgear.git/commitdiff
Some minor splash screen status improvements.
authorThorstenB <brehmt@gmail.com>
Sun, 22 May 2011 16:28:42 +0000 (18:28 +0200)
committerThorstenB <brehmt@gmail.com>
Sun, 22 May 2011 16:32:15 +0000 (18:32 +0200)
src/Main/fg_os_osgviewer.cxx
src/Main/main.cxx
src/Main/renderer.cxx
src/Main/renderer.hxx
src/Main/splash.cxx

index e2556f5b2ea12e5c2e274c4b0cfe043c7202a33e..a8b88db43616eb84558ec3c3ebae1b6e46bfd8da 100644 (file)
@@ -272,6 +272,7 @@ void fgOSExit(int code)
 
 int fgOSMainLoop()
 {
+    globals->get_renderer()->init();
     ref_ptr<FGEventHandler> manipulator
         = globals->get_renderer()->getEventHandler();
     viewer->setReleaseContextAtEndOfFrameHint(false);
index e66ffe242e9e4a8b0df24e1cf6548cb4d3bf1ea5..59737e5fac3a90199d98c502b4f1f9942a43f5cc 100644 (file)
@@ -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;
 }
-
-
index a6b216ead99f47ca9fa22583585785f356872aa6..7dfe81f3fe377e7956a772a556ca2644784f733b 100644 (file)
@@ -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();
index 54a69a1513e91c49f236c7f686ddd517ecf97f3a..3f045fe0cb037bb625f681610e97b35ac8d87255 100644 (file)
@@ -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
index 9152fb26dcf2b2dc78bfc26009c3216c971c2462..36cc603260b8870b4562ad68f24ca3cd1c789cdb 100644 (file)
@@ -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);