/* Handle keyboard events */
void GLUTkey(unsigned char k, int x, int y) {
struct fgCONTROLS *c;
+ struct fgTIME *t;
struct fgVIEW *v;
struct fgWEATHER *w;
c = ¤t_aircraft.controls;
+ t = &cur_time_params;
v = ¤t_view;
w = ¤t_weather;
case 72: /* H key */
show_hud = !show_hud;
return;
+ case 77: /* M key */
+ t->warp -= 60;
+ return;
+ case 84: /* T key */
+ t->warp_delta -= 30;
+ return;
case 87: /* W key */
displayInstruments = !displayInstruments;
return;
case 51: /* numeric keypad 3 (Pg Dn) */
fgThrottleMove(0, -0.01);
return;
+ case 109: /* m key */
+ t->warp += 60;
+ return;
+ case 116: /* t key */
+ t->warp_delta += 30;
+ return;
case 122: /* z key */
w->visibility *= 1.10;
xglFogf(GL_FOG_END, w->visibility);
/* $Log$
-/* Revision 1.24 1997/12/30 16:36:46 curt
-/* Merged in Durk's changes ...
+/* Revision 1.25 1998/01/05 18:44:34 curt
+/* Add an option to advance/decrease time from keyboard.
/*
+ * Revision 1.24 1997/12/30 16:36:46 curt
+ * Merged in Durk's changes ...
+ *
* Revision 1.23 1997/12/15 23:54:44 curt
* Add xgl wrappers for debugging.
* Generate terrain normals on the fly.
fgEventRegister( "fgSunInit()", fgSunInit, FG_EVENT_READY, 600000 );
/* Intialize the moon's position */
- fgEventRegister( "fgMoonInit()", fgSunInit, FG_EVENT_READY, 600000 );
+ fgEventRegister( "fgMoonInit()", fgMoonInit, FG_EVENT_READY, 600000 );
/* Initialize the "sky" */
fgSkyInit();
/* $Log$
-/* Revision 1.26 1997/12/30 23:09:04 curt
-/* Tweaking initialization sequences.
+/* Revision 1.27 1998/01/05 18:44:35 curt
+/* Add an option to advance/decrease time from keyboard.
/*
+ * Revision 1.26 1997/12/30 23:09:04 curt
+ * Tweaking initialization sequences.
+ *
* Revision 1.25 1997/12/30 22:22:33 curt
* Further integration of event manager.
*
moonPos.Declination);
#endif
+ xMoon = 60000.0 * cos(moonPos.RightAscension) * cos(moonPos.Declination);
+ yMoon = 60000.0 * sin(moonPos.RightAscension) * cos(moonPos.Declination);
+ zMoon = 60000.0 * sin(moonPos.Declination);
+
if ( !dl_exists ) {
dl_exists = 1;
xglMaterialfv(GL_FRONT, GL_DIFFUSE, moon_color); */
- xMoon = 60000.0 * cos(moonPos.RightAscension) *
- cos(moonPos.Declination);
- yMoon = 60000.0 * sin(moonPos.RightAscension) *
- cos(moonPos.Declination);
- zMoon = 60000.0 * sin(moonPos.Declination);
-
glutSolidSphere(1.0, 10, 10);
xglEndList();
struct fgLIGHT *l;
GLfloat white[4] = { 1.0, 1.0, 1.0, 1.0 };
+ /* printf("Rendering moon\n"); */
+
l = &cur_light_params;
xglMaterialfv(GL_FRONT, GL_AMBIENT, l->sky_color );
/* $Log$
-/* Revision 1.14 1997/12/30 20:47:50 curt
-/* Integrated new event manager with subsystem initializations.
+/* Revision 1.15 1998/01/05 18:44:35 curt
+/* Add an option to advance/decrease time from keyboard.
/*
+ * Revision 1.14 1997/12/30 20:47:50 curt
+ * Integrated new event manager with subsystem initializations.
+ *
* Revision 1.13 1997/12/30 16:41:00 curt
* Added log at end of file.
*
sunPos.Declination);
#endif
+ xSun = 60000.0 * cos(sunPos.RightAscension) * cos(sunPos.Declination);
+ ySun = 60000.0 * sin(sunPos.RightAscension) * cos(sunPos.Declination);
+ zSun = 60000.0 * sin(sunPos.Declination);
+
if ( !dl_exists ) {
dl_exists = 1;
sun_obj = xglGenLists(1);
xglNewList(sun_obj, GL_COMPILE );
- xSun = 60000.0 * cos(sunPos.RightAscension) * cos(sunPos.Declination);
- ySun = 60000.0 * sin(sunPos.RightAscension) * cos(sunPos.Declination);
- zSun = 60000.0 * sin(sunPos.Declination);
-
glutSolidSphere(1.0, 10, 10);
xglEndList();
/* $Log$
-/* Revision 1.11 1997/12/30 23:09:40 curt
-/* Worked on winding problem without luck, so back to calling glFrontFace()
-/* 3 times for each scenery area.
+/* Revision 1.12 1998/01/05 18:44:36 curt
+/* Add an option to advance/decrease time from keyboard.
/*
+ * Revision 1.11 1997/12/30 23:09:40 curt
+ * Worked on winding problem without luck, so back to calling glFrontFace()
+ * 3 times for each scenery area.
+ *
* Revision 1.10 1997/12/30 20:47:54 curt
* Integrated new event manager with subsystem initializations.
*
# -
#---------------------------------------------------------------------------
-GLOBAL_CFLAGS = -g -Wall -DVERSION=\"$(FG_VERSION)\"
+GLOBAL_CFLAGS = -Wall -DVERSION=\"$(FG_VERSION)\"
#---------------------------------------------------------------------------
#---------------------------------------------------------------------------
# $Log$
+# Revision 1.29 1998/01/05 18:44:33 curt
+# Add an option to advance/decrease time from keyboard.
+#
# Revision 1.28 1997/12/30 23:08:50 curt
# Version 0.21
#
printf("Initializing Time\n");
t->gst_diff = -9999.0;
+ t->warp = 0;
+ t->warp_delta = 0;
}
void fgTimeUpdate(struct fgFLIGHT *f, struct fgTIME *t) {
double gst_precise, gst_course;
- static long int warp = 0;
printf("Updating time\n");
/* get current Unix calendar time (in seconds) */
/* warp = 60; */
- warp += 0;
- t->cur_time = time(NULL) + (0) * 60 * 60;
- t->cur_time += warp;
- printf(" Current Unix calendar time = %ld warp = %ld\n",
- t->cur_time, warp);
+ t->warp += t->warp_delta;
+ t->cur_time = time(NULL) + t->warp;
+ printf(" Current Unix calendar time = %ld warp = %ld delta = %ld\n",
+ t->cur_time, t->warp, t->warp_delta);
/* get GMT break down for current time */
t->gmt = gmtime(&t->cur_time);
/* $Log$
-/* Revision 1.25 1997/12/31 17:46:50 curt
-/* Tweaked fg_time.c to be able to use ftime() instead of gettimeofday()
+/* Revision 1.26 1998/01/05 18:44:36 curt
+/* Add an option to advance/decrease time from keyboard.
/*
+ * Revision 1.25 1997/12/31 17:46:50 curt
+ * Tweaked fg_time.c to be able to use ftime() instead of gettimeofday()
+ *
* Revision 1.24 1997/12/30 22:22:42 curt
* Further integration of event manager.
*
sidereal time algorithm result and the
course result. course + diff has good
accuracy for the short term */
+
+ long int warp; /* An offset in seconds from the true time.
+ Allows us to adjust the effective time of day. */
+
+ long int warp_delta; /* How much to change the value of warp each
+ iteration. Allows us to make time
+ progress faster than normal. */
};
extern struct fgTIME cur_time_params;
/* $Log$
-/* Revision 1.11 1997/12/19 23:35:07 curt
-/* Lot's of tweaking with sky rendering and lighting.
+/* Revision 1.12 1998/01/05 18:44:37 curt
+/* Add an option to advance/decrease time from keyboard.
/*
+ * Revision 1.11 1997/12/19 23:35:07 curt
+ * Lot's of tweaking with sky rendering and lighting.
+ *
* Revision 1.10 1997/12/15 23:55:07 curt
* Add xgl wrappers for debugging.
* Generate terrain normals on the fly.