]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/groundcache.cxx
Really implement fgWarpMouse for osgviewer
[flightgear.git] / src / FDM / groundcache.cxx
index bbddb3f174707ad35af682bab70f582bfb7b861f..035302dacb04c38c693053be75afc7df502c327e 100644 (file)
@@ -145,12 +145,6 @@ public:
     mGroundProperty.pivot = SGVec3d(0, 0, 0);
   }
 
-  void setSceneryCenter(const SGVec3d& cntr)
-  {
-    mLocalToGlobal.makeTranslate(cntr.osg());
-    mGlobalToLocal.makeTranslate(-cntr.osg());
-  }
-
   void updateCullMode(osg::StateSet* stateSet)
   {
     if (!stateSet)
@@ -200,11 +194,6 @@ public:
 
     FGGroundCache::GroundProperty& gp = mGroundProperty;
     // get some material information for use in the gear model
-    gp.material = globals->get_matlib()->findMaterial(&node);
-    if (gp.material) {
-      gp.type = gp.material->get_solid() ? FGInterface::Solid : FGInterface::Water;
-      return true;
-    }
     gp.type = FGInterface::Unknown;
     osg::Referenced* base = node.getUserData();
     if (!base)
@@ -241,6 +230,12 @@ public:
     bool oldBackfaceCulling = mBackfaceCulling;
     updateCullMode(drawable->getStateSet());
 
+    FGGroundCache::GroundProperty& gp = mGroundProperty;
+    // get some material information for use in the gear model
+    gp.material = globals->get_matlib()->findMaterial(drawable->getStateSet());
+    if (gp.material)
+      gp.type = gp.material->get_solid() ? FGInterface::Solid : FGInterface::Water;
+
     drawable->accept(mTriangleFunctor);
 
     mBackfaceCulling = oldBackfaceCulling;
@@ -507,7 +502,6 @@ FGGroundCache::prepare_ground_cache(double ref_time, const SGVec3d& pt,
 
   // Walk the scene graph and extract solid ground triangles and carrier data.
   GroundCacheFillVisitor gcfv(this, down, pt, cacheRadius, wireCacheRadius);
-  gcfv.setSceneryCenter(globals->get_scenery()->get_center());
   globals->get_scenery()->get_scene_graph()->accept(gcfv);
 
   // some stats
@@ -713,7 +707,7 @@ bool FGGroundCache::get_wire_ends(double t, SGVec3d end[2], SGVec3d vel[2])
   for (size_t i = 0; i < sz; ++i) {
     if (wires[i].wire_id == wire_id) {
       for (size_t k = 0; k < 2; ++k) {
-        SGVec3d pivotoff = end[k] - wires[i].rotation_pivot;
+        SGVec3d pivotoff = wires[i].ends[k] - wires[i].rotation_pivot;
         vel[k] = wires[i].velocity + cross(wires[i].rotation, pivotoff);
         end[k] = wires[i].ends[k] + t*vel[k];
       }