From 2cea593fbdaa4cb2f673cfed9b82d60372d5e556 Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Thu, 3 Dec 2015 10:20:40 -0800 Subject: [PATCH] Remove RealSense & MIDI --- cmake/modules/FindRSSDK.cmake | 33 ---- cmake/modules/FindRtMidi.cmake | 30 --- interface/CMakeLists.txt | 9 +- interface/external/rssdk/readme.txt | 9 - interface/external/rtmidi/readme.txt | 43 ----- interface/src/Application.cpp | 14 -- interface/src/Menu.cpp | 7 - interface/src/Menu.h | 1 - interface/src/devices/MIDIManager.cpp | 73 -------- interface/src/devices/MIDIManager.h | 58 ------ interface/src/devices/RealSense.cpp | 259 -------------------------- interface/src/devices/RealSense.h | 65 ------- 12 files changed, 1 insertion(+), 600 deletions(-) delete mode 100644 cmake/modules/FindRSSDK.cmake delete mode 100644 cmake/modules/FindRtMidi.cmake delete mode 100644 interface/external/rssdk/readme.txt delete mode 100644 interface/external/rtmidi/readme.txt delete mode 100644 interface/src/devices/MIDIManager.cpp delete mode 100644 interface/src/devices/MIDIManager.h delete mode 100644 interface/src/devices/RealSense.cpp delete mode 100644 interface/src/devices/RealSense.h diff --git a/cmake/modules/FindRSSDK.cmake b/cmake/modules/FindRSSDK.cmake deleted file mode 100644 index c31b0efcd9..0000000000 --- a/cmake/modules/FindRSSDK.cmake +++ /dev/null @@ -1,33 +0,0 @@ -# Try to find the RSSDK library -# -# You must provide a RSSDK_ROOT_DIR which contains lib and include directories -# -# Once done this will define -# -# RSSDK_FOUND - system found RSSDK -# RSSDK_INCLUDE_DIRS - the RSSDK include directory -# RSSDK_LIBRARIES - Link this to use RSSDK -# -# Created on 12/7/2014 by Thijs Wenker -# Copyright (c) 2014 High Fidelity -# - -include("${MACRO_DIR}/HifiLibrarySearchHints.cmake") -hifi_library_search_hints("rssdk") - -find_path(RSSDK_INCLUDE_DIRS pxcbase.h PATH_SUFFIXES include HINTS ${RSSDK_SEARCH_DIRS}) - -if (WIN32) - find_library(RSSDK_LIBRARY_DEBUG libpxc_d PATH_SUFFIXES lib/Win32 HINTS ${RSSDK_SEARCH_DIRS}) - find_library(RSSDK_LIBRARY_RELEASE libpxc PATH_SUFFIXES lib/Win32 HINTS ${RSSDK_SEARCH_DIRS}) -endif () - -include(SelectLibraryConfigurations) -select_library_configurations(RSSDK) - -set(RSSDK_LIBRARIES "${RSSDK_LIBRARY}") - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(RSSDK DEFAULT_MSG RSSDK_INCLUDE_DIRS RSSDK_LIBRARIES) - -mark_as_advanced(RSSDK_INCLUDE_DIRS RSSDK_LIBRARIES RSSDK_SEARCH_DIRS) diff --git a/cmake/modules/FindRtMidi.cmake b/cmake/modules/FindRtMidi.cmake deleted file mode 100644 index 213c990b52..0000000000 --- a/cmake/modules/FindRtMidi.cmake +++ /dev/null @@ -1,30 +0,0 @@ -# -# FindRtMidi.cmake -# -# Try to find the RtMidi library -# -# You can provide a RTMIDI_ROOT_DIR which contains lib and include directories -# -# Once done this will define -# -# RTMIDI_FOUND - system found RtMidi -# RTMIDI_INCLUDE_DIRS - the RtMidi include directory -# RTMIDI_LIBRARIES - link to this to use RtMidi -# -# Created on 6/30/2014 by Stephen Birarda -# Copyright 2014 High Fidelity, Inc. -# -# Distributed under the Apache License, Version 2.0. -# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -# - -include("${MACRO_DIR}/HifiLibrarySearchHints.cmake") -hifi_library_search_hints("rtmidi") - -find_path(RTMIDI_INCLUDE_DIRS RtMidi.h PATH_SUFFIXES include HINTS ${RTMIDI_SEARCH_DIRS}) -find_library(RTMIDI_LIBRARIES NAMES rtmidi PATH_SUFFIXES lib HINTS ${RTMIDI_SEARCH_DIRS}) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(RtMidi DEFAULT_MSG RTMIDI_INCLUDE_DIRS RTMIDI_LIBRARIES) - -mark_as_advanced(RTMIDI_INCLUDE_DIRS RTMIDI_LIBRARIES RTMIDI_SEARCH_DIRS) \ No newline at end of file diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index 67ce3f3df8..573fc1ce1e 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -2,7 +2,7 @@ set(TARGET_NAME interface) project(${TARGET_NAME}) # set a default root dir for each of our optional externals if it was not passed -set(OPTIONAL_EXTERNALS "LeapMotion" "RtMidi" "RSSDK") +set(OPTIONAL_EXTERNALS "LeapMotion") if(WIN32) list(APPEND OPTIONAL_EXTERNALS "3DConnexionClient") @@ -161,13 +161,6 @@ foreach(EXTERNAL ${OPTIONAL_EXTERNALS}) endif () endforeach() -# special OS X modifications for RtMidi library -if (RTMIDI_FOUND AND NOT DISABLE_RTMIDI AND APPLE) - find_library(CoreMIDI CoreMIDI) - add_definitions(-D__MACOSX_CORE__) - target_link_libraries(${TARGET_NAME} ${CoreMIDI}) -endif () - # include headers for interface and InterfaceConfig. include_directories("${PROJECT_SOURCE_DIR}/src") diff --git a/interface/external/rssdk/readme.txt b/interface/external/rssdk/readme.txt deleted file mode 100644 index fe2246e32a..0000000000 --- a/interface/external/rssdk/readme.txt +++ /dev/null @@ -1,9 +0,0 @@ - -Instructions for adding the Intel Realsense (RSSDK) to Interface -Thijs Wenker, December 19, 2014 - -This is Windows only for now. - -1. Download the SDK at https://software.intel.com/en-us/intel-realsense-sdk/download - -2. Copy the `lib` and `include` folder inside this directory \ No newline at end of file diff --git a/interface/external/rtmidi/readme.txt b/interface/external/rtmidi/readme.txt deleted file mode 100644 index 3b9d6603a9..0000000000 --- a/interface/external/rtmidi/readme.txt +++ /dev/null @@ -1,43 +0,0 @@ - -Instructions for adding the RtMidi library to Interface -Stephen Birarda, June 30, 2014 - -1. Download the RtMidi tarball from High Fidelity S3. - http://public.highfidelity.io/dependencies/rtmidi-2.1.0.tar.gz - -2. Copy RtMidi.h to externals/rtmidi/include. - -3. Compile the RtMidi library. - -3. Copy either librtmidi.dylib (dynamic) or librtmidi.a (static) to externals/rtmidi/lib - -4. Delete your build directory, run cmake and build, and you should be all set. - -========================= - -RtMidi: realtime MIDI i/o C++ classes
-Copyright (c) 2003-2014 Gary P. Scavone - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation files -(the "Software"), to deal in the Software without restriction, -including without limitation the rights to use, copy, modify, merge, -publish, distribute, sublicense, and/or sell copies of the Software, -and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -Any person wishing to distribute modifications to the Software is -asked to send the modifications to the original developer so that -they can be incorporated into the canonical version. This is, -however, not a binding provision of this license. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF -CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index ef10ad4464..0c913bfaef 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -110,8 +110,6 @@ #include "devices/EyeTracker.h" #include "devices/Faceshift.h" #include "devices/Leapmotion.h" -#include "devices/MIDIManager.h" -#include "devices/RealSense.h" #include "DiscoverabilityManager.h" #include "GLCanvas.h" #include "InterfaceActionFactory.h" @@ -719,12 +717,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : // set the local loopback interface for local sounds from audio scripts AudioScriptingInterface::getInstance().setLocalAudioInterface(audioIO.data()); -#ifdef HAVE_RTMIDI - // setup the MIDIManager - MIDIManager& midiManagerInstance = MIDIManager::getInstance(); - midiManagerInstance.openDefaultPort(); -#endif - this->installEventFilter(this); // initialize our face trackers after loading the menu settings @@ -970,7 +962,6 @@ Application::~Application() { nodeThread->wait(); Leapmotion::destroy(); - RealSense::destroy(); #if 0 ConnexionClient::getInstance().destroy(); @@ -2519,7 +2510,6 @@ void Application::init() { qCDebug(interfaceapp) << "Loaded settings"; Leapmotion::init(); - RealSense::init(); // fire off an immediate domain-server check in now that settings are loaded DependencyManager::get()->sendDomainServerCheckIn(); @@ -4069,10 +4059,6 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri scriptEngine->registerGlobalObject("Scene", DependencyManager::get().data()); scriptEngine->registerGlobalObject("ScriptDiscoveryService", this->getRunningScriptsWidget()); - -#ifdef HAVE_RTMIDI - scriptEngine->registerGlobalObject("MIDI", &MIDIManager::getInstance()); -#endif } bool Application::canAcceptURL(const QString& urlString) { diff --git a/interface/src/Menu.cpp b/interface/src/Menu.cpp index d0c8b502c5..48204464fc 100644 --- a/interface/src/Menu.cpp +++ b/interface/src/Menu.cpp @@ -29,7 +29,6 @@ #include "avatar/AvatarManager.h" #include "devices/DdeFaceTracker.h" #include "devices/Faceshift.h" -#include "devices/RealSense.h" #include "input-plugins/SpacemouseManager.h" #include "MainWindow.h" #include "scripting/MenuScriptingInterface.h" @@ -462,12 +461,6 @@ Menu::Menu() { MenuWrapper* leapOptionsMenu = handOptionsMenu->addMenu("Leap Motion"); addCheckableActionToQMenuAndActionHash(leapOptionsMenu, MenuOption::LeapMotionOnHMD, 0, false); -#ifdef HAVE_RSSDK - MenuWrapper* realSenseOptionsMenu = handOptionsMenu->addMenu("RealSense"); - addActionToQMenuAndActionHash(realSenseOptionsMenu, MenuOption::LoadRSSDKFile, 0, - RealSense::getInstance(), SLOT(loadRSSDKFile())); -#endif - MenuWrapper* networkMenu = developerMenu->addMenu("Network"); addActionToQMenuAndActionHash(networkMenu, MenuOption::ReloadContent, 0, qApp, SLOT(reloadResourceCaches())); addCheckableActionToQMenuAndActionHash(networkMenu, MenuOption::DisableNackPackets, 0, false, diff --git a/interface/src/Menu.h b/interface/src/Menu.h index 6b51987479..a30c5d434b 100644 --- a/interface/src/Menu.h +++ b/interface/src/Menu.h @@ -211,7 +211,6 @@ namespace MenuOption { const QString LeapMotionOnHMD = "Leap Motion on HMD"; const QString LoadScript = "Open and Run Script File..."; const QString LoadScriptURL = "Open and Run Script from URL..."; - const QString LoadRSSDKFile = "Load .rssdk file"; const QString LodTools = "LOD Tools"; const QString Login = "Login"; const QString Log = "Log"; diff --git a/interface/src/devices/MIDIManager.cpp b/interface/src/devices/MIDIManager.cpp deleted file mode 100644 index a21f5d49f5..0000000000 --- a/interface/src/devices/MIDIManager.cpp +++ /dev/null @@ -1,73 +0,0 @@ -// -// MIDIManager.cpp -// -// -// Created by Stephen Birarda on 2014-06-30. -// Copyright 2014 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -#include - -#include "InterfaceLogging.h" -#include "MIDIManager.h" - -MIDIManager& MIDIManager::getInstance() { - static MIDIManager sharedInstance; - return sharedInstance; -} - -void MIDIManager::midiCallback(double deltaTime, std::vector* message, void* userData) { -#ifdef HAVE_RTMIDI - - MIDIEvent callbackEvent; - callbackEvent.deltaTime = deltaTime; - - callbackEvent.type = message->at(0); - - if (message->size() > 1) { - callbackEvent.data1 = message->at(1); - } - - if (message->size() > 2) { - callbackEvent.data2 = message->at(2); - } - - emit getInstance().midiEvent(callbackEvent); -#endif -} - -MIDIManager::~MIDIManager() { -#ifdef HAVE_RTMIDI - delete _midiInput; -#endif -} - -#ifdef HAVE_RTMIDI -const int DEFAULT_MIDI_PORT = 0; -#endif - -void MIDIManager::openDefaultPort() { -#ifdef HAVE_RTMIDI - if (!_midiInput) { - _midiInput = new RtMidiIn(); - - if (_midiInput->getPortCount() > 0) { - qCDebug(interfaceapp) << "MIDIManager opening port" << DEFAULT_MIDI_PORT; - - _midiInput->openPort(DEFAULT_MIDI_PORT); - - // don't ignore sysex, timing, or active sensing messages - _midiInput->ignoreTypes(false, false, false); - - _midiInput->setCallback(&MIDIManager::midiCallback); - } else { - qCDebug(interfaceapp) << "MIDIManager openDefaultPort called but there are no ports available."; - delete _midiInput; - _midiInput = NULL; - } - } -#endif -} diff --git a/interface/src/devices/MIDIManager.h b/interface/src/devices/MIDIManager.h deleted file mode 100644 index 9fc55d11da..0000000000 --- a/interface/src/devices/MIDIManager.h +++ /dev/null @@ -1,58 +0,0 @@ -// -// MIDIManager.h -// interface/src/devices -// -// Created by Stephen Birarda on 2014-06-30. -// Copyright 2014 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -#ifndef hifi_MIDIManager_h -#define hifi_MIDIManager_h - -#include -#include - -#include - -#ifdef HAVE_RTMIDI -#include -#endif - -class MIDIManager : public QObject { - Q_OBJECT - - Q_PROPERTY(unsigned int NoteOn READ NoteOn) - Q_PROPERTY(unsigned int NoteOff READ NoteOff) - Q_PROPERTY(unsigned int ModWheel READ ModWheel) - Q_PROPERTY(unsigned int PitchWheel READ PitchWheel) - -public: - static MIDIManager& getInstance(); - static void midiCallback(double deltaTime, std::vector* message, void* userData); - - ~MIDIManager(); - - void openDefaultPort(); -#ifdef HAVE_RTMIDI - bool hasDevice() const { return !!_midiInput; } -#endif -public slots: - unsigned int NoteOn() const { return 144; } - unsigned int NoteOff() const { return 128; } - unsigned int ModWheel() const { return 176; } - unsigned int PitchWheel() const { return 224; } -signals: - void midiEvent(const MIDIEvent& event); - -private: -#ifdef HAVE_RTMIDI - RtMidiIn* _midiInput; -#endif -}; - - -#endif // hifi_MIDIManager_h - diff --git a/interface/src/devices/RealSense.cpp b/interface/src/devices/RealSense.cpp deleted file mode 100644 index ce28e40f2b..0000000000 --- a/interface/src/devices/RealSense.cpp +++ /dev/null @@ -1,259 +0,0 @@ -// -// RealSense.cpp -// interface/src/devices -// -// Created by Thijs Wenker on 12/10/14 -// Copyright 2014 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -#include "Application.h" -#include "RealSense.h" -#include "MainWindow.h" -#include "Menu.h" -#include "SharedUtil.h" - -#ifdef HAVE_RSSDK -const int PALMROOT_NUM_JOINTS = 3; -const int FINGER_NUM_JOINTS = 4; -#endif // HAVE_RSSDK - -const DeviceTracker::Name RealSense::NAME = "RealSense"; - -// find the index of a joint from -// the side: true = right -// the finger & the bone: -// finger in [0..4] : bone in [0..3] a finger phalange -// [-1] up the hand branch : bone in [0..1] <=> [ hand, forearm] -MotionTracker::Index evalRealSenseJointIndex(bool isRightSide, int finger, int bone) { -#ifdef HAVE_RSSDK - MotionTracker::Index offset = 1 // start after root - + (int(isRightSide) * PXCHandData::NUMBER_OF_JOINTS) // then offset for side - + PALMROOT_NUM_JOINTS; // then add the arm/forearm/hand chain - if (finger >= 0) { - // from there go down in the correct finger and bone - return offset + (finger * FINGER_NUM_JOINTS) + bone; - } else { - // or go back up for the correct root bone - return offset - 1 - bone; - } -#else - return -1; -#endif // HAVE_RSSDK -} - -// static -void RealSense::init() { - DeviceTracker* device = DeviceTracker::getDevice(NAME); - if (!device) { - // create a new RealSense and register it - RealSense* realSense = new RealSense(); - DeviceTracker::registerDevice(NAME, realSense); - } -} - -// static -void RealSense::destroy() { - DeviceTracker::destroyDevice(NAME); -} - -// static -RealSense* RealSense::getInstance() { - DeviceTracker* device = DeviceTracker::getDevice(NAME); - if (!device) { - // create a new RealSense and register it - RealSense* realSense = new RealSense(); - DeviceTracker::registerDevice(NAME, realSense); - } - return dynamic_cast< RealSense* > (device); -} - -RealSense::RealSense() : - MotionTracker(), - _active(false) -{ -#ifdef HAVE_RSSDK - _handData = NULL; - _session = PXCSession_Create(); - initSession(false, NULL); - - // Create the RealSense joint hierarchy - std::vector< Semantic > sides; - sides.push_back("joint_L_"); - sides.push_back("joint_R_"); - - std::vector< Semantic > rootBones; - rootBones.push_back("wrist"); - rootBones.push_back("hand"); - - std::vector< Semantic > fingers; - fingers.push_back("thumb"); - fingers.push_back("index"); - fingers.push_back("middle"); - fingers.push_back("ring"); - fingers.push_back("pinky"); - - std::vector< Semantic > fingerBones; - fingerBones.push_back("1"); - fingerBones.push_back("2"); - fingerBones.push_back("3"); - fingerBones.push_back("4"); - - std::vector< Index > palms; - for (unsigned int s = 0; s < sides.size(); s++) { - Index rootJoint = 0; - for (unsigned int rb = 0; rb < rootBones.size(); rb++) { - rootJoint = addJoint(sides[s] + rootBones[rb], rootJoint); - } - - // capture the hand index for debug - palms.push_back(rootJoint); - - for (unsigned int f = 0; f < fingers.size(); f++) { - for (unsigned int b = 0; b < fingerBones.size(); b++) { - rootJoint = addJoint(sides[s] + fingers[f] + fingerBones[b], rootJoint); - } - } - } -#endif // HAVE_RSSDK -} - -RealSense::~RealSense() { -#ifdef HAVE_RSSDK - _manager->Release(); -#endif // HAVE_RSSDK -} - -void RealSense::initSession(bool playback, QString filename) { -#ifdef HAVE_RSSDK - _active = false; - _properlyInitialized = false; - if (_handData != NULL) { - _handData->Release(); - _handController->Release(); - _session->Release(); - _config->Release(); - } - _manager = _session->CreateSenseManager(); - if (playback) { - _manager->QueryCaptureManager()->SetFileName(filename.toStdWString().c_str(), false); - } - _manager->QueryCaptureManager()->SetRealtime(!playback); - _manager->EnableHand(0); - _handController = _manager->QueryHand(); - - if (_manager->Init() == PXC_STATUS_NO_ERROR) { - _handData = _handController->CreateOutput(); - - PXCCapture::Device *device = _manager->QueryCaptureManager()->QueryDevice(); - PXCCapture::DeviceInfo dinfo; - _manager->QueryCaptureManager()->QueryDevice()->QueryDeviceInfo(&dinfo); - if (dinfo.model == PXCCapture::DEVICE_MODEL_IVCAM) - { - device->SetDepthConfidenceThreshold(1); - device->SetMirrorMode(PXCCapture::Device::MIRROR_MODE_DISABLED); - device->SetIVCAMFilterOption(6); - } - _properlyInitialized = true; - } - - _config = _handController->CreateActiveConfiguration(); - _config->EnableStabilizer(true); - _config->SetTrackingMode(PXCHandData::TRACKING_MODE_FULL_HAND); - _config->ApplyChanges(); -#endif // HAVE_RSSDK -} - -#ifdef HAVE_RSSDK -glm::quat quatFromPXCPoint4DF32(const PXCPoint4DF32& basis) { - return glm::normalize(glm::quat(basis.w, basis.x, basis.y, basis.z) * glm::quat(glm::vec3(0, M_PI, 0))); -} - -glm::vec3 vec3FromPXCPoint3DF32(const PXCPoint3DF32& vec) { - return glm::vec3(-vec.x, vec.y, -vec.z); -} -#endif // HAVE_RSSDK - -void RealSense::update() { -#ifdef HAVE_RSSDK - bool wasActive = _active; - _active = _manager->IsConnected() && _properlyInitialized; - if (_active || wasActive) { - // Go through all the joints and increment their counter since last update. - // Increment all counters once after controller first becomes inactive so that each joint reports itself as inactive. - // TODO C++11 for (auto jointIt = _jointsArray.begin(); jointIt != _jointsArray.end(); jointIt++) { - for (JointTracker::Vector::iterator jointIt = _jointsArray.begin(); jointIt != _jointsArray.end(); jointIt++) { - (*jointIt).tickNewFrame(); - } - } - - if (!_active) { - return; - } - - pxcStatus sts = _manager->AcquireFrame(true); - _handData->Update(); - PXCHandData::JointData nodes[2][PXCHandData::NUMBER_OF_JOINTS] = {}; - PXCHandData::ExtremityData extremitiesPointsNodes[2][PXCHandData::NUMBER_OF_EXTREMITIES] = {}; - for (pxcI32 i = 0; i < _handData->QueryNumberOfHands(); i++) { - PXCHandData::IHand* handData; - if (_handData->QueryHandData(PXCHandData::ACCESS_ORDER_BY_TIME, i, handData) == PXC_STATUS_NO_ERROR) { - int rightSide = handData->QueryBodySide() == PXCHandData::BODY_SIDE_RIGHT; - PXCHandData::JointData jointData; - JointTracker* parentJointTracker = _jointsArray.data(); - //Iterate Joints - int rootBranchIndex = -1; - JointTracker* palmJoint = NULL; - for (int j = 0; j < PXCHandData::NUMBER_OF_JOINTS; j++) { - handData->QueryTrackedJoint((PXCHandData::JointType)j, jointData); - nodes[i][j] = jointData; - if (j == PXCHandData::JOINT_WRIST) { - JointTracker* wrist = editJointTracker(evalRealSenseJointIndex(rightSide, rootBranchIndex, 1)); // 1 is the index of the wrist joint - wrist->editAbsFrame().setTranslation(vec3FromPXCPoint3DF32(jointData.positionWorld)); - wrist->editAbsFrame().setRotation(quatFromPXCPoint4DF32(jointData.globalOrientation)); - wrist->updateLocFromAbsTransform(parentJointTracker); - wrist->activeFrame(); - parentJointTracker = wrist; - continue; - } else if (j == PXCHandData::JOINT_CENTER) { - palmJoint = editJointTracker(evalRealSenseJointIndex(rightSide, rootBranchIndex, 0)); // 0 is the index of the palm joint - palmJoint->editAbsFrame().setTranslation(vec3FromPXCPoint3DF32(jointData.positionWorld)); - palmJoint->editAbsFrame().setRotation(quatFromPXCPoint4DF32(jointData.globalOrientation)); - palmJoint->updateLocFromAbsTransform(parentJointTracker); - palmJoint->activeFrame(); - parentJointTracker = palmJoint; - continue; - } - int finger_index = j - PALMROOT_NUM_JOINTS; - int finger = finger_index / FINGER_NUM_JOINTS; - int finger_bone = finger_index % FINGER_NUM_JOINTS; - JointTracker* ljointTracker = editJointTracker(evalRealSenseJointIndex(rightSide, finger, finger_bone)); - if (jointData.confidence > 0) { - ljointTracker->editAbsFrame().setTranslation(vec3FromPXCPoint3DF32(jointData.positionWorld)); - ljointTracker->editAbsFrame().setRotation(quatFromPXCPoint4DF32(jointData.globalOrientation)); - ljointTracker->updateLocFromAbsTransform(parentJointTracker); - ljointTracker->activeFrame(); - } - if (finger_bone == (FINGER_NUM_JOINTS - 1)) { - parentJointTracker = palmJoint; - continue; - } - parentJointTracker = ljointTracker; - } - } - } - _manager->ReleaseFrame(); -#endif // HAVE_RSSDK -} - -void RealSense::loadRSSDKFile() { - QString locationDir(QStandardPaths::displayName(QStandardPaths::DesktopLocation)); - QString fileNameString = QFileDialog::getOpenFileName(qApp->getWindow(), tr("Open RSSDK clip"), - locationDir, - tr("RSSDK Recordings (*.rssdk)")); - if (!fileNameString.isEmpty()) { - initSession(true, fileNameString); - } -} diff --git a/interface/src/devices/RealSense.h b/interface/src/devices/RealSense.h deleted file mode 100644 index c958ab1e53..0000000000 --- a/interface/src/devices/RealSense.h +++ /dev/null @@ -1,65 +0,0 @@ -// -// RealSense.h -// interface/src/devices -// -// Created by Thijs Wenker on 12/10/14 -// Copyright 2014 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -#ifndef hifi_RealSense_h -#define hifi_RealSense_h - -#include - -#include "MotionTracker.h" - -#ifdef HAVE_RSSDK -#include -#include -#include -#include -#include -#endif - -/// Handles interaction with the RealSense skeleton tracking suit. -class RealSense : public QObject, public MotionTracker { - Q_OBJECT - -public: - static const Name NAME; - - static void init(); - static void destroy(); - - /// RealSense MotionTracker factory - static RealSense* getInstance(); - - bool isActive() const { return _active; } - - virtual void update(); - -public slots: - void loadRSSDKFile(); - -protected: - RealSense(); - virtual ~RealSense(); - - void initSession(bool playback, QString filename); - -private: -#ifdef HAVE_RSSDK - PXCSession* _session; - PXCSenseManager* _manager; - PXCHandModule* _handController; - PXCHandData* _handData; - PXCHandConfiguration* _config; -#endif - bool _properlyInitialized; - bool _active; -}; - -#endif // hifi_RealSense_h