From 31519b5cd1e6ec9a09c05e263aac52a04931b6f3 Mon Sep 17 00:00:00 2001 From: curt Date: Mon, 22 Sep 1997 14:44:19 +0000 Subject: [PATCH] Continuing to try to align stars correctly. --- Cockpit/depend | 10 --------- Main/GLUTmain.c | 9 ++++++-- Main/fg_init.c | 24 ++++++++++++-------- Scenery/Makefile | 6 +++++ Scenery/stars.c | 57 ++++++++++++++++++++++++++---------------------- Time/Makefile | 9 ++++++++ Time/depend | 2 +- 7 files changed, 69 insertions(+), 48 deletions(-) diff --git a/Cockpit/depend b/Cockpit/depend index a271456de..04135f2ba 100644 --- a/Cockpit/depend +++ b/Cockpit/depend @@ -18,13 +18,3 @@ hud.o: hud.c hud.h ../Aircraft/aircraft.h \ ../Scenery/scenery.h ../Scenery/../types.h ../Math/mat3.h \ ../Math/polar.h ../Math/../types.h ../Time/fg_timer.h \ ../Math/fg_random.h ../Weather/weather.h -test.o: test.c test.h ../Aircraft/aircraft.h \ - ../Aircraft/../Flight/flight.h ../Aircraft/../Flight/Slew/slew.h \ - ../Aircraft/../Flight/LaRCsim/ls_interface.h \ - ../Aircraft/../Flight/LaRCsim/../flight.h \ - ../Aircraft/../Controls/controls.h \ - ../Aircraft/../Controls/../limits.h ../Flight/flight.h \ - ../Controls/controls.h ../constants.h ../Scenery/mesh.h \ - ../Scenery/scenery.h ../Scenery/../types.h ../Math/mat3.h \ - ../Math/polar.h ../Math/../types.h ../Time/fg_timer.h \ - ../Math/fg_random.h ../Weather/weather.h diff --git a/Main/GLUTmain.c b/Main/GLUTmain.c index d8dc658e9..c5a21745b 100644 --- a/Main/GLUTmain.c +++ b/Main/GLUTmain.c @@ -192,6 +192,8 @@ static void fgUpdateViewParams() { sky = 0.85 * pow(1.2, -x_8 / 20.0) + 0.15; + sky = 0.15; /* force a dark sky (for testing) */ + if ( ambient < 0.1 ) { ambient = 0.1; } if ( diffuse < 0.0 ) { diffuse = 0.0; } @@ -575,9 +577,12 @@ int main( int argc, char *argv[] ) { /* $Log$ -/* Revision 1.19 1997/09/18 16:20:08 curt -/* At dusk/dawn add/remove stars in stages. +/* Revision 1.20 1997/09/22 14:44:19 curt +/* Continuing to try to align stars correctly. /* + * Revision 1.19 1997/09/18 16:20:08 curt + * At dusk/dawn add/remove stars in stages. + * * Revision 1.18 1997/09/16 22:14:51 curt * Tweaked time of day lighting equations. Don't draw stars during the day. * diff --git a/Main/fg_init.c b/Main/fg_init.c index 2604bd29d..4c97095ac 100644 --- a/Main/fg_init.c +++ b/Main/fg_init.c @@ -76,7 +76,7 @@ void fgInitSubsystems( void ) { double cur_elev; struct FLIGHT *f; - struct TIME *t; + struct fgTIME *t; struct VIEW *v; f = ¤t_aircraft.flight; @@ -90,29 +90,32 @@ void fgInitSubsystems( void ) { ****************************************************************/ /* Globe Aiport, AZ */ - FG_Runway_altitude = 3234.5; - FG_Runway_latitude = 120070.41; FG_Runway_longitude = -398391.28; + FG_Runway_latitude = 120070.41; + FG_Runway_altitude = 3234.5; FG_Runway_heading = 102.0 * DEG_TO_RAD; /* Initial Position at GLOBE airport */ - FG_Latitude = ( 120070.41 / 3600.0 ) * DEG_TO_RAD; FG_Longitude = ( -398391.28 / 3600.0 ) * DEG_TO_RAD; + FG_Latitude = ( 120070.41 / 3600.0 ) * DEG_TO_RAD; FG_Altitude = FG_Runway_altitude + 3.758099; /* FG_Altitude = 20000; */ /* Initial Position north of the city of Globe */ - /* FG_Latitude = ( 120625.64 / 3600.0 ) * DEG_TO_RAD; */ /* FG_Longitude = ( -398673.28 / 3600.0 ) * DEG_TO_RAD; */ + /* FG_Latitude = ( 120625.64 / 3600.0 ) * DEG_TO_RAD; */ /* FG_Altitude = 0.0 + 3.758099; */ /* Initial Position: 10125 Jewell St. NE */ - /* FG_Latitude = ( 45.15 ) * DEG_TO_RAD; */ /* FG_Longitude = ( -93.15 ) * DEG_TO_RAD; */ + /* FG_Latitude = ( 45.15 ) * DEG_TO_RAD; */ /* FG_Altitude = FG_Runway_altitude + 3.758099; */ + FG_Longitude = ( -583200.00 / 3600.0 ) * DEG_TO_RAD; + FG_Latitude = ( 110808.41 / 3600.0 ) * DEG_TO_RAD; + printf("Initial position is: (%.4f, %.4f, %.2f)\n", - FG_Latitude * RAD_TO_DEG, FG_Longitude * RAD_TO_DEG, + FG_Longitude * RAD_TO_DEG, FG_Latitude * RAD_TO_DEG, FG_Altitude * FEET_TO_METER); /* Initial Velocity */ @@ -212,9 +215,12 @@ void fgInitSubsystems( void ) { /* $Log$ -/* Revision 1.7 1997/09/16 15:50:30 curt -/* Working on star alignment and time issues. +/* Revision 1.8 1997/09/22 14:44:20 curt +/* Continuing to try to align stars correctly. /* + * Revision 1.7 1997/09/16 15:50:30 curt + * Working on star alignment and time issues. + * * Revision 1.6 1997/09/05 14:17:30 curt * More tweaking with stars. * diff --git a/Scenery/Makefile b/Scenery/Makefile index f6ebee5dd..c9088bd7f 100644 --- a/Scenery/Makefile +++ b/Scenery/Makefile @@ -90,11 +90,17 @@ mesh2GL.o: scenery.o: $(CC) $(CFLAGS) -c scenery.c -o $@ +stars.c: + $(CC) $(CFLAGS) -c starts.c -o $@ + geometry.o: $(CC) $(CFLAGS) -c geometry.c -o $@ #--------------------------------------------------------------------------- # $Log$ +# Revision 1.20 1997/09/22 14:44:21 curt +# Continuing to try to align stars correctly. +# # Revision 1.19 1997/08/27 03:30:23 curt # Changed naming scheme of basic shared structures. # diff --git a/Scenery/stars.c b/Scenery/stars.c index 6c3ff954f..fb2f67beb 100644 --- a/Scenery/stars.c +++ b/Scenery/stars.c @@ -121,13 +121,13 @@ void fgStarsInit() { sscanf(front, "%lf,%lf,%lf\n", &right_ascension, &declination, &magnitude); - if ( strcmp(name, "Hamal") == 0 ) { + if ( strcmp(name, "Betelgeuse") == 0 ) { printf(" *** Marking %s\n", name); ra_save = right_ascension; decl_save = declination; } - if ( strcmp(name, "Algenib") == 0 ) { + if ( strcmp(name, "Alnilam") == 0 ) { printf(" *** Marking %s\n", name); ra_save1 = right_ascension; decl_save1 = declination; @@ -141,12 +141,12 @@ void fgStarsInit() { if ( magnitude < 0.0 ) { magnitude = 0.0; } magnitude = magnitude * 0.7 + (((FG_STAR_LEVELS - 1) - i) * 0.1); - printf("Found star: %d %s, %.3f %.3f %.3f\n", count, - name, right_ascension, declination, magnitude); + /* printf("Found star: %d %s, %.3f %.3f %.3f\n", count, + name, right_ascension, declination, magnitude); */ glColor3f( magnitude, magnitude, magnitude ); - glVertex3f( 190000.0 * sin(right_ascension) * cos(declination), - -190000.0 * cos(right_ascension) * cos(declination), + glVertex3f( 190000.0 * cos(right_ascension) * cos(declination), + 190000.0 * sin(right_ascension) * cos(declination), 190000.0 * sin(declination) ); count++; @@ -161,33 +161,33 @@ void fgStarsInit() { glBegin(GL_LINE_LOOP); glColor3f(1.0, 0.0, 0.0); - glVertex3f( 190000.0 * sin(ra_save-0.2) * cos(decl_save-0.2), - -190000.0 * cos(ra_save-0.2) * cos(decl_save-0.2), + glVertex3f( 190000.0 * cos(ra_save-0.2) * cos(decl_save-0.2), + 190000.0 * sin(ra_save-0.2) * cos(decl_save-0.2), 190000.0 * sin(decl_save-0.2) ); - glVertex3f( 190000.0 * sin(ra_save+0.2) * cos(decl_save-0.2), - -190000.0 * cos(ra_save+0.2) * cos(decl_save-0.2), + glVertex3f( 190000.0 * cos(ra_save+0.2) * cos(decl_save-0.2), + 190000.0 * sin(ra_save+0.2) * cos(decl_save-0.2), 190000.0 * sin(decl_save-0.2) ); - glVertex3f( 190000.0 * sin(ra_save+0.2) * cos(decl_save+0.2), - -190000.0 * cos(ra_save+0.2) * cos(decl_save+0.2), + glVertex3f( 190000.0 * cos(ra_save+0.2) * cos(decl_save+0.2), + 190000.0 * sin(ra_save+0.2) * cos(decl_save+0.2), 190000.0 * sin(decl_save+0.2) ); - glVertex3f( 190000.0 * sin(ra_save-0.2) * cos(decl_save+0.2), - -190000.0 * cos(ra_save-0.2) * cos(decl_save+0.2), + glVertex3f( 190000.0 * cos(ra_save-0.2) * cos(decl_save+0.2), + 190000.0 * sin(ra_save-0.2) * cos(decl_save+0.2), 190000.0 * sin(decl_save+0.2) ); glEnd(); glBegin(GL_LINE_LOOP); glColor3f(0.0, 1.0, 0.0); - glVertex3f( 190000.0 * sin(ra_save1-0.2) * cos(decl_save1-0.2), - -190000.0 * cos(ra_save1-0.2) * cos(decl_save1-0.2), + glVertex3f( 190000.0 * cos(ra_save1-0.2) * cos(decl_save1-0.2), + 190000.0 * sin(ra_save1-0.2) * cos(decl_save1-0.2), 190000.0 * sin(decl_save1-0.2) ); - glVertex3f( 190000.0 * sin(ra_save1+0.2) * cos(decl_save1-0.2), - -190000.0 * cos(ra_save1+0.2) * cos(decl_save1-0.2), + glVertex3f( 190000.0 * cos(ra_save1+0.2) * cos(decl_save1-0.2), + 190000.0 * sin(ra_save1+0.2) * cos(decl_save1-0.2), 190000.0 * sin(decl_save1-0.2) ); - glVertex3f( 190000.0 * sin(ra_save1+0.2) * cos(decl_save1+0.2), - -190000.0 * cos(ra_save1+0.2) * cos(decl_save1+0.2), + glVertex3f( 190000.0 * cos(ra_save1+0.2) * cos(decl_save1+0.2), + 190000.0 * sin(ra_save1+0.2) * cos(decl_save1+0.2), 190000.0 * sin(decl_save1+0.2) ); - glVertex3f( 190000.0 * sin(ra_save1-0.2) * cos(decl_save1+0.2), - -190000.0 * cos(ra_save1-0.2) * cos(decl_save1+0.2), + glVertex3f( 190000.0 * cos(ra_save1-0.2) * cos(decl_save1+0.2), + 190000.0 * sin(ra_save1-0.2) * cos(decl_save1+0.2), 190000.0 * sin(decl_save1+0.2) ); glEnd(); @@ -213,6 +213,8 @@ void fgStarsRender() { /* FG_PI_2 + 0.1 is about 6 degrees after sundown and before sunrise */ + t->sun_angle = 3.0; /* force stars (for testing) */ + if ( t->sun_angle > (FG_PI_2 + 5 * DEG_TO_RAD ) ) { /* determine which star structure to draw */ if ( t->sun_angle > (FG_PI_2 + 7.25 * DEG_TO_RAD ) ) { @@ -237,8 +239,8 @@ void fgStarsRender() { /* warp += 1.0; */ /* warp = 15.0; */ warp = 0.0; - glRotatef( -(angle+warp), 0.0, 0.0, 1.0 ); - printf("Rotating stars by %.2f degrees + %.2f degrees\n",-angle,-warp); + glRotatef( (angle+warp), 0.0, 0.0, -1.0 ); + printf("Rotating stars by %.2f degrees + %.2f degrees\n",angle,warp); glCallList(stars[i]); @@ -252,9 +254,12 @@ void fgStarsRender() { /* $Log$ -/* Revision 1.10 1997/09/20 03:34:32 curt -/* Still trying to get those durned stars aligned properly. +/* Revision 1.11 1997/09/22 14:44:21 curt +/* Continuing to try to align stars correctly. /* + * Revision 1.10 1997/09/20 03:34:32 curt + * Still trying to get those durned stars aligned properly. + * * Revision 1.9 1997/09/18 16:20:09 curt * At dusk/dawn add/remove stars in stages. * diff --git a/Time/Makefile b/Time/Makefile index 023960526..88de7e487 100644 --- a/Time/Makefile +++ b/Time/Makefile @@ -56,12 +56,21 @@ clean: include depend +fg_time.o: + $(CC) $(CFLAGS) -c fg_time.c -o $@ + fg_timer.o: $(CC) $(CFLAGS) -c fg_timer.c -o $@ +sunpos.o: + $(CC) $(CFLAGS) -c sunpos.c -o $@ + #--------------------------------------------------------------------------- # $Log$ +# Revision 1.13 1997/09/22 14:44:22 curt +# Continuing to try to align stars correctly. +# # Revision 1.12 1997/08/06 00:24:31 curt # Working on correct real time sun lighting. # diff --git a/Time/depend b/Time/depend index ab061cf3d..a4cdb8767 100644 --- a/Time/depend +++ b/Time/depend @@ -2,7 +2,7 @@ fg_time.o: fg_time.c fg_time.h ../types.h ../Flight/flight.h \ ../Flight/Slew/slew.h ../Flight/LaRCsim/ls_interface.h \ ../Flight/LaRCsim/../flight.h ../constants.h ../Time/fg_time.h fg_timer.o: fg_timer.c fg_timer.h -sidereal.o: sidereal.c ../constants.h +sptest.o: sptest.c sunpos.h ../types.h ../constants.h sunpos.o: sunpos.c sunpos.h ../types.h fg_time.h ../Flight/flight.h \ ../Flight/Slew/slew.h ../Flight/LaRCsim/ls_interface.h \ ../Flight/LaRCsim/../flight.h ../constants.h ../GLUT/views.h \