| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
#ifndef OSGXR_OPENXR_INTERACTION_PROFILE |
| 5 |
#define OSGXR_OPENXR_INTERACTION_PROFILE 1 |
| 6 |
|
| 7 |
#include "Action.h" |
| 8 |
#include "Path.h" |
| 9 |
|
| 10 |
#include <osg/ref_ptr> |
| 11 |
|
| 12 |
#include <set> |
| 13 |
#include <utility> |
| 14 |
|
| 15 |
namespace osgXR { |
| 16 |
|
| 17 |
namespace OpenXR { |
| 18 |
|
| 19 |
class InteractionProfile : public osg::Referenced |
| 20 |
{ |
| 21 |
public: |
| 22 |
|
| 23 |
InteractionProfile(const Path &path); |
| 24 |
InteractionProfile(Instance *instance, |
| 25 |
const char *vendor, const char *type); |
| 26 |
virtual ~InteractionProfile(); |
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
void addBinding(Action *action, const std::string &binding) |
| 31 |
{ |
| 32 |
Path path(_path.getInstance(), binding); |
| 33 |
addBinding(action, path); |
| 34 |
} |
| 35 |
|
| 36 |
void addBinding(Action *action, const Path &binding); |
| 37 |
|
| 38 |
|
| 39 |
bool suggestBindings(); |
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
inline bool check(XrResult result, const char *actionMsg) const |
| 44 |
{ |
| 45 |
return _path.check(result, actionMsg); |
| 46 |
} |
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
inline const osg::ref_ptr<Instance> getInstance() const |
| 51 |
{ |
| 52 |
return _path.getInstance(); |
| 53 |
} |
| 54 |
|
| 55 |
inline XrInstance getXrInstance() const |
| 56 |
{ |
| 57 |
return _path.getXrInstance(); |
| 58 |
} |
| 59 |
|
| 60 |
inline const Path &getPath() const |
| 61 |
{ |
| 62 |
return _path; |
| 63 |
} |
| 64 |
|
| 65 |
protected: |
| 66 |
|
| 67 |
|
| 68 |
Path _path; |
| 69 |
typedef std::pair<osg::ref_ptr<Action>, XrPath> ActionBindingPair; |
| 70 |
std::set<ActionBindingPair> _bindings; |
| 71 |
}; |
| 72 |
|
| 73 |
} |
| 74 |
|
| 75 |
} |
| 76 |
|
| 77 |
#endif |