]> git.mxchange.org Git - flightgear.git/commitdiff
- model loading should work again with the latest CVS PLIB (and, I
authorcurt <curt>
Thu, 29 Mar 2001 03:49:02 +0000 (03:49 +0000)
committercurt <curt>
Thu, 29 Mar 2001 03:49:02 +0000 (03:49 +0000)
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

src/FDM/UIUCModel/uiuc_aircraft.h
src/FDM/flight.cxx
src/Main/fg_props.hxx
src/Main/main.cxx

index 65ff390ba4de45f27fb820e3ebc28d0f615c382e..cda2abd2ee4d8f772be33b9f02fc208f72fdff92 100644 (file)
@@ -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
index 8502f728204cf3c484e48aea99bb2aae0f0191b3..2a4680673dc6ee5d38b017851de6e7fe355f60d1 100644 (file)
@@ -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,
index 0b52d0c947c1bc3b9a6d950481e0052d4c205ad4..8a6c28bcddc374f90897e03c0717f7730da9b71e 100644 (file)
@@ -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)
 {
index e7191c5773523864c87bd5bf218009c768fd2e93..8f69cd5726b8ce899d1e9a55ec13b554bce74979 100644 (file)
@@ -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" );