diff --git a/Simulator/Autopilot/autopilot.cxx b/Simulator/Autopilot/autopilot.cxx index 279c13fbf..354a81bcd 100644 --- a/Simulator/Autopilot/autopilot.cxx +++ b/Simulator/Autopilot/autopilot.cxx @@ -240,6 +240,8 @@ static float TmpRollOutSmoothValue; static puDialogBox *APAdjustDialog; static puFrame *APAdjustFrame; static puText *APAdjustDialogMessage; +static puFont APAdjustLegendFont; +static puFont APAdjustLabelFont; static int DialogX = 40; static int DialogY = 100; @@ -477,10 +479,11 @@ void fgAPAdjustInit( void ) MaxAileronValue = APData->MaxAileron / MaxAileronAdjust; RollOutSmoothValue = APData->RollOutSmooth / RollOutSmoothAdjust; + puGetDefaultFonts ( &APAdjustLegendFont, &APAdjustLabelFont ); APAdjustDialog = new puDialogBox (DialogX, DialogY); { - int horiz_slider_height = puGetStringHeight () + - puGetStringDescender () + + int horiz_slider_height = puGetStringHeight (APAdjustLabelFont) + + puGetStringDescender (APAdjustLabelFont) + PUSTR_TGAP + PUSTR_BGAP+5; APAdjustFrame = new puFrame (0,0,230, 85+4*horiz_slider_height); diff --git a/Simulator/GUI/gui.cxx b/Simulator/GUI/gui.cxx index 8f2be6c6e..d3db56ff3 100644 --- a/Simulator/GUI/gui.cxx +++ b/Simulator/GUI/gui.cxx @@ -91,8 +91,8 @@ static puOneShot *YNdialogBoxOkButton = 0; static puOneShot *YNdialogBoxNoButton = 0; // Accessor CallBacks for external PUI Objects -extern void NewAltitude( puObject *cb ); -extern void NewHeading( puObject *cb ); +// extern void NewAltitude( puObject *cb ); +// extern void NewHeading( puObject *cb ); extern void fgAPAdjust( puObject * ); extern void fgLatLonFormatToggle( puObject *); @@ -512,7 +512,7 @@ puCallback viewSubmenuCb [] = { char *aircraftSubmenu [] = { "Autopilot", "Heading", "Altitude", "Navigation", "Communication", NULL}; puCallback aircraftSubmenuCb [] = { - fgAPAdjust, NewHeading, NewAltitude, fgLatLonFormatToggle, notCb, NULL }; + fgAPAdjust, notCb, notCb, fgLatLonFormatToggle, notCb, NULL }; char *environmentSubmenu [] = { "Airport", "Terrain", "Weather", NULL}; diff --git a/Simulator/Main/3dfx.sh b/Simulator/Main/3dfx.sh index 2a310ebf7..0e7b718be 100755 --- a/Simulator/Main/3dfx.sh +++ b/Simulator/Main/3dfx.sh @@ -16,12 +16,18 @@ if [ $WINDOW = "YES" ]; then export SST_VGA_PASS=1 export SST_NOSHUTDOWN=1 + + export SSTV2_VGA_PASS=1 + export SSTV2_NOSHUTDOWN=1 else # full screen export MESA_GLX_FX=fullscreen unset SST_VGA_PASS unset SST_NOSHUTDOWN + + unset SSTV2_VGA_PASS + unset SSTV2_NOSHUTDOWN fi export FX_GLIDE_NO_SPLASH=1 @@ -33,9 +39,18 @@ export SST_GRXCLK=57 export SST_GAMMA=1.0 export SST_SCREENREFRESH=60 +export SSTV2_FASTMEM=1 +export SSTV2_FASTPCIRD=1 +export SSTV2_GRXCLK=57 +export SSTV2_GAMMA=1.0 +export SSTV2_SCREENREFRESH=60 + # Enable this if you wand solid vswap - disable to measure speeds export SST_SWAP_EN_WAIT_ON_VSYNC=0 +export SSTV2_SWAP_EN_WAIT_ON_VSYNC=0 + # export SST_SWA_EN_WAIT_ON_VSYNC=1 +# export SSTV2_SWA_EN_WAIT_ON_VSYNC=1 echo executing $* diff --git a/Simulator/Main/GLUTkey.cxx b/Simulator/Main/GLUTkey.cxx index 5b8e608c7..3a097ad64 100644 --- a/Simulator/Main/GLUTkey.cxx +++ b/Simulator/Main/GLUTkey.cxx @@ -56,8 +56,8 @@ #include "options.hxx" #include "views.hxx" -extern void NewAltitude( puObject *cb ); -extern void NewHeading( puObject *cb ); +// extern void NewAltitude( puObject *cb ); +// extern void NewHeading( puObject *cb ); // Force an update of the sky and lighting parameters static void local_update_sky_and_lighting_params( void ) { @@ -374,12 +374,12 @@ void GLUTspecialkey(int k, int x, int y) { return; case GLUT_KEY_F11: // F11 Altitude Dialog. FG_LOG(FG_INPUT, FG_INFO, "Invoking Altitude call back function"); - NewAltitude( NULL ); + // NewAltitude( NULL ); //exit(1); return; case GLUT_KEY_F12: // F12 Heading Dialog... FG_LOG(FG_INPUT, FG_INFO, "Invoking Heading call back function"); - NewHeading( NULL ); + // NewHeading( NULL ); return; case GLUT_KEY_UP: if( fgAPAltitudeEnabled() || fgAPTerrainFollowEnabled() ) { diff --git a/Simulator/Main/fg_init.cxx b/Simulator/Main/fg_init.cxx index fa723fbe5..f569e5032 100644 --- a/Simulator/Main/fg_init.cxx +++ b/Simulator/Main/fg_init.cxx @@ -388,7 +388,7 @@ int fgInitSubsystems( void ) // above values fgFDMInit( current_options.get_flight_model(), cur_fdm_state, - 1.0 / DEFAULT_MODEL_HZ ); + 1.0 / DEFAULT_MODEL_HZ ); // I'm just sticking this here for now, it should probably move // eventually @@ -429,14 +429,18 @@ int fgInitSubsystems( void ) void fgReInitSubsystems( void ) { FGInterface *f = current_aircraft.fdm_state; -// fgLIGHT *l = &cur_light_params; -// fgTIME *t = &cur_time_params; FGView *v = ¤t_view; - - fgInitPosition(); + FGTime *t = FGTime::cur_time_params; + + int toggle_pause = t->getPause(); + + if( !toggle_pause ) + t->togglePauseMode(); + + fgInitPosition(); if( fgTileMgrInit() ) { - // Load the local scenery data - fgTileMgrUpdate(); + // Load the local scenery data + fgTileMgrUpdate(); } else { FG_LOG( FG_GENERAL, FG_ALERT, "Error in Tile Manager initialization!" ); exit(-1); @@ -462,11 +466,11 @@ void fgReInitSubsystems( void ) (sea_level_radius_meters * METER_TO_FEET) ); f->set_Sea_level_radius( sea_level_radius_meters * METER_TO_FEET ); - f->set_sin_cos_longitude(f->get_Longitude()); - f->set_sin_cos_latitude(f->get_Latitude()); + f->set_sin_cos_longitude(f->get_Longitude()); + f->set_sin_cos_latitude(f->get_Latitude()); - f->set_sin_lat_geocentric(sin(lat_geoc)); - f->set_cos_lat_geocentric(cos(lat_geoc)); + f->set_sin_lat_geocentric(sin(lat_geoc)); + f->set_cos_lat_geocentric(cos(lat_geoc)); // The following section sets up the flight model EOM parameters // and should really be read in from one or more files. @@ -500,7 +504,7 @@ void fgReInitSubsystems( void ) v->UpdateWorldToEye(f); fgFDMInit( current_options.get_flight_model(), cur_fdm_state, - 1.0 / DEFAULT_MODEL_HZ ); + 1.0 / DEFAULT_MODEL_HZ ); scenery.cur_elev = f->get_Runway_altitude() * FEET_TO_METER; @@ -508,6 +512,9 @@ void fgReInitSubsystems( void ) f->set_Altitude( f->get_Runway_altitude() + 3.758099 ); } - controls.reset_all(); - fgAPReset(); + controls.reset_all(); + fgAPReset(); + + if( !toggle_pause ) + t->togglePauseMode(); } diff --git a/Simulator/Main/options.cxx b/Simulator/Main/options.cxx index a9477ac25..5df50ddda 100644 --- a/Simulator/Main/options.cxx +++ b/Simulator/Main/options.cxx @@ -209,7 +209,14 @@ fgOPTIONS::fgOPTIONS() : void fgOPTIONS::toggle_panel() { - + + FGTime *t = FGTime::cur_time_params; + + int toggle_pause = t->getPause(); + + if( !toggle_pause ) + t->togglePauseMode(); + if( panel_status ) { panel_status = false; } else { @@ -220,9 +227,12 @@ fgOPTIONS::toggle_panel() { new FGPanel; fov *= 0.4232; } else { - fov *= (1.0 /0.4232); + fov *= (1.0 / 0.4232); } fgReshape( xsize, ysize); + + if( !toggle_pause ) + t->togglePauseMode(); } double @@ -306,19 +316,19 @@ fgOPTIONS::parse_time(const string& time_in) { long int fgOPTIONS::parse_date( const string& date) { - struct tm gmt; - char * date_str, num[256]; - int i; - // initialize to zero - gmt.tm_sec = 0; - gmt.tm_min = 0; - gmt.tm_hour = 0; - gmt.tm_mday = 0; - gmt.tm_mon = 0; - gmt.tm_year = 0; - gmt.tm_isdst = 0; // ignore daylight savingtime for the moment - date_str = (char *)date.c_str(); - // get year + struct tm gmt; + char * date_str, num[256]; + int i; + // initialize to zero + gmt.tm_sec = 0; + gmt.tm_min = 0; + gmt.tm_hour = 0; + gmt.tm_mday = 0; + gmt.tm_mon = 0; + gmt.tm_year = 0; + gmt.tm_isdst = 0; // ignore daylight savingtime for the moment + date_str = (char *)date.c_str(); + // get year if ( strlen(date_str) ) { i = 0; while ( (date_str[0] != ':') && (date_str[0] != '\0') ) { @@ -332,7 +342,7 @@ long int fgOPTIONS::parse_date( const string& date) num[i] = '\0'; gmt.tm_year = atoi(num) - 1900; } - // get month + // get month if ( strlen(date_str) ) { i = 0; while ( (date_str[0] != ':') && (date_str[0] != '\0') ) { @@ -690,8 +700,7 @@ int fgOPTIONS::parse_config_file( const string& path ) { FG_LOG( FG_GENERAL, FG_INFO, "Processing config file: " << path ); in >> skipcomment; - while ( !in.eof() ) - { + while ( !in.eof() ) { string line; #ifdef GETLINE_NEEDS_TERMINATOR diff --git a/Simulator/Main/views.hxx b/Simulator/Main/views.hxx index 22f84d063..332176bb3 100644 --- a/Simulator/Main/views.hxx +++ b/Simulator/Main/views.hxx @@ -241,6 +241,7 @@ public: inline double *get_surface_south() { return surface_south; } inline double *get_surface_east() { return surface_east; } inline double *get_local_up() { return local_up; } + inline double *get_view_forward() { return view_forward; } inline const MAT3mat *get_WORLD_TO_EYE() const { return &WORLD_TO_EYE; } inline GLfloat *get_MODEL_VIEW() { return MODEL_VIEW; } }; diff --git a/Simulator/Objects/obj.cxx b/Simulator/Objects/obj.cxx index 936d20a87..c20c397c4 100644 --- a/Simulator/Objects/obj.cxx +++ b/Simulator/Objects/obj.cxx @@ -67,6 +67,7 @@ FG_USING_STD(string); static double normals[FG_MAX_NODES][3]; +static double tex_coords[FG_MAX_NODES*3][3]; // given three points defining a triangle, calculate the normal @@ -135,8 +136,9 @@ int fgObjLoad( const string& path, fgTILE *t) { // GLfloat sgenparams[] = { 1.0, 0.0, 0.0, 0.0 }; GLint display_list = 0; int shading; - int in_fragment = 0, in_faces = 0, vncount; + int in_fragment = 0, in_faces = 0, vncount, vtcount; int n1 = 0, n2 = 0, n3 = 0, n4 = 0; + int tex; int last1 = 0, last2 = 0, odd = 0; double (*nodes)[3]; Point3D center; @@ -155,6 +157,7 @@ int fgObjLoad( const string& path, fgTILE *t) { in_fragment = 0; t->ncount = 0; vncount = 0; + vtcount = 0; t->bounding_radius = 0.0; nodes = t->nodes; center = t->center; @@ -273,6 +276,18 @@ int fgObjLoad( const string& path, fgTILE *t) { "Read too many vertex normals ... dying :-(" ); exit(-1); } + } else if ( token == "vt" ) { + // vertex texture coordinate + if ( vtcount < FG_MAX_NODES*3 ) { + in >> tex_coords[vtcount][0] + >> tex_coords[vtcount][1]; + vtcount++; + } else { + FG_LOG( FG_TERRAIN, FG_ALERT, + "Read too many vertex texture coords ... dying :-(" + ); + exit(-1); + } } else if ( token == "v" ) { // node (vertex) if ( t->ncount < FG_MAX_NODES ) { @@ -397,14 +412,28 @@ int fgObjLoad( const string& path, fgTILE *t) { in >> n1; xglNormal3dv(normals[n1]); - pp = calc_tex_coords(nodes[n1], center); - xglTexCoord2f(pp.lon(), pp.lat()); + if ( in.get( c ) && c == '/' ) { + in >> tex; + pp.setx( tex_coords[tex][0] ); + pp.sety( tex_coords[tex][1] ); + } else { + in.putback( c ); + pp = calc_tex_coords(nodes[n1], center); + } + xglTexCoord2f(pp.x(), pp.y()); xglVertex3dv(nodes[n1]); in >> n2; xglNormal3dv(normals[n2]); - pp = calc_tex_coords(nodes[n2], center); - xglTexCoord2f(pp.lon(), pp.lat()); + if ( in.get( c ) && c == '/' ) { + in >> tex; + pp.setx( tex_coords[tex][0] ); + pp.sety( tex_coords[tex][1] ); + } else { + in.putback( c ); + pp = calc_tex_coords(nodes[n2], center); + } + xglTexCoord2f(pp.x(), pp.y()); xglVertex3dv(nodes[n2]); // read all subsequent numbers until next thing isn't a number @@ -423,8 +452,15 @@ int fgObjLoad( const string& path, fgTILE *t) { // << n1 << "," << n2 << "," << n3 // << endl; xglNormal3dv(normals[n3]); - pp = calc_tex_coords(nodes[n3], center); - xglTexCoord2f(pp.lon(), pp.lat()); + if ( in.get( c ) && c == '/' ) { + in >> tex; + pp.setx( tex_coords[tex][0] ); + pp.sety( tex_coords[tex][1] ); + } else { + in.putback( c ); + pp = calc_tex_coords(nodes[n3], center); + } + xglTexCoord2f(pp.x(), pp.y()); xglVertex3dv(nodes[n3]); fragment.add_face(n1, n2, n3);