Showing the changes to interface/src/Camera.cpp (1 of 35 files). Show all
Unified · Split
| @@ -17,7 +17,6 @@ · 16 unmodified lines | ||
| 17 | 17 | #include "Camera.h" |
| 18 | 18 | #include "Menu.h" |
| 19 | 19 | #include "Util.h" |
| 20 | −#include "devices/OculusManager.h" | |
| 21 | 20 | |
| 22 | 21 | |
| 23 | 22 | CameraMode stringToMode(const QString& mode) { |
| @@ -54,42 +53,24 @@ Camera::Camera() : · 30 unmodified lines | ||
| 54 | 53 | _nearClip(DEFAULT_NEAR_CLIP), // default |
| 55 | 54 | _farClip(DEFAULT_FAR_CLIP), // default |
| 56 | 55 | _hmdPosition(), |
| 57 | − _hmdRotation(), | |
| 58 | − _isKeepLookingAt(false), | |
| 59 | − _lookingAt(0.0f, 0.0f, 0.0f) | |
| 56 | + _hmdRotation() | |
| 60 | 57 | { |
| 61 | 58 | } |
| 62 | 59 | |
| 63 | −void Camera::update(float deltaTime) { | |
| 64 | − if (_isKeepLookingAt) { | |
| 65 | − lookAt(_lookingAt); | |
| 66 | − } | |
| 67 | − return; | |
| 68 | −} | |
| 69 | − | |
| 70 | 60 | void Camera::setPosition(const glm::vec3& position) { |
| 71 | 61 | _position = position; |
| 72 | 62 | } |
| 73 | 63 | |
| 74 | 64 | void Camera::setRotation(const glm::quat& rotation) { |
| 75 | 65 | _rotation = rotation; |
| 76 | − if (_isKeepLookingAt) { | |
| 77 | − lookAt(_lookingAt); | |
| 78 | − } | |
| 79 | 66 | } |
| 80 | 67 | |
| 81 | 68 | void Camera::setHmdPosition(const glm::vec3& hmdPosition) { |
| 82 | 69 | _hmdPosition = hmdPosition; |
| 83 | − if (_isKeepLookingAt) { | |
| 84 | − lookAt(_lookingAt); | |
| 85 | − } | |
| 86 | 70 | } |
| 87 | 71 | |
| 88 | 72 | void Camera::setHmdRotation(const glm::quat& hmdRotation) { |
| 89 | 73 | _hmdRotation = hmdRotation; |
| 90 | − if (_isKeepLookingAt) { | |
| 91 | − lookAt(_lookingAt); | |
| 92 | − } | |
| 93 | 74 | } |
| 94 | 75 | |
| 95 | 76 | float Camera::getFarClip() const { |
| @@ -120,21 +101,6 @@ void Camera::setFarClip(float f) { · 24 unmodified lines | ||
| 120 | 101 | _farClip = f; |
| 121 | 102 | } |
| 122 | 103 | |
| 123 | −PickRay Camera::computePickRay(float x, float y) { | |
| 124 | − auto glCanvas = Application::getInstance()->getGLWidget(); | |
| 125 | − return computeViewPickRay(x / glCanvas->width(), y / glCanvas->height()); | |
| 126 | −} | |
| 127 | − | |
| 128 | −PickRay Camera::computeViewPickRay(float xRatio, float yRatio) { | |
| 129 | − PickRay result; | |
| 130 | − if (OculusManager::isConnected()) { | |
| 131 | − Application::getInstance()->getApplicationOverlay().computeOculusPickRay(xRatio, yRatio, result.origin, result.direction); | |
| 132 | − } else { | |
| 133 | − Application::getInstance()->getViewFrustum()->computePickRay(xRatio, yRatio, result.origin, result.direction); | |
| 134 | − } | |
| 135 | − return result; | |
| 136 | −} | |
| 137 | − | |
| 138 | 104 | void Camera::setModeString(const QString& mode) { |
| 139 | 105 | CameraMode targetMode = stringToMode(mode); |
| 140 | 106 | |
| @@ -163,17 +129,3 @@ void Camera::setModeString(const QString& mode) { · 22 unmodified lines | ||
| 163 | 129 | QString Camera::getModeString() const { |
| 164 | 130 | return modeToString(_mode); |
| 165 | 131 | } |
| 166 | − | |
| 167 | −void Camera::lookAt(const glm::vec3& lookAt) { | |
| 168 | − glm::vec3 up = IDENTITY_UP; | |
| 169 | − glm::mat4 lookAtMatrix = glm::lookAt(_position, lookAt, up); | |
| 170 | − glm::quat rotation = glm::quat_cast(lookAtMatrix); | |
| 171 | − rotation.w = -rotation.w; // Rosedale approved | |
| 172 | − _rotation = rotation; | |
| 173 | −} | |
| 174 | − | |
| 175 | −void Camera::keepLookingAt(const glm::vec3& point) { | |
| 176 | − lookAt(point); | |
| 177 | − _isKeepLookingAt = true; | |
| 178 | − _lookingAt = point; | |
| 179 | −} | |