History

Attempting to fix 3DTV/Oculus deferred lighting/ambient occlusion.

Andrzej Kapolka committed 12 years ago

Commit 2cba7b31 parent c5ad6035 files · +48 −1Browse files

Showing the changes to interface/src/devices/OculusManager.cpp (1 of 5 files). Show all

Unified · Split

interface/src/devices/OculusManager.cpp+17−0
@@ -53,6 +53,7 @@ unsigned int OculusManager::_frameIndex = 0; · 52 unmodified lines
5353 bool OculusManager::_frameTimingActive = false;
5454 bool OculusManager::_programInitialized = false;
5555 Camera* OculusManager::_camera = NULL;
56+int OculusManager::_activeEyeIndex = -1;
5657
5758 #endif
5859
@@ -330,6 +331,8 @@ void OculusManager::display(const glm::quat &bodyOrientation, const glm::vec3 &p · 271 unmodified lines
330331
331332 //Render each eye into an fbo
332333 for (int eyeIndex = 0; eyeIndex < ovrEye_Count; eyeIndex++) {
334+ _activeEyeIndex = eyeIndex;
335+
333336 #if defined(__APPLE__) || defined(_WIN32)
334337 ovrEyeType eye = _ovrHmd->EyeRenderOrder[eyeIndex];
335338 #else
@@ -363,6 +366,7 @@ void OculusManager::display(const glm::quat &bodyOrientation, const glm::vec3 &p · 27 unmodified lines
363366 Application::getInstance()->displaySide(*_camera);
364367
365368 applicationOverlay.displayOverlayTextureOculus(*_camera);
369+ _activeEyeIndex = -1;
366370 }
367371
368372 //Wait till time-warp to reduce latency
@@ -528,3 +532,16 @@ QSize OculusManager::getRenderTargetSize() { · 159 unmodified lines
528532 return QSize(100, 100);
529533 #endif
530534 }
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+}