mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 17:41:12 +02:00
Starting on PrioVR integration.
This commit is contained in:
parent
3e78d63e34
commit
e0486b2654
7 changed files with 166 additions and 0 deletions
42
cmake/modules/FindPrioVR.cmake
Normal file
42
cmake/modules/FindPrioVR.cmake
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
# Try to find the PrioVT 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
|
||||||
|
#
|
||||||
|
|
||||||
|
if (PRIOVR_LIBRARIES AND PRIOVR_INCLUDE_DIRS)
|
||||||
|
# in cache already
|
||||||
|
set(PRIOVR_FOUND TRUE)
|
||||||
|
else (PRIOVR_LIBRARIES AND PRIOVR_INCLUDE_DIRS)
|
||||||
|
find_path(PRIOVR_INCLUDE_DIRS yei_threespace_api.h ${PRIOVR_ROOT_DIR}/include)
|
||||||
|
|
||||||
|
if (WIN32)
|
||||||
|
find_library(PRIOVR_LIBRARIES ThreeSpace_API.lib ${PRIOVR_ROOT_DIR})
|
||||||
|
endif (WIN32)
|
||||||
|
|
||||||
|
if (PRIOVR_INCLUDE_DIRS AND PRIOVR_LIBRARIES)
|
||||||
|
set(PRIOVR_FOUND TRUE)
|
||||||
|
endif (PRIOVR_INCLUDE_DIRS AND PRIOVR_LIBRARIES)
|
||||||
|
|
||||||
|
if (PRIOVR_FOUND)
|
||||||
|
if (NOT PRIOVR_FIND_QUIETLY)
|
||||||
|
message(STATUS "Found PrioVR... ${PRIOVR_LIBRARIES}")
|
||||||
|
endif (NOT PRIOVR_FIND_QUIETLY)
|
||||||
|
else ()
|
||||||
|
if (PRIOVR_FIND_REQUIRED)
|
||||||
|
message(FATAL_ERROR "Could not find PrioVR")
|
||||||
|
endif (PRIOVR_FIND_REQUIRED)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
# show the PRIOVR_INCLUDE_DIRS and PRIOVR_LIBRARIES variables only in the advanced view
|
||||||
|
mark_as_advanced(PRIOVR_INCLUDE_DIRS PRIOVR_LIBRARIES)
|
||||||
|
|
||||||
|
endif (PRIOVR_LIBRARIES AND PRIOVR_INCLUDE_DIRS)
|
|
@ -15,6 +15,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../cmake
|
||||||
set(FACEPLUS_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/external/faceplus")
|
set(FACEPLUS_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/external/faceplus")
|
||||||
set(FACESHIFT_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/external/faceshift")
|
set(FACESHIFT_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/external/faceshift")
|
||||||
set(LIBOVR_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/external/oculus")
|
set(LIBOVR_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/external/oculus")
|
||||||
|
set(PRIOVR_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/external/priovr")
|
||||||
set(SIXENSE_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/external/Sixense")
|
set(SIXENSE_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/external/Sixense")
|
||||||
set(VISAGE_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/external/visage")
|
set(VISAGE_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/external/visage")
|
||||||
|
|
||||||
|
@ -133,6 +134,7 @@ link_hifi_library(script-engine ${TARGET_NAME} "${ROOT_DIR}")
|
||||||
find_package(Faceplus)
|
find_package(Faceplus)
|
||||||
find_package(Faceshift)
|
find_package(Faceshift)
|
||||||
find_package(LibOVR)
|
find_package(LibOVR)
|
||||||
|
find_package(PrioVR)
|
||||||
find_package(Sixense)
|
find_package(Sixense)
|
||||||
find_package(Visage)
|
find_package(Visage)
|
||||||
find_package(ZLIB)
|
find_package(ZLIB)
|
||||||
|
@ -183,6 +185,13 @@ if (LIBOVR_FOUND AND NOT DISABLE_LIBOVR)
|
||||||
target_link_libraries(${TARGET_NAME} "${LIBOVR_LIBRARIES}")
|
target_link_libraries(${TARGET_NAME} "${LIBOVR_LIBRARIES}")
|
||||||
endif (LIBOVR_FOUND AND NOT DISABLE_LIBOVR)
|
endif (LIBOVR_FOUND AND NOT DISABLE_LIBOVR)
|
||||||
|
|
||||||
|
# and with PrioVR library
|
||||||
|
if (PRIOVR_FOUND AND NOT DISABLE_PRIOVR)
|
||||||
|
add_definitions(-DHAVE_PRIOVR)
|
||||||
|
include_directories(SYSTEM "${PRIOVR_INCLUDE_DIRS}")
|
||||||
|
target_link_libraries(${TARGET_NAME} "${PRIOVR_LIBRARIES}")
|
||||||
|
endif (PRIOVR_FOUND AND NOT DISABLE_PRIOVR)
|
||||||
|
|
||||||
# and with qxmpp for chat
|
# and with qxmpp for chat
|
||||||
if (QXMPP_FOUND AND NOT DISABLE_QXMPP)
|
if (QXMPP_FOUND AND NOT DISABLE_QXMPP)
|
||||||
add_definitions(-DHAVE_QXMPP -DQXMPP_STATIC)
|
add_definitions(-DHAVE_QXMPP -DQXMPP_STATIC)
|
||||||
|
|
11
interface/external/priovr/readme.txt
vendored
Normal file
11
interface/external/priovr/readme.txt
vendored
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
|
||||||
|
Instructions for adding the PrioVR driver to Interface
|
||||||
|
Andrzej Kapolka, May 12, 2014
|
||||||
|
|
||||||
|
1. Copy the PrioVR sdk folders (include, *.lib) into the interface/external/priovr folder.
|
||||||
|
This readme.txt should be there as well.
|
||||||
|
|
||||||
|
2. Copy the PrioVR DLLs from the API into your path.
|
||||||
|
|
||||||
|
3. Delete your build directory, run cmake and build, and you should be all set.
|
||||||
|
|
|
@ -1987,6 +1987,7 @@ void Application::update(float deltaTime) {
|
||||||
_myAvatar->updateLookAtTargetAvatar();
|
_myAvatar->updateLookAtTargetAvatar();
|
||||||
updateMyAvatarLookAtPosition();
|
updateMyAvatarLookAtPosition();
|
||||||
_sixenseManager.update(deltaTime);
|
_sixenseManager.update(deltaTime);
|
||||||
|
_prioVR.update();
|
||||||
updateMyAvatar(deltaTime); // Sample hardware, update view frustum if needed, and send avatar data to mixer/nodes
|
updateMyAvatar(deltaTime); // Sample hardware, update view frustum if needed, and send avatar data to mixer/nodes
|
||||||
updateThreads(deltaTime); // If running non-threaded, then give the threads some time to process...
|
updateThreads(deltaTime); // If running non-threaded, then give the threads some time to process...
|
||||||
_avatarManager.updateOtherAvatars(deltaTime); //loop through all the other avatars and simulate them...
|
_avatarManager.updateOtherAvatars(deltaTime); //loop through all the other avatars and simulate them...
|
||||||
|
|
|
@ -58,6 +58,7 @@
|
||||||
#include "avatar/MyAvatar.h"
|
#include "avatar/MyAvatar.h"
|
||||||
#include "devices/Faceplus.h"
|
#include "devices/Faceplus.h"
|
||||||
#include "devices/Faceshift.h"
|
#include "devices/Faceshift.h"
|
||||||
|
#include "devices/PrioVR.h"
|
||||||
#include "devices/SixenseManager.h"
|
#include "devices/SixenseManager.h"
|
||||||
#include "devices/Visage.h"
|
#include "devices/Visage.h"
|
||||||
#include "models/ModelTreeRenderer.h"
|
#include "models/ModelTreeRenderer.h"
|
||||||
|
@ -441,6 +442,7 @@ private:
|
||||||
Visage _visage;
|
Visage _visage;
|
||||||
|
|
||||||
SixenseManager _sixenseManager;
|
SixenseManager _sixenseManager;
|
||||||
|
PrioVR _prioVR;
|
||||||
|
|
||||||
Camera _myCamera; // My view onto the world
|
Camera _myCamera; // My view onto the world
|
||||||
Camera _viewFrustumOffsetCamera; // The camera we use to sometimes show the view frustum from an offset mode
|
Camera _viewFrustumOffsetCamera; // The camera we use to sometimes show the view frustum from an offset mode
|
||||||
|
|
60
interface/src/devices/PrioVR.cpp
Normal file
60
interface/src/devices/PrioVR.cpp
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
//
|
||||||
|
// 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 "PrioVR.h"
|
||||||
|
|
||||||
|
PrioVR::PrioVR() {
|
||||||
|
#ifdef HAVE_PRIOVR
|
||||||
|
TSS_ComPort comPort;
|
||||||
|
if (!tss_getComPorts(&comPort, 1, 0, PVR_FIND_BS)) {
|
||||||
|
_baseStation = TSS_NO_DEVICE_ID;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_baseStation = tss_createTSDeviceStr(comPort.com_port, TSS_TIMESTAMP_SYSTEM);
|
||||||
|
if (_baseStation == TSS_NO_DEVICE_ID) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < MAX_SENSOR_NODES; i++) {
|
||||||
|
tss_getSensorFromDongle(_baseStation, i, &_sensorNodes[i]);
|
||||||
|
if (_sensorNodes[i] == TSS_NO_DEVICE_ID) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
int present;
|
||||||
|
tss_isPresent(_sensorNodes[i], &present);
|
||||||
|
if (!present) {
|
||||||
|
_sensorNodes[i] = TSS_NO_DEVICE_ID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tss_startStreaming(_baseStation, NULL);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
PrioVR::~PrioVR() {
|
||||||
|
#ifdef HAVE_PRIOVR
|
||||||
|
if (_baseStation != TSS_NO_DEVICE_ID) {
|
||||||
|
tss_stopStreaming(_baseStation, NULL);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void PrioVR::update() {
|
||||||
|
#ifdef HAVE_PRIOVR
|
||||||
|
for (int i = 0; i < MAX_SENSOR_NODES; i++) {
|
||||||
|
if (_sensorNodes[i] == TSS_NO_DEVICE_ID) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
glm::quat rotation;
|
||||||
|
if (!tss_getLastStreamData(_sensorNodes[i], (char*)&rotation, sizeof(glm::quat), NULL)) {
|
||||||
|
qDebug() << i << rotation.x << rotation.y << rotation.z << rotation.w;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
41
interface/src/devices/PrioVR.h
Normal file
41
interface/src/devices/PrioVR.h
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
//
|
||||||
|
// 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 <QObject>
|
||||||
|
|
||||||
|
#ifdef HAVE_PRIOVR
|
||||||
|
#include <yei_threespace_api.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/// Handles interaction with the PrioVR skeleton tracking suit.
|
||||||
|
class PrioVR : public QObject {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
PrioVR();
|
||||||
|
virtual ~PrioVR();
|
||||||
|
|
||||||
|
void update();
|
||||||
|
|
||||||
|
private:
|
||||||
|
#ifdef HAVE_PRIOVR
|
||||||
|
TSS_Device_Id _baseStation;
|
||||||
|
|
||||||
|
const int MAX_SENSOR_NODES = 20;
|
||||||
|
TSS_Device_Id _sensorNodes[MAX_SENSOR_NODES];
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // hifi_PrioVR_h
|
Loading…
Reference in a new issue