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 | 89 | const int MIRROR_VIEW_LEFT_PADDING = 10; |
| 90 | 90 | const int MIRROR_VIEW_WIDTH = 265; |
| 91 | 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 | 95 | void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString &message) { |
| 94 | 96 | fprintf(stdout, "%s", message.toLocal8Bit().constData()); |
| @@ -384,7 +386,7 @@ void Application::paintGL() { · 289 unmodified lines | ||
| 384 | 386 | |
| 385 | 387 | } else if (_myCamera.getMode() == CAMERA_MODE_MIRROR) { |
| 386 | 388 | _myCamera.setTightness(0.0f); |
| 387 | − _myCamera.setDistance(0.3f); | |
| 389 | + _myCamera.setDistance(MAX_ZOOM_DISTANCE); | |
| 388 | 390 | _myCamera.setTargetPosition(_myAvatar.getHead().calculateAverageEyePosition()); |
| 389 | 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 | 436 | _glowEffect.render(); |
| 435 | 437 | |
| 436 | 438 | if (Menu::getInstance()->isOptionChecked(MenuOption::Mirror)) { |
| 437 | − _mirrorCamera.setDistance(0.3f); | |
| 438 | − _mirrorCamera.setTargetPosition(_myAvatar.getHead().calculateAverageEyePosition()); | |
| 439 | + | |
| 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 | 448 | _mirrorCamera.setTargetRotation(_myAvatar.getWorldAlignedOrientation() * glm::quat(glm::vec3(0.0f, PIf, 0.0f))); |
| 440 | 449 | _mirrorCamera.update(1.0f/_fps); |
| 441 | 450 | |
| @@ -1322,8 +1331,8 @@ void Application::terminate() { · 880 unmodified lines | ||
| 1322 | 1331 | // close(serial_fd); |
| 1323 | 1332 | |
| 1324 | 1333 | LeapManager::terminate(); |
| 1325 | − | |
| 1326 | 1334 | Menu::getInstance()->saveSettings(); |
| 1335 | + _rearMirrorTools->saveSettings(_settings); | |
| 1327 | 1336 | _settings->sync(); |
| 1328 | 1337 | |
| 1329 | 1338 | if (_enableNetworkThread) { |
| @@ -1719,7 +1728,7 @@ void Application::init() { · 389 unmodified lines | ||
| 1719 | 1728 | |
| 1720 | 1729 | _audio.init(_glWidget); |
| 1721 | 1730 | |
| 1722 | − _rearMirrorTools = new RearMirrorTools(_glWidget, _mirrorViewRect); | |
| 1731 | + _rearMirrorTools = new RearMirrorTools(_glWidget, _mirrorViewRect, _settings); | |
| 1723 | 1732 | connect(_rearMirrorTools, SIGNAL(closeView()), SLOT(closeMirrorView())); |
| 1724 | 1733 | connect(_rearMirrorTools, SIGNAL(restoreView()), SLOT(restoreMirrorView())); |
| 1725 | 1734 | connect(_rearMirrorTools, SIGNAL(shrinkView()), SLOT(shrinkMirrorView())); |