Moved fov and win_ration from FGOptions to FGViewer so we can control these
on a per view basis. Fixed some compile warnings in Main/*.cxx
This commit is contained in:
parent
f24b6a4098
commit
08fd9cc36d
13 changed files with 74 additions and 43 deletions
|
@ -235,7 +235,7 @@ float get_frame_rate( void )
|
||||||
|
|
||||||
float get_fov( void )
|
float get_fov( void )
|
||||||
{
|
{
|
||||||
float fov = globals->get_options()->get_fov();
|
float fov = globals->get_current_view()->get_fov();
|
||||||
return (fov);
|
return (fov);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,6 @@ bool
|
||||||
fgPanelVisible ()
|
fgPanelVisible ()
|
||||||
{
|
{
|
||||||
return ((globals->get_options()->get_panel_status()) &&
|
return ((globals->get_options()->get_panel_status()) &&
|
||||||
(globals->get_options()->get_view_mode() == FGOptions::FG_VIEW_PILOT) &&
|
|
||||||
(globals->get_current_view()->get_view_offset() == 0.0));
|
(globals->get_current_view()->get_view_offset() == 0.0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ NETWORK_LIBS = \
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if OLD_AUTOMAKE
|
if OLD_AUTOMAKE
|
||||||
CXXFLAGS += -DPKGLIBDIR=\"$(pkglibdir)\"
|
# nothing CXXFLAGS += -DPKGLIBDIR=\"$(pkglibdir)\"
|
||||||
else
|
else
|
||||||
AM_CXXFLAGS = -DPKGLIBDIR=\"$(pkglibdir)\"
|
AM_CXXFLAGS = -DPKGLIBDIR=\"$(pkglibdir)\"
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -107,8 +107,8 @@ reinit ()
|
||||||
double apAltitude = FGBFI::getAPAltitude();
|
double apAltitude = FGBFI::getAPAltitude();
|
||||||
const string &targetAirport = FGBFI::getTargetAirport();
|
const string &targetAirport = FGBFI::getTargetAirport();
|
||||||
bool gpsLock = FGBFI::getGPSLock();
|
bool gpsLock = FGBFI::getGPSLock();
|
||||||
double gpsLatitude = FGBFI::getGPSTargetLatitude();
|
// double gpsLatitude = FGBFI::getGPSTargetLatitude();
|
||||||
double gpsLongitude = FGBFI::getGPSTargetLongitude();
|
// double gpsLongitude = FGBFI::getGPSTargetLongitude();
|
||||||
|
|
||||||
FGBFI::setTargetAirport("");
|
FGBFI::setTargetAirport("");
|
||||||
cout << "Target airport is " << globals->get_options()->get_airport_id() << endl;
|
cout << "Target airport is " << globals->get_options()->get_airport_id() << endl;
|
||||||
|
@ -753,6 +753,8 @@ FGBFI::getEGT ()
|
||||||
{
|
{
|
||||||
if ( current_aircraft.fdm_state->get_engine(0) != NULL ) {
|
if ( current_aircraft.fdm_state->get_engine(0) != NULL ) {
|
||||||
return current_aircraft.fdm_state->get_engine(0)->get_EGT();
|
return current_aircraft.fdm_state->get_engine(0)->get_EGT();
|
||||||
|
} else {
|
||||||
|
return 0.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -765,6 +767,8 @@ FGBFI::getCHT ()
|
||||||
{
|
{
|
||||||
if ( current_aircraft.fdm_state->get_engine(0) != NULL ) {
|
if ( current_aircraft.fdm_state->get_engine(0) != NULL ) {
|
||||||
return current_aircraft.fdm_state->get_engine(0)->get_CHT();
|
return current_aircraft.fdm_state->get_engine(0)->get_CHT();
|
||||||
|
} else {
|
||||||
|
return 0.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -777,6 +781,8 @@ FGBFI::getMP ()
|
||||||
{
|
{
|
||||||
if ( current_aircraft.fdm_state->get_engine(0) != NULL ) {
|
if ( current_aircraft.fdm_state->get_engine(0) != NULL ) {
|
||||||
return current_aircraft.fdm_state->get_engine(0)->get_Manifold_Pressure();
|
return current_aircraft.fdm_state->get_engine(0)->get_Manifold_Pressure();
|
||||||
|
} else {
|
||||||
|
return 0.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -221,7 +221,7 @@ bool fgSetPosFromAirportID( const string& id ) {
|
||||||
bool fgSetPosFromAirportIDandHdg( const string& id, double tgt_hdg ) {
|
bool fgSetPosFromAirportIDandHdg( const string& id, double tgt_hdg ) {
|
||||||
FGRunway r;
|
FGRunway r;
|
||||||
FGRunway found_r;
|
FGRunway found_r;
|
||||||
double found_dir;
|
double found_dir = 0.0;
|
||||||
|
|
||||||
if ( id.length() ) {
|
if ( id.length() ) {
|
||||||
// set initial position from runway and heading
|
// set initial position from runway and heading
|
||||||
|
@ -564,10 +564,12 @@ bool fgInitSubsystems( void ) {
|
||||||
&fgEVENT_MGR::PrintStats),
|
&fgEVENT_MGR::PrintStats),
|
||||||
fgEVENT::FG_EVENT_READY, 60000 );
|
fgEVENT::FG_EVENT_READY, 60000 );
|
||||||
|
|
||||||
// Initialize win ratio parameters
|
// Initialize win_ratio parameters
|
||||||
globals->get_options()->set_win_ratio( globals->get_options()->get_xsize() /
|
for ( int i = 0; i < globals->get_viewmgr()->size(); ++i ) {
|
||||||
globals->get_options()->get_ysize()
|
globals->get_viewmgr()->get_view(i)->
|
||||||
);
|
set_win_ratio( globals->get_options()->get_xsize() /
|
||||||
|
globals->get_options()->get_ysize() );
|
||||||
|
}
|
||||||
|
|
||||||
// Initialize pilot view
|
// Initialize pilot view
|
||||||
FGViewerRPH *pilot_view =
|
FGViewerRPH *pilot_view =
|
||||||
|
|
|
@ -213,12 +213,12 @@ void GLUTkey(unsigned char k, int x, int y) {
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
case 88: // X key
|
case 88: // X key
|
||||||
fov = globals->get_options()->get_fov();
|
fov = globals->get_current_view()->get_fov();
|
||||||
fov *= 1.05;
|
fov *= 1.05;
|
||||||
if ( fov > FG_FOV_MAX ) {
|
if ( fov > FG_FOV_MAX ) {
|
||||||
fov = FG_FOV_MAX;
|
fov = FG_FOV_MAX;
|
||||||
}
|
}
|
||||||
globals->get_options()->set_fov(fov);
|
globals->get_current_view()->set_fov(fov);
|
||||||
// v->force_update_fov_math();
|
// v->force_update_fov_math();
|
||||||
return;
|
return;
|
||||||
case 90: // Z key
|
case 90: // Z key
|
||||||
|
@ -375,12 +375,12 @@ void GLUTkey(unsigned char k, int x, int y) {
|
||||||
globals->get_options()->get_ysize() );
|
globals->get_options()->get_ysize() );
|
||||||
return;
|
return;
|
||||||
case 120: // x key
|
case 120: // x key
|
||||||
fov = globals->get_options()->get_fov();
|
fov = globals->get_current_view()->get_fov();
|
||||||
fov /= 1.05;
|
fov /= 1.05;
|
||||||
if ( fov < FG_FOV_MIN ) {
|
if ( fov < FG_FOV_MIN ) {
|
||||||
fov = FG_FOV_MIN;
|
fov = FG_FOV_MIN;
|
||||||
}
|
}
|
||||||
globals->get_options()->set_fov(fov);
|
globals->get_current_view()->set_fov(fov);
|
||||||
// v->force_update_fov_math();
|
// v->force_update_fov_math();
|
||||||
return;
|
return;
|
||||||
case 122: // z key
|
case 122: // z key
|
||||||
|
@ -519,7 +519,7 @@ void GLUTspecialkey(int k, int x, int y) {
|
||||||
switch (k) {
|
switch (k) {
|
||||||
case GLUT_KEY_F2: // F2 Reload Tile Cache...
|
case GLUT_KEY_F2: // F2 Reload Tile Cache...
|
||||||
{
|
{
|
||||||
bool freeze;
|
bool freeze = globals->get_freeze();
|
||||||
FG_LOG(FG_INPUT, FG_INFO, "ReIniting TileCache");
|
FG_LOG(FG_INPUT, FG_INFO, "ReIniting TileCache");
|
||||||
if ( !freeze )
|
if ( !freeze )
|
||||||
globals->set_freeze( true );
|
globals->set_freeze( true );
|
||||||
|
|
|
@ -387,6 +387,12 @@ void fgRenderFrame( void ) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// update view port
|
// update view port
|
||||||
|
fgReshape( globals->get_options()->get_xsize(),
|
||||||
|
globals->get_options()->get_ysize() );
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
// swing and a miss
|
||||||
|
|
||||||
if ( ! fgPanelVisible() ) {
|
if ( ! fgPanelVisible() ) {
|
||||||
xglViewport( 0, 0 ,
|
xglViewport( 0, 0 ,
|
||||||
(GLint)(globals->get_options()->get_xsize()),
|
(GLint)(globals->get_options()->get_xsize()),
|
||||||
|
@ -401,6 +407,7 @@ void fgRenderFrame( void ) {
|
||||||
(GLint)(globals->get_options()->get_xsize()),
|
(GLint)(globals->get_options()->get_xsize()),
|
||||||
(GLint)(view_h) );
|
(GLint)(view_h) );
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// set the sun position
|
// set the sun position
|
||||||
glLightfv( GL_LIGHT0, GL_POSITION, l->sun_vec );
|
glLightfv( GL_LIGHT0, GL_POSITION, l->sun_vec );
|
||||||
|
@ -554,8 +561,8 @@ void fgRenderFrame( void ) {
|
||||||
|
|
||||||
// glMatrixMode( GL_PROJECTION );
|
// glMatrixMode( GL_PROJECTION );
|
||||||
// glLoadIdentity();
|
// glLoadIdentity();
|
||||||
float fov = globals->get_options()->get_fov();
|
float fov = globals->get_current_view()->get_fov();
|
||||||
ssgSetFOV(fov, fov * globals->get_options()->get_win_ratio());
|
ssgSetFOV(fov, fov * globals->get_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;
|
||||||
|
@ -1165,16 +1172,27 @@ 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 ) {
|
||||||
|
// for all views
|
||||||
|
for ( int i = 0; i < globals->get_viewmgr()->size(); ++i ) {
|
||||||
|
if ( ! fgPanelVisible() || idle_state != 1000 ) {
|
||||||
|
globals->get_viewmgr()->get_view(i)->
|
||||||
|
set_win_ratio( (float)height / (float)width );
|
||||||
|
} else {
|
||||||
|
int view_h =
|
||||||
|
int((current_panel->getViewHeight() -
|
||||||
|
current_panel->getYOffset())
|
||||||
|
* (height / 768.0)) + 1;
|
||||||
|
globals->get_viewmgr()->get_view(i)->
|
||||||
|
set_win_ratio( (float)view_h / (float)width );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( ! fgPanelVisible() || idle_state != 1000 ) {
|
if ( ! fgPanelVisible() || idle_state != 1000 ) {
|
||||||
globals->get_options()->set_win_ratio( (float)height /
|
|
||||||
(float)width );
|
|
||||||
glViewport(0, 0 , (GLint)(width), (GLint)(height) );
|
glViewport(0, 0 , (GLint)(width), (GLint)(height) );
|
||||||
} else {
|
} else {
|
||||||
int view_h =
|
int view_h =
|
||||||
int((current_panel->getViewHeight() - current_panel->getYOffset())
|
int((current_panel->getViewHeight() - current_panel->getYOffset())
|
||||||
* (height / 768.0)) + 1;
|
* (height / 768.0)) + 1;
|
||||||
globals->get_options()->set_win_ratio( (float)view_h /
|
|
||||||
(float)width );
|
|
||||||
glViewport(0, (GLint)(height - view_h),
|
glViewport(0, (GLint)(height - view_h),
|
||||||
(GLint)(width), (GLint)(view_h) );
|
(GLint)(width), (GLint)(view_h) );
|
||||||
}
|
}
|
||||||
|
@ -1182,8 +1200,8 @@ void fgReshape( int width, int height ) {
|
||||||
globals->get_options()->set_xsize( width );
|
globals->get_options()->set_xsize( width );
|
||||||
globals->get_options()->set_ysize( height );
|
globals->get_options()->set_ysize( height );
|
||||||
|
|
||||||
float fov = globals->get_options()->get_fov();
|
float fov = globals->get_current_view()->get_fov();
|
||||||
ssgSetFOV(fov, fov * globals->get_options()->get_win_ratio());
|
ssgSetFOV(fov, fov * globals->get_current_view()->get_win_ratio());
|
||||||
|
|
||||||
fgHUDReshape();
|
fgHUDReshape();
|
||||||
}
|
}
|
||||||
|
@ -1545,8 +1563,8 @@ int main( int argc, char **argv ) {
|
||||||
sgMat4 tux_matrix;
|
sgMat4 tux_matrix;
|
||||||
float h_rot =
|
float h_rot =
|
||||||
current_properties.getFloatValue("/sim/model/h-rotation", 0.0);
|
current_properties.getFloatValue("/sim/model/h-rotation", 0.0);
|
||||||
float p_rot =
|
/* float p_rot =
|
||||||
current_properties.getFloatValue("/sim/model/p-rotation", 0.0);
|
current_properties.getFloatValue("/sim/model/p-rotation", 0.0); */
|
||||||
float r_rot =
|
float r_rot =
|
||||||
current_properties.getFloatValue("/sim/model/r-rotation", 0.0);
|
current_properties.getFloatValue("/sim/model/r-rotation", 0.0);
|
||||||
sgMakeRotMat4(tux_matrix, h_rot, h_rot, r_rot);
|
sgMakeRotMat4(tux_matrix, h_rot, h_rot, r_rot);
|
||||||
|
|
|
@ -180,7 +180,6 @@ FGOptions::FGOptions() :
|
||||||
fog(FG_FOG_NICEST), // nicest
|
fog(FG_FOG_NICEST), // nicest
|
||||||
clouds(true),
|
clouds(true),
|
||||||
clouds_asl(5000*FEET_TO_METER),
|
clouds_asl(5000*FEET_TO_METER),
|
||||||
fov(55.0),
|
|
||||||
fullscreen(0),
|
fullscreen(0),
|
||||||
shading(1),
|
shading(1),
|
||||||
skyblend(1),
|
skyblend(1),
|
||||||
|
@ -547,9 +546,11 @@ FGOptions::parse_fov( const string& arg ) {
|
||||||
if ( fov < FG_FOV_MIN ) { fov = FG_FOV_MIN; }
|
if ( fov < FG_FOV_MIN ) { fov = FG_FOV_MIN; }
|
||||||
if ( fov > FG_FOV_MAX ) { fov = FG_FOV_MAX; }
|
if ( fov > FG_FOV_MAX ) { fov = FG_FOV_MAX; }
|
||||||
|
|
||||||
|
globals->get_current_view()->set_fov( fov );
|
||||||
|
|
||||||
// printf("parse_fov(): result = %.4f\n", fov);
|
// printf("parse_fov(): result = %.4f\n", fov);
|
||||||
|
|
||||||
return(fov);
|
return fov;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -670,7 +671,6 @@ int FGOptions::parse_option( const string& arg ) {
|
||||||
current_properties.setBoolValue("/sim/panel/visibility", true);
|
current_properties.setBoolValue("/sim/panel/visibility", true);
|
||||||
if ( current_panel != NULL )
|
if ( current_panel != NULL )
|
||||||
current_panel->setVisibility(true);
|
current_panel->setVisibility(true);
|
||||||
// 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" ) {
|
||||||
|
@ -798,7 +798,7 @@ int FGOptions::parse_option( const string& arg ) {
|
||||||
clouds_asl = atof( arg.substr(13) );
|
clouds_asl = atof( arg.substr(13) );
|
||||||
}
|
}
|
||||||
} else if ( arg.find( "--fov=" ) != string::npos ) {
|
} else if ( arg.find( "--fov=" ) != string::npos ) {
|
||||||
fov = parse_fov( arg.substr(6) );
|
parse_fov( arg.substr(6) );
|
||||||
} else if ( arg == "--disable-fullscreen" ) {
|
} else if ( arg == "--disable-fullscreen" ) {
|
||||||
fullscreen = false;
|
fullscreen = false;
|
||||||
} else if ( arg== "--enable-fullscreen") {
|
} else if ( arg== "--enable-fullscreen") {
|
||||||
|
|
|
@ -56,8 +56,6 @@ FG_USING_STD(vector);
|
||||||
FG_USING_STD(string);
|
FG_USING_STD(string);
|
||||||
|
|
||||||
#define NEW_DEFAULT_MODEL_HZ 120
|
#define NEW_DEFAULT_MODEL_HZ 120
|
||||||
#define FG_FOV_MIN 0.1
|
|
||||||
#define FG_FOV_MAX 179.9
|
|
||||||
|
|
||||||
|
|
||||||
class FGOptions {
|
class FGOptions {
|
||||||
|
@ -186,14 +184,12 @@ private:
|
||||||
fgFogKind fog; // Fog nicest/fastest/disabled
|
fgFogKind fog; // Fog nicest/fastest/disabled
|
||||||
bool clouds; // Enable clouds
|
bool clouds; // Enable clouds
|
||||||
double clouds_asl; // Cloud layer height above sea level
|
double clouds_asl; // Cloud layer height above sea level
|
||||||
double fov; // Field of View
|
|
||||||
bool fullscreen; // Full screen mode enabled/disabled
|
bool fullscreen; // Full screen mode enabled/disabled
|
||||||
int shading; // shading method, 0 = Flat, 1 = Smooth
|
int shading; // shading method, 0 = Flat, 1 = Smooth
|
||||||
bool skyblend; // Blend sky to haze (using polygons) or just clear
|
bool skyblend; // Blend sky to haze (using polygons) or just clear
|
||||||
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
|
||||||
double win_ratio; // ratio of x and y fov's; fov(y) = fov(x) * win_ratio
|
|
||||||
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
|
||||||
|
@ -296,7 +292,6 @@ public:
|
||||||
inline fgFogKind get_fog() const { return fog; }
|
inline fgFogKind get_fog() const { return fog; }
|
||||||
inline bool get_clouds() const { return clouds; }
|
inline bool get_clouds() const { return clouds; }
|
||||||
inline double get_clouds_asl() const { return clouds_asl; }
|
inline double get_clouds_asl() const { return clouds_asl; }
|
||||||
inline double get_fov() const { return fov; }
|
|
||||||
inline bool get_fullscreen() const { return fullscreen; }
|
inline bool get_fullscreen() const { return fullscreen; }
|
||||||
inline int get_shading() const { return shading; }
|
inline int get_shading() const { return shading; }
|
||||||
inline bool get_skyblend() const { return skyblend; }
|
inline bool get_skyblend() const { return skyblend; }
|
||||||
|
@ -304,7 +299,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 double get_win_ratio() const { return win_ratio; }
|
|
||||||
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 {
|
||||||
|
@ -359,7 +353,6 @@ public:
|
||||||
inline void set_fog (fgFogKind value) { fog = value; }
|
inline void set_fog (fgFogKind value) { fog = value; }
|
||||||
inline void set_clouds( bool value ) { clouds = value; }
|
inline void set_clouds( bool value ) { clouds = value; }
|
||||||
inline void set_clouds_asl( double value ) { clouds_asl = value; }
|
inline void set_clouds_asl( double value ) { clouds_asl = value; }
|
||||||
inline void set_fov( double amount ) { fov = amount; }
|
|
||||||
inline void set_fullscreen (bool value) { fullscreen = value; }
|
inline void set_fullscreen (bool value) { fullscreen = value; }
|
||||||
inline void set_shading (int value) { shading = value; }
|
inline void set_shading (int value) { shading = value; }
|
||||||
inline void set_skyblend (bool value) { skyblend = value; }
|
inline void set_skyblend (bool value) { skyblend = value; }
|
||||||
|
@ -379,7 +372,6 @@ public:
|
||||||
void toggle_panel();
|
void toggle_panel();
|
||||||
inline void set_xsize( int x ) { xsize = x; }
|
inline void set_xsize( int x ) { xsize = x; }
|
||||||
inline void set_ysize( int y ) { ysize = y; }
|
inline void set_ysize( int y ) { ysize = y; }
|
||||||
inline void set_win_ratio( double r ) { win_ratio = r; }
|
|
||||||
inline void set_view_mode (fgViewMode value) { view_mode = value; }
|
inline void set_view_mode (fgViewMode value) { view_mode = value; }
|
||||||
inline void set_tile_radius (int value) { tile_radius = value; }
|
inline void set_tile_radius (int value) { tile_radius = value; }
|
||||||
inline void set_tile_diameter (int value) { tile_diameter = value; }
|
inline void set_tile_diameter (int value) { tile_diameter = value; }
|
||||||
|
|
|
@ -68,7 +68,7 @@ fgLoadFlight (istream &input)
|
||||||
// it would be better if FGFS just
|
// it would be better if FGFS just
|
||||||
// noticed the new lat/lon.
|
// noticed the new lat/lon.
|
||||||
if (retval) {
|
if (retval) {
|
||||||
bool freeze;
|
bool freeze = globals->get_freeze();
|
||||||
FG_LOG(FG_INPUT, FG_INFO, "ReIniting TileCache");
|
FG_LOG(FG_INPUT, FG_INFO, "ReIniting TileCache");
|
||||||
if ( !freeze )
|
if ( !freeze )
|
||||||
globals->set_freeze( true );
|
globals->set_freeze( true );
|
||||||
|
|
|
@ -34,7 +34,8 @@
|
||||||
|
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
FGViewer::FGViewer( void )
|
FGViewer::FGViewer( void ):
|
||||||
|
fov(55.0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,10 @@
|
||||||
#include <plib/sg.h> // plib include
|
#include <plib/sg.h> // plib include
|
||||||
|
|
||||||
|
|
||||||
|
#define FG_FOV_MIN 0.1
|
||||||
|
#define FG_FOV_MAX 179.9
|
||||||
|
|
||||||
|
|
||||||
// Define a structure containing view information
|
// Define a structure containing view information
|
||||||
class FGViewer {
|
class FGViewer {
|
||||||
|
|
||||||
|
@ -55,6 +59,12 @@ protected:
|
||||||
|
|
||||||
fgViewType _type;
|
fgViewType _type;
|
||||||
|
|
||||||
|
// the field of view in the x (width) direction
|
||||||
|
double fov;
|
||||||
|
|
||||||
|
// ratio of x and y fov's; fov(y) = fov(x) * win_ratio
|
||||||
|
double win_ratio;
|
||||||
|
|
||||||
// the current view offset angle from forward (rotated about the
|
// the current view offset angle from forward (rotated about the
|
||||||
// view_up vector)
|
// view_up vector)
|
||||||
double view_offset;
|
double view_offset;
|
||||||
|
@ -115,6 +125,8 @@ public:
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
// setter functions
|
// setter functions
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
inline void set_fov( double amount ) { fov = amount; }
|
||||||
|
inline void set_win_ratio( double r ) { win_ratio = r; }
|
||||||
inline void set_view_offset( double a ) {
|
inline void set_view_offset( double a ) {
|
||||||
set_dirty();
|
set_dirty();
|
||||||
view_offset = a;
|
view_offset = a;
|
||||||
|
@ -150,6 +162,8 @@ public:
|
||||||
inline int get_type() const { return _type ; }
|
inline int get_type() const { return _type ; }
|
||||||
inline int is_a( int t ) const { return get_type() == t ; }
|
inline int is_a( int t ) const { return get_type() == t ; }
|
||||||
inline bool is_dirty() const { return dirty; }
|
inline bool is_dirty() const { return dirty; }
|
||||||
|
inline double get_fov() const { return fov; }
|
||||||
|
inline double get_win_ratio() const { return win_ratio; }
|
||||||
inline double get_view_offset() const { return view_offset; }
|
inline double get_view_offset() const { return view_offset; }
|
||||||
inline double get_goal_view_offset() const { return goal_view_offset; }
|
inline double get_goal_view_offset() const { return goal_view_offset; }
|
||||||
inline double *get_geod_view_pos() { return geod_view_pos; }
|
inline double *get_geod_view_pos() { return geod_view_pos; }
|
||||||
|
|
|
@ -102,8 +102,7 @@ static void print_sgMat4( sgMat4 &in) {
|
||||||
// Update the view parameters
|
// Update the view parameters
|
||||||
void FGViewerLookAt::update() {
|
void FGViewerLookAt::update() {
|
||||||
Point3D tmp;
|
Point3D tmp;
|
||||||
sgVec3 minus_z, forward;
|
sgVec3 minus_z;
|
||||||
sgMat4 VIEWo;
|
|
||||||
|
|
||||||
// calculate the cartesion coords of the current lat/lon/0 elev
|
// calculate the cartesion coords of the current lat/lon/0 elev
|
||||||
Point3D p = Point3D( geod_view_pos[0],
|
Point3D p = Point3D( geod_view_pos[0],
|
||||||
|
|
Loading…
Add table
Reference in a new issue