Code Review for Job #19447
Showing the changes to interface/src/Application.cpp (1 of 6 files). Show all
Unified · Split
| @@ -89,6 +89,8 @@ const int MIRROR_VIEW_TOP_PADDING = 5; · 88 unmodified lines | |||
| 89 | const int MIRROR_VIEW_LEFT_PADDING = 10; | 89 | const int MIRROR_VIEW_LEFT_PADDING = 10; |
| 90 | const int MIRROR_VIEW_WIDTH = 265; | 90 | const int MIRROR_VIEW_WIDTH = 265; |
| 91 | const int MIRROR_VIEW_HEIGHT = 215; | 91 | const int MIRROR_VIEW_HEIGHT = 215; |
| 92 | const float MAX_ZOOM_DISTANCE = 0.3f; | ||
| 93 | const float MIN_ZOOM_DISTANCE = 2.0f; | ||
| 92 | 94 | ||
| 93 | void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString &message) { | 95 | void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString &message) { |
| 94 | fprintf(stdout, "%s", message.toLocal8Bit().constData()); | 96 | fprintf(stdout, "%s", message.toLocal8Bit().constData()); |
| @@ -384,7 +386,7 @@ void Application::paintGL() { · 289 unmodified lines | |||
| 384 | 386 | ||
| 385 | } else if (_myCamera.getMode() == CAMERA_MODE_MIRROR) { | 387 | } else if (_myCamera.getMode() == CAMERA_MODE_MIRROR) { |
| 386 | _myCamera.setTightness(0.0f); | 388 | _myCamera.setTightness(0.0f); |
| 387 | _myCamera.setDistance(0.3f); | 389 | _myCamera.setDistance(MAX_ZOOM_DISTANCE); |
| 388 | _myCamera.setTargetPosition(_myAvatar.getHead().calculateAverageEyePosition()); | 390 | _myCamera.setTargetPosition(_myAvatar.getHead().calculateAverageEyePosition()); |
| 389 | _myCamera.setTargetRotation(_myAvatar.getWorldAlignedOrientation() * glm::quat(glm::vec3(0.0f, PIf, 0.0f))); | 391 | _myCamera.setTargetRotation(_myAvatar.getWorldAlignedOrientation() * glm::quat(glm::vec3(0.0f, PIf, 0.0f))); |
| 390 | } | 392 | } |
| @@ -434,8 +436,15 @@ void Application::paintGL() { · 43 unmodified lines | |||
| 434 | _glowEffect.render(); | 436 | _glowEffect.render(); |
| 435 | 437 | ||
| 436 | if (Menu::getInstance()->isOptionChecked(MenuOption::Mirror)) { | 438 | if (Menu::getInstance()->isOptionChecked(MenuOption::Mirror)) { |
| 437 | _mirrorCamera.setDistance(0.3f); | 439 | |
| 438 | _mirrorCamera.setTargetPosition(_myAvatar.getHead().calculateAverageEyePosition()); | 440 | if (_rearMirrorTools->getZoomLevel() == BODY) { |
| 441 | _mirrorCamera.setDistance(MIN_ZOOM_DISTANCE); | ||
| 442 | _mirrorCamera.setTargetPosition(_myAvatar.getChestJointPosition()); | ||
| 443 | } else { // HEAD zoom level | ||
| 444 | _mirrorCamera.setDistance(MAX_ZOOM_DISTANCE); | ||
| 445 | _mirrorCamera.setTargetPosition(_myAvatar.getHead().calculateAverageEyePosition()); | ||
| 446 | } | ||
| 447 | |||
| 439 | _mirrorCamera.setTargetRotation(_myAvatar.getWorldAlignedOrientation() * glm::quat(glm::vec3(0.0f, PIf, 0.0f))); | 448 | _mirrorCamera.setTargetRotation(_myAvatar.getWorldAlignedOrientation() * glm::quat(glm::vec3(0.0f, PIf, 0.0f))); |
| 440 | _mirrorCamera.update(1.0f/_fps); | 449 | _mirrorCamera.update(1.0f/_fps); |
| 441 | 450 | ||
| @@ -1322,8 +1331,8 @@ void Application::terminate() { · 880 unmodified lines | |||
| 1322 | // close(serial_fd); | 1331 | // close(serial_fd); |
| 1323 | 1332 | ||
| 1324 | LeapManager::terminate(); | 1333 | LeapManager::terminate(); |
| 1325 | |||
| 1326 | Menu::getInstance()->saveSettings(); | 1334 | Menu::getInstance()->saveSettings(); |
| 1335 | _rearMirrorTools->saveSettings(_settings); | ||
| 1327 | _settings->sync(); | 1336 | _settings->sync(); |
| 1328 | 1337 | ||
| 1329 | if (_enableNetworkThread) { | 1338 | if (_enableNetworkThread) { |
| @@ -1719,7 +1728,7 @@ void Application::init() { · 389 unmodified lines | |||
| 1719 | 1728 | ||
| 1720 | _audio.init(_glWidget); | 1729 | _audio.init(_glWidget); |
| 1721 | 1730 | ||
| 1722 | _rearMirrorTools = new RearMirrorTools(_glWidget, _mirrorViewRect); | 1731 | _rearMirrorTools = new RearMirrorTools(_glWidget, _mirrorViewRect, _settings); |
| 1723 | connect(_rearMirrorTools, SIGNAL(closeView()), SLOT(closeMirrorView())); | 1732 | connect(_rearMirrorTools, SIGNAL(closeView()), SLOT(closeMirrorView())); |
| 1724 | connect(_rearMirrorTools, SIGNAL(restoreView()), SLOT(restoreMirrorView())); | 1733 | connect(_rearMirrorTools, SIGNAL(restoreView()), SLOT(restoreMirrorView())); |
| 1725 | connect(_rearMirrorTools, SIGNAL(shrinkView()), SLOT(shrinkMirrorView())); | 1734 | connect(_rearMirrorTools, SIGNAL(shrinkView()), SLOT(shrinkMirrorView())); |