double angle;
GLfloat black[4] = { 0.0, 0.0, 0.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 };
l = &cur_light_params;
xglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE ) ;
xglHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST ) ;
// 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);
} else {
xglDisable( GL_TEXTURE_2D );
- xglMaterialfv (GL_FRONT, GL_AMBIENT, terrain_color);
- xglMaterialfv (GL_FRONT, GL_DIFFUSE, terrain_color);
+ // xglMaterialfv (GL_FRONT, GL_AMBIENT, terrain_color);
+ // xglMaterialfv (GL_FRONT, GL_DIFFUSE, terrain_color);
+ xglMaterialfv (GL_FRONT, GL_AMBIENT, white);
+ xglMaterialfv (GL_FRONT, GL_DIFFUSE, white);
}
fgTileMgrRender();
// $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
// Modifications to use the new fgEVENT_MGR class.
//
// load the data
int fgAIRPORTS::load( char *file ) {
+ fgAIRPORT a;
fgOPTIONS *o;
char path[256], fgpath[256], line[256];
char id[5];
- double lon, lat, elev;
+ string id_str;
fgFile f;
o = ¤t_options;
}
}
- size = 0;
while ( fggets(f, line, 250) != NULL ) {
// printf("%s", line);
- if ( size < MAX_AIRPORTS ) {
- sscanf( line, "%s %lf %lf %lfl\n", id, &lon, &lat, &elev );
- strcpy(airports[size].id, id);
- airports[size].longitude = lon;
- airports[size].latitude = lat;
- airports[size].elevation = elev;
- } else {
- fgPrintf( FG_GENERAL, FG_EXIT,
- "Overran size of airport list in fgAIRPORTS::load()\n");
- }
-
- size++;
+ sscanf( line, "%s %lf %lf %lfl\n", id, &a.longitude, &a.latitude,
+ &a.elevation );
+ id_str = id;
+ airports[id_str] = a;
}
fgclose(f);
// search for the specified id
fgAIRPORT fgAIRPORTS::search( char *id ) {
+ map < string, fgAIRPORT, less<string> > :: iterator find;
fgAIRPORT a;
- int i;
- for ( i = 0; i < size; i++ ) {
- if ( strcmp(airports[i].id, id) == 0 ) {
- return(airports[i]);
- }
+ find = airports.find(id);
+ if ( find == airports.end() ) {
+ // not found
+ a.longitude = a.latitude = a.elevation = 0;
+ } else {
+ a = (*find).second;
}
- strcpy(a.id, "none");
return(a);
}
// $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
// Root path info moved to fgOPTIONS.
//
#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 {
- char id[5];
+ // char id[5];
double longitude, latitude, elevation;
} fgAIRPORT;
class fgAIRPORTS {
- fgAIRPORT airports[MAX_AIRPORTS];
- int size;
+ map < string, fgAIRPORT, less<string> > airports;
public:
// $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
// Added an command line option to set starting position based on airport ID.
//
airports.load("Airports");
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,
"Failed to find %s in database.\n", o->airport_id);
} else {
// $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
// Modifications to use the new fgEVENT_MGR class.
//