- 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 <FDM/LaRCsim/ls_types.h>
|
||||
|
||||
#include <map>
|
||||
#include STL_IOSTREAM
|
||||
#include <math.h>
|
||||
|
@ -856,11 +858,11 @@ typedef struct
|
|||
#define gear_map aircraft_->gear_map
|
||||
#define MAX_GEAR 16
|
||||
bool gear_model[MAX_GEAR];
|
||||
double D_gear_v[MAX_GEAR][3];
|
||||
double cgear[MAX_GEAR];
|
||||
double kgear[MAX_GEAR];
|
||||
double muGear[MAX_GEAR];
|
||||
double strutLength[MAX_GEAR];
|
||||
SCALAR D_gear_v[MAX_GEAR][3];
|
||||
SCALAR cgear[MAX_GEAR];
|
||||
SCALAR kgear[MAX_GEAR];
|
||||
SCALAR muGear[MAX_GEAR];
|
||||
SCALAR strutLength[MAX_GEAR];
|
||||
#define D_gear_v aircraft_->D_gear_v
|
||||
#define gear_model aircraft_->gear_model
|
||||
#define cgear aircraft_->cgear
|
||||
|
|
|
@ -162,18 +162,15 @@ FGInterface::init ()
|
|||
void
|
||||
FGInterface::bind ()
|
||||
{
|
||||
// Time management
|
||||
// Time management (read-only)
|
||||
fgTie("/fdm/time/delta_t", this,
|
||||
&FGInterface::get_delta_t);
|
||||
|
||||
// The following two can't be uncommented until we have support for
|
||||
// the "long" data type in the property manager
|
||||
/* fgTie("/fdm/time/elapsed", this,
|
||||
&FGInterface::get_elapsed);
|
||||
&FGInterface::get_delta_t); // read-only
|
||||
fgTie("/fdm/time/elapsed", this,
|
||||
&FGInterface::get_elapsed); // read-only
|
||||
fgTie("/fdm/time/remainder", this,
|
||||
&FGInterface::get_remainder); */
|
||||
&FGInterface::get_remainder); // read-only
|
||||
fgTie("/fdm/time/multi_loop", this,
|
||||
&FGInterface::get_multi_loop);
|
||||
&FGInterface::get_multi_loop); // read-only
|
||||
|
||||
// Aircraft position
|
||||
fgTie("/position/latitude", this,
|
||||
|
|
|
@ -45,6 +45,11 @@ inline int fgGetInt (const string &name, int defaultValue = 0)
|
|||
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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
inline bool fgSetLong (const string &name, long val)
|
||||
{
|
||||
return globals->get_props()->setLongValue(name, val);
|
||||
}
|
||||
|
||||
inline bool fgSetFloat (const string &name, float 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");
|
||||
}
|
||||
|
||||
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
|
||||
fgTie (const string &name, float *pointer, bool useDefault = true)
|
||||
{
|
||||
|
|
|
@ -1568,18 +1568,17 @@ int main( int argc, char **argv ) {
|
|||
acmodel_selector = new ssgSelector;
|
||||
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 =
|
||||
fgGetString("/sim/model/path", "Models/Geometry/glider.ac");
|
||||
|
||||
string full_model = globals->get_fg_root() + "/"
|
||||
+ acmodel_path;
|
||||
int pos = full_model.rfind("/");
|
||||
|
||||
SGPath texturepath( full_model.substr(0, pos) );
|
||||
cout << "Texture path = " << texturepath.str() << endl;
|
||||
ssgTexturePath( (char *)texturepath.c_str() );
|
||||
|
||||
ssgEntity *acmodel_obj = ssgLoad((char *)(acmodel_path.c_str()));
|
||||
SGPath full_model = globals->get_fg_root();
|
||||
full_model.append(acmodel_path);
|
||||
// this should be redundant...
|
||||
ssgModelPath( (char *)full_model.dir().c_str() );
|
||||
ssgTexturePath( (char *)full_model.dir().c_str() );
|
||||
ssgEntity *acmodel_obj = ssgLoad( (char *)full_model.c_str() );
|
||||
|
||||
// find moving parts (if this is an MDL model)
|
||||
flaps_selector = (ssgSelector*)fgFindNode( acmodel_obj, "FLAPS" );
|
||||
|
|
Loading…
Reference in a new issue