2001-04-22 17:00:08 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include <config.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_WINDOWS_H
|
|
|
|
# include <windows.h>
|
|
|
|
#endif
|
|
|
|
|
2001-12-07 22:38:19 +00:00
|
|
|
#include <GL/glut.h> // needed before pu.h
|
|
|
|
#include <plib/pu.h> // plib include
|
|
|
|
|
|
|
|
#include <FDM/flight.hxx>
|
2001-01-08 20:55:16 +00:00
|
|
|
|
2001-01-19 22:57:24 +00:00
|
|
|
#include <Main/globals.hxx>
|
2001-01-08 20:55:16 +00:00
|
|
|
#include <Main/fg_init.hxx>
|
2001-04-16 20:31:26 +00:00
|
|
|
#include <Main/fg_props.hxx>
|
2001-12-07 22:38:19 +00:00
|
|
|
#include <Scenery/tilemgr.hxx>
|
|
|
|
#include <Time/light.hxx>
|
2001-01-08 20:55:16 +00:00
|
|
|
|
|
|
|
#include "gui.h"
|
|
|
|
#include "trackball.h"
|
|
|
|
|
2001-04-16 20:31:26 +00:00
|
|
|
// from main.cxx
|
|
|
|
extern void fgReshape(int, int);
|
|
|
|
|
2001-01-08 20:55:16 +00:00
|
|
|
// FOR MOUSE VIEW MODE
|
|
|
|
// stashed trackball(_quat0, 0.0, 0.0, 0.0, 0.0);
|
|
|
|
static float _quat0[4];
|
|
|
|
|
|
|
|
float lastGuiQuat[4];
|
|
|
|
float curGuiQuat[4];
|
|
|
|
|
|
|
|
// To apply our mouse rotation quat to VIEW
|
|
|
|
// sgPreMultMat4( VIEW, GuiQuat_mat);
|
|
|
|
// This is here temporarily should be in views.hxx
|
|
|
|
float GuiQuat_mat[4][4];
|
|
|
|
|
|
|
|
void Quat0( void ) {
|
2001-12-07 22:38:19 +00:00
|
|
|
curGuiQuat[0] = _quat0[0];
|
|
|
|
curGuiQuat[1] = _quat0[1];
|
|
|
|
curGuiQuat[2] = _quat0[2];
|
|
|
|
curGuiQuat[3] = _quat0[3];
|
2001-01-08 20:55:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void initMouseQuat(void) {
|
2001-12-07 22:38:19 +00:00
|
|
|
trackball(_quat0, 0.0, 0.0, 0.0, 0.0);
|
|
|
|
Quat0();
|
|
|
|
build_rotmatrix(GuiQuat_mat, curGuiQuat);
|
2001-01-08 20:55:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void reInit(puObject *cb)
|
|
|
|
{
|
2001-12-11 22:40:14 +00:00
|
|
|
// BusyCursor(0);
|
2001-12-07 22:38:19 +00:00
|
|
|
Quat0();
|
|
|
|
|
2002-01-20 03:52:36 +00:00
|
|
|
static const SGPropertyNode *master_freeze
|
|
|
|
= fgGetNode("/sim/freeze/master");
|
|
|
|
|
|
|
|
bool freeze = master_freeze->getBoolValue();
|
|
|
|
if ( !freeze ) {
|
|
|
|
fgSetBool("/sim/freeze/master", true);
|
|
|
|
}
|
2001-12-07 22:38:19 +00:00
|
|
|
|
|
|
|
cur_fdm_state->unbind();
|
|
|
|
|
|
|
|
// in case user has changed window size as
|
|
|
|
// restoreInitialState() overwrites these
|
|
|
|
int xsize = fgGetInt("/sim/startup/xsize");
|
|
|
|
int ysize = fgGetInt("/sim/startup/ysize");
|
|
|
|
|
|
|
|
build_rotmatrix(GuiQuat_mat, curGuiQuat);
|
|
|
|
|
|
|
|
globals->restoreInitialState();
|
|
|
|
|
|
|
|
// Unsuccessful KLUDGE to fix the 'every other time'
|
|
|
|
// problem when doing a 'reset' after a 'goto airport'
|
|
|
|
|
|
|
|
// string AptId( fgGetString("/sim/startup/airport-id") );
|
|
|
|
// if( AptId.c_str() != "\0" )
|
|
|
|
// fgSetPosFromAirportID( AptId );
|
|
|
|
|
|
|
|
fgReInitSubsystems();
|
|
|
|
|
|
|
|
// reduntant(fgReInitSubsystems) ?
|
|
|
|
global_tile_mgr.update( fgGetDouble("/position/longitude-deg"),
|
|
|
|
fgGetDouble("/position/latitude-deg") );
|
|
|
|
|
|
|
|
cur_light_params.Update();
|
|
|
|
|
|
|
|
fgReshape( xsize, ysize );
|
|
|
|
|
2001-12-11 22:40:14 +00:00
|
|
|
// BusyCursor(1);
|
2001-12-07 22:38:19 +00:00
|
|
|
|
|
|
|
if ( !freeze ) {
|
2002-01-20 03:52:36 +00:00
|
|
|
fgSetBool("/sim/freeze/master", false);
|
2001-12-07 22:38:19 +00:00
|
|
|
}
|
2001-01-08 20:55:16 +00:00
|
|
|
}
|
|
|
|
|