570 lines · 22.7 KB · C++
RawDownload
} QVector<UserInputMapper::InputPair> ControllerScriptingInterface::getAvailableInputs(unsigned int device) {    return DependencyManager::get<UserInputMapper>()->getAvailableInputs((unsigned short)device);} void ControllerScriptingInterface::resetAllDeviceBindings() {    DependencyManager::get<UserInputMapper>()->resetAllDeviceBindings();} void ControllerScriptingInterface::resetDevice(unsigned int device) {    DependencyManager::get<UserInputMapper>()->resetDevice(device);} int ControllerScriptingInterface::findDevice(QString name) {    return DependencyManager::get<UserInputMapper>()->findDevice(name);} QVector<QString> ControllerScriptingInterface::getDeviceNames() {    return DependencyManager::get<UserInputMapper>()->getDeviceNames();} float ControllerScriptingInterface::getActionValue(int action) {    return DependencyManager::get<UserInputMapper>()->getActionState(UserInputMapper::Action(action));} int ControllerScriptingInterface::findAction(QString actionName) {    return DependencyManager::get<UserInputMapper>()->findAction(actionName);} QVector<QString> ControllerScriptingInterface::getActionNames() const {    return DependencyManager::get<UserInputMapper>()->getActionNames();} InputController::InputController(int deviceTrackerId, int subTrackerId, QObject* parent) :    AbstractInputController(),    _deviceTrackerId(deviceTrackerId),    _subTrackerId(subTrackerId),    _isActive(false){} void InputController::update() {    _isActive = false;     // TODO for now the InputController is only supporting a JointTracker from a MotionTracker    MotionTracker* motionTracker = dynamic_cast< MotionTracker*> (DeviceTracker::getDevice(_deviceTrackerId));    if (motionTracker) {        if ((int)_subTrackerId < motionTracker->numJointTrackers()) {            const MotionTracker::JointTracker* joint = motionTracker->getJointTracker(_subTrackerId);             if (joint->isActive()) {                joint->getAbsFrame().getTranslation(_eventCache.absTranslation);                joint->getAbsFrame().getRotation(_eventCache.absRotation);                joint->getLocFrame().getTranslation(_eventCache.locTranslation);                joint->getLocFrame().getRotation(_eventCache.locRotation);                 _isActive = true;                emit spatialEvent(_eventCache);            }        }    }} const unsigned int INPUTCONTROLLER_KEY_DEVICE_OFFSET = 16;const unsigned int INPUTCONTROLLER_KEY_DEVICE_MASK = 16; InputController::Key InputController::getKey() const {    return (((_deviceTrackerId & INPUTCONTROLLER_KEY_DEVICE_MASK) << INPUTCONTROLLER_KEY_DEVICE_OFFSET) | _subTrackerId);}

Lines 501–570 of 570. Previous lines