Data logging patches from Jon Berndt
Fix for model loading under plib-1.2.x in main.cxx
This commit is contained in:
parent
96fbc75b7c
commit
397a83d69f
7 changed files with 84 additions and 37 deletions
|
@ -431,6 +431,22 @@ void FGJSBsim::snap_shot(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool FGJSBsim::ToggleDataLogging(void) {
|
||||||
|
return fdmex->GetOutput()->Toggle();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool FGJSBsim::ToggleDataLogging(bool state) {
|
||||||
|
if (state) {
|
||||||
|
fdmex->GetOutput()->Enable();
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
fdmex->GetOutput()->Disable();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//Positions
|
//Positions
|
||||||
void FGJSBsim::set_Latitude(double lat) {
|
void FGJSBsim::set_Latitude(double lat) {
|
||||||
double sea_level_radius_meters,lat_geoc;
|
double sea_level_radius_meters,lat_geoc;
|
||||||
|
|
|
@ -194,6 +194,8 @@ public:
|
||||||
@param multiloop number of times to loop through the FDM
|
@param multiloop number of times to loop through the FDM
|
||||||
@return true if successful */
|
@return true if successful */
|
||||||
bool update( int multiloop );
|
bool update( int multiloop );
|
||||||
|
bool ToggleDataLogging(bool state);
|
||||||
|
bool ToggleDataLogging(void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FGFDMExec *fdmex;
|
FGFDMExec *fdmex;
|
||||||
|
|
|
@ -79,6 +79,7 @@ public:
|
||||||
void SetSubsystems(int tt) {SubSystems = tt;}
|
void SetSubsystems(int tt) {SubSystems = tt;}
|
||||||
inline void Enable(void) { enabled = true; }
|
inline void Enable(void) { enabled = true; }
|
||||||
inline void Disable(void) { enabled = false; }
|
inline void Disable(void) { enabled = false; }
|
||||||
|
inline bool Toggle(void) {enabled = !enabled; return enabled;}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
|
@ -577,3 +577,8 @@ void FGInterface::_busdump(void) {
|
||||||
SG_LOG(SG_FLIGHT,SG_INFO,"altitude_agl: " << altitude_agl );
|
SG_LOG(SG_FLIGHT,SG_INFO,"altitude_agl: " << altitude_agl );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void fgToggleFDMdataLogging(void) {
|
||||||
|
cur_fdm_state->ToggleDataLogging();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -447,6 +447,8 @@ public:
|
||||||
virtual void unbind ();
|
virtual void unbind ();
|
||||||
virtual void update ();
|
virtual void update ();
|
||||||
virtual bool update( int multi_loop );
|
virtual bool update( int multi_loop );
|
||||||
|
virtual bool ToggleDataLogging(bool state) {};
|
||||||
|
virtual bool ToggleDataLogging(void) {};
|
||||||
|
|
||||||
// Define the various supported flight models (many not yet implemented)
|
// Define the various supported flight models (many not yet implemented)
|
||||||
enum {
|
enum {
|
||||||
|
@ -1134,5 +1136,8 @@ void fgFDMForceAltitude(const string &model, double alt_meters);
|
||||||
// Set the local ground elevation
|
// Set the local ground elevation
|
||||||
void fgFDMSetGroundElevation(const string &model, double alt_meters);
|
void fgFDMSetGroundElevation(const string &model, double alt_meters);
|
||||||
|
|
||||||
|
// Toggle data logging on/off
|
||||||
|
void fgToggleFDMdataLogging(void);
|
||||||
|
|
||||||
|
|
||||||
#endif // _FLIGHT_HXX
|
#endif // _FLIGHT_HXX
|
||||||
|
|
|
@ -449,53 +449,66 @@ void GLUTspecialkey(int k, int x, int y) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case GLUT_KEY_F3: {
|
case GLUT_KEY_F3: {
|
||||||
string panel_path =
|
string panel_path =
|
||||||
fgGetString("/sim/panel/path", "Panels/Default/default.xml");
|
fgGetString("/sim/panel/path", "Panels/Default/default.xml");
|
||||||
FGPanel * new_panel = fgReadPanel(panel_path);
|
FGPanel * new_panel = fgReadPanel(panel_path);
|
||||||
if (new_panel == 0) {
|
if (new_panel == 0) {
|
||||||
SG_LOG(SG_INPUT, SG_ALERT,
|
SG_LOG(SG_INPUT, SG_ALERT,
|
||||||
"Error reading new panel from " << panel_path);
|
"Error reading new panel from " << panel_path);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SG_LOG(SG_INPUT, SG_INFO, "Loaded new panel from " << panel_path);
|
SG_LOG(SG_INPUT, SG_INFO, "Loaded new panel from " << panel_path);
|
||||||
current_panel->unbind();
|
current_panel->unbind();
|
||||||
delete current_panel;
|
delete current_panel;
|
||||||
current_panel = new_panel;
|
current_panel = new_panel;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case GLUT_KEY_F4: {
|
case GLUT_KEY_F4: {
|
||||||
SGPath props_path(globals->get_fg_root());
|
SGPath props_path(globals->get_fg_root());
|
||||||
props_path.append("preferences.xml");
|
props_path.append("preferences.xml");
|
||||||
SG_LOG(SG_INPUT, SG_INFO, "Rereading global preferences");
|
SG_LOG(SG_INPUT, SG_INFO, "Rereading global preferences");
|
||||||
if (!readProperties(props_path.str(), globals->get_props())) {
|
if (!readProperties(props_path.str(), globals->get_props())) {
|
||||||
SG_LOG(SG_INPUT, SG_ALERT,
|
SG_LOG(SG_INPUT, SG_ALERT,
|
||||||
"Failed to reread global preferences from "
|
"Failed to reread global preferences from "
|
||||||
<< props_path.str());
|
<< props_path.str());
|
||||||
} else {
|
} else {
|
||||||
SG_LOG(SG_INPUT, SG_INFO, "Finished Reading global preferences");
|
SG_LOG(SG_INPUT, SG_INFO, "Finished Reading global preferences");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case GLUT_KEY_F5: {
|
case GLUT_KEY_F5: {
|
||||||
current_panel->setYOffset(current_panel->getYOffset() - 5);
|
current_panel->setYOffset(current_panel->getYOffset() - 5);
|
||||||
fgReshape(fgGetInt("/sim/startup/xsize"),
|
fgReshape(fgGetInt("/sim/startup/xsize"),
|
||||||
fgGetInt("/sim/startup/ysize"));
|
fgGetInt("/sim/startup/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(fgGetInt("/sim/startup/xsize"),
|
fgReshape(fgGetInt("/sim/startup/xsize"),
|
||||||
fgGetInt("/sim/startup/ysize"));
|
fgGetInt("/sim/startup/ysize"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case GLUT_KEY_F7: {
|
case GLUT_KEY_F7: {
|
||||||
current_panel->setXOffset(current_panel->getXOffset() - 5);
|
current_panel->setXOffset(current_panel->getXOffset() - 5);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case GLUT_KEY_F8: {
|
case GLUT_KEY_F8: {
|
||||||
current_panel->setXOffset(current_panel->getXOffset() + 5);
|
current_panel->setXOffset(current_panel->getXOffset() + 5);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// case GLUT_KEY_F9: {
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
case GLUT_KEY_F10: {
|
||||||
|
fgToggleFDMdataLogging();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// case GLUT_KEY_F11: {
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// case GLUT_KEY_F12: {
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
case GLUT_KEY_END: // numeric keypad 1
|
case GLUT_KEY_END: // numeric keypad 1
|
||||||
v->set_goal_view_offset( SGD_PI * 0.75 );
|
v->set_goal_view_offset( SGD_PI * 0.75 );
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1577,8 +1577,13 @@ int main( int argc, char **argv ) {
|
||||||
fgGetString("/sim/model/path", "Models/Geometry/glider.ac");
|
fgGetString("/sim/model/path", "Models/Geometry/glider.ac");
|
||||||
SGPath full_model = globals->get_fg_root();
|
SGPath full_model = globals->get_fg_root();
|
||||||
full_model.append(acmodel_path);
|
full_model.append(acmodel_path);
|
||||||
// this should be redundant...
|
|
||||||
|
#if !defined( PLIB_1_2_X )
|
||||||
|
// this should be redundant ... but it breaks for relative paths
|
||||||
|
// w/ plib-1.2.0
|
||||||
ssgModelPath( (char *)full_model.dir().c_str() );
|
ssgModelPath( (char *)full_model.dir().c_str() );
|
||||||
|
#endif
|
||||||
|
|
||||||
ssgTexturePath( (char *)full_model.dir().c_str() );
|
ssgTexturePath( (char *)full_model.dir().c_str() );
|
||||||
ssgEntity *acmodel_obj = ssgLoad( (char *)full_model.c_str() );
|
ssgEntity *acmodel_obj = ssgLoad( (char *)full_model.c_str() );
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue