From: curt Date: Tue, 16 Sep 1997 22:14:47 +0000 (+0000) Subject: Tweaked time of day lighting equations. Don't draw stars during the day. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=3b5f599f7321df7447d2b1dc3c665b1cf8b4680d;p=flightgear.git Tweaked time of day lighting equations. Don't draw stars during the day. --- diff --git a/Main/GLUTmain.c b/Main/GLUTmain.c index ea734584f..895a91df6 100644 --- a/Main/GLUTmain.c +++ b/Main/GLUTmain.c @@ -141,7 +141,7 @@ static void fgUpdateViewParams() { struct FLIGHT *f; struct fgTIME *t; struct VIEW *v; - double x_2, x_4, x_8; + double x_2, x_4, x_8, x_10; double ambient, diffuse, sky; GLfloat color[4] = { 1.0, 1.0, 0.50, 1.0 }; GLfloat amb[3], diff[3], fog[4], clear[4]; @@ -178,10 +178,19 @@ static void fgUpdateViewParams() { x_2 = t->sun_angle * t->sun_angle; x_4 = x_2 * x_2; x_8 = x_4 * x_4; + x_10 = x_8 * x_2; - ambient = 0.4 * pow(1.5, -x_8 / 20.0); - diffuse = 0.4 * cos(0.55 * x_2); - sky = 0.85 * pow(1.6, -x_4 / 2.0) + 0.15; + ambient = 0.4 * pow(1.2, -x_10 / 30.0); + + /* diffuse = 0.4 * cos(0.3 * x_2); + if ( t->sun_angle > FG_PI_2 + 0.05 ) { + diffuse = 0.0; + } + */ + + diffuse = ambient; + + sky = 0.85 * pow(1.2, -x_8 / 20.0) + 0.15; if ( ambient < 0.1 ) { ambient = 0.1; } if ( diffuse < 0.0 ) { diffuse = 0.0; } @@ -566,9 +575,12 @@ int main( int argc, char *argv[] ) { /* $Log$ -/* Revision 1.17 1997/09/16 15:50:29 curt -/* Working on star alignment and time issues. +/* Revision 1.18 1997/09/16 22:14:51 curt +/* Tweaked time of day lighting equations. Don't draw stars during the day. /* + * Revision 1.17 1997/09/16 15:50:29 curt + * Working on star alignment and time issues. + * * Revision 1.16 1997/09/13 02:00:06 curt * Mostly working on stars and generating sidereal time for accurate star * placement. diff --git a/Scenery/stars.c b/Scenery/stars.c index ceb163246..5b1ae258f 100644 --- a/Scenery/stars.c +++ b/Scenery/stars.c @@ -203,33 +203,42 @@ void fgStarsRender() { t = &cur_time_params; v = ¤t_view; - printf("RENDERING STARS\n"); + /* FG_PI_2 + 0.1 is about 6 degrees after sundown and before sunrise */ - glDisable( GL_FOG ); - glDisable( GL_LIGHTING ); - glPushMatrix(); + if ( t->sun_angle > (FG_PI_2 + 0.1 ) ) { + printf("RENDERING STARS (night)\n"); - glTranslatef( v->view_pos.x, v->view_pos.y, v->view_pos.z ); + glDisable( GL_FOG ); + glDisable( GL_LIGHTING ); + glPushMatrix(); - angle = FG_2PI * t->lst / 24.0; - /* warp += 1.0 * DEG_TO_RAD; */ - warp = 15.0 * DEG_TO_RAD; - glRotatef( -(angle+warp) * RAD_TO_DEG, 0.0, 0.0, 1.0 ); - printf("Rotating stars by %.2f + %.2f\n", -angle * RAD_TO_DEG, - -warp * RAD_TO_DEG); + glTranslatef( v->view_pos.x, v->view_pos.y, v->view_pos.z ); - glCallList(stars); + angle = FG_2PI * t->lst / 24.0; + /* warp += 1.0 * DEG_TO_RAD; */ + warp = 15.0 * DEG_TO_RAD; + glRotatef( -(angle+warp) * RAD_TO_DEG, 0.0, 0.0, 1.0 ); + printf("Rotating stars by %.2f + %.2f\n", -angle * RAD_TO_DEG, + -warp * RAD_TO_DEG); - glPopMatrix(); - glEnable( GL_LIGHTING ); - glEnable( GL_FOG ); + glCallList(stars); + + glPopMatrix(); + glEnable( GL_LIGHTING ); + glEnable( GL_FOG ); + } else { + printf("not RENDERING STARS (day)\n"); + } } /* $Log$ -/* Revision 1.7 1997/09/16 15:50:31 curt -/* Working on star alignment and time issues. +/* Revision 1.8 1997/09/16 22:14:52 curt +/* Tweaked time of day lighting equations. Don't draw stars during the day. /* + * Revision 1.7 1997/09/16 15:50:31 curt + * Working on star alignment and time issues. + * * Revision 1.6 1997/09/05 14:17:31 curt * More tweaking with stars. * diff --git a/Simulator/make.inc b/Simulator/make.inc index 705be7e83..19e926ac5 100644 --- a/Simulator/make.inc +++ b/Simulator/make.inc @@ -25,7 +25,7 @@ #--------------------------------------------------------------------------- -VERSION = 0.11 +VERSION = 0.12 #--------------------------------------------------------------------------- # Choose your weapons @@ -120,6 +120,9 @@ FG_CFLAGS = $(GLOBAL_CFLAGS) #--------------------------------------------------------------------------- # $Log$ +# Revision 1.14 1997/09/16 22:14:47 curt +# Tweaked time of day lighting equations. Don't draw stars during the day. +# # Revision 1.13 1997/09/04 02:17:19 curt # Shufflin' stuff. # diff --git a/Time/fg_time.c b/Time/fg_time.c index 3b9721943..d5b34c169 100644 --- a/Time/fg_time.c +++ b/Time/fg_time.c @@ -149,7 +149,6 @@ double sidereal_course(struct tm *gmt, time_t now, double lng) { struct tm mt; long int offset; double diff, part, days, hours, lst; - int i; printf("COURSE: GMT = %d/%d/%2d %d:%02d:%02d\n", gmt->tm_mon, gmt->tm_mday, gmt->tm_year, @@ -201,10 +200,14 @@ double sidereal_course(struct tm *gmt, time_t now, double lng) { void fgTimeUpdate(struct FLIGHT *f, struct fgTIME *t) { double lst_precise, lst_course; + static long int warp = 0; /* get current Unix calendar time (in seconds) */ + /* warp += 120; */ + warp = 0; t->cur_time = time(NULL); - printf("Current Unix calendar time = %ld\n", t->cur_time); + t->cur_time += warp; + printf("Current Unix calendar time = %ld warp = %ld\n", t->cur_time, warp); /* get GMT break down for current time */ t->gmt = gmtime(&t->cur_time); @@ -249,9 +252,12 @@ void fgTimeUpdate(struct FLIGHT *f, struct fgTIME *t) { /* $Log$ -/* Revision 1.4 1997/09/16 15:50:31 curt -/* Working on star alignment and time issues. +/* Revision 1.5 1997/09/16 22:14:52 curt +/* Tweaked time of day lighting equations. Don't draw stars during the day. /* + * Revision 1.4 1997/09/16 15:50:31 curt + * Working on star alignment and time issues. + * * Revision 1.3 1997/09/13 02:00:08 curt * Mostly working on stars and generating sidereal time for accurate star * placement.