From 621df1f66bdefa7406492367d4aa8fc663fcc949 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 26 Feb 2015 09:50:21 -0800 Subject: [PATCH 1/9] remove win requirement of msbuild for bullet --- BUILD_WIN.md | 6 +----- cmake/externals/bullet/CMakeLists.txt | 13 ++----------- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/BUILD_WIN.md b/BUILD_WIN.md index 28d26d9eb4..63648241a4 100644 --- a/BUILD_WIN.md +++ b/BUILD_WIN.md @@ -16,16 +16,12 @@ If using Visual Studio 2013 and building as a Visual Studio 2013 project you nee ####nmake & msbuild -Some of the external projects may require nmake and msbuild to compile and install. If they are not installed at the locations listed below, please ensure that both are in your PATH so CMake can find them when required. +Some of the external projects may require nmake to compile and install. If it is not installed at the location listed below, please ensure that it is in your PATH so CMake can find it when required. We expect nmake.exe to be located at the following path. C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin -We expect msbuild.exe to be located at the following path. - - C:\Program Files (x86)\MSBUILD\12.0\Bin - ###Qt You can use the online installer or the offline installer. If you use the offline installer, be sure to select the "OpenGL" version. diff --git a/cmake/externals/bullet/CMakeLists.txt b/cmake/externals/bullet/CMakeLists.txt index d08ceb11b9..fb5a4ecf8b 100644 --- a/cmake/externals/bullet/CMakeLists.txt +++ b/cmake/externals/bullet/CMakeLists.txt @@ -14,21 +14,12 @@ endif () include(ExternalProject) -if (WIN32) - if (UPPER_CMAKE_BUILD_TYPE MATCHES DEBUG) - set(MSBUILD_CONFIGURATION Debug) - else () - set(MSBUILD_CONFIGURATION Release) - endif () - - find_program(MSBUILD_COMMAND msbuild PATHS "C:/Program Files (x86)/MSBUILD/12.0/Bin") - +if (WIN32) ExternalProject_Add( ${EXTERNAL_NAME} URL https://bullet.googlecode.com/files/bullet-2.82-r2704.zip URL_MD5 f5e8914fc9064ad32e0d62d19d33d977 - CMAKE_ARGS ${PLATFORM_CMAKE_ARGS} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX:PATH= -DBUILD_EXTRAS=0 -DINSTALL_LIBS=1 -DBUILD_DEMOS=0 -DUSE_GLUT=0 - BUILD_COMMAND ${MSBUILD_COMMAND} ALL_BUILD.vcxproj /p:Configuration=${MSBUILD_CONFIGURATION} + CMAKE_ARGS ${PLATFORM_CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX:PATH= -DBUILD_EXTRAS=0 -DINSTALL_LIBS=1 -DBUILD_DEMOS=0 -DUSE_GLUT=0 LOG_DOWNLOAD 1 LOG_CONFIGURE 1 LOG_BUILD 1 From ea88518a440ced8cae3a051fc41cb19aa5a38e34 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 26 Feb 2015 09:57:56 -0800 Subject: [PATCH 2/9] handle debug/release for multi-config on WIN32 --- cmake/externals/bullet/CMakeLists.txt | 38 +++++++++++++-------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/cmake/externals/bullet/CMakeLists.txt b/cmake/externals/bullet/CMakeLists.txt index fb5a4ecf8b..47f4c16f91 100644 --- a/cmake/externals/bullet/CMakeLists.txt +++ b/cmake/externals/bullet/CMakeLists.txt @@ -57,28 +57,26 @@ elseif (WIN32) endif () if (DEFINED BULLET_LIB_EXT) - if (NOT WIN32 OR UPPER_CMAKE_BUILD_TYPE MATCHES RELEASE) - set(_PRESENT_LIB_TYPE RELEASE) - set(_MISSING_LIB_TYPE DEBUG) - else () - set(_PRESENT_LIB_TYPE DEBUG) - set(_MISSING_LIB_TYPE RELEASE) - set(_LIB_NAME_SUFFIX _Debug) - endif () + set(_BULLET_LIB_PAIRS "DYNAMICS_LIBRARY\;BulletDynamics" "COLLISION_LIBRARY\;BulletCollision" "MATH_LIBRARY\;LinearMath" "SOFTBODY_LIBRARY\;BulletSoftBody") - set(${EXTERNAL_NAME_UPPER}_DYNAMICS_LIBRARY_${_PRESENT_LIB_TYPE} ${BULLET_LIB_DIR}/${LIB_PREFIX}BulletDynamics${_LIB_NAME_SUFFIX}.${BULLET_LIB_EXT} CACHE FILEPATH "Bullet dynamics ${_PRESENT_LIB_TYPE} library location") - set(${EXTERNAL_NAME_UPPER}_DYNAMICS_LIBRARY_${_MISSING_LIB_TYPE} "" CACHE FILEPATH "Bullet dynamics ${_MISSING_LIB_TYPE} library location") - - set(${EXTERNAL_NAME_UPPER}_COLLISION_LIBRARY_${_PRESENT_LIB_TYPE} ${BULLET_LIB_DIR}/${LIB_PREFIX}BulletCollision${_LIB_NAME_SUFFIX}.${BULLET_LIB_EXT} CACHE FILEPATH "Bullet collision ${_PRESENT_LIB_TYPE} library location") - set(${EXTERNAL_NAME_UPPER}_COLLISION_LIBRARY_${_MISSING_LIB_TYPE} "" CACHE FILEPATH "Bullet collision ${_MISSING_LIB_TYPE} library location") - - set(${EXTERNAL_NAME_UPPER}_MATH_LIBRARY_${_PRESENT_LIB_TYPE} ${BULLET_LIB_DIR}/${LIB_PREFIX}LinearMath${_LIB_NAME_SUFFIX}.${BULLET_LIB_EXT} CACHE FILEPATH "Bullet math ${_PRESENT_LIB_TYPE} library location") - set(${EXTERNAL_NAME_UPPER}_MATH_LIBRARY_${_MISSING_LIB_TYPE} "" CACHE FILEPATH "Bullet math ${_MISSING_LIB_TYPE} library location") - - set(${EXTERNAL_NAME_UPPER}_SOFTBODY_LIBRARY_${_PRESENT_LIB_TYPE} ${BULLET_LIB_DIR}/${LIB_PREFIX}BulletSoftBody${_LIB_NAME_SUFFIX}.${BULLET_LIB_EXT} CACHE FILEPATH "Bullet softbody ${_PRESENT_LIB_TYPE} library location") - set(${EXTERNAL_NAME_UPPER}_SOFTBODY_LIBRARY_${_MISSING_LIB_TYPE} "" CACHE FILEPATH "Bullet softbody ${_MISSING_LIB_TYPE} library location") + foreach(_LIB_PAIR ${_BULLET_LIB_PAIRS}) + + list(GET _LIB_PAIR 0 _LIB_VAR_NAME) + list(GET _LIB_PAIR 1 _LIB_NAME) + + message(STATUS ${_LIB_VAR_NAME}) + message(STATUS ${_LIB_NAME}) + + set(${EXTERNAL_NAME_UPPER}_${_LIB_VAR_NAME}_RELEASE ${BULLET_LIB_DIR}/${LIB_PREFIX}${_LIB_NAME}.${BULLET_LIB_EXT} CACHE FILEPATH "${_LIB_NAME} release library location") + + if (WIN32) + set(${EXTERNAL_NAME_UPPER}_${_LIB_VAR_NAME}_DEBUG ${BULLET_LIB_DIR}/${LIB_PREFIX}${_LIB_NAME}.${BULLET_LIB_EXT} CACHE FILEPATH "${_LIB_NAME} debug library location") + else () + set(${EXTERNAL_NAME_UPPER}_${_LIB_VAR_NAME}_DEBUG "" CACHE FILEPATH "${_LIB_NAME} debug library location") + endif () + endforeach() endif () -if (DEFINED ${EXTERNAL_NAME_UPPER}_DYNAMICS_LIBRARY_${_PRESENT_LIB_TYPE}) +if (DEFINED ${EXTERNAL_NAME_UPPER}_DYNAMICS_LIBRARY_RELEASE) set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIR ${INSTALL_DIR}/include/bullet CACHE PATH "Path to bullet include directory") endif () \ No newline at end of file From 5a4a3ce6dd99e054c80c37d0ac7571c9610fc0b0 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 26 Feb 2015 09:59:15 -0800 Subject: [PATCH 3/9] remove message calls to debug bullet vars --- cmake/externals/bullet/CMakeLists.txt | 4 ---- 1 file changed, 4 deletions(-) diff --git a/cmake/externals/bullet/CMakeLists.txt b/cmake/externals/bullet/CMakeLists.txt index 47f4c16f91..587b7a12f1 100644 --- a/cmake/externals/bullet/CMakeLists.txt +++ b/cmake/externals/bullet/CMakeLists.txt @@ -60,13 +60,9 @@ if (DEFINED BULLET_LIB_EXT) set(_BULLET_LIB_PAIRS "DYNAMICS_LIBRARY\;BulletDynamics" "COLLISION_LIBRARY\;BulletCollision" "MATH_LIBRARY\;LinearMath" "SOFTBODY_LIBRARY\;BulletSoftBody") foreach(_LIB_PAIR ${_BULLET_LIB_PAIRS}) - list(GET _LIB_PAIR 0 _LIB_VAR_NAME) list(GET _LIB_PAIR 1 _LIB_NAME) - message(STATUS ${_LIB_VAR_NAME}) - message(STATUS ${_LIB_NAME}) - set(${EXTERNAL_NAME_UPPER}_${_LIB_VAR_NAME}_RELEASE ${BULLET_LIB_DIR}/${LIB_PREFIX}${_LIB_NAME}.${BULLET_LIB_EXT} CACHE FILEPATH "${_LIB_NAME} release library location") if (WIN32) From 9979bbd8b52eb67e73326532e96f4e4ed723090f Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 26 Feb 2015 15:49:03 -0800 Subject: [PATCH 4/9] actually link debug bullet lib for WIN32 --- cmake/externals/bullet/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/externals/bullet/CMakeLists.txt b/cmake/externals/bullet/CMakeLists.txt index 587b7a12f1..e3610997d1 100644 --- a/cmake/externals/bullet/CMakeLists.txt +++ b/cmake/externals/bullet/CMakeLists.txt @@ -66,7 +66,7 @@ if (DEFINED BULLET_LIB_EXT) set(${EXTERNAL_NAME_UPPER}_${_LIB_VAR_NAME}_RELEASE ${BULLET_LIB_DIR}/${LIB_PREFIX}${_LIB_NAME}.${BULLET_LIB_EXT} CACHE FILEPATH "${_LIB_NAME} release library location") if (WIN32) - set(${EXTERNAL_NAME_UPPER}_${_LIB_VAR_NAME}_DEBUG ${BULLET_LIB_DIR}/${LIB_PREFIX}${_LIB_NAME}.${BULLET_LIB_EXT} CACHE FILEPATH "${_LIB_NAME} debug library location") + set(${EXTERNAL_NAME_UPPER}_${_LIB_VAR_NAME}_DEBUG ${BULLET_LIB_DIR}/${LIB_PREFIX}${_LIB_NAME}_Debug.${BULLET_LIB_EXT} CACHE FILEPATH "${_LIB_NAME} debug library location") else () set(${EXTERNAL_NAME_UPPER}_${_LIB_VAR_NAME}_DEBUG "" CACHE FILEPATH "${_LIB_NAME} debug library location") endif () From 43da329eb4734777157123c50046aaf4b6df431d Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 26 Feb 2015 16:14:04 -0800 Subject: [PATCH 5/9] attempt to remove out-of-date warning for tbb --- cmake/externals/tbb/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmake/externals/tbb/CMakeLists.txt b/cmake/externals/tbb/CMakeLists.txt index 06da60ac04..8d6eb3924e 100644 --- a/cmake/externals/tbb/CMakeLists.txt +++ b/cmake/externals/tbb/CMakeLists.txt @@ -12,6 +12,7 @@ if (ANDROID) URL_MD5 f09c9abe8ec74e6558c1f89cebbe2893 BUILD_COMMAND ${NDK_BUILD_COMMAND} --directory=jni target=android tbb tbbmalloc arch=arm BUILD_IN_SOURCE 1 + UPDATE_COMMAND "" CONFIGURE_COMMAND "" INSTALL_COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/AndroidTBBLibCopy.cmake LOG_DOWNLOAD 1 @@ -33,6 +34,7 @@ else () ExternalProject_Add( ${EXTERNAL_NAME} URL ${DOWNLOAD_URL} + UPDATE_COMMAND "" BUILD_COMMAND "" CONFIGURE_COMMAND "" INSTALL_COMMAND "" From eb646383e99318676000d389ad64cf32a5aea55d Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 26 Feb 2015 16:21:15 -0800 Subject: [PATCH 6/9] Revert "attempt to remove out-of-date warning for tbb" This reverts commit 43da329eb4734777157123c50046aaf4b6df431d. --- cmake/externals/tbb/CMakeLists.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/cmake/externals/tbb/CMakeLists.txt b/cmake/externals/tbb/CMakeLists.txt index 8d6eb3924e..06da60ac04 100644 --- a/cmake/externals/tbb/CMakeLists.txt +++ b/cmake/externals/tbb/CMakeLists.txt @@ -12,7 +12,6 @@ if (ANDROID) URL_MD5 f09c9abe8ec74e6558c1f89cebbe2893 BUILD_COMMAND ${NDK_BUILD_COMMAND} --directory=jni target=android tbb tbbmalloc arch=arm BUILD_IN_SOURCE 1 - UPDATE_COMMAND "" CONFIGURE_COMMAND "" INSTALL_COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/AndroidTBBLibCopy.cmake LOG_DOWNLOAD 1 @@ -34,7 +33,6 @@ else () ExternalProject_Add( ${EXTERNAL_NAME} URL ${DOWNLOAD_URL} - UPDATE_COMMAND "" BUILD_COMMAND "" CONFIGURE_COMMAND "" INSTALL_COMMAND "" From 95c25086d70d06aa71d815c9ecb3d7b5dc727be4 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 26 Feb 2015 16:59:37 -0800 Subject: [PATCH 7/9] handle QTTOOLDIR env when looking for qmake --- cmake/externals/qxmpp/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/externals/qxmpp/CMakeLists.txt b/cmake/externals/qxmpp/CMakeLists.txt index c8bbdba6ba..9165da115f 100644 --- a/cmake/externals/qxmpp/CMakeLists.txt +++ b/cmake/externals/qxmpp/CMakeLists.txt @@ -1,7 +1,7 @@ set(EXTERNAL_NAME qxmpp) # we need to find qmake inside QT_DIR -find_program(QMAKE_COMMAND NAME qmake PATHS ${QT_DIR}/bin NO_DEFAULT_PATH) +find_program(QMAKE_COMMAND NAME qmake PATHS ${QT_DIR}/bin $ENV{QTTOOLDIR} NO_DEFAULT_PATH) if (NOT QMAKE_COMMAND) message(FATAL_ERROR "Could not find qmake. Qxmpp cannot be compiled without qmake.") From 38f77190ebab0dcdcc61dfbb4b376af7f914e9da Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 26 Feb 2015 17:20:45 -0800 Subject: [PATCH 8/9] remove PrioVR from build files --- BUILD.md | 2 +- cmake/modules/FindPrioVR.cmake | 24 ------------------------ interface/CMakeLists.txt | 2 +- interface/external/priovr/readme.txt | 16 ---------------- 4 files changed, 2 insertions(+), 42 deletions(-) delete mode 100644 cmake/modules/FindPrioVR.cmake delete mode 100644 interface/external/priovr/readme.txt diff --git a/BUILD.md b/BUILD.md index 98b8cffab1..e598ee500a 100644 --- a/BUILD.md +++ b/BUILD.md @@ -76,5 +76,5 @@ In the examples below the variable $NAME would be replaced by the name of the de ####Devices -You can support external input/output devices such as Oculus Rift, Leap Motion, Faceshift, PrioVR, MIDI, Razr Hydra and more by adding each individual SDK in the visible building path. Refer to the readme file available in each device folder in [interface/external/](interface/external) for the detailed explanation of the requirements to use the device. +You can support external input/output devices such as Oculus Rift, Leap Motion, Faceshift, MIDI, Razr Hydra and more by adding each individual SDK in the visible building path. Refer to the readme file available in each device folder in [interface/external/](interface/external) for the detailed explanation of the requirements to use the device. diff --git a/cmake/modules/FindPrioVR.cmake b/cmake/modules/FindPrioVR.cmake deleted file mode 100644 index 691ba85689..0000000000 --- a/cmake/modules/FindPrioVR.cmake +++ /dev/null @@ -1,24 +0,0 @@ -# Try to find the PrioVR library -# -# You must provide a PRIOVR_ROOT_DIR which contains lib and include directories -# -# Once done this will define -# -# PRIOVR_FOUND - system found PrioVR -# PRIOVR_INCLUDE_DIRS - the PrioVR include directory -# PRIOVR_LIBRARIES - Link this to use PrioVR -# -# Created on 5/12/2014 by Andrzej Kapolka -# Copyright (c) 2014 High Fidelity -# - -find_path(PRIOVR_INCLUDE_DIRS yei_skeletal_api.h ${PRIOVR_ROOT_DIR}/include) - -if (WIN32) - find_library(PRIOVR_LIBRARIES Skeletal_API.lib ${PRIOVR_ROOT_DIR}/lib) -endif (WIN32) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(PrioVR DEFAULT_MSG PRIOVR_INCLUDE_DIRS PRIOVR_LIBRARIES) - -mark_as_advanced(PRIOVR_INCLUDE_DIRS PRIOVR_LIBRARIES) \ No newline at end of file diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index ee41648758..9bc4b393c5 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 "Faceshift" "LibOVR" "PrioVR" "Sixense" "LeapMotion" "RtMidi" "Qxmpp" "SDL2" "RSSDK") +set(OPTIONAL_EXTERNALS "Faceshift" "LibOVR" "Sixense" "LeapMotion" "RtMidi" "Qxmpp" "SDL2" "RSSDK") foreach(EXTERNAL ${OPTIONAL_EXTERNALS}) string(TOUPPER ${EXTERNAL} ${EXTERNAL}_UPPERCASE) if (NOT ${${EXTERNAL}_UPPERCASE}_ROOT_DIR) diff --git a/interface/external/priovr/readme.txt b/interface/external/priovr/readme.txt deleted file mode 100644 index 202a90cf12..0000000000 --- a/interface/external/priovr/readme.txt +++ /dev/null @@ -1,16 +0,0 @@ - -Instructions for adding the PrioVR driver to Interface -Andrzej Kapolka, May 12, 2014 - -1. Download and install the YEI drivers from https://www.yeitechnology.com/yei-3-space-sensor-software-suite. If using - Window 8+, follow the workaround instructions at http://forum.yeitechnology.com/viewtopic.php?f=3&t=24. - -2. Get the PrioVR skeleton API, open ts_c_api2_priovr2/visual_studio/ThreeSpace_API_2/ThreeSpace_API_2.sln - in Visual Studio, and build it. - -3. Copy ts_c_api2_priovr2/visual_studio/ThreeSpace_API_2/Skeletal_API/yei_skeletal_api.h to interface/external/priovr/include, - ts_c_api2_priovr2/visual_studio/ThreeSpace_API_2/Debug/Skeletal_API.lib to interface/external/priovr/lib, and - ts_c_api2_priovr2/visual_studio/ThreeSpace_API_2/Debug/*.dll to your path. - -4. Delete your build directory, run cmake and build, and you should be all set. - From fc2f6d47bbf3dc55fa011545feb5c65f052da788 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 26 Feb 2015 17:28:00 -0800 Subject: [PATCH 9/9] remove references to PrioVR in interface code --- interface/src/Application.cpp | 4 - interface/src/Application.h | 4 - interface/src/avatar/MyAvatar.cpp | 14 +- interface/src/avatar/SkeletonModel.cpp | 17 +- interface/src/devices/PrioVR.cpp | 224 ------------------------- interface/src/devices/PrioVR.h | 65 ------- 6 files changed, 2 insertions(+), 326 deletions(-) delete mode 100644 interface/src/devices/PrioVR.cpp delete mode 100644 interface/src/devices/PrioVR.h diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 0bdd8f8f53..eed5a39138 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -771,7 +771,6 @@ void Application::paintGL() { { PerformanceTimer perfTimer("renderOverlay"); - // PrioVR will only work if renderOverlay is called, calibration is connected to Application::renderingOverlay() _applicationOverlay.renderOverlay(true); if (Menu::getInstance()->isOptionChecked(MenuOption::UserInterface)) { _applicationOverlay.displayOverlayTexture(); @@ -2071,8 +2070,6 @@ void Application::update(float deltaTime) { updateVisage(); SixenseManager::getInstance().update(deltaTime); JoystickScriptingInterface::getInstance().update(); - _prioVR.update(deltaTime); - } // Dispatch input events @@ -3131,7 +3128,6 @@ void Application::resetSensors() { OculusManager::reset(); - _prioVR.reset(); //_leapmotion.reset(); QScreen* currentScreen = _window->windowHandle()->screen(); diff --git a/interface/src/Application.h b/interface/src/Application.h index 9cd19c8259..2d83f68f6b 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -51,7 +51,6 @@ #include "Stars.h" #include "avatar/Avatar.h" #include "avatar/MyAvatar.h" -#include "devices/PrioVR.h" #include "devices/SixenseManager.h" #include "scripting/ControllerScriptingInterface.h" #include "ui/BandwidthDialog.h" @@ -182,7 +181,6 @@ public: MetavoxelSystem* getMetavoxels() { return &_metavoxels; } EntityTreeRenderer* getEntities() { return &_entities; } Environment* getEnvironment() { return &_environment; } - PrioVR* getPrioVR() { return &_prioVR; } QUndoStack* getUndoStack() { return &_undoStack; } MainWindow* getWindow() { return _window; } OctreeQuery& getOctreeQuery() { return _octreeQuery; } @@ -493,8 +491,6 @@ private: MyAvatar* _myAvatar; // TODO: move this and relevant code to AvatarManager (or MyAvatar as the case may be) - PrioVR _prioVR; - Camera _myCamera; // My view onto the world Camera _mirrorCamera; // Cammera for mirror view QRect _mirrorViewRect; diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index ba628ea0d4..55355b623d 100644 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -294,12 +294,7 @@ void MyAvatar::updateFromTrackers(float deltaTime) { return; } - if (Application::getInstance()->getPrioVR()->hasHeadRotation()) { - estimatedRotation = glm::degrees(safeEulerAngles(Application::getInstance()->getPrioVR()->getHeadRotation())); - estimatedRotation.x *= -1.0f; - estimatedRotation.z *= -1.0f; - - } else if (OculusManager::isConnected()) { + if (OculusManager::isConnected()) { estimatedPosition = OculusManager::getRelativePosition(); estimatedPosition.x *= -1.0f; _trackedHeadPosition = estimatedPosition; @@ -349,13 +344,6 @@ void MyAvatar::updateFromTrackers(float deltaTime) { } head->setDeltaRoll(estimatedRotation.z); - // the priovr can give us exact lean - if (Application::getInstance()->getPrioVR()->isActive()) { - glm::vec3 eulers = glm::degrees(safeEulerAngles(Application::getInstance()->getPrioVR()->getTorsoRotation())); - head->setLeanSideways(eulers.z); - head->setLeanForward(eulers.x); - return; - } // Update torso lean distance based on accelerometer data const float TORSO_LENGTH = 0.5f; glm::vec3 relativePosition = estimatedPosition - glm::vec3(0.0f, -TORSO_LENGTH, 0.0f); diff --git a/interface/src/avatar/SkeletonModel.cpp b/interface/src/avatar/SkeletonModel.cpp index 6e207f9703..fa9846fd7d 100644 --- a/interface/src/avatar/SkeletonModel.cpp +++ b/interface/src/avatar/SkeletonModel.cpp @@ -106,21 +106,6 @@ void SkeletonModel::simulate(float deltaTime, bool fullUpdate) { } const FBXGeometry& geometry = _geometry->getFBXGeometry(); - PrioVR* prioVR = Application::getInstance()->getPrioVR(); - if (prioVR->isActive()) { - for (int i = 0; i < prioVR->getJointRotations().size(); i++) { - int humanIKJointIndex = prioVR->getHumanIKJointIndices().at(i); - if (humanIKJointIndex == -1) { - continue; - } - int jointIndex = geometry.humanIKJointIndices.at(humanIKJointIndex); - if (jointIndex != -1) { - JointState& state = _jointStates[jointIndex]; - state.setRotationInBindFrame(prioVR->getJointRotations().at(i), PALM_PRIORITY); - } - } - return; - } // find the left and rightmost active palms int leftPalmIndex, rightPalmIndex; @@ -294,7 +279,7 @@ void SkeletonModel::updateJointState(int index) { } void SkeletonModel::maybeUpdateLeanRotation(const JointState& parentState, JointState& state) { - if (!_owningAvatar->isMyAvatar() || Application::getInstance()->getPrioVR()->isActive()) { + if (!_owningAvatar->isMyAvatar()) { return; } // get the rotation axes in joint space and use them to adjust the rotation diff --git a/interface/src/devices/PrioVR.cpp b/interface/src/devices/PrioVR.cpp deleted file mode 100644 index 428c223eb7..0000000000 --- a/interface/src/devices/PrioVR.cpp +++ /dev/null @@ -1,224 +0,0 @@ -// -// PrioVR.cpp -// interface/src/devices -// -// Created by Andrzej Kapolka on 5/12/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 -#include - -#include -#include -#include -#include - -#include "Application.h" -#include "PrioVR.h" -#include "scripting/JoystickScriptingInterface.h" - -#ifdef HAVE_PRIOVR -const unsigned int SERIAL_LIST[] = { 0x00000001, 0x00000000, 0x00000008, 0x00000009, 0x0000000A, - 0x0000000C, 0x0000000D, 0x0000000E, 0x00000004, 0x00000005, 0x00000010, 0x00000011 }; -const unsigned char AXIS_LIST[] = { 9, 43, 37, 37, 37, 13, 13, 13, 52, 52, 28, 28 }; -const int LIST_LENGTH = sizeof(SERIAL_LIST) / sizeof(SERIAL_LIST[0]); - -const char* JOINT_NAMES[] = { "Neck", "Spine", "LeftArm", "LeftForeArm", "LeftHand", "RightArm", - "RightForeArm", "RightHand", "LeftUpLeg", "LeftLeg", "RightUpLeg", "RightLeg" }; - -static int indexOfHumanIKJoint(const char* jointName) { - for (int i = 0;; i++) { - QByteArray humanIKJoint = HUMANIK_JOINTS[i]; - if (humanIKJoint.isEmpty()) { - return -1; - } - if (humanIKJoint == jointName) { - return i; - } - } -} - -static void setPalm(float deltaTime, int index) { - MyAvatar* avatar = DependencyManager::get()->getMyAvatar(); - Hand* hand = avatar->getHand(); - PalmData* palm; - bool foundHand = false; - for (size_t j = 0; j < hand->getNumPalms(); j++) { - if (hand->getPalms()[j].getSixenseID() == index) { - palm = &(hand->getPalms()[j]); - foundHand = true; - } - } - if (!foundHand) { - PalmData newPalm(hand); - hand->getPalms().push_back(newPalm); - palm = &(hand->getPalms()[hand->getNumPalms() - 1]); - palm->setSixenseID(index); - } - - palm->setActive(true); - - // Read controller buttons and joystick into the hand - const QString PRIO_JOYSTICK_NAME = "PrioVR"; - Joystick* prioJoystick = JoystickScriptingInterface::getInstance().joystickWithName(PRIO_JOYSTICK_NAME); - if (prioJoystick) { - const QVector axes = prioJoystick->getAxes(); - const QVector buttons = prioJoystick->getButtons(); - - if (axes.size() >= 4 && buttons.size() >= 4) { - if (index == LEFT_HAND_INDEX) { - palm->setControllerButtons(buttons[1] ? BUTTON_FWD : 0); - palm->setTrigger(buttons[0] ? 1.0f : 0.0f); - palm->setJoystick(axes[0], -axes[1]); - - } else { - palm->setControllerButtons(buttons[3] ? BUTTON_FWD : 0); - palm->setTrigger(buttons[2] ? 1.0f : 0.0f); - palm->setJoystick(axes[2], -axes[3]); - } - } - } - - // NOTE: this math is done in the worl-frame with unecessary complexity. - // TODO: transfom this to stay in the model-frame. - glm::vec3 position; - glm::quat rotation; - SkeletonModel* skeletonModel = &DependencyManager::get()->getMyAvatar()->getSkeletonModel(); - int jointIndex; - glm::quat inverseRotation = glm::inverse(DependencyManager::get()->getMyAvatar()->getOrientation()); - if (index == LEFT_HAND_INDEX) { - jointIndex = skeletonModel->getLeftHandJointIndex(); - skeletonModel->getJointRotationInWorldFrame(jointIndex, rotation); - rotation = inverseRotation * rotation * glm::quat(glm::vec3(0.0f, PI_OVER_TWO, 0.0f)); - - } else { - jointIndex = skeletonModel->getRightHandJointIndex(); - skeletonModel->getJointRotationInWorldFrame(jointIndex, rotation); - rotation = inverseRotation * rotation * glm::quat(glm::vec3(0.0f, -PI_OVER_TWO, 0.0f)); - } - skeletonModel->getJointPositionInWorldFrame(jointIndex, position); - position = inverseRotation * (position - skeletonModel->getTranslation()); - - palm->setRawRotation(rotation); - - // Compute current velocity from position change - glm::vec3 rawVelocity; - if (deltaTime > 0.0f) { - rawVelocity = (position - palm->getRawPosition()) / deltaTime; - } else { - rawVelocity = glm::vec3(0.0f); - } - palm->setRawVelocity(rawVelocity); - palm->setRawPosition(position); - - // Store the one fingertip in the palm structure so we can track velocity - const float FINGER_LENGTH = 0.3f; // meters - const glm::vec3 FINGER_VECTOR(0.0f, 0.0f, FINGER_LENGTH); - const glm::vec3 newTipPosition = position + rotation * FINGER_VECTOR; - glm::vec3 oldTipPosition = palm->getTipRawPosition(); - if (deltaTime > 0.0f) { - palm->setTipVelocity((newTipPosition - oldTipPosition) / deltaTime); - } else { - palm->setTipVelocity(glm::vec3(0.0f)); - } - palm->setTipPosition(newTipPosition); -} -#endif - -PrioVR::PrioVR() { -#ifdef HAVE_PRIOVR - char jointsDiscovered[LIST_LENGTH]; - _skeletalDevice = yei_setUpPrioVRSensors(0x00000000, const_cast(SERIAL_LIST), - const_cast(AXIS_LIST), jointsDiscovered, LIST_LENGTH, YEI_TIMESTAMP_SYSTEM); - if (!_skeletalDevice) { - return; - } - _jointRotations.resize(LIST_LENGTH); - _lastJointRotations.resize(LIST_LENGTH); - for (int i = 0; i < LIST_LENGTH; i++) { - _humanIKJointIndices.append(jointsDiscovered[i] ? indexOfHumanIKJoint(JOINT_NAMES[i]) : -1); - } -#endif -} - -PrioVR::~PrioVR() { -#ifdef HAVE_PRIOVR - if (_skeletalDevice) { - yei_stopStreaming(_skeletalDevice); - } -#endif -} - -const int HEAD_ROTATION_INDEX = 0; - -bool PrioVR::hasHeadRotation() const { - return _humanIKJointIndices.size() > HEAD_ROTATION_INDEX && _humanIKJointIndices.at(HEAD_ROTATION_INDEX) != -1; -} - -glm::quat PrioVR::getHeadRotation() const { - return _jointRotations.size() > HEAD_ROTATION_INDEX ? _jointRotations.at(HEAD_ROTATION_INDEX) : glm::quat(); -} - -glm::quat PrioVR::getTorsoRotation() const { - const int TORSO_ROTATION_INDEX = 1; - return _jointRotations.size() > TORSO_ROTATION_INDEX ? _jointRotations.at(TORSO_ROTATION_INDEX) : glm::quat(); -} - -void PrioVR::update(float deltaTime) { -#ifdef HAVE_PRIOVR - if (!_skeletalDevice) { - return; - } - PerformanceTimer perfTimer("PrioVR"); - unsigned int timestamp; - yei_getLastStreamDataAll(_skeletalDevice, (char*)_jointRotations.data(), - _jointRotations.size() * sizeof(glm::quat), ×tamp); - - // convert to our expected coordinate system, average with last rotations to smooth - for (int i = 0; i < _jointRotations.size(); i++) { - _jointRotations[i].y *= -1.0f; - _jointRotations[i].z *= -1.0f; - - glm::quat lastRotation = _lastJointRotations.at(i); - _lastJointRotations[i] = _jointRotations.at(i); - _jointRotations[i] = safeMix(lastRotation, _jointRotations.at(i), 0.5f); - } - - // convert the joysticks into palm data - setPalm(deltaTime, LEFT_HAND_INDEX); - setPalm(deltaTime, RIGHT_HAND_INDEX); -#endif -} - -void PrioVR::reset() { -#ifdef HAVE_PRIOVR - if (!_skeletalDevice) { - return; - } - connect(Application::getInstance(), SIGNAL(renderingOverlay()), SLOT(renderCalibrationCountdown())); - _calibrationCountdownStarted = QDateTime::currentDateTime(); -#endif -} - -void PrioVR::renderCalibrationCountdown() { -#ifdef HAVE_PRIOVR - const int COUNTDOWN_SECONDS = 3; - int secondsRemaining = COUNTDOWN_SECONDS - _calibrationCountdownStarted.secsTo(QDateTime::currentDateTime()); - if (secondsRemaining == 0) { - yei_tareSensors(_skeletalDevice); - Application::getInstance()->disconnect(this); - return; - } - static TextRenderer* textRenderer = TextRenderer::getInstance(MONO_FONT_FAMILY, 18, QFont::Bold, - false, TextRenderer::OUTLINE_EFFECT, 2); - QByteArray text = "Assume T-Pose in " + QByteArray::number(secondsRemaining) + "..."; - auto glCanvas = Application::getInstance()->getGLWidget(); - textRenderer->draw((glCanvas->width() - textRenderer->computeExtent(text.constData()).x) / 2, - glCanvas->height() / 2, - text, glm::vec4(1,1,1,1)); -#endif -} diff --git a/interface/src/devices/PrioVR.h b/interface/src/devices/PrioVR.h deleted file mode 100644 index bb563bf807..0000000000 --- a/interface/src/devices/PrioVR.h +++ /dev/null @@ -1,65 +0,0 @@ -// -// PrioVR.h -// interface/src/devices -// -// Created by Andrzej Kapolka on 5/12/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_PrioVR_h -#define hifi_PrioVR_h - -#include -#include -#include - -#include - -#ifdef HAVE_PRIOVR -extern "C" { -#include -} -#endif - -/// Handles interaction with the PrioVR skeleton tracking suit. -class PrioVR : public QObject { - Q_OBJECT - -public: - - PrioVR(); - virtual ~PrioVR(); - - bool isActive() const { return !_jointRotations.isEmpty(); } - - bool hasHeadRotation() const; - - glm::quat getHeadRotation() const; - glm::quat getTorsoRotation() const; - - const QVector& getHumanIKJointIndices() const { return _humanIKJointIndices; } - const QVector& getJointRotations() const { return _jointRotations; } - - void update(float deltaTime); - void reset(); - -private slots: - - void renderCalibrationCountdown(); - -private: -#ifdef HAVE_PRIOVR - YEI_Device_Id _skeletalDevice; -#endif - - QVector _humanIKJointIndices; - QVector _jointRotations; - QVector _lastJointRotations; - - QDateTime _calibrationCountdownStarted; -}; - -#endif // hifi_PrioVR_h