Added some cheap eye candy to entertain myself for a few minutes. Splash
screen now fades out revealing the scene.
This commit is contained in:
parent
928309d3d1
commit
2384d0ed51
3 changed files with 24 additions and 10 deletions
src/Main
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue