]> git.mxchange.org Git - flightgear.git/commitdiff
Added a local routine to update lighting params every frame when time is
authorcurt <curt>
Wed, 5 Aug 1998 00:19:33 +0000 (00:19 +0000)
committercurt <curt>
Wed, 5 Aug 1998 00:19:33 +0000 (00:19 +0000)
accelerated.

Main/GLUTkey.cxx
Time/fg_time.cxx

index 786ae3b2645f05fa569913255aa1374d9f3e1022..3b8aca0bbface7eb92c6cdfa325cddf4dd4f57df 100644 (file)
 #include <stdlib.h>
 
 #include <Aircraft/aircraft.h>
+#include <Astro/orbits.hxx>
+#include <Astro/sun.hxx>
+#include <Astro/sky.hxx>
 #include <Autopilot/autopilot.h> // Added autopilot.h to list, Jeff Goeke-Smith
 #include <Cockpit/hud.hxx>
 #include <Debug/fg_debug.h>
 #include <GUI/gui.h>
 #include <Include/fg_constants.h>
 #include <PUI/pu.h>
+#include <Time/light.hxx>
 #include <Weather/weather.h>
 
 #include "GLUTkey.hxx"
    static int fullscreen = 1;
 #endif
 
+
+// Force an update of the sky and lighting parameters
+static void local_update_sky_and_lighting_params( void ) {
+    fgSunInit();
+    fgLightUpdate();
+    fgSkyColorsInit();
+}
+
+
 /* Handle keyboard events */
 void GLUTkey(unsigned char k, int x, int y) {
     fgCONTROLS *c;
@@ -108,9 +121,11 @@ void GLUTkey(unsigned char k, int x, int y) {
            return;
        case 77: /* M key */
            t->warp -= 60;
+           local_update_sky_and_lighting_params();
            return;
        case 84: /* T key */
            t->warp_delta -= 30;
+           local_update_sky_and_lighting_params();
            return;
        case 87: /* W key */
 #if defined(FX) && !defined(WIN32)
@@ -188,6 +203,7 @@ void GLUTkey(unsigned char k, int x, int y) {
            return;
        case 109: /* m key */
            t->warp += 60;
+           local_update_sky_and_lighting_params();
            return;
        case 112: /* p key */
            t->pause = !t->pause;
@@ -205,6 +221,7 @@ void GLUTkey(unsigned char k, int x, int y) {
            return;
        case 116: /* t key */
            t->warp_delta += 30;
+           local_update_sky_and_lighting_params();
            return;
        case 120: /* X key */
            fov = current_options.get_fov();
@@ -321,13 +338,17 @@ void GLUTspecialkey(int k, int x, int y) {
 
 
 /* $Log$
-/* Revision 1.18  1998/07/30 23:48:24  curt
-/* Output position & orientation when pausing.
-/* Eliminated libtool use.
-/* Added options to specify initial position and orientation.
-/* Changed default fov to 55 degrees.
-/* Added command line option to start in paused or unpaused state.
+/* Revision 1.19  1998/08/05 00:19:33  curt
+/* Added a local routine to update lighting params every frame when time is
+/* accelerated.
 /*
+ * Revision 1.18  1998/07/30 23:48:24  curt
+ * Output position & orientation when pausing.
+ * Eliminated libtool use.
+ * Added options to specify initial position and orientation.
+ * Changed default fov to 55 degrees.
+ * Added command line option to start in paused or unpaused state.
+ *
  * Revision 1.17  1998/07/27 18:41:23  curt
  * Added a pause command "p"
  * Fixed some initialization order problems between pui and glut.
index 5d8bf5f36761e1e5d25a4309d4d6d6834d4d7aa7..d4dd3262994902eb442bdc8673dd258a6b7a24d0 100644 (file)
 #  include <sys/time.h>  // for get/setitimer, gettimeofday, struct timeval
 #endif
 
+#include <Astro/orbits.hxx>
+#include <Astro/sun.hxx>
+#include <Astro/sky.hxx>
 #include <Debug/fg_debug.h>
 #include <Flight/flight.h>
 #include <Include/fg_constants.h>
 #include <Main/options.hxx>
+#include <Time/light.hxx>
 
 #include "fg_time.hxx"
 
 fgTIME cur_time_params;
 
 
-// Initialize the time dependent variables
+// Force an update of the sky and lighting parameters
+static void local_update_sky_and_lighting_params( void ) {
+    fgSunInit();
+    fgLightUpdate();
+    fgSkyColorsInit();
+}
 
+
+// Initialize the time dependent variables
 void fgTimeInit(fgTIME *t) {
     fgPrintf( FG_EVENT, FG_INFO, "Initializing Time\n");
 
@@ -360,6 +371,11 @@ void fgTimeUpdate(fgFLIGHT *f, fgTIME *t) {
              "  Current Unix calendar time = %ld  warp = %ld  delta = %ld\n", 
              t->cur_time, t->warp, t->warp_delta);
 
+    if ( t->warp_delta ) {
+       // time is changing so force an update
+       local_update_sky_and_lighting_params();
+    }
+
     // get GMT break down for current time
     t->gmt = gmtime(&t->cur_time);
     fgPrintf( FG_EVENT, FG_BULK, 
@@ -411,6 +427,10 @@ void fgTimeUpdate(fgFLIGHT *f, fgTIME *t) {
 
 
 // $Log$
+// Revision 1.14  1998/08/05 00:20:07  curt
+// Added a local routine to update lighting params every frame when time is
+// accelerated.
+//
 // Revision 1.13  1998/07/30 23:48:55  curt
 // Sgi build tweaks.
 // Pause support.