Showing the changes to interface/src/devices/OculusManager.cpp (1 of 5 files). Show all
Unified · Split
| @@ -53,6 +53,7 @@ unsigned int OculusManager::_frameIndex = 0; · 52 unmodified lines | ||
| 53 | 53 | bool OculusManager::_frameTimingActive = false; |
| 54 | 54 | bool OculusManager::_programInitialized = false; |
| 55 | 55 | Camera* OculusManager::_camera = NULL; |
| 56 | +int OculusManager::_activeEyeIndex = -1; | |
| 56 | 57 | |
| 57 | 58 | #endif |
| 58 | 59 | |
| @@ -330,6 +331,8 @@ void OculusManager::display(const glm::quat &bodyOrientation, const glm::vec3 &p · 271 unmodified lines | ||
| 330 | 331 | |
| 331 | 332 | //Render each eye into an fbo |
| 332 | 333 | for (int eyeIndex = 0; eyeIndex < ovrEye_Count; eyeIndex++) { |
| 334 | + _activeEyeIndex = eyeIndex; | |
| 335 | + | |
| 333 | 336 | #if defined(__APPLE__) || defined(_WIN32) |
| 334 | 337 | ovrEyeType eye = _ovrHmd->EyeRenderOrder[eyeIndex]; |
| 335 | 338 | #else |
| @@ -363,6 +366,7 @@ void OculusManager::display(const glm::quat &bodyOrientation, const glm::vec3 &p · 27 unmodified lines | ||
| 363 | 366 | Application::getInstance()->displaySide(*_camera); |
| 364 | 367 | |
| 365 | 368 | applicationOverlay.displayOverlayTextureOculus(*_camera); |
| 369 | + _activeEyeIndex = -1; | |
| 366 | 370 | } |
| 367 | 371 | |
| 368 | 372 | //Wait till time-warp to reduce latency |
| @@ -528,3 +532,16 @@ QSize OculusManager::getRenderTargetSize() { · 159 unmodified lines | ||
| 528 | 532 | return QSize(100, 100); |
| 529 | 533 | #endif |
| 530 | 534 | } |
| 535 | + | |
| 536 | +void OculusManager::overrideOffAxisFrustum(float& left, float& right, float& bottom, float& top, float& nearVal, | |
| 537 | + float& farVal, glm::vec4& nearClipPlane, glm::vec4& farClipPlane) { | |
| 538 | +#ifdef HAVE_LIBOVR | |
| 539 | + if (_activeEyeIndex != -1) { | |
| 540 | + float extent = nearVal * glm::tan(_eyeRenderDesc[_activeEyeIndex].Fov / 2.0f); | |
| 541 | + right = extent; | |
| 542 | + left = -extent; | |
| 543 | + top = extent; | |
| 544 | + bottom = -extent; | |
| 545 | + } | |
| 546 | +#endif | |
| 547 | +} | |