mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 05:48:26 +02:00
general improvements, need to resolve dependency issues
This commit is contained in:
parent
a27196dfee
commit
1dd62b2726
2 changed files with 13 additions and 14 deletions
|
@ -72,12 +72,12 @@ bool OpenVrDisplayPlugin::isSupported() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenVrDisplayPlugin::activate(PluginContainer * container) {
|
void OpenVrDisplayPlugin::activate(PluginContainer * container) {
|
||||||
|
vr::HmdError eError = vr::HmdError_None;
|
||||||
if (!_hmd) {
|
if (!_hmd) {
|
||||||
vr::HmdError eError = vr::HmdError_None;
|
|
||||||
_hmd = vr::VR_Init(&eError);
|
_hmd = vr::VR_Init(&eError);
|
||||||
Q_ASSERT(eError == vr::HmdError_None);
|
Q_ASSERT(eError == vr::HmdError_None);
|
||||||
Q_ASSERT(_hmd);
|
}
|
||||||
}
|
Q_ASSERT(_hmd);
|
||||||
|
|
||||||
_hmd->GetWindowBounds(&_windowPosition.x, &_windowPosition.y, &_windowSize.x, &_windowSize.y);
|
_hmd->GetWindowBounds(&_windowPosition.x, &_windowPosition.y, &_windowSize.x, &_windowSize.y);
|
||||||
_hmd->GetRecommendedRenderTargetSize(&_renderTargetSize.x, &_renderTargetSize.y);
|
_hmd->GetRecommendedRenderTargetSize(&_renderTargetSize.x, &_renderTargetSize.y);
|
||||||
|
|
|
@ -11,8 +11,11 @@
|
||||||
|
|
||||||
#include "ViveControllerManager.h"
|
#include "ViveControllerManager.h"
|
||||||
|
|
||||||
#include "Application.h"
|
|
||||||
#include <avatar/AvatarManager.h>
|
#include <avatar/AvatarManager.h>
|
||||||
|
#include <GLMHelpers.h>
|
||||||
|
#include <PerfStat.h>
|
||||||
|
|
||||||
|
#include "Application.h"
|
||||||
#include "OpenVrDisplayPlugin.h"
|
#include "OpenVrDisplayPlugin.h"
|
||||||
#include "OpenVrHelpers.h"
|
#include "OpenVrHelpers.h"
|
||||||
#include "UserActivityLogger.h"
|
#include "UserActivityLogger.h"
|
||||||
|
@ -74,7 +77,7 @@ void ViveControllerManager::update() {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Matrix4 & mat = _trackedDevicePoseMat4[unTrackedDevice];
|
const mat4& mat = _trackedDevicePoseMat4[unTrackedDevice];
|
||||||
|
|
||||||
PalmData* palm;
|
PalmData* palm;
|
||||||
bool foundHand = false;
|
bool foundHand = false;
|
||||||
|
@ -92,14 +95,14 @@ void ViveControllerManager::update() {
|
||||||
palm = &(hand->getPalms()[hand->getNumPalms() - 1]);
|
palm = &(hand->getPalms()[hand->getNumPalms() - 1]);
|
||||||
palm->setSixenseID(unTrackedDevice);
|
palm->setSixenseID(unTrackedDevice);
|
||||||
_prevPalms[trackedControllerCount - 1] = palm;
|
_prevPalms[trackedControllerCount - 1] = palm;
|
||||||
qCDebug(interfaceapp, "Found new Vive hand controller, ID %i", unTrackedDevice);
|
//qDebug(interfaceapp, "Found new Vive hand controller, ID %i", unTrackedDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
palm->setActive(true);
|
palm->setActive(true);
|
||||||
|
|
||||||
// handle inputs
|
// handle inputs
|
||||||
vr::VRControllerState_t* controllerState;
|
vr::VRControllerState_t* controllerState;
|
||||||
if(vr::GetControllerState(unTrackedDevice, controllerState)) {
|
if(_hmd->GetControllerState(unTrackedDevice, controllerState)) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,12 +121,8 @@ void ViveControllerManager::update() {
|
||||||
// position = _orbRotation * (position - neck);
|
// position = _orbRotation * (position - neck);
|
||||||
|
|
||||||
// // Rotation of Palm
|
// // Rotation of Palm
|
||||||
float w = sqrt(1.0f + _trackedDevicePoseMat4[0][0] + _trackedDevicePoseMat4[1][1] + _trackedDevicePoseMat4[2][2]) / 2.0f;
|
glm::quat rotation = glm::quat_cast(_trackedDevicePoseMat4[unTrackedDevice]);
|
||||||
float x = (_trackedDevicePoseMat4[2][1] - _trackedDevicePoseMat4[1][2])/(4.0f * w);
|
//rotation = glm::angleAxis(PI, glm::vec3(0.0f, 1.0f, 0.0f)) * rotation;
|
||||||
float y = (_trackedDevicePoseMat4[0][2] - _trackedDevicePoseMat4[2][0])/(4.0f * w);
|
|
||||||
float z = (_trackedDevicePoseMat4[1][0] - _trackedDevicePoseMat4[0][1])/(4.0f * w);
|
|
||||||
glm::quat rotation(w, x, y, z);
|
|
||||||
rotation = glm::angleAxis(PI, glm::vec3(0.0f, 1.0f, 0.0f)) * rotation;
|
|
||||||
|
|
||||||
// // Compute current velocity from position change
|
// // Compute current velocity from position change
|
||||||
// glm::vec3 rawVelocity;
|
// glm::vec3 rawVelocity;
|
||||||
|
|
Loading…
Reference in a new issue