1
0
Fork 0

Moved winWidth and winHeight out of FGViewer since these are set on a

per-application level.  We can have multiple viewers ...
Cleaned up fov mistake on startup with panel activated.
This commit is contained in:
curt 2000-10-19 23:09:33 +00:00
parent 01c44cbb99
commit 152a5902c8
26 changed files with 84 additions and 106 deletions

View file

@ -33,8 +33,6 @@
#include <simgear/debug/logstream.hxx> #include <simgear/debug/logstream.hxx>
#include <simgear/misc/fgstream.hxx> #include <simgear/misc/fgstream.hxx>
#include <Main/options.hxx>
#include STL_STRING #include STL_STRING
#include STL_FUNCTIONAL #include STL_FUNCTIONAL
#include STL_ALGORITHM #include STL_ALGORITHM

View file

@ -42,8 +42,6 @@
#include <simgear/debug/logstream.hxx> #include <simgear/debug/logstream.hxx>
#include <simgear/misc/fgstream.hxx> #include <simgear/misc/fgstream.hxx>
#include <Main/options.hxx>
#include STL_STRING #include STL_STRING
#include STL_FUNCTIONAL #include STL_FUNCTIONAL
#include STL_ALGORITHM #include STL_ALGORITHM

View file

@ -41,7 +41,6 @@
#include <Main/bfi.hxx> #include <Main/bfi.hxx>
#include <Main/fg_init.hxx> #include <Main/fg_init.hxx>
#include <Main/globals.hxx> #include <Main/globals.hxx>
#include <Main/options.hxx>
#include <Navaids/fixlist.hxx> #include <Navaids/fixlist.hxx>
#include "auto_gui.hxx" #include "auto_gui.hxx"

View file

@ -38,7 +38,6 @@
#include <FDM/flight.hxx> #include <FDM/flight.hxx>
#include <Main/bfi.hxx> #include <Main/bfi.hxx>
#include <Main/globals.hxx> #include <Main/globals.hxx>
#include <Main/options.hxx>
#include <Scenery/scenery.hxx> #include <Scenery/scenery.hxx>
#include "newauto.hxx" #include "newauto.hxx"

View file

@ -30,7 +30,7 @@
#endif #endif
#include <GL/glut.h> #include <GL/glut.h>
#include <simgear/xgl/xgl.h> // #include <simgear/xgl/xgl.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
@ -45,7 +45,6 @@
#include <Include/general.hxx> #include <Include/general.hxx>
#include <FDM/ADA.hxx> #include <FDM/ADA.hxx>
#include <Main/globals.hxx> #include <Main/globals.hxx>
#include <Main/options.hxx>
#include <Scenery/scenery.hxx> #include <Scenery/scenery.hxx>
#include <Time/fg_timer.hxx> #include <Time/fg_timer.hxx>
#include <GUI/gui.h> #include <GUI/gui.h>
@ -700,8 +699,8 @@ void fgCockpitUpdate( void ) {
"Cockpit: code " << ac_cockpit->code() << " status " "Cockpit: code " << ac_cockpit->code() << " status "
<< ac_cockpit->status() ); << ac_cockpit->status() );
int iwidth = globals->get_current_view()->get_winWidth(); int iwidth = globals->get_options()->get_xsize();
int iheight = globals->get_current_view()->get_winHeight(); int iheight = globals->get_options()->get_ysize();
float width = iwidth; float width = iwidth;
float height = iheight; float height = iheight;
@ -721,33 +720,35 @@ void fgCockpitUpdate( void ) {
// sprintf(buf,"%-4.1f %7.0f %7.0f", fps, tris, culled); // sprintf(buf,"%-4.1f %7.0f %7.0f", fps, tris, culled);
sprintf(buf,"%-5.1f", fps); sprintf(buf,"%-5.1f", fps);
glMatrixMode(GL_PROJECTION); glMatrixMode( GL_PROJECTION );
glPushMatrix(); glPushMatrix();
glLoadIdentity(); glLoadIdentity();
gluOrtho2D(0, width, 0, height); gluOrtho2D( 0, globals->get_options()->get_xsize(),
glMatrixMode(GL_MODELVIEW); 0, globals->get_options()->get_ysize() );
glMatrixMode( GL_MODELVIEW );
glPushMatrix(); glPushMatrix();
glLoadIdentity(); glLoadIdentity();
glDisable(GL_DEPTH_TEST); glDisable( GL_DEPTH_TEST );
glDisable(GL_LIGHTING); glDisable( GL_LIGHTING );
glColor3f (0.9, 0.4, 0.2); glColor3f( 0.9, 0.4, 0.2 );
guiFnt.drawString( buf, guiFnt.drawString( buf,
// width/2 - guiFnt.getStringWidth(buf)/2,
int(width - guiFnt.getStringWidth(buf) - 10), int(width - guiFnt.getStringWidth(buf) - 10),
10 ); 10 );
glEnable(GL_DEPTH_TEST); glEnable( GL_DEPTH_TEST );
glEnable(GL_LIGHTING); glEnable( GL_LIGHTING );
glMatrixMode(GL_PROJECTION); glMatrixMode( GL_PROJECTION );
glPopMatrix(); glPopMatrix();
glMatrixMode(GL_MODELVIEW); glMatrixMode( GL_MODELVIEW );
glPopMatrix(); glPopMatrix();
} }
#endif // #ifdef DISPLAY_COUNTER #endif // #ifdef DISPLAY_COUNTER
xglViewport( 0, 0, iwidth, iheight ); glViewport( 0, 0,
globals->get_options()->get_xsize(),
globals->get_options()->get_ysize() );
if (current_panel != 0) if (current_panel != 0)
current_panel->update(); current_panel->update();

View file

@ -46,7 +46,7 @@
#include <Aircraft/aircraft.hxx> #include <Aircraft/aircraft.hxx>
#include <Autopilot/newauto.hxx> #include <Autopilot/newauto.hxx>
#include <GUI/gui.h> #include <GUI/gui.h>
#include <Main/options.hxx> #include <Main/globals.hxx>
#ifdef FG_NETWORK_OLK #ifdef FG_NETWORK_OLK
#include <NetworkOLK/network.h> #include <NetworkOLK/network.h>
#endif #endif

View file

@ -34,7 +34,6 @@
#include <simgear/debug/logstream.hxx> #include <simgear/debug/logstream.hxx>
#include <simgear/misc/fgpath.hxx> #include <simgear/misc/fgpath.hxx>
#include <Main/globals.hxx> #include <Main/globals.hxx>
#include <Main/options.hxx>
#include <Objects/texload.h> #include <Objects/texload.h>
#include "hud.hxx" #include "hud.hxx"
@ -305,8 +304,8 @@ FGPanel::doMouseAction (int button, int updown, int x, int y)
} }
// Scale for the real window size. // Scale for the real window size.
x = int(((float)x / globals->get_current_view()->get_winWidth()) * _winw); x = int(((float)x / globals->get_options()->get_xsize()) * _winw);
y = int(_winh - (((float)y / globals->get_current_view()->get_winHeight()) y = int(_winh - (((float)y / globals->get_options()->get_ysize())
* _winh)); * _winh));
// Adjust for offsets. // Adjust for offsets.

View file

@ -33,8 +33,8 @@
#include <simgear/math/sg_types.hxx> #include <simgear/math/sg_types.hxx>
#include <simgear/misc/props.hxx> #include <simgear/misc/props.hxx>
#include <Aircraft/aircraft.hxx> #include <Aircraft/aircraft.hxx>
#include <Main/options.hxx>
#include <Main/bfi.hxx> #include <Main/bfi.hxx>
#include <Main/globals.hxx>
#include <NetworkOLK/features.hxx> #include <NetworkOLK/features.hxx>
FG_USING_NAMESPACE(std); FG_USING_NAMESPACE(std);

View file

@ -52,7 +52,7 @@ HISTORY
#include <Aircraft/aircraft.hxx> #include <Aircraft/aircraft.hxx>
#include <Controls/controls.hxx> #include <Controls/controls.hxx>
#include <Main/options.hxx> #include <Main/globals.hxx>
#include "Balloon.h" #include "Balloon.h"

View file

@ -38,7 +38,7 @@
#include <Aircraft/aircraft.hxx> #include <Aircraft/aircraft.hxx>
#include <Controls/controls.hxx> #include <Controls/controls.hxx>
#include <Main/options.hxx> #include <Main/globals.hxx>
#include <FDM/JSBSim/FGFDMExec.h> #include <FDM/JSBSim/FGFDMExec.h>
#include <FDM/JSBSim/FGAircraft.h> #include <FDM/JSBSim/FGAircraft.h>

View file

@ -28,7 +28,7 @@
#include <simgear/math/sg_geodesy.hxx> #include <simgear/math/sg_geodesy.hxx>
#include <FDM/LaRCsim/ls_interface.h> #include <FDM/LaRCsim/ls_interface.h>
#include <Main/options.hxx> #include <Main/globals.hxx>
#include <Time/timestamp.hxx> #include <Time/timestamp.hxx>
#include "External.hxx" #include "External.hxx"

View file

@ -68,7 +68,6 @@
#include <Main/fg_init.hxx> #include <Main/fg_init.hxx>
#include <Main/fg_io.hxx> #include <Main/fg_io.hxx>
#include <Main/globals.hxx> #include <Main/globals.hxx>
#include <Main/options.hxx>
#include <Main/save.hxx> #include <Main/save.hxx>
#ifdef FG_NETWORK_OLK #ifdef FG_NETWORK_OLK
#include <NetworkOLK/network.h> #include <NetworkOLK/network.h>
@ -299,8 +298,8 @@ static inline void TurnCursorOn( void )
} }
#endif #endif
#if defined(X_CURSOR_TWEAKS) #if defined(X_CURSOR_TWEAKS)
glutWarpPointer( globals->get_current_view()->get_winWidth()/2, glutWarpPointer( globals->get_options()->get_xsize()/2,
globals->get_current_view()->get_winHeight()/2); globals->get_options()->get_ysize()/2);
#endif #endif
} }
@ -310,8 +309,8 @@ static inline void TurnCursorOff( void )
#if defined(WIN32_CURSOR_TWEAKS) #if defined(WIN32_CURSOR_TWEAKS)
glutSetCursor(GLUT_CURSOR_NONE); glutSetCursor(GLUT_CURSOR_NONE);
#elif defined(X_CURSOR_TWEAKS) #elif defined(X_CURSOR_TWEAKS)
glutWarpPointer( globals->get_current_view()->get_winWidth(), glutWarpPointer( globals->get_options()->get_xsize(),
globals->get_current_view()->get_winHeight()); globals->get_options()->get_ysize());
#endif #endif
} }
@ -382,8 +381,8 @@ void guiMotionFunc ( int x, int y )
// reset left click MOUSE_VIEW toggle feature // reset left click MOUSE_VIEW toggle feature
_mVtoggle = 0; _mVtoggle = 0;
ww = globals->get_current_view()->get_winWidth(); ww = globals->get_options()->get_xsize();
wh = globals->get_current_view()->get_winHeight(); wh = globals->get_options()->get_ysize();
switch (mouse_mode) { switch (mouse_mode) {
case MOUSE_YOKE: case MOUSE_YOKE:
@ -558,10 +557,11 @@ void guiMouseFunc(int button, int updown, int x, int y)
_quat[1] = curquat[1]; _quat[1] = curquat[1];
_quat[2] = curquat[2]; _quat[2] = curquat[2];
_quat[3] = curquat[3]; _quat[3] = curquat[3];
x = globals->get_current_view()->get_winWidth()/2; x = globals->get_options()->get_xsize()/2;
y = globals->get_current_view()->get_winHeight()/2; y = globals->get_options()->get_ysize()/2;
Quat0(); Quat0();
_view_offset = globals->get_current_view()->get_goal_view_offset(); _view_offset =
globals->get_current_view()->get_goal_view_offset();
globals->get_current_view()->set_goal_view_offset(0.0); globals->get_current_view()->set_goal_view_offset(0.0);
#ifdef NO_SMOOTH_MOUSE_VIEW #ifdef NO_SMOOTH_MOUSE_VIEW
globals->get_current_view()->set_view_offset(0.0); globals->get_current_view()->set_view_offset(0.0);
@ -580,8 +580,8 @@ void guiMouseFunc(int button, int updown, int x, int y)
_savedX = x; _savedX = x;
_savedY = y; _savedY = y;
// start with zero point in center of screen // start with zero point in center of screen
_mX = globals->get_current_view()->get_winWidth()/2; _mX = globals->get_options()->get_xsize()/2;
_mY = globals->get_current_view()->get_winHeight()/2; _mY = globals->get_options()->get_ysize()/2;
// try to have the MOUSE_YOKE position // try to have the MOUSE_YOKE position
// reflect the current stick position // reflect the current stick position
@ -597,8 +597,8 @@ void guiMouseFunc(int button, int updown, int x, int y)
case MOUSE_YOKE: case MOUSE_YOKE:
mouse_mode = MOUSE_VIEW; mouse_mode = MOUSE_VIEW;
globals->get_options()->set_control_mode( FGOptions::FG_JOYSTICK ); globals->get_options()->set_control_mode( FGOptions::FG_JOYSTICK );
x = globals->get_current_view()->get_winWidth()/2; x = globals->get_options()->get_xsize()/2;
y = globals->get_current_view()->get_winHeight()/2; y = globals->get_options()->get_ysize()/2;
_mVtoggle = 0; _mVtoggle = 0;
Quat0(); Quat0();
build_rotmatrix(quat_mat, curquat); build_rotmatrix(quat_mat, curquat);
@ -966,8 +966,8 @@ void fgDumpSnapShot () {
} }
fgInitVisuals(); fgInitVisuals();
fgReshape( globals->get_current_view()->get_winWidth(), fgReshape( globals->get_options()->get_xsize(),
globals->get_current_view()->get_winHeight() ); globals->get_options()->get_ysize() );
// we need two render frames here to clear the menu and cursor // we need two render frames here to clear the menu and cursor
// ... not sure why but doing an extra fgFenderFrame() shoulnd't // ... not sure why but doing an extra fgFenderFrame() shoulnd't

View file

@ -55,7 +55,6 @@
#endif #endif
#include "globals.hxx" #include "globals.hxx"
#include "options.hxx"
#include "save.hxx" #include "save.hxx"
#include "fg_init.hxx" #include "fg_init.hxx"
#include <simgear/misc/props.hxx> #include <simgear/misc/props.hxx>

View file

@ -93,7 +93,6 @@
#include "fg_init.hxx" #include "fg_init.hxx"
#include "fg_io.hxx" #include "fg_io.hxx"
#include "globals.hxx" #include "globals.hxx"
#include "options.hxx"
#include "bfi.hxx" #include "bfi.hxx"
#if defined(FX) && defined(XMESA) #if defined(FX) && defined(XMESA)
@ -104,6 +103,9 @@ FG_USING_STD(string);
extern const char *default_root; extern const char *default_root;
// from main.cxx
extern void fgReshape( int width, int height );
// Read in configuration (file and command line) and just set fg_root // Read in configuration (file and command line) and just set fg_root
bool fgInitFGRoot ( int argc, char **argv ) { bool fgInitFGRoot ( int argc, char **argv ) {

View file

@ -70,7 +70,6 @@
#include "bfi.hxx" #include "bfi.hxx"
#include "globals.hxx" #include "globals.hxx"
#include "keyboard.hxx" #include "keyboard.hxx"
#include "options.hxx"
#include "save.hxx" #include "save.hxx"
// From main.cxx // From main.cxx
@ -437,8 +436,8 @@ void GLUTkey(unsigned char k, int x, int y) {
v->set_view_offset( FG_PI * 1.75 ); v->set_view_offset( FG_PI * 1.75 );
globals->get_pilot_view()->set_pilot_offset(25.0, -25.0, 1.0); globals->get_pilot_view()->set_pilot_offset(25.0, -25.0, 1.0);
} }
fgReshape( globals->get_current_view()->get_winWidth(), fgReshape( globals->get_options()->get_xsize(),
globals->get_current_view()->get_winHeight() ); globals->get_options()->get_ysize() );
return; return;
case 120: // x key case 120: // x key
fov = globals->get_options()->get_fov(); fov = globals->get_options()->get_fov();
@ -539,14 +538,14 @@ void GLUTspecialkey(int k, int x, int y) {
} }
case GLUT_KEY_F5: { case GLUT_KEY_F5: {
current_panel->setYOffset(current_panel->getYOffset() - 5); current_panel->setYOffset(current_panel->getYOffset() - 5);
fgReshape(globals->get_current_view()->get_winWidth(), fgReshape(globals->get_options()->get_xsize(),
globals->get_current_view()->get_winHeight()); globals->get_options()->get_ysize());
return; return;
} }
case GLUT_KEY_F6: { case GLUT_KEY_F6: {
current_panel->setYOffset(current_panel->getYOffset() + 5); current_panel->setYOffset(current_panel->getYOffset() + 5);
fgReshape(globals->get_current_view()->get_winWidth(), fgReshape(globals->get_options()->get_xsize(),
globals->get_current_view()->get_winHeight()); globals->get_options()->get_ysize());
return; return;
} }
case GLUT_KEY_F7: { case GLUT_KEY_F7: {

View file

@ -115,7 +115,6 @@ ssgTransform *ship_pos = NULL;
#include "fg_io.hxx" #include "fg_io.hxx"
#include "globals.hxx" #include "globals.hxx"
#include "keyboard.hxx" #include "keyboard.hxx"
#include "options.hxx"
#include "splash.hxx" #include "splash.hxx"
@ -143,6 +142,9 @@ static bool initial_freeze = true;
// Another hack // Another hack
int use_signals = 0; int use_signals = 0;
// forward declaration
void fgReshape( int width, int height );
// Global structures for the Audio library // Global structures for the Audio library
#ifdef ENABLE_AUDIO_SUPPORT #ifdef ENABLE_AUDIO_SUPPORT
slEnvelope pitch_envelope ( 1, SL_SAMPLE_ONE_SHOT ) ; slEnvelope pitch_envelope ( 1, SL_SAMPLE_ONE_SHOT ) ;
@ -1120,6 +1122,10 @@ static void fgIdleFunction ( void ) {
// sleep(1); // sleep(1);
idle_state = 1000; idle_state = 1000;
cout << "Panel visible = " << fgPanelVisible() << endl;
fgReshape( globals->get_options()->get_xsize(),
globals->get_options()->get_ysize() );
} }
if ( idle_state == 1000 ) { if ( idle_state == 1000 ) {
@ -1151,8 +1157,8 @@ void fgReshape( int width, int height ) {
(GLint)(width), (GLint)(view_h) ); (GLint)(width), (GLint)(view_h) );
} }
globals->get_current_view()->set_winWidth( width ); globals->get_options()->set_xsize( width );
globals->get_current_view()->set_winHeight( height ); globals->get_options()->set_ysize( height );
globals->get_current_view()->force_update_fov_math(); globals->get_current_view()->force_update_fov_math();
// set these fov to be the same as in fgRenderFrame() // set these fov to be the same as in fgRenderFrame()
@ -1315,7 +1321,8 @@ int main( int argc, char **argv ) {
// seed the random number generater // seed the random number generater
fg_srandom(); fg_srandom();
// needs to happen before we parse command line options // Allocate global data structures. This needs to happen before
// we parse command line options
globals = new FGGlobals; globals = new FGGlobals;
SGRoute *route = new SGRoute; SGRoute *route = new SGRoute;

View file

@ -60,7 +60,7 @@ bool global_fullscreen = true;
FG_USING_STD(string); FG_USING_STD(string);
FG_USING_NAMESPACE(std); FG_USING_NAMESPACE(std);
// from GLUTmain.cxx // from main.cxx
extern void fgReshape( int width, int height ); extern void fgReshape( int width, int height );
inline double inline double
@ -185,10 +185,6 @@ FGOptions::FGOptions() :
wireframe(0), wireframe(0),
xsize(800), xsize(800),
ysize(600), ysize(600),
xmin(0),
ymin(0),
xmax(800),
ymax(600),
bpp(16), bpp(16),
view_mode(FG_VIEW_PILOT), view_mode(FG_VIEW_PILOT),
default_view_offset(0), default_view_offset(0),
@ -271,9 +267,7 @@ FGOptions::toggle_panel() {
fov *= (1.0 / 0.4232); fov *= (1.0 / 0.4232);
} */ } */
// fgReshape( xsize, ysize); fgReshape( xsize, ysize);
fgReshape( globals->get_current_view()->get_winWidth(),
globals->get_current_view()->get_winHeight() );
if( !freeze ) if( !freeze )
globals->set_freeze( false ); globals->set_freeze( false );
@ -826,10 +820,6 @@ int FGOptions::parse_option( const string& arg ) {
FG_LOG( FG_GENERAL, FG_ALERT, FG_LOG( FG_GENERAL, FG_ALERT,
"Setting geometry to " << xsize << 'x' << ysize << '\n'); "Setting geometry to " << xsize << 'x' << ysize << '\n');
} }
xmin = ymin = 0;
xmax = xsize;
ymax = ysize;
} else if ( arg.find( "--bpp=" ) != string::npos ) { } else if ( arg.find( "--bpp=" ) != string::npos ) {
string bits_per_pix = arg.substr( 6 ); string bits_per_pix = arg.substr( 6 );
if ( bits_per_pix == "16" ) { if ( bits_per_pix == "16" ) {

View file

@ -180,8 +180,6 @@ private:
bool textures; // Textures enabled/disabled bool textures; // Textures enabled/disabled
bool wireframe; // Wireframe mode enabled/disabled bool wireframe; // Wireframe mode enabled/disabled
int xsize, ysize; // window size derived from geometry string int xsize, ysize; // window size derived from geometry string
int xmin, ymin; // upper left corner of window to draw in
int xmax, ymax; // lower right corner of window to draw in
int bpp; // bits per pixel int bpp; // bits per pixel
fgViewMode view_mode; // view mode fgViewMode view_mode; // view mode
double default_view_offset; // default forward view offset (for use by double default_view_offset; // default forward view offset (for use by
@ -288,10 +286,6 @@ public:
inline bool get_wireframe() const { return wireframe; } inline bool get_wireframe() const { return wireframe; }
inline int get_xsize() const { return xsize; } inline int get_xsize() const { return xsize; }
inline int get_ysize() const { return ysize; } inline int get_ysize() const { return ysize; }
inline int get_xmin() const { return xmin; }
inline int get_ymin() const { return ymin; }
inline int get_xmax() const { return xmax; }
inline int get_ymax() const { return ymax; }
inline int get_bpp() const { return bpp; } inline int get_bpp() const { return bpp; }
inline fgViewMode get_view_mode() const { return view_mode; } inline fgViewMode get_view_mode() const { return view_mode; }
inline double get_default_view_offset() const { inline double get_default_view_offset() const {

View file

@ -109,15 +109,15 @@ void fgSplashUpdate ( double progress ) {
int xsize = 480; int xsize = 480;
int ysize = 380; int ysize = 380;
if ( !globals->get_current_view()->get_winWidth() if ( !globals->get_options()->get_xsize()
|| !globals->get_current_view()->get_winHeight() ) { || !globals->get_options()->get_ysize() ) {
return; return;
} }
xmin = (globals->get_current_view()->get_winWidth() - xsize) / 2; xmin = (globals->get_options()->get_xsize() - xsize) / 2;
xmax = xmin + xsize; xmax = xmin + xsize;
ymin = (globals->get_current_view()->get_winHeight() - ysize) / 2; ymin = (globals->get_options()->get_ysize() - ysize) / 2;
ymax = ymin + ysize; ymax = ymin + ysize;
// first clear the screen; // first clear the screen;
@ -128,8 +128,8 @@ void fgSplashUpdate ( double progress ) {
xglMatrixMode(GL_PROJECTION); xglMatrixMode(GL_PROJECTION);
xglPushMatrix(); xglPushMatrix();
xglLoadIdentity(); xglLoadIdentity();
gluOrtho2D(0, globals->get_current_view()->get_winWidth(), gluOrtho2D(0, globals->get_options()->get_xsize(),
0, globals->get_current_view()->get_winHeight()); 0, globals->get_options()->get_ysize());
xglMatrixMode(GL_MODELVIEW); xglMatrixMode(GL_MODELVIEW);
xglPushMatrix(); xglPushMatrix();
xglLoadIdentity(); xglLoadIdentity();

View file

@ -40,7 +40,7 @@
#include <Cockpit/panel.hxx> #include <Cockpit/panel.hxx>
#include <Scenery/scenery.hxx> #include <Scenery/scenery.hxx>
#include "options.hxx" #include "globals.hxx"
#include "viewer.hxx" #include "viewer.hxx"
@ -86,10 +86,8 @@ void FGViewer::Init( void ) {
view_offset = goal_view_offset = globals->get_options()->get_default_view_offset(); view_offset = goal_view_offset = globals->get_options()->get_default_view_offset();
sgSetVec3( pilot_offset, 0.0, 0.0, 0.0 ); sgSetVec3( pilot_offset, 0.0, 0.0, 0.0 );
winWidth = globals->get_options()->get_xsize(); set_win_ratio( globals->get_options()->get_xsize() /
winHeight = globals->get_options()->get_ysize(); globals->get_options()->get_ysize() );
set_win_ratio( winHeight / winWidth );
#ifndef USE_FAST_VIEWROT #ifndef USE_FAST_VIEWROT
// This never changes -- NHV // This never changes -- NHV
@ -158,13 +156,16 @@ void FGViewer::UpdateViewParams( const FGInterface& f ) {
UpdateViewMath(f); UpdateViewMath(f);
if ( ! fgPanelVisible() ) { if ( ! fgPanelVisible() ) {
xglViewport(0, 0 , (GLint)(winWidth), (GLint)(winHeight) ); xglViewport( 0, 0 ,
(GLint)(globals->get_options()->get_xsize()),
(GLint)(globals->get_options()->get_ysize()) );
} else { } else {
int view_h = int view_h =
int((current_panel->getViewHeight() - current_panel->getYOffset()) int((current_panel->getViewHeight() - current_panel->getYOffset())
* (winHeight / 768.0)); * (globals->get_options()->get_ysize() / 768.0));
glViewport(0, (GLint)(winHeight - view_h), glViewport( 0, (GLint)(globals->get_options()->get_ysize() - view_h),
(GLint)(winWidth), (GLint)(view_h) ); (GLint)(globals->get_options()->get_xsize()),
(GLint)(view_h) );
} }
} }

View file

@ -41,7 +41,6 @@
#include <FDM/flight.hxx> #include <FDM/flight.hxx>
#include <Time/light.hxx> #include <Time/light.hxx>
#include "options.hxx"
FG_USING_STD(list); FG_USING_STD(list);
@ -70,7 +69,7 @@ private:
double win_ratio; double win_ratio;
// width & height of window // width & height of window
int winWidth, winHeight; // int winWidth, winHeight;
// absolute view position in earth coordinates // absolute view position in earth coordinates
Point3D abs_view_pos; Point3D abs_view_pos;
@ -165,10 +164,10 @@ public:
inline void set_goal_view_offset( double a) { goal_view_offset = a; } inline void set_goal_view_offset( double a) { goal_view_offset = a; }
inline double get_win_ratio() const { return win_ratio; } inline double get_win_ratio() const { return win_ratio; }
inline void set_win_ratio( double r ) { win_ratio = r; } inline void set_win_ratio( double r ) { win_ratio = r; }
inline int get_winWidth() const { return winWidth; } // inline int get_winWidth() const { return winWidth; }
inline void set_winWidth( int w ) { winWidth = w; } // inline void set_winWidth( int w ) { winWidth = w; }
inline int get_winHeight() const { return winHeight; } // inline int get_winHeight() const { return winHeight; }
inline void set_winHeight( int h ) { winHeight = h; } // inline void set_winHeight( int h ) { winHeight = h; }
inline Point3D get_abs_view_pos() const { return abs_view_pos; } inline Point3D get_abs_view_pos() const { return abs_view_pos; }
inline Point3D get_view_pos() const { return view_pos; } inline Point3D get_view_pos() const { return view_pos; }
inline float *get_pilot_offset() { return pilot_offset; } inline float *get_pilot_offset() { return pilot_offset; }

View file

@ -41,7 +41,7 @@
#include <Cockpit/panel.hxx> #include <Cockpit/panel.hxx>
#include <Scenery/scenery.hxx> #include <Scenery/scenery.hxx>
#include "options.hxx" #include "globals.hxx"
#include "views.hxx" #include "views.hxx"

View file

@ -41,8 +41,6 @@
#include <FDM/flight.hxx> #include <FDM/flight.hxx>
#include <Time/light.hxx> #include <Time/light.hxx>
#include "options.hxx"
FG_USING_STD(list); FG_USING_STD(list);

View file

@ -51,7 +51,6 @@
#include <Aircraft/aircraft.hxx> #include <Aircraft/aircraft.hxx>
#include <GUI/gui.h> #include <GUI/gui.h>
#include <Main/options.hxx>
#include <Scenery/scenery.hxx> #include <Scenery/scenery.hxx>
#include <Time/fg_timer.hxx> #include <Time/fg_timer.hxx>
@ -63,7 +62,6 @@ extern "C" {
*/ */
#include <Main/options.hxx>
#include <Cockpit/hud.hxx> #include <Cockpit/hud.hxx>
#include <NetworkOLK/network.h> #include <NetworkOLK/network.h>

View file

@ -50,7 +50,6 @@
#include <Aircraft/aircraft.hxx> #include <Aircraft/aircraft.hxx>
#include <GUI/gui.h> #include <GUI/gui.h>
#include <Main/options.hxx>
#include <Scenery/scenery.hxx> #include <Scenery/scenery.hxx>
#include <Time/fg_timer.hxx> #include <Time/fg_timer.hxx>

View file

@ -37,8 +37,6 @@
#include <simgear/debug/logstream.hxx> #include <simgear/debug/logstream.hxx>
#include <Main/options.hxx>
#include "scenery.hxx" #include "scenery.hxx"