Wrote access functions for current fgOPTIONS.
This commit is contained in:
parent
8767a84ffc
commit
4abe562805
19 changed files with 255 additions and 201 deletions
|
@ -111,16 +111,13 @@ int fgReadOrbElements(struct OrbElements *dest, gzFile src) {
|
||||||
|
|
||||||
int fgSolarSystemInit(fgTIME t)
|
int fgSolarSystemInit(fgTIME t)
|
||||||
{
|
{
|
||||||
fgOPTIONS *o;
|
|
||||||
char path[256], gzpath[256];
|
char path[256], gzpath[256];
|
||||||
int i, ret_val;
|
int i, ret_val;
|
||||||
|
|
||||||
fgPrintf( FG_ASTRO, FG_INFO, "Initializing solar system\n");
|
fgPrintf( FG_ASTRO, FG_INFO, "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 */
|
||||||
o = ¤t_options;
|
current_options.get_fg_root(path);
|
||||||
path[0] = '\0';
|
|
||||||
strcat(path, o->fg_root);
|
|
||||||
strcat(path, "/Scenery/");
|
strcat(path, "/Scenery/");
|
||||||
strcat(path, "Planets");
|
strcat(path, "Planets");
|
||||||
|
|
||||||
|
@ -170,9 +167,12 @@ void fgSolarSystemUpdate(struct OrbElements *planet, fgTIME t)
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.6 1998/05/29 20:35:41 curt
|
/* Revision 1.7 1998/07/13 21:00:09 curt
|
||||||
/* Added zlib support for reading in compressed data files.
|
/* Wrote access functions for current fgOPTIONS.
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.6 1998/05/29 20:35:41 curt
|
||||||
|
* Added zlib support for reading in compressed data files.
|
||||||
|
*
|
||||||
* Revision 1.5 1998/05/13 18:25:34 curt
|
* Revision 1.5 1998/05/13 18:25:34 curt
|
||||||
* Root path info moved to fgOPTIONS.
|
* Root path info moved to fgOPTIONS.
|
||||||
*
|
*
|
||||||
|
|
|
@ -64,7 +64,6 @@
|
||||||
/* Initialize the Star Management Subsystem */
|
/* Initialize the Star Management Subsystem */
|
||||||
int fgStarsInit( void ) {
|
int fgStarsInit( void ) {
|
||||||
fgFile fd;
|
fgFile fd;
|
||||||
fgOPTIONS *o;
|
|
||||||
/* struct CelestialCoord pltPos; */
|
/* struct CelestialCoord pltPos; */
|
||||||
char path[256], gzpath[256];
|
char path[256], gzpath[256];
|
||||||
char line[256], name[256];
|
char line[256], name[256];
|
||||||
|
@ -76,11 +75,8 @@ int fgStarsInit( void ) {
|
||||||
|
|
||||||
fgPrintf( FG_ASTRO, FG_INFO, "Initializing stars\n");
|
fgPrintf( FG_ASTRO, FG_INFO, "Initializing stars\n");
|
||||||
|
|
||||||
o = ¤t_options;
|
|
||||||
|
|
||||||
/* build the full path name to the stars data base file */
|
/* build the full path name to the stars data base file */
|
||||||
path[0] = '\0';
|
current_options.get_fg_root(path);
|
||||||
strcat(path, o->fg_root);
|
|
||||||
strcat(path, "/Scenery/");
|
strcat(path, "/Scenery/");
|
||||||
strcat(path, "Stars");
|
strcat(path, "Stars");
|
||||||
|
|
||||||
|
@ -265,9 +261,12 @@ void fgStarsRender( void ) {
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.7 1998/05/29 20:35:42 curt
|
/* Revision 1.8 1998/07/13 21:00:10 curt
|
||||||
/* Added zlib support for reading in compressed data files.
|
/* Wrote access functions for current fgOPTIONS.
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.7 1998/05/29 20:35:42 curt
|
||||||
|
* Added zlib support for reading in compressed data files.
|
||||||
|
*
|
||||||
* Revision 1.6 1998/05/13 18:25:35 curt
|
* Revision 1.6 1998/05/13 18:25:35 curt
|
||||||
* Root path info moved to fgOPTIONS.
|
* Root path info moved to fgOPTIONS.
|
||||||
*
|
*
|
||||||
|
|
|
@ -133,16 +133,14 @@ puCallback helpSubmenuCb [] = { notCb, notCb, NULL };
|
||||||
void guiInit()
|
void guiInit()
|
||||||
{
|
{
|
||||||
fgGENERAL *g;
|
fgGENERAL *g;
|
||||||
fgOPTIONS *o;
|
|
||||||
char *mesa_win_state;
|
char *mesa_win_state;
|
||||||
|
|
||||||
g = &general;
|
g = &general;
|
||||||
o = ¤t_options;
|
|
||||||
|
|
||||||
// Initialize PUI
|
// Initialize PUI
|
||||||
puInit();
|
puInit();
|
||||||
|
|
||||||
if ( o->mouse_pointer == 0 ) {
|
if ( current_options.get_mouse_pointer() == 0 ) {
|
||||||
// no preference specified for mouse pointer, attempt to autodetect...
|
// no preference specified for mouse pointer, attempt to autodetect...
|
||||||
// Determine if we need to render the cursor, or if the windowing
|
// Determine if we need to render the cursor, or if the windowing
|
||||||
// system will do it. First test if we are rendering with glide.
|
// system will do it. First test if we are rendering with glide.
|
||||||
|
@ -156,9 +154,9 @@ void guiInit()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if ( o->mouse_pointer == 1 ) {
|
} else if ( current_options.get_mouse_pointer() == 1 ) {
|
||||||
// don't show pointer
|
// don't show pointer
|
||||||
} else if ( o->mouse_pointer == 2 ) {
|
} else if ( current_options.get_mouse_pointer() == 2 ) {
|
||||||
// force showing pointer
|
// force showing pointer
|
||||||
puShowCursor();
|
puShowCursor();
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,14 +57,13 @@
|
||||||
/* 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;
|
||||||
fgOPTIONS *o;
|
|
||||||
fgTIME *t;
|
fgTIME *t;
|
||||||
fgVIEW *v;
|
fgVIEW *v;
|
||||||
struct fgWEATHER *w;
|
struct fgWEATHER *w;
|
||||||
float tmp;
|
float fov, tmp;
|
||||||
|
int status;
|
||||||
|
|
||||||
c = current_aircraft.controls;
|
c = current_aircraft.controls;
|
||||||
o = ¤t_options;
|
|
||||||
t = &cur_time_params;
|
t = &cur_time_params;
|
||||||
v = ¤t_view;
|
v = ¤t_view;
|
||||||
w = ¤t_weather;
|
w = ¤t_weather;
|
||||||
|
@ -100,7 +99,8 @@ void GLUTkey(unsigned char k, int x, int y) {
|
||||||
v->goal_view_offset = FG_PI * 1.75;
|
v->goal_view_offset = FG_PI * 1.75;
|
||||||
return;
|
return;
|
||||||
case 72: /* H key */
|
case 72: /* H key */
|
||||||
o->hud_status = !(o->hud_status);
|
status = current_options.get_hud_status();
|
||||||
|
current_options.set_hud_status(!status);
|
||||||
return;
|
return;
|
||||||
case 77: /* M key */
|
case 77: /* M key */
|
||||||
t->warp -= 60;
|
t->warp -= 60;
|
||||||
|
@ -115,10 +115,12 @@ void GLUTkey(unsigned char k, int x, int y) {
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
case 88: /* X key */
|
case 88: /* X key */
|
||||||
o->fov *= 1.05;
|
fov = current_options.get_fov();
|
||||||
if ( o->fov > FG_FOV_MAX ) {
|
fov *= 1.05;
|
||||||
o->fov = FG_FOV_MAX;
|
if ( fov > FG_FOV_MAX ) {
|
||||||
|
fov = FG_FOV_MAX;
|
||||||
}
|
}
|
||||||
|
current_options.set_fov(fov);
|
||||||
v->update_fov = TRUE;
|
v->update_fov = TRUE;
|
||||||
return;
|
return;
|
||||||
case 90: /* Z key */
|
case 90: /* Z key */
|
||||||
|
@ -182,10 +184,12 @@ void GLUTkey(unsigned char k, int x, int y) {
|
||||||
t->warp_delta += 30;
|
t->warp_delta += 30;
|
||||||
return;
|
return;
|
||||||
case 120: /* X key */
|
case 120: /* X key */
|
||||||
o->fov /= 1.05;
|
fov = current_options.get_fov();
|
||||||
if ( o->fov < FG_FOV_MIN ) {
|
fov /= 1.05;
|
||||||
o->fov = FG_FOV_MIN;
|
if ( fov < FG_FOV_MIN ) {
|
||||||
|
fov = FG_FOV_MIN;
|
||||||
}
|
}
|
||||||
|
current_options.set_fov(fov);
|
||||||
v->update_fov = TRUE;
|
v->update_fov = TRUE;
|
||||||
return;
|
return;
|
||||||
case 122: /* z key */
|
case 122: /* z key */
|
||||||
|
@ -294,18 +298,21 @@ void GLUTspecialkey(int k, int x, int y) {
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.14 1998/07/06 02:42:02 curt
|
/* Revision 1.15 1998/07/13 21:01:34 curt
|
||||||
/* Added support for switching between fullscreen and window mode for
|
/* Wrote access functions for current fgOPTIONS.
|
||||||
/* Mesa/3dfx/glide.
|
|
||||||
/*
|
|
||||||
/* Added a basic splash screen. Restructured the main loop and top level
|
|
||||||
/* initialization routines to do this.
|
|
||||||
/*
|
|
||||||
/* Hacked in some support for playing a startup mp3 sound file while rest
|
|
||||||
/* of sim initializes. Currently only works in Unix using the mpg123 player.
|
|
||||||
/* Waits for the mpg123 player to finish before initializing internal
|
|
||||||
/* sound drivers.
|
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.14 1998/07/06 02:42:02 curt
|
||||||
|
* Added support for switching between fullscreen and window mode for
|
||||||
|
* Mesa/3dfx/glide.
|
||||||
|
*
|
||||||
|
* Added a basic splash screen. Restructured the main loop and top level
|
||||||
|
* initialization routines to do this.
|
||||||
|
*
|
||||||
|
* Hacked in some support for playing a startup mp3 sound file while rest
|
||||||
|
* of sim initializes. Currently only works in Unix using the mpg123 player.
|
||||||
|
* Waits for the mpg123 player to finish before initializing internal
|
||||||
|
* sound drivers.
|
||||||
|
*
|
||||||
* Revision 1.13 1998/06/27 16:54:32 curt
|
* Revision 1.13 1998/06/27 16:54:32 curt
|
||||||
* Replaced "extern displayInstruments" with a entry in fgOPTIONS.
|
* Replaced "extern displayInstruments" with a entry in fgOPTIONS.
|
||||||
* Don't change the view port when displaying the panel.
|
* Don't change the view port when displaying the panel.
|
||||||
|
|
|
@ -130,15 +130,13 @@ slSample *s2;
|
||||||
// fgInitVisuals() -- Initialize various GL/view parameters
|
// fgInitVisuals() -- Initialize various GL/view parameters
|
||||||
static void fgInitVisuals( void ) {
|
static void fgInitVisuals( void ) {
|
||||||
fgLIGHT *l;
|
fgLIGHT *l;
|
||||||
fgOPTIONS *o;
|
|
||||||
struct fgWEATHER *w;
|
struct fgWEATHER *w;
|
||||||
|
|
||||||
l = &cur_light_params;
|
l = &cur_light_params;
|
||||||
o = ¤t_options;
|
|
||||||
w = ¤t_weather;
|
w = ¤t_weather;
|
||||||
|
|
||||||
// Go full screen if requested ...
|
// Go full screen if requested ...
|
||||||
if ( o->fullscreen ) {
|
if ( current_options.get_fullscreen() ) {
|
||||||
glutFullScreen();
|
glutFullScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,13 +152,14 @@ static void fgInitVisuals( void ) {
|
||||||
xglFogi (GL_FOG_MODE, GL_EXP2);
|
xglFogi (GL_FOG_MODE, GL_EXP2);
|
||||||
// Fog density is now set when the weather system is initialized
|
// Fog density is now set when the weather system is initialized
|
||||||
// xglFogf (GL_FOG_DENSITY, w->fog_density);
|
// xglFogf (GL_FOG_DENSITY, w->fog_density);
|
||||||
if ( (o->fog == 1) || (o->shading == 0) ) {
|
if ( (current_options.get_fog() == 1) ||
|
||||||
|
(current_options.get_shading() == 0) ) {
|
||||||
// if fastest fog requested, or if flat shading force fastest
|
// if fastest fog requested, or if flat shading force fastest
|
||||||
xglHint (GL_FOG_HINT, GL_FASTEST );
|
xglHint (GL_FOG_HINT, GL_FASTEST );
|
||||||
} else if ( o->fog == 2 ) {
|
} else if ( current_options.get_fog() == 2 ) {
|
||||||
xglHint (GL_FOG_HINT, GL_NICEST );
|
xglHint (GL_FOG_HINT, GL_NICEST );
|
||||||
}
|
}
|
||||||
if ( o->wireframe ) {
|
if ( current_options.get_wireframe() ) {
|
||||||
// draw wire frame
|
// draw wire frame
|
||||||
xglPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
|
xglPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
|
||||||
}
|
}
|
||||||
|
@ -174,12 +173,10 @@ static void fgInitVisuals( void ) {
|
||||||
static void fgUpdateViewParams( void ) {
|
static void fgUpdateViewParams( void ) {
|
||||||
fgFLIGHT *f;
|
fgFLIGHT *f;
|
||||||
fgLIGHT *l;
|
fgLIGHT *l;
|
||||||
fgOPTIONS *o;
|
|
||||||
fgVIEW *v;
|
fgVIEW *v;
|
||||||
|
|
||||||
f = current_aircraft.flight;
|
f = current_aircraft.flight;
|
||||||
l = &cur_light_params;
|
l = &cur_light_params;
|
||||||
o = ¤t_options;
|
|
||||||
v = ¤t_view;
|
v = ¤t_view;
|
||||||
|
|
||||||
v->Update(f);
|
v->Update(f);
|
||||||
|
@ -198,9 +195,9 @@ static void fgUpdateViewParams( void ) {
|
||||||
xglMatrixMode(GL_PROJECTION);
|
xglMatrixMode(GL_PROJECTION);
|
||||||
xglLoadIdentity();
|
xglLoadIdentity();
|
||||||
if ( FG_Altitude * FEET_TO_METER - scenery.cur_elev > 10.0 ) {
|
if ( FG_Altitude * FEET_TO_METER - scenery.cur_elev > 10.0 ) {
|
||||||
gluPerspective(o->fov, v->win_ratio, 10.0, 100000.0);
|
gluPerspective(current_options.get_fov(), v->win_ratio, 10.0, 100000.0);
|
||||||
} else {
|
} else {
|
||||||
gluPerspective(o->fov, v->win_ratio, 1.0, 100000.0);
|
gluPerspective(current_options.get_fov(), v->win_ratio, 1.0, 100000.0);
|
||||||
// printf("Near ground, minimizing near clip plane\n");
|
// printf("Near ground, minimizing near clip plane\n");
|
||||||
}
|
}
|
||||||
// }
|
// }
|
||||||
|
@ -293,7 +290,6 @@ static void fgUpdateInstrViewParams( void ) {
|
||||||
static void fgRenderFrame( void ) {
|
static void fgRenderFrame( void ) {
|
||||||
fgFLIGHT *f;
|
fgFLIGHT *f;
|
||||||
fgLIGHT *l;
|
fgLIGHT *l;
|
||||||
fgOPTIONS *o;
|
|
||||||
fgTIME *t;
|
fgTIME *t;
|
||||||
fgVIEW *v;
|
fgVIEW *v;
|
||||||
double angle;
|
double angle;
|
||||||
|
@ -304,13 +300,12 @@ static void fgRenderFrame( void ) {
|
||||||
|
|
||||||
f = current_aircraft.flight;
|
f = current_aircraft.flight;
|
||||||
l = &cur_light_params;
|
l = &cur_light_params;
|
||||||
o = ¤t_options;
|
|
||||||
t = &cur_time_params;
|
t = &cur_time_params;
|
||||||
v = ¤t_view;
|
v = ¤t_view;
|
||||||
|
|
||||||
if ( idle_state != 1000 ) {
|
if ( idle_state != 1000 ) {
|
||||||
// still initializing, draw the splash screen
|
// still initializing, draw the splash screen
|
||||||
if ( o->splash_screen == 1 ) {
|
if ( current_options.get_splash_screen() == 1 ) {
|
||||||
fgSplashUpdate(0.0);
|
fgSplashUpdate(0.0);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -329,10 +324,10 @@ static void fgRenderFrame( void ) {
|
||||||
fgUpdateViewParams();
|
fgUpdateViewParams();
|
||||||
|
|
||||||
clear_mask = GL_DEPTH_BUFFER_BIT;
|
clear_mask = GL_DEPTH_BUFFER_BIT;
|
||||||
if ( o->wireframe ) {
|
if ( current_options.get_wireframe() ) {
|
||||||
clear_mask |= GL_COLOR_BUFFER_BIT;
|
clear_mask |= GL_COLOR_BUFFER_BIT;
|
||||||
}
|
}
|
||||||
if ( o->skyblend ) {
|
if ( current_options.get_skyblend() ) {
|
||||||
glClearColor(black[0], black[1], black[2], black[3]);
|
glClearColor(black[0], black[1], black[2], black[3]);
|
||||||
} else {
|
} else {
|
||||||
glClearColor(l->sky_color[0], l->sky_color[1],
|
glClearColor(l->sky_color[0], l->sky_color[1],
|
||||||
|
@ -351,7 +346,7 @@ static void fgRenderFrame( void ) {
|
||||||
xglDisable( GL_CULL_FACE );
|
xglDisable( GL_CULL_FACE );
|
||||||
xglDisable( GL_FOG );
|
xglDisable( GL_FOG );
|
||||||
xglShadeModel( GL_SMOOTH );
|
xglShadeModel( GL_SMOOTH );
|
||||||
if ( o->skyblend ) {
|
if ( current_options.get_skyblend() ) {
|
||||||
fgSkyRender();
|
fgSkyRender();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -388,13 +383,13 @@ static void fgRenderFrame( void ) {
|
||||||
xglPopMatrix();
|
xglPopMatrix();
|
||||||
|
|
||||||
// draw scenery
|
// draw scenery
|
||||||
if ( o->shading ) {
|
if ( current_options.get_shading() ) {
|
||||||
xglShadeModel( GL_SMOOTH );
|
xglShadeModel( GL_SMOOTH );
|
||||||
} else {
|
} else {
|
||||||
xglShadeModel( GL_FLAT );
|
xglShadeModel( GL_FLAT );
|
||||||
}
|
}
|
||||||
xglEnable( GL_DEPTH_TEST );
|
xglEnable( GL_DEPTH_TEST );
|
||||||
if ( o->fog > 0 ) {
|
if ( current_options.get_fog() > 0 ) {
|
||||||
xglEnable( GL_FOG );
|
xglEnable( GL_FOG );
|
||||||
xglFogfv (GL_FOG_COLOR, l->fog_color);
|
xglFogfv (GL_FOG_COLOR, l->fog_color);
|
||||||
}
|
}
|
||||||
|
@ -402,7 +397,7 @@ static void fgRenderFrame( void ) {
|
||||||
xglLightfv(GL_LIGHT0, GL_AMBIENT, l->scene_ambient );
|
xglLightfv(GL_LIGHT0, GL_AMBIENT, l->scene_ambient );
|
||||||
xglLightfv(GL_LIGHT0, GL_DIFFUSE, l->scene_diffuse );
|
xglLightfv(GL_LIGHT0, GL_DIFFUSE, l->scene_diffuse );
|
||||||
|
|
||||||
if ( o->textures ) {
|
if ( current_options.get_textures() ) {
|
||||||
// texture parameters
|
// texture parameters
|
||||||
xglEnable( GL_TEXTURE_2D );
|
xglEnable( GL_TEXTURE_2D );
|
||||||
xglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE ) ;
|
xglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE ) ;
|
||||||
|
@ -635,18 +630,16 @@ static void fgMainLoop( void ) {
|
||||||
|
|
||||||
static void fgIdleFunction ( void ) {
|
static void fgIdleFunction ( void ) {
|
||||||
fgGENERAL *g;
|
fgGENERAL *g;
|
||||||
fgOPTIONS *o;
|
|
||||||
char path[256], mp3file[256], command[256], slfile[256];
|
char path[256], mp3file[256], command[256], slfile[256];
|
||||||
static char *lockfile = "/tmp/mpg123.running";
|
static char *lockfile = "/tmp/mpg123.running";
|
||||||
|
|
||||||
g = &general;
|
g = &general;
|
||||||
o = ¤t_options;
|
|
||||||
|
|
||||||
// printf("idle state == %d\n", idle_state);
|
// printf("idle state == %d\n", idle_state);
|
||||||
|
|
||||||
if ( idle_state == 0 ) {
|
if ( idle_state == 0 ) {
|
||||||
// Initialize the splash screen right away
|
// Initialize the splash screen right away
|
||||||
if ( o->splash_screen ) {
|
if ( current_options.get_splash_screen() ) {
|
||||||
fgSplashInit();
|
fgSplashInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -654,8 +647,8 @@ static void fgIdleFunction ( void ) {
|
||||||
} else if ( idle_state == 1 ) {
|
} else if ( idle_state == 1 ) {
|
||||||
// Start the intro music
|
// Start the intro music
|
||||||
#if !defined(WIN32)
|
#if !defined(WIN32)
|
||||||
if ( o->intro_music ) {
|
if ( current_options.get_intro_music() ) {
|
||||||
strcpy(mp3file, o->fg_root);
|
current_options.get_fg_root(mp3file);
|
||||||
strcat(mp3file, "/Sounds/");
|
strcat(mp3file, "/Sounds/");
|
||||||
strcat(mp3file, "intro.mp3");
|
strcat(mp3file, "intro.mp3");
|
||||||
sprintf(command,
|
sprintf(command,
|
||||||
|
@ -714,7 +707,7 @@ static void fgIdleFunction ( void ) {
|
||||||
#ifdef HAVE_AUDIO_SUPPORT
|
#ifdef HAVE_AUDIO_SUPPORT
|
||||||
|
|
||||||
#if !defined(WIN32)
|
#if !defined(WIN32)
|
||||||
if ( o->intro_music ) {
|
if ( current_options.get_intro_music() ) {
|
||||||
// Let's wait for mpg123 to finish
|
// Let's wait for mpg123 to finish
|
||||||
struct stat stat_buf;
|
struct stat stat_buf;
|
||||||
|
|
||||||
|
@ -733,7 +726,7 @@ static void fgIdleFunction ( void ) {
|
||||||
audio_mixer = new smMixer;
|
audio_mixer = new smMixer;
|
||||||
audio_mixer -> setMasterVolume ( 30 ) ; /* 50% of max volume. */
|
audio_mixer -> setMasterVolume ( 30 ) ; /* 50% of max volume. */
|
||||||
audio_sched -> setSafetyMargin ( 1.0 ) ;
|
audio_sched -> setSafetyMargin ( 1.0 ) ;
|
||||||
strcpy(path, o->fg_root);
|
current_options.get_fg_root(path);
|
||||||
strcat(path, "/Sounds/");
|
strcat(path, "/Sounds/");
|
||||||
|
|
||||||
strcpy(slfile, path);
|
strcpy(slfile, path);
|
||||||
|
@ -762,7 +755,7 @@ static void fgIdleFunction ( void ) {
|
||||||
|
|
||||||
fgMainLoop();
|
fgMainLoop();
|
||||||
} else {
|
} else {
|
||||||
if ( o->splash_screen == 1 ) {
|
if ( current_options.get_splash_screen() == 1 ) {
|
||||||
fgSplashUpdate(0.0);
|
fgSplashUpdate(0.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -844,12 +837,10 @@ int fgGlutInitEvents( void ) {
|
||||||
// Main ...
|
// Main ...
|
||||||
int main( int argc, char **argv ) {
|
int main( int argc, char **argv ) {
|
||||||
fgFLIGHT *f;
|
fgFLIGHT *f;
|
||||||
fgOPTIONS *o;
|
|
||||||
char config[256];
|
char config[256];
|
||||||
int result; // Used in command line argument.
|
int result; // Used in command line argument.
|
||||||
|
|
||||||
f = current_aircraft.flight;
|
f = current_aircraft.flight;
|
||||||
o = ¤t_options;
|
|
||||||
|
|
||||||
#ifdef HAVE_BC5PLUS
|
#ifdef HAVE_BC5PLUS
|
||||||
_control87(MCW_EM, MCW_EM); /* defined in float.h */
|
_control87(MCW_EM, MCW_EM); /* defined in float.h */
|
||||||
|
@ -873,24 +864,24 @@ int main( int argc, char **argv ) {
|
||||||
|
|
||||||
// Attempt to locate and parse a config file
|
// Attempt to locate and parse a config file
|
||||||
// First check fg_root
|
// First check fg_root
|
||||||
strcpy(config, o->fg_root);
|
current_options.get_fg_root(config);
|
||||||
strcat(config, "/system.fgfsrc");
|
strcat(config, "/system.fgfsrc");
|
||||||
result = o->parse_config_file(config);
|
result = current_options.parse_config_file(config);
|
||||||
|
|
||||||
// Next check home directory
|
// Next check home directory
|
||||||
if ( getenv("HOME") != NULL ) {
|
if ( getenv("HOME") != NULL ) {
|
||||||
strcpy(config, getenv("HOME"));
|
strcpy(config, getenv("HOME"));
|
||||||
strcat(config, "/.fgfsrc");
|
strcat(config, "/.fgfsrc");
|
||||||
result = o->parse_config_file(config);
|
result = current_options.parse_config_file(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse remaining command line options
|
// Parse remaining command line options
|
||||||
// These will override anything specified in a config file
|
// These will override anything specified in a config file
|
||||||
result = o->parse_command_line(argc, argv);
|
result = current_options.parse_command_line(argc, argv);
|
||||||
if ( result != FG_OPTIONS_OK ) {
|
if ( result != FG_OPTIONS_OK ) {
|
||||||
// Something must have gone horribly wrong with the command
|
// Something must have gone horribly wrong with the command
|
||||||
// line parsing or maybe the user just requested help ... :-)
|
// line parsing or maybe the user just requested help ... :-)
|
||||||
o->usage();
|
current_options.usage();
|
||||||
fgPrintf( FG_GENERAL, FG_EXIT, "\nExiting ...\n");
|
fgPrintf( FG_GENERAL, FG_EXIT, "\nExiting ...\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -903,6 +894,9 @@ int main( int argc, char **argv ) {
|
||||||
|
|
||||||
|
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.35 1998/07/13 21:01:36 curt
|
||||||
|
// Wrote access functions for current fgOPTIONS.
|
||||||
|
//
|
||||||
// Revision 1.34 1998/07/13 15:32:37 curt
|
// Revision 1.34 1998/07/13 15:32:37 curt
|
||||||
// Clear color buffer if drawing wireframe.
|
// Clear color buffer if drawing wireframe.
|
||||||
// When specifying and airport, start elevation at -1000 and let the system
|
// When specifying and airport, start elevation at -1000 and let the system
|
||||||
|
|
|
@ -42,16 +42,13 @@ fgAIRPORTS::fgAIRPORTS( void ) {
|
||||||
// load the data
|
// load the data
|
||||||
int fgAIRPORTS::load( char *file ) {
|
int fgAIRPORTS::load( char *file ) {
|
||||||
fgAIRPORT a;
|
fgAIRPORT a;
|
||||||
fgOPTIONS *o;
|
|
||||||
char path[256], fgpath[256], line[256];
|
char path[256], fgpath[256], line[256];
|
||||||
char id[5];
|
char id[5];
|
||||||
string id_str;
|
string id_str;
|
||||||
fgFile f;
|
fgFile f;
|
||||||
|
|
||||||
o = ¤t_options;
|
|
||||||
|
|
||||||
// build the path name to the airport file
|
// build the path name to the airport file
|
||||||
strcpy(path, o->fg_root);
|
current_options.get_fg_root(path);
|
||||||
strcat(path, "/Scenery/");
|
strcat(path, "/Scenery/");
|
||||||
strcat(path, "Airports");
|
strcat(path, "Airports");
|
||||||
strcpy(fgpath, path);
|
strcpy(fgpath, path);
|
||||||
|
@ -103,6 +100,9 @@ fgAIRPORTS::~fgAIRPORTS( void ) {
|
||||||
|
|
||||||
|
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.8 1998/07/13 21:01:37 curt
|
||||||
|
// Wrote access functions for current fgOPTIONS.
|
||||||
|
//
|
||||||
// Revision 1.7 1998/06/03 22:01:07 curt
|
// Revision 1.7 1998/06/03 22:01:07 curt
|
||||||
// Tweaking sound library usage.
|
// Tweaking sound library usage.
|
||||||
//
|
//
|
||||||
|
|
|
@ -65,18 +65,17 @@ extern const char *default_root;
|
||||||
|
|
||||||
// Set initial position
|
// Set initial position
|
||||||
int fgInitPosition( void ) {
|
int fgInitPosition( void ) {
|
||||||
|
char id[5];
|
||||||
fgFLIGHT *f;
|
fgFLIGHT *f;
|
||||||
fgOPTIONS *o;
|
|
||||||
|
|
||||||
f = current_aircraft.flight;
|
f = current_aircraft.flight;
|
||||||
o = ¤t_options;
|
|
||||||
|
|
||||||
// If nothing else is specified, default initial position is
|
// If nothing else is specified, default initial position is
|
||||||
// Globe, AZ (P13)
|
// Globe, AZ (P13)
|
||||||
FG_Longitude = ( -110.6642444 ) * DEG_TO_RAD;
|
FG_Longitude = ( -110.6642444 ) * DEG_TO_RAD;
|
||||||
FG_Latitude = ( 33.3528917 ) * DEG_TO_RAD;
|
FG_Latitude = ( 33.3528917 ) * DEG_TO_RAD;
|
||||||
FG_Runway_altitude = (3234.5 + 300);
|
FG_Runway_altitude = (3234.5);
|
||||||
FG_Altitude = FG_Runway_altitude + 3.758099;
|
FG_Altitude = -1000 /* FG_Runway_altitude + 3.758099 */;
|
||||||
|
|
||||||
// Initial Position north of the city of Globe
|
// Initial Position north of the city of Globe
|
||||||
// FG_Longitude = ( -398673.28 / 3600.0 ) * DEG_TO_RAD;
|
// FG_Longitude = ( -398673.28 / 3600.0 ) * DEG_TO_RAD;
|
||||||
|
@ -133,24 +132,25 @@ int fgInitPosition( void ) {
|
||||||
// Test Position
|
// Test Position
|
||||||
// FG_Longitude = ( 8.5 ) * DEG_TO_RAD;
|
// FG_Longitude = ( 8.5 ) * DEG_TO_RAD;
|
||||||
// FG_Latitude = ( 47.5 ) * DEG_TO_RAD;
|
// FG_Latitude = ( 47.5 ) * DEG_TO_RAD;
|
||||||
FG_Runway_altitude = ( 6000 );
|
// FG_Runway_altitude = ( 6000 );
|
||||||
FG_Altitude = FG_Runway_altitude + 3.758099;
|
// FG_Altitude = FG_Runway_altitude + 3.758099;
|
||||||
|
|
||||||
if ( strlen(o->airport_id) ) {
|
current_options.get_airport_id(id);
|
||||||
|
if ( strlen(id) ) {
|
||||||
fgAIRPORTS airports;
|
fgAIRPORTS airports;
|
||||||
fgAIRPORT a;
|
fgAIRPORT a;
|
||||||
|
|
||||||
fgPrintf( FG_GENERAL, FG_INFO,
|
fgPrintf( FG_GENERAL, FG_INFO,
|
||||||
"Attempting to set starting position from airport code %s.\n",
|
"Attempting to set starting position from airport code %s.\n",
|
||||||
o->airport_id);
|
id);
|
||||||
|
|
||||||
airports.load("Airports");
|
airports.load("Airports");
|
||||||
a = airports.search(o->airport_id);
|
a = airports.search(id);
|
||||||
if ( (fabs(a.longitude) < FG_EPSILON) &&
|
if ( (fabs(a.longitude) < FG_EPSILON) &&
|
||||||
(fabs(a.latitude) < FG_EPSILON) &&
|
(fabs(a.latitude) < FG_EPSILON) &&
|
||||||
(fabs(a.elevation) < FG_EPSILON) ) {
|
(fabs(a.elevation) < FG_EPSILON) ) {
|
||||||
fgPrintf( FG_GENERAL, FG_EXIT,
|
fgPrintf( FG_GENERAL, FG_EXIT,
|
||||||
"Failed to find %s in database.\n", o->airport_id);
|
"Failed to find %s in database.\n", id);
|
||||||
} else {
|
} else {
|
||||||
FG_Longitude = ( a.longitude ) * DEG_TO_RAD;
|
FG_Longitude = ( a.longitude ) * DEG_TO_RAD;
|
||||||
FG_Latitude = ( a.latitude ) * DEG_TO_RAD;
|
FG_Latitude = ( a.latitude ) * DEG_TO_RAD;
|
||||||
|
@ -171,11 +171,10 @@ int fgInitPosition( void ) {
|
||||||
// General house keeping initializations
|
// General house keeping initializations
|
||||||
int fgInitGeneral( void ) {
|
int fgInitGeneral( void ) {
|
||||||
fgGENERAL *g;
|
fgGENERAL *g;
|
||||||
fgOPTIONS *o;
|
char root[256];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
g = &general;
|
g = &general;
|
||||||
o = ¤t_options;
|
|
||||||
|
|
||||||
fgPrintf( FG_GENERAL, FG_INFO, "General Initialization\n" );
|
fgPrintf( FG_GENERAL, FG_INFO, "General Initialization\n" );
|
||||||
fgPrintf( FG_GENERAL, FG_INFO, "======= ==============\n" );
|
fgPrintf( FG_GENERAL, FG_INFO, "======= ==============\n" );
|
||||||
|
@ -184,14 +183,14 @@ int fgInitGeneral( void ) {
|
||||||
g->glRenderer = glGetString ( GL_RENDERER );
|
g->glRenderer = glGetString ( GL_RENDERER );
|
||||||
g->glVersion = glGetString ( GL_VERSION );
|
g->glVersion = glGetString ( GL_VERSION );
|
||||||
|
|
||||||
if ( !strlen(o->fg_root) ) {
|
current_options.get_fg_root(root);
|
||||||
// No root path set? Then assume, we will exit if this is
|
if ( !strlen(root) ) {
|
||||||
// wrong when looking for support files.
|
// No root path set? Then bail ...
|
||||||
fgPrintf( FG_GENERAL, FG_EXIT, "%s %s\n",
|
fgPrintf( FG_GENERAL, FG_EXIT, "%s %s\n",
|
||||||
"Cannot continue without environment variable FG_ROOT",
|
"Cannot continue without environment variable FG_ROOT",
|
||||||
"being defined.");
|
"being defined.");
|
||||||
}
|
}
|
||||||
fgPrintf( FG_GENERAL, FG_INFO, "FG_ROOT = %s\n\n", o->fg_root);
|
fgPrintf( FG_GENERAL, FG_INFO, "FG_ROOT = %s\n\n", root);
|
||||||
|
|
||||||
// prime the frame rate counter pump
|
// prime the frame rate counter pump
|
||||||
for ( i = 0; i < FG_FRAME_RATE_HISTORY; i++ ) {
|
for ( i = 0; i < FG_FRAME_RATE_HISTORY; i++ ) {
|
||||||
|
@ -395,6 +394,9 @@ int fgInitSubsystems( void ) {
|
||||||
|
|
||||||
|
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.25 1998/07/13 21:01:38 curt
|
||||||
|
// Wrote access functions for current fgOPTIONS.
|
||||||
|
//
|
||||||
// Revision 1.24 1998/07/13 15:32:39 curt
|
// Revision 1.24 1998/07/13 15:32:39 curt
|
||||||
// Clear color buffer if drawing wireframe.
|
// Clear color buffer if drawing wireframe.
|
||||||
// When specifying and airport, start elevation at -1000 and let the system
|
// When specifying and airport, start elevation at -1000 and let the system
|
||||||
|
|
|
@ -458,12 +458,39 @@ void fgOPTIONS::usage ( void ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Query functions
|
||||||
|
void fgOPTIONS::get_fg_root(char *root) { strcpy(root, fg_root); }
|
||||||
|
void fgOPTIONS::get_airport_id(char *id) { strcpy(id, airport_id); }
|
||||||
|
int fgOPTIONS::get_splash_screen( void ) { return(splash_screen); }
|
||||||
|
int fgOPTIONS::get_intro_music( void ) { return(intro_music); }
|
||||||
|
int fgOPTIONS::get_mouse_pointer( void ) { return(mouse_pointer); }
|
||||||
|
int fgOPTIONS::get_hud_status( void ) { return(hud_status); }
|
||||||
|
int fgOPTIONS::get_panel_status( void ) { return(panel_status); }
|
||||||
|
int fgOPTIONS::get_fog( void ) { return(fog); }
|
||||||
|
double fgOPTIONS::get_fov( void ) { return(fov); }
|
||||||
|
int fgOPTIONS::get_fullscreen( void ) { return(fullscreen); }
|
||||||
|
int fgOPTIONS::get_shading( void ) { return(shading); }
|
||||||
|
int fgOPTIONS::get_skyblend( void ) { return(skyblend); }
|
||||||
|
int fgOPTIONS::get_textures( void ) { return(textures); }
|
||||||
|
int fgOPTIONS::get_wireframe( void ) { return(wireframe); }
|
||||||
|
int fgOPTIONS::get_tile_radius( void ) { return(tile_radius); }
|
||||||
|
int fgOPTIONS::get_tile_diameter( void ) { return(tile_diameter); }
|
||||||
|
int fgOPTIONS::get_time_offset( void ) { return(time_offset); }
|
||||||
|
|
||||||
|
|
||||||
|
// Update functions
|
||||||
|
void fgOPTIONS::set_hud_status( int status ) { hud_status = status; }
|
||||||
|
void fgOPTIONS::set_fov( double amount ) { fov = amount; }
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
fgOPTIONS::~fgOPTIONS( void ) {
|
fgOPTIONS::~fgOPTIONS( void ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.16 1998/07/13 21:01:39 curt
|
||||||
|
// Wrote access functions for current fgOPTIONS.
|
||||||
|
//
|
||||||
// Revision 1.15 1998/07/06 21:34:19 curt
|
// Revision 1.15 1998/07/06 21:34:19 curt
|
||||||
// Added an enable/disable splash screen option.
|
// Added an enable/disable splash screen option.
|
||||||
// Added an enable/disable intro music option.
|
// Added an enable/disable intro music option.
|
||||||
|
|
|
@ -39,7 +39,6 @@
|
||||||
|
|
||||||
class fgOPTIONS {
|
class fgOPTIONS {
|
||||||
|
|
||||||
public:
|
|
||||||
// The flight gear "root" directory
|
// The flight gear "root" directory
|
||||||
char fg_root[256];
|
char fg_root[256];
|
||||||
|
|
||||||
|
@ -75,6 +74,8 @@ public:
|
||||||
// Time options
|
// Time options
|
||||||
int time_offset; // Offset true time by this many seconds
|
int time_offset; // Offset true time by this many seconds
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
fgOPTIONS( void );
|
fgOPTIONS( void );
|
||||||
|
|
||||||
|
@ -90,6 +91,29 @@ public:
|
||||||
// Print usage message
|
// Print usage message
|
||||||
void usage ( void );
|
void usage ( void );
|
||||||
|
|
||||||
|
// Query functions
|
||||||
|
void get_fg_root(char *root);
|
||||||
|
void get_airport_id(char *id);
|
||||||
|
int get_splash_screen( void );
|
||||||
|
int get_intro_music( void );
|
||||||
|
int get_mouse_pointer( void );
|
||||||
|
int get_hud_status( void );
|
||||||
|
int get_panel_status( void );
|
||||||
|
int get_fog( void );
|
||||||
|
double get_fov( void );
|
||||||
|
int get_fullscreen( void );
|
||||||
|
int get_shading( void );
|
||||||
|
int get_skyblend( void );
|
||||||
|
int get_textures( void );
|
||||||
|
int get_wireframe( void );
|
||||||
|
int get_tile_radius( void );
|
||||||
|
int get_tile_diameter( void );
|
||||||
|
int get_time_offset( void );
|
||||||
|
|
||||||
|
// Update functions
|
||||||
|
void set_hud_status( int status );
|
||||||
|
void set_fov( double amount );
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
~fgOPTIONS( void );
|
~fgOPTIONS( void );
|
||||||
|
|
||||||
|
@ -103,6 +127,9 @@ extern fgOPTIONS current_options;
|
||||||
|
|
||||||
|
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.11 1998/07/13 21:01:39 curt
|
||||||
|
// Wrote access functions for current fgOPTIONS.
|
||||||
|
//
|
||||||
// Revision 1.10 1998/07/06 21:34:20 curt
|
// Revision 1.10 1998/07/06 21:34:20 curt
|
||||||
// Added an enable/disable splash screen option.
|
// Added an enable/disable splash screen option.
|
||||||
// Added an enable/disable intro music option.
|
// Added an enable/disable intro music option.
|
||||||
|
|
|
@ -50,12 +50,9 @@ static GLubyte *splash_texbuf;
|
||||||
|
|
||||||
// Initialize the splash screen
|
// Initialize the splash screen
|
||||||
void fgSplashInit ( void ) {
|
void fgSplashInit ( void ) {
|
||||||
fgOPTIONS *o;
|
|
||||||
char tpath[256], fg_tpath[256];
|
char tpath[256], fg_tpath[256];
|
||||||
int width, height;
|
int width, height;
|
||||||
|
|
||||||
o = ¤t_options;
|
|
||||||
|
|
||||||
fgPrintf( FG_GENERAL, FG_INFO, "Initializing splash screen\n");
|
fgPrintf( FG_GENERAL, FG_INFO, "Initializing splash screen\n");
|
||||||
#ifdef GL_VERSION_1_1
|
#ifdef GL_VERSION_1_1
|
||||||
xglGenTextures(1, &splash_texid);
|
xglGenTextures(1, &splash_texid);
|
||||||
|
@ -73,8 +70,7 @@ void fgSplashInit ( void ) {
|
||||||
xglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
xglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||||
|
|
||||||
// load in the texture data
|
// load in the texture data
|
||||||
tpath[0] = '\0';
|
current_options.get_fg_root(tpath);
|
||||||
strcat(tpath, o->fg_root);
|
|
||||||
strcat(tpath, "/Textures/");
|
strcat(tpath, "/Textures/");
|
||||||
strcat(tpath, "Splash2.rgb");
|
strcat(tpath, "Splash2.rgb");
|
||||||
|
|
||||||
|
@ -147,6 +143,9 @@ void fgSplashUpdate ( double progress ) {
|
||||||
|
|
||||||
|
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.2 1998/07/13 21:01:40 curt
|
||||||
|
// Wrote access functions for current fgOPTIONS.
|
||||||
|
//
|
||||||
// Revision 1.1 1998/07/06 02:42:36 curt
|
// Revision 1.1 1998/07/06 02:42:36 curt
|
||||||
// Initial revision.
|
// Initial revision.
|
||||||
//
|
//
|
||||||
|
|
|
@ -65,11 +65,13 @@ void fgVIEW::Init( void ) {
|
||||||
|
|
||||||
// Update the field of view parameters
|
// Update the field of view parameters
|
||||||
void fgVIEW::UpdateFOV( fgOPTIONS *o ) {
|
void fgVIEW::UpdateFOV( fgOPTIONS *o ) {
|
||||||
double theta_x, theta_y;
|
double fov, theta_x, theta_y;
|
||||||
|
|
||||||
|
fov = o->get_fov();
|
||||||
|
|
||||||
// printf("win_ratio = %.2f\n", win_ratio);
|
// printf("win_ratio = %.2f\n", win_ratio);
|
||||||
// calculate sin() and cos() of fov / 2 in X direction;
|
// calculate sin() and cos() of fov / 2 in X direction;
|
||||||
theta_x = (o->fov * win_ratio * DEG_TO_RAD) / 2.0;
|
theta_x = (fov * win_ratio * DEG_TO_RAD) / 2.0;
|
||||||
// printf("theta_x = %.2f\n", theta_x);
|
// printf("theta_x = %.2f\n", theta_x);
|
||||||
sin_fov_x = sin(theta_x);
|
sin_fov_x = sin(theta_x);
|
||||||
cos_fov_x = cos(theta_x);
|
cos_fov_x = cos(theta_x);
|
||||||
|
@ -77,7 +79,7 @@ void fgVIEW::UpdateFOV( fgOPTIONS *o ) {
|
||||||
// printf("slope_x = %.2f\n", slope_x);
|
// printf("slope_x = %.2f\n", slope_x);
|
||||||
|
|
||||||
// calculate sin() and cos() of fov / 2 in Y direction;
|
// calculate sin() and cos() of fov / 2 in Y direction;
|
||||||
theta_y = (o->fov * DEG_TO_RAD) / 2.0;
|
theta_y = (fov * DEG_TO_RAD) / 2.0;
|
||||||
// printf("theta_y = %.2f\n", theta_y);
|
// printf("theta_y = %.2f\n", theta_y);
|
||||||
sin_fov_y = sin(theta_y);
|
sin_fov_y = sin(theta_y);
|
||||||
cos_fov_y = cos(theta_y);
|
cos_fov_y = cos(theta_y);
|
||||||
|
@ -88,17 +90,14 @@ void fgVIEW::UpdateFOV( fgOPTIONS *o ) {
|
||||||
|
|
||||||
// Update the view parameters
|
// Update the view parameters
|
||||||
void fgVIEW::Update( fgFLIGHT *f ) {
|
void fgVIEW::Update( fgFLIGHT *f ) {
|
||||||
fgOPTIONS *o;
|
|
||||||
fgPoint3d p;
|
fgPoint3d p;
|
||||||
MAT3vec vec, forward, v0, minus_z;
|
MAT3vec vec, forward, v0, minus_z;
|
||||||
MAT3mat R, TMP, UP, LOCAL, VIEW;
|
MAT3mat R, TMP, UP, LOCAL, VIEW;
|
||||||
double ntmp;
|
double ntmp;
|
||||||
|
|
||||||
o = ¤t_options;
|
|
||||||
|
|
||||||
if(update_fov == TRUE) {
|
if(update_fov == TRUE) {
|
||||||
// printf("Updating fov\n");
|
// printf("Updating fov\n");
|
||||||
UpdateFOV(o);
|
UpdateFOV(¤t_options);
|
||||||
update_fov = FALSE;
|
update_fov = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -464,6 +463,9 @@ void fg_gluLookAt( GLdouble eyex, GLdouble eyey, GLdouble eyez,
|
||||||
|
|
||||||
|
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.16 1998/07/13 21:01:41 curt
|
||||||
|
// Wrote access functions for current fgOPTIONS.
|
||||||
|
//
|
||||||
// Revision 1.15 1998/07/12 03:14:43 curt
|
// Revision 1.15 1998/07/12 03:14:43 curt
|
||||||
// Added ground collision detection.
|
// Added ground collision detection.
|
||||||
// Did some serious horsing around to be able to "hug" the ground properly
|
// Did some serious horsing around to be able to "hug" the ground properly
|
||||||
|
|
|
@ -71,7 +71,6 @@ fgMATERIAL_MGR::fgMATERIAL_MGR ( void ) {
|
||||||
// Load a library of material properties
|
// Load a library of material properties
|
||||||
int fgMATERIAL_MGR::load_lib ( void ) {
|
int fgMATERIAL_MGR::load_lib ( void ) {
|
||||||
fgMATERIAL m;
|
fgMATERIAL m;
|
||||||
fgOPTIONS *o;
|
|
||||||
char material_name[256];
|
char material_name[256];
|
||||||
char mpath[256], fg_mpath[256], tpath[256], fg_tpath[256];
|
char mpath[256], fg_mpath[256], tpath[256], fg_tpath[256];
|
||||||
char line[256], *line_ptr, value[256];
|
char line[256], *line_ptr, value[256];
|
||||||
|
@ -80,11 +79,8 @@ int fgMATERIAL_MGR::load_lib ( void ) {
|
||||||
int width, height;
|
int width, height;
|
||||||
int alpha;
|
int alpha;
|
||||||
|
|
||||||
o = ¤t_options;
|
|
||||||
|
|
||||||
// build the path name to the material db
|
// build the path name to the material db
|
||||||
mpath[0] = '\0';
|
current_options.get_fg_root(mpath);
|
||||||
strcat(mpath, o->fg_root);
|
|
||||||
strcat(mpath, "/Scenery/");
|
strcat(mpath, "/Scenery/");
|
||||||
strcat(mpath, "Materials");
|
strcat(mpath, "Materials");
|
||||||
strcpy(fg_mpath, mpath);
|
strcpy(fg_mpath, mpath);
|
||||||
|
@ -174,8 +170,7 @@ int fgMATERIAL_MGR::load_lib ( void ) {
|
||||||
GL_LINEAR_MIPMAP_LINEAR ) ;
|
GL_LINEAR_MIPMAP_LINEAR ) ;
|
||||||
|
|
||||||
/* load in the texture data */
|
/* load in the texture data */
|
||||||
tpath[0] = '\0';
|
current_options.get_fg_root(tpath);
|
||||||
strcat(tpath, o->fg_root);
|
|
||||||
strcat(tpath, "/Textures/");
|
strcat(tpath, "/Textures/");
|
||||||
strcat(tpath, m.texture_name);
|
strcat(tpath, m.texture_name);
|
||||||
strcat(tpath, ".rgb");
|
strcat(tpath, ".rgb");
|
||||||
|
@ -299,6 +294,9 @@ fgMATERIAL_MGR::~fgMATERIAL_MGR ( void ) {
|
||||||
|
|
||||||
|
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.9 1998/07/13 21:01:57 curt
|
||||||
|
// Wrote access functions for current fgOPTIONS.
|
||||||
|
//
|
||||||
// Revision 1.8 1998/07/08 14:47:20 curt
|
// Revision 1.8 1998/07/08 14:47:20 curt
|
||||||
// Fix GL_MODULATE vs. GL_DECAL problem introduced by splash screen.
|
// Fix GL_MODULATE vs. GL_DECAL problem introduced by splash screen.
|
||||||
// polare3d.h renamed to polar3d.hxx
|
// polare3d.h renamed to polar3d.hxx
|
||||||
|
|
|
@ -104,7 +104,6 @@ fgPoint3d calc_tex_coords(double *node, fgPoint3d *ref) {
|
||||||
|
|
||||||
// Load a .obj file and build the GL fragment list
|
// Load a .obj file and build the GL fragment list
|
||||||
int fgObjLoad(char *path, fgTILE *t) {
|
int fgObjLoad(char *path, fgTILE *t) {
|
||||||
fgOPTIONS *o;
|
|
||||||
fgFRAGMENT fragment;
|
fgFRAGMENT fragment;
|
||||||
fgPoint3d pp;
|
fgPoint3d pp;
|
||||||
char fgpath[256], line[256], material[256];
|
char fgpath[256], line[256], material[256];
|
||||||
|
@ -113,11 +112,10 @@ int fgObjLoad(char *path, fgTILE *t) {
|
||||||
// GLfloat sgenparams[] = { 1.0, 0.0, 0.0, 0.0 };
|
// GLfloat sgenparams[] = { 1.0, 0.0, 0.0, 0.0 };
|
||||||
GLint display_list;
|
GLint display_list;
|
||||||
fgFile f;
|
fgFile f;
|
||||||
|
int shading;
|
||||||
int in_fragment, in_faces, vncount, n1, n2, n3, n4;
|
int in_fragment, in_faces, vncount, n1, n2, n3, n4;
|
||||||
int last1, last2, odd;
|
int last1, last2, odd;
|
||||||
|
|
||||||
o = ¤t_options;
|
|
||||||
|
|
||||||
// First try "path.gz" (compressed format)
|
// First try "path.gz" (compressed format)
|
||||||
strcpy(fgpath, path);
|
strcpy(fgpath, path);
|
||||||
strcat(fgpath, ".gz");
|
strcat(fgpath, ".gz");
|
||||||
|
@ -136,6 +134,8 @@ int fgObjLoad(char *path, fgTILE *t) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
shading = current_options.get_shading();
|
||||||
|
|
||||||
in_fragment = 0;
|
in_fragment = 0;
|
||||||
t->ncount = 1;
|
t->ncount = 1;
|
||||||
vncount = 1;
|
vncount = 1;
|
||||||
|
@ -254,7 +254,7 @@ int fgObjLoad(char *path, fgTILE *t) {
|
||||||
odd = 1;
|
odd = 1;
|
||||||
scale = 1.0;
|
scale = 1.0;
|
||||||
|
|
||||||
if ( o->shading ) {
|
if ( shading ) {
|
||||||
// Shading model is "GL_SMOOTH" so use precalculated
|
// Shading model is "GL_SMOOTH" so use precalculated
|
||||||
// (averaged) normals
|
// (averaged) normals
|
||||||
MAT3_SCALE_VEC(normal, normals[n1], scale);
|
MAT3_SCALE_VEC(normal, normals[n1], scale);
|
||||||
|
@ -307,7 +307,7 @@ int fgObjLoad(char *path, fgTILE *t) {
|
||||||
if ( n4 > 0 ) {
|
if ( n4 > 0 ) {
|
||||||
fragment.add_face(n3, n2, n4);
|
fragment.add_face(n3, n2, n4);
|
||||||
|
|
||||||
if ( o->shading ) {
|
if ( shading ) {
|
||||||
// Shading model is "GL_SMOOTH"
|
// Shading model is "GL_SMOOTH"
|
||||||
MAT3_SCALE_VEC(normal, normals[n4], scale);
|
MAT3_SCALE_VEC(normal, normals[n4], scale);
|
||||||
} else {
|
} else {
|
||||||
|
@ -367,7 +367,7 @@ int fgObjLoad(char *path, fgTILE *t) {
|
||||||
fragment.add_face(last2, last1, n1);
|
fragment.add_face(last2, last1, n1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( o->shading ) {
|
if ( shading ) {
|
||||||
// Shading model is "GL_SMOOTH"
|
// Shading model is "GL_SMOOTH"
|
||||||
MAT3_SCALE_VEC(normal, normals[n1], scale);
|
MAT3_SCALE_VEC(normal, normals[n1], scale);
|
||||||
xglNormal3dv(normal);
|
xglNormal3dv(normal);
|
||||||
|
@ -401,7 +401,7 @@ int fgObjLoad(char *path, fgTILE *t) {
|
||||||
fragment.add_face(last2, last1, n2);
|
fragment.add_face(last2, last1, n2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( o->shading ) {
|
if ( shading ) {
|
||||||
// Shading model is "GL_SMOOTH"
|
// Shading model is "GL_SMOOTH"
|
||||||
MAT3_SCALE_VEC(normal, normals[n2], scale);
|
MAT3_SCALE_VEC(normal, normals[n2], scale);
|
||||||
xglNormal3dv(normal);
|
xglNormal3dv(normal);
|
||||||
|
@ -466,6 +466,9 @@ int fgObjLoad(char *path, fgTILE *t) {
|
||||||
|
|
||||||
|
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.19 1998/07/13 21:01:58 curt
|
||||||
|
// Wrote access functions for current fgOPTIONS.
|
||||||
|
//
|
||||||
// Revision 1.18 1998/07/12 03:18:27 curt
|
// Revision 1.18 1998/07/12 03:18:27 curt
|
||||||
// Added ground collision detection. This involved:
|
// Added ground collision detection. This involved:
|
||||||
// - saving the entire vertex list for each tile with the tile records.
|
// - saving the entire vertex list for each tile with the tile records.
|
||||||
|
|
|
@ -75,24 +75,7 @@ int fgSceneryInit( void ) {
|
||||||
/* Tell the scenery manager where we are so it can load the proper data, and
|
/* Tell the scenery manager where we are so it can load the proper data, and
|
||||||
* build the proper structures. */
|
* build the proper structures. */
|
||||||
void fgSceneryUpdate(double lon, double lat, double elev) {
|
void fgSceneryUpdate(double lon, double lat, double elev) {
|
||||||
fgOPTIONS *o;
|
// does nothing;
|
||||||
// double max_radius;
|
|
||||||
char path[1024];
|
|
||||||
|
|
||||||
o = ¤t_options;
|
|
||||||
|
|
||||||
/* a hardcoded hack follows */
|
|
||||||
|
|
||||||
/* this routine should parse the file, and make calls back to the
|
|
||||||
* scenery management system to build the appropriate structures */
|
|
||||||
path[0] = '\0';
|
|
||||||
strcat(path, o->fg_root);
|
|
||||||
strcat(path, "/Scenery/");
|
|
||||||
strcat(path, "mesa-e.obj");
|
|
||||||
|
|
||||||
// fgPrintf(FG_TERRAIN, FG_DEBUG, " Loading Scenery: %s\n", path);
|
|
||||||
|
|
||||||
// area_terrain = fgObjLoad(path, &scenery.center, &max_radius);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -102,14 +85,17 @@ void fgSceneryRender( void ) {
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.6 1998/07/12 03:18:27 curt
|
/* Revision 1.7 1998/07/13 21:01:59 curt
|
||||||
/* Added ground collision detection. This involved:
|
/* Wrote access functions for current fgOPTIONS.
|
||||||
/* - saving the entire vertex list for each tile with the tile records.
|
|
||||||
/* - saving the face list for each fragment with the fragment records.
|
|
||||||
/* - code to intersect the current vertical line with the proper face in
|
|
||||||
/* an efficient manner as possible.
|
|
||||||
/* Fixed a bug where the tiles weren't being shifted to "near" (0,0,0)
|
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.6 1998/07/12 03:18:27 curt
|
||||||
|
* Added ground collision detection. This involved:
|
||||||
|
* - saving the entire vertex list for each tile with the tile records.
|
||||||
|
* - saving the face list for each fragment with the fragment records.
|
||||||
|
* - code to intersect the current vertical line with the proper face in
|
||||||
|
* an efficient manner as possible.
|
||||||
|
* Fixed a bug where the tiles weren't being shifted to "near" (0,0,0)
|
||||||
|
*
|
||||||
* Revision 1.5 1998/06/17 21:36:41 curt
|
* Revision 1.5 1998/06/17 21:36:41 curt
|
||||||
* Load and manage multiple textures defined in the Materials library.
|
* Load and manage multiple textures defined in the Materials library.
|
||||||
* Boost max material fagments for each material property to 800.
|
* Boost max material fagments for each material property to 800.
|
||||||
|
|
|
@ -88,12 +88,10 @@ int fgTILECACHE::Exists( fgBUCKET *p ) {
|
||||||
|
|
||||||
// Fill in a tile cache entry with real data for the specified bucket
|
// Fill in a tile cache entry with real data for the specified bucket
|
||||||
void fgTILECACHE::EntryFillIn( int index, fgBUCKET *p ) {
|
void fgTILECACHE::EntryFillIn( int index, fgBUCKET *p ) {
|
||||||
fgOPTIONS *o;
|
char root[256];
|
||||||
char base_path[256];
|
char base_path[256];
|
||||||
char file_name[256];
|
char file_name[256];
|
||||||
|
|
||||||
o = ¤t_options;
|
|
||||||
|
|
||||||
// Mark this cache entry as used
|
// Mark this cache entry as used
|
||||||
tile_cache[index].used = 1;
|
tile_cache[index].used = 1;
|
||||||
|
|
||||||
|
@ -105,7 +103,8 @@ void fgTILECACHE::EntryFillIn( int index, fgBUCKET *p ) {
|
||||||
|
|
||||||
// Load the appropriate data file and built tile fragment list
|
// Load the appropriate data file and built tile fragment list
|
||||||
fgBucketGenBasePath(p, base_path);
|
fgBucketGenBasePath(p, base_path);
|
||||||
sprintf(file_name, "%s/Scenery/%s/%ld", o->fg_root,
|
current_options.get_fg_root(root);
|
||||||
|
sprintf(file_name, "%s/Scenery/%s/%ld", root,
|
||||||
base_path, fgBucketGenIndex(p));
|
base_path, fgBucketGenIndex(p));
|
||||||
fgObjLoad(file_name, &tile_cache[index]);
|
fgObjLoad(file_name, &tile_cache[index]);
|
||||||
/*
|
/*
|
||||||
|
@ -213,6 +212,9 @@ fgTILECACHE::~fgTILECACHE( void ) {
|
||||||
|
|
||||||
|
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.13 1998/07/13 21:02:00 curt
|
||||||
|
// Wrote access functions for current fgOPTIONS.
|
||||||
|
//
|
||||||
// Revision 1.12 1998/07/12 03:18:29 curt
|
// Revision 1.12 1998/07/12 03:18:29 curt
|
||||||
// Added ground collision detection. This involved:
|
// Added ground collision detection. This involved:
|
||||||
// - saving the entire vertex list for each tile with the tile records.
|
// - saving the entire vertex list for each tile with the tile records.
|
||||||
|
|
|
@ -95,18 +95,19 @@ void fgTileMgrLoadTile( fgBUCKET *p, int *index) {
|
||||||
int fgTileMgrUpdate( void ) {
|
int fgTileMgrUpdate( void ) {
|
||||||
fgTILECACHE *c;
|
fgTILECACHE *c;
|
||||||
fgFLIGHT *f;
|
fgFLIGHT *f;
|
||||||
fgOPTIONS *o;
|
|
||||||
fgBUCKET p1, p2;
|
fgBUCKET p1, p2;
|
||||||
static fgBUCKET p_last = {-1000, 0, 0, 0};
|
static fgBUCKET p_last = {-1000, 0, 0, 0};
|
||||||
|
int tile_diameter;
|
||||||
int i, j, dw, dh;
|
int i, j, dw, dh;
|
||||||
|
|
||||||
c = &global_tile_cache;
|
c = &global_tile_cache;
|
||||||
f = current_aircraft.flight;
|
f = current_aircraft.flight;
|
||||||
o = ¤t_options;
|
|
||||||
|
tile_diameter = current_options.get_tile_diameter();
|
||||||
|
|
||||||
fgBucketFind(FG_Longitude * RAD_TO_DEG, FG_Latitude * RAD_TO_DEG, &p1);
|
fgBucketFind(FG_Longitude * RAD_TO_DEG, FG_Latitude * RAD_TO_DEG, &p1);
|
||||||
dw = o->tile_diameter / 2;
|
dw = tile_diameter / 2;
|
||||||
dh = o->tile_diameter / 2;
|
dh = tile_diameter / 2;
|
||||||
|
|
||||||
if ( (p1.lon == p_last.lon) && (p1.lat == p_last.lat) &&
|
if ( (p1.lon == p_last.lon) && (p1.lat == p_last.lat) &&
|
||||||
(p1.x == p_last.x) && (p1.y == p_last.y) ) {
|
(p1.x == p_last.x) && (p1.y == p_last.y) ) {
|
||||||
|
@ -120,16 +121,16 @@ int fgTileMgrUpdate( void ) {
|
||||||
fgPrintf( FG_TERRAIN, FG_INFO, " Updating Tile list for %d,%d %d,%d\n",
|
fgPrintf( FG_TERRAIN, FG_INFO, " Updating Tile list for %d,%d %d,%d\n",
|
||||||
p1.lon, p1.lat, p1.x, p1.y);
|
p1.lon, p1.lat, p1.x, p1.y);
|
||||||
fgPrintf( FG_TERRAIN, FG_INFO, " Loading %d tiles\n",
|
fgPrintf( FG_TERRAIN, FG_INFO, " Loading %d tiles\n",
|
||||||
o->tile_diameter * o->tile_diameter);
|
tile_diameter * tile_diameter);
|
||||||
|
|
||||||
// wipe/initialize tile cache
|
// wipe/initialize tile cache
|
||||||
c->Init();
|
c->Init();
|
||||||
|
|
||||||
// build the local area list and update cache
|
// build the local area list and update cache
|
||||||
for ( j = 0; j < o->tile_diameter; j++ ) {
|
for ( j = 0; j < tile_diameter; j++ ) {
|
||||||
for ( i = 0; i < o->tile_diameter; i++ ) {
|
for ( i = 0; i < tile_diameter; i++ ) {
|
||||||
fgBucketOffset(&p1, &p2, i - dw, j - dh);
|
fgBucketOffset(&p1, &p2, i - dw, j - dh);
|
||||||
fgTileMgrLoadTile(&p2, &tiles[(j*o->tile_diameter) + i]);
|
fgTileMgrLoadTile(&p2, &tiles[(j*tile_diameter) + i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -146,58 +147,58 @@ int fgTileMgrUpdate( void ) {
|
||||||
if ( (p1.lon > p_last.lon) ||
|
if ( (p1.lon > p_last.lon) ||
|
||||||
( (p1.lon == p_last.lon) && (p1.x > p_last.x) ) ) {
|
( (p1.lon == p_last.lon) && (p1.x > p_last.x) ) ) {
|
||||||
fgPrintf( FG_TERRAIN, FG_INFO, " Loading %d tiles\n",
|
fgPrintf( FG_TERRAIN, FG_INFO, " Loading %d tiles\n",
|
||||||
o->tile_diameter);
|
tile_diameter);
|
||||||
for ( j = 0; j < o->tile_diameter; j++ ) {
|
for ( j = 0; j < tile_diameter; j++ ) {
|
||||||
// scrolling East
|
// scrolling East
|
||||||
for ( i = 0; i < o->tile_diameter - 1; i++ ) {
|
for ( i = 0; i < tile_diameter - 1; i++ ) {
|
||||||
tiles[(j*o->tile_diameter) + i] =
|
tiles[(j*tile_diameter) + i] =
|
||||||
tiles[(j*o->tile_diameter) + i + 1];
|
tiles[(j*tile_diameter) + i + 1];
|
||||||
}
|
}
|
||||||
// load in new column
|
// load in new column
|
||||||
fgBucketOffset(&p_last, &p2, dw + 1, j - dh);
|
fgBucketOffset(&p_last, &p2, dw + 1, j - dh);
|
||||||
fgTileMgrLoadTile(&p2, &tiles[(j*o->tile_diameter) +
|
fgTileMgrLoadTile(&p2, &tiles[(j*tile_diameter) +
|
||||||
o->tile_diameter - 1]);
|
tile_diameter - 1]);
|
||||||
}
|
}
|
||||||
} else if ( (p1.lon < p_last.lon) ||
|
} else if ( (p1.lon < p_last.lon) ||
|
||||||
( (p1.lon == p_last.lon) && (p1.x < p_last.x) ) ) {
|
( (p1.lon == p_last.lon) && (p1.x < p_last.x) ) ) {
|
||||||
fgPrintf( FG_TERRAIN, FG_INFO, " Loading %d tiles\n",
|
fgPrintf( FG_TERRAIN, FG_INFO, " Loading %d tiles\n",
|
||||||
o->tile_diameter);
|
tile_diameter);
|
||||||
for ( j = 0; j < o->tile_diameter; j++ ) {
|
for ( j = 0; j < tile_diameter; j++ ) {
|
||||||
// scrolling West
|
// scrolling West
|
||||||
for ( i = o->tile_diameter - 1; i > 0; i-- ) {
|
for ( i = tile_diameter - 1; i > 0; i-- ) {
|
||||||
tiles[(j*o->tile_diameter) + i] =
|
tiles[(j*tile_diameter) + i] =
|
||||||
tiles[(j*o->tile_diameter) + i - 1];
|
tiles[(j*tile_diameter) + i - 1];
|
||||||
}
|
}
|
||||||
// load in new column
|
// load in new column
|
||||||
fgBucketOffset(&p_last, &p2, -dw - 1, j - dh);
|
fgBucketOffset(&p_last, &p2, -dw - 1, j - dh);
|
||||||
fgTileMgrLoadTile(&p2, &tiles[(j*o->tile_diameter) + 0]);
|
fgTileMgrLoadTile(&p2, &tiles[(j*tile_diameter) + 0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( (p1.lat > p_last.lat) ||
|
if ( (p1.lat > p_last.lat) ||
|
||||||
( (p1.lat == p_last.lat) && (p1.y > p_last.y) ) ) {
|
( (p1.lat == p_last.lat) && (p1.y > p_last.y) ) ) {
|
||||||
fgPrintf( FG_TERRAIN, FG_INFO, " Loading %d tiles\n",
|
fgPrintf( FG_TERRAIN, FG_INFO, " Loading %d tiles\n",
|
||||||
o->tile_diameter);
|
tile_diameter);
|
||||||
for ( i = 0; i < o->tile_diameter; i++ ) {
|
for ( i = 0; i < tile_diameter; i++ ) {
|
||||||
// scrolling North
|
// scrolling North
|
||||||
for ( j = 0; j < o->tile_diameter - 1; j++ ) {
|
for ( j = 0; j < tile_diameter - 1; j++ ) {
|
||||||
tiles[(j * o->tile_diameter) + i] =
|
tiles[(j * tile_diameter) + i] =
|
||||||
tiles[((j+1) * o->tile_diameter) + i];
|
tiles[((j+1) * tile_diameter) + i];
|
||||||
}
|
}
|
||||||
// load in new column
|
// load in new column
|
||||||
fgBucketOffset(&p_last, &p2, i - dw, dh + 1);
|
fgBucketOffset(&p_last, &p2, i - dw, dh + 1);
|
||||||
fgTileMgrLoadTile(&p2, &tiles[((o->tile_diameter-1) *
|
fgTileMgrLoadTile(&p2, &tiles[((tile_diameter-1) *
|
||||||
o->tile_diameter) + i]);
|
tile_diameter) + i]);
|
||||||
}
|
}
|
||||||
} else if ( (p1.lat < p_last.lat) ||
|
} else if ( (p1.lat < p_last.lat) ||
|
||||||
( (p1.lat == p_last.lat) && (p1.y < p_last.y) ) ) {
|
( (p1.lat == p_last.lat) && (p1.y < p_last.y) ) ) {
|
||||||
fgPrintf( FG_TERRAIN, FG_INFO, " Loading %d tiles\n",
|
fgPrintf( FG_TERRAIN, FG_INFO, " Loading %d tiles\n",
|
||||||
o->tile_diameter);
|
tile_diameter);
|
||||||
for ( i = 0; i < o->tile_diameter; i++ ) {
|
for ( i = 0; i < tile_diameter; i++ ) {
|
||||||
// scrolling South
|
// scrolling South
|
||||||
for ( j = o->tile_diameter - 1; j > 0; j-- ) {
|
for ( j = tile_diameter - 1; j > 0; j-- ) {
|
||||||
tiles[(j * o->tile_diameter) + i] =
|
tiles[(j * tile_diameter) + i] =
|
||||||
tiles[((j-1) * o->tile_diameter) + i];
|
tiles[((j-1) * tile_diameter) + i];
|
||||||
}
|
}
|
||||||
// load in new column
|
// load in new column
|
||||||
fgBucketOffset(&p_last, &p2, i - dw, -dh - 1);
|
fgBucketOffset(&p_last, &p2, i - dw, -dh - 1);
|
||||||
|
@ -315,7 +316,6 @@ static int viewable( fgPoint3d *cp, double radius ) {
|
||||||
void fgTileMgrRender( void ) {
|
void fgTileMgrRender( void ) {
|
||||||
fgTILECACHE *c;
|
fgTILECACHE *c;
|
||||||
fgFLIGHT *f;
|
fgFLIGHT *f;
|
||||||
fgOPTIONS *o;
|
|
||||||
fgTILE *t, *last_tile_ptr;
|
fgTILE *t, *last_tile_ptr;
|
||||||
fgVIEW *v;
|
fgVIEW *v;
|
||||||
fgBUCKET p;
|
fgBUCKET p;
|
||||||
|
@ -329,15 +329,18 @@ void fgTileMgrRender( void ) {
|
||||||
list < fgFRAGMENT > :: iterator current;
|
list < fgFRAGMENT > :: iterator current;
|
||||||
list < fgFRAGMENT > :: iterator last;
|
list < fgFRAGMENT > :: iterator last;
|
||||||
int i, j, size;
|
int i, j, size;
|
||||||
|
int tile_diameter, textures;
|
||||||
int index;
|
int index;
|
||||||
int culled = 0;
|
int culled = 0;
|
||||||
int drawn = 0;
|
int drawn = 0;
|
||||||
|
|
||||||
c = &global_tile_cache;
|
c = &global_tile_cache;
|
||||||
f = current_aircraft.flight;
|
f = current_aircraft.flight;
|
||||||
o = ¤t_options;
|
|
||||||
v = ¤t_view;
|
v = ¤t_view;
|
||||||
|
|
||||||
|
tile_diameter = current_options.get_tile_diameter();
|
||||||
|
textures = current_options.get_textures();
|
||||||
|
|
||||||
// Find current translation offset
|
// Find current translation offset
|
||||||
fgBucketFind(FG_Longitude * RAD_TO_DEG, FG_Latitude * RAD_TO_DEG, &p);
|
fgBucketFind(FG_Longitude * RAD_TO_DEG, FG_Latitude * RAD_TO_DEG, &p);
|
||||||
index = c->Exists(&p);
|
index = c->Exists(&p);
|
||||||
|
@ -362,7 +365,7 @@ void fgTileMgrRender( void ) {
|
||||||
|
|
||||||
// Pass 1
|
// Pass 1
|
||||||
// traverse the potentially viewable tile list
|
// traverse the potentially viewable tile list
|
||||||
for ( i = 0; i < (o->tile_diameter * o->tile_diameter); i++ ) {
|
for ( i = 0; i < (tile_diameter * tile_diameter); i++ ) {
|
||||||
index = tiles[i];
|
index = tiles[i];
|
||||||
// fgPrintf( FG_TERRAIN, FG_DEBUG, "Index = %d\n", index);
|
// fgPrintf( FG_TERRAIN, FG_DEBUG, "Index = %d\n", index);
|
||||||
t = c->GetTile(index);
|
t = c->GetTile(index);
|
||||||
|
@ -507,7 +510,7 @@ void fgTileMgrRender( void ) {
|
||||||
|
|
||||||
size = mtl_ptr->list_size;
|
size = mtl_ptr->list_size;
|
||||||
if ( size > 0 ) {
|
if ( size > 0 ) {
|
||||||
if ( o->textures ) {
|
if ( textures ) {
|
||||||
#ifdef GL_VERSION_1_1
|
#ifdef GL_VERSION_1_1
|
||||||
xglBindTexture(GL_TEXTURE_2D, mtl_ptr->texture_id);
|
xglBindTexture(GL_TEXTURE_2D, mtl_ptr->texture_id);
|
||||||
#elif GL_EXT_texture_object
|
#elif GL_EXT_texture_object
|
||||||
|
@ -550,6 +553,9 @@ void fgTileMgrRender( void ) {
|
||||||
|
|
||||||
|
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.25 1998/07/13 21:02:01 curt
|
||||||
|
// Wrote access functions for current fgOPTIONS.
|
||||||
|
//
|
||||||
// Revision 1.24 1998/07/12 03:18:29 curt
|
// Revision 1.24 1998/07/12 03:18:29 curt
|
||||||
// Added ground collision detection. This involved:
|
// Added ground collision detection. This involved:
|
||||||
// - saving the entire vertex list for each tile with the tile records.
|
// - saving the entire vertex list for each tile with the tile records.
|
||||||
|
|
|
@ -39,6 +39,9 @@ extern "C" void *memset(void *, int, size_t);
|
||||||
|
|
||||||
#include <deque> // STL double ended queue
|
#include <deque> // STL double ended queue
|
||||||
#include <list> // STL list
|
#include <list> // STL list
|
||||||
|
#ifdef NEEDNAMESPACESTD
|
||||||
|
using namespace std;
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "fg_time.hxx"
|
#include "fg_time.hxx"
|
||||||
|
|
||||||
|
@ -121,6 +124,9 @@ extern fgEVENT_MGR global_events;
|
||||||
|
|
||||||
|
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.5 1998/07/13 21:02:07 curt
|
||||||
|
// Wrote access functions for current fgOPTIONS.
|
||||||
|
//
|
||||||
// Revision 1.4 1998/06/12 00:59:52 curt
|
// Revision 1.4 1998/06/12 00:59:52 curt
|
||||||
// Build only static libraries.
|
// Build only static libraries.
|
||||||
// Declare memmove/memset for Sloaris.
|
// Declare memmove/memset for Sloaris.
|
||||||
|
|
|
@ -63,16 +63,14 @@ fgTIME cur_time_params;
|
||||||
// Initialize the time dependent variables
|
// Initialize the time dependent variables
|
||||||
|
|
||||||
void fgTimeInit(fgTIME *t) {
|
void fgTimeInit(fgTIME *t) {
|
||||||
fgOPTIONS *o;
|
|
||||||
|
|
||||||
o = ¤t_options;
|
|
||||||
|
|
||||||
fgPrintf( FG_EVENT, FG_INFO, "Initializing Time\n");
|
fgPrintf( FG_EVENT, FG_INFO, "Initializing Time\n");
|
||||||
|
|
||||||
t->gst_diff = -9999.0;
|
t->gst_diff = -9999.0;
|
||||||
fgPrintf( FG_EVENT, FG_DEBUG, "o->time_offset = %d\n", o->time_offset);
|
|
||||||
|
|
||||||
t->warp = o->time_offset;
|
fgPrintf( FG_EVENT, FG_DEBUG, "time offset = %d\n",
|
||||||
|
current_options.get_time_offset() );
|
||||||
|
|
||||||
|
t->warp = current_options.get_time_offset();
|
||||||
t->warp_delta = 0;
|
t->warp_delta = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -409,6 +407,9 @@ void fgTimeUpdate(fgFLIGHT *f, fgTIME *t) {
|
||||||
|
|
||||||
|
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.10 1998/07/13 21:02:07 curt
|
||||||
|
// Wrote access functions for current fgOPTIONS.
|
||||||
|
//
|
||||||
// Revision 1.9 1998/06/12 00:59:53 curt
|
// Revision 1.9 1998/06/12 00:59:53 curt
|
||||||
// Build only static libraries.
|
// Build only static libraries.
|
||||||
// Declare memmove/memset for Sloaris.
|
// Declare memmove/memset for Sloaris.
|
||||||
|
|
|
@ -59,33 +59,27 @@ fgLIGHT::fgLIGHT( void ) {
|
||||||
|
|
||||||
// initialize lighting tables
|
// initialize lighting tables
|
||||||
void fgLIGHT::Init( void ) {
|
void fgLIGHT::Init( void ) {
|
||||||
fgOPTIONS *o;
|
|
||||||
char path[256];
|
char path[256];
|
||||||
|
|
||||||
fgPrintf( FG_EVENT, FG_INFO,
|
fgPrintf( FG_EVENT, FG_INFO,
|
||||||
"Initializing Lighting interpolation tables.\n" );
|
"Initializing Lighting interpolation tables.\n" );
|
||||||
|
|
||||||
o = ¤t_options;
|
|
||||||
|
|
||||||
// build the path name to the ambient lookup table
|
// build the path name to the ambient lookup table
|
||||||
path[0] = '\0';
|
current_options.get_fg_root(path);
|
||||||
strcat(path, o->fg_root);
|
|
||||||
strcat(path, "/Scenery/");
|
strcat(path, "/Scenery/");
|
||||||
strcat(path, "Ambient");
|
strcat(path, "Ambient");
|
||||||
// initialize ambient table
|
// initialize ambient table
|
||||||
ambient_tbl = new fgINTERPTABLE(path);
|
ambient_tbl = new fgINTERPTABLE(path);
|
||||||
|
|
||||||
// build the path name to the diffuse lookup table
|
// build the path name to the diffuse lookup table
|
||||||
path[0] = '\0';
|
current_options.get_fg_root(path);
|
||||||
strcat(path, o->fg_root);
|
|
||||||
strcat(path, "/Scenery/");
|
strcat(path, "/Scenery/");
|
||||||
strcat(path, "Diffuse");
|
strcat(path, "Diffuse");
|
||||||
// initialize diffuse table
|
// initialize diffuse table
|
||||||
diffuse_tbl = new fgINTERPTABLE(path);
|
diffuse_tbl = new fgINTERPTABLE(path);
|
||||||
|
|
||||||
// build the path name to the sky lookup table
|
// build the path name to the sky lookup table
|
||||||
path[0] = '\0';
|
current_options.get_fg_root(path);
|
||||||
strcat(path, o->fg_root);
|
|
||||||
strcat(path, "/Scenery/");
|
strcat(path, "/Scenery/");
|
||||||
strcat(path, "Sky");
|
strcat(path, "Sky");
|
||||||
// initialize sky table
|
// initialize sky table
|
||||||
|
@ -167,6 +161,9 @@ void fgLightUpdate ( void ) {
|
||||||
|
|
||||||
|
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.11 1998/07/13 21:02:08 curt
|
||||||
|
// Wrote access functions for current fgOPTIONS.
|
||||||
|
//
|
||||||
// Revision 1.10 1998/07/08 14:48:38 curt
|
// Revision 1.10 1998/07/08 14:48:38 curt
|
||||||
// polar3d.h renamed to polar3d.hxx
|
// polar3d.h renamed to polar3d.hxx
|
||||||
//
|
//
|
||||||
|
|
Loading…
Add table
Reference in a new issue