Showing the changes to interface/src/Application.cpp (1 of 1 file). Show all
Unified · Split
| @@ -446,6 +446,13 @@ void Application::updateProjectionMatrix() { · 445 unmodified lines | |||
| 446 | nearVal = _viewFrustumOffsetCamera.getNearClip(); | 446 | nearVal = _viewFrustumOffsetCamera.getNearClip(); |
| 447 | farVal = _viewFrustumOffsetCamera.getFarClip(); | 447 | farVal = _viewFrustumOffsetCamera.getFarClip(); |
| 448 | } | 448 | } |
| 449 | |||
| 450 | // when mirrored, we must flip left and right | ||
| 451 | if (Menu::getInstance()->isOptionChecked(MenuOption::Mirror)) { | ||
| 452 | float tmp = left; | ||
| 453 | left = -right; | ||
| 454 | right = -tmp; | ||
| 455 | } | ||
| 449 | glFrustum(left, right, bottom, top, nearVal, farVal); | 456 | glFrustum(left, right, bottom, top, nearVal, farVal); |
| 450 | 457 | ||
| 451 | glMatrixMode(GL_MODELVIEW); | 458 | glMatrixMode(GL_MODELVIEW); |
| @@ -1812,8 +1819,9 @@ void Application::update(float deltaTime) { · 1360 unmodified lines | |||
| 1812 | updateProjectionMatrix(); | 1819 | updateProjectionMatrix(); |
| 1813 | 1820 | ||
| 1814 | } else if (_webcam.isActive()) { | 1821 | } else if (_webcam.isActive()) { |
| 1815 | const float EYE_OFFSET_SCALE = 5.0f; | 1822 | const float EYE_OFFSET_SCALE = 0.1f; |
| 1816 | _myCamera.setEyeOffsetPosition(_webcam.getEstimatedPosition() * EYE_OFFSET_SCALE); | 1823 | glm::vec3 position = _webcam.getEstimatedPosition() * EYE_OFFSET_SCALE; |
| 1824 | _myCamera.setEyeOffsetPosition(glm::vec3(-position.x, -position.y, position.z)); | ||
| 1817 | updateProjectionMatrix(); | 1825 | updateProjectionMatrix(); |
| 1818 | } | 1826 | } |
| 1819 | } | 1827 | } |
| @@ -1966,7 +1974,15 @@ void Application::loadViewFrustum(Camera& camera, ViewFrustum& viewFrustum) { · 146 unmodified lines | |||
| 1966 | viewFrustum.setFieldOfView(fov); | 1974 | viewFrustum.setFieldOfView(fov); |
| 1967 | viewFrustum.setNearClip(nearClip); | 1975 | viewFrustum.setNearClip(nearClip); |
| 1968 | viewFrustum.setFarClip(farClip); | 1976 | viewFrustum.setFarClip(farClip); |
| 1969 | viewFrustum.setEyeOffsetPosition(camera.getEyeOffsetPosition()); | 1977 | |
| 1978 | // when mirrored, we must flip the eye offset in x to get the correct frustum | ||
| 1979 | if (Menu::getInstance()->isOptionChecked(MenuOption::Mirror)) { | ||
| 1980 | glm::vec3 position = camera.getEyeOffsetPosition(); | ||
| 1981 | viewFrustum.setEyeOffsetPosition(glm::vec3(-position.x, position.y, position.z)); | ||
| 1982 | |||
| 1983 | } else { | ||
| 1984 | viewFrustum.setEyeOffsetPosition(camera.getEyeOffsetPosition()); | ||
| 1985 | } | ||
| 1970 | viewFrustum.setEyeOffsetOrientation(camera.getEyeOffsetOrientation()); | 1986 | viewFrustum.setEyeOffsetOrientation(camera.getEyeOffsetOrientation()); |
| 1971 | 1987 | ||
| 1972 | // Ask the ViewFrustum class to calculate our corners | 1988 | // Ask the ViewFrustum class to calculate our corners |