]> git.mxchange.org Git - simgear.git/blobdiff - simgear/scene/util/SGPickCallback.hxx
Work around apparent OSG 3.2.0 normal binding bug.
[simgear.git] / simgear / scene / util / SGPickCallback.hxx
index 33ab28adab6e529059ed1d7064eff06da1926966..c41bce7233e8878e3510a5e64cd7c4c16601f1ea 100644 (file)
@@ -44,6 +44,7 @@ public:
   struct Info {
     SGVec3d wgs84;
     SGVec3d local;
+    SGVec2d uv;
   };
 
   SGPickCallback(Priority priority = PriorityOther) :
@@ -51,19 +52,41 @@ public:
   { }
 
   virtual ~SGPickCallback() {}
-  virtual bool buttonPressed(int button, const osgGA::GUIEventAdapter* event, const Info& info)
+
+  // TODO maybe better provide a single callback to handle all events
+  virtual bool buttonPressed( int button,
+                              const osgGA::GUIEventAdapter& ea,
+                              const Info& info )
   { return false; }
   
   virtual void update(double dt, int keyModState)
   { }
-    
-  virtual void buttonReleased(int keyModState)
+
+  /**
+   * @param info    Can be null if no info is available (eg. mouse not over 3d
+   *                object anymore)
+   */
+  virtual void buttonReleased( int keyModState,
+                               const osgGA::GUIEventAdapter& ea,
+                               const Info* info )
+  { }
+
+  /**
+   * @param info    Can be null if no info is available (eg. mouse not over 3d
+   *                object anymore)
+   */
+  virtual void mouseMoved( const osgGA::GUIEventAdapter& ea,
+                           const Info* info )
   { }
 
-  virtual void mouseMoved(const osgGA::GUIEventAdapter* event)
+  /**
+   * The mouse is not hovering anymore over the element.
+   */
+  virtual void mouseLeave(const osg::Vec2d& windowPos)
   { }
 
-  virtual bool hover(const osg::Vec2d& windowPos, const Info& info)
+  virtual bool hover( const osg::Vec2d& windowPos,
+                      const Info& info )
   {  return false; }
 
   virtual Priority getPriority() const
@@ -76,6 +99,13 @@ public:
   virtual std::string getCursor() const
   { return std::string(); }
 
+  /**
+   * Whether the uv coordinates of the picking action should be calculated upon
+   * an intersection.
+   */
+  virtual bool needsUV() const
+  { return false; }
+
 private:
   Priority _priority;
 };