]> git.mxchange.org Git - flightgear.git/commitdiff
Shufflin' stuff.
authorcurt <curt>
Thu, 4 Sep 1997 02:17:18 +0000 (02:17 +0000)
committercurt <curt>
Thu, 4 Sep 1997 02:17:18 +0000 (02:17 +0000)
16 files changed:
Cockpit/depend
Cockpit/hud.c
FDM/flight.h
Main/GLUTmain.c
Main/Makefile
Main/depend
Main/fg_init.c
Scenery/depend
Scenery/scenery.h
Scenery/stars.c
Simulator/Makefile
Simulator/make.inc
Time/depend
Time/fg_time.h
Time/sunpos.c
Time/sunpos.h

index 2d0d3ec52cb3fba4268d8f03c1d4ba498313899c..a271456de9289405b642c5e1ece4c5cad90bf0dd 100644 (file)
@@ -1,6 +1,30 @@
-hud.o: cockpit.c cockpit.h hud.c hud.h ../Aircraft/aircraft.h \
+cockpit.o: cockpit.c cockpit.h hud.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 ../Math/fg_random.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
+hud.o: hud.c hud.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
+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
index 453a8dd84dbb62d6d127573466dfcd5766f6989a..1c698753d619f7a69fe647f740db2d628a16d441 100644 (file)
  
 
 #include <GL/glut.h>
-
 #include <stdlib.h>
+#ifndef WIN32
+#  include <values.h>  /* for MAXINT */
+#endif /* not WIN32 */
 #include "hud.h"
 
 #include "../constants.h"
@@ -392,10 +394,10 @@ static void drawhorizon( struct HUD_horizon horizon )
        
        bank_angle = (*horizon.load_value)();
 
-       // sin_bank = sin( 2*PI-FG_Phi );
-       // cos_bank = cos( 2*PI-FG_Phi );
-       sin_bank = sin(2*PI-bank_angle);
-       cos_bank = cos(2*PI-bank_angle);
+       // sin_bank = sin( FG_2PI-FG_Phi );
+       // cos_bank = cos( FG_2PI-FG_Phi );
+       sin_bank = sin(FG_2PI-bank_angle);
+       cos_bank = cos(FG_2PI-bank_angle);
        x_inc1 = (int)(horizon.scr_width*cos_bank);
        y_inc1 = (int)(horizon.scr_width*sin_bank);
        x_inc2 = (int)(horizon.scr_hole*cos_bank);
@@ -531,13 +533,13 @@ Hptr fgHUDInit( struct AIRCRAFT current_aircraft, int color )
        hud->code = 123;
        hud->status = 0;
        
-       // For now let's just hardcode a hud here .
+       // For now lets just hardcode a hud here .
        // In the future, hud information has to come from the same place 
        // aircraft information came
        
        fgHUDAddHorizon( hud, 590, 50, 40, 20, get_roll );
        fgHUDAddScale( hud, VERTICAL, 220, 100, 280, 5, 10, LEFT, LEFT, 0, 100, get_speed );
-       fgHUDAddScale( hud, VERTICAL, 440, 100, 280, 1, 5, RIGHT, RIGHT, -MAXINT, 25, get_aoa );
+       fgHUDAddScale( hud, VERTICAL, 440, 100, 280, 1, 5, RIGHT, RIGHT, -400, 25, get_aoa );
        fgHUDAddScale( hud, HORIZONTAL, 280, 220, 440, 5, 10, TOP, TOP, 0, 50, get_heading );
        fgHUDAddLabel( hud, 180, 85, SMALL, NOBLINK, RIGHT_JUST, NULL, " Kts", "%5.0f", get_speed );
        fgHUDAddLabel( hud, 180, 73, SMALL, NOBLINK, RIGHT_JUST, NULL, " m", "%5.0f", get_altitude );
@@ -546,7 +548,6 @@ Hptr fgHUDInit( struct AIRCRAFT current_aircraft, int color )
        return( hud );
 }
 
-
 Hptr fgHUDAddHorizon( Hptr hud, int x_pos, int y_pos, int length, \
                                                int hole_len, double (*load_value)() )
 {
@@ -683,7 +684,7 @@ Hptr fgHUDAddLadder( Hptr hud, int x_pos, int y_pos, int scr_width, int scr_heig
        ladder = (struct HUD_ladder *)calloc(sizeof(struct HUD_ladder),1);
        if( ladder == NULL )
                return( NULL );
-       
+
        instrument->type = LADDER;
        instrument->instr = *ladder;
        instrument->instr.ladder.type = 0;      // Not used.
@@ -702,7 +703,6 @@ Hptr fgHUDAddLadder( Hptr hud, int x_pos, int y_pos, int scr_width, int scr_heig
        hud->instruments = instrument;
 
        return( hud );
-
 }
 
 /*
@@ -799,7 +799,10 @@ void fgUpdateHUD( Hptr hud )
 
 
 /* $Log$
-/* Revision 1.1  1997/08/29 18:03:22  curt
-/* Initial revision.
+/* Revision 1.2  1997/09/04 02:17:30  curt
+/* Shufflin' stuff.
 /*
+ * Revision 1.1  1997/08/29 18:03:22  curt
+ * Initial revision.
+ *
  */
index c9196ed568ea8ad972342a47d95394f523bc153a..c06d1d99c8e5b52564ee314a4ecd770313b405f5 100644 (file)
 #define FG_EXTERN_NET  8
 
 
-/* Define a structure containing the shared flight model parameters */
-/* struct flight_params {
-    double pos_x, pos_y, pos_z;
-    double vel_x, vel_y, vel_z;
-
-    double Phi;
-    double Theta;
-    double Psi;
-    double vel_Phi;
-    double vel_Theta;
-    double vel_Psi;
-}; */
-
-
 typedef double FG_VECTOR_3[3];
 
 /* This is based heavily on LaRCsim/ls_generic.h */
@@ -410,9 +396,12 @@ int fgFlightModelUpdate(int model, struct FLIGHT *f, int multiloop);
 
 
 /* $Log$
-/* Revision 1.8  1997/08/27 03:30:06  curt
-/* Changed naming scheme of basic shared structures.
+/* Revision 1.9  1997/09/04 02:17:33  curt
+/* Shufflin' stuff.
 /*
+ * Revision 1.8  1997/08/27 03:30:06  curt
+ * Changed naming scheme of basic shared structures.
+ *
  * Revision 1.7  1997/07/23 21:52:19  curt
  * Put comments around the text after an #endif for increased portability.
  *
index 38385940000da9ab77b4da790402554198933616..2f74301ea4a3e883eecd85887d0843ff92bec848 100644 (file)
@@ -69,7 +69,7 @@ struct VIEW current_view;
 static GLfloat win_ratio = 1.0;
 
 /* sun direction */
-static GLfloat sun_vec[4] = {1.0, 0.0, 0.0, 0.0 };
+/* static GLfloat sun_vec[4] = {1.0, 0.0, 0.0, 0.0 }; */
 
 /* if the 4th field is 0.0, this specifies a direction ... */
 /* clear color (sky) */
@@ -86,10 +86,6 @@ static GLfloat fgFogColor[4] =   {0.65, 0.65, 0.85, 1.0};
 /* pointer to scenery structure */
 /* static GLint scenery, runway; */
 
-/* Another hack */
-/* double view_offset = 0.0;
-double goal_view_offset = 0.0; */
-
 double Simtime;
 
 /* Another hack */
@@ -104,8 +100,10 @@ int show_hud;
  **************************************************************************/
 
 static void fgInitVisuals() {
+    struct fgTIME *t;
     struct WEATHER *w;
 
+    t = &cur_time_params;
     w = &current_weather;
 
     glEnable( GL_DEPTH_TEST );
@@ -116,7 +114,7 @@ static void fgInitVisuals() {
        to unit length after transformation.  See glNormal. */
     glEnable( GL_NORMALIZE );
 
-    glLightfv( GL_LIGHT0, GL_POSITION, sun_vec );
+    glLightfv( GL_LIGHT0, GL_POSITION, t->sun_vec );
     glEnable( GL_LIGHTING );
     glEnable( GL_LIGHT0 );
 
@@ -143,8 +141,7 @@ static void fgUpdateViewParams() {
     struct FLIGHT *f;
     struct fgTIME *t;
     struct VIEW *v;
-    MAT3vec nup, nsun;
-    double sun_angle, temp, ambient, diffuse, sky;
+    double ambient, diffuse, sky;
     GLfloat color[4] = { 1.0, 1.0, 0.50, 1.0 };
     GLfloat amb[3], diff[3], fog[4], clear[4];
 
@@ -170,24 +167,17 @@ static void fgUpdateViewParams() {
              v->view_up[0], v->view_up[1], v->view_up[2]);
 
     /* set the sun position */
-    glLightfv( GL_LIGHT0, GL_POSITION, sun_vec );
+    glLightfv( GL_LIGHT0, GL_POSITION, t->sun_vec );
 
     /* calculate lighting parameters based on sun's relative angle to
      * local up */
-    MAT3_COPY_VEC(nup, v->local_up);
-    nsun[0] = t->fg_sunpos.x; 
-    nsun[1] = t->fg_sunpos.y;
-    nsun[2] = t->fg_sunpos.z;
-    MAT3_NORMALIZE_VEC(nup, temp);
-    MAT3_NORMALIZE_VEC(nsun, temp);
-
-    sun_angle = acos(MAT3_DOT_PRODUCT(nup, nsun));
-    printf("SUN ANGLE relative to current location = %.3f rads.\n", sun_angle);
-
     /* ya kind'a have to plot this to see the magic */
-    ambient = 0.4 * pow(2.4, -sun_angle*sun_angle*sun_angle*sun_angle/3.0);
-    diffuse = 0.4 * cos(0.6*sun_angle*sun_angle);
-    sky = 0.85 * pow(1.6, -sun_angle*sun_angle*sun_angle*sun_angle/2.0) + 0.15;
+    ambient = 0.4 * 
+       pow(2.4, -t->sun_angle*t->sun_angle*t->sun_angle*t->sun_angle / 3.0);
+    diffuse = 0.4 * cos(0.6 * t->sun_angle * t->sun_angle);
+    sky = 0.85 * 
+       pow(1.6, -t->sun_angle*t->sun_angle*t->sun_angle*t->sun_angle/2.0) 
+       + 0.15;
 
     if ( ambient < 0.1 ) { ambient = 0.1; }
     if ( diffuse < 0.0 ) { diffuse = 0.0; }
@@ -240,10 +230,8 @@ static void fgUpdateVisuals( void ) {
     fgSceneryRender();
 
     /* display HUD */
-    if( show_hud ) {
+    if( show_hud )
        fgCockpitUpdate();
-       /* fgUpdateHUD(); */
-    }
 
     #ifdef GLUT
       glutSwapBuffers();
@@ -274,14 +262,7 @@ void fgUpdateTimeDepCalcs(int multi_loop) {
     fgFlightModelUpdate(FG_LARCSIM, f, multi_loop);
 
     /* refresh shared sun position and sun_vec */
-    fgUpdateSunPos();
-
-    /* the sun position has to be translated just like everything else */
-    sun_vec[0] = t->fg_sunpos.x - scenery.center.x; 
-    sun_vec[1] = t->fg_sunpos.y - scenery.center.y;
-    sun_vec[2] = t->fg_sunpos.z - scenery.center.z;
-    /* make this a directional light source only */
-    sun_vec[3] = 0.0;
+    fgUpdateSunPos(scenery.center);
 
     /* update the view angle */
     for ( i = 0; i < multi_loop; i++ ) {
@@ -420,8 +401,8 @@ static void fgMainLoop( void ) {
     f = &current_aircraft.flight;
 
     /* Read joystick */
-    /* fgJoystickRead( &joy_x, &joy_y, &joy_b1, &joy_b2 ); */
-    /* printf( "Joystick X %f  Y %f  B1 %d  B2 %d\n",  
+    /* fgJoystickRead( &joy_x, &joy_y, &joy_b1, &joy_b2 );
+    printf( "Joystick X %f  Y %f  B1 %d  B2 %d\n",  
            joy_x, joy_y, joy_b1, joy_b2 );
     fgElevSet( -joy_y );
     fgAileronSet( joy_x ); */
@@ -574,9 +555,12 @@ int main( int argc, char *argv[] ) {
 
 
 /* $Log$
-/* Revision 1.12  1997/08/27 21:32:24  curt
-/* Restructured view calculation code.  Added stars.
+/* Revision 1.13  1997/09/04 02:17:34  curt
+/* Shufflin' stuff.
 /*
+ * Revision 1.12  1997/08/27 21:32:24  curt
+ * Restructured view calculation code.  Added stars.
+ *
  * Revision 1.11  1997/08/27 03:30:16  curt
  * Changed naming scheme of basic shared structures.
  *
index c1d80675e7fcfc7088eacf083764a84022264900..98451a63581f778adaff891b517da0a28ce138b8 100644 (file)
@@ -32,7 +32,7 @@ AFILES = ../Aircraft/libAircraft.a ../Cockpit/libCockpit.a \
        ../Controls/libControls.a ../Flight/libFlight.a \
        ../Joystick/libJoystick.a ../Flight/LaRCsim/libLaRCsim.a \
        ../Flight/Slew/libSlew.a ../Scenery/libScenery.a \
-       ../Time/libTime.a ../Weather/libWeather.a ../Math/libMath.a 
+       ../Time/libTime.a ../Weather/libWeather.a ../Math/libMath.a
 
 
 include ../make.inc
@@ -73,6 +73,9 @@ GLTKkey.o:
 
 #---------------------------------------------------------------------------
 # $Log$
+# Revision 1.33  1997/09/04 02:17:35  curt
+# Shufflin' stuff.
+#
 # Revision 1.32  1997/08/27 21:31:27  curt
 # Added views.[ch]
 #
index 70d441644fb28fc9452732c676b48df46bcb72f7..a468e5febb0035260fbf0f1faa305e41e33b8b08 100644 (file)
@@ -1,33 +1,34 @@
-GLUTkey.o: GLUTkey.c GLUTkey.h ../constants.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 ../Weather/weather.h
-GLUTmain.o: GLUTmain.c fg_init.h ../constants.h ../general.h \
+GLUTkey.o: GLUTkey.c GLUTkey.h views.h ../types.h ../Flight/flight.h \
+ ../Flight/Slew/slew.h ../Flight/LaRCsim/ls_interface.h \
+ ../Flight/LaRCsim/../flight.h ../Math/mat3.h ../constants.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 ../Weather/weather.h
+GLUTmain.o: GLUTmain.c GLUTkey.h fg_init.h views.h ../types.h \
+ ../Flight/flight.h ../Flight/Slew/slew.h \
+ ../Flight/LaRCsim/ls_interface.h ../Flight/LaRCsim/../flight.h \
+ ../Math/mat3.h ../constants.h ../general.h ../Aircraft/aircraft.h \
+ ../Aircraft/../Flight/flight.h ../Aircraft/../Controls/controls.h \
  ../Aircraft/../Controls/../limits.h ../Cockpit/cockpit.h \
  ../Cockpit/hud.h ../Cockpit/../Aircraft/aircraft.h \
  ../Cockpit/../Flight/flight.h ../Cockpit/../Controls/controls.h \
- ../Joystick/joystick.h ../Math/fg_geodesy.h ../Math/mat3.h \
- ../Math/polar.h ../Math/../types.h ../Scenery/mesh.h \
- ../Scenery/scenery.h ../Scenery/../types.h ../Time/fg_time.h \
- ../Time/../types.h ../Time/fg_timer.h ../Time/sunpos.h \
- ../Weather/weather.h
-fg_init.o: fg_init.c fg_init.h ../constants.h ../general.h \
- ../Aircraft/aircraft.h ../Aircraft/../Flight/flight.h \
- ../Aircraft/../Flight/Slew/slew.h \
- ../Aircraft/../Flight/LaRCsim/ls_interface.h \
- ../Aircraft/../Flight/LaRCsim/../flight.h \
+ ../Joystick/joystick.h ../Math/fg_geodesy.h ../Math/polar.h \
+ ../Math/../types.h ../Scenery/mesh.h ../Scenery/scenery.h \
+ ../Scenery/../types.h ../Time/fg_time.h ../Time/../types.h \
+ ../Time/fg_timer.h ../Time/sunpos.h ../Weather/weather.h
+fg_init.o: fg_init.c fg_init.h views.h ../types.h ../Flight/flight.h \
+ ../Flight/Slew/slew.h ../Flight/LaRCsim/ls_interface.h \
+ ../Flight/LaRCsim/../flight.h ../Math/mat3.h ../constants.h \
+ ../general.h ../Aircraft/aircraft.h ../Aircraft/../Flight/flight.h \
  ../Aircraft/../Controls/controls.h \
  ../Aircraft/../Controls/../limits.h ../Cockpit/cockpit.h \
  ../Cockpit/hud.h ../Cockpit/../Aircraft/aircraft.h \
  ../Cockpit/../Flight/flight.h ../Cockpit/../Controls/controls.h \
  ../Joystick/joystick.h ../Math/fg_random.h ../Scenery/mesh.h \
  ../Scenery/scenery.h ../Scenery/../types.h ../Scenery/stars.h \
- ../Time/sunpos.h ../Weather/weather.h
-views.o: views.c views.h ../types.h
+ ../Time/sunpos.h ../Time/../types.h ../Weather/weather.h
+views.o: views.c views.h ../types.h ../Flight/flight.h \
+ ../Flight/Slew/slew.h ../Flight/LaRCsim/ls_interface.h \
+ ../Flight/LaRCsim/../flight.h ../Math/mat3.h ../constants.h \
+ ../Math/polar.h ../Math/../types.h ../Scenery/scenery.h \
+ ../Scenery/../types.h
index 0d17c5d4ea62c934fe65b1523421fd6d7b356bcc..36f368c2c92e5fe5eb2fa144cc45d552950d9b39 100644 (file)
@@ -96,7 +96,8 @@ void fgInitSubsystems( void ) {
     FG_Latitude  = (  120070.41 / 3600.0 ) * DEG_TO_RAD;
     FG_Longitude = ( -398391.28 / 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; */
@@ -142,7 +143,7 @@ void fgInitSubsystems( void ) {
     /* fgSlewInit(-398673.28,120625.64, 53, 4.38); */
 
     /* Initialize shared sun position and sun_vec */
-    fgUpdateSunPos();
+    fgUpdateSunPos(scenery.center);
 
     /* Initialize view parameters */
     fgViewInit(v);
@@ -151,7 +152,11 @@ void fgInitSubsystems( void ) {
     fgWeatherInit();
 
     /* Initialize the Cockpit subsystem */
-    fgCockpitInit( current_aircraft );
+    if( fgCockpitInit( current_aircraft ) == NULL )
+    {
+       printf( "Error in Cockpit initialization!\n" );
+       exit( 1 );
+    }
 
     /* Initialize the Stars subsystem  */
     fgStarsInit();
@@ -195,9 +200,12 @@ void fgInitSubsystems( void ) {
 
 
 /* $Log$
-/* Revision 1.4  1997/08/27 21:32:26  curt
-/* Restructured view calculation code.  Added stars.
+/* Revision 1.5  1997/09/04 02:17:36  curt
+/* Shufflin' stuff.
 /*
+ * Revision 1.4  1997/08/27 21:32:26  curt
+ * Restructured view calculation code.  Added stars.
+ *
  * Revision 1.3  1997/08/27 03:30:19  curt
  * Changed naming scheme of basic shared structures.
  *
index c11d4fc7527d028e772a8a6db9e6da0ac08062e5..2fcd2dea74e2171cb0eb202afa09ea6a49e116a1 100644 (file)
@@ -7,5 +7,13 @@ mesh.o: mesh.c ../constants.h ../types.h ../Math/fg_geodesy.h \
 parser.o: parser.c parsevrml.h geometry.h common.h mesh.h scenery.h \
  ../types.h
 scanner.o: scanner.c parser.h
-scenery.o: scenery.c ../general.h scenery.h ../types.h parsevrml.h
-stars.o: stars.c stars.h ../general.h
+scenery.o: scenery.c ../general.h scenery.h ../types.h parsevrml.h \
+ stars.h
+stars.o: stars.c stars.h ../constants.h ../general.h ../GLUT/views.h \
+ ../GLUT/../types.h ../GLUT/../Flight/flight.h \
+ ../GLUT/../Flight/Slew/slew.h \
+ ../GLUT/../Flight/LaRCsim/ls_interface.h \
+ ../GLUT/../Flight/LaRCsim/../flight.h ../GLUT/../Math/mat3.h \
+ ../Aircraft/aircraft.h ../Aircraft/../Flight/flight.h \
+ ../Aircraft/../Controls/controls.h \
+ ../Aircraft/../Controls/../limits.h
index e6f76028950fbddfc173b12bb7b066451621008d..635826f2994c58d3bdbeb9141b535a78cca33db0 100644 (file)
@@ -38,6 +38,9 @@ struct SCENERY {
 
     /* center of current scenery chunk */
     struct fgCartesianPoint center;
+
+    /* angle of sun relative to current local horizontal */
+    double sun_angle;
 };
 
 extern struct SCENERY scenery;
@@ -60,9 +63,12 @@ void fgSceneryRender();
 
 
 /* $Log$
-/* Revision 1.9  1997/08/27 03:30:33  curt
-/* Changed naming scheme of basic shared structures.
+/* Revision 1.10  1997/09/04 02:17:37  curt
+/* Shufflin' stuff.
 /*
+ * Revision 1.9  1997/08/27 03:30:33  curt
+ * Changed naming scheme of basic shared structures.
+ *
  * Revision 1.8  1997/08/06 00:24:30  curt
  * Working on correct real time sun lighting.
  *
index af868804e09e191a4fe05204d97b778a13653193..9d665d4b0e32bcc7a5773978e2b3072a7ae05f0e 100644 (file)
@@ -133,12 +133,6 @@ void fgStarsRender() {
     glDisable( GL_LIGHTING );
     glPushMatrix();
 
-    /* set lighting parameters for stars */
-    /* amb[0] = amb[1] = amb[2] = 1.0;
-    diff[0] = diff[1] = diff[2] = 1.0;
-    glLightfv(GL_LIGHT0, GL_AMBIENT, amb );
-    glLightfv(GL_LIGHT0, GL_DIFFUSE, diff ); */
-
     glTranslatef( v->view_pos.x, v->view_pos.y, v->view_pos.z );
 
     angle = FG_2PI * fmod(DaysSinceEpoch(time(NULL)), 1.0);
@@ -154,9 +148,12 @@ void fgStarsRender() {
 
 
 /* $Log$
-/* Revision 1.3  1997/08/29 17:55:28  curt
-/* Worked on properly aligning the stars.
+/* Revision 1.4  1997/09/04 02:17:38  curt
+/* Shufflin' stuff.
 /*
+ * Revision 1.3  1997/08/29 17:55:28  curt
+ * Worked on properly aligning the stars.
+ *
  * Revision 1.2  1997/08/27 21:32:30  curt
  * Restructured view calculation code.  Added stars.
  *
index 1919e021cba8bb716d995d9f365c39f5fd1c95d8..96e80aa28331ffd05ceba3d6ce6d7d2acc500c48 100644 (file)
@@ -58,19 +58,43 @@ clean:
        done
 
 
-tar: clean
+source-tar: clean
        (cd ../..; \
-       tar cvf source-$(VERSION).tar FlightGear/COPYING FlightGear/Docs \
-       FlightGear/Src FlightGear/Thanks)
+       tar cvzf source-$(VERSION).tar.gz FlightGear/fgtop FlightGear/COPYING \
+       FlightGear/Docs FlightGear/Src FlightGear/Thanks)
 
-zip: clean
+source-zip: clean
        (cd ../..; \
-       zip -r source-$(VERSION).zip FlightGear/COPYING FlightGear/Docs \
-       FlightGear/Src FlightGear/Thanks)
+       zip -r source-$(VERSION).zip FlightGear/fgtop FlightGear/COPYING \
+       FlightGear/Docs FlightGear/Src FlightGear/Thanks)
+
+scenery-tar:
+       (cd ../..; \
+       tar cvzf scenery-$(VERSION).tar.gz FlightGear/Scenery)
+
+scenery-zip:
+       (cd ../..; \
+       zip -r scenery-$(VERSION).zip FlightGear/Scenery)
+
+bin-tar: all
+       cp GLUT/fg0 GLUT/runfg ..
+       (cd ../..; \
+       tar cvzf bin-$(VERSION).tar.gz FlightGear/fgtop FlightGear/fg0 \
+       FlightGear/runfg FlightGear/COPYING FlightGear/Docs FlightGear/Thanks)
+
+bin-zip: all
+       cp GLUT/fg0.exe GLUT/runfg.bat GLUT/cygwin.dll ..
+       (cd ../..; \
+       zip -r bin-$(VERSION).zip FlightGear/fgtop FlightGear/fg0.exe \
+       FlightGear/runfg.bat FlightGear/cygwin.dll FlightGear/COPYING \
+       FlightGear/Docs FlightGear/Thanks)
 
 
 #---------------------------------------------------------------------------
 # $Log$
+# Revision 1.26  1997/09/04 02:17:18  curt
+# Shufflin' stuff.
+#
 # Revision 1.25  1997/08/25 20:27:21  curt
 # Merged in initial HUD and Joystick code.
 #
index d72c2ea5aff9d2da6ce273a6fb6625483c510f4e..705be7e8382201cd8f127ef91dab058a62cb78b6 100644 (file)
@@ -25,7 +25,7 @@
 #---------------------------------------------------------------------------
 
 
-VERSION = 0.10
+VERSION = 0.11
 
 #---------------------------------------------------------------------------
 # Choose your weapons
@@ -120,6 +120,9 @@ FG_CFLAGS = $(GLOBAL_CFLAGS)
 
 #---------------------------------------------------------------------------
 # $Log$
+# Revision 1.13  1997/09/04 02:17:19  curt
+# Shufflin' stuff.
+#
 # Revision 1.12  1997/08/25 20:27:21  curt
 # Merged in initial HUD and Joystick code.
 #
index e73736bdc077fba0d321d250110ab5a0adc6e93a..66b8d5dd7fab0371d23aa54ce761864d6be9db45 100644 (file)
@@ -1,4 +1,9 @@
 fg_time.o: fg_time.c fg_time.h ../types.h
 fg_timer.o: fg_timer.c fg_timer.h
-sunpos.o: sunpos.c sunpos.h fg_time.h ../types.h ../constants.h \
- ../Math/fg_geodesy.h ../Math/polar.h ../Math/../types.h
+sunpos.o: sunpos.c sunpos.h ../types.h fg_time.h ../constants.h \
+ ../GLUT/views.h ../GLUT/../types.h ../GLUT/../Flight/flight.h \
+ ../GLUT/../Flight/Slew/slew.h \
+ ../GLUT/../Flight/LaRCsim/ls_interface.h \
+ ../GLUT/../Flight/LaRCsim/../flight.h ../GLUT/../Math/mat3.h \
+ ../Math/fg_geodesy.h ../Math/mat3.h ../Math/polar.h \
+ ../Math/../types.h
index 9518d913ab1421fc7f8e67dcea0572326c01b7b2..6f028b2eb60f62ab6213beca48ab1142959a7df9 100644 (file)
 #define FG_TIME_H
 
 
+#ifdef WIN32
+#  include <windows.h>
+#endif
+
+#include <GL/glut.h>
+
 #include "../types.h"
 
 
 struct fgTIME {
     /* the point on the earth's surface above which the sun is directly 
      * overhead */
-    struct fgCartesianPoint fg_sunpos;  /* in cartesian coordiantes */
     double sun_lon, sun_gc_lat;         /* in geocentric coordinates */
+    struct fgCartesianPoint fg_sunpos;  /* in cartesian coordiantes */
+    GLfloat sun_vec[4];                 /* in view coordinates */
+    double sun_angle;                   /* the angle between the sun and the 
+                                          local horizontal */
 };
 
 extern struct fgTIME cur_time_params;
@@ -46,9 +55,12 @@ extern struct fgTIME cur_time_params;
 
 
 /* $Log$
-/* Revision 1.2  1997/08/27 03:30:36  curt
-/* Changed naming scheme of basic shared structures.
+/* Revision 1.3  1997/09/04 02:17:39  curt
+/* Shufflin' stuff.
 /*
+ * Revision 1.2  1997/08/27 03:30:36  curt
+ * Changed naming scheme of basic shared structures.
+ *
  * Revision 1.1  1997/08/13 21:56:00  curt
  * Initial revision.
  *
index 074265d876bc6eb5f7714d700b15fcb480a372b6..186e6cfa99b716a70cd4c183d516c8eb3eb0b8f1 100644 (file)
@@ -46,7 +46,9 @@
 #include "sunpos.h"
 #include "fg_time.h"
 #include "../constants.h"
+#include "../GLUT/views.h"
 #include "../Math/fg_geodesy.h"
+#include "../Math/mat3.h"
 #include "../Math/polar.h"
 
 #undef E
@@ -258,12 +260,15 @@ void fgSunPosition(time_t ssue, double *lon, double *lat) {
 
 
 /* update the cur_time_params structure with the current sun position */
-void fgUpdateSunPos() {
+void fgUpdateSunPos(struct fgCartesianPoint scenery_center) {
     struct fgTIME *t;
-    double sun_gd_lat, sl_radius;
+    struct VIEW *v;
+    MAT3vec nup, nsun;
+    double sun_gd_lat, sl_radius, temp;
     static int time_warp = 0;
 
     t = &cur_time_params;
+    v = &current_view;
 
     time_warp += 200; /* increase this to make the world spin real fast */
 
@@ -275,13 +280,35 @@ void fgUpdateSunPos() {
 
     /* printf("Geodetic lat = %.5f Geocentric lat = %.5f\n", sun_gd_lat,
        t->sun_gc_lat); */
+
+    /* the sun position has to be translated just like everything else */
+    t->sun_vec[0] = t->fg_sunpos.x - scenery_center.x; 
+    t->sun_vec[1] = t->fg_sunpos.y - scenery_center.y;
+    t->sun_vec[2] = t->fg_sunpos.z - scenery_center.z;
+    /* make this a directional light source only */
+    t->sun_vec[3] = 0.0;
+
+    /* calculate thesun's relative angle to local up */
+    MAT3_COPY_VEC(nup, v->local_up);
+    nsun[0] = t->fg_sunpos.x; 
+    nsun[1] = t->fg_sunpos.y;
+    nsun[2] = t->fg_sunpos.z;
+    MAT3_NORMALIZE_VEC(nup, temp);
+    MAT3_NORMALIZE_VEC(nsun, temp);
+
+    t->sun_angle = acos(MAT3_DOT_PRODUCT(nup, nsun));
+    printf("SUN ANGLE relative to current location = %.3f rads.\n", 
+          t->sun_angle);
 }
 
 
 /* $Log$
-/* Revision 1.6  1997/08/27 03:30:37  curt
-/* Changed naming scheme of basic shared structures.
+/* Revision 1.7  1997/09/04 02:17:40  curt
+/* Shufflin' stuff.
 /*
+ * Revision 1.6  1997/08/27 03:30:37  curt
+ * Changed naming scheme of basic shared structures.
+ *
  * Revision 1.5  1997/08/22 21:34:41  curt
  * Doing a bit of reorganizing and house cleaning.
  *
index 767728485047aa17030ff1a9a1fe3f0c91ee4dc6..96f582a33cbece68ace1da6b8ffa16c7e0030334 100644 (file)
 
 #include <time.h>
 
+#include "../types.h"
 
 /* update the cur_time_params structure with the current sun position */
-void fgUpdateSunPos();
+void fgUpdateSunPos(struct fgCartesianPoint scenery_center);
 
 void fgSunPosition(time_t ssue, double *lon, double *lat);