Tweaked material properties & lighting a bit in GLUTmain.cxx.
Read airport list into a "map" STL for dynamic list sizing and fast tree based lookups.
This commit is contained in:
parent
371806f033
commit
d6f20aa8be
4 changed files with 52 additions and 29 deletions
|
@ -339,7 +339,6 @@ static void fgRenderFrame( void ) {
|
||||||
double angle;
|
double angle;
|
||||||
GLfloat black[4] = { 0.0, 0.0, 0.0, 1.0 };
|
GLfloat black[4] = { 0.0, 0.0, 0.0, 1.0 };
|
||||||
GLfloat white[4] = { 1.0, 1.0, 1.0, 1.0 };
|
GLfloat white[4] = { 1.0, 1.0, 1.0, 1.0 };
|
||||||
GLfloat gray90[4] = { 0.9, 0.9, 0.9, 1.0 };
|
|
||||||
GLfloat terrain_color[4] = { 0.54, 0.44, 0.29, 1.0 };
|
GLfloat terrain_color[4] = { 0.54, 0.44, 0.29, 1.0 };
|
||||||
|
|
||||||
l = &cur_light_params;
|
l = &cur_light_params;
|
||||||
|
@ -429,12 +428,14 @@ static void fgRenderFrame( void ) {
|
||||||
xglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE ) ;
|
xglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE ) ;
|
||||||
xglHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST ) ;
|
xglHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST ) ;
|
||||||
// set base color (I don't think this is doing anything here)
|
// set base color (I don't think this is doing anything here)
|
||||||
xglMaterialfv (GL_FRONT, GL_AMBIENT, gray90);
|
xglMaterialfv (GL_FRONT, GL_AMBIENT, white);
|
||||||
xglMaterialfv (GL_FRONT, GL_DIFFUSE, white);
|
xglMaterialfv (GL_FRONT, GL_DIFFUSE, white);
|
||||||
} else {
|
} else {
|
||||||
xglDisable( GL_TEXTURE_2D );
|
xglDisable( GL_TEXTURE_2D );
|
||||||
xglMaterialfv (GL_FRONT, GL_AMBIENT, terrain_color);
|
// xglMaterialfv (GL_FRONT, GL_AMBIENT, terrain_color);
|
||||||
xglMaterialfv (GL_FRONT, GL_DIFFUSE, terrain_color);
|
// xglMaterialfv (GL_FRONT, GL_DIFFUSE, terrain_color);
|
||||||
|
xglMaterialfv (GL_FRONT, GL_AMBIENT, white);
|
||||||
|
xglMaterialfv (GL_FRONT, GL_DIFFUSE, white);
|
||||||
}
|
}
|
||||||
|
|
||||||
fgTileMgrRender();
|
fgTileMgrRender();
|
||||||
|
@ -778,6 +779,11 @@ extern "C" {
|
||||||
|
|
||||||
|
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.18 1998/05/29 20:37:19 curt
|
||||||
|
// Tweaked material properties & lighting a bit in GLUTmain.cxx.
|
||||||
|
// Read airport list into a "map" STL for dynamic list sizing and fast tree
|
||||||
|
// based lookups.
|
||||||
|
//
|
||||||
// Revision 1.17 1998/05/22 21:28:52 curt
|
// Revision 1.17 1998/05/22 21:28:52 curt
|
||||||
// Modifications to use the new fgEVENT_MGR class.
|
// Modifications to use the new fgEVENT_MGR class.
|
||||||
//
|
//
|
||||||
|
|
|
@ -41,10 +41,11 @@ fgAIRPORTS::fgAIRPORTS( void ) {
|
||||||
|
|
||||||
// load the data
|
// load the data
|
||||||
int fgAIRPORTS::load( char *file ) {
|
int fgAIRPORTS::load( char *file ) {
|
||||||
|
fgAIRPORT a;
|
||||||
fgOPTIONS *o;
|
fgOPTIONS *o;
|
||||||
char path[256], fgpath[256], line[256];
|
char path[256], fgpath[256], line[256];
|
||||||
char id[5];
|
char id[5];
|
||||||
double lon, lat, elev;
|
string id_str;
|
||||||
fgFile f;
|
fgFile f;
|
||||||
|
|
||||||
o = ¤t_options;
|
o = ¤t_options;
|
||||||
|
@ -65,22 +66,13 @@ int fgAIRPORTS::load( char *file ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
size = 0;
|
|
||||||
while ( fggets(f, line, 250) != NULL ) {
|
while ( fggets(f, line, 250) != NULL ) {
|
||||||
// printf("%s", line);
|
// printf("%s", line);
|
||||||
|
|
||||||
if ( size < MAX_AIRPORTS ) {
|
sscanf( line, "%s %lf %lf %lfl\n", id, &a.longitude, &a.latitude,
|
||||||
sscanf( line, "%s %lf %lf %lfl\n", id, &lon, &lat, &elev );
|
&a.elevation );
|
||||||
strcpy(airports[size].id, id);
|
id_str = id;
|
||||||
airports[size].longitude = lon;
|
airports[id_str] = a;
|
||||||
airports[size].latitude = lat;
|
|
||||||
airports[size].elevation = elev;
|
|
||||||
} else {
|
|
||||||
fgPrintf( FG_GENERAL, FG_EXIT,
|
|
||||||
"Overran size of airport list in fgAIRPORTS::load()\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
size++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fgclose(f);
|
fgclose(f);
|
||||||
|
@ -91,16 +83,17 @@ int fgAIRPORTS::load( char *file ) {
|
||||||
|
|
||||||
// search for the specified id
|
// search for the specified id
|
||||||
fgAIRPORT fgAIRPORTS::search( char *id ) {
|
fgAIRPORT fgAIRPORTS::search( char *id ) {
|
||||||
|
map < string, fgAIRPORT, less<string> > :: iterator find;
|
||||||
fgAIRPORT a;
|
fgAIRPORT a;
|
||||||
int i;
|
|
||||||
|
|
||||||
for ( i = 0; i < size; i++ ) {
|
find = airports.find(id);
|
||||||
if ( strcmp(airports[i].id, id) == 0 ) {
|
if ( find == airports.end() ) {
|
||||||
return(airports[i]);
|
// not found
|
||||||
}
|
a.longitude = a.latitude = a.elevation = 0;
|
||||||
|
} else {
|
||||||
|
a = (*find).second;
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy(a.id, "none");
|
|
||||||
return(a);
|
return(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,6 +104,11 @@ fgAIRPORTS::~fgAIRPORTS( void ) {
|
||||||
|
|
||||||
|
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.5 1998/05/29 20:37:22 curt
|
||||||
|
// Tweaked material properties & lighting a bit in GLUTmain.cxx.
|
||||||
|
// Read airport list into a "map" STL for dynamic list sizing and fast tree
|
||||||
|
// based lookups.
|
||||||
|
//
|
||||||
// Revision 1.4 1998/05/13 18:26:25 curt
|
// Revision 1.4 1998/05/13 18:26:25 curt
|
||||||
// Root path info moved to fgOPTIONS.
|
// Root path info moved to fgOPTIONS.
|
||||||
//
|
//
|
||||||
|
|
|
@ -34,18 +34,25 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#define MAX_AIRPORTS 10000
|
#include <map.h> // STL associative "array"
|
||||||
|
|
||||||
|
#if defined(__CYGWIN32__)
|
||||||
|
# include <string> // Standard C++ string library
|
||||||
|
#elif defined(WIN32)
|
||||||
|
# include <string.h> // Standard C++ string library
|
||||||
|
#else
|
||||||
|
# include <std/string.h> // Standard C++ string library
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char id[5];
|
// char id[5];
|
||||||
double longitude, latitude, elevation;
|
double longitude, latitude, elevation;
|
||||||
} fgAIRPORT;
|
} fgAIRPORT;
|
||||||
|
|
||||||
|
|
||||||
class fgAIRPORTS {
|
class fgAIRPORTS {
|
||||||
fgAIRPORT airports[MAX_AIRPORTS];
|
map < string, fgAIRPORT, less<string> > airports;
|
||||||
int size;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -68,6 +75,11 @@ public:
|
||||||
|
|
||||||
|
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.2 1998/05/29 20:37:22 curt
|
||||||
|
// Tweaked material properties & lighting a bit in GLUTmain.cxx.
|
||||||
|
// Read airport list into a "map" STL for dynamic list sizing and fast tree
|
||||||
|
// based lookups.
|
||||||
|
//
|
||||||
// Revision 1.1 1998/04/25 15:11:11 curt
|
// Revision 1.1 1998/04/25 15:11:11 curt
|
||||||
// Added an command line option to set starting position based on airport ID.
|
// Added an command line option to set starting position based on airport ID.
|
||||||
//
|
//
|
||||||
|
|
|
@ -146,7 +146,9 @@ int fgInitPosition( void ) {
|
||||||
|
|
||||||
airports.load("Airports");
|
airports.load("Airports");
|
||||||
a = airports.search(o->airport_id);
|
a = airports.search(o->airport_id);
|
||||||
if ( strcmp(a.id, "none") == 0 ) {
|
if ( (fabs(a.longitude) < FG_EPSILON) &&
|
||||||
|
(fabs(a.latitude) < 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", o->airport_id);
|
||||||
} else {
|
} else {
|
||||||
|
@ -384,6 +386,11 @@ int fgInitSubsystems( void ) {
|
||||||
|
|
||||||
|
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.16 1998/05/29 20:37:24 curt
|
||||||
|
// Tweaked material properties & lighting a bit in GLUTmain.cxx.
|
||||||
|
// Read airport list into a "map" STL for dynamic list sizing and fast tree
|
||||||
|
// based lookups.
|
||||||
|
//
|
||||||
// Revision 1.15 1998/05/22 21:28:53 curt
|
// Revision 1.15 1998/05/22 21:28:53 curt
|
||||||
// Modifications to use the new fgEVENT_MGR class.
|
// Modifications to use the new fgEVENT_MGR class.
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in a new issue