/usr/include/simgear/scene/util/SGPickCallback.hxx is in libsimgear-dev 3.0.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | /* -*-c++-*-
*
* Copyright (C) 2006-2007 Mathias Froehlich
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*/
#ifndef SG_SCENE_PICKCALLBACK_HXX
#define SG_SCENE_PICKCALLBACK_HXX
#include <osg/Vec2d>
#include <simgear/structure/SGReferenced.hxx>
#include <simgear/structure/SGSharedPtr.hxx>
#include <simgear/math/SGMath.hxx>
namespace osgGA { class GUIEventAdapter; }
// Used to implement scenery interaction.
// The interface is still under development
class SGPickCallback : public SGReferenced {
public:
enum Priority {
PriorityGUI = 0,
PriorityPanel = 1,
PriorityOther = 2,
PriorityScenery = 3
};
struct Info {
SGVec3d wgs84;
SGVec3d local;
SGVec2d uv;
};
SGPickCallback(Priority priority = PriorityOther) :
_priority(priority)
{ }
virtual ~SGPickCallback() {}
// 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)
{ }
/**
* @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 )
{ }
/**
* 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 )
{ return false; }
virtual Priority getPriority() const
{ return _priority; }
/**
* retrieve the name of the cursor to user when hovering this pickable
* object. Mapping is undefined, since SimGear doesn't know about cursors.
*/
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;
};
struct SGSceneryPick {
SGPickCallback::Info info;
SGSharedPtr<SGPickCallback> callback;
};
#endif
|