mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-04-09 09:02:29 +02:00
Optional compilation for Sixense.
This commit is contained in:
parent
9c401607b1
commit
0231ed133c
4 changed files with 42 additions and 8 deletions
|
@ -19,9 +19,9 @@ else (SIXENSE_LIBRARIES AND SIXENSE_INCLUDE_DIRS)
|
|||
find_path(SIXENSE_INCLUDE_DIRS sixense.h ${SIXENSE_ROOT_DIR}/include)
|
||||
|
||||
if (APPLE)
|
||||
find_library(SIXENSE_LIBRARIES libsixense.dylib ${SIXENSE_ROOT_DIR}/lib/MacOS/)
|
||||
find_library(SIXENSE_LIBRARIES libsixense_x64.dylib ${SIXENSE_ROOT_DIR}/lib/osx_x64/release_dll)
|
||||
elseif (UNIX)
|
||||
find_library(SIXENSE_LIBRARIES libsixense_x64.so ${SIXENSE_ROOT_DIR}/lib/UNIX/)
|
||||
find_library(SIXENSE_LIBRARIES libsixense_x64.so ${SIXENSE_ROOT_DIR}/lib/linux_x64/release)
|
||||
endif ()
|
||||
|
||||
if (SIXENSE_INCLUDE_DIRS AND SIXENSE_LIBRARIES)
|
||||
|
|
|
@ -108,6 +108,14 @@ if (OPENNI_FOUND AND NOT DISABLE_OPENNI)
|
|||
target_link_libraries(${TARGET_NAME} ${OPENNI_LIBRARIES})
|
||||
endif (OPENNI_FOUND AND NOT DISABLE_OPENNI)
|
||||
|
||||
# likewise with Sixense library for Razer Hydra
|
||||
if (SIXENSE_FOUND AND NOT DISABLE_SIXENSE)
|
||||
add_definitions(-DHAVE_SIXENSE)
|
||||
include_directories(SYSTEM ${SIXENSE_INCLUDE_DIRS})
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -isystem ${SIXENSE_INCLUDE_DIRS}")
|
||||
target_link_libraries(${TARGET_NAME} ${SIXENSE_LIBRARIES})
|
||||
endif (SIXENSE_FOUND AND NOT DISABLE_SIXENSE)
|
||||
|
||||
qt5_use_modules(${TARGET_NAME} Core Gui Multimedia Network OpenGL Svg WebKit WebKitWidgets)
|
||||
|
||||
# include headers for interface and InterfaceConfig.
|
||||
|
@ -127,7 +135,6 @@ include_directories(
|
|||
${LEAP_INCLUDE_DIRS}
|
||||
${MOTIONDRIVER_INCLUDE_DIRS}
|
||||
${OPENCV_INCLUDE_DIRS}
|
||||
${SIXENSE_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -isystem ${OPENCV_INCLUDE_DIRS}")
|
||||
|
@ -138,7 +145,6 @@ target_link_libraries(
|
|||
${MOTIONDRIVER_LIBRARIES}
|
||||
${OPENCV_LIBRARIES}
|
||||
${ZLIB_LIBRARIES}
|
||||
${SIXENSE_LIBRARIES}
|
||||
)
|
||||
|
||||
if (APPLE)
|
||||
|
|
11
interface/external/Sixense/readme.txt
vendored
Normal file
11
interface/external/Sixense/readme.txt
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
|
||||
Instructions for adding the Sixense driver to Interface
|
||||
Andrzej Kapolka, November 18, 2013
|
||||
|
||||
NOTE: Without doing step 2, you will crash at program start time.
|
||||
|
||||
1. Copy the Sixense sdk folders (lib, include) into the interface/external/Sixense folder. This readme.txt should be there as well.
|
||||
|
||||
2. IMPORTANT: Copy the file interface/external/Leap/lib/libc++/libLeap.dylib to /usr/lib
|
||||
|
||||
3. Delete your build directory, run cmake and build, and you should be all set.
|
|
@ -6,20 +6,27 @@
|
|||
// Copyright (c) 2013 High Fidelity, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#include "sixense.h"
|
||||
#ifdef HAVE_SIXENSE
|
||||
#include "sixense.h"
|
||||
#endif
|
||||
|
||||
#include "Application.h"
|
||||
#include "SixenseManager.h"
|
||||
|
||||
SixenseManager::SixenseManager() {
|
||||
#ifdef HAVE_SIXENSE
|
||||
sixenseInit();
|
||||
#endif
|
||||
}
|
||||
|
||||
SixenseManager::~SixenseManager() {
|
||||
#ifdef HAVE_SIXENSE
|
||||
sixenseExit();
|
||||
#endif
|
||||
}
|
||||
|
||||
void SixenseManager::update() {
|
||||
#ifdef HAVE_SIXENSE
|
||||
if (sixenseGetNumActiveControllers() == 0) {
|
||||
return;
|
||||
}
|
||||
|
@ -33,21 +40,31 @@ void SixenseManager::update() {
|
|||
}
|
||||
sixenseControllerData data;
|
||||
sixenseGetNewestData(i, &data);
|
||||
|
||||
// set palm position and normal based on Hydra position/orientation
|
||||
PalmData palm(&hand);
|
||||
palm.setActive(true);
|
||||
glm::vec3 position(-data.pos[0], data.pos[1], -data.pos[2]);
|
||||
palm.setRawPosition(position);
|
||||
glm::quat rotation(data.rot_quat[3], -data.rot_quat[0], data.rot_quat[1], -data.rot_quat[2]);
|
||||
palm.setRawNormal(rotation * glm::vec3(0.0f, -1.0f, 0.0f));
|
||||
const glm::vec3 PALM_VECTOR(0.0f, -1.0f, 0.0f);
|
||||
palm.setRawNormal(rotation * PALM_VECTOR);
|
||||
|
||||
// initialize the "finger" based on the direction
|
||||
FingerData finger(&palm, &hand);
|
||||
finger.setActive(true);
|
||||
finger.setRawRootPosition(position);
|
||||
finger.setRawTipPosition(position + rotation * glm::vec3(0.0f, 0.0f, 100.0f));
|
||||
const glm::vec3 FINGER_VECTOR(0.0f, 0.0f, 100.0f);
|
||||
finger.setRawTipPosition(position + rotation * FINGER_VECTOR);
|
||||
|
||||
// three fingers indicates to the skeleton that we have enough data to determine direction
|
||||
palm.getFingers().clear();
|
||||
palm.getFingers().push_back(finger);
|
||||
palm.getFingers().push_back(finger);
|
||||
palm.getFingers().push_back(finger);
|
||||
|
||||
hand.getPalms().push_back(palm);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue