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 | bool OculusManager::_frameTimingActive = false; | 53 | bool OculusManager::_frameTimingActive = false; |
| 54 | bool OculusManager::_programInitialized = false; | 54 | bool OculusManager::_programInitialized = false; |
| 55 | Camera* OculusManager::_camera = NULL; | 55 | Camera* OculusManager::_camera = NULL; |
| 56 | int OculusManager::_activeEyeIndex = -1; | ||
| 56 | 57 | ||
| 57 | #endif | 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 | //Render each eye into an fbo | 332 | //Render each eye into an fbo |
| 332 | for (int eyeIndex = 0; eyeIndex < ovrEye_Count; eyeIndex++) { | 333 | for (int eyeIndex = 0; eyeIndex < ovrEye_Count; eyeIndex++) { |
| 334 | _activeEyeIndex = eyeIndex; | ||
| 335 | |||
| 333 | #if defined(__APPLE__) || defined(_WIN32) | 336 | #if defined(__APPLE__) || defined(_WIN32) |
| 334 | ovrEyeType eye = _ovrHmd->EyeRenderOrder[eyeIndex]; | 337 | ovrEyeType eye = _ovrHmd->EyeRenderOrder[eyeIndex]; |
| 335 | #else | 338 | #else |
| @@ -363,6 +366,7 @@ void OculusManager::display(const glm::quat &bodyOrientation, const glm::vec3 &p · 27 unmodified lines | |||
| 363 | Application::getInstance()->displaySide(*_camera); | 366 | Application::getInstance()->displaySide(*_camera); |
| 364 | 367 | ||
| 365 | applicationOverlay.displayOverlayTextureOculus(*_camera); | 368 | applicationOverlay.displayOverlayTextureOculus(*_camera); |
| 369 | _activeEyeIndex = -1; | ||
| 366 | } | 370 | } |
| 367 | 371 | ||
| 368 | //Wait till time-warp to reduce latency | 372 | //Wait till time-warp to reduce latency |
| @@ -528,3 +532,16 @@ QSize OculusManager::getRenderTargetSize() { · 159 unmodified lines | |||
| 528 | return QSize(100, 100); | 532 | return QSize(100, 100); |
| 529 | #endif | 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 | } | ||