From: curt Date: Sun, 17 Nov 2002 01:21:13 +0000 (+0000) Subject: Added some cheap eye candy to entertain myself for a few minutes. Splash X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=2384d0ed51374711145294e6bc4d5af7f324832e;p=flightgear.git Added some cheap eye candy to entertain myself for a few minutes. Splash screen now fades out revealing the scene. --- diff --git a/src/Main/main.cxx b/src/Main/main.cxx index a3b1f325f..efde56729 100644 --- a/src/Main/main.cxx +++ b/src/Main/main.cxx @@ -481,7 +481,7 @@ void fgRenderFrame() { if ( idle_state != 1000 ) { // still initializing, draw the splash screen if ( fgGetBool("/sim/startup/splash-screen") ) { - fgSplashUpdate(0.0); + fgSplashUpdate(0.0, 1.0); } // Keep resetting sim time while the sim is initializing globals->set_sim_time_sec( 0.0 ); @@ -864,6 +864,13 @@ void fgRenderFrame() { glEnable( GL_DEPTH_TEST ); glEnable( GL_FOG ); + // Fade out the splash screen over the first three seconds. + double t = globals->get_sim_time_sec(); + if ( t <= 1.0 ) { + fgSplashUpdate(0.0, 1.0); + } else if ( t <= 3.0) { + fgSplashUpdate(0.0, (3.0 - t) / 2.0); + } } glutSwapBuffers(); @@ -1348,7 +1355,7 @@ static void fgIdleFunction ( void ) { glutIdleFunc(fgMainLoop); } else { if ( fgGetBool("/sim/startup/splash-screen") ) { - fgSplashUpdate(0.0); + fgSplashUpdate(0.0, 1.0); } } } diff --git a/src/Main/splash.cxx b/src/Main/splash.cxx index 092a3d371..cf222fd9f 100644 --- a/src/Main/splash.cxx +++ b/src/Main/splash.cxx @@ -105,7 +105,7 @@ void fgSplashInit ( void ) { // Update the splash screen with progress specified from 0.0 to 1.0 -void fgSplashUpdate ( double progress ) { +void fgSplashUpdate ( double progress, float alpha ) { int xmin, ymin, xmax, ymax; int xsize = 480; int ysize = 380; @@ -121,11 +121,6 @@ void fgSplashUpdate ( double progress ) { ymin = (fgGetInt("/sim/startup/ysize") - ysize) / 2; ymax = ymin + ysize; - // first clear the screen; - glClearColor(0.0, 0.0, 0.0, 1.0); - glClear( GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT ); - - // now draw the logo glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); @@ -137,6 +132,17 @@ void fgSplashUpdate ( double progress ) { glDisable(GL_DEPTH_TEST); glDisable(GL_LIGHTING); + + // draw the background + glColor4f( 0.0, 0.0, 0.0, alpha ); + glBegin(GL_POLYGON); + glVertex2f(0.0, 0.0); + glVertex2f(fgGetInt("/sim/startup/xsize"), 0.0); + glVertex2f(fgGetInt("/sim/startup/xsize"), fgGetInt("/sim/startup/ysize")); + glVertex2f(0.0, fgGetInt("/sim/startup/ysize")); + glEnd(); + + // now draw the logo glEnable(GL_TEXTURE_2D); #ifdef GL_VERSION_1_1 glBindTexture(GL_TEXTURE_2D, splash_texid); @@ -145,8 +151,9 @@ void fgSplashUpdate ( double progress ) { #else # error port me #endif - glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); + glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); + glColor4f( 1.0, 1.0, 1.0, alpha ); glBegin(GL_POLYGON); glTexCoord2f(0.0, 0.0); glVertex2f(xmin, ymin); glTexCoord2f(1.0, 0.0); glVertex2f(xmax, ymin); diff --git a/src/Main/splash.hxx b/src/Main/splash.hxx index 3e2ca1e73..fe3064433 100644 --- a/src/Main/splash.hxx +++ b/src/Main/splash.hxx @@ -35,7 +35,7 @@ void fgSplashInit ( void ); // Update the splash screen with progress specified from 0.0 to 1.0 -void fgSplashUpdate ( double progress ); +void fgSplashUpdate ( double progress, float alpha ); #endif // _SPLASH_HXX