]> git.mxchange.org Git - simgear.git/blobdiff - simgear/canvas/ODGauge.cxx
Fix VS2010 lack of fminf
[simgear.git] / simgear / canvas / ODGauge.cxx
index 3f34f989a8635c27d26fc88e32066e83e2d83cad..4a2b7facf54b83644e633430cf4abfd4c9001ce2 100644 (file)
@@ -29,6 +29,7 @@
 #endif
 
 #include "ODGauge.hxx"
+#include "Canvas.hxx"
 #include "CanvasSystemAdapter.hxx"
 
 #include <simgear/debug/logstream.hxx>
@@ -43,6 +44,7 @@
 #include <osg/ShadeModel>
 #include <osg/StateSet>
 #include <osg/FrameBufferObject> // for GL_DEPTH_STENCIL_EXT on Windows
+#include <osg/Version>
 #include <osgUtil/RenderBin>
 
 #include <cassert>
@@ -123,12 +125,6 @@ namespace canvas
     clear();
   }
 
-  //----------------------------------------------------------------------------
-  void ODGauge::setSystemAdapter(const SystemAdapterPtr& system_adapter)
-  {
-    _system_adapter = system_adapter;
-  }
-
   //----------------------------------------------------------------------------
   void ODGauge::setSize(int size_x, int size_y)
   {
@@ -262,8 +258,8 @@ namespace canvas
     updateSampling();
     updateBlendMode();
 
-    if( _system_adapter )
-      _system_adapter->addCamera(camera.get());
+    if( Canvas::getSystemAdapter() )
+      Canvas::getSystemAdapter()->addCamera(camera.get());
 
     _flags |= AVAILABLE;
   }
@@ -271,7 +267,15 @@ namespace canvas
   //----------------------------------------------------------------------------
   void ODGauge::reinit()
   {
-    osg::NodeCallback* cull_callback = camera ? camera->getCullCallback() : 0;
+    osg::NodeCallback* cull_callback =
+      camera
+#if OSG_VERSION_LESS_THAN(3,3,2)
+      ? camera->getCullCallback()
+#else
+      ? dynamic_cast<osg::NodeCallback*>(camera->getCullCallback())
+#endif
+      : 0;
+
     clear();
     allocRT(cull_callback);
   }
@@ -279,8 +283,8 @@ namespace canvas
   //----------------------------------------------------------------------------
   void ODGauge::clear()
   {
-    if( camera.valid() && _system_adapter )
-      _system_adapter->removeCamera(camera.get());
+    if( camera.valid() && Canvas::getSystemAdapter() )
+      Canvas::getSystemAdapter()->removeCamera(camera.get());
     camera.release();
     texture.release();