- model loading should work again with the latest CVS PLIB (and, I
hope, with earlier versions as well) - support for the new LONG value type - gear support for UIUC (updated for the newly renamed SG_* stuff; otherwise identical to what I sent you before) - fixed reported MSVC problem in src/FDM/flight.cxx
This commit is contained in:
parent
0ab39eea99
commit
31047f65ac
4 changed files with 41 additions and 24 deletions
|
@ -97,6 +97,8 @@
|
||||||
|
|
||||||
#include <simgear/compiler.h>
|
#include <simgear/compiler.h>
|
||||||
|
|
||||||
|
#include <FDM/LaRCsim/ls_types.h>
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include STL_IOSTREAM
|
#include STL_IOSTREAM
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
@ -856,11 +858,11 @@ typedef struct
|
||||||
#define gear_map aircraft_->gear_map
|
#define gear_map aircraft_->gear_map
|
||||||
#define MAX_GEAR 16
|
#define MAX_GEAR 16
|
||||||
bool gear_model[MAX_GEAR];
|
bool gear_model[MAX_GEAR];
|
||||||
double D_gear_v[MAX_GEAR][3];
|
SCALAR D_gear_v[MAX_GEAR][3];
|
||||||
double cgear[MAX_GEAR];
|
SCALAR cgear[MAX_GEAR];
|
||||||
double kgear[MAX_GEAR];
|
SCALAR kgear[MAX_GEAR];
|
||||||
double muGear[MAX_GEAR];
|
SCALAR muGear[MAX_GEAR];
|
||||||
double strutLength[MAX_GEAR];
|
SCALAR strutLength[MAX_GEAR];
|
||||||
#define D_gear_v aircraft_->D_gear_v
|
#define D_gear_v aircraft_->D_gear_v
|
||||||
#define gear_model aircraft_->gear_model
|
#define gear_model aircraft_->gear_model
|
||||||
#define cgear aircraft_->cgear
|
#define cgear aircraft_->cgear
|
||||||
|
|
|
@ -162,18 +162,15 @@ FGInterface::init ()
|
||||||
void
|
void
|
||||||
FGInterface::bind ()
|
FGInterface::bind ()
|
||||||
{
|
{
|
||||||
// Time management
|
// Time management (read-only)
|
||||||
fgTie("/fdm/time/delta_t", this,
|
fgTie("/fdm/time/delta_t", this,
|
||||||
&FGInterface::get_delta_t);
|
&FGInterface::get_delta_t); // read-only
|
||||||
|
fgTie("/fdm/time/elapsed", this,
|
||||||
// The following two can't be uncommented until we have support for
|
&FGInterface::get_elapsed); // read-only
|
||||||
// the "long" data type in the property manager
|
|
||||||
/* fgTie("/fdm/time/elapsed", this,
|
|
||||||
&FGInterface::get_elapsed);
|
|
||||||
fgTie("/fdm/time/remainder", this,
|
fgTie("/fdm/time/remainder", this,
|
||||||
&FGInterface::get_remainder); */
|
&FGInterface::get_remainder); // read-only
|
||||||
fgTie("/fdm/time/multi_loop", this,
|
fgTie("/fdm/time/multi_loop", this,
|
||||||
&FGInterface::get_multi_loop);
|
&FGInterface::get_multi_loop); // read-only
|
||||||
|
|
||||||
// Aircraft position
|
// Aircraft position
|
||||||
fgTie("/position/latitude", this,
|
fgTie("/position/latitude", this,
|
||||||
|
|
|
@ -45,6 +45,11 @@ inline int fgGetInt (const string &name, int defaultValue = 0)
|
||||||
return globals->get_props()->getIntValue(name, defaultValue);
|
return globals->get_props()->getIntValue(name, defaultValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline int fgGetLong (const string &name, long defaultValue = 0L)
|
||||||
|
{
|
||||||
|
return globals->get_props()->getLongValue(name, defaultValue);
|
||||||
|
}
|
||||||
|
|
||||||
inline float fgGetFloat (const string &name, float defaultValue = 0.0)
|
inline float fgGetFloat (const string &name, float defaultValue = 0.0)
|
||||||
{
|
{
|
||||||
return globals->get_props()->getFloatValue(name, defaultValue);
|
return globals->get_props()->getFloatValue(name, defaultValue);
|
||||||
|
@ -70,6 +75,11 @@ inline bool fgSetInt (const string &name, int val)
|
||||||
return globals->get_props()->setIntValue(name, val);
|
return globals->get_props()->setIntValue(name, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool fgSetLong (const string &name, long val)
|
||||||
|
{
|
||||||
|
return globals->get_props()->setLongValue(name, val);
|
||||||
|
}
|
||||||
|
|
||||||
inline bool fgSetFloat (const string &name, float val)
|
inline bool fgSetFloat (const string &name, float val)
|
||||||
{
|
{
|
||||||
return globals->get_props()->setFloatValue(name, val);
|
return globals->get_props()->setFloatValue(name, val);
|
||||||
|
@ -118,6 +128,15 @@ fgTie (const string &name, int *pointer, bool useDefault = true)
|
||||||
"Failed to tie property " << name << " to a pointer");
|
"Failed to tie property " << name << " to a pointer");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void
|
||||||
|
fgTie (const string &name, long *pointer, bool useDefault = true)
|
||||||
|
{
|
||||||
|
if (!globals->get_props()->tie(name, SGRawValuePointer<long>(pointer),
|
||||||
|
useDefault))
|
||||||
|
SG_LOG(SG_GENERAL, SG_WARN,
|
||||||
|
"Failed to tie property " << name << " to a pointer");
|
||||||
|
}
|
||||||
|
|
||||||
inline void
|
inline void
|
||||||
fgTie (const string &name, float *pointer, bool useDefault = true)
|
fgTie (const string &name, float *pointer, bool useDefault = true)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1568,18 +1568,17 @@ int main( int argc, char **argv ) {
|
||||||
acmodel_selector = new ssgSelector;
|
acmodel_selector = new ssgSelector;
|
||||||
acmodel_pos = new ssgTransform;
|
acmodel_pos = new ssgTransform;
|
||||||
|
|
||||||
|
// Get the model location, and load textures from the same
|
||||||
|
// directory. Use an absolute path for the model to avoid
|
||||||
|
// incompatibilities in different versions of PLIB.
|
||||||
string acmodel_path =
|
string acmodel_path =
|
||||||
fgGetString("/sim/model/path", "Models/Geometry/glider.ac");
|
fgGetString("/sim/model/path", "Models/Geometry/glider.ac");
|
||||||
|
SGPath full_model = globals->get_fg_root();
|
||||||
string full_model = globals->get_fg_root() + "/"
|
full_model.append(acmodel_path);
|
||||||
+ acmodel_path;
|
// this should be redundant...
|
||||||
int pos = full_model.rfind("/");
|
ssgModelPath( (char *)full_model.dir().c_str() );
|
||||||
|
ssgTexturePath( (char *)full_model.dir().c_str() );
|
||||||
SGPath texturepath( full_model.substr(0, pos) );
|
ssgEntity *acmodel_obj = ssgLoad( (char *)full_model.c_str() );
|
||||||
cout << "Texture path = " << texturepath.str() << endl;
|
|
||||||
ssgTexturePath( (char *)texturepath.c_str() );
|
|
||||||
|
|
||||||
ssgEntity *acmodel_obj = ssgLoad((char *)(acmodel_path.c_str()));
|
|
||||||
|
|
||||||
// find moving parts (if this is an MDL model)
|
// find moving parts (if this is an MDL model)
|
||||||
flaps_selector = (ssgSelector*)fgFindNode( acmodel_obj, "FLAPS" );
|
flaps_selector = (ssgSelector*)fgFindNode( acmodel_obj, "FLAPS" );
|
||||||
|
|
Loading…
Reference in a new issue