1
0
Fork 0

Added a local routine to update lighting params every frame when time is

accelerated.
This commit is contained in:
curt 1998-08-05 00:19:33 +00:00
parent c2a987d354
commit fcdc2cf4c9
2 changed files with 48 additions and 7 deletions

View file

@ -38,12 +38,16 @@
#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"
@ -55,6 +59,15 @@
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.

View file

@ -42,10 +42,14 @@
# 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"
@ -60,8 +64,15 @@
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.