]> git.mxchange.org Git - flightgear.git/blobdiff - src/Scenery/scenery.cxx
Fix unused private vars.
[flightgear.git] / src / Scenery / scenery.cxx
index 908f4da22870e9bc226cd02f1364fa950637198d..379538ba8188cdbb2410da475abc0fbed1c634e9 100644 (file)
 #include <osgViewer/Viewer>
 
 #include <simgear/constants.h>
+#include <simgear/sg_inlines.h>
 #include <simgear/debug/logstream.hxx>
 #include <simgear/scene/tgdb/userdata.hxx>
 #include <simgear/scene/material/matlib.hxx>
+#include <simgear/scene/material/mat.hxx>
 #include <simgear/scene/util/SGNodeMasks.hxx>
+#include <simgear/scene/util/OsgMath.hxx>
 #include <simgear/scene/util/SGSceneUserData.hxx>
 #include <simgear/scene/model/CheckSceneryVisitor.hxx>
-#include <simgear/scene/bvh/BVHNode.hxx>
-#include <simgear/scene/bvh/BVHLineSegmentVisitor.hxx>
+#include <simgear/bvh/BVHNode.hxx>
+#include <simgear/bvh/BVHLineSegmentVisitor.hxx>
+#include <simgear/structure/commands.hxx>
 
-#include <Main/renderer.hxx>
+#include <Viewer/renderer.hxx>
 #include <Main/fg_props.hxx>
+#include <GUI/MouseCursor.hxx>
 
 #include "tilemgr.hxx"
 #include "scenery.hxx"
@@ -56,7 +61,12 @@ using namespace simgear;
 
 class FGGroundPickCallback : public SGPickCallback {
 public:
-  virtual bool buttonPressed(int button, const Info& info)
+  FGGroundPickCallback() : SGPickCallback(PriorityScenery)
+  { }
+    
+  virtual bool buttonPressed( int button,
+                              const osgGA::GUIEventAdapter&,
+                              const Info& info )
   {
     // only on left mouse button
     if (button != 0)
@@ -91,7 +101,7 @@ public:
     { return _haveHit; }
     const SGLineSegmentd& getLineSegment() const
     { return _lineSegment; }
-    const SGMaterial* getMaterial() const
+    const simgear::BVHMaterial* getMaterial() const
     { return _material; }
 
     virtual void apply(osg::Node& node)
@@ -151,7 +161,7 @@ private:
 
         SGLineSegmentd lineSegment = _lineSegment;
         bool haveHit = _haveHit;
-        const SGMaterial* material = _material;
+        const simgear::BVHMaterial* material = _material;
 
         _haveHit = false;
         _lineSegment = lineSegment.transform(SGMatrixd(inverseMatrix.ptr()));
@@ -204,7 +214,7 @@ private:
     SGLineSegmentd _lineSegment;
     const osg::Node* _skipNode;
 
-    const SGMaterial* _material;
+    const simgear::BVHMaterial* _material;
     bool _haveHit;
 };
 
@@ -224,7 +234,7 @@ FGScenery::~FGScenery() {
 void FGScenery::init() {
     // Scene graph root
     scene_graph = new osg::Group;
-    scene_graph->setName( "Scene" );
+    scene_graph->setName( "FGScenery" );
 
     // Terrain branch
     terrain_branch = new osg::Group;
@@ -247,7 +257,11 @@ void FGScenery::init() {
 }
 
 
-void FGScenery::update(double dt) {
+void FGScenery::update(double dt)
+{
+    SG_UNUSED(dt);
+    // nothing here, don't call again
+    suspend();
 }
 
 
@@ -260,7 +274,8 @@ void FGScenery::unbind() {
 
 bool
 FGScenery::get_cart_elevation_m(const SGVec3d& pos, double max_altoff,
-                                double& alt, const SGMaterial** material,
+                                double& alt,
+                                const simgear::BVHMaterial** material,
                                 const osg::Node* butNotFrom)
 {
   SGGeod geod = SGGeod::fromCart(pos);
@@ -270,7 +285,7 @@ FGScenery::get_cart_elevation_m(const SGVec3d& pos, double max_altoff,
 
 bool
 FGScenery::get_elevation_m(const SGGeod& geod, double& alt,
-                           const SGMaterial** material,
+                           const simgear::BVHMaterial** material,
                            const osg::Node* butNotFrom)
 {
   SGVec3d start = SGVec3d::fromGeod(geod);