]> git.mxchange.org Git - flightgear.git/commitdiff
Added some cheap eye candy to entertain myself for a few minutes. Splash
authorcurt <curt>
Sun, 17 Nov 2002 01:21:13 +0000 (01:21 +0000)
committercurt <curt>
Sun, 17 Nov 2002 01:21:13 +0000 (01:21 +0000)
screen now fades out revealing the scene.

src/Main/main.cxx
src/Main/splash.cxx
src/Main/splash.hxx

index a3b1f325f4fd3ef5893c84d93a7504c7d7a019c4..efde56729700ba7314ef1fb83bfc73781ed2c6a5 100644 (file)
@@ -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);
        }
     }
 }
index 092a3d3714f933b811159d1758bf940545eae71e..cf222fd9f14d5e6476562c538540259c15b1e0de 100644 (file)
@@ -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);
index 3e2ca1e730728615537f3a81e8583196e0f047e5..fe30644333f194b5d723610e7c84b65da8110bb3 100644 (file)
@@ -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