mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-08 03:42:27 +02:00
OpenVR: upgrade to version 1.0.6, for better generic tracker support
This commit is contained in:
parent
be2fdd9388
commit
42262aac78
4 changed files with 16 additions and 10 deletions
4
cmake/externals/openvr/CMakeLists.txt
vendored
4
cmake/externals/openvr/CMakeLists.txt
vendored
|
@ -7,8 +7,8 @@ string(TOUPPER ${EXTERNAL_NAME} EXTERNAL_NAME_UPPER)
|
|||
|
||||
ExternalProject_Add(
|
||||
${EXTERNAL_NAME}
|
||||
URL https://github.com/ValveSoftware/openvr/archive/v1.0.3.zip
|
||||
URL_MD5 b484b12901917cc739e40389583c8b0d
|
||||
URL https://github.com/ValveSoftware/openvr/archive/v1.0.6.zip
|
||||
URL_MD5 f6892cd3a3078f505d03b4297f5a1951
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
|
|
|
@ -277,8 +277,8 @@ public:
|
|||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
|
||||
static const vr::VRTextureBounds_t leftBounds{ 0, 0, 0.5f, 1 };
|
||||
static const vr::VRTextureBounds_t rightBounds{ 0.5f, 0, 1, 1 };
|
||||
|
||||
vr::Texture_t texture{ (void*)_colors[currentColorBuffer], vr::API_OpenGL, vr::ColorSpace_Auto };
|
||||
|
||||
vr::Texture_t texture{ (void*)_colors[currentColorBuffer], vr::TextureType_OpenGL, vr::ColorSpace_Auto };
|
||||
vr::VRCompositor()->Submit(vr::Eye_Left, &texture, &leftBounds);
|
||||
vr::VRCompositor()->Submit(vr::Eye_Right, &texture, &rightBounds);
|
||||
_plugin._presentRate.increment();
|
||||
|
@ -422,7 +422,7 @@ bool OpenVrDisplayPlugin::internalActivate() {
|
|||
withNonPresentThreadLock([&] {
|
||||
openvr_for_each_eye([&](vr::Hmd_Eye eye) {
|
||||
_eyeOffsets[eye] = toGlm(_system->GetEyeToHeadTransform(eye));
|
||||
_eyeProjections[eye] = toGlm(_system->GetProjectionMatrix(eye, DEFAULT_NEAR_CLIP, DEFAULT_FAR_CLIP, vr::API_OpenGL));
|
||||
_eyeProjections[eye] = toGlm(_system->GetProjectionMatrix(eye, DEFAULT_NEAR_CLIP, DEFAULT_FAR_CLIP));
|
||||
});
|
||||
// FIXME Calculate the proper combined projection by using GetProjectionRaw values from both eyes
|
||||
_cullingProjection = _eyeProjections[0];
|
||||
|
@ -639,7 +639,7 @@ void OpenVrDisplayPlugin::hmdPresent() {
|
|||
_submitThread->waitForPresent();
|
||||
} else {
|
||||
GLuint glTexId = getGLBackend()->getTextureID(_compositeFramebuffer->getRenderBuffer(0));
|
||||
vr::Texture_t vrTexture { (void*)glTexId, vr::API_OpenGL, vr::ColorSpace_Auto };
|
||||
vr::Texture_t vrTexture { (void*)glTexId, vr::TextureType_OpenGL, vr::ColorSpace_Auto };
|
||||
vr::VRCompositor()->Submit(vr::Eye_Left, &vrTexture, &OPENVR_TEXTURE_BOUNDS_LEFT);
|
||||
vr::VRCompositor()->Submit(vr::Eye_Right, &vrTexture, &OPENVR_TEXTURE_BOUNDS_RIGHT);
|
||||
vr::VRCompositor()->PostPresentHandoff();
|
||||
|
|
|
@ -114,7 +114,7 @@ void releaseOpenVrSystem() {
|
|||
|
||||
// HACK: workaround openvr crash, call submit with an invalid texture, right before VR_Shutdown.
|
||||
const GLuint INVALID_GL_TEXTURE_HANDLE = -1;
|
||||
vr::Texture_t vrTexture{ (void*)INVALID_GL_TEXTURE_HANDLE, vr::API_OpenGL, vr::ColorSpace_Auto };
|
||||
vr::Texture_t vrTexture{ (void*)INVALID_GL_TEXTURE_HANDLE, vr::TextureType_OpenGL, vr::ColorSpace_Auto };
|
||||
static vr::VRTextureBounds_t OPENVR_TEXTURE_BOUNDS_LEFT{ 0, 0, 0.5f, 1 };
|
||||
static vr::VRTextureBounds_t OPENVR_TEXTURE_BOUNDS_RIGHT{ 0.5f, 0, 1, 1 };
|
||||
|
||||
|
|
|
@ -140,9 +140,15 @@ void ViveControllerManager::InputDevice::update(float deltaTime, const controlle
|
|||
handleHandController(deltaTime, leftHandDeviceIndex, inputCalibrationData, true);
|
||||
handleHandController(deltaTime, rightHandDeviceIndex, inputCalibrationData, false);
|
||||
|
||||
// collect raw poses
|
||||
// collect poses for all generic trackers
|
||||
for (int i = 0; i < vr::k_unMaxTrackedDeviceCount; i++) {
|
||||
handleTrackedObject(i, inputCalibrationData);
|
||||
if (_system->GetTrackedDeviceClass(i) == vr::TrackedDeviceClass_GenericTracker) {
|
||||
handleTrackedObject(i, inputCalibrationData);
|
||||
} else {
|
||||
uint32_t poseIndex = controller::TRACKED_OBJECT_00 + i;
|
||||
controller::Pose invalidPose;
|
||||
_poseStateMap[poseIndex] = invalidPose;
|
||||
}
|
||||
}
|
||||
|
||||
// handle haptics
|
||||
|
@ -203,7 +209,7 @@ void ViveControllerManager::InputDevice::handleHandController(float deltaTime, u
|
|||
handlePoseEvent(deltaTime, inputCalibrationData, mat, linearVelocity, angularVelocity, isLeftHand);
|
||||
|
||||
vr::VRControllerState_t controllerState = vr::VRControllerState_t();
|
||||
if (_system->GetControllerState(deviceIndex, &controllerState)) {
|
||||
if (_system->GetControllerState(deviceIndex, &controllerState, sizeof(vr::VRControllerState_t))) {
|
||||
// process each button
|
||||
for (uint32_t i = 0; i < vr::k_EButton_Max; ++i) {
|
||||
auto mask = vr::ButtonMaskFromId((vr::EVRButtonId)i);
|
||||
|
|
Loading…
Reference in a new issue