1
0
Fork 0

Tweaked time of day lighting equations. Don't draw stars during the day.

This commit is contained in:
curt 1997-09-16 22:14:47 +00:00
parent 1ba17de9ba
commit 3b5f599f73
4 changed files with 58 additions and 28 deletions

View file

@ -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.

View file

@ -203,33 +203,42 @@ void fgStarsRender() {
t = &cur_time_params;
v = &current_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.
*

View file

@ -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.
#

View file

@ -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.