- 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
Showing the changes to libraries/script-engine/src/EventTypes.cpp (1 of 33 files). Show all
Unified · Split
| @@ -19,6 +19,7 @@ void registerEventTypes(QScriptEngine* engine) { · 18 unmodified lines | ||
| 19 | 19 | qScriptRegisterMetaType(engine, mouseEventToScriptValue, mouseEventFromScriptValue); |
| 20 | 20 | qScriptRegisterMetaType(engine, touchEventToScriptValue, touchEventFromScriptValue); |
| 21 | 21 | qScriptRegisterMetaType(engine, wheelEventToScriptValue, wheelEventFromScriptValue); |
| 22 | + qScriptRegisterMetaType(engine, spatialEventToScriptValue, spatialEventFromScriptValue); | |
| 22 | 23 | } |
| 23 | 24 | |
| 24 | 25 | KeyEvent::KeyEvent() : |
| @@ -600,3 +601,34 @@ void wheelEventFromScriptValue(const QScriptValue& object, WheelEvent& event) { · 575 unmodified lines | ||
| 600 | 601 | } |
| 601 | 602 | |
| 602 | 603 | |
| 604 | + | |
| 605 | +SpatialEvent::SpatialEvent() : | |
| 606 | + locTranslation(0.0f), | |
| 607 | + locRotation(), | |
| 608 | + absTranslation(0.0f), | |
| 609 | + absRotation() | |
| 610 | +{ | |
| 611 | +}; | |
| 612 | + | |
| 613 | +SpatialEvent::SpatialEvent(const SpatialEvent& event) { | |
| 614 | + locTranslation = event.locTranslation; | |
| 615 | + locRotation = event.locRotation; | |
| 616 | + absTranslation = event.absTranslation; | |
| 617 | + absRotation = event.absRotation; | |
| 618 | +} | |
| 619 | + | |
| 620 | + | |
| 621 | +QScriptValue spatialEventToScriptValue(QScriptEngine* engine, const SpatialEvent& event) { | |
| 622 | + QScriptValue obj = engine->newObject(); | |
| 623 | + | |
| 624 | + obj.setProperty("locTranslation", vec3toScriptValue(engine, event.locTranslation) ); | |
| 625 | + obj.setProperty("locRotation", quatToScriptValue(engine, event.locRotation) ); | |
| 626 | + obj.setProperty("absTranslation", vec3toScriptValue(engine, event.absTranslation) ); | |
| 627 | + obj.setProperty("absRotation", quatToScriptValue(engine, event.absRotation) ); | |
| 628 | + | |
| 629 | + return obj; | |
| 630 | +} | |
| 631 | + | |
| 632 | +void spatialEventFromScriptValue(const QScriptValue& object,SpatialEvent& event) { | |
| 633 | + // nothing for now... | |
| 634 | +} | |