Integrated new event manager with subsystem initializations.
This commit is contained in:
parent
8fc35e70b4
commit
2ebbbe0053
19 changed files with 231 additions and 108 deletions
|
@ -50,6 +50,8 @@ struct fgCOCKPIT *fgCockpitInit( struct fgAIRCRAFT cur_aircraft )
|
||||||
struct fgCOCKPIT *cockpit;
|
struct fgCOCKPIT *cockpit;
|
||||||
Hptr hud;
|
Hptr hud;
|
||||||
|
|
||||||
|
printf("Initializing cockpit subsystem\n");
|
||||||
|
|
||||||
cockpit = (struct fgCOCKPIT *)calloc(sizeof(struct fgCOCKPIT),1);
|
cockpit = (struct fgCOCKPIT *)calloc(sizeof(struct fgCOCKPIT),1);
|
||||||
if( cockpit == NULL )
|
if( cockpit == NULL )
|
||||||
return( NULL );
|
return( NULL );
|
||||||
|
@ -66,7 +68,8 @@ struct fgCOCKPIT *fgCockpitInit( struct fgAIRCRAFT cur_aircraft )
|
||||||
|
|
||||||
aircraft_cockpit = cockpit;
|
aircraft_cockpit = cockpit;
|
||||||
|
|
||||||
printf( "Code %d Status %d\n", cockpit->hud->code, cockpit->hud->status );
|
printf(" Code %d Status %d\n", cockpit->hud->code,
|
||||||
|
cockpit->hud->status );
|
||||||
|
|
||||||
return( cockpit );
|
return( cockpit );
|
||||||
}
|
}
|
||||||
|
@ -87,10 +90,13 @@ void fgCockpitUpdate()
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.3 1997/12/15 23:54:33 curt
|
/* Revision 1.4 1997/12/30 20:47:34 curt
|
||||||
/* Add xgl wrappers for debugging.
|
/* Integrated new event manager with subsystem initializations.
|
||||||
/* Generate terrain normals on the fly.
|
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.3 1997/12/15 23:54:33 curt
|
||||||
|
* Add xgl wrappers for debugging.
|
||||||
|
* Generate terrain normals on the fly.
|
||||||
|
*
|
||||||
* Revision 1.2 1997/12/10 22:37:38 curt
|
* Revision 1.2 1997/12/10 22:37:38 curt
|
||||||
* Prepended "fg" on the name of all global structures that didn't have it yet.
|
* Prepended "fg" on the name of all global structures that didn't have it yet.
|
||||||
* i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
|
* i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
|
||||||
|
|
11
FDM/flight.c
11
FDM/flight.c
|
@ -31,6 +31,8 @@
|
||||||
int fgFlightModelInit(int model, struct fgFLIGHT *f, double dt) {
|
int fgFlightModelInit(int model, struct fgFLIGHT *f, double dt) {
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
|
printf("Initializing flight model\n");
|
||||||
|
|
||||||
if ( model == FG_LARCSIM ) {
|
if ( model == FG_LARCSIM ) {
|
||||||
fgFlight_2_LaRCsim(f); /* translate FG to LaRCsim structure */
|
fgFlight_2_LaRCsim(f); /* translate FG to LaRCsim structure */
|
||||||
fgLaRCsimInit(dt);
|
fgLaRCsimInit(dt);
|
||||||
|
@ -61,10 +63,13 @@ int fgFlightModelUpdate(int model, struct fgFLIGHT *f, int multiloop) {
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.4 1997/12/10 22:37:42 curt
|
/* Revision 1.5 1997/12/30 20:47:37 curt
|
||||||
/* Prepended "fg" on the name of all global structures that didn't have it yet.
|
/* Integrated new event manager with subsystem initializations.
|
||||||
/* i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
|
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.4 1997/12/10 22:37:42 curt
|
||||||
|
* Prepended "fg" on the name of all global structures that didn't have it yet.
|
||||||
|
* i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
|
||||||
|
*
|
||||||
* Revision 1.3 1997/08/27 03:30:04 curt
|
* Revision 1.3 1997/08/27 03:30:04 curt
|
||||||
* Changed naming scheme of basic shared structures.
|
* Changed naming scheme of basic shared structures.
|
||||||
*
|
*
|
||||||
|
|
|
@ -41,8 +41,9 @@ static joy_y_dead_min=1000, joy_y_dead_max=-1000;
|
||||||
|
|
||||||
static int joystick_fd;
|
static int joystick_fd;
|
||||||
|
|
||||||
int fgJoystickInit( int joy_num )
|
int fgJoystickInit( int joy_num ) {
|
||||||
{
|
printf("Initializing joystick\n");
|
||||||
|
|
||||||
#ifdef HAVE_JOYSTICK
|
#ifdef HAVE_JOYSTICK
|
||||||
int status;
|
int status;
|
||||||
char *fname;
|
char *fname;
|
||||||
|
@ -235,7 +236,10 @@ int fgJoystickRead( double *joy_x, double *joy_y, int *joy_b1, int *joy_b2 )
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.1 1997/08/29 18:06:54 curt
|
/* Revision 1.2 1997/12/30 20:47:40 curt
|
||||||
/* Initial revision.
|
/* Integrated new event manager with subsystem initializations.
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.1 1997/08/29 18:06:54 curt
|
||||||
|
* Initial revision.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -348,9 +348,9 @@ static void fgRenderFrame( void ) {
|
||||||
fgSceneryRender();
|
fgSceneryRender();
|
||||||
|
|
||||||
/* display HUD */
|
/* display HUD */
|
||||||
/* if( show_hud ) {
|
if( show_hud ) {
|
||||||
fgCockpitUpdate();
|
fgCockpitUpdate();
|
||||||
} */
|
}
|
||||||
|
|
||||||
/* display instruments */
|
/* display instruments */
|
||||||
if (displayInstruments) {
|
if (displayInstruments) {
|
||||||
|
@ -512,6 +512,7 @@ void fgInitTimeDepCalcs() {
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/* What should we do when we have nothing else to do? How about get
|
/* What should we do when we have nothing else to do? How about get
|
||||||
* ready for the next move and update the display? */
|
* ready for the next move and update the display? */
|
||||||
static void fgMainLoop( void ) {
|
static void fgMainLoop( void ) {
|
||||||
|
@ -555,6 +556,7 @@ static void fgMainLoop( void ) {
|
||||||
printf("Model iterations needed = %d, new remainder = %d\n", multi_loop,
|
printf("Model iterations needed = %d, new remainder = %d\n", multi_loop,
|
||||||
remainder);
|
remainder);
|
||||||
|
|
||||||
|
/* Run flight model */
|
||||||
if ( ! use_signals ) {
|
if ( ! use_signals ) {
|
||||||
/* flight model */
|
/* flight model */
|
||||||
fgUpdateTimeDepCalcs(multi_loop);
|
fgUpdateTimeDepCalcs(multi_loop);
|
||||||
|
@ -580,6 +582,9 @@ static void fgMainLoop( void ) {
|
||||||
|
|
||||||
fgAircraftOutputCurrent(a);
|
fgAircraftOutputCurrent(a);
|
||||||
|
|
||||||
|
/* Process/manage pending events */
|
||||||
|
fgEventProcess();
|
||||||
|
|
||||||
/* redraw display */
|
/* redraw display */
|
||||||
fgRenderFrame();
|
fgRenderFrame();
|
||||||
}
|
}
|
||||||
|
@ -689,9 +694,12 @@ int main( int argc, char *argv[] ) {
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.42 1997/12/30 16:36:47 curt
|
/* Revision 1.43 1997/12/30 20:47:43 curt
|
||||||
/* Merged in Durk's changes ...
|
/* Integrated new event manager with subsystem initializations.
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.42 1997/12/30 16:36:47 curt
|
||||||
|
* Merged in Durk's changes ...
|
||||||
|
*
|
||||||
* Revision 1.41 1997/12/30 13:06:56 curt
|
* Revision 1.41 1997/12/30 13:06:56 curt
|
||||||
* A couple lighting tweaks ...
|
* A couple lighting tweaks ...
|
||||||
*
|
*
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
#include "../Scenery/sky.h"
|
#include "../Scenery/sky.h"
|
||||||
#include "../Scenery/stars.h"
|
#include "../Scenery/stars.h"
|
||||||
#include "../Scenery/sun.h"
|
#include "../Scenery/sun.h"
|
||||||
|
#include "../Time/event.h"
|
||||||
#include "../Time/fg_time.h"
|
#include "../Time/fg_time.h"
|
||||||
#include "../Time/sunpos.h"
|
#include "../Time/sunpos.h"
|
||||||
#include "../Weather/weather.h"
|
#include "../Weather/weather.h"
|
||||||
|
@ -59,6 +60,9 @@ void fgInitGeneral( void ) {
|
||||||
|
|
||||||
g = &general;
|
g = &general;
|
||||||
|
|
||||||
|
printf("General Initialization\n");
|
||||||
|
printf("======= ==============\n");
|
||||||
|
|
||||||
/* seed the random number generater */
|
/* seed the random number generater */
|
||||||
fg_srandom();
|
fg_srandom();
|
||||||
|
|
||||||
|
@ -69,6 +73,8 @@ void fgInitGeneral( void ) {
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
printf("FG_ROOT = %s\n", g->root_dir);
|
printf("FG_ROOT = %s\n", g->root_dir);
|
||||||
|
|
||||||
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -87,6 +93,8 @@ void fgInitSubsystems( void ) {
|
||||||
t = &cur_time_params;
|
t = &cur_time_params;
|
||||||
v = ¤t_view;
|
v = ¤t_view;
|
||||||
|
|
||||||
|
printf("Initialize Subsystems\n");
|
||||||
|
printf("========== ==========\n");
|
||||||
|
|
||||||
/****************************************************************
|
/****************************************************************
|
||||||
* The following section sets up the flight model EOM parameters and
|
* The following section sets up the flight model EOM parameters and
|
||||||
|
@ -160,12 +168,19 @@ void fgInitSubsystems( void ) {
|
||||||
/* fgSlewInit(-335340,162540, 15, 4.38); */
|
/* fgSlewInit(-335340,162540, 15, 4.38); */
|
||||||
/* fgSlewInit(-398673.28,120625.64, 53, 4.38); */
|
/* fgSlewInit(-398673.28,120625.64, 53, 4.38); */
|
||||||
|
|
||||||
|
/* Initialize the event manager */
|
||||||
|
fgEventInit();
|
||||||
|
|
||||||
|
/* Dump event stats every 60 seconds */
|
||||||
|
fgEventRegister( "fgEventPrintStats()", fgEventPrintStats,
|
||||||
|
FG_EVENT_READY, 60000 );
|
||||||
|
|
||||||
/* Initialize "time" */
|
/* Initialize "time" */
|
||||||
fgTimeInit(t);
|
fgTimeInit(t);
|
||||||
fgTimeUpdate(f, t);
|
fgTimeUpdate(f, t);
|
||||||
|
|
||||||
/* Initialize shared sun position and sun_vec */
|
/* Initialize shared sun position and sun_vec */
|
||||||
fgUpdateSunPos(scenery.center);
|
fgEventRegister( "fgUpdateSunPos()", fgUpdateSunPos, FG_EVENT_READY, 1000 );
|
||||||
|
|
||||||
/* Initialize view parameters */
|
/* Initialize view parameters */
|
||||||
fgViewInit(v);
|
fgViewInit(v);
|
||||||
|
@ -174,13 +189,10 @@ void fgInitSubsystems( void ) {
|
||||||
fgWeatherInit();
|
fgWeatherInit();
|
||||||
|
|
||||||
/* Initialize the Cockpit subsystem */
|
/* Initialize the Cockpit subsystem */
|
||||||
/*
|
if( fgCockpitInit( current_aircraft ) == NULL ) {
|
||||||
if( fgCockpitInit( current_aircraft ) == NULL )
|
|
||||||
{
|
|
||||||
printf( "Error in Cockpit initialization!\n" );
|
printf( "Error in Cockpit initialization!\n" );
|
||||||
exit( 1 );
|
exit( 1 );
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
/* Initialize the orbital elements of sun, moon and mayor planets */
|
/* Initialize the orbital elements of sun, moon and mayor planets */
|
||||||
fgSolarSystemInit(*t);
|
fgSolarSystemInit(*t);
|
||||||
|
@ -208,7 +220,7 @@ void fgInitSubsystems( void ) {
|
||||||
* eventually */
|
* eventually */
|
||||||
cur_elev = mesh_altitude(FG_Longitude * RAD_TO_DEG * 3600.0,
|
cur_elev = mesh_altitude(FG_Longitude * RAD_TO_DEG * 3600.0,
|
||||||
FG_Latitude * RAD_TO_DEG * 3600.0);
|
FG_Latitude * RAD_TO_DEG * 3600.0);
|
||||||
printf("Ground elevation is %.2f meters here.\n", cur_elev);
|
printf("True ground elevation is %.2f meters here.\n", cur_elev);
|
||||||
if ( cur_elev > -9990.0 ) {
|
if ( cur_elev > -9990.0 ) {
|
||||||
FG_Runway_altitude = cur_elev * METER_TO_FEET;
|
FG_Runway_altitude = cur_elev * METER_TO_FEET;
|
||||||
}
|
}
|
||||||
|
@ -216,7 +228,7 @@ void fgInitSubsystems( void ) {
|
||||||
if ( FG_Altitude < FG_Runway_altitude ) {
|
if ( FG_Altitude < FG_Runway_altitude ) {
|
||||||
FG_Altitude = FG_Runway_altitude + 3.758099;
|
FG_Altitude = FG_Runway_altitude + 3.758099;
|
||||||
}
|
}
|
||||||
printf("Updated position is: (%.4f, %.4f, %.2f)\n",
|
printf("Updated position (after elevation adj): (%.4f, %.4f, %.2f)\n",
|
||||||
FG_Latitude * RAD_TO_DEG, FG_Longitude * RAD_TO_DEG,
|
FG_Latitude * RAD_TO_DEG, FG_Longitude * RAD_TO_DEG,
|
||||||
FG_Altitude * FEET_TO_METER);
|
FG_Altitude * FEET_TO_METER);
|
||||||
/* end of thing that I just stuck in that I should probably move */
|
/* end of thing that I just stuck in that I should probably move */
|
||||||
|
@ -227,20 +239,25 @@ void fgInitSubsystems( void ) {
|
||||||
fgFlightModelInit( FG_LARCSIM, f, 1.0 / DEFAULT_MODEL_HZ );
|
fgFlightModelInit( FG_LARCSIM, f, 1.0 / DEFAULT_MODEL_HZ );
|
||||||
|
|
||||||
/* To HUD or not to HUD */
|
/* To HUD or not to HUD */
|
||||||
show_hud = 1;
|
show_hud = 0;
|
||||||
|
|
||||||
/* Let's show the instrument panel */
|
/* Let's show the instrument panel */
|
||||||
displayInstruments = 1;
|
displayInstruments = 0;
|
||||||
|
|
||||||
/* Joystick support */
|
/* Joystick support */
|
||||||
fgJoystickInit( 0 );
|
fgJoystickInit( 0 );
|
||||||
|
|
||||||
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.23 1997/12/30 16:36:50 curt
|
/* Revision 1.24 1997/12/30 20:47:44 curt
|
||||||
/* Merged in Durk's changes ...
|
/* Integrated new event manager with subsystem initializations.
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.23 1997/12/30 16:36:50 curt
|
||||||
|
* Merged in Durk's changes ...
|
||||||
|
*
|
||||||
* Revision 1.22 1997/12/19 23:34:05 curt
|
* Revision 1.22 1997/12/19 23:34:05 curt
|
||||||
* Lot's of tweaking with sky rendering and lighting.
|
* Lot's of tweaking with sky rendering and lighting.
|
||||||
*
|
*
|
||||||
|
|
|
@ -42,6 +42,8 @@ struct fgVIEW current_view;
|
||||||
|
|
||||||
/* Initialize a view structure */
|
/* Initialize a view structure */
|
||||||
void fgViewInit(struct fgVIEW *v) {
|
void fgViewInit(struct fgVIEW *v) {
|
||||||
|
printf("Initializing View parameters\n");
|
||||||
|
|
||||||
v->view_offset = 0.0;
|
v->view_offset = 0.0;
|
||||||
v->goal_view_offset = 0.0;
|
v->goal_view_offset = 0.0;
|
||||||
}
|
}
|
||||||
|
@ -181,9 +183,12 @@ void fgViewUpdate(struct fgFLIGHT *f, struct fgVIEW *v, struct fgLIGHT *l) {
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.6 1997/12/22 04:14:32 curt
|
/* Revision 1.7 1997/12/30 20:47:45 curt
|
||||||
/* Aligned sky with sun so dusk/dawn effects can be correct relative to the sun.
|
/* Integrated new event manager with subsystem initializations.
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.6 1997/12/22 04:14:32 curt
|
||||||
|
* Aligned sky with sun so dusk/dawn effects can be correct relative to the sun.
|
||||||
|
*
|
||||||
* Revision 1.5 1997/12/18 04:07:02 curt
|
* Revision 1.5 1997/12/18 04:07:02 curt
|
||||||
* Worked on properly translating and positioning the sky dome.
|
* Worked on properly translating and positioning the sky dome.
|
||||||
*
|
*
|
||||||
|
|
|
@ -260,6 +260,8 @@ void fgMoonInit() {
|
||||||
struct fgLIGHT *l;
|
struct fgLIGHT *l;
|
||||||
static int dl_exists = 0;
|
static int dl_exists = 0;
|
||||||
|
|
||||||
|
printf("Initializing the Moon\n");
|
||||||
|
|
||||||
l = &cur_light_params;
|
l = &cur_light_params;
|
||||||
|
|
||||||
/* position the moon */
|
/* position the moon */
|
||||||
|
@ -317,7 +319,10 @@ void fgMoonRender() {
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.13 1997/12/30 16:41:00 curt
|
/* Revision 1.14 1997/12/30 20:47:50 curt
|
||||||
/* Added log at end of file.
|
/* Integrated new event manager with subsystem initializations.
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.13 1997/12/30 16:41:00 curt
|
||||||
|
* Added log at end of file.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -89,6 +89,8 @@ GLint fgObjLoad(char *path) {
|
||||||
while ( fgets(line, 250, f) != NULL ) {
|
while ( fgets(line, 250, f) != NULL ) {
|
||||||
if ( line[0] == '#' ) {
|
if ( line[0] == '#' ) {
|
||||||
/* comment -- ignore */
|
/* comment -- ignore */
|
||||||
|
} else if ( line[0] == '\n' ) {
|
||||||
|
/* empty line -- ignore */
|
||||||
} else if ( strncmp(line, "v ", 2) == 0 ) {
|
} else if ( strncmp(line, "v ", 2) == 0 ) {
|
||||||
/* node (vertex) */
|
/* node (vertex) */
|
||||||
if ( ncount < MAXNODES ) {
|
if ( ncount < MAXNODES ) {
|
||||||
|
@ -121,7 +123,7 @@ GLint fgObjLoad(char *path) {
|
||||||
}
|
}
|
||||||
} else if ( strncmp(line, "winding ", 8) == 0 ) {
|
} else if ( strncmp(line, "winding ", 8) == 0 ) {
|
||||||
sscanf(line+8, "%s", winding_str);
|
sscanf(line+8, "%s", winding_str);
|
||||||
printf("WINDING = %s\n", winding_str);
|
printf(" WINDING = %s\n", winding_str);
|
||||||
|
|
||||||
/* can't call xglFrontFace() between xglBegin() & xglEnd() */
|
/* can't call xglFrontFace() between xglBegin() & xglEnd() */
|
||||||
xglEnd();
|
xglEnd();
|
||||||
|
@ -146,7 +148,7 @@ GLint fgObjLoad(char *path) {
|
||||||
first = 0;
|
first = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("new tri strip = %s", line);
|
/* printf(" new tri strip = %s", line); */
|
||||||
sscanf(line, "t %d %d %d %d\n", &n1, &n2, &n3, &n4);
|
sscanf(line, "t %d %d %d %d\n", &n1, &n2, &n3, &n4);
|
||||||
|
|
||||||
/* printf("(t) = "); */
|
/* printf("(t) = "); */
|
||||||
|
@ -315,9 +317,12 @@ GLint fgObjLoad(char *path) {
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.14 1997/12/30 01:38:46 curt
|
/* Revision 1.15 1997/12/30 20:47:51 curt
|
||||||
/* Switched back to per vertex normals and smooth shading for terrain.
|
/* Integrated new event manager with subsystem initializations.
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.14 1997/12/30 01:38:46 curt
|
||||||
|
* Switched back to per vertex normals and smooth shading for terrain.
|
||||||
|
*
|
||||||
* Revision 1.13 1997/12/18 23:32:36 curt
|
* Revision 1.13 1997/12/18 23:32:36 curt
|
||||||
* First stab at sky dome actually starting to look reasonable. :-)
|
* First stab at sky dome actually starting to look reasonable. :-)
|
||||||
*
|
*
|
||||||
|
|
|
@ -53,10 +53,11 @@ double fgCalcActTime(struct fgTIME t)
|
||||||
actTime += (UT / 24.0);
|
actTime += (UT / 24.0);
|
||||||
#define DEBUG 1
|
#define DEBUG 1
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("Actual Time:\n");
|
/* printf(" Actual Time:\n"); */
|
||||||
printf("current day = %f\t", actTime);
|
/* printf(" current day = %f\t", actTime); */
|
||||||
printf("GMT = %d, %d, %d, %d, %d, %d\n", year, t.gmt->tm_mon, t.gmt->tm_mday,
|
/* printf(" GMT = %d, %d, %d, %d, %d, %d\n",
|
||||||
t.gmt->tm_hour, t.gmt->tm_min, t.gmt->tm_sec);
|
year, t.gmt->tm_mon, t.gmt->tm_mday,
|
||||||
|
t.gmt->tm_hour, t.gmt->tm_min, t.gmt->tm_sec); */
|
||||||
#endif
|
#endif
|
||||||
return actTime;
|
return actTime;
|
||||||
}
|
}
|
||||||
|
@ -124,6 +125,8 @@ void fgSolarSystemInit(struct fgTIME t)
|
||||||
int i;
|
int i;
|
||||||
FILE *data;
|
FILE *data;
|
||||||
|
|
||||||
|
printf("Initializing solar system\n");
|
||||||
|
|
||||||
/* build the full path name to the orbital elements database file */
|
/* build the full path name to the orbital elements database file */
|
||||||
g = &general;
|
g = &general;
|
||||||
path[0] = '\0';
|
path[0] = '\0';
|
||||||
|
@ -137,7 +140,7 @@ void fgSolarSystemInit(struct fgTIME t)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("reading datafile %s", path);
|
printf(" reading datafile %s\n", path);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* for all the objects... */
|
/* for all the objects... */
|
||||||
|
@ -170,10 +173,13 @@ void fgSolarSystemUpdate(struct OrbElements *planet, struct fgTIME t)
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.5 1997/12/15 23:55:02 curt
|
/* Revision 1.6 1997/12/30 20:47:52 curt
|
||||||
/* Add xgl wrappers for debugging.
|
/* Integrated new event manager with subsystem initializations.
|
||||||
/* Generate terrain normals on the fly.
|
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.5 1997/12/15 23:55:02 curt
|
||||||
|
* Add xgl wrappers for debugging.
|
||||||
|
* Generate terrain normals on the fly.
|
||||||
|
*
|
||||||
* Revision 1.4 1997/12/10 22:37:51 curt
|
* Revision 1.4 1997/12/10 22:37:51 curt
|
||||||
* Prepended "fg" on the name of all global structures that didn't have it yet.
|
* Prepended "fg" on the name of all global structures that didn't have it yet.
|
||||||
* i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
|
* i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
|
||||||
|
|
|
@ -120,20 +120,25 @@ struct CelestialCoord fgCalculatePlanet(struct OrbElements planet,
|
||||||
default:
|
default:
|
||||||
printf("index %d out of range !!!!\n", idx);
|
printf("index %d out of range !!!!\n", idx);
|
||||||
}
|
}
|
||||||
printf("Geocentric dist %f\n"
|
printf(" Planet found at %f (ra), %f (dec)\n",
|
||||||
"Heliocentric dist %f\n"
|
result.RightAscension, result.Declination);
|
||||||
"Distance to the sun %f\n"
|
printf(" Geocentric dist %f\n"
|
||||||
"Phase angle %f\n"
|
" Heliocentric dist %f\n"
|
||||||
"Brightness %f\n", R, r, s, FV, result.magnitude);
|
" Distance to the sun %f\n"
|
||||||
|
" Phase angle %f\n"
|
||||||
|
" Brightness %f\n", R, r, s, FV, result.magnitude);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.3 1997/12/30 16:36:52 curt
|
/* Revision 1.4 1997/12/30 20:47:52 curt
|
||||||
/* Merged in Durk's changes ...
|
/* Integrated new event manager with subsystem initializations.
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.3 1997/12/30 16:36:52 curt
|
||||||
|
* Merged in Durk's changes ...
|
||||||
|
*
|
||||||
* Revision 1.2 1997/12/12 21:41:29 curt
|
* Revision 1.2 1997/12/12 21:41:29 curt
|
||||||
* More light/material property tweaking ... still a ways off.
|
* More light/material property tweaking ... still a ways off.
|
||||||
*
|
*
|
||||||
|
|
|
@ -52,6 +52,8 @@ struct fgSCENERY scenery;
|
||||||
|
|
||||||
/* Initialize the Scenery Management system */
|
/* Initialize the Scenery Management system */
|
||||||
void fgSceneryInit() {
|
void fgSceneryInit() {
|
||||||
|
printf("Initializing scenery subsystem\n");
|
||||||
|
|
||||||
/* set the default terrain detail level */
|
/* set the default terrain detail level */
|
||||||
scenery.terrain_skip = 6;
|
scenery.terrain_skip = 6;
|
||||||
}
|
}
|
||||||
|
@ -74,7 +76,7 @@ void fgSceneryUpdate(double lon, double lat, double elev) {
|
||||||
strcat(path, "/Scenery/");
|
strcat(path, "/Scenery/");
|
||||||
strcat(path, "mesa-e.obj");
|
strcat(path, "mesa-e.obj");
|
||||||
|
|
||||||
printf("Loading Scenery: %s\n", path);
|
printf(" Loading Scenery: %s\n", path);
|
||||||
|
|
||||||
area_terrain = fgObjLoad(path);
|
area_terrain = fgObjLoad(path);
|
||||||
}
|
}
|
||||||
|
@ -100,10 +102,13 @@ void fgSceneryRender() {
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.28 1997/12/15 23:55:02 curt
|
/* Revision 1.29 1997/12/30 20:47:52 curt
|
||||||
/* Add xgl wrappers for debugging.
|
/* Integrated new event manager with subsystem initializations.
|
||||||
/* Generate terrain normals on the fly.
|
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.28 1997/12/15 23:55:02 curt
|
||||||
|
* Add xgl wrappers for debugging.
|
||||||
|
* Generate terrain normals on the fly.
|
||||||
|
*
|
||||||
* Revision 1.27 1997/12/12 21:41:30 curt
|
* Revision 1.27 1997/12/12 21:41:30 curt
|
||||||
* More light/material property tweaking ... still a ways off.
|
* More light/material property tweaking ... still a ways off.
|
||||||
*
|
*
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
|
|
||||||
#include "sky.h"
|
#include "sky.h"
|
||||||
|
|
||||||
|
#include "../Time/event.h"
|
||||||
#include "../Time/fg_time.h"
|
#include "../Time/fg_time.h"
|
||||||
|
|
||||||
#include "../Aircraft/aircraft.h"
|
#include "../Aircraft/aircraft.h"
|
||||||
|
@ -75,7 +76,7 @@ void fgSkyVerticesInit() {
|
||||||
float theta;
|
float theta;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
printf("Generating the sky dome vertices.\n");
|
printf(" Generating the sky dome vertices.\n");
|
||||||
|
|
||||||
for ( i = 0; i < 12; i++ ) {
|
for ( i = 0; i < 12; i++ ) {
|
||||||
theta = (i * 30.0) * DEG_TO_RAD;
|
theta = (i * 30.0) * DEG_TO_RAD;
|
||||||
|
@ -84,8 +85,8 @@ void fgSkyVerticesInit() {
|
||||||
inner_vertex[i][1] = sin(theta) * INNER_RADIUS;
|
inner_vertex[i][1] = sin(theta) * INNER_RADIUS;
|
||||||
inner_vertex[i][2] = INNER_ELEV;
|
inner_vertex[i][2] = INNER_ELEV;
|
||||||
|
|
||||||
printf(" %.2f %.2f\n", cos(theta) * INNER_RADIUS,
|
/* printf(" %.2f %.2f\n", cos(theta) * INNER_RADIUS,
|
||||||
sin(theta) * INNER_RADIUS);
|
sin(theta) * INNER_RADIUS); */
|
||||||
|
|
||||||
middle_vertex[i][0] = cos((double)theta) * MIDDLE_RADIUS;
|
middle_vertex[i][0] = cos((double)theta) * MIDDLE_RADIUS;
|
||||||
middle_vertex[i][1] = sin((double)theta) * MIDDLE_RADIUS;
|
middle_vertex[i][1] = sin((double)theta) * MIDDLE_RADIUS;
|
||||||
|
@ -109,7 +110,7 @@ void fgSkyColorsInit() {
|
||||||
|
|
||||||
l = &cur_light_params;
|
l = &cur_light_params;
|
||||||
|
|
||||||
printf("Generating the sky colors for each vertex.\n");
|
printf(" Generating the sky colors for each vertex.\n");
|
||||||
|
|
||||||
/* setup for the possibility of sunset effects */
|
/* setup for the possibility of sunset effects */
|
||||||
sun_angle = l->sun_angle * RAD_TO_DEG;
|
sun_angle = l->sun_angle * RAD_TO_DEG;
|
||||||
|
@ -169,6 +170,7 @@ void fgSkyColorsInit() {
|
||||||
middle_amt[j] -= middle_diff[j];
|
middle_amt[j] -= middle_diff[j];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
printf("inner_color[%d] = %.2f %.2f %.2f %.2f\n", i, inner_color[i][0],
|
printf("inner_color[%d] = %.2f %.2f %.2f %.2f\n", i, inner_color[i][0],
|
||||||
inner_color[i][1], inner_color[i][2], inner_color[i][3]);
|
inner_color[i][1], inner_color[i][2], inner_color[i][3]);
|
||||||
printf("middle_color[%d] = %.2f %.2f %.2f %.2f\n", i,
|
printf("middle_color[%d] = %.2f %.2f %.2f %.2f\n", i,
|
||||||
|
@ -177,6 +179,7 @@ void fgSkyColorsInit() {
|
||||||
printf("outer_color[%d] = %.2f %.2f %.2f %.2f\n", i,
|
printf("outer_color[%d] = %.2f %.2f %.2f %.2f\n", i,
|
||||||
outer_color[i][0], outer_color[i][1], outer_color[i][2],
|
outer_color[i][0], outer_color[i][1], outer_color[i][2],
|
||||||
outer_color[i][3]);
|
outer_color[i][3]);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( j = 0; j < 3; j++ ) {
|
for ( j = 0; j < 3; j++ ) {
|
||||||
|
@ -206,6 +209,7 @@ void fgSkyColorsInit() {
|
||||||
middle_amt[j] += middle_diff[j];
|
middle_amt[j] += middle_diff[j];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
printf("inner_color[%d] = %.2f %.2f %.2f %.2f\n", i, inner_color[i][0],
|
printf("inner_color[%d] = %.2f %.2f %.2f %.2f\n", i, inner_color[i][0],
|
||||||
inner_color[i][1], inner_color[i][2], inner_color[i][3]);
|
inner_color[i][1], inner_color[i][2], inner_color[i][3]);
|
||||||
printf("middle_color[%d] = %.2f %.2f %.2f %.2f\n", i,
|
printf("middle_color[%d] = %.2f %.2f %.2f %.2f\n", i,
|
||||||
|
@ -214,14 +218,20 @@ void fgSkyColorsInit() {
|
||||||
printf("outer_color[%d] = %.2f %.2f %.2f %.2f\n", i,
|
printf("outer_color[%d] = %.2f %.2f %.2f %.2f\n", i,
|
||||||
outer_color[i][0], outer_color[i][1], outer_color[i][2],
|
outer_color[i][0], outer_color[i][1], outer_color[i][2],
|
||||||
outer_color[i][3]);
|
outer_color[i][3]);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Initialize the sky structure and colors */
|
/* Initialize the sky structure and colors */
|
||||||
void fgSkyInit() {
|
void fgSkyInit() {
|
||||||
|
printf("Initializing the sky\n");
|
||||||
|
|
||||||
fgSkyVerticesInit();
|
fgSkyVerticesInit();
|
||||||
fgSkyColorsInit();
|
|
||||||
|
/* regester fgSkyColorsInit() as an event to be run periodically */
|
||||||
|
fgEventRegister("fgSkyColorsInit()", fgSkyColorsInit,
|
||||||
|
FG_EVENT_READY, 30000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -319,9 +329,12 @@ void fgSkyRender() {
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.9 1997/12/30 13:06:57 curt
|
/* Revision 1.10 1997/12/30 20:47:53 curt
|
||||||
/* A couple lighting tweaks ...
|
/* Integrated new event manager with subsystem initializations.
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.9 1997/12/30 13:06:57 curt
|
||||||
|
* A couple lighting tweaks ...
|
||||||
|
*
|
||||||
* Revision 1.8 1997/12/23 04:58:38 curt
|
* Revision 1.8 1997/12/23 04:58:38 curt
|
||||||
* Tweaked the sky coloring a bit to build in structures to allow finer rgb
|
* Tweaked the sky coloring a bit to build in structures to allow finer rgb
|
||||||
* control.
|
* control.
|
||||||
|
|
|
@ -68,6 +68,8 @@ void fgStarsInit() {
|
||||||
double ra_save1, decl_save1;
|
double ra_save1, decl_save1;
|
||||||
int count, i, j, max_stars;
|
int count, i, j, max_stars;
|
||||||
|
|
||||||
|
printf("Initializing stars\n");
|
||||||
|
|
||||||
g = &general;
|
g = &general;
|
||||||
|
|
||||||
/* build the full path name to the stars data base file */
|
/* build the full path name to the stars data base file */
|
||||||
|
@ -79,7 +81,7 @@ void fgStarsInit() {
|
||||||
max_stars = FG_MAX_STARS;
|
max_stars = FG_MAX_STARS;
|
||||||
|
|
||||||
for ( i = 0; i < FG_STAR_LEVELS; i++ ) {
|
for ( i = 0; i < FG_STAR_LEVELS; i++ ) {
|
||||||
printf("Loading %d Stars: %s\n", max_stars, path);
|
printf(" Loading %d Stars: %s\n", max_stars, path);
|
||||||
|
|
||||||
if ( (fd = fopen(path, "r")) == NULL ) {
|
if ( (fd = fopen(path, "r")) == NULL ) {
|
||||||
printf("Cannot open star file: '%s'\n", path);
|
printf("Cannot open star file: '%s'\n", path);
|
||||||
|
@ -95,14 +97,14 @@ void fgStarsInit() {
|
||||||
while ( (fgets(line, 256, fd) != NULL) && (count < max_stars) ) {
|
while ( (fgets(line, 256, fd) != NULL) && (count < max_stars) ) {
|
||||||
front = line;
|
front = line;
|
||||||
|
|
||||||
/* printf("Read line = %s", front); */
|
/* printf(" Read line = %s", front); */
|
||||||
|
|
||||||
/* advance to first non-whitespace character */
|
/* advance to first non-whitespace character */
|
||||||
while ( (front[0] == ' ') || (front[0] == '\t') ) {
|
while ( (front[0] == ' ') || (front[0] == '\t') ) {
|
||||||
front++;
|
front++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* printf("Line length (after trimming) = %d\n", strlen(front)); */
|
/* printf(" Line length (after trimming) = %d\n", strlen(front));*/
|
||||||
|
|
||||||
if ( front[0] == '#' ) {
|
if ( front[0] == '#' ) {
|
||||||
/* comment */
|
/* comment */
|
||||||
|
@ -148,7 +150,7 @@ void fgStarsInit() {
|
||||||
if ( magnitude < 0.0 ) { magnitude = 0.0; }
|
if ( magnitude < 0.0 ) { magnitude = 0.0; }
|
||||||
magnitude =
|
magnitude =
|
||||||
magnitude * 0.7 + (((FG_STAR_LEVELS - 1) - i) * 0.1);
|
magnitude * 0.7 + (((FG_STAR_LEVELS - 1) - i) * 0.1);
|
||||||
/* printf("Found star: %d %s, %.3f %.3f %.3f\n", count,
|
/* printf(" Found star: %d %s, %.3f %.3f %.3f\n", count,
|
||||||
name, right_ascension, declination, magnitude); */
|
name, right_ascension, declination, magnitude); */
|
||||||
|
|
||||||
xglColor3f( magnitude, magnitude, magnitude );
|
xglColor3f( magnitude, magnitude, magnitude );
|
||||||
|
@ -168,8 +170,6 @@ void fgStarsInit() {
|
||||||
for ( j = 2; j < 9; j++ ) {
|
for ( j = 2; j < 9; j++ ) {
|
||||||
pltPos = fgCalculatePlanet(pltOrbElements[j],
|
pltPos = fgCalculatePlanet(pltOrbElements[j],
|
||||||
pltOrbElements[0], cur_time_params, j);
|
pltOrbElements[0], cur_time_params, j);
|
||||||
printf("Planet found at %f (ra), %f (dec)\n",
|
|
||||||
pltPos.RightAscension, pltPos.Declination);
|
|
||||||
/* give the planets a temporary color, for testing purposes */
|
/* give the planets a temporary color, for testing purposes */
|
||||||
/* xglColor3f( 1.0, 0.0, 0.0); */
|
/* xglColor3f( 1.0, 0.0, 0.0); */
|
||||||
|
|
||||||
|
@ -278,9 +278,12 @@ void fgStarsRender() {
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.22 1997/12/30 16:36:53 curt
|
/* Revision 1.23 1997/12/30 20:47:53 curt
|
||||||
/* Merged in Durk's changes ...
|
/* Integrated new event manager with subsystem initializations.
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.22 1997/12/30 16:36:53 curt
|
||||||
|
* Merged in Durk's changes ...
|
||||||
|
*
|
||||||
* Revision 1.21 1997/12/19 23:35:00 curt
|
* Revision 1.21 1997/12/19 23:35:00 curt
|
||||||
* Lot's of tweaking with sky rendering and lighting.
|
* Lot's of tweaking with sky rendering and lighting.
|
||||||
*
|
*
|
||||||
|
|
|
@ -97,6 +97,8 @@ struct CelestialCoord fgCalculateSun(struct OrbElements params, struct fgTIME t)
|
||||||
void fgSunInit() {
|
void fgSunInit() {
|
||||||
static int dl_exists = 0;
|
static int dl_exists = 0;
|
||||||
|
|
||||||
|
printf("Initializing the Sun\n");
|
||||||
|
|
||||||
fgSolarSystemUpdate(&(pltOrbElements[0]), cur_time_params);
|
fgSolarSystemUpdate(&(pltOrbElements[0]), cur_time_params);
|
||||||
sunPos = fgCalculateSun(pltOrbElements[0], cur_time_params);
|
sunPos = fgCalculateSun(pltOrbElements[0], cur_time_params);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
@ -188,9 +190,12 @@ void fgSunRender() {
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.9 1997/12/30 16:36:54 curt
|
/* Revision 1.10 1997/12/30 20:47:54 curt
|
||||||
/* Merged in Durk's changes ...
|
/* Integrated new event manager with subsystem initializations.
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.9 1997/12/30 16:36:54 curt
|
||||||
|
* Merged in Durk's changes ...
|
||||||
|
*
|
||||||
* Revision 1.8 1997/12/19 23:35:00 curt
|
* Revision 1.8 1997/12/19 23:35:00 curt
|
||||||
* Lot's of tweaking with sky rendering and lighting.
|
* Lot's of tweaking with sky rendering and lighting.
|
||||||
*
|
*
|
||||||
|
|
30
Time/event.c
30
Time/event.c
|
@ -142,6 +142,8 @@ void fgEventRun(int ptr) {
|
||||||
|
|
||||||
e = &events[ptr];
|
e = &events[ptr];
|
||||||
|
|
||||||
|
printf("Running %s\n", e->description);
|
||||||
|
|
||||||
/* record starting time */
|
/* record starting time */
|
||||||
#ifdef USE_FTIME
|
#ifdef USE_FTIME
|
||||||
ftime(&e->last_run);
|
ftime(&e->last_run);
|
||||||
|
@ -196,6 +198,7 @@ void fgEventRun(int ptr) {
|
||||||
|
|
||||||
/* Initialize the scheduling subsystem */
|
/* Initialize the scheduling subsystem */
|
||||||
void fgEventInit() {
|
void fgEventInit() {
|
||||||
|
printf("Initializing event manager\n");
|
||||||
event_ptr = 0;
|
event_ptr = 0;
|
||||||
initq();
|
initq();
|
||||||
}
|
}
|
||||||
|
@ -208,6 +211,8 @@ int fgEventRegister(char *desc, void (*event)(), int status, int interval) {
|
||||||
|
|
||||||
e = &events[event_ptr];
|
e = &events[event_ptr];
|
||||||
|
|
||||||
|
printf("Registering event: %s\n", desc);
|
||||||
|
|
||||||
if ( strlen(desc) < 256 ) {
|
if ( strlen(desc) < 256 ) {
|
||||||
strcpy(e->description, desc);
|
strcpy(e->description, desc);
|
||||||
} else {
|
} else {
|
||||||
|
@ -257,13 +262,17 @@ void fgEventResume() {
|
||||||
void fgEventPrintStats() {
|
void fgEventPrintStats() {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
printf("Event Stats\n");
|
if ( event_ptr > 0 ) {
|
||||||
|
printf("\n");
|
||||||
|
printf("Event Stats\n");
|
||||||
|
printf("----- -----\n");
|
||||||
|
|
||||||
for ( i = 0; i < event_ptr; i++ ) {
|
for ( i = 0; i < event_ptr; i++ ) {
|
||||||
printf(" %s cum=%d min=%d max=%d count=%d ave=%.2f\n",
|
printf(" %s cum=%d min=%d max=%d count=%d ave=%.2f\n",
|
||||||
events[i].description, events[i].cum_time, events[i].min_time,
|
events[i].description, events[i].cum_time,
|
||||||
events[i].max_time, events[i].count,
|
events[i].min_time, events[i].max_time, events[i].count,
|
||||||
events[i].cum_time / (double)events[i].count);
|
events[i].cum_time / (double)events[i].count);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -279,7 +288,7 @@ void fgEventProcess() {
|
||||||
#endif /* USE_FTIME */
|
#endif /* USE_FTIME */
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* printf("Processing events\n"); */
|
printf("Processing events\n");
|
||||||
|
|
||||||
/* get the current time */
|
/* get the current time */
|
||||||
#ifdef USE_FTIME
|
#ifdef USE_FTIME
|
||||||
|
@ -323,7 +332,10 @@ void fgEventProcess() {
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.1 1997/12/30 04:19:22 curt
|
/* Revision 1.2 1997/12/30 20:47:58 curt
|
||||||
/* Initial revision.
|
/* Integrated new event manager with subsystem initializations.
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.1 1997/12/30 04:19:22 curt
|
||||||
|
* Initial revision.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -51,6 +51,8 @@ struct fgLIGHT cur_light_params;
|
||||||
/* Initialize the time dependent variables */
|
/* Initialize the time dependent variables */
|
||||||
|
|
||||||
void fgTimeInit(struct fgTIME *t) {
|
void fgTimeInit(struct fgTIME *t) {
|
||||||
|
printf("Initializing Time\n");
|
||||||
|
|
||||||
t->gst_diff = -9999.0;
|
t->gst_diff = -9999.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,7 +120,7 @@ double utc_gst (double mjd) {
|
||||||
x /= 3600.0;
|
x /= 3600.0;
|
||||||
gst = (1.0/SIDRATE)*hr + x;
|
gst = (1.0/SIDRATE)*hr + x;
|
||||||
|
|
||||||
printf("gst => %.4f\n", gst);
|
printf(" gst => %.4f\n", gst);
|
||||||
|
|
||||||
return(gst);
|
return(gst);
|
||||||
}
|
}
|
||||||
|
@ -166,9 +168,11 @@ double sidereal_course(struct tm *gmt, time_t now, double lng) {
|
||||||
struct timezone tz;
|
struct timezone tz;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
printf("COURSE: GMT = %d/%d/%2d %d:%02d:%02d\n",
|
/*
|
||||||
|
printf(" COURSE: GMT = %d/%d/%2d %d:%02d:%02d\n",
|
||||||
gmt->tm_mon, gmt->tm_mday, gmt->tm_year,
|
gmt->tm_mon, gmt->tm_mday, gmt->tm_year,
|
||||||
gmt->tm_hour, gmt->tm_min, gmt->tm_sec);
|
gmt->tm_hour, gmt->tm_min, gmt->tm_sec);
|
||||||
|
*/
|
||||||
|
|
||||||
mt.tm_mon = 2;
|
mt.tm_mon = 2;
|
||||||
mt.tm_mday = 21;
|
mt.tm_mday = 21;
|
||||||
|
@ -193,19 +197,19 @@ double sidereal_course(struct tm *gmt, time_t now, double lng) {
|
||||||
|
|
||||||
offset = -(timezone / 3600 - daylight);
|
offset = -(timezone / 3600 - daylight);
|
||||||
|
|
||||||
printf("Raw time zone offset = %ld\n", timezone);
|
/* printf(" Raw time zone offset = %ld\n", timezone); */
|
||||||
printf("Daylight Savings = %d\n", daylight);
|
/* printf(" Daylight Savings = %d\n", daylight); */
|
||||||
|
|
||||||
printf("Local hours from GMT = %ld\n", offset);
|
/* printf(" Local hours from GMT = %ld\n", offset); */
|
||||||
|
|
||||||
start_gmt = start - timezone + (daylight * 3600);
|
start_gmt = start - timezone + (daylight * 3600);
|
||||||
|
|
||||||
printf("March 21 noon (CST) = %ld\n", start);
|
/* printf(" March 21 noon (CST) = %ld\n", start); */
|
||||||
printf("March 21 noon (GMT) = %ld\n", start_gmt);
|
/* printf(" March 21 noon (GMT) = %ld\n", start_gmt); */
|
||||||
|
|
||||||
diff = (now - start_gmt) / (3600.0 * 24.0);
|
diff = (now - start_gmt) / (3600.0 * 24.0);
|
||||||
|
|
||||||
printf("Time since 3/21/%2d GMT = %.2f\n", gmt->tm_year, diff);
|
/* printf(" Time since 3/21/%2d GMT = %.2f\n", gmt->tm_year, diff); */
|
||||||
|
|
||||||
part = fmod(diff, 1.0);
|
part = fmod(diff, 1.0);
|
||||||
days = diff - part;
|
days = diff - part;
|
||||||
|
@ -217,8 +221,8 @@ double sidereal_course(struct tm *gmt, time_t now, double lng) {
|
||||||
lst += 24.0;
|
lst += 24.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("days = %.1f hours = %.2f lon = %.2f lst = %.2f\n",
|
/* printf(" days = %.1f hours = %.2f lon = %.2f lst = %.2f\n",
|
||||||
days, hours, lng, lst);
|
days, hours, lng, lst); */
|
||||||
|
|
||||||
return(lst);
|
return(lst);
|
||||||
}
|
}
|
||||||
|
@ -235,11 +239,12 @@ void fgTimeUpdate(struct fgFLIGHT *f, struct fgTIME *t) {
|
||||||
warp += 0;
|
warp += 0;
|
||||||
t->cur_time = time(NULL) + (0) * 60 * 60;
|
t->cur_time = time(NULL) + (0) * 60 * 60;
|
||||||
t->cur_time += warp;
|
t->cur_time += warp;
|
||||||
printf("Current Unix calendar time = %ld warp = %ld\n", t->cur_time, warp);
|
printf(" Current Unix calendar time = %ld warp = %ld\n",
|
||||||
|
t->cur_time, warp);
|
||||||
|
|
||||||
/* get GMT break down for current time */
|
/* get GMT break down for current time */
|
||||||
t->gmt = gmtime(&t->cur_time);
|
t->gmt = gmtime(&t->cur_time);
|
||||||
printf("Current GMT = %d/%d/%2d %d:%02d:%02d\n",
|
printf(" Current GMT = %d/%d/%2d %d:%02d:%02d\n",
|
||||||
t->gmt->tm_mon+1, t->gmt->tm_mday, t->gmt->tm_year,
|
t->gmt->tm_mon+1, t->gmt->tm_mday, t->gmt->tm_year,
|
||||||
t->gmt->tm_hour, t->gmt->tm_min, t->gmt->tm_sec);
|
t->gmt->tm_hour, t->gmt->tm_min, t->gmt->tm_sec);
|
||||||
|
|
||||||
|
@ -253,15 +258,15 @@ void fgTimeUpdate(struct fgFLIGHT *f, struct fgTIME *t) {
|
||||||
|
|
||||||
/* convert "back" to Julian date + partial day (as a fraction of one) */
|
/* convert "back" to Julian date + partial day (as a fraction of one) */
|
||||||
t->jd = t->mjd + MJD0;
|
t->jd = t->mjd + MJD0;
|
||||||
printf("Current Julian Date = %.5f\n", t->jd);
|
printf(" Current Julian Date = %.5f\n", t->jd);
|
||||||
|
|
||||||
printf("Current Longitude = %.3f\n", FG_Longitude * RAD_TO_DEG);
|
/* printf(" Current Longitude = %.3f\n", FG_Longitude * RAD_TO_DEG); */
|
||||||
|
|
||||||
/* Calculate local side real time */
|
/* Calculate local side real time */
|
||||||
if ( t->gst_diff < -100.0 ) {
|
if ( t->gst_diff < -100.0 ) {
|
||||||
/* first time through do the expensive calculation & cheap
|
/* first time through do the expensive calculation & cheap
|
||||||
calculation to get the difference. */
|
calculation to get the difference. */
|
||||||
printf("First time, doing precise gst\n");
|
printf(" First time, doing precise gst\n");
|
||||||
t->gst = gst_precise = sidereal_precise(t->mjd, 0.00);
|
t->gst = gst_precise = sidereal_precise(t->mjd, 0.00);
|
||||||
gst_course = sidereal_course(t->gmt, t->cur_time, 0.00);
|
gst_course = sidereal_course(t->gmt, t->cur_time, 0.00);
|
||||||
t->gst_diff = gst_precise - gst_course;
|
t->gst_diff = gst_precise - gst_course;
|
||||||
|
@ -277,17 +282,20 @@ void fgTimeUpdate(struct fgFLIGHT *f, struct fgTIME *t) {
|
||||||
sidereal_course(t->gmt, t->cur_time, -(FG_Longitude * RAD_TO_DEG))
|
sidereal_course(t->gmt, t->cur_time, -(FG_Longitude * RAD_TO_DEG))
|
||||||
+ t->gst_diff;
|
+ t->gst_diff;
|
||||||
}
|
}
|
||||||
/* printf("Current lon=0.00 Sidereal Time = %.3f\n", t->gst); */
|
/* printf(" Current lon=0.00 Sidereal Time = %.3f\n", t->gst); */
|
||||||
/* printf("Current LOCAL Sidereal Time = %.3f (%.3f) (diff = %.3f)\n",
|
/* printf(" Current LOCAL Sidereal Time = %.3f (%.3f) (diff = %.3f)\n",
|
||||||
t->lst, sidereal_precise(t->mjd, -(FG_Longitude * RAD_TO_DEG)),
|
t->lst, sidereal_precise(t->mjd, -(FG_Longitude * RAD_TO_DEG)),
|
||||||
t->gst_diff); */
|
t->gst_diff); */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.22 1997/12/30 01:38:47 curt
|
/* Revision 1.23 1997/12/30 20:47:58 curt
|
||||||
/* Switched back to per vertex normals and smooth shading for terrain.
|
/* Integrated new event manager with subsystem initializations.
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.22 1997/12/30 01:38:47 curt
|
||||||
|
* Switched back to per vertex normals and smooth shading for terrain.
|
||||||
|
*
|
||||||
* Revision 1.21 1997/12/23 04:58:39 curt
|
* Revision 1.21 1997/12/23 04:58:39 curt
|
||||||
* Tweaked the sky coloring a bit to build in structures to allow finer rgb
|
* Tweaked the sky coloring a bit to build in structures to allow finer rgb
|
||||||
* control.
|
* control.
|
||||||
|
|
|
@ -51,6 +51,7 @@
|
||||||
#include "../Math/mat3.h"
|
#include "../Math/mat3.h"
|
||||||
#include "../Math/polar.h"
|
#include "../Math/polar.h"
|
||||||
|
|
||||||
|
|
||||||
#undef E
|
#undef E
|
||||||
|
|
||||||
|
|
||||||
|
@ -260,7 +261,7 @@ void fgSunPosition(time_t ssue, double *lon, double *lat) {
|
||||||
|
|
||||||
|
|
||||||
/* update the cur_time_params structure with the current sun position */
|
/* update the cur_time_params structure with the current sun position */
|
||||||
void fgUpdateSunPos(struct fgCartesianPoint scenery_center) {
|
void fgUpdateSunPos() {
|
||||||
struct fgLIGHT *l;
|
struct fgLIGHT *l;
|
||||||
struct fgTIME *t;
|
struct fgTIME *t;
|
||||||
struct fgVIEW *v;
|
struct fgVIEW *v;
|
||||||
|
@ -272,6 +273,8 @@ void fgUpdateSunPos(struct fgCartesianPoint scenery_center) {
|
||||||
t = &cur_time_params;
|
t = &cur_time_params;
|
||||||
v = ¤t_view;
|
v = ¤t_view;
|
||||||
|
|
||||||
|
printf(" Updating Sun position\n");
|
||||||
|
|
||||||
time_warp += 0; /* increase this to make the world spin real fast */
|
time_warp += 0; /* increase this to make the world spin real fast */
|
||||||
|
|
||||||
fgSunPosition(t->cur_time + time_warp, &l->sun_lon, &sun_gd_lat);
|
fgSunPosition(t->cur_time + time_warp, &l->sun_lon, &sun_gd_lat);
|
||||||
|
@ -280,7 +283,7 @@ void fgUpdateSunPos(struct fgCartesianPoint scenery_center) {
|
||||||
|
|
||||||
l->fg_sunpos = fgPolarToCart(l->sun_lon, l->sun_gc_lat, sl_radius);
|
l->fg_sunpos = fgPolarToCart(l->sun_lon, l->sun_gc_lat, sl_radius);
|
||||||
|
|
||||||
/* printf("Geodetic lat = %.5f Geocentric lat = %.5f\n", sun_gd_lat,
|
/* printf(" Geodetic lat = %.5f Geocentric lat = %.5f\n", sun_gd_lat,
|
||||||
t->sun_gc_lat); */
|
t->sun_gc_lat); */
|
||||||
|
|
||||||
/* FALSE! (?> the sun position has to be translated just like
|
/* FALSE! (?> the sun position has to be translated just like
|
||||||
|
@ -310,16 +313,19 @@ void fgUpdateSunPos(struct fgCartesianPoint scenery_center) {
|
||||||
MAT3_NORMALIZE_VEC(nsun, temp);
|
MAT3_NORMALIZE_VEC(nsun, temp);
|
||||||
|
|
||||||
l->sun_angle = acos(MAT3_DOT_PRODUCT(nup, nsun));
|
l->sun_angle = acos(MAT3_DOT_PRODUCT(nup, nsun));
|
||||||
printf("SUN ANGLE relative to current location = %.3f rads.\n",
|
printf(" SUN ANGLE relative to current location = %.3f rads.\n",
|
||||||
l->sun_angle);
|
l->sun_angle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.18 1997/12/23 04:58:40 curt
|
/* Revision 1.19 1997/12/30 20:47:59 curt
|
||||||
/* Tweaked the sky coloring a bit to build in structures to allow finer rgb
|
/* Integrated new event manager with subsystem initializations.
|
||||||
/* control.
|
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.18 1997/12/23 04:58:40 curt
|
||||||
|
* Tweaked the sky coloring a bit to build in structures to allow finer rgb
|
||||||
|
* control.
|
||||||
|
*
|
||||||
* Revision 1.17 1997/12/15 23:55:08 curt
|
* Revision 1.17 1997/12/15 23:55:08 curt
|
||||||
* Add xgl wrappers for debugging.
|
* Add xgl wrappers for debugging.
|
||||||
* Generate terrain normals on the fly.
|
* Generate terrain normals on the fly.
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
#include "../Include/types.h"
|
#include "../Include/types.h"
|
||||||
|
|
||||||
/* update the cur_time_params structure with the current sun position */
|
/* update the cur_time_params structure with the current sun position */
|
||||||
void fgUpdateSunPos(struct fgCartesianPoint scenery_center);
|
void fgUpdateSunPos();
|
||||||
|
|
||||||
void fgSunPosition(time_t ssue, double *lon, double *lat);
|
void fgSunPosition(time_t ssue, double *lon, double *lat);
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,8 @@ void fgWeatherInit(void) {
|
||||||
|
|
||||||
w = ¤t_weather;
|
w = ¤t_weather;
|
||||||
|
|
||||||
|
printf("Initializing weather subsystem\n");
|
||||||
|
|
||||||
/* Configure some wind */
|
/* Configure some wind */
|
||||||
/* FG_V_north_airmass = 15; */ /* ft/s =~ 10mph */
|
/* FG_V_north_airmass = 15; */ /* ft/s =~ 10mph */
|
||||||
|
|
||||||
|
@ -62,10 +64,13 @@ void fgWeatherUpdate(double lon, double lat, double alt) {
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.8 1997/12/11 04:43:58 curt
|
/* Revision 1.9 1997/12/30 20:48:03 curt
|
||||||
/* Fixed sun vector and lighting problems. I thing the moon is now lit
|
/* Integrated new event manager with subsystem initializations.
|
||||||
/* correctly.
|
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.8 1997/12/11 04:43:58 curt
|
||||||
|
* Fixed sun vector and lighting problems. I thing the moon is now lit
|
||||||
|
* correctly.
|
||||||
|
*
|
||||||
* Revision 1.7 1997/12/10 22:37:56 curt
|
* Revision 1.7 1997/12/10 22:37:56 curt
|
||||||
* Prepended "fg" on the name of all global structures that didn't have it yet.
|
* Prepended "fg" on the name of all global structures that didn't have it yet.
|
||||||
* i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
|
* i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
|
||||||
|
|
Loading…
Reference in a new issue