1
0
Fork 0

Activated gyro drift ... look out!

Cleaned a bit of cruft out of gui.[ch]xx
Cleaned up win_ratio() and fov code to make more sense and be a bit more
consistant and robust and less buggy and less susceptible to screw ups.
Panel is activated now by default, HUD is off by default.
This commit is contained in:
curt 2000-07-22 23:25:49 +00:00
parent 81b266aa4a
commit fc84045169
7 changed files with 23 additions and 47 deletions

View file

@ -323,7 +323,7 @@ void FGSteam::_CatchUp()
*/ */
if ( _UpdatesPending > 999999 ) if ( _UpdatesPending > 999999 )
the_DG_err = FGBFI::getMagVar(); the_DG_err = FGBFI::getMagVar();
the_DG_degps = 0.0; /* HACK! */ the_DG_degps = 0.01; /* HACK! */
if (dt<1.0) the_DG_err += dt * the_DG_degps; if (dt<1.0) the_DG_err += dt * the_DG_degps;
the_DG_deg = FGBFI::getHeading () - the_DG_err; the_DG_deg = FGBFI::getHeading () - the_DG_err;

View file

@ -667,26 +667,6 @@ void mkDialog (const char *txt)
FG_PUSH_PUI_DIALOG( dialogBox ); FG_PUSH_PUI_DIALOG( dialogBox );
} }
// Repair any damage done to the Panel by other Gui Items
void guiFixPanel( void )
{
#if 0 // this function does nothing anyway
bool freeze = globals->get_freeze();
if ( current_options.get_panel_status() ) {
// FGView *v = &current_view;
if( !freeze )
globals->set_freeze( true );
// we must have some something here at some point but this
// function does nothing now.
if( !freeze )
globals->set_freeze( false );
}
#endif
}
// Toggle the Menu and Mouse display state // Toggle the Menu and Mouse display state
void guiToggleMenu(void) void guiToggleMenu(void)
{ {

View file

@ -37,7 +37,6 @@ extern void BusyCursor( int restore );
extern void guiToggleMenu(void); extern void guiToggleMenu(void);
extern void mkDialog(const char *txt); extern void mkDialog(const char *txt);
extern void ConfirmExitDialog(void); extern void ConfirmExitDialog(void);
extern void guiFixPanel( void );
extern void fgDumpSnapShot(); extern void fgDumpSnapShot();
@ -66,7 +65,6 @@ extern char *gui_msg_RESET; // "RESET"
#define FG_POP_PUI_DIALOG( X ) \ #define FG_POP_PUI_DIALOG( X ) \
(X)->hide(); \ (X)->hide(); \
puPopLiveInterface(); \ puPopLiveInterface(); \
guiFixPanel(); \
maybeToggleMouse(); maybeToggleMouse();
// Finalize Dialog Box Construction // Finalize Dialog Box Construction

View file

@ -480,7 +480,8 @@ void fgRenderFrame( void ) {
// glMatrixMode( GL_PROJECTION ); // glMatrixMode( GL_PROJECTION );
// glLoadIdentity(); // glLoadIdentity();
float fov = current_options.get_fov(); float fov = current_options.get_fov();
ssgSetFOV(fov * current_view.get_win_ratio(), fov); // ssgSetFOV(fov * current_view.get_win_ratio(), fov);
ssgSetFOV(fov, fov * current_view.get_win_ratio());
double agl = current_aircraft.fdm_state->get_Altitude() * FEET_TO_METER double agl = current_aircraft.fdm_state->get_Altitude() * FEET_TO_METER
- scenery.cur_elev; - scenery.cur_elev;
@ -1111,12 +1112,11 @@ static void fgIdleFunction ( void ) {
// options.cxx needs to see this for toggle_panel() // options.cxx needs to see this for toggle_panel()
// Handle new window size or exposure // Handle new window size or exposure
void fgReshape( int width, int height ) { void fgReshape( int width, int height ) {
if ( ! current_options.get_panel_status() ) { if ( ! current_options.get_panel_status() || idle_state != 1000 ) {
current_view.set_win_ratio( (GLfloat) width / (GLfloat) height ); current_view.set_win_ratio( height / width );
glViewport(0, 0 , (GLint)(width), (GLint)(height) ); glViewport(0, 0 , (GLint)(width), (GLint)(height) );
} else { } else {
current_view.set_win_ratio( (GLfloat) width / current_view.set_win_ratio( (height*0.4232) / width );
((GLfloat) (height)*0.4232) );
glViewport(0, (GLint)((height)*0.5768), glViewport(0, (GLint)((height)*0.5768),
(GLint)(width), (GLint)((height)*0.4232) ); (GLint)(width), (GLint)((height)*0.4232) );
} }
@ -1132,7 +1132,8 @@ void fgReshape( int width, int height ) {
// glViewport ( 0, 0, width, height ); // glViewport ( 0, 0, width, height );
float fov = current_options.get_fov(); float fov = current_options.get_fov();
ssgSetFOV(fov * current_view.get_win_ratio(), fov); // ssgSetFOV(fov * current_view.get_win_ratio(), fov);
ssgSetFOV(fov, fov * current_view.get_win_ratio());
fgHUDReshape(); fgHUDReshape();

View file

@ -160,8 +160,8 @@ fgOPTIONS::fgOPTIONS() :
auto_coordination(FG_AUTO_COORD_NOT_SPECIFIED), auto_coordination(FG_AUTO_COORD_NOT_SPECIFIED),
// Features // Features
hud_status(1), hud_status(0),
panel_status(0), panel_status(1),
sound(1), sound(1),
anti_alias_hud(0), anti_alias_hud(0),
@ -182,8 +182,8 @@ fgOPTIONS::fgOPTIONS() :
skyblend(1), skyblend(1),
textures(1), textures(1),
wireframe(0), wireframe(0),
xsize(640), xsize(800),
ysize(480), ysize(600),
bpp(16), bpp(16),
view_mode(FG_VIEW_PILOT), view_mode(FG_VIEW_PILOT),
@ -257,11 +257,14 @@ fgOPTIONS::toggle_panel() {
if ( current_panel != NULL ) if ( current_panel != NULL )
current_panel->setVisibility(true); current_panel->setVisibility(true);
} }
if ( panel_status ) {
// new rule .. "fov" shouldn't get messed with like this.
/* if ( panel_status ) {
fov *= 0.4232; fov *= 0.4232;
} else { } else {
fov *= (1.0 / 0.4232); fov *= (1.0 / 0.4232);
} } */
// fgReshape( xsize, ysize); // fgReshape( xsize, ysize);
fgReshape( current_view.get_winWidth(), current_view.get_winHeight() ); fgReshape( current_view.get_winWidth(), current_view.get_winHeight() );
@ -634,7 +637,7 @@ int fgOPTIONS::parse_option( const string& arg ) {
panel_status = true; panel_status = true;
if ( current_panel != NULL ) if ( current_panel != NULL )
current_panel->setVisibility(true); current_panel->setVisibility(true);
fov *= 0.4232; // fov *= 0.4232; /* NO!!! */
} else if ( arg == "--disable-sound" ) { } else if ( arg == "--disable-sound" ) {
sound = false; sound = false;
} else if ( arg == "--enable-sound" ) { } else if ( arg == "--enable-sound" ) {

View file

@ -42,10 +42,6 @@
#include "views.hxx" #include "views.hxx"
// temporary (hopefully) hack
static int panel_hist = 0;
// This is a record containing current view parameters for the current // This is a record containing current view parameters for the current
// aircraft position // aircraft position
FGView pilot_view; FGView pilot_view;
@ -72,10 +68,9 @@ void FGView::Init( void ) {
winHeight = current_options.get_ysize(); winHeight = current_options.get_ysize();
if ( ! current_options.get_panel_status() ) { if ( ! current_options.get_panel_status() ) {
set_win_ratio( (GLfloat) winWidth / (GLfloat) winHeight ); set_win_ratio( winHeight / winWidth );
} else { } else {
set_win_ratio( (GLfloat) winWidth / set_win_ratio( (winHeight*0.4232) / winWidth );
((GLfloat) (winHeight)*0.4232) );
} }
// This never changes -- NHV // This never changes -- NHV
@ -137,6 +132,7 @@ inline static void fgMakeLOCAL( sgMat4 dst, const double Theta,
} }
#endif #endif
// Update the view volume, position, and orientation // Update the view volume, position, and orientation
void FGView::UpdateViewParams( const FGInterface& f ) { void FGView::UpdateViewParams( const FGInterface& f ) {
UpdateViewMath(f); UpdateViewMath(f);
@ -147,8 +143,6 @@ void FGView::UpdateViewParams( const FGInterface& f ) {
xglViewport(0, (GLint)((winHeight)*0.5768), (GLint)(winWidth), xglViewport(0, (GLint)((winHeight)*0.5768), (GLint)(winWidth),
(GLint)((winHeight)*0.4232) ); (GLint)((winHeight)*0.4232) );
} }
panel_hist = current_options.get_panel_status();
} }

View file

@ -64,7 +64,7 @@ public:
bool update_fov; bool update_fov;
// fov of view is specified in the y direction, win_ratio is used to // fov of view is specified in the y direction, win_ratio is used to
// calculate the fov in the X direction = width/height // calculate the fov in the X direction = width / height
double win_ratio; double win_ratio;
// width & height of window // width & height of window