History

Support for LeapMotion and worklist 19734

- Introduce the DeviceTracker class to abstract all the possible devices - Introduce the MotionTracker ( a DeviceTracker ) that contains a transform tree of joints - Add Leapmotion class as a MotionTracker and the support for the Leapmotion sdk in external - Add InputController as the abstraction of a MotionTracker/Joint for Javascript

samcake committed 12 years ago

Commit 3ce455a1 parent fe0374333 files · +7810 −197Browse files

Showing the changes to interface/src/scripting/ControllerScriptingInterface.h (1 of 33 files). Show all

Unified · Split

interface/src/scripting/ControllerScriptingInterface.h+42−0
@@ -17,6 +17,38 @@ · 16 unmodified lines
17#include <AbstractControllerScriptingInterface.h>17#include <AbstractControllerScriptingInterface.h>
18class PalmData;18class PalmData;
19 19
20
21class InputController : public AbstractInputController {
22 Q_OBJECT
23
24public:
25 InputController(int deviceTrackerId, int subTrackerId, QObject* parent = NULL);
26
27 virtual void update();
28 virtual Key getKey() const;
29
30public slots:
31
32 virtual bool isActive() const { return _isActive; }
33 virtual glm::vec3 getAbsTranslation() const { return _eventCache.absTranslation; }
34 virtual glm::quat getAbsRotation() const { return _eventCache.absRotation; }
35 virtual glm::vec3 getLocTranslation() const { return _eventCache.locTranslation; }
36 virtual glm::quat getLocRotation() const { return _eventCache.locRotation; }
37
38private:
39
40 int _deviceTrackerId;
41 int _subTrackerId;
42
43 // cache for the spatial
44 SpatialEvent _eventCache;
45 bool _isActive;
46
47
48signals:
49};
50
51
20/// handles scripting of input controller commands from JS52/// handles scripting of input controller commands from JS
21class ControllerScriptingInterface : public AbstractControllerScriptingInterface {53class ControllerScriptingInterface : public AbstractControllerScriptingInterface {
22 Q_OBJECT54 Q_OBJECT
@@ -43,6 +75,10 @@ public: · 20 unmodified lines
43 bool isWheelCaptured() const { return _wheelCaptured; }75 bool isWheelCaptured() const { return _wheelCaptured; }
44 bool isJoystickCaptured(int joystickIndex) const;76 bool isJoystickCaptured(int joystickIndex) const;
45 77
78 void updateInputControllers();
79
80 void releaseInputController( AbstractInputController* input );
81
46public slots:82public slots:
47 virtual bool isPrimaryButtonPressed() const;83 virtual bool isPrimaryButtonPressed() const;
48 virtual glm::vec2 getPrimaryJoystickPosition() const;84 virtual glm::vec2 getPrimaryJoystickPosition() const;
@@ -78,6 +114,8 @@ public slots: · 29 unmodified lines
78 114
79 virtual glm::vec2 getViewportDimensions() const;115 virtual glm::vec2 getViewportDimensions() const;
80 116
117 virtual AbstractInputController* createInputController( const QString& category, const QString& tracker );
118
81private:119private:
82 const PalmData* getPrimaryPalm() const;120 const PalmData* getPrimaryPalm() const;
83 const PalmData* getPalm(int palmIndex) const;121 const PalmData* getPalm(int palmIndex) const;
@@ -89,6 +127,9 @@ private: · 5 unmodified lines
89 bool _wheelCaptured;127 bool _wheelCaptured;
90 QMultiMap<int,KeyEvent> _capturedKeys;128 QMultiMap<int,KeyEvent> _capturedKeys;
91 QSet<int> _capturedJoysticks;129 QSet<int> _capturedJoysticks;
130
131 typedef std::map< AbstractInputController::Key, AbstractInputController* > InputControllerMap;
132 InputControllerMap _inputControllers;
92};133};
93 134
94const int NUMBER_OF_SPATIALCONTROLS_PER_PALM = 2; // the hand and the tip135const int NUMBER_OF_SPATIALCONTROLS_PER_PALM = 2; // the hand and the tip
@@ -98,4 +139,5 @@ const int NUMBER_OF_BUTTONS_PER_PALM = 6; · 3 unmodified lines
98const int PALM_SPATIALCONTROL = 0;139const int PALM_SPATIALCONTROL = 0;
99const int TIP_SPATIALCONTROL = 1;140const int TIP_SPATIALCONTROL = 1;
100 141
142
101#endif // hifi_ControllerScriptingInterface_h143#endif // hifi_ControllerScriptingInterface_h

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t