]> git.mxchange.org Git - flightgear.git/blobdiff - src/Cockpit/od_gauge.cxx
Allow using the system version of flite and the HTS engine
[flightgear.git] / src / Cockpit / od_gauge.cxx
index f2343a0aa5a8d90e363fd592b6e311694ba29bb6..883a17178036aabfa0a814506dca636056fd7cb2 100644 (file)
 #include <simgear/scene/material/EffectGeode.hxx>
 #include <simgear/scene/util/RenderConstants.hxx>
 
-#include <Canvas/FGCanvasSystemAdapter.hxx>
 #include <Main/globals.hxx>
 #include <Scenery/scenery.hxx>
 #include "od_gauge.hxx"
 
 #include <cassert>
 
-static simgear::canvas::SystemAdapterPtr system_adapter(
-  new canvas::FGCanvasSystemAdapter
-);
-
 //------------------------------------------------------------------------------
 FGODGauge::FGODGauge()
 {
-  setSystemAdapter(system_adapter);
+
 }
 
 //------------------------------------------------------------------------------
@@ -138,7 +133,7 @@ class ReplaceStaticTextureVisitor:
         return;
 
       osg::Group *parent = node.getParent(0);
-      if( !_node_name.empty() && parent->getName() != _node_name )
+      if( !_node_name.empty() && getNodeName(*parent) != _node_name )
         return;
 
       if( !_parent_name.empty() )
@@ -233,6 +228,21 @@ class ReplaceStaticTextureVisitor:
 
     simgear::canvas::CanvasWeakPtr  _canvas;
     simgear::canvas::Placements     _placements;
+
+    const std::string& getNodeName(const osg::Node& node) const
+    {
+      if( !node.getName().empty() )
+        return node.getName();
+
+      // Special handling for pick animation which clears the name of the object
+      // and instead sets the name of a parent group with one or two groups
+      // attached (one for normal rendering and one for the picking highlight).
+      osg::Group const* parent = node.getParent(0);
+      if( parent->getName() == "pick render group" )
+        return parent->getParent(0)->getName();
+
+      return node.getName();
+    }
 };
 
 //------------------------------------------------------------------------------