Showing the changes to interface/src/Application.cpp (1 of 2 files). Show all
Unified · Split
| @@ -116,7 +116,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 115 unmodified lines | ||
| 116 | 116 | _nudgeStarted(false), |
| 117 | 117 | _lookingAlongX(false), |
| 118 | 118 | _lookingAwayFromOrigin(true), |
| 119 | − _isLookingAtOtherAvatar(false), | |
| 119 | + _lookatTargetAvatar(NULL), | |
| 120 | 120 | _lookatIndicatorScale(1.0f), |
| 121 | 121 | _perfStatsOn(false), |
| 122 | 122 | _chatEntryOn(false), |
| @@ -974,7 +974,7 @@ void Application::mousePressEvent(QMouseEvent* event) { · 851 unmodified lines | ||
| 974 | 974 | |
| 975 | 975 | maybeEditVoxelUnderCursor(); |
| 976 | 976 | |
| 977 | − if (!_palette.isActive() && (!_isHoverVoxel || _isLookingAtOtherAvatar)) { | |
| 977 | + if (!_palette.isActive() && (!_isHoverVoxel || _lookatTargetAvatar)) { | |
| 978 | 978 | _pieMenu.mousePressEvent(_mouseX, _mouseY); |
| 979 | 979 | } |
| 980 | 980 | |
| @@ -1503,7 +1503,7 @@ void Application::setListenModeSingleSource() { · 522 unmodified lines | ||
| 1503 | 1503 | glm::vec3 eyePositionIgnored; |
| 1504 | 1504 | uint16_t nodeID; |
| 1505 | 1505 | |
| 1506 | − if (isLookingAtOtherAvatar(mouseRayOrigin, mouseRayDirection, eyePositionIgnored, nodeID)) { | |
| 1506 | + if (findLookatTargetAvatar(mouseRayOrigin, mouseRayDirection, eyePositionIgnored, nodeID)) { | |
| 1507 | 1507 | _audio.addListenSource(nodeID); |
| 1508 | 1508 | } |
| 1509 | 1509 | } |
| @@ -1600,8 +1600,8 @@ const float HEAD_SPHERE_RADIUS = 0.07; · 90 unmodified lines | ||
| 1600 | 1600 | static uint16_t DEFAULT_NODE_ID_REF = 1; |
| 1601 | 1601 | |
| 1602 | 1602 | |
| 1603 | −Avatar* Application::isLookingAtOtherAvatar(glm::vec3& mouseRayOrigin, glm::vec3& mouseRayDirection, | |
| 1604 | − glm::vec3& eyePosition, uint16_t& nodeID = DEFAULT_NODE_ID_REF) { | |
| 1603 | +Avatar* Application::findLookatTargetAvatar(const glm::vec3& mouseRayOrigin, const glm::vec3& mouseRayDirection, | |
| 1604 | + glm::vec3& eyePosition, uint16_t& nodeID = DEFAULT_NODE_ID_REF) { | |
| 1605 | 1605 | |
| 1606 | 1606 | NodeList* nodeList = NodeList::getInstance(); |
| 1607 | 1607 | for (NodeList::iterator node = nodeList->begin(); node != nodeList->end(); node++) { |
| @@ -1748,8 +1748,8 @@ void Application::update(float deltaTime) { · 140 unmodified lines | ||
| 1748 | 1748 | _faceshift.getEstimatedEyePitch(), _faceshift.getEstimatedEyeYaw(), 0.0f))) * glm::vec3(0.0f, 0.0f, -1.0f); |
| 1749 | 1749 | } |
| 1750 | 1750 | |
| 1751 | − _isLookingAtOtherAvatar = isLookingAtOtherAvatar(lookAtRayOrigin, lookAtRayDirection, lookAtSpot); | |
| 1752 | − if (_isLookingAtOtherAvatar) { | |
| 1751 | + _lookatTargetAvatar = findLookatTargetAvatar(lookAtRayOrigin, lookAtRayDirection, lookAtSpot); | |
| 1752 | + if (_lookatTargetAvatar) { | |
| 1753 | 1753 | // If the mouse is over another avatar's head... |
| 1754 | 1754 | _myAvatar.getHead().setLookAtPosition(lookAtSpot); |
| 1755 | 1755 | } else if (_isHoverVoxel && !_faceshift.isActive()) { |
| @@ -2063,15 +2063,15 @@ void Application::updateAvatar(float deltaTime) { · 307 unmodified lines | ||
| 2063 | 2063 | const float MIDPOINT_OF_SCREEN = 0.5; |
| 2064 | 2064 | |
| 2065 | 2065 | // Only use gyro to set lookAt if mouse hasn't selected an avatar |
| 2066 | − if (!_isLookingAtOtherAvatar) { | |
| 2066 | + if (!_lookatTargetAvatar) { | |
| 2067 | 2067 | |
| 2068 | 2068 | // Set lookAtPosition if an avatar is at the center of the screen |
| 2069 | 2069 | glm::vec3 screenCenterRayOrigin, screenCenterRayDirection; |
| 2070 | 2070 | _viewFrustum.computePickRay(MIDPOINT_OF_SCREEN, MIDPOINT_OF_SCREEN, screenCenterRayOrigin, screenCenterRayDirection); |
| 2071 | 2071 | |
| 2072 | 2072 | glm::vec3 eyePosition; |
| 2073 | − _isLookingAtOtherAvatar = isLookingAtOtherAvatar(screenCenterRayOrigin, screenCenterRayDirection, eyePosition); | |
| 2074 | − if (_isLookingAtOtherAvatar) { | |
| 2073 | + _lookatTargetAvatar = findLookatTargetAvatar(screenCenterRayOrigin, screenCenterRayDirection, eyePosition); | |
| 2074 | + if (_lookatTargetAvatar) { | |
| 2075 | 2075 | glm::vec3 myLookAtFromMouse(eyePosition); |
| 2076 | 2076 | _myAvatar.getHead().setLookAtPosition(myLookAtFromMouse); |
| 2077 | 2077 | } |
| @@ -2540,7 +2540,7 @@ void Application::displaySide(Camera& whichCamera) { · 462 unmodified lines | ||
| 2540 | 2540 | Menu::getInstance()->isOptionChecked(MenuOption::AvatarAsBalls)); |
| 2541 | 2541 | _myAvatar.setDisplayingLookatVectors(Menu::getInstance()->isOptionChecked(MenuOption::LookAtVectors)); |
| 2542 | 2542 | |
| 2543 | − if (Menu::getInstance()->isOptionChecked(MenuOption::LookAtIndicator) && _isLookingAtOtherAvatar) { | |
| 2543 | + if (Menu::getInstance()->isOptionChecked(MenuOption::LookAtIndicator) && _lookatTargetAvatar) { | |
| 2544 | 2544 | renderLookatIndicator(_lookatOtherPosition, whichCamera); |
| 2545 | 2545 | } |
| 2546 | 2546 | } |
| @@ -3342,10 +3342,7 @@ void Application::toggleFollowMode() { · 795 unmodified lines | ||
| 3342 | 3342 | mouseRayOrigin, mouseRayDirection); |
| 3343 | 3343 | glm::vec3 eyePositionIgnored; |
| 3344 | 3344 | uint16_t nodeIDIgnored; |
| 3345 | − Avatar* leadingAvatar = isLookingAtOtherAvatar(mouseRayOrigin, | |
| 3346 | − mouseRayDirection, | |
| 3347 | − eyePositionIgnored, | |
| 3348 | − nodeIDIgnored); | |
| 3345 | + Avatar* leadingAvatar = findLookatTargetAvatar(mouseRayOrigin, mouseRayDirection, eyePositionIgnored, nodeIDIgnored); | |
| 3349 | 3346 | |
| 3350 | 3347 | _myAvatar.follow(leadingAvatar); |
| 3351 | 3348 | } |