Added a local routine to update lighting params every frame when time is
accelerated.
This commit is contained in:
parent
c2a987d354
commit
fcdc2cf4c9
2 changed files with 48 additions and 7 deletions
|
@ -38,12 +38,16 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <Aircraft/aircraft.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 <Autopilot/autopilot.h> // Added autopilot.h to list, Jeff Goeke-Smith
|
||||||
#include <Cockpit/hud.hxx>
|
#include <Cockpit/hud.hxx>
|
||||||
#include <Debug/fg_debug.h>
|
#include <Debug/fg_debug.h>
|
||||||
#include <GUI/gui.h>
|
#include <GUI/gui.h>
|
||||||
#include <Include/fg_constants.h>
|
#include <Include/fg_constants.h>
|
||||||
#include <PUI/pu.h>
|
#include <PUI/pu.h>
|
||||||
|
#include <Time/light.hxx>
|
||||||
#include <Weather/weather.h>
|
#include <Weather/weather.h>
|
||||||
|
|
||||||
#include "GLUTkey.hxx"
|
#include "GLUTkey.hxx"
|
||||||
|
@ -55,6 +59,15 @@
|
||||||
static int fullscreen = 1;
|
static int fullscreen = 1;
|
||||||
#endif
|
#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 */
|
/* Handle keyboard events */
|
||||||
void GLUTkey(unsigned char k, int x, int y) {
|
void GLUTkey(unsigned char k, int x, int y) {
|
||||||
fgCONTROLS *c;
|
fgCONTROLS *c;
|
||||||
|
@ -108,9 +121,11 @@ void GLUTkey(unsigned char k, int x, int y) {
|
||||||
return;
|
return;
|
||||||
case 77: /* M key */
|
case 77: /* M key */
|
||||||
t->warp -= 60;
|
t->warp -= 60;
|
||||||
|
local_update_sky_and_lighting_params();
|
||||||
return;
|
return;
|
||||||
case 84: /* T key */
|
case 84: /* T key */
|
||||||
t->warp_delta -= 30;
|
t->warp_delta -= 30;
|
||||||
|
local_update_sky_and_lighting_params();
|
||||||
return;
|
return;
|
||||||
case 87: /* W key */
|
case 87: /* W key */
|
||||||
#if defined(FX) && !defined(WIN32)
|
#if defined(FX) && !defined(WIN32)
|
||||||
|
@ -188,6 +203,7 @@ void GLUTkey(unsigned char k, int x, int y) {
|
||||||
return;
|
return;
|
||||||
case 109: /* m key */
|
case 109: /* m key */
|
||||||
t->warp += 60;
|
t->warp += 60;
|
||||||
|
local_update_sky_and_lighting_params();
|
||||||
return;
|
return;
|
||||||
case 112: /* p key */
|
case 112: /* p key */
|
||||||
t->pause = !t->pause;
|
t->pause = !t->pause;
|
||||||
|
@ -205,6 +221,7 @@ void GLUTkey(unsigned char k, int x, int y) {
|
||||||
return;
|
return;
|
||||||
case 116: /* t key */
|
case 116: /* t key */
|
||||||
t->warp_delta += 30;
|
t->warp_delta += 30;
|
||||||
|
local_update_sky_and_lighting_params();
|
||||||
return;
|
return;
|
||||||
case 120: /* X key */
|
case 120: /* X key */
|
||||||
fov = current_options.get_fov();
|
fov = current_options.get_fov();
|
||||||
|
@ -321,13 +338,17 @@ void GLUTspecialkey(int k, int x, int y) {
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.18 1998/07/30 23:48:24 curt
|
/* Revision 1.19 1998/08/05 00:19:33 curt
|
||||||
/* Output position & orientation when pausing.
|
/* Added a local routine to update lighting params every frame when time is
|
||||||
/* Eliminated libtool use.
|
/* accelerated.
|
||||||
/* 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.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
|
* Revision 1.17 1998/07/27 18:41:23 curt
|
||||||
* Added a pause command "p"
|
* Added a pause command "p"
|
||||||
* Fixed some initialization order problems between pui and glut.
|
* Fixed some initialization order problems between pui and glut.
|
||||||
|
|
|
@ -42,10 +42,14 @@
|
||||||
# include <sys/time.h> // for get/setitimer, gettimeofday, struct timeval
|
# include <sys/time.h> // for get/setitimer, gettimeofday, struct timeval
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <Astro/orbits.hxx>
|
||||||
|
#include <Astro/sun.hxx>
|
||||||
|
#include <Astro/sky.hxx>
|
||||||
#include <Debug/fg_debug.h>
|
#include <Debug/fg_debug.h>
|
||||||
#include <Flight/flight.h>
|
#include <Flight/flight.h>
|
||||||
#include <Include/fg_constants.h>
|
#include <Include/fg_constants.h>
|
||||||
#include <Main/options.hxx>
|
#include <Main/options.hxx>
|
||||||
|
#include <Time/light.hxx>
|
||||||
|
|
||||||
#include "fg_time.hxx"
|
#include "fg_time.hxx"
|
||||||
|
|
||||||
|
@ -60,8 +64,15 @@
|
||||||
fgTIME cur_time_params;
|
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) {
|
void fgTimeInit(fgTIME *t) {
|
||||||
fgPrintf( FG_EVENT, FG_INFO, "Initializing Time\n");
|
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",
|
" Current Unix calendar time = %ld warp = %ld delta = %ld\n",
|
||||||
t->cur_time, t->warp, t->warp_delta);
|
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
|
// get GMT break down for current time
|
||||||
t->gmt = gmtime(&t->cur_time);
|
t->gmt = gmtime(&t->cur_time);
|
||||||
fgPrintf( FG_EVENT, FG_BULK,
|
fgPrintf( FG_EVENT, FG_BULK,
|
||||||
|
@ -411,6 +427,10 @@ void fgTimeUpdate(fgFLIGHT *f, fgTIME *t) {
|
||||||
|
|
||||||
|
|
||||||
// $Log$
|
// $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
|
// Revision 1.13 1998/07/30 23:48:55 curt
|
||||||
// Sgi build tweaks.
|
// Sgi build tweaks.
|
||||||
// Pause support.
|
// Pause support.
|
||||||
|
|
Loading…
Add table
Reference in a new issue