Showing the changes to interface/src/Application.cpp (1 of 10 files). Show all
Unified · Split
| @@ -1105,9 +1105,24 @@ void Application::mouseMoveEvent(QMouseEvent* event) { · 1104 unmodified lines | ||
| 1105 | 1105 | } |
| 1106 | 1106 | |
| 1107 | 1107 | if (activeWindow() == _window) { |
| 1108 | + int deltaX = event->x() - _mouseX; | |
| 1109 | + int deltaY = event->y() - _mouseY; | |
| 1110 | + | |
| 1108 | 1111 | _mouseX = event->x(); |
| 1109 | 1112 | _mouseY = event->y(); |
| 1110 | 1113 | |
| 1114 | + // orbit behavior | |
| 1115 | + if (_mousePressed && !Menu::getInstance()->isVoxelModeActionChecked()) { | |
| 1116 | + if (_lookatTargetAvatar) { | |
| 1117 | + _myAvatar.orbit(_lookatTargetAvatar->getPosition(), deltaX, deltaY); | |
| 1118 | + return; | |
| 1119 | + } | |
| 1120 | + if (_isHoverVoxel) { | |
| 1121 | + _myAvatar.orbit(glm::vec3(_hoverVoxel.x, _hoverVoxel.y, _hoverVoxel.z) * (float)TREE_SCALE, deltaX, deltaY); | |
| 1122 | + return; | |
| 1123 | + } | |
| 1124 | + } | |
| 1125 | + | |
| 1111 | 1126 | // detect drag |
| 1112 | 1127 | glm::vec3 mouseVoxelPos(_mouseVoxel.x, _mouseVoxel.y, _mouseVoxel.z); |
| 1113 | 1128 | if (!_justEditedVoxel && mouseVoxelPos != _lastMouseVoxelPos) { |
| @@ -1151,7 +1166,8 @@ void Application::mousePressEvent(QMouseEvent* event) { · 37 unmodified lines | ||
| 1151 | 1166 | } |
| 1152 | 1167 | |
| 1153 | 1168 | if (!_palette.isActive() && (!_isHoverVoxel || _lookatTargetAvatar)) { |
| 1154 | − _pieMenu.mousePressEvent(_mouseX, _mouseY); | |
| 1169 | + // disable for now | |
| 1170 | + // _pieMenu.mousePressEvent(_mouseX, _mouseY); | |
| 1155 | 1171 | } |
| 1156 | 1172 | |
| 1157 | 1173 | if (Menu::getInstance()->isOptionChecked(MenuOption::VoxelSelectMode) && _pasteMode) { |
| @@ -1952,7 +1968,9 @@ void Application::updateLookatTargetAvatar(const glm::vec3& mouseRayOrigin, cons · 794 unmodified lines | ||
| 1952 | 1968 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); |
| 1953 | 1969 | PerformanceWarning warn(showWarnings, "Application::updateLookatTargetAvatar()"); |
| 1954 | 1970 | |
| 1955 | − _lookatTargetAvatar = findLookatTargetAvatar(mouseRayOrigin, mouseRayDirection, eyePosition, DEFAULT_NODE_ID_REF); | |
| 1971 | + if (!_mousePressed) { | |
| 1972 | + _lookatTargetAvatar = findLookatTargetAvatar(mouseRayOrigin, mouseRayDirection, eyePosition, DEFAULT_NODE_ID_REF); | |
| 1973 | + } | |
| 1956 | 1974 | } |
| 1957 | 1975 | |
| 1958 | 1976 | Avatar* Application::findLookatTargetAvatar(const glm::vec3& mouseRayOrigin, const glm::vec3& mouseRayDirection, |
| @@ -1961,17 +1979,15 @@ Avatar* Application::findLookatTargetAvatar(const glm::vec3& mouseRayOrigin, con · 2 unmodified lines | ||
| 1961 | 1979 | NodeList* nodeList = NodeList::getInstance(); |
| 1962 | 1980 | for (NodeList::iterator node = nodeList->begin(); node != nodeList->end(); node++) { |
| 1963 | 1981 | if (node->getLinkedData() != NULL && node->getType() == NODE_TYPE_AGENT) { |
| 1964 | − Avatar* avatar = (Avatar *) node->getLinkedData(); | |
| 1965 | − glm::vec3 headPosition = avatar->getHead().getPosition(); | |
| 1982 | + Avatar* avatar = (Avatar*)node->getLinkedData(); | |
| 1966 | 1983 | float distance; |
| 1967 | − if (rayIntersectsSphere(mouseRayOrigin, mouseRayDirection, headPosition, | |
| 1968 | − HEAD_SPHERE_RADIUS * avatar->getHead().getScale(), distance)) { | |
| 1984 | + if (avatar->findRayIntersection(mouseRayOrigin, mouseRayDirection, distance)) { | |
| 1969 | 1985 | // rescale to compensate for head embiggening |
| 1970 | 1986 | eyePosition = (avatar->getHead().calculateAverageEyePosition() - avatar->getHead().getScalePivot()) * |
| 1971 | 1987 | (avatar->getScale() / avatar->getHead().getScale()) + avatar->getHead().getScalePivot(); |
| 1972 | 1988 | |
| 1973 | 1989 | _lookatIndicatorScale = avatar->getHead().getScale(); |
| 1974 | − _lookatOtherPosition = headPosition; | |
| 1990 | + _lookatOtherPosition = avatar->getHead().getPosition(); | |
| 1975 | 1991 | nodeUUID = avatar->getOwningNode()->getUUID(); |
| 1976 | 1992 | return avatar; |
| 1977 | 1993 | } |
| @@ -2213,7 +2229,7 @@ void Application::updateHoverVoxels(float deltaTime, glm::vec3& mouseRayOrigin, · 235 unmodified lines | ||
| 2213 | 2229 | glm::vec4 oldVoxel(_hoverVoxel.x, _hoverVoxel.y, _hoverVoxel.z, _hoverVoxel.s); |
| 2214 | 2230 | // only do this work if MAKE_SOUND_ON_VOXEL_HOVER or MAKE_SOUND_ON_VOXEL_CLICK is enabled, |
| 2215 | 2231 | // and make sure the tree is not already busy... because otherwise you'll have to wait. |
| 2216 | − if (!_voxels.treeIsBusy()) { | |
| 2232 | + if (!(_voxels.treeIsBusy() || _mousePressed)) { | |
| 2217 | 2233 | { |
| 2218 | 2234 | PerformanceWarning warn(showWarnings, "Application::updateHoverVoxels() _voxels.findRayIntersection()"); |
| 2219 | 2235 | _isHoverVoxel = _voxels.findRayIntersection(mouseRayOrigin, mouseRayDirection, _hoverVoxel, distance, face); |